diff options
author | cyBerta <cyberta@riseup.net> | 2020-12-29 14:38:43 +0100 |
---|---|---|
committer | cyBerta <cyberta@riseup.net> | 2020-12-29 14:38:43 +0100 |
commit | 4487985ea1589ab8d32330c22dac2e65cbede0bf (patch) | |
tree | b48998fd48b04864944643e16d8790b8a35547af /app | |
parent | fd81f2e14e36adb59d534df257e6ba2262cc362f (diff) |
update butterknife probably a last time
Diffstat (limited to 'app')
15 files changed, 159 insertions, 119 deletions
diff --git a/app/build.gradle b/app/build.gradle index 0b3403ff..5d54f3da 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -365,9 +365,9 @@ dependencies { debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.6.2' releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.6.2' betaImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.6.2' - annotationProcessor 'com.jakewharton:butterknife:6.1.0' + annotationProcessor 'com.jakewharton:butterknife-compiler:10.2.3' annotationProcessor 'com.squareup.dagger:dagger-compiler:1.2.2' - implementation 'com.jakewharton:butterknife:6.1.0' + implementation 'com.jakewharton:butterknife:10.2.1' //TODO: replace that library compileOnly 'com.squareup.dagger:dagger-compiler:1.2.2' implementation 'com.github.pedrovgs:renderers:1.5' 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/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/production/java/se/leap/bitmaskclient/providersetup/AddProviderActivity.java b/app/src/production/java/se/leap/bitmaskclient/providersetup/AddProviderActivity.java index d05c76f0..7ca707db 100644 --- a/app/src/production/java/se/leap/bitmaskclient/providersetup/AddProviderActivity.java +++ b/app/src/production/java/se/leap/bitmaskclient/providersetup/AddProviderActivity.java @@ -4,7 +4,7 @@ import android.os.Bundle; import android.view.View; import android.widget.Button; -import butterknife.InjectView; +import butterknife.BindView; import se.leap.bitmaskclient.R; import se.leap.bitmaskclient.providersetup.activities.AddProviderBaseActivity; @@ -12,7 +12,7 @@ public class AddProviderActivity extends AddProviderBaseActivity { final public static String TAG = "AddProviderActivity"; - @InjectView(R.id.button_save) + @BindView(R.id.button_save) Button saveButton; @Override |