Skip to content

Commit

Permalink
Added legacy account manager option in accounts
Browse files Browse the repository at this point in the history
  • Loading branch information
WSTxda committed Mar 4, 2024
1 parent 76a4f77 commit 034a8da
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 0 deletions.
1 change: 1 addition & 0 deletions play-services-core/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,7 @@

<activity
android:name="org.microg.gms.ui.LegacyAccountSettingsActivity"
android:label="@string/account_manager_title"
android:process=":ui"
android:taskAffinity="org.microg.gms.settings" />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,14 @@ import android.content.Intent
import android.os.Bundle
import android.provider.Settings
import android.util.Log
import android.view.Menu
import android.view.MenuInflater
import android.view.MenuItem
import android.view.View
import android.widget.Toast
import androidx.appcompat.app.AlertDialog
import androidx.core.content.ContextCompat
import androidx.navigation.fragment.findNavController
import androidx.preference.Preference
import androidx.preference.PreferenceCategory
import androidx.preference.PreferenceFragmentCompat
Expand Down Expand Up @@ -135,4 +139,24 @@ class AccountsFragment : PreferenceFragmentCompat() {
true
}
}

init {
setHasOptionsMenu(true)
}

override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
inflater.inflate(R.menu.accounts_menu_item, menu)
super.onCreateOptionsMenu(menu, inflater)
}

override fun onOptionsItemSelected(item: MenuItem): Boolean {
return when (item.itemId) {
R.id.account_legacy_settings -> {
findNavController().navigate(R.id.accountLegacyFragment)
true
}

else -> super.onOptionsItemSelected(item)
}
}
}
9 changes: 9 additions & 0 deletions play-services-core/src/main/res/menu/accounts_menu_item.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">

<item
android:id="@+id/account_legacy_settings"
android:icon="@drawable/ic_settings"
android:title="@string/account_manager_title"
app:showAsAction="always" />
</menu>
5 changes: 5 additions & 0 deletions play-services-core/src/main/res/navigation/nav_settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,11 @@
android:name="org.microg.gms.ui.PushNotificationAdvancedFragment"
android:label="@string/service_name_mcs" />

<fragment
android:id="@+id/accountLegacyFragment"
android:name="org.microg.gms.ui.LegacyAccountSettingsActivity$AccountSettingsFragment"
android:label="@string/account_manager_title" />

<!-- About -->

<fragment
Expand Down

0 comments on commit 034a8da

Please sign in to comment.