Skip to content

Commit

Permalink
Fix app glitching when rotating screen
Browse files Browse the repository at this point in the history
  • Loading branch information
ErdbeerbaerLP committed Jul 1, 2023
1 parent 628eae5 commit 981a0e2
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ android {
minSdkVersion 21
targetSdkVersion 29
versionCode 59
versionName "1.7.3"
versionName "1.7.4"
vectorDrawables.useSupportLibrary = true
manifestPlaceholders = [appName: "@string/app_name"]

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

<activity
android:name=".settings.SettingsActivity"
android:configChanges="orientation|screenSize"
android:launchMode="singleTop">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
Expand Down Expand Up @@ -79,6 +80,5 @@
<meta-data
android:name="google_analytics_adid_collection_enabled"
android:value="false" />

</application>
</manifest>
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.pluscubed.velociraptor.settings

import android.content.Intent
import android.content.res.Configuration
import android.os.Build
import android.os.Bundle
import android.provider.Settings
Expand Down Expand Up @@ -39,6 +40,7 @@ class SettingsActivity : AppCompatActivity() {
private val generalFragment = GeneralFragment()
private val advancedFragment = AdvancedFragment()
private var active: Fragment = permissionsFragment
private var bottomNavigationSelectedItemId = R.id.action_permissions


override fun onCreate(savedInstanceState: Bundle?) {
Expand Down Expand Up @@ -100,6 +102,12 @@ class SettingsActivity : AppCompatActivity() {

PrefUtils.setFirstRun(this, false)
PrefUtils.setVersionCode(this, BuildConfig.VERSION_CODE)
// Zustand der BottomNavigationView wiederherstellen
if (savedInstanceState != null) {
bottomNavigationSelectedItemId = savedInstanceState.getInt("selectedItemId", R.id.action_advanced)
}
bottomNavigationView.selectedItemId = bottomNavigationSelectedItemId

}

fun showSupportDialog() {
Expand All @@ -110,11 +118,20 @@ class SettingsActivity : AppCompatActivity() {
super.onPause()
startLimitService(false)
}

override fun onCreateOptionsMenu(menu: Menu): Boolean {
menuInflater.inflate(R.menu.menu_settings, menu)
return true
}
override fun onSaveInstanceState(outState: Bundle) {
// Zustand der BottomNavigationView speichern
outState.putInt("selectedItemId", bottomNavigationView.selectedItemId)

super.onSaveInstanceState(outState)
}
override fun onConfigurationChanged(newConfig: Configuration) {
super.onConfigurationChanged(newConfig)

}

override fun onOptionsItemSelected(item: MenuItem): Boolean {
when (item.itemId) {
Expand Down

0 comments on commit 981a0e2

Please sign in to comment.