|
|
@ -93,6 +93,7 @@ public class FragmentOptionsSynchronize extends FragmentBase implements SharedPr
|
|
|
|
private SwitchCompat swCheckBlocklist;
|
|
|
|
private SwitchCompat swCheckBlocklist;
|
|
|
|
private SwitchCompat swUseBlocklist;
|
|
|
|
private SwitchCompat swUseBlocklist;
|
|
|
|
private RecyclerView rvBlocklist;
|
|
|
|
private RecyclerView rvBlocklist;
|
|
|
|
|
|
|
|
private AdapterBlocklist badapter;
|
|
|
|
|
|
|
|
|
|
|
|
private Group grpExempted;
|
|
|
|
private Group grpExempted;
|
|
|
|
|
|
|
|
|
|
|
@ -379,6 +380,8 @@ public class FragmentOptionsSynchronize extends FragmentBase implements SharedPr
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
prefs.edit().putBoolean("check_blocklist", checked).apply();
|
|
|
|
prefs.edit().putBoolean("check_blocklist", checked).apply();
|
|
|
|
swUseBlocklist.setEnabled(checked);
|
|
|
|
swUseBlocklist.setEnabled(checked);
|
|
|
|
|
|
|
|
if (badapter != null)
|
|
|
|
|
|
|
|
badapter.enabledChanged();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
@ -391,7 +394,7 @@ public class FragmentOptionsSynchronize extends FragmentBase implements SharedPr
|
|
|
|
|
|
|
|
|
|
|
|
rvBlocklist.setHasFixedSize(false);
|
|
|
|
rvBlocklist.setHasFixedSize(false);
|
|
|
|
rvBlocklist.setLayoutManager(new LinearLayoutManager(getContext()));
|
|
|
|
rvBlocklist.setLayoutManager(new LinearLayoutManager(getContext()));
|
|
|
|
AdapterBlocklist badapter = new AdapterBlocklist(getContext(), DnsBlockList.getListsAvailable());
|
|
|
|
badapter = new AdapterBlocklist(getContext(), DnsBlockList.getListsAvailable());
|
|
|
|
rvBlocklist.setAdapter(badapter);
|
|
|
|
rvBlocklist.setAdapter(badapter);
|
|
|
|
|
|
|
|
|
|
|
|
// Initialize
|
|
|
|
// Initialize
|
|
|
@ -679,6 +682,7 @@ public class FragmentOptionsSynchronize extends FragmentBase implements SharedPr
|
|
|
|
private Context context;
|
|
|
|
private Context context;
|
|
|
|
private LayoutInflater inflater;
|
|
|
|
private LayoutInflater inflater;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private boolean enabled;
|
|
|
|
private List<DnsBlockList.BlockList> items;
|
|
|
|
private List<DnsBlockList.BlockList> items;
|
|
|
|
|
|
|
|
|
|
|
|
public class ViewHolder extends RecyclerView.ViewHolder implements CompoundButton.OnCheckedChangeListener {
|
|
|
|
public class ViewHolder extends RecyclerView.ViewHolder implements CompoundButton.OnCheckedChangeListener {
|
|
|
@ -700,6 +704,7 @@ public class FragmentOptionsSynchronize extends FragmentBase implements SharedPr
|
|
|
|
private void bindTo(DnsBlockList.BlockList blocklist) {
|
|
|
|
private void bindTo(DnsBlockList.BlockList blocklist) {
|
|
|
|
cbEnabled.setText(blocklist.name);
|
|
|
|
cbEnabled.setText(blocklist.name);
|
|
|
|
cbEnabled.setChecked(DnsBlockList.isEnabled(context, blocklist));
|
|
|
|
cbEnabled.setChecked(DnsBlockList.isEnabled(context, blocklist));
|
|
|
|
|
|
|
|
cbEnabled.setEnabled(enabled);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
@ -719,6 +724,13 @@ public class FragmentOptionsSynchronize extends FragmentBase implements SharedPr
|
|
|
|
|
|
|
|
|
|
|
|
setHasStableIds(true);
|
|
|
|
setHasStableIds(true);
|
|
|
|
this.items = items;
|
|
|
|
this.items = items;
|
|
|
|
|
|
|
|
enabledChanged();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void enabledChanged() {
|
|
|
|
|
|
|
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
|
|
|
|
|
|
|
this.enabled = prefs.getBoolean("check_blocklist", false);
|
|
|
|
|
|
|
|
notifyDataSetChanged();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|