From 336cde9989ae0d3c1adff1d8ca4cd448ec5f03c0 Mon Sep 17 00:00:00 2001 From: Norbel AMBANUMBEN Date: Sat, 16 Mar 2024 13:59:23 +0100 Subject: [PATCH 1/3] feat: (OON Run v2) add missing post-load toast from install link flow https://github.com/ooni/run/issues/148 --- .../ooniprobe/activity/adddescriptor/AddDescriptorActivity.kt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/src/main/java/org/openobservatory/ooniprobe/activity/adddescriptor/AddDescriptorActivity.kt b/app/src/main/java/org/openobservatory/ooniprobe/activity/adddescriptor/AddDescriptorActivity.kt index 6fedc19fd..20a435156 100644 --- a/app/src/main/java/org/openobservatory/ooniprobe/activity/adddescriptor/AddDescriptorActivity.kt +++ b/app/src/main/java/org/openobservatory/ooniprobe/activity/adddescriptor/AddDescriptorActivity.kt @@ -10,6 +10,7 @@ import android.view.MenuInflater import android.view.MenuItem import android.widget.ImageView import android.widget.TextView +import android.widget.Toast import androidx.activity.viewModels import androidx.appcompat.widget.Toolbar import androidx.databinding.BindingAdapter @@ -173,6 +174,7 @@ class AddDescriptorActivity : AbstractActivity() { // This observer is used to finish the activity when the descriptor is added. viewModel.finishActivity.observe(this) { shouldFinish -> if (shouldFinish) { + Toast.makeText(this@AddDescriptorActivity, "Link installed", Toast.LENGTH_LONG).show() finish() } } From e9b68a09551b515f38200d7d2c3da3b08ce6a03f Mon Sep 17 00:00:00 2001 From: Norbel AMBANUMBEN Date: Sat, 16 Mar 2024 14:35:39 +0100 Subject: [PATCH 2/3] feat: (OONI Run V2) Add `Cancel` button on link install flow and Update Add link button text to Install Link https://github.com/ooni/run/issues/152 , https://github.com/ooni/run/issues/149 --- .../adddescriptor/AddDescriptorActivity.kt | 29 +++++++--------- .../res/layout/activity_add_descriptor.xml | 34 ++++++++++++++++--- app/src/main/res/menu/add_descriptor.xml | 10 ------ 3 files changed, 41 insertions(+), 32 deletions(-) delete mode 100644 app/src/main/res/menu/add_descriptor.xml diff --git a/app/src/main/java/org/openobservatory/ooniprobe/activity/adddescriptor/AddDescriptorActivity.kt b/app/src/main/java/org/openobservatory/ooniprobe/activity/adddescriptor/AddDescriptorActivity.kt index 20a435156..450b3ae35 100644 --- a/app/src/main/java/org/openobservatory/ooniprobe/activity/adddescriptor/AddDescriptorActivity.kt +++ b/app/src/main/java/org/openobservatory/ooniprobe/activity/adddescriptor/AddDescriptorActivity.kt @@ -12,7 +12,6 @@ import android.widget.ImageView import android.widget.TextView import android.widget.Toast import androidx.activity.viewModels -import androidx.appcompat.widget.Toolbar import androidx.databinding.BindingAdapter import androidx.lifecycle.ViewModel import androidx.lifecycle.ViewModelProvider @@ -114,7 +113,7 @@ class AddDescriptorActivity : AbstractActivity() { setSupportActionBar(binding.toolbar) supportActionBar?.setDisplayHomeAsUpEnabled(false) supportActionBar?.setDisplayShowHomeEnabled(false) - supportActionBar?.title = "Add New Link" + supportActionBar?.title = "Install New Link" val descriptorExtra = if (VERSION.SDK_INT >= VERSION_CODES.TIRAMISU) { intent.getParcelableExtra(DESCRIPTOR, TestDescriptor::class.java) } else { @@ -145,21 +144,17 @@ class AddDescriptorActivity : AbstractActivity() { for (i in 0 until adapter.groupCount) { binding.expandableListView.expandGroup(i) } - val bottomBarOnMenuItemClickListener: Toolbar.OnMenuItemClickListener = - Toolbar.OnMenuItemClickListener { item -> - when (item.itemId) { - R.id.add_descriptor -> { - viewModel.onAddButtonClicked( - disabledAutorunNettests = adapter.nettests.filter { it.selected }, - automatedUpdates = binding.automaticUpdatesSwitch.isChecked - ) - true - } - - else -> false - } - } - binding.bottomBar.setOnMenuItemClickListener(bottomBarOnMenuItemClickListener) + + binding.btnInstallLink.setOnClickListener { + viewModel.onAddButtonClicked( + disabledAutorunNettests = adapter.nettests.filter { it.selected }, + automatedUpdates = binding.automaticUpdatesSwitch.isChecked + ) + } + + binding.btnCancel.setOnClickListener { + finish() + } viewModel.selectedAllBtnStatus.observe(this) { state -> binding.testsCheckbox.checkedState = state; diff --git a/app/src/main/res/layout/activity_add_descriptor.xml b/app/src/main/res/layout/activity_add_descriptor.xml index 36fbf7298..6d7aaaecf 100644 --- a/app/src/main/res/layout/activity_add_descriptor.xml +++ b/app/src/main/res/layout/activity_add_descriptor.xml @@ -162,13 +162,37 @@ android:layout_gravity="bottom" android:theme="@style/Theme.MaterialComponents.Light.DarkActionBar.App.NoActionBar"> - + android:gravity="center"> + +