Skip to content

Commit

Permalink
Refresh the navbar with new Material icons
Browse files Browse the repository at this point in the history
  • Loading branch information
meenbeese committed Aug 10, 2024
1 parent 939ce1d commit c3caf3a
Show file tree
Hide file tree
Showing 13 changed files with 92 additions and 37 deletions.
19 changes: 11 additions & 8 deletions app/src/main/java/org/torproject/android/OrbotActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -113,7 +117,6 @@ class OrbotActivity : BaseActivity() {
//we didn't find indication of root
}
}

}

override fun onBackPressed() {
Expand Down
10 changes: 10 additions & 0 deletions app/src/main/res/drawable/ic_connect_filled.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M280,720Q180,720 110,650Q40,580 40,480Q40,380 110,310Q180,240 280,240Q361,240 421.5,285.5Q482,331 506,400L920,400L920,560L840,560L840,720L680,720L680,560L506,560Q482,629 421.5,674.5Q361,720 280,720ZM280,560Q313,560 336.5,536.5Q360,513 360,480Q360,447 336.5,423.5Q313,400 280,400Q247,400 223.5,423.5Q200,447 200,480Q200,513 223.5,536.5Q247,560 280,560Z"/>
</vector>
10 changes: 10 additions & 0 deletions app/src/main/res/drawable/ic_connect_outline.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M280,720Q180,720 110,650Q40,580 40,480Q40,380 110,310Q180,240 280,240Q346,240 401,273Q456,306 488,360L920,360L920,600L840,600L840,720L600,720L600,600L488,600Q456,654 401,687Q346,720 280,720ZM280,640Q346,640 386,599.5Q426,559 434,520L680,520L680,640L760,640L760,520L840,520L840,440L434,440Q426,401 386,360.5Q346,320 280,320Q214,320 167,367Q120,414 120,480Q120,546 167,593Q214,640 280,640ZM280,560Q313,560 336.5,536.5Q360,513 360,480Q360,447 336.5,423.5Q313,400 280,400Q247,400 223.5,423.5Q200,447 200,480Q200,513 223.5,536.5Q247,560 280,560ZM280,480Q280,480 280,480Q280,480 280,480Q280,480 280,480Q280,480 280,480Q280,480 280,480Q280,480 280,480L280,480L280,480L280,480L280,480L280,480L280,480L280,480Q280,480 280,480Q280,480 280,480Z"/>
</vector>
5 changes: 5 additions & 0 deletions app/src/main/res/drawable/ic_connect_selector.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/ic_connect_filled" android:state_checked="true"/>
<item android:drawable="@drawable/ic_connect_outline" android:state_checked="false"/>
</selector>
10 changes: 10 additions & 0 deletions app/src/main/res/drawable/ic_kindness_filled.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M480,840L422,788Q321,697 255,631Q189,565 150,512.5Q111,460 95.5,416Q80,372 80,326Q80,232 143,169Q206,106 300,106Q352,106 399,128Q446,150 480,190Q514,150 561,128Q608,106 660,106Q754,106 817,169Q880,232 880,326Q880,372 864.5,416Q849,460 810,512.5Q771,565 705,631Q639,697 538,788L480,840Z"/>
</vector>
10 changes: 10 additions & 0 deletions app/src/main/res/drawable/ic_kindness_outline.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M480,840L422,788Q321,697 255,631Q189,565 150,512.5Q111,460 95.5,416Q80,372 80,326Q80,232 143,169Q206,106 300,106Q352,106 399,128Q446,150 480,190Q514,150 561,128Q608,106 660,106Q754,106 817,169Q880,232 880,326Q880,372 864.5,416Q849,460 810,512.5Q771,565 705,631Q639,697 538,788L480,840ZM480,732Q576,646 638,584.5Q700,523 736,477.5Q772,432 786,396.5Q800,361 800,326Q800,266 760,226Q720,186 660,186Q613,186 573,212.5Q533,239 518,280L518,280L442,280L442,280Q427,239 387,212.5Q347,186 300,186Q240,186 200,226Q160,266 160,326Q160,361 174,396.5Q188,432 224,477.5Q260,523 322,584.5Q384,646 480,732ZM480,459Q480,459 480,459Q480,459 480,459Q480,459 480,459Q480,459 480,459Q480,459 480,459Q480,459 480,459Q480,459 480,459Q480,459 480,459L480,459L480,459L480,459Q480,459 480,459Q480,459 480,459Q480,459 480,459Q480,459 480,459Q480,459 480,459Q480,459 480,459Q480,459 480,459Q480,459 480,459Z"/>
</vector>
5 changes: 5 additions & 0 deletions app/src/main/res/drawable/ic_kindness_selector.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/ic_kindness_filled" android:state_checked="true"/>
<item android:drawable="@drawable/ic_kindness_outline" android:state_checked="false"/>
</selector>
21 changes: 0 additions & 21 deletions app/src/main/res/drawable/ic_more.xml

This file was deleted.

11 changes: 11 additions & 0 deletions app/src/main/res/drawable/ic_more_filled.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960"
android:tint="?attr/colorControlNormal"
android:autoMirrored="true">
<path
android:fillColor="@android:color/white"
android:pathData="M318,760L120,480L318,200L840,200L840,760L318,760ZM380,520Q397,520 408.5,508.5Q420,497 420,480Q420,463 408.5,451.5Q397,440 380,440Q363,440 351.5,451.5Q340,463 340,480Q340,497 351.5,508.5Q363,520 380,520ZM520,520Q537,520 548.5,508.5Q560,497 560,480Q560,463 548.5,451.5Q537,440 520,440Q503,440 491.5,451.5Q480,463 480,480Q480,497 491.5,508.5Q503,520 520,520ZM660,520Q677,520 688.5,508.5Q700,497 700,480Q700,463 688.5,451.5Q677,440 660,440Q643,440 631.5,451.5Q620,463 620,480Q620,497 631.5,508.5Q643,520 660,520Z"/>
</vector>
11 changes: 11 additions & 0 deletions app/src/main/res/drawable/ic_more_outline.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960"
android:tint="?attr/colorControlNormal"
android:autoMirrored="true">
<path
android:fillColor="@android:color/white"
android:pathData="M380,520Q397,520 408.5,508.5Q420,497 420,480Q420,463 408.5,451.5Q397,440 380,440Q363,440 351.5,451.5Q340,463 340,480Q340,497 351.5,508.5Q363,520 380,520ZM520,520Q537,520 548.5,508.5Q560,497 560,480Q560,463 548.5,451.5Q537,440 520,440Q503,440 491.5,451.5Q480,463 480,480Q480,497 491.5,508.5Q503,520 520,520ZM660,520Q677,520 688.5,508.5Q700,497 700,480Q700,463 688.5,451.5Q677,440 660,440Q643,440 631.5,451.5Q620,463 620,480Q620,497 631.5,508.5Q643,520 660,520ZM360,760Q340,760 322.5,751Q305,742 294,726L120,480L294,234Q305,218 322.5,209Q340,200 360,200L760,200Q793,200 816.5,223.5Q840,247 840,280L840,680Q840,713 816.5,736.5Q793,760 760,760L360,760ZM760,680Q760,680 760,680Q760,680 760,680L760,480L760,280Q760,280 760,280Q760,280 760,280L760,280Q760,280 760,280Q760,280 760,280L760,680Q760,680 760,680Q760,680 760,680ZM360,680L760,680Q760,680 760,680Q760,680 760,680L760,280Q760,280 760,280Q760,280 760,280L360,280Q360,280 360,280Q360,280 360,280L218,480L360,680Q360,680 360,680Q360,680 360,680Z"/>
</vector>
5 changes: 5 additions & 0 deletions app/src/main/res/drawable/ic_more_selector.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/ic_more_filled" android:state_checked="true"/>
<item android:drawable="@drawable/ic_more_outline" android:state_checked="false"/>
</selector>
10 changes: 3 additions & 7 deletions app/src/main/res/menu/main_bottom_nav.xml
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/connectFragment"
android:enabled="true"
android:icon="@drawable/ic_onion"
android:icon="@drawable/ic_connect_selector"
android:title="@string/connect"/>
<item
android:id="@+id/kindnessFragment"
android:enabled="true"
android:icon="@drawable/ic_heart"
android:icon="@drawable/ic_kindness_selector"
android:title="@string/menu_kindness"/>

<item
android:id="@+id/moreFragment"
android:enabled="true"
android:icon="@drawable/ic_more"
android:icon="@drawable/ic_more_selector"
android:title="@string/menu_more"/>
</menu>
2 changes: 1 addition & 1 deletion app/src/main/res/menu/orbot_nav_menu.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
android:title="@string/menu_settings"/>

<item
android:icon="@drawable/ic_more"
android:icon="@drawable/ic_more_outline"
android:id="@+id/menu_log"
android:title="@string/menu_log"/>

Expand Down

0 comments on commit c3caf3a

Please sign in to comment.