diff --git a/NOTICE b/NOTICE index 4b365e82d..5fc016898 100644 --- a/NOTICE +++ b/NOTICE @@ -19,7 +19,6 @@ Terms: https://firebase.google.com/terms/ - easypermissions - LocalhostToolkit -- butterknife - DBFlow - LocalhostToolkit - MarkdownView diff --git a/app/build.gradle b/app/build.gradle index b1b52ef1b..9f2e1f496 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -126,9 +126,6 @@ dependencies { implementation 'com.squareup.okhttp3:logging-interceptor:4.9.1' - implementation 'com.jakewharton:butterknife:10.2.3' - annotationProcessor 'com.jakewharton:butterknife-compiler:10.2.3' - implementation 'com.github.xanscale.LocalhostToolkit:app:19.05.01' implementation 'com.airbnb.android:lottie:3.0.7' implementation 'com.google.code.gson:gson:2.8.9' diff --git a/app/src/main/java/org/openobservatory/ooniprobe/activity/MainActivity.java b/app/src/main/java/org/openobservatory/ooniprobe/activity/MainActivity.java index 66650d8dc..933bfbf88 100644 --- a/app/src/main/java/org/openobservatory/ooniprobe/activity/MainActivity.java +++ b/app/src/main/java/org/openobservatory/ooniprobe/activity/MainActivity.java @@ -19,7 +19,6 @@ import androidx.appcompat.app.AppCompatDelegate; import androidx.core.content.ContextCompat; -import com.google.android.material.bottomnavigation.BottomNavigationView; import com.google.android.material.snackbar.Snackbar; import org.openobservatory.ooniprobe.R; @@ -38,8 +37,6 @@ import javax.inject.Inject; -import butterknife.BindView; -import butterknife.ButterKnife; import localhost.toolkit.app.fragment.ConfirmDialogFragment; public class MainActivity extends AbstractActivity implements ConfirmDialogFragment.OnConfirmedListener { @@ -71,7 +68,6 @@ protected void onCreate(@Nullable Bundle savedInstanceState) { finish(); } else { - ButterKnife.bind(this); binding = ActivityMainBinding.inflate(getLayoutInflater()); setContentView(binding.getRoot()); binding.bottomNavigation.setOnItemSelectedListener(item -> { diff --git a/app/src/main/java/org/openobservatory/ooniprobe/item/DateItem.java b/app/src/main/java/org/openobservatory/ooniprobe/item/DateItem.java index 139bfe342..60a6003c5 100644 --- a/app/src/main/java/org/openobservatory/ooniprobe/item/DateItem.java +++ b/app/src/main/java/org/openobservatory/ooniprobe/item/DateItem.java @@ -2,20 +2,16 @@ import android.text.format.DateFormat; import android.view.LayoutInflater; -import android.view.View; import android.view.ViewGroup; -import android.widget.TextView; import androidx.recyclerview.widget.RecyclerView; -import org.openobservatory.ooniprobe.R; +import org.openobservatory.ooniprobe.databinding.ItemDateBinding; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Locale; -import butterknife.BindView; -import butterknife.ButterKnife; import localhost.toolkit.widget.recyclerview.HeterogeneousRecyclerItem; public class DateItem extends HeterogeneousRecyclerItem { @@ -27,19 +23,19 @@ public DateItem(Date extra) { } @Override public ViewHolder onCreateViewHolder(LayoutInflater layoutInflater, ViewGroup viewGroup) { - return new ViewHolder(layoutInflater.inflate(R.layout.item_date, viewGroup, false)); + return new ViewHolder(ItemDateBinding.inflate(layoutInflater, viewGroup, false)); } @Override public void onBindViewHolder(ViewHolder viewHolder) { - viewHolder.textView.setText(SDF.format(extra)); + viewHolder.binding.textView.setText(SDF.format(extra)); } class ViewHolder extends RecyclerView.ViewHolder { - @BindView(R.id.textView) TextView textView; + ItemDateBinding binding; - ViewHolder(View itemView) { - super(itemView); - ButterKnife.bind(this, itemView); + ViewHolder(ItemDateBinding binding) { + super(binding.getRoot()); + this.binding = binding; } } } diff --git a/app/src/main/java/org/openobservatory/ooniprobe/item/FailedItem.java b/app/src/main/java/org/openobservatory/ooniprobe/item/FailedItem.java index f86a9559a..43171a5f4 100644 --- a/app/src/main/java/org/openobservatory/ooniprobe/item/FailedItem.java +++ b/app/src/main/java/org/openobservatory/ooniprobe/item/FailedItem.java @@ -4,19 +4,16 @@ import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; -import android.widget.ImageView; -import android.widget.TextView; import androidx.core.content.ContextCompat; import androidx.recyclerview.widget.RecyclerView; import org.openobservatory.ooniprobe.R; +import org.openobservatory.ooniprobe.databinding.ItemFailedBinding; import org.openobservatory.ooniprobe.model.database.Result; import java.util.Locale; -import butterknife.BindView; -import butterknife.ButterKnife; import localhost.toolkit.widget.recyclerview.HeterogeneousRecyclerItem; public class FailedItem extends HeterogeneousRecyclerItem { @@ -30,7 +27,7 @@ public FailedItem(Result extra, View.OnClickListener onClickListener, View.OnLon } @Override public ViewHolder onCreateViewHolder(LayoutInflater layoutInflater, ViewGroup viewGroup) { - return new ViewHolder(layoutInflater.inflate(R.layout.item_failed, viewGroup, false)); + return new ViewHolder(ItemFailedBinding.inflate(layoutInflater, viewGroup, false)); } @Override public void onBindViewHolder(ViewHolder viewHolder) { @@ -38,25 +35,22 @@ public FailedItem(Result extra, View.OnClickListener onClickListener, View.OnLon viewHolder.itemView.setOnClickListener(onClickListener); viewHolder.itemView.setOnLongClickListener(onLongClickListener); viewHolder.itemView.setBackgroundColor(ContextCompat.getColor(viewHolder.itemView.getContext(), R.color.color_gray2)); - viewHolder.testName.setTextColor(ContextCompat.getColor(viewHolder.itemView.getContext(), R.color.color_gray6)); - viewHolder.icon.setImageResource(extra.getTestSuite().getIcon()); - viewHolder.testName.setText(extra.getTestSuite().getTitle()); + viewHolder.binding.testName.setTextColor(ContextCompat.getColor(viewHolder.itemView.getContext(), R.color.color_gray6)); + viewHolder.binding.icon.setImageResource(extra.getTestSuite().getIcon()); + viewHolder.binding.testName.setText(extra.getTestSuite().getTitle()); String failure_msg = viewHolder.itemView.getContext().getString(R.string.TestResults_Overview_Error); if (extra.failure_msg != null) failure_msg += " - " + extra.failure_msg; - viewHolder.subtitle.setText(failure_msg); - viewHolder.startTime.setText(DateFormat.format(DateFormat.getBestDateTimePattern(Locale.getDefault(), "yMdHm"), extra.start_time)); + viewHolder.binding.subtitle.setText(failure_msg); + viewHolder.binding.startTime.setText(DateFormat.format(DateFormat.getBestDateTimePattern(Locale.getDefault(), "yMdHm"), extra.start_time)); } class ViewHolder extends RecyclerView.ViewHolder { - @BindView(R.id.testName) TextView testName; - @BindView(R.id.subtitle) TextView subtitle; - @BindView(R.id.startTime) TextView startTime; - @BindView(R.id.icon) ImageView icon; - - ViewHolder(View itemView) { - super(itemView); - ButterKnife.bind(this, itemView); + ItemFailedBinding binding; + + ViewHolder(ItemFailedBinding binding) { + super(binding.getRoot()); + this.binding = binding; } } } \ No newline at end of file diff --git a/app/src/main/java/org/openobservatory/ooniprobe/item/SeperatorItem.java b/app/src/main/java/org/openobservatory/ooniprobe/item/SeperatorItem.java index 5b50974d5..70c971b22 100644 --- a/app/src/main/java/org/openobservatory/ooniprobe/item/SeperatorItem.java +++ b/app/src/main/java/org/openobservatory/ooniprobe/item/SeperatorItem.java @@ -1,14 +1,12 @@ package org.openobservatory.ooniprobe.item; import android.view.LayoutInflater; -import android.view.View; import android.view.ViewGroup; import androidx.recyclerview.widget.RecyclerView; -import org.openobservatory.ooniprobe.R; +import org.openobservatory.ooniprobe.databinding.ItemSeperatorBinding; -import butterknife.ButterKnife; import localhost.toolkit.widget.recyclerview.HeterogeneousRecyclerItem; public class SeperatorItem extends HeterogeneousRecyclerItem { @@ -18,15 +16,14 @@ public SeperatorItem() { } @Override public ViewHolderImpl onCreateViewHolder(LayoutInflater layoutInflater, ViewGroup viewGroup) { - return new ViewHolderImpl(layoutInflater.inflate(R.layout.item_seperator, viewGroup, false)); + return new ViewHolderImpl(ItemSeperatorBinding.inflate(layoutInflater, viewGroup, false)); } @Override public void onBindViewHolder(ViewHolderImpl holder) {} static class ViewHolderImpl extends RecyclerView.ViewHolder { - ViewHolderImpl(View itemView) { - super(itemView); - ButterKnife.bind(this, itemView); + ViewHolderImpl(ItemSeperatorBinding binding) { + super(binding.getRoot()); } } } diff --git a/app/src/main/java/org/openobservatory/ooniprobe/item/TextItem.java b/app/src/main/java/org/openobservatory/ooniprobe/item/TextItem.java index 9d0bdb097..f3e6349c4 100644 --- a/app/src/main/java/org/openobservatory/ooniprobe/item/TextItem.java +++ b/app/src/main/java/org/openobservatory/ooniprobe/item/TextItem.java @@ -1,16 +1,12 @@ package org.openobservatory.ooniprobe.item; import android.view.LayoutInflater; -import android.view.View; import android.view.ViewGroup; -import android.widget.TextView; import androidx.recyclerview.widget.RecyclerView; -import org.openobservatory.ooniprobe.R; +import org.openobservatory.ooniprobe.databinding.ItemTextBinding; -import butterknife.BindView; -import butterknife.ButterKnife; import localhost.toolkit.widget.recyclerview.HeterogeneousRecyclerItem; public class TextItem extends HeterogeneousRecyclerItem { @@ -19,19 +15,19 @@ public TextItem(String extra) { } @Override public ViewHolder onCreateViewHolder(LayoutInflater layoutInflater, ViewGroup viewGroup) { - return new ViewHolder(layoutInflater.inflate(R.layout.item_text, viewGroup, false)); + return new ViewHolder(ItemTextBinding.inflate(layoutInflater, viewGroup, false)); } @Override public void onBindViewHolder(ViewHolder viewHolder) { - viewHolder.textView.setText(extra); + viewHolder.binding.textView.setText(extra); } class ViewHolder extends RecyclerView.ViewHolder { - @BindView(R.id.textView) TextView textView; + ItemTextBinding binding; - ViewHolder(View itemView) { - super(itemView); - ButterKnife.bind(this, itemView); + ViewHolder(ItemTextBinding binding) { + super(binding.getRoot()); + this.binding = binding; } } }