diff --git a/app/src/main/java/eu/ottop/yamlauncher/MainActivity.kt b/app/src/main/java/eu/ottop/yamlauncher/MainActivity.kt
index 55b02dd..5339fd8 100644
--- a/app/src/main/java/eu/ottop/yamlauncher/MainActivity.kt
+++ b/app/src/main/java/eu/ottop/yamlauncher/MainActivity.kt
@@ -145,25 +145,6 @@ class MainActivity : AppCompatActivity(), SharedPreferences.OnSharedPreferenceCh
setHomeListeners()
- // Task to update the app menu every 5 seconds
- lifecycleScope.launch {
- lifecycle.repeatOnLifecycle(Lifecycle.State.STARTED) {
- while (true) {
- refreshAppMenu()
- delay(5000)
- }
- }
- }
-
- // Task to update the weather every 10 minutes
- lifecycleScope.launch(Dispatchers.IO) {
- repeatOnLifecycle(Lifecycle.State.STARTED) {
- while (true) {
- updateWeather()
- delay(600000)
- }
- }
- }
setupApps()
}
@@ -1170,39 +1151,78 @@ class MainActivity : AppCompatActivity(), SharedPreferences.OnSharedPreferenceCh
val deltaY = e2.y - e1.y
val deltaX = e2.x - e1.x
- // Swipe up
- if (deltaY < -swipeThreshold && abs(velocityY) > swipeVelocityThreshold) {
- canLaunchShortcut = false
- openAppMenu()
- }
-
- // Swipe down
- else if (deltaY > swipeThreshold && abs(velocityY) > swipeVelocityThreshold) {
- val statusBarService = getSystemService(Context.STATUS_BAR_SERVICE)
- val statusBarManager: Class<*> = Class.forName("android.app.StatusBarManager")
- val expandMethod: Method = statusBarManager.getMethod("expandNotificationsPanel")
- expandMethod.invoke(statusBarService)
- }
-
- // Swipe left
- else if (deltaX < 0 && abs(deltaX) > swipeThreshold && abs(velocityX) > swipeVelocityThreshold && sharedPreferenceManager.isGestureEnabled("left")){
- println(leftSwipeActivity)
- if (leftSwipeActivity.first != null && leftSwipeActivity.second != null) {
+ if (Math.abs(deltaX) > Math.abs(deltaY)) {
+ // Swipe right
+ if (deltaX > 0 && abs(deltaX) > swipeThreshold && abs(velocityX) > swipeVelocityThreshold && sharedPreferenceManager.isGestureEnabled(
+ "right"
+ )
+ ) {
+ if (rightSwipeActivity.first != null && rightSwipeActivity.second != null) {
+ canLaunchShortcut = false
+ appUtils.launchApp(
+ rightSwipeActivity.first!!.componentName,
+ launcherApps.profiles[rightSwipeActivity.second!!]
+ )
+ } else {
+ Toast.makeText(
+ this@MainActivity,
+ getString(R.string.launch_error),
+ Toast.LENGTH_SHORT
+ ).show()
+ }
+ } else if (deltaX > 0 && abs(deltaX) > swipeThreshold && abs(velocityX) > swipeVelocityThreshold && !sharedPreferenceManager.isGestureEnabled(
+ "right"
+ )
+ ) {
canLaunchShortcut = false
- appUtils.launchApp(leftSwipeActivity.first!!.componentName, launcherApps.profiles[leftSwipeActivity.second!!])
- } else {
- Toast.makeText(this@MainActivity, getString(R.string.launch_error), Toast.LENGTH_SHORT).show()
+ if (gestureUtils.isAccessibilityServiceEnabled(
+ ScreenLockService::class.java
+ )
+ ) {
+ val intent = Intent(this@MainActivity, ScreenLockService::class.java)
+ intent.action = "RECENTS"
+ startService(intent)
+ finishAndRemoveTask()
+ } else {
+ gestureUtils.promptEnableAccessibility()
+ }
}
- }
+ // Swipe left
+ else if (deltaX < 0 && abs(deltaX) > swipeThreshold && abs(velocityX) > swipeVelocityThreshold && sharedPreferenceManager.isGestureEnabled(
+ "left"
+ )
+ ) {
+ println(leftSwipeActivity)
+ if (leftSwipeActivity.first != null && leftSwipeActivity.second != null) {
+ canLaunchShortcut = false
+ appUtils.launchApp(
+ leftSwipeActivity.first!!.componentName,
+ launcherApps.profiles[leftSwipeActivity.second!!]
+ )
+ } else {
+ Toast.makeText(
+ this@MainActivity,
+ getString(R.string.launch_error),
+ Toast.LENGTH_SHORT
+ ).show()
+ }
+ }
+ } else {
-
- // Swipe right
- else if (deltaX > 0 && abs(deltaX) > swipeThreshold && abs(velocityX) > swipeVelocityThreshold && sharedPreferenceManager.isGestureEnabled("right")) {
- if (rightSwipeActivity.first != null && rightSwipeActivity.second != null) {
+ // Swipe up
+ if (deltaY < -swipeThreshold && abs(velocityY) > swipeVelocityThreshold) {
canLaunchShortcut = false
- appUtils.launchApp(rightSwipeActivity.first!!.componentName, launcherApps.profiles[rightSwipeActivity.second!!])
- } else {
- Toast.makeText(this@MainActivity, getString(R.string.launch_error), Toast.LENGTH_SHORT).show()
+ openAppMenu()
+ }
+
+ // Swipe down
+ else if (deltaY > swipeThreshold && abs(velocityY) > swipeVelocityThreshold) {
+ val statusBarService = getSystemService(Context.STATUS_BAR_SERVICE)
+ val statusBarManager: Class<*> =
+ Class.forName("android.app.StatusBarManager")
+ val expandMethod: Method =
+ statusBarManager.getMethod("expandNotificationsPanel")
+ expandMethod.invoke(statusBarService)
}
}
}
diff --git a/app/src/main/java/eu/ottop/yamlauncher/tasks/ScreenLockService.kt b/app/src/main/java/eu/ottop/yamlauncher/tasks/ScreenLockService.kt
index 403ccec..afcf884 100644
--- a/app/src/main/java/eu/ottop/yamlauncher/tasks/ScreenLockService.kt
+++ b/app/src/main/java/eu/ottop/yamlauncher/tasks/ScreenLockService.kt
@@ -16,6 +16,9 @@ class ScreenLockService : AccessibilityService() {
if (intent != null && intent.action == "LOCK_SCREEN") {
performLockScreen()
}
+ if (intent != null && intent.action == "RECENTS") {
+ performShowRecents()
+ }
stopSelf()
return super.onStartCommand(intent, flags, startId)
}
@@ -23,4 +26,8 @@ class ScreenLockService : AccessibilityService() {
private fun performLockScreen() {
performGlobalAction(GLOBAL_ACTION_LOCK_SCREEN)
}
+
+ private fun performShowRecents() {
+ performGlobalAction(GLOBAL_ACTION_RECENTS)
+ }
}
\ No newline at end of file
diff --git a/app/src/main/java/eu/ottop/yamlauncher/utils/Animations.kt b/app/src/main/java/eu/ottop/yamlauncher/utils/Animations.kt
index a0b3c2d..020bdda 100644
--- a/app/src/main/java/eu/ottop/yamlauncher/utils/Animations.kt
+++ b/app/src/main/java/eu/ottop/yamlauncher/utils/Animations.kt
@@ -118,12 +118,10 @@ class Animations (context: Context) {
private fun View.fadeIn(duration: Long = sharedPreferenceManager.getAnimationSpeed()) {
if (visibility != View.VISIBLE) {
alpha = 0f
- translationY = -height.toFloat()/100
visibility = View.VISIBLE
animate()
.alpha(1f)
- .translationY(0f)
.setDuration(duration)
.setListener(null)
}
@@ -131,12 +129,12 @@ class Animations (context: Context) {
private fun View.fadeOut() {
if (visibility == View.VISIBLE) {
+ alpha = 0f
isInAnim = true
val duration = sharedPreferenceManager.getAnimationSpeed()
animate()
.alpha(0f)
- .translationY(-height.toFloat()/100)
.setDuration(duration/2)
.setListener(object : AnimatorListenerAdapter() {
override fun onAnimationEnd(animation: Animator) {
diff --git a/app/src/main/java/eu/ottop/yamlauncher/utils/UIUtils.kt b/app/src/main/java/eu/ottop/yamlauncher/utils/UIUtils.kt
index d294800..91635b1 100644
--- a/app/src/main/java/eu/ottop/yamlauncher/utils/UIUtils.kt
+++ b/app/src/main/java/eu/ottop/yamlauncher/utils/UIUtils.kt
@@ -350,11 +350,11 @@ class UIUtils(private val context: Context) {
// Size
fun setClockSize(clock: TextClock) {
- setTextSize(clock, sharedPreferenceManager.getClockSize(), 48F, 58F, 70F, 78F, 82F, 84F)
+ setTextSize(clock, sharedPreferenceManager.getClockSize(), 66F, 58F, 70F, 78F, 82F, 84F)
}
fun setDateSize(dateText: TextClock) {
- setTextSize(dateText, sharedPreferenceManager.getDateSize(), 14F, 17F, 20F, 23F, 26F, 29F)
+ setTextSize(dateText, sharedPreferenceManager.getDateSize(), 22F, 17F, 20F, 23F, 26F, 29F)
}
fun setShortcutsSize(shortcuts: LinearLayout) {
@@ -363,7 +363,9 @@ class UIUtils(private val context: Context) {
shortcuts.children.forEach {
if (it is TextView) {
- setShortcutSize(it, size)
+ it.setTextSize(TypedValue.COMPLEX_UNIT_SP, 22F)
+// val padding = 15
+// it.setPadding(0, dpToPx(padding), 0, dpToPx(padding))
}
}
}
@@ -373,9 +375,9 @@ class UIUtils(private val context: Context) {
when (size) {
"tiny" -> {
shortcut.setAutoSizeTextTypeUniformWithConfiguration(
- 5, // Min text size in SP
- 20, // Max text size in SP
- 2, // Step granularity in SP
+ 22, // Min text size in SP
+ 22, // Max text size in SP
+ 1, // Step granularity in SP
TypedValue.COMPLEX_UNIT_SP // Unit of measurement
)
}
@@ -434,9 +436,9 @@ class UIUtils(private val context: Context) {
regionText: TextView? = null
) {
val size = sharedPreferenceManager.getAppSize()
- setTextSize(textView, size, 21F, 24F, 27F, 30F, 33F, 36F)
+ setTextSize(textView, size, 22F, 24F, 27F, 30F, 33F, 36F)
if (editText != null) {
- setTextSize(editText, size, 21F, 24F, 27F, 30F, 33F, 36F)
+ setTextSize(editText, size, 22F, 24F, 27F, 30F, 33F, 36F)
}
if (regionText != null) {
setTextSize(regionText, size, 11F, 14F, 17F, 20F, 23F, 26F)
@@ -444,11 +446,11 @@ class UIUtils(private val context: Context) {
}
fun setSearchSize(searchView: TextInputEditText) {
- setTextSize(searchView, sharedPreferenceManager.getSearchSize(), 18F, 21F, 25F, 27F, 30F, 33F)
+ setTextSize(searchView, sharedPreferenceManager.getSearchSize(), 22F, 21F, 25F, 27F, 30F, 33F)
}
fun setMenuTitleSize(menuTitle: TextView) {
- setTextSize(menuTitle, sharedPreferenceManager.getAppSize(), 27F, 30F, 33F, 36F, 39F, 42F)
+ setTextSize(menuTitle, sharedPreferenceManager.getAppSize(), 22F, 30F, 33F, 36F, 39F, 42F)
}
private fun setTextSize(view: TextView, size: String?, t: Float, s: Float, m: Float, l: Float, x: Float, h: Float) {
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index f6c8ff7..4186ab9 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -17,10 +17,6 @@
android:orientation="vertical"
android:visibility="invisible">
-
-
@@ -75,8 +70,8 @@
android:id="@+id/searchLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_marginHorizontal="32dp"
- android:layout_marginTop="5dp"
+ android:layout_marginHorizontal="22dp"
+ android:layout_marginTop="0dp"
android:layout_marginBottom="10dp"
android:layout_weight="0.1"
android:orientation="horizontal"
@@ -96,7 +91,6 @@
android:singleLine="true"
android:textAlignment="viewStart"
android:textAppearance="@android:style/TextAppearance.DeviceDefault"
- android:textColorHighlight="#5F33B5E5"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/internetSearch"
@@ -164,9 +158,10 @@
android:id="@+id/textClock"
android:layout_width="0dp"
android:layout_height="wrap_content"
- android:layout_marginHorizontal="32dp"
- android:layout_marginTop="45dp"
- android:layout_marginBottom="27dp"
+ android:layout_marginHorizontal="0dp"
+ android:layout_marginTop="0dp"
+ android:layout_marginBottom="78dp"
+ android:paddingHorizontal="19dp"
android:format12Hour="hh:mm"
android:format24Hour="HH:mm"
android:textAlignment="textStart"
@@ -183,9 +178,11 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:format12Hour="dd MMM yyyy"
- android:format24Hour="dd MMM yyyy"
- android:lineSpacingExtra="8sp"
- android:paddingHorizontal="2dp"
+ android:format24Hour="yyyy-MM-dd / EEEE"
+ android:lineSpacingExtra="0sp"
+ android:paddingTop="0dp"
+ android:paddingHorizontal="22dp"
+ android:layout_marginBottom="38dp"
android:textAlignment="textStart"
android:textAppearance="@android:style/TextAppearance.DeviceDefault"
android:textColor="#F3F3F3"
@@ -201,18 +198,17 @@
android:id="@+id/topSpace"
android:layout_width="match_parent"
android:layout_height="0dp"
- android:layout_weight="0.22" />
+ android:layout_weight="0" />
- - 0.06
+ - 0.15
- 0.09
- 0.11
- 0.14
diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml
index 45e8c74..2307f34 100644
--- a/app/src/main/res/values/themes.xml
+++ b/app/src/main/res/values/themes.xml
@@ -11,7 +11,7 @@
- shortEdges
- false
- false
- - #FF80CBC4
+ - #FFCDCDCD