From c7e3f72886a6c9a61271a97ef2375d85a0baf566 Mon Sep 17 00:00:00 2001 From: Meenbeese Date: Sun, 4 Aug 2024 10:27:06 -0400 Subject: [PATCH] Refresh the navbar with new Material icons --- .../org/torproject/android/OrbotActivity.kt | 19 +++++++++++-------- .../main/res/drawable/ic_connect_filled.xml | 10 ++++++++++ .../main/res/drawable/ic_connect_outline.xml | 10 ++++++++++ .../main/res/drawable/ic_connect_selector.xml | 5 +++++ .../main/res/drawable/ic_kindness_filled.xml | 10 ++++++++++ .../main/res/drawable/ic_kindness_outline.xml | 10 ++++++++++ .../res/drawable/ic_kindness_selector.xml | 5 +++++ app/src/main/res/drawable/ic_more_filled.xml | 11 +++++++++++ app/src/main/res/drawable/ic_more_outline.xml | 11 +++++++++++ .../main/res/drawable/ic_more_selector.xml | 5 +++++ app/src/main/res/menu/main_bottom_nav.xml | 10 +++------- app/src/main/res/navigation/nav_graph.xml | 4 ++-- 12 files changed, 93 insertions(+), 17 deletions(-) create mode 100644 app/src/main/res/drawable/ic_connect_filled.xml create mode 100644 app/src/main/res/drawable/ic_connect_outline.xml create mode 100644 app/src/main/res/drawable/ic_connect_selector.xml create mode 100644 app/src/main/res/drawable/ic_kindness_filled.xml create mode 100644 app/src/main/res/drawable/ic_kindness_outline.xml create mode 100644 app/src/main/res/drawable/ic_kindness_selector.xml create mode 100644 app/src/main/res/drawable/ic_more_filled.xml create mode 100644 app/src/main/res/drawable/ic_more_outline.xml create mode 100644 app/src/main/res/drawable/ic_more_selector.xml diff --git a/app/src/main/java/org/torproject/android/OrbotActivity.kt b/app/src/main/java/org/torproject/android/OrbotActivity.kt index 20473e017..87aeb17f9 100644 --- a/app/src/main/java/org/torproject/android/OrbotActivity.kt +++ b/app/src/main/java/org/torproject/android/OrbotActivity.kt @@ -11,13 +11,17 @@ import android.content.pm.PackageManager import android.content.res.Configuration import android.os.Bundle import android.widget.* + import androidx.activity.result.contract.ActivityResultContracts import androidx.core.content.ContextCompat import androidx.localbroadcastmanager.content.LocalBroadcastManager +import androidx.navigation.NavController import androidx.navigation.findNavController import androidx.navigation.ui.setupWithNavController + import com.google.android.material.bottomnavigation.BottomNavigationView import com.scottyab.rootbeer.RootBeer + import org.torproject.android.core.LocaleHelper import org.torproject.android.core.putNotSystem import org.torproject.android.core.ui.BaseActivity @@ -27,11 +31,10 @@ import org.torproject.android.ui.LogBottomSheet class OrbotActivity : BaseActivity() { - private lateinit var bottomNavigationView: BottomNavigationView - private lateinit var logBottomSheet: LogBottomSheet - lateinit var fragConnect: ConnectFragment - lateinit var fragMore: MoreFragment + var fragConnect: ConnectFragment = ConnectFragment() + var fragKindness: KindnessFragment = KindnessFragment() + var fragMore: MoreFragment = MoreFragment() var previousReceivedTorStatus: String? = null @@ -75,11 +78,12 @@ class OrbotActivity : BaseActivity() { logBottomSheet = LogBottomSheet() - bottomNavigationView = findViewById(R.id.bottom_navigation) + val navController: NavController = findNavController(R.id.nav_fragment) + val bottomNavigationView: BottomNavigationView = findViewById(R.id.bottom_navigation) - val navController = findNavController(R.id.nav_fragment) bottomNavigationView.setupWithNavController(navController) - bottomNavigationView.selectedItemId = R.id.connectFragment + + bottomNavigationView.menu.findItem(R.id.connectFragment).isChecked = true with(LocalBroadcastManager.getInstance(this)) { registerReceiver( @@ -113,7 +117,6 @@ class OrbotActivity : BaseActivity() { //we didn't find indication of root } } - } override fun onBackPressed() { diff --git a/app/src/main/res/drawable/ic_connect_filled.xml b/app/src/main/res/drawable/ic_connect_filled.xml new file mode 100644 index 000000000..cbc006739 --- /dev/null +++ b/app/src/main/res/drawable/ic_connect_filled.xml @@ -0,0 +1,10 @@ + + + diff --git a/app/src/main/res/drawable/ic_connect_outline.xml b/app/src/main/res/drawable/ic_connect_outline.xml new file mode 100644 index 000000000..cef952372 --- /dev/null +++ b/app/src/main/res/drawable/ic_connect_outline.xml @@ -0,0 +1,10 @@ + + + diff --git a/app/src/main/res/drawable/ic_connect_selector.xml b/app/src/main/res/drawable/ic_connect_selector.xml new file mode 100644 index 000000000..14fa72c62 --- /dev/null +++ b/app/src/main/res/drawable/ic_connect_selector.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/app/src/main/res/drawable/ic_kindness_filled.xml b/app/src/main/res/drawable/ic_kindness_filled.xml new file mode 100644 index 000000000..7c29e5e33 --- /dev/null +++ b/app/src/main/res/drawable/ic_kindness_filled.xml @@ -0,0 +1,10 @@ + + + diff --git a/app/src/main/res/drawable/ic_kindness_outline.xml b/app/src/main/res/drawable/ic_kindness_outline.xml new file mode 100644 index 000000000..2e40a458e --- /dev/null +++ b/app/src/main/res/drawable/ic_kindness_outline.xml @@ -0,0 +1,10 @@ + + + diff --git a/app/src/main/res/drawable/ic_kindness_selector.xml b/app/src/main/res/drawable/ic_kindness_selector.xml new file mode 100644 index 000000000..c310e909b --- /dev/null +++ b/app/src/main/res/drawable/ic_kindness_selector.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/app/src/main/res/drawable/ic_more_filled.xml b/app/src/main/res/drawable/ic_more_filled.xml new file mode 100644 index 000000000..6b9c1d268 --- /dev/null +++ b/app/src/main/res/drawable/ic_more_filled.xml @@ -0,0 +1,11 @@ + + + diff --git a/app/src/main/res/drawable/ic_more_outline.xml b/app/src/main/res/drawable/ic_more_outline.xml new file mode 100644 index 000000000..8622d5e0d --- /dev/null +++ b/app/src/main/res/drawable/ic_more_outline.xml @@ -0,0 +1,11 @@ + + + diff --git a/app/src/main/res/drawable/ic_more_selector.xml b/app/src/main/res/drawable/ic_more_selector.xml new file mode 100644 index 000000000..29b5d9c84 --- /dev/null +++ b/app/src/main/res/drawable/ic_more_selector.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/app/src/main/res/menu/main_bottom_nav.xml b/app/src/main/res/menu/main_bottom_nav.xml index d76e92f75..e3f296a84 100644 --- a/app/src/main/res/menu/main_bottom_nav.xml +++ b/app/src/main/res/menu/main_bottom_nav.xml @@ -1,18 +1,14 @@ - \ No newline at end of file diff --git a/app/src/main/res/navigation/nav_graph.xml b/app/src/main/res/navigation/nav_graph.xml index d2952d35f..d4fc7e0e4 100644 --- a/app/src/main/res/navigation/nav_graph.xml +++ b/app/src/main/res/navigation/nav_graph.xml @@ -2,8 +2,8 @@ + android:id="@+id/nav_graph" + app:startDestination="@id/connectFragment">