diff --git a/app/src/main/java/eu/ottop/yamlauncher/LocationFragment.kt b/app/src/main/java/eu/ottop/yamlauncher/LocationFragment.kt
index 0358fb9..23f18bc 100644
--- a/app/src/main/java/eu/ottop/yamlauncher/LocationFragment.kt
+++ b/app/src/main/java/eu/ottop/yamlauncher/LocationFragment.kt
@@ -77,7 +77,6 @@ class LocationFragment : Fragment(), LocationListAdapter.OnItemClickListener {
}
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
- println(searchView.text.toString())
lifecycleScope.launch(Dispatchers.IO){
val locations = weatherSystem.getSearchedLocations(
searchView.text.toString()
diff --git a/app/src/main/java/eu/ottop/yamlauncher/MainActivity.kt b/app/src/main/java/eu/ottop/yamlauncher/MainActivity.kt
index 3abd04e..8f92a75 100644
--- a/app/src/main/java/eu/ottop/yamlauncher/MainActivity.kt
+++ b/app/src/main/java/eu/ottop/yamlauncher/MainActivity.kt
@@ -224,6 +224,12 @@ class MainActivity : AppCompatActivity(), SharedPreferences.OnSharedPreferenceCh
}
private fun toAppMenu() {
+ try {
+ recyclerView.scrollToPosition(0)
+ }
+ catch (_: UninitializedPropertyAccessException) {
+
+ }
animations.showApps(binding.homeView, binding.appView)
animations.backgroundIn(this@MainActivity)
if (sharedPreferenceManager.isAutoKeyboardEnabled()) {
@@ -386,14 +392,7 @@ class MainActivity : AppCompatActivity(), SharedPreferences.OnSharedPreferenceCh
lifecycleScope.launch {
refreshAppMenu()
- try {
- withContext(Dispatchers.Main) {
- recyclerView.scrollToPosition(0)
- }
- }
- catch (_: UninitializedPropertyAccessException) {
- }
}}, animSpeed + 50)
}
@@ -482,7 +481,7 @@ class MainActivity : AppCompatActivity(), SharedPreferences.OnSharedPreferenceCh
recyclerView.layoutManager = appMenuLinearLayoutManager
recyclerView.edgeEffectFactory = appMenuEdgeFactory
recyclerView.adapter = adapter
- recyclerView.scrollToPosition(0)
+
}
setupRecyclerListener()
@@ -500,7 +499,7 @@ class MainActivity : AppCompatActivity(), SharedPreferences.OnSharedPreferenceCh
}
private suspend fun setupSearch() {
- recyclerView.addOnLayoutChangeListener { _, _, top, _, bottom, _, oldTop, _, oldBottom ->
+ binding.appView.addOnLayoutChangeListener { _, _, top, _, bottom, _, oldTop, _, oldBottom ->
if (bottom - top > oldBottom - oldTop) {
canExit = true
@@ -589,12 +588,7 @@ class MainActivity : AppCompatActivity(), SharedPreferences.OnSharedPreferenceCh
super.onStart()
// Keyboard is sometimes open when going back to the app, so close it.
closeKeyboard()
- try {
- recyclerView.scrollToPosition(0)
- }
- catch (_: UninitializedPropertyAccessException) {
- }
}
@SuppressLint("NotifyDataSetChanged")
diff --git a/app/src/main/java/eu/ottop/yamlauncher/UIUtils.kt b/app/src/main/java/eu/ottop/yamlauncher/UIUtils.kt
index 094f0a7..64c1984 100644
--- a/app/src/main/java/eu/ottop/yamlauncher/UIUtils.kt
+++ b/app/src/main/java/eu/ottop/yamlauncher/UIUtils.kt
@@ -192,7 +192,7 @@ class UIUtils(context: Context) {
}
fun setClockSize(clock: TextClock) {
- setTextSize(clock, sharedPreferenceManager.getClockSize(), 48F, 58F, 68F)
+ setTextSize(clock, sharedPreferenceManager.getClockSize(), 58F, 68F, 78F)
}
fun setDateSize(dateText: TextClock) {
@@ -200,15 +200,15 @@ class UIUtils(context: Context) {
}
fun setShortcutsSize(shortcuts: LinearLayout) {
- val alignment = sharedPreferenceManager.getShortcutSize()
-
val viewTreeObserver = shortcuts.viewTreeObserver
val globalLayoutListener = object : ViewTreeObserver.OnGlobalLayoutListener {
override fun onGlobalLayout() {
+ val size = sharedPreferenceManager.getShortcutSize()
+
shortcuts.children.forEach {
if (it is TextView) {
- setShortcutSize(it, alignment)
+ setShortcutSize(it, size)
}
}
@@ -223,31 +223,27 @@ class UIUtils(context: Context) {
}
}
- private fun setShortcutSize(shortcut: TextView, alignment: String?) {
+ private fun setShortcutSize(shortcut: TextView, size: String?) {
try {
- when (alignment) {
+ val layoutParams = shortcut.layoutParams as LinearLayout.LayoutParams
+ when (size) {
"small" -> {
- shortcut.setPadding(
- shortcut.paddingLeft,
- shortcut.height / 4,
- shortcut.paddingRight,
- shortcut.height / 4
- )
+ layoutParams.weight = 0.08F
}
"medium" -> {
- shortcut.setPadding(
- shortcut.paddingLeft,
- (shortcut.height / 4.5).toInt(),
- shortcut.paddingRight,
- (shortcut.height / 4.5).toInt()
- )
+ layoutParams.weight = 0.092F
}
"large" -> {
- shortcut.setPadding(shortcut.paddingLeft, 0, shortcut.paddingRight, 0)
+ layoutParams.weight = 0.1F
+ }
+
+ "extra" -> {
+ layoutParams.weight = 0.12F
}
}
+ shortcut.layoutParams = layoutParams
} catch(_: Exception) {}
}
@@ -257,17 +253,17 @@ class UIUtils(context: Context) {
regionText: TextView? = null
) {
val size = sharedPreferenceManager.getAppSize()
- setTextSize(textView, size, 24F, 26F, 28F)
+ setTextSize(textView, size, 24F, 26F, 30F)
if (editText != null) {
- setTextSize(editText, size, 24F, 26F, 28F)
+ setTextSize(editText, size, 24F, 26F, 30F)
}
if (regionText != null) {
- setTextSize(regionText, size, 14F, 16F, 18F)
+ setTextSize(regionText, size, 14F, 16F, 20F)
}
}
fun setSearchSize(searchView: TextInputEditText) {
- setTextSize(searchView, sharedPreferenceManager.getSearchSize(), 21F, 23F, 25F)
+ setTextSize(searchView, sharedPreferenceManager.getSearchSize(), 21F, 23F, 27F)
}
private fun setTextSize(view: TextView, size: String?, s: Float, m: Float, l: Float) {
diff --git a/app/src/main/java/eu/ottop/yamlauncher/WeatherSystem.kt b/app/src/main/java/eu/ottop/yamlauncher/WeatherSystem.kt
index 7e359df..3e24078 100644
--- a/app/src/main/java/eu/ottop/yamlauncher/WeatherSystem.kt
+++ b/app/src/main/java/eu/ottop/yamlauncher/WeatherSystem.kt
@@ -58,7 +58,6 @@ class WeatherSystem(private val context: Context) {
try {
inputStream.bufferedReader().use {
val response = it.readText()
- println("yo")
val jsonObject = JSONObject(response)
val resultArray = jsonObject.getJSONArray("results")
@@ -74,8 +73,7 @@ class WeatherSystem(private val context: Context) {
))
}
}
- }catch (e: Exception){
- e.printStackTrace()
+ }catch (_: Exception){
}
}
return foundLocations
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index 2ffee6a..1823281 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -125,18 +125,19 @@
+ android:layout_weight="0.21" />
large
+
+ - Small
+ - Medium
+ - Large
+ - Extra Large
+
+
+
+ - small
+ - medium
+ - large
+ - extra
+
+
- °C
diff --git a/app/src/main/res/xml/root_preferences.xml b/app/src/main/res/xml/root_preferences.xml
index 3e15cd3..fee3c54 100644
--- a/app/src/main/res/xml/root_preferences.xml
+++ b/app/src/main/res/xml/root_preferences.xml
@@ -92,8 +92,8 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:defaultValue="medium"
- app:entries="@array/size_options"
- app:entryValues="@array/size_values"
+ app:entries="@array/shortcut_size_options"
+ app:entryValues="@array/shortcut_size_values"
app:key="shortcutSize"
app:title="Shortcut Size"
app:useSimpleSummaryProvider="true" />