diff options
author | cyberta <cyberta@riseup.net> | 2021-11-25 02:14:08 +0000 |
---|---|---|
committer | cyberta <cyberta@riseup.net> | 2021-11-25 02:14:08 +0000 |
commit | 5a2ff7c85f13fe2e875e4ca7ec4192df0e896d01 (patch) | |
tree | e74b21e0b9e24b5b8774598142b343aa56a7070c /app/src/main/java/se/leap/bitmaskclient/base/fragments/ExcludeAppsFragment.java | |
parent | 68ca9c827da3c3fad9e70c74960f113560fd6711 (diff) | |
parent | 6fb2050aaf6e992bf96d41c5f6b19f5c1a3771c3 (diff) |
Merge branch 'preferences_ui' into 'master'
Preferences ui
See merge request leap/bitmask_android!145
Diffstat (limited to 'app/src/main/java/se/leap/bitmaskclient/base/fragments/ExcludeAppsFragment.java')
-rw-r--r-- | app/src/main/java/se/leap/bitmaskclient/base/fragments/ExcludeAppsFragment.java | 32 |
1 files changed, 13 insertions, 19 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/base/fragments/ExcludeAppsFragment.java b/app/src/main/java/se/leap/bitmaskclient/base/fragments/ExcludeAppsFragment.java index 04745d42..f5d7f286 100644 --- a/app/src/main/java/se/leap/bitmaskclient/base/fragments/ExcludeAppsFragment.java +++ b/app/src/main/java/se/leap/bitmaskclient/base/fragments/ExcludeAppsFragment.java @@ -20,13 +20,15 @@ import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.BaseAdapter; -import android.widget.CompoundButton; import android.widget.Filter; import android.widget.Filterable; import android.widget.ImageView; import android.widget.ListView; import android.widget.SearchView; +import androidx.annotation.StringRes; +import androidx.appcompat.app.ActionBar; +import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.widget.AppCompatTextView; import androidx.fragment.app.Fragment; @@ -41,6 +43,8 @@ import se.leap.bitmaskclient.R; import se.leap.bitmaskclient.base.utils.PreferenceHelper; import se.leap.bitmaskclient.base.views.SimpleCheckBox; +import static se.leap.bitmaskclient.R.string.exclude_apps_fragment_title; + /** * Created by arne on 16.11.14. */ @@ -51,20 +55,6 @@ public class ExcludeAppsFragment extends Fragment implements AdapterView.OnItemC private Set<String> apps; - public interface ExcludedAppsCallback { - void onAppsExcluded(int number); - } - - private ExcludedAppsCallback callback; - - @Override - public void onAttach(Context context) { - super.onAttach(context); - if (context instanceof ExcludedAppsCallback) { - callback = (ExcludedAppsCallback) context; - } - } - @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { AppViewHolder avh = (AppViewHolder) view.getTag(); @@ -120,10 +110,6 @@ public class ExcludeAppsFragment extends Fragment implements AdapterView.OnItemC Log.d("openvpn", "removing from allowed apps" + packageName); apps.remove(packageName); } - - if (callback != null) { - callback.onAppsExcluded(apps.size()); - } } class PackageAdapter extends BaseAdapter implements Filterable { @@ -328,10 +314,18 @@ public class ExcludeAppsFragment extends Fragment implements AdapterView.OnItemC mListView.setOnItemClickListener(this); mListView.setEmptyView(v.findViewById(R.id.loading_container)); + setActionBarTitle(exclude_apps_fragment_title); new Thread(() -> mListAdapter.populateList(getActivity())).start(); return v; } + private void setActionBarTitle(@StringRes int stringId) { + ActionBar actionBar = ((AppCompatActivity) getActivity()).getSupportActionBar(); + if (actionBar != null) { + actionBar.setSubtitle(stringId); + } + } + } |