]> gitweb.stoutner.com Git - PrivacyBrowserAndroid.git/blobdiff - app/src/main/java/com/stoutner/privacybrowser/asynctasks/PopulateBlocklists.java
Create a blocklists loading splash screen. https://redmine.stoutner.com/issues/285
[PrivacyBrowserAndroid.git] / app / src / main / java / com / stoutner / privacybrowser / asynctasks / PopulateBlocklists.java
index f732f47534aadcf354cf089bbe160755ba6ec137..f7fa50886569b72c544afe3dac3adca794c61850 100644 (file)
@@ -27,15 +27,16 @@ import android.widget.LinearLayout;
 import android.widget.RelativeLayout;
 import android.widget.TextView;
 
 import android.widget.RelativeLayout;
 import android.widget.TextView;
 
+import androidx.appcompat.widget.Toolbar;
+import androidx.drawerlayout.widget.DrawerLayout;
+
 import com.stoutner.privacybrowser.R;
 import com.stoutner.privacybrowser.R;
-import com.stoutner.privacybrowser.helpers.BlockListHelper;
+import com.stoutner.privacybrowser.helpers.BlocklistHelper;
 
 import java.lang.ref.WeakReference;
 import java.util.ArrayList;
 import java.util.List;
 
 
 import java.lang.ref.WeakReference;
 import java.util.ArrayList;
 import java.util.List;
 
-import androidx.appcompat.widget.Toolbar;
-
 public class PopulateBlocklists extends AsyncTask<Void, String, ArrayList<ArrayList<List<String[]>>>> {
     // The public interface is used to send information back to the parent activity.
     public interface PopulateBlocklistsListener {
 public class PopulateBlocklists extends AsyncTask<Void, String, ArrayList<ArrayList<List<String[]>>>> {
     // The public interface is used to send information back to the parent activity.
     public interface PopulateBlocklistsListener {
@@ -66,7 +67,7 @@ public class PopulateBlocklists extends AsyncTask<Void, String, ArrayList<ArrayL
         Context context = contextWeakReference.get();
 
         // Instantiate the blocklist helper.
         Context context = contextWeakReference.get();
 
         // Instantiate the blocklist helper.
-        BlockListHelper blockListHelper = new BlockListHelper();
+        BlocklistHelper blocklistHelper = new BlocklistHelper();
 
         // Create a combined array list.
         ArrayList<ArrayList<List<String[]>>> combinedBlocklists = new ArrayList<>();
 
         // Create a combined array list.
         ArrayList<ArrayList<List<String[]>>> combinedBlocklists = new ArrayList<>();
@@ -77,35 +78,35 @@ public class PopulateBlocklists extends AsyncTask<Void, String, ArrayList<ArrayL
             publishProgress(context.getString(R.string.loading_easylist));
 
             // Populate EasyList.
             publishProgress(context.getString(R.string.loading_easylist));
 
             // Populate EasyList.
-            ArrayList<List<String[]>> easyList = blockListHelper.parseBlockList(context.getAssets(), "blocklists/easylist.txt");
+            ArrayList<List<String[]>> easyList = blocklistHelper.parseBlocklist(context.getAssets(), "blocklists/easylist.txt");
 
 
             // Update the progress.
             publishProgress(context.getString(R.string.loading_easyprivacy));
 
             // Populate EasyPrivacy.
 
 
             // Update the progress.
             publishProgress(context.getString(R.string.loading_easyprivacy));
 
             // Populate EasyPrivacy.
-            ArrayList<List<String[]>> easyPrivacy = blockListHelper.parseBlockList(context.getAssets(), "blocklists/easyprivacy.txt");
+            ArrayList<List<String[]>> easyPrivacy = blocklistHelper.parseBlocklist(context.getAssets(), "blocklists/easyprivacy.txt");
 
 
             // Update the progress.
             publishProgress(context.getString(R.string.loading_fanboys_annoyance_list));
 
             // Populate Fanboy's Annoyance List.
 
 
             // Update the progress.
             publishProgress(context.getString(R.string.loading_fanboys_annoyance_list));
 
             // Populate Fanboy's Annoyance List.
-            ArrayList<List<String[]>> fanboysAnnoyanceList = blockListHelper.parseBlockList(context.getAssets(), "blocklists/fanboy-annoyance.txt");
+            ArrayList<List<String[]>> fanboysAnnoyanceList = blocklistHelper.parseBlocklist(context.getAssets(), "blocklists/fanboy-annoyance.txt");
 
 
             // Update the progress.
             publishProgress(context.getString(R.string.loading_fanboys_social_blocking_list));
 
             // Populate Fanboy's Social Blocking List.
 
 
             // Update the progress.
             publishProgress(context.getString(R.string.loading_fanboys_social_blocking_list));
 
             // Populate Fanboy's Social Blocking List.
-            ArrayList<List<String[]>> fanboysSocialList = blockListHelper.parseBlockList(context.getAssets(), "blocklists/fanboy-social.txt");
+            ArrayList<List<String[]>> fanboysSocialList = blocklistHelper.parseBlocklist(context.getAssets(), "blocklists/fanboy-social.txt");
 
 
             // Update the progress.
             publishProgress(context.getString(R.string.loading_ultraprivacy));
 
             // Populate UltraPrivacy.
 
 
             // Update the progress.
             publishProgress(context.getString(R.string.loading_ultraprivacy));
 
             // Populate UltraPrivacy.
-            ArrayList<List<String[]>> ultraPrivacy = blockListHelper.parseBlockList(context.getAssets(), "blocklists/ultraprivacy.txt");
+            ArrayList<List<String[]>> ultraPrivacy = blocklistHelper.parseBlocklist(context.getAssets(), "blocklists/ultraprivacy.txt");
 
 
             // Populate the combined array list.
 
 
             // Populate the combined array list.
@@ -149,6 +150,7 @@ public class PopulateBlocklists extends AsyncTask<Void, String, ArrayList<ArrayL
 
         // Get handles for the views.
         Toolbar toolbar = activity.findViewById(R.id.toolbar);
 
         // Get handles for the views.
         Toolbar toolbar = activity.findViewById(R.id.toolbar);
+        DrawerLayout drawerLayout = activity.findViewById(R.id.drawerlayout);
         LinearLayout tabsLinearLayout = activity.findViewById(R.id.tabs_linearlayout);
         RelativeLayout loadingBlocklistsRelativeLayout = activity.findViewById(R.id.loading_blocklists_relativelayout);
 
         LinearLayout tabsLinearLayout = activity.findViewById(R.id.tabs_linearlayout);
         RelativeLayout loadingBlocklistsRelativeLayout = activity.findViewById(R.id.loading_blocklists_relativelayout);
 
@@ -159,7 +161,10 @@ public class PopulateBlocklists extends AsyncTask<Void, String, ArrayList<ArrayL
         // Hide the loading blocklists screen.
         loadingBlocklistsRelativeLayout.setVisibility(View.GONE);
 
         // Hide the loading blocklists screen.
         loadingBlocklistsRelativeLayout.setVisibility(View.GONE);
 
+        // Enable the sliding drawers.
+        drawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED);
+
         // Add the first tab.
         populateBlocklistsListener.finishedPopulatingBlocklists(combinedBlocklists);
     }
         // Add the first tab.
         populateBlocklistsListener.finishedPopulatingBlocklists(combinedBlocklists);
     }
-}
+}
\ No newline at end of file