adding some theming and paddings

This commit is contained in:
tibbi 2022-08-10 12:50:41 +02:00
parent 1cca4b9bd5
commit 7bface3d99
4 changed files with 45 additions and 3 deletions

View File

@ -43,5 +43,5 @@ android {
}
dependencies {
implementation 'com.github.SimpleMobileTools:Simple-Commons:edc62ece69'
implementation 'com.github.SimpleMobileTools:Simple-Commons:6f922ee918'
}

View File

@ -32,7 +32,8 @@
<activity
android:name=".activities.MainActivity"
android:exported="true" />
android:exported="true"
android:theme="@style/LauncherTheme" />
<activity
android:name=".activities.SettingsActivity"

View File

@ -7,8 +7,10 @@ import android.content.pm.LauncherApps
import android.content.pm.PackageManager
import android.graphics.drawable.Drawable
import android.os.Bundle
import android.view.Surface
import android.view.WindowManager
import com.simplemobiletools.commons.extensions.*
import com.simplemobiletools.commons.models.FAQItem
import com.simplemobiletools.commons.helpers.isRPlus
import com.simplemobiletools.commons.views.MyGridLayoutManager
import com.simplemobiletools.launcher.BuildConfig
import com.simplemobiletools.launcher.R
@ -18,6 +20,8 @@ import kotlinx.android.synthetic.main.activity_main.*
class MainActivity : SimpleActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
useDynamicTheme = false
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
appLaunched(BuildConfig.APPLICATION_ID)
@ -30,6 +34,7 @@ class MainActivity : SimpleActivity() {
setupToolbar(main_toolbar)
updateTextColors(main_coordinator)
launchers_fastscroller.updateColors(getProperPrimaryColor())
setupNavigationBar()
}
private fun setupOptionsMenu() {
@ -98,6 +103,35 @@ class MainActivity : SimpleActivity() {
}
}
private fun setupNavigationBar() {
var bottomListPadding = 0
var leftListPadding = 0
var rightListPadding = 0
if (navigationBarOnBottom) {
bottomListPadding = navigationBarHeight
leftListPadding = 0
rightListPadding = 0
} else if (navigationBarOnSide) {
bottomListPadding = 0
val display = if (isRPlus()) {
display!!
} else {
(getSystemService(Context.WINDOW_SERVICE) as WindowManager).defaultDisplay
}
if (display.rotation == Surface.ROTATION_90) {
rightListPadding = navigationBarWidth
} else if (display.rotation == Surface.ROTATION_270) {
leftListPadding = navigationBarWidth
}
}
launchers_grid.setPadding(0, 0, resources.getDimension(R.dimen.medium_margin).toInt(), bottomListPadding)
launchers_fastscroller.setPadding(leftListPadding, 0, rightListPadding, 0)
}
private fun launchSettings() {
hideKeyboard()
startActivity(Intent(applicationContext, SettingsActivity::class.java))

View File

@ -2,4 +2,11 @@
<style name="AppTheme" parent="AppTheme.Base" />
<style name="LauncherTheme" parent="Theme.Material3.Dark.NoActionBar">
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:windowShowWallpaper">true</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowTranslucentNavigation">true</item>
</style>
</resources>