From 24be5fbba912258f9d1e3d4cd87fb0f20380a6c0 Mon Sep 17 00:00:00 2001 From: cyBerta Date: Wed, 21 Dec 2022 12:36:02 +0100 Subject: remove dead code related to deprecated Android versions --- .../base/fragments/SettingsFragment.java | 22 ++++++++++------------ .../leap/bitmaskclient/base/utils/ViewHelper.java | 10 ++++------ .../se/leap/bitmaskclient/eip/VoidVpnService.java | 9 ++------- .../activities/ConfigWizardBaseActivity.java | 11 ----------- 4 files changed, 16 insertions(+), 36 deletions(-) (limited to 'app/src/main/java/se/leap/bitmaskclient') diff --git a/app/src/main/java/se/leap/bitmaskclient/base/fragments/SettingsFragment.java b/app/src/main/java/se/leap/bitmaskclient/base/fragments/SettingsFragment.java index d5bbd2c5..d57d725e 100644 --- a/app/src/main/java/se/leap/bitmaskclient/base/fragments/SettingsFragment.java +++ b/app/src/main/java/se/leap/bitmaskclient/base/fragments/SettingsFragment.java @@ -174,19 +174,17 @@ public class SettingsFragment extends Fragment implements SharedPreferences.OnSh } private void initExcludeAppsEntry(View rootView) { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { - IconTextEntry excludeApps = rootView.findViewById(R.id.exclude_apps); - excludeApps.setVisibility(VISIBLE); - Set apps = PreferenceHelper.getExcludedApps(this.getContext()); - if (apps != null) { - updateExcludeAppsSubtitle(excludeApps, apps.size()); - } - FragmentManagerEnhanced fragmentManager = new FragmentManagerEnhanced(getActivity().getSupportFragmentManager()); - excludeApps.setOnClickListener((buttonView) -> { - Fragment fragment = new ExcludeAppsFragment(); - fragmentManager.replace(R.id.main_container, fragment, MainActivity.TAG); - }); + IconTextEntry excludeApps = rootView.findViewById(R.id.exclude_apps); + excludeApps.setVisibility(VISIBLE); + Set apps = PreferenceHelper.getExcludedApps(this.getContext()); + if (apps != null) { + updateExcludeAppsSubtitle(excludeApps, apps.size()); } + FragmentManagerEnhanced fragmentManager = new FragmentManagerEnhanced(getActivity().getSupportFragmentManager()); + excludeApps.setOnClickListener((buttonView) -> { + Fragment fragment = new ExcludeAppsFragment(); + fragmentManager.replace(R.id.main_container, fragment, MainActivity.TAG); + }); } private void updateExcludeAppsSubtitle(IconTextEntry excludeApps, int number) { diff --git a/app/src/main/java/se/leap/bitmaskclient/base/utils/ViewHelper.java b/app/src/main/java/se/leap/bitmaskclient/base/utils/ViewHelper.java index 8f4d7862..51bcb2b1 100644 --- a/app/src/main/java/se/leap/bitmaskclient/base/utils/ViewHelper.java +++ b/app/src/main/java/se/leap/bitmaskclient/base/utils/ViewHelper.java @@ -96,12 +96,10 @@ public class ViewHelper { } int color = ContextCompat.getColor(activity, secondaryColor); bar.setBackgroundDrawable(new ColorDrawable(color)); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { - Window window = activity.getWindow(); - window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); - window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); - window.setStatusBarColor(ContextCompat.getColor(activity, primaryColor)); - } + Window window = activity.getWindow(); + window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); + window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); + window.setStatusBarColor(ContextCompat.getColor(activity, primaryColor)); int actionBarTextColor; if (textColor == 0) { diff --git a/app/src/main/java/se/leap/bitmaskclient/eip/VoidVpnService.java b/app/src/main/java/se/leap/bitmaskclient/eip/VoidVpnService.java index 645d7b26..b5d4a353 100644 --- a/app/src/main/java/se/leap/bitmaskclient/eip/VoidVpnService.java +++ b/app/src/main/java/se/leap/bitmaskclient/eip/VoidVpnService.java @@ -154,15 +154,12 @@ public class VoidVpnService extends VpnService implements Observer, VpnNotificat builder.addRoute("::",0); builder.addAddress("fc00::", 7); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { - allowAllAFFamilies(builder); - } + allowAllAFFamilies(builder); return builder; } - @TargetApi(Build.VERSION_CODES.LOLLIPOP) private void allowAllAFFamilies(Builder builder) { builder.allowFamily(OsConstants.AF_INET); builder.allowFamily(OsConstants.AF_INET6); @@ -174,9 +171,7 @@ public class VoidVpnService extends VpnService implements Observer, VpnNotificat VpnStatus.updateStateString(STATE_ESTABLISH, "", R.string.void_vpn_establish, ConnectionStatus.LEVEL_BLOCKING); Builder builder = prepareBlockingVpnProfile(); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { - builder.addDisallowedApplication(getPackageName()); - } + builder.addDisallowedApplication(getPackageName()); fd = builder.establish(); } catch (Exception e) { diff --git a/app/src/main/java/se/leap/bitmaskclient/providersetup/activities/ConfigWizardBaseActivity.java b/app/src/main/java/se/leap/bitmaskclient/providersetup/activities/ConfigWizardBaseActivity.java index aaf20647..5cfefb2e 100644 --- a/app/src/main/java/se/leap/bitmaskclient/providersetup/activities/ConfigWizardBaseActivity.java +++ b/app/src/main/java/se/leap/bitmaskclient/providersetup/activities/ConfigWizardBaseActivity.java @@ -161,7 +161,6 @@ public abstract class ConfigWizardBaseActivity extends ButterKnifeActivity imple if (provider != null) { setProviderHeaderText(provider.getName()); } - setProgressbarColorForPreLollipop(); setDefaultGuidelineValues(); setGlobalLayoutChangeListener(); } @@ -173,16 +172,6 @@ public abstract class ConfigWizardBaseActivity extends ButterKnifeActivity imple } } - private void setProgressbarColorForPreLollipop() { - if (progressBar == null || Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { - return; - } - progressBar.getIndeterminateDrawable().setColorFilter( - ContextCompat.getColor(this, R.color.colorPrimary), - PorterDuff.Mode.SRC_IN); - } - - @Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); -- cgit v1.2.3