Skip to content

Commit

Permalink
fix: tweak OverviewActivity for NMS
Browse files Browse the repository at this point in the history
  • Loading branch information
aanorbel committed May 28, 2024
1 parent 720ddb9 commit 6191cc4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import com.google.android.material.snackbar.Snackbar;

import org.openobservatory.engine.BaseNettest;
import org.openobservatory.ooniprobe.BuildConfig;
import org.openobservatory.ooniprobe.R;
import org.openobservatory.ooniprobe.activity.customwebsites.CustomWebsiteActivity;
import org.openobservatory.ooniprobe.activity.overview.OverviewTestsExpandableListViewAdapter;
Expand Down Expand Up @@ -156,8 +157,10 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
binding.automaticUpdatesContainer.setVisibility(View.VISIBLE);
binding.automaticUpdatesSwitch.setChecked(installedDescriptor.getTestDescriptor().isAutoUpdate());

if (Objects.equals("contact@openobservatory.org", installedDescriptor.getTestDescriptor().getAuthor())) {
if (BuildConfig.FLAVOR_brand.equals("dw")) {
binding.uninstallLink.setVisibility(View.GONE);
binding.revisionsContainer.setVisibility(View.GONE);
binding.headerContainer.setVisibility(View.GONE);
}

} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ import android.widget.BaseExpandableListAdapter
import android.widget.ImageView
import android.widget.TextView
import com.google.android.material.checkbox.MaterialCheckBox
import org.openobservatory.ooniprobe.BuildConfig
import org.openobservatory.ooniprobe.R
import org.openobservatory.ooniprobe.common.OONITests
import org.openobservatory.ooniprobe.test.test.AbstractTest
import org.openobservatory.ooniprobe.test.test.Experimental
import org.openobservatory.ooniprobe.test.test.WebConnectivity

class OverviewTestsExpandableListViewAdapter(
private val items: List<TestGroupItem>,
Expand Down Expand Up @@ -51,9 +53,13 @@ class OverviewTestsExpandableListViewAdapter(

else -> {
val testSuite = AbstractTest.getTestByName(groupItem.name)
view.findViewById<TextView>(R.id.group_name).text = when (testSuite is Experimental) {
true -> testSuite.name
false -> parent.context.resources.getText(testSuite.labelResId)
view.findViewById<TextView>(R.id.group_name).text = when (testSuite) {
is Experimental -> testSuite.name
is WebConnectivity -> when (BuildConfig.FLAVOR_brand == "dw") {
true -> "Test websites automatically"
else -> parent.context.resources.getText(testSuite.labelResId)
}
else -> parent.context.resources.getText(testSuite.labelResId)
}
when(testSuite.iconResId){
0 -> view.findViewById<ImageView>(R.id.group_icon).visibility = View.GONE
Expand Down Expand Up @@ -115,7 +121,7 @@ class OverviewTestsExpandableListViewAdapter(
}
}

if (groupItem.inputs?.isNotEmpty() == true) {
if (items.count() > 1 && groupItem.inputs?.isNotEmpty() == true) {
if (isExpanded) {
groupIndicator.setImageResource(R.drawable.expand_less)
} else {
Expand Down

0 comments on commit 6191cc4

Please sign in to comment.