summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorTanuj M <thetanuj@hotmail.com>2020-11-28 19:43:20 +0530
committerTanuj M <thetanuj@hotmail.com>2020-11-28 19:43:20 +0530
commit97bf8a623c273cb7ac3ba4c0c9a72dd3156dfed3 (patch)
tree01ffac928bfcbe49adecfb19c3d1f2e5d9ca1d62 /app
parent5c1e2eca0f7c904bd41ba6fe758e056eb921354f (diff)
downloadSidePhOnelauncher-97bf8a623c273cb7ac3ba4c0c9a72dd3156dfed3.tar.gz
SidePhOnelauncher-97bf8a623c273cb7ac3ba4c0c9a72dd3156dfed3.tar.bz2
SidePhOnelauncher-97bf8a623c273cb7ac3ba4c0c9a72dd3156dfed3.zip
Showing status bar. Date and time hidden.
Diffstat (limited to 'app')
-rw-r--r--app/src/main/java/app/olauncher/data/Constants.kt2
-rw-r--r--app/src/main/java/app/olauncher/ui/HomeFragment.kt50
-rw-r--r--app/src/main/res/layout/fragment_home.xml2
-rw-r--r--app/src/main/res/values-v29/themes.xml6
-rw-r--r--app/src/main/res/values/styles.xml9
5 files changed, 41 insertions, 28 deletions
diff --git a/app/src/main/java/app/olauncher/data/Constants.kt b/app/src/main/java/app/olauncher/data/Constants.kt
index 206a45f..6882b59 100644
--- a/app/src/main/java/app/olauncher/data/Constants.kt
+++ b/app/src/main/java/app/olauncher/data/Constants.kt
@@ -23,7 +23,7 @@ object Constants {
const val HINT_EMAIL_US = 20
const val HINT_RATE_US = 30
- const val TRIPLE_TAP_DELAY_MS = 400
+ const val TRIPLE_TAP_DELAY_MS = 300
const val LONG_PRESS_DELAY_MS = 600
const val URL_ABOUT_OLAUNCHER = "https://www.notion.so/About-Olauncher-4843e398b05a455bb521b0665b26fbcd"
diff --git a/app/src/main/java/app/olauncher/ui/HomeFragment.kt b/app/src/main/java/app/olauncher/ui/HomeFragment.kt
index dfe03e0..be116e4 100644
--- a/app/src/main/java/app/olauncher/ui/HomeFragment.kt
+++ b/app/src/main/java/app/olauncher/ui/HomeFragment.kt
@@ -172,7 +172,7 @@ class HomeFragment : Fragment(), View.OnClickListener, View.OnLongClickListener
private fun populateHomeApps(appCountUpdated: Boolean) {
if (appCountUpdated) hideHomeApps()
- dateTimeLayout.visibility = View.VISIBLE
+// dateTimeLayout.visibility = View.VISIBLE
val homeAppsNum = prefs.homeAppsNum
if (homeAppsNum == 0) return
@@ -370,9 +370,10 @@ class HomeFragment : Fragment(), View.OnClickListener, View.OnLongClickListener
private fun showNavBarAndResetScreenTimeout() {
if (Settings.System.canWrite(requireContext()))
Settings.System.putInt(requireContext().contentResolver, Settings.System.SCREEN_OFF_TIMEOUT, prefs.screenTimeout);
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R)
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
+ requireActivity().window.insetsController?.show(WindowInsets.Type.statusBars())
requireActivity().window.insetsController?.show(WindowInsets.Type.navigationBars())
- else
+ } else
requireActivity().window.decorView.apply {
systemUiVisibility = (View.SYSTEM_UI_FLAG_LAYOUT_STABLE
or View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
@@ -380,6 +381,29 @@ class HomeFragment : Fragment(), View.OnClickListener, View.OnLongClickListener
}
}
+ private fun hideNavBar() {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
+ requireActivity().window.insetsController?.hide(WindowInsets.Type.statusBars())
+ requireActivity().window.insetsController?.hide(WindowInsets.Type.navigationBars())
+ } else {
+ @Suppress("DEPRECATION")
+ requireActivity().window.decorView.apply {
+ systemUiVisibility =
+ View.SYSTEM_UI_FLAG_IMMERSIVE or View.SYSTEM_UI_FLAG_FULLSCREEN or View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
+ }
+ }
+ }
+
+ private fun setScreenTimeout() {
+ // Save the existing screen off timeout
+ val screenTimeoutInSettings =
+ Settings.System.getInt(requireContext().contentResolver, Settings.System.SCREEN_OFF_TIMEOUT)
+ if (screenTimeoutInSettings >= 5000) prefs.screenTimeout = screenTimeoutInSettings
+
+ // Set timeout to 5 seconds
+ Settings.System.putInt(requireContext().contentResolver, Settings.System.SCREEN_OFF_TIMEOUT, 5000)
+ }
+
private fun textOnClick(view: View) = onClick(view)
private fun textOnLongClick(view: View) = onLongClick(view)
@@ -420,24 +444,8 @@ class HomeFragment : Fragment(), View.OnClickListener, View.OnLongClickListener
if (Settings.System.canWrite(requireContext())) {
requireActivity().runOnUiThread {
blackOverlay.visibility = View.VISIBLE
-
- // Save the existing screen off timeout
- val screenTimeoutInSettings =
- Settings.System.getInt(requireContext().contentResolver, Settings.System.SCREEN_OFF_TIMEOUT)
- if (screenTimeoutInSettings >= 5000) prefs.screenTimeout = screenTimeoutInSettings
-
- // Set timeout to 5 seconds
- Settings.System.putInt(requireContext().contentResolver, Settings.System.SCREEN_OFF_TIMEOUT, 5000)
-
- // Hide the navigation bar
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
- requireActivity().window.insetsController?.hide(WindowInsets.Type.navigationBars())
- } else {
- @Suppress("DEPRECATION")
- requireActivity().window.decorView.apply {
- systemUiVisibility = View.SYSTEM_UI_FLAG_IMMERSIVE or View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
- }
- }
+ setScreenTimeout()
+ hideNavBar()
}
} else {
lockPhone()
diff --git a/app/src/main/res/layout/fragment_home.xml b/app/src/main/res/layout/fragment_home.xml
index 6e13fee..c2e111f 100644
--- a/app/src/main/res/layout/fragment_home.xml
+++ b/app/src/main/res/layout/fragment_home.xml
@@ -42,7 +42,7 @@
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginStart="24dp"
- android:layout_marginTop="36dp"
+ android:layout_marginTop="16dp"
android:layout_marginEnd="24dp"
android:orientation="vertical">
diff --git a/app/src/main/res/values-v29/themes.xml b/app/src/main/res/values-v29/themes.xml
index 5a60898..94cf4ea 100644
--- a/app/src/main/res/values-v29/themes.xml
+++ b/app/src/main/res/values-v29/themes.xml
@@ -1,12 +1,16 @@
<resources>
<style name="AppTheme" parent="Theme.AppCompat.NoActionBar">
+ <item name="colorPrimary">@android:color/white</item>
+ <item name="colorPrimaryDark">@android:color/white</item>
+ <item name="colorAccent">@android:color/darker_gray</item>
<item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item>
<item name="android:fitsSystemWindows">false</item>
<item name="android:windowShowWallpaper">true</item>
<item name="android:windowBackground">@android:color/transparent</item>
- <item name="android:windowFullscreen">true</item>
+ <item name="android:windowLightStatusBar">false</item>
+ <item name="android:windowFullscreen">false</item>
<item name="android:navigationBarColor">@android:color/transparent</item>
<item name="android:windowLightNavigationBar">true</item>
<item name="android:windowContentOverlay">@null</item>
diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml
index 6f0918b..5a4736f 100644
--- a/app/src/main/res/values/styles.xml
+++ b/app/src/main/res/values/styles.xml
@@ -1,8 +1,8 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<style name="AppTheme" parent="Theme.AppCompat.NoActionBar">
- <item name="colorPrimary">@android:color/black</item>
- <item name="colorPrimaryDark">@android:color/black</item>
+ <item name="colorPrimary">@android:color/white</item>
+ <item name="colorPrimaryDark">@android:color/white</item>
<item name="colorAccent">@android:color/darker_gray</item>
<item name="android:windowLayoutInDisplayCutoutMode" tools:targetApi="o_mr1">shortEdges
@@ -13,7 +13,8 @@
<item name="android:fitsSystemWindows">false</item>
<item name="android:windowShowWallpaper">true</item>
<item name="android:windowBackground">@android:color/transparent</item>
- <item name="android:windowFullscreen">true</item>
+ <item name="android:windowFullscreen">false</item>
+ <item name="android:windowLightStatusBar">false</item>
<item name="android:navigationBarColor">@android:color/transparent</item>
<item name="android:windowLightNavigationBar" tools:targetApi="o_mr1">true</item>
<item name="android:windowContentOverlay">@null</item>
@@ -43,7 +44,7 @@
<style name="TextLarge" parent="TextDefault">
<item name="android:fontFamily">sans-serif-light</item>
- <item name="android:textSize">26sp</item>
+ <item name="android:textSize">28sp</item>
</style>
<style name="TextMedium" parent="TextDefault">