diff options
author | cyberta <cyberta@riseup.net> | 2020-12-29 19:24:27 -0800 |
---|---|---|
committer | cyberta <cyberta@riseup.net> | 2020-12-29 19:24:27 -0800 |
commit | f03c21446566546e66c977c72c16fdb87f16ffed (patch) | |
tree | 4e3d7c5561e963504553ee941cc258b6b2b06d14 /app/src/main/java/se/leap | |
parent | fd81f2e14e36adb59d534df257e6ba2262cc362f (diff) | |
parent | 9b690df036cf91f749c0b6159a7035233a73315d (diff) |
Merge branch 'update_android_10' into 'master'
Update android 10
See merge request leap/bitmask_android!118
Diffstat (limited to 'app/src/main/java/se/leap')
17 files changed, 172 insertions, 134 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/base/fragments/AboutFragment.java b/app/src/main/java/se/leap/bitmaskclient/base/fragments/AboutFragment.java index d901ba68..c269c872 100644 --- a/app/src/main/java/se/leap/bitmaskclient/base/fragments/AboutFragment.java +++ b/app/src/main/java/se/leap/bitmaskclient/base/fragments/AboutFragment.java @@ -3,14 +3,16 @@ package se.leap.bitmaskclient.base.fragments; import android.content.pm.PackageInfo; import android.content.pm.PackageManager.NameNotFoundException; import android.os.Bundle; -import androidx.fragment.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; +import androidx.fragment.app.Fragment; + +import butterknife.BindView; import butterknife.ButterKnife; -import butterknife.InjectView; +import butterknife.Unbinder; import se.leap.bitmaskclient.BuildConfig; import se.leap.bitmaskclient.R; @@ -20,17 +22,18 @@ public class AboutFragment extends Fragment { final public static String TAG = AboutFragment.class.getSimpleName(); final public static int VIEWED = 0; + private Unbinder unbinder; - @InjectView(R.id.version) + @BindView(R.id.version) TextView versionTextView; - @InjectView(R.id.terms_of_service) + @BindView(R.id.terms_of_service) TextView termsOfService; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.f_about, container, false); - ButterKnife.inject(this, view); + unbinder = ButterKnife.bind(this, view); return view; } @@ -56,6 +59,12 @@ public class AboutFragment extends Fragment { } } + @Override + public void onDestroyView() { + super.onDestroyView(); + unbinder.unbind(); + } + private boolean hasTermsOfServiceResource() { return getTermsOfServiceResource() != 0; } diff --git a/app/src/main/java/se/leap/bitmaskclient/base/fragments/AlwaysOnDialog.java b/app/src/main/java/se/leap/bitmaskclient/base/fragments/AlwaysOnDialog.java index a8034e1a..7d457406 100644 --- a/app/src/main/java/se/leap/bitmaskclient/base/fragments/AlwaysOnDialog.java +++ b/app/src/main/java/se/leap/bitmaskclient/base/fragments/AlwaysOnDialog.java @@ -4,17 +4,19 @@ import android.app.Dialog; import android.content.Intent; import android.os.Build; import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.View; +import android.widget.CheckBox; + import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AppCompatDialogFragment; import androidx.appcompat.widget.AppCompatTextView; -import android.view.LayoutInflater; -import android.view.View; -import android.widget.CheckBox; +import butterknife.BindView; import butterknife.ButterKnife; -import butterknife.InjectView; +import butterknife.Unbinder; import se.leap.bitmaskclient.R; import se.leap.bitmaskclient.base.views.IconTextView; @@ -31,15 +33,17 @@ public class AlwaysOnDialog extends AppCompatDialogFragment { public final static String TAG = AlwaysOnDialog.class.getName(); - @InjectView(R.id.do_not_show_again) + @BindView(R.id.do_not_show_again) CheckBox doNotShowAgainCheckBox; - @InjectView(R.id.user_message) + @BindView(R.id.user_message) IconTextView userMessage; - @InjectView(R.id.block_vpn_user_message) + @BindView(R.id.block_vpn_user_message) AppCompatTextView blockVpnUserMessage; + private Unbinder unbinder; + @Override public void onCreate(@Nullable Bundle savedInstanceState) { @@ -52,7 +56,7 @@ public class AlwaysOnDialog extends AppCompatDialogFragment { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); LayoutInflater inflater = getActivity().getLayoutInflater(); View view = inflater.inflate(R.layout.d_checkbox_confirm, null); - ButterKnife.inject(this, view); + unbinder = ButterKnife.bind(this, view); userMessage.setIcon(R.drawable.ic_settings); userMessage.setText(getString(R.string.always_on_vpn_user_message)); @@ -73,4 +77,10 @@ public class AlwaysOnDialog extends AppCompatDialogFragment { .setNegativeButton(R.string.cancel, (dialog, id) -> dialog.cancel()); return builder.create(); } + + @Override + public void onDestroyView() { + super.onDestroyView(); + unbinder.unbind(); + } } diff --git a/app/src/main/java/se/leap/bitmaskclient/base/fragments/DonationReminderDialog.java b/app/src/main/java/se/leap/bitmaskclient/base/fragments/DonationReminderDialog.java index 0277933c..c39386fc 100644 --- a/app/src/main/java/se/leap/bitmaskclient/base/fragments/DonationReminderDialog.java +++ b/app/src/main/java/se/leap/bitmaskclient/base/fragments/DonationReminderDialog.java @@ -6,19 +6,21 @@ import android.content.Context; import android.content.Intent; import android.net.Uri; import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.appcompat.app.AlertDialog; -import androidx.appcompat.app.AppCompatDialogFragment; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.widget.Button; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.appcompat.app.AlertDialog; +import androidx.appcompat.app.AppCompatDialogFragment; + import java.text.ParseException; +import butterknife.BindView; import butterknife.ButterKnife; -import butterknife.InjectView; +import butterknife.Unbinder; import se.leap.bitmaskclient.R; import se.leap.bitmaskclient.base.utils.DateHelper; import se.leap.bitmaskclient.base.utils.PreferenceHelper; @@ -35,12 +37,14 @@ public class DonationReminderDialog extends AppCompatDialogFragment { public final static String TAG = DonationReminderDialog.class.getName(); private static boolean isShown = false; - @InjectView(R.id.btnDonate) + @BindView(R.id.btnDonate) Button btnDonate; - @InjectView(R.id.btnLater) + @BindView(R.id.btnLater) Button btnLater; + private Unbinder unbinder; + @Override public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -52,7 +56,7 @@ public class DonationReminderDialog extends AppCompatDialogFragment { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); LayoutInflater inflater = getActivity().getLayoutInflater(); View view = inflater.inflate(R.layout.donation_reminder_dialog, null); - ButterKnife.inject(this, view); + unbinder = ButterKnife.bind(this, view); isShown = true; builder.setView(view); @@ -76,6 +80,12 @@ public class DonationReminderDialog extends AppCompatDialogFragment { return builder.create(); } + @Override + public void onDestroyView() { + super.onDestroyView(); + unbinder.unbind(); + } + public static boolean isCallable(Context context) { if (isShown) { return false; diff --git a/app/src/main/java/se/leap/bitmaskclient/base/fragments/EipFragment.java b/app/src/main/java/se/leap/bitmaskclient/base/fragments/EipFragment.java index 9544fb1e..d8501a92 100644 --- a/app/src/main/java/se/leap/bitmaskclient/base/fragments/EipFragment.java +++ b/app/src/main/java/se/leap/bitmaskclient/base/fragments/EipFragment.java @@ -48,9 +48,10 @@ import androidx.fragment.app.FragmentTransaction; import java.util.Observable; import java.util.Observer; +import butterknife.BindView; import butterknife.ButterKnife; -import butterknife.InjectView; import butterknife.OnClick; +import butterknife.Unbinder; import de.blinkt.openvpn.core.IOpenVPNServiceInternal; import de.blinkt.openvpn.core.OpenVPNService; import de.blinkt.openvpn.core.VpnStatus; @@ -97,23 +98,22 @@ public class EipFragment extends Fragment implements Observer { private SharedPreferences preferences; private Provider provider; - @InjectView(R.id.background) + @BindView(R.id.background) AppCompatImageView background; - @InjectView(R.id.vpn_state_image) + @BindView(R.id.vpn_state_image) VpnStateImage vpnStateImage; - @InjectView(R.id.vpn_main_button) + @BindView(R.id.vpn_main_button) AppCompatButton mainButton; - @InjectView(R.id.routed_text) + @BindView(R.id.routed_text) AppCompatTextView routedText; - @InjectView(R.id.vpn_route) + @BindView(R.id.vpn_route) AppCompatTextView vpnRoute; - - + private Unbinder unbinder; private EipStatus eipStatus; //---saved Instance ------- @@ -157,8 +157,6 @@ public class EipFragment extends Fragment implements Observer { } - - @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -176,7 +174,7 @@ public class EipFragment extends Fragment implements Observer { public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { eipStatus.addObserver(this); View view = inflater.inflate(R.layout.f_eip, container, false); - ButterKnife.inject(this, view); + unbinder = ButterKnife.bind(this, view); Bundle arguments = getArguments(); if (arguments != null && arguments.containsKey(ASK_TO_CANCEL_VPN) && arguments.getBoolean(ASK_TO_CANCEL_VPN)) { @@ -241,6 +239,7 @@ public class EipFragment extends Fragment implements Observer { public void onDestroyView() { super.onDestroyView(); eipStatus.deleteObserver(this); + unbinder.unbind(); } private void saveStatus(boolean restartOnBoot) { diff --git a/app/src/main/java/se/leap/bitmaskclient/base/fragments/TetheringDialog.java b/app/src/main/java/se/leap/bitmaskclient/base/fragments/TetheringDialog.java index 8593e25c..675f1a61 100644 --- a/app/src/main/java/se/leap/bitmaskclient/base/fragments/TetheringDialog.java +++ b/app/src/main/java/se/leap/bitmaskclient/base/fragments/TetheringDialog.java @@ -7,12 +7,6 @@ import android.content.Intent; import android.graphics.drawable.Drawable; import android.os.Bundle; import android.provider.Settings; -import androidx.annotation.NonNull; -import androidx.appcompat.app.AlertDialog; -import androidx.appcompat.app.AppCompatDialogFragment; -import androidx.appcompat.widget.AppCompatTextView; -import androidx.recyclerview.widget.LinearLayoutManager; -import androidx.recyclerview.widget.RecyclerView; import android.text.Spannable; import android.text.SpannableString; import android.text.method.LinkMovementMethod; @@ -22,19 +16,27 @@ import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import androidx.annotation.NonNull; +import androidx.appcompat.app.AlertDialog; +import androidx.appcompat.app.AppCompatDialogFragment; +import androidx.appcompat.widget.AppCompatTextView; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; + import java.util.Observable; import java.util.Observer; import java.util.regex.Matcher; import java.util.regex.Pattern; +import butterknife.BindView; import butterknife.ButterKnife; -import butterknife.InjectView; +import butterknife.Unbinder; import de.blinkt.openvpn.core.VpnStatus; import se.leap.bitmaskclient.R; -import se.leap.bitmaskclient.firewall.FirewallManager; -import se.leap.bitmaskclient.tethering.TetheringObservable; import se.leap.bitmaskclient.base.utils.PreferenceHelper; import se.leap.bitmaskclient.base.views.IconCheckboxEntry; +import se.leap.bitmaskclient.firewall.FirewallManager; +import se.leap.bitmaskclient.tethering.TetheringObservable; /** * Copyright (c) 2020 LEAP Encryption Access Project and contributers @@ -57,16 +59,17 @@ public class TetheringDialog extends AppCompatDialogFragment implements Observer public final static String TAG = TetheringDialog.class.getName(); - @InjectView(R.id.tvTitle) + @BindView(R.id.tvTitle) AppCompatTextView title; - @InjectView(R.id.user_message) + @BindView(R.id.user_message) AppCompatTextView userMessage; - @InjectView(R.id.selection_list_view) + @BindView(R.id.selection_list_view) RecyclerView selectionListView; DialogListAdapter adapter; private DialogListAdapter.ViewModel[] dataset; + private Unbinder unbinder; public static class DialogListAdapter extends RecyclerView.Adapter<DialogListAdapter.ViewHolder> { @@ -137,7 +140,7 @@ public class TetheringDialog extends AppCompatDialogFragment implements Observer AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); LayoutInflater inflater = getActivity().getLayoutInflater(); View view = inflater.inflate(R.layout.d_list_selection, null); - ButterKnife.inject(this, view); + unbinder = ButterKnife.bind(this, view); title.setText(R.string.tethering); userMessage.setMovementMethod(LinkMovementMethod.getInstance()); @@ -187,6 +190,12 @@ public class TetheringDialog extends AppCompatDialogFragment implements Observer TetheringObservable.getInstance().deleteObserver(this); } + @Override + public void onDestroyView() { + super.onDestroyView(); + unbinder.unbind(); + } + public void onItemClick(DialogListAdapter.ViewModel item) { } diff --git a/app/src/main/java/se/leap/bitmaskclient/base/views/IconCheckboxEntry.java b/app/src/main/java/se/leap/bitmaskclient/base/views/IconCheckboxEntry.java index fdbd7dbd..977056f7 100644 --- a/app/src/main/java/se/leap/bitmaskclient/base/views/IconCheckboxEntry.java +++ b/app/src/main/java/se/leap/bitmaskclient/base/views/IconCheckboxEntry.java @@ -3,31 +3,32 @@ package se.leap.bitmaskclient.base.views; import android.annotation.TargetApi; import android.content.Context; import android.graphics.drawable.Drawable; -import androidx.annotation.Nullable; -import androidx.core.content.ContextCompat; -import androidx.core.graphics.drawable.DrawableCompat; -import androidx.appcompat.widget.AppCompatImageView; import android.util.AttributeSet; import android.view.LayoutInflater; import android.view.View; import android.widget.LinearLayout; import android.widget.TextView; +import androidx.annotation.Nullable; +import androidx.appcompat.widget.AppCompatImageView; +import androidx.core.content.ContextCompat; +import androidx.core.graphics.drawable.DrawableCompat; + +import butterknife.BindView; import butterknife.ButterKnife; -import butterknife.InjectView; import se.leap.bitmaskclient.R; import se.leap.bitmaskclient.base.fragments.TetheringDialog; public class IconCheckboxEntry extends LinearLayout { - @InjectView(android.R.id.text1) + @BindView(android.R.id.text1) TextView textView; - @InjectView(R.id.material_icon) + @BindView(R.id.material_icon) AppCompatImageView iconView; - @InjectView(R.id.checked_icon) + @BindView(R.id.checked_icon) AppCompatImageView checkedIcon; public IconCheckboxEntry(Context context) { @@ -55,10 +56,7 @@ public class IconCheckboxEntry extends LinearLayout { LayoutInflater inflater = (LayoutInflater) context .getSystemService(Context.LAYOUT_INFLATER_SERVICE); View rootview = inflater.inflate(R.layout.v_icon_select_text_list_item, this, true); - ButterKnife.inject(this, rootview); - - - + ButterKnife.bind(this, rootview); } public void bind(TetheringDialog.DialogListAdapter.ViewModel model) { diff --git a/app/src/main/java/se/leap/bitmaskclient/eip/EipCommand.java b/app/src/main/java/se/leap/bitmaskclient/eip/EipCommand.java index 39d4e33e..0650e8cd 100644 --- a/app/src/main/java/se/leap/bitmaskclient/eip/EipCommand.java +++ b/app/src/main/java/se/leap/bitmaskclient/eip/EipCommand.java @@ -6,11 +6,9 @@ import android.content.Intent; import android.os.ResultReceiver; import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import androidx.annotation.VisibleForTesting; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - import static se.leap.bitmaskclient.base.models.Constants.EIP_ACTION_CHECK_CERT_VALIDITY; import static se.leap.bitmaskclient.base.models.Constants.EIP_ACTION_CONFIGURE_TETHERING; import static se.leap.bitmaskclient.base.models.Constants.EIP_ACTION_START; @@ -26,7 +24,7 @@ import static se.leap.bitmaskclient.base.models.Constants.EIP_RECEIVER; public class EipCommand { - private static void execute(@NotNull Context context, @NotNull String action) { + private static void execute(@NonNull Context context, @NonNull String action) { execute(context.getApplicationContext(), action, null, null); } @@ -37,7 +35,7 @@ public class EipCommand { * filter for the EIP class * @param resultReceiver The resultreceiver to reply to */ - private static void execute(@NotNull Context context, @NotNull String action, @Nullable ResultReceiver resultReceiver, @Nullable Intent vpnIntent) { + private static void execute(@NonNull Context context, @NonNull String action, @Nullable ResultReceiver resultReceiver, @Nullable Intent vpnIntent) { if (vpnIntent == null) { vpnIntent = new Intent(); } diff --git a/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderAPICommand.java b/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderAPICommand.java index 79a107d1..1408dce8 100644 --- a/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderAPICommand.java +++ b/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderAPICommand.java @@ -5,8 +5,8 @@ import android.content.Intent; import android.os.Bundle; import android.os.ResultReceiver; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import se.leap.bitmaskclient.base.models.Constants; import se.leap.bitmaskclient.base.models.Provider; @@ -20,18 +20,18 @@ public class ProviderAPICommand { private ResultReceiver resultReceiver; private Provider provider; - private ProviderAPICommand(@NotNull Context context, @NotNull String action, @NotNull Provider provider, ResultReceiver resultReceiver) { + private ProviderAPICommand(@NonNull Context context, @NonNull String action, @NonNull Provider provider, ResultReceiver resultReceiver) { this(context.getApplicationContext(), action, Bundle.EMPTY, provider, resultReceiver); } - private ProviderAPICommand(@NotNull Context context, @NotNull String action, @NotNull Provider provider) { + private ProviderAPICommand(@NonNull Context context, @NonNull String action, @NonNull Provider provider) { this(context.getApplicationContext(), action, Bundle.EMPTY, provider); } - private ProviderAPICommand(@NotNull Context context, @NotNull String action, @NotNull Bundle parameters, @NotNull Provider provider) { + private ProviderAPICommand(@NonNull Context context, @NonNull String action, @NonNull Bundle parameters, @NonNull Provider provider) { this(context.getApplicationContext(), action, parameters, provider, null); } - private ProviderAPICommand(@NotNull Context context, @NotNull String action, @NotNull Bundle parameters, @NotNull Provider provider, @Nullable ResultReceiver resultReceiver) { + private ProviderAPICommand(@NonNull Context context, @NonNull String action, @NonNull Bundle parameters, @NonNull Provider provider, @Nullable ResultReceiver resultReceiver) { super(); this.context = context; this.action = action; @@ -64,22 +64,22 @@ public class ProviderAPICommand { return command; } - public static void execute(Context context, String action, @NotNull Provider provider) { + public static void execute(Context context, String action, @NonNull Provider provider) { ProviderAPICommand command = new ProviderAPICommand(context, action, provider); command.execute(); } - public static void execute(Context context, String action, Bundle parameters, @NotNull Provider provider) { + public static void execute(Context context, String action, Bundle parameters, @NonNull Provider provider) { ProviderAPICommand command = new ProviderAPICommand(context, action, parameters, provider); command.execute(); } - public static void execute(Context context, String action, Bundle parameters, @NotNull Provider provider, ResultReceiver resultReceiver) { + public static void execute(Context context, String action, Bundle parameters, @NonNull Provider provider, ResultReceiver resultReceiver) { ProviderAPICommand command = new ProviderAPICommand(context, action, parameters, provider, resultReceiver); command.execute(); } - public static void execute(Context context, String action, @NotNull Provider provider, ResultReceiver resultReceiver) { + public static void execute(Context context, String action, @NonNull Provider provider, ResultReceiver resultReceiver) { ProviderAPICommand command = new ProviderAPICommand(context, action, provider, resultReceiver); command.execute(); } diff --git a/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderRenderer.java b/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderRenderer.java index 52ee4656..339199e0 100644 --- a/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderRenderer.java +++ b/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderRenderer.java @@ -1,14 +1,17 @@ package se.leap.bitmaskclient.providersetup; -import android.content.*; -import android.view.*; -import android.widget.*; +import android.content.Context; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.TextView; -import com.pedrogomez.renderers.*; +import com.pedrogomez.renderers.Renderer; -import butterknife.*; -import se.leap.bitmaskclient.base.models.Provider; +import butterknife.BindView; +import butterknife.ButterKnife; import se.leap.bitmaskclient.R; +import se.leap.bitmaskclient.base.models.Provider; /** * Created by parmegv on 4/12/14. @@ -16,9 +19,9 @@ import se.leap.bitmaskclient.R; public class ProviderRenderer extends Renderer<Provider> { private final Context context; - @InjectView(R.id.provider_name) + @BindView(R.id.provider_name) TextView name; - @InjectView(R.id.provider_domain) + @BindView(R.id.provider_domain) TextView domain; public ProviderRenderer(Context context) { @@ -28,7 +31,7 @@ public class ProviderRenderer extends Renderer<Provider> { @Override protected View inflate(LayoutInflater inflater, ViewGroup parent) { View view = inflater.inflate(R.layout.v_provider_list_item, parent, false); - ButterKnife.inject(this, view); + ButterKnife.bind(this, view); return view; } diff --git a/app/src/main/java/se/leap/bitmaskclient/providersetup/activities/AbstractProviderDetailActivity.java b/app/src/main/java/se/leap/bitmaskclient/providersetup/activities/AbstractProviderDetailActivity.java index b7325e03..ba84ed9a 100644 --- a/app/src/main/java/se/leap/bitmaskclient/providersetup/activities/AbstractProviderDetailActivity.java +++ b/app/src/main/java/se/leap/bitmaskclient/providersetup/activities/AbstractProviderDetailActivity.java @@ -11,7 +11,8 @@ import android.widget.TextView; import java.util.ArrayList; -import butterknife.InjectView; + +import butterknife.BindView; import se.leap.bitmaskclient.base.models.Provider; import se.leap.bitmaskclient.R; @@ -22,10 +23,10 @@ public abstract class AbstractProviderDetailActivity extends ConfigWizardBaseAct final public static String TAG = "providerDetailActivity"; - @InjectView(R.id.provider_detail_description) + @BindView(R.id.provider_detail_description) AppCompatTextView description; - @InjectView(R.id.provider_detail_options) + @BindView(R.id.provider_detail_options) ListView options; @Override @@ -39,7 +40,6 @@ public abstract class AbstractProviderDetailActivity extends ConfigWizardBaseAct return; } - setProviderHeaderText(provider.getName()); description.setText(provider.getDescription()); @@ -55,7 +55,6 @@ public abstract class AbstractProviderDetailActivity extends ConfigWizardBaseAct onAnonymouslySelected(); } - options.setAdapter(new ArrayAdapter<>( this, R.layout.v_single_list_item, diff --git a/app/src/main/java/se/leap/bitmaskclient/providersetup/activities/AddProviderBaseActivity.java b/app/src/main/java/se/leap/bitmaskclient/providersetup/activities/AddProviderBaseActivity.java index 0031f48d..193c1d59 100644 --- a/app/src/main/java/se/leap/bitmaskclient/providersetup/activities/AddProviderBaseActivity.java +++ b/app/src/main/java/se/leap/bitmaskclient/providersetup/activities/AddProviderBaseActivity.java @@ -2,14 +2,15 @@ package se.leap.bitmaskclient.providersetup.activities; import android.content.Intent; import android.os.Bundle; -import com.google.android.material.textfield.TextInputEditText; -import com.google.android.material.textfield.TextInputLayout; import android.text.Editable; import android.text.TextWatcher; import android.view.View; import android.widget.Button; -import butterknife.InjectView; +import com.google.android.material.textfield.TextInputEditText; +import com.google.android.material.textfield.TextInputLayout; + +import butterknife.BindView; import se.leap.bitmaskclient.R; import static se.leap.bitmaskclient.providersetup.activities.ProviderListBaseActivity.EXTRAS_KEY_INVALID_URL; @@ -22,16 +23,16 @@ public abstract class AddProviderBaseActivity extends ConfigWizardBaseActivity { final public static String EXTRAS_KEY_NEW_URL = "NEW_URL"; - @InjectView(R.id.text_uri_error) + @BindView(R.id.text_uri_error) TextInputLayout urlError; - @InjectView(R.id.text_uri) + @BindView(R.id.text_uri) TextInputEditText editUrl; - @InjectView(R.id.button_cancel) + @BindView(R.id.button_cancel) Button cancelButton; - @InjectView(R.id.button_save) + @BindView(R.id.button_save) Button saveButton; diff --git a/app/src/main/java/se/leap/bitmaskclient/providersetup/activities/ButterKnifeActivity.java b/app/src/main/java/se/leap/bitmaskclient/providersetup/activities/ButterKnifeActivity.java index 22edd9ee..c695cc46 100644 --- a/app/src/main/java/se/leap/bitmaskclient/providersetup/activities/ButterKnifeActivity.java +++ b/app/src/main/java/se/leap/bitmaskclient/providersetup/activities/ButterKnifeActivity.java @@ -16,9 +16,10 @@ */ package se.leap.bitmaskclient.providersetup.activities; -import androidx.appcompat.app.AppCompatActivity; import android.view.View; +import androidx.appcompat.app.AppCompatActivity; + import butterknife.ButterKnife; /** @@ -30,13 +31,13 @@ public abstract class ButterKnifeActivity extends AppCompatActivity { @Override public void setContentView(View view) { super.setContentView(view); - ButterKnife.inject(this); + ButterKnife.bind(this); } @Override public void setContentView(int layoutResID) { super.setContentView(layoutResID); - ButterKnife.inject(this); + ButterKnife.bind(this); } @Override 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 3712c544..b2f13e07 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 @@ -5,23 +5,24 @@ import android.graphics.PorterDuff; import android.graphics.Rect; import android.os.Build; import android.os.Bundle; +import android.view.View; +import android.view.ViewGroup; +import android.view.ViewTreeObserver; +import android.widget.LinearLayout; +import android.widget.ProgressBar; + import androidx.annotation.DrawableRes; import androidx.annotation.Nullable; import androidx.annotation.StringRes; +import androidx.appcompat.widget.AppCompatTextView; import androidx.constraintlayout.widget.ConstraintLayout; import androidx.constraintlayout.widget.Guideline; import androidx.core.content.ContextCompat; -import androidx.appcompat.widget.AppCompatTextView; -import android.view.View; -import android.view.ViewGroup; -import android.view.ViewTreeObserver; -import android.widget.LinearLayout; -import android.widget.ProgressBar; -import butterknife.InjectView; +import butterknife.BindView; import butterknife.Optional; -import se.leap.bitmaskclient.base.models.Provider; import se.leap.bitmaskclient.R; +import se.leap.bitmaskclient.base.models.Provider; import se.leap.bitmaskclient.base.views.ProviderHeaderView; import static android.content.res.Configuration.ORIENTATION_LANDSCAPE; @@ -42,32 +43,32 @@ public abstract class ConfigWizardBaseActivity extends ButterKnifeActivity { public static final float GUIDE_LINE_COMPACT_DELTA = 0.1f; protected SharedPreferences preferences; - @InjectView(R.id.header) + @BindView(R.id.header) ProviderHeaderView providerHeaderView; //Add provider screen has no loading screen - @Optional - @InjectView(R.id.loading_screen) + @Nullable + @BindView(R.id.loading_screen) protected LinearLayout loadingScreen; - @Optional - @InjectView(R.id.progressbar) + @Nullable + @BindView(R.id.progressbar) protected ProgressBar progressBar; - @Optional - @InjectView(R.id.progressbar_description) + @Nullable + @BindView(R.id.progressbar_description) protected AppCompatTextView progressbarText; //Only tablet layouts have guidelines as they are based on a ConstraintLayout - @Optional - @InjectView(R.id.guideline_top) + @Nullable + @BindView(R.id.guideline_top) protected Guideline guideline_top; - @Optional - @InjectView(R.id.guideline_bottom) + @Nullable + @BindView(R.id.guideline_bottom) protected Guideline guideline_bottom; - @InjectView(R.id.content) + @BindView(R.id.content) protected LinearLayout content; protected Provider provider; diff --git a/app/src/main/java/se/leap/bitmaskclient/providersetup/activities/ProviderCredentialsBaseActivity.java b/app/src/main/java/se/leap/bitmaskclient/providersetup/activities/ProviderCredentialsBaseActivity.java index 91d0de56..e186ce5d 100644 --- a/app/src/main/java/se/leap/bitmaskclient/providersetup/activities/ProviderCredentialsBaseActivity.java +++ b/app/src/main/java/se/leap/bitmaskclient/providersetup/activities/ProviderCredentialsBaseActivity.java @@ -43,7 +43,7 @@ import android.widget.TextView; import org.json.JSONArray; import org.json.JSONException; -import butterknife.InjectView; +import butterknife.BindView; import butterknife.OnClick; import se.leap.bitmaskclient.base.models.Constants.CREDENTIAL_ERRORS; import se.leap.bitmaskclient.base.models.Provider; @@ -87,28 +87,28 @@ public abstract class ProviderCredentialsBaseActivity extends ConfigWizardBaseAc protected Intent mConfigState = new Intent(SHOWING_FORM); protected ProviderAPIBroadcastReceiver providerAPIBroadcastReceiver; - @InjectView(R.id.provider_credentials_user_message) + @BindView(R.id.provider_credentials_user_message) AppCompatTextView userMessage; - @InjectView(R.id.provider_credentials_username) + @BindView(R.id.provider_credentials_username) TextInputEditText usernameField; - @InjectView(R.id.provider_credentials_password) + @BindView(R.id.provider_credentials_password) TextInputEditText passwordField; - @InjectView(R.id.provider_credentials_password_verification) + @BindView(R.id.provider_credentials_password_verification) TextInputEditText passwordVerificationField; - @InjectView(R.id.provider_credentials_username_error) + @BindView(R.id.provider_credentials_username_error) TextInputLayout usernameError; - @InjectView(R.id.provider_credentials_password_error) + @BindView(R.id.provider_credentials_password_error) TextInputLayout passwordError; - @InjectView(R.id.provider_credentials_password_verification_error) + @BindView(R.id.provider_credentials_password_verification_error) TextInputLayout passwordVerificationError; - @InjectView(R.id.button) + @BindView(R.id.button) AppCompatButton button; private boolean isUsernameError = false; diff --git a/app/src/main/java/se/leap/bitmaskclient/providersetup/activities/ProviderListBaseActivity.java b/app/src/main/java/se/leap/bitmaskclient/providersetup/activities/ProviderListBaseActivity.java index 46a40d11..002335db 100644 --- a/app/src/main/java/se/leap/bitmaskclient/providersetup/activities/ProviderListBaseActivity.java +++ b/app/src/main/java/se/leap/bitmaskclient/providersetup/activities/ProviderListBaseActivity.java @@ -30,15 +30,15 @@ import java.util.List; import javax.inject.Inject; -import butterknife.InjectView; +import butterknife.BindView; import butterknife.OnItemClick; -import se.leap.bitmaskclient.providersetup.AddProviderActivity; +import se.leap.bitmaskclient.R; import se.leap.bitmaskclient.base.models.Provider; +import se.leap.bitmaskclient.providersetup.AddProviderActivity; import se.leap.bitmaskclient.providersetup.ProviderListActivity; +import se.leap.bitmaskclient.providersetup.ProviderListAdapter; import se.leap.bitmaskclient.providersetup.ProviderRenderer; import se.leap.bitmaskclient.providersetup.ProviderRendererBuilder; -import se.leap.bitmaskclient.R; -import se.leap.bitmaskclient.providersetup.ProviderListAdapter; import static se.leap.bitmaskclient.base.models.Constants.REQUEST_CODE_ADD_PROVIDER; import static se.leap.bitmaskclient.base.models.Constants.REQUEST_CODE_CONFIGURE_LEAP; @@ -58,7 +58,7 @@ import static se.leap.bitmaskclient.providersetup.ProviderSetupInterface.Provide public abstract class ProviderListBaseActivity extends ProviderSetupBaseActivity { - @InjectView(R.id.provider_list) + @BindView(R.id.provider_list) protected ListView providerListView; @Inject protected ProviderListAdapter adapter; diff --git a/app/src/main/java/se/leap/bitmaskclient/providersetup/activities/ProviderSetupBaseActivity.java b/app/src/main/java/se/leap/bitmaskclient/providersetup/activities/ProviderSetupBaseActivity.java index e54fb048..40efd811 100644 --- a/app/src/main/java/se/leap/bitmaskclient/providersetup/activities/ProviderSetupBaseActivity.java +++ b/app/src/main/java/se/leap/bitmaskclient/providersetup/activities/ProviderSetupBaseActivity.java @@ -21,12 +21,12 @@ import android.content.IntentFilter; import android.os.Bundle; import android.util.Log; +import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.fragment.app.DialogFragment; import androidx.fragment.app.FragmentTransaction; import androidx.localbroadcastmanager.content.LocalBroadcastManager; -import org.jetbrains.annotations.NotNull; import org.json.JSONException; import org.json.JSONObject; @@ -107,7 +107,7 @@ public abstract class ProviderSetupBaseActivity extends ConfigWizardBaseActivity @Override - public void onSaveInstanceState(@NotNull Bundle outState) { + public void onSaveInstanceState(@NonNull Bundle outState) { outState.putString(ACTIVITY_STATE, providerConfigState.toString()); outState.putString(REASON_TO_FAIL, reasonToFail); diff --git a/app/src/main/java/se/leap/bitmaskclient/providersetup/connectivity/DnsResolver.java b/app/src/main/java/se/leap/bitmaskclient/providersetup/connectivity/DnsResolver.java index 44de1e6d..c5100a67 100644 --- a/app/src/main/java/se/leap/bitmaskclient/providersetup/connectivity/DnsResolver.java +++ b/app/src/main/java/se/leap/bitmaskclient/providersetup/connectivity/DnsResolver.java @@ -1,6 +1,6 @@ package se.leap.bitmaskclient.providersetup.connectivity; -import org.jetbrains.annotations.NotNull; +import androidx.annotation.NonNull; import java.net.InetAddress; import java.net.UnknownHostException; @@ -15,7 +15,7 @@ import se.leap.bitmaskclient.base.utils.IPAddress; class DnsResolver implements Dns { @Override - public List<InetAddress> lookup(@NotNull String hostname) throws UnknownHostException { + public List<InetAddress> lookup(@NonNull String hostname) throws UnknownHostException { try { return Dns.SYSTEM.lookup(hostname); } catch (UnknownHostException e) { |