mirror of
https://github.com/He4eT/yamf_launcher.git
synced 2026-05-05 01:47:24 +00:00
A bunch more refactoring
This commit is contained in:
parent
4bac8ffee8
commit
b78a021ac2
21 changed files with 164 additions and 287 deletions
|
|
@ -39,15 +39,9 @@ android {
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
|
||||||
implementation("androidx.core:core-ktx:1.13.1")
|
implementation("androidx.core:core-ktx:1.13.1")
|
||||||
implementation("androidx.appcompat:appcompat:1.7.0")
|
implementation("androidx.appcompat:appcompat:1.7.0")
|
||||||
implementation("com.google.android.material:material:1.12.0")
|
implementation("com.google.android.material:material:1.12.0")
|
||||||
implementation("androidx.constraintlayout:constraintlayout:2.1.4")
|
|
||||||
implementation("androidx.navigation:navigation-fragment-ktx:2.7.7")
|
|
||||||
implementation("androidx.navigation:navigation-ui-ktx:2.7.7")
|
|
||||||
implementation("com.google.code.gson:gson:2.11.0")
|
|
||||||
implementation("androidx.recyclerview:recyclerview:1.3.2")
|
implementation("androidx.recyclerview:recyclerview:1.3.2")
|
||||||
implementation("androidx.preference:preference-ktx:1.2.1")
|
implementation("androidx.preference:preference-ktx:1.2.1")
|
||||||
implementation ("androidx.activity:activity-ktx:1.9.1")
|
|
||||||
}
|
}
|
||||||
|
|
@ -1,13 +1,10 @@
|
||||||
package eu.ottop.yamlauncher
|
package eu.ottop.yamlauncher
|
||||||
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.text.Html
|
|
||||||
import android.text.method.LinkMovementMethod
|
|
||||||
import androidx.fragment.app.Fragment
|
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.widget.TextView
|
import androidx.fragment.app.Fragment
|
||||||
|
|
||||||
class AboutFragment : Fragment() {
|
class AboutFragment : Fragment() {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,18 +3,15 @@ package eu.ottop.yamlauncher
|
||||||
import android.animation.Animator
|
import android.animation.Animator
|
||||||
import android.animation.AnimatorListenerAdapter
|
import android.animation.AnimatorListenerAdapter
|
||||||
import android.animation.ArgbEvaluator
|
import android.animation.ArgbEvaluator
|
||||||
import android.animation.ObjectAnimator
|
|
||||||
import android.animation.ValueAnimator
|
import android.animation.ValueAnimator
|
||||||
import android.app.Activity
|
import android.app.Activity
|
||||||
import android.content.SharedPreferences
|
import android.content.SharedPreferences
|
||||||
import android.graphics.Color
|
import android.graphics.Color
|
||||||
import android.graphics.drawable.ColorDrawable
|
import android.graphics.drawable.ColorDrawable
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.WindowManager
|
|
||||||
import androidx.core.content.ContextCompat
|
|
||||||
import eu.ottop.yamlauncher.databinding.ActivityMainBinding
|
import eu.ottop.yamlauncher.databinding.ActivityMainBinding
|
||||||
|
|
||||||
class Animations () {
|
class Animations {
|
||||||
|
|
||||||
fun fadeViewIn(view: View, duration: Long = 100) {
|
fun fadeViewIn(view: View, duration: Long = 100) {
|
||||||
view.fadeIn(duration)
|
view.fadeIn(duration)
|
||||||
|
|
|
||||||
|
|
@ -16,8 +16,8 @@ import android.widget.EditText
|
||||||
import android.widget.LinearLayout
|
import android.widget.LinearLayout
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
import androidx.appcompat.widget.AppCompatButton
|
import androidx.appcompat.widget.AppCompatButton
|
||||||
|
import androidx.lifecycle.lifecycleScope
|
||||||
import eu.ottop.yamlauncher.databinding.ActivityMainBinding
|
import eu.ottop.yamlauncher.databinding.ActivityMainBinding
|
||||||
import kotlinx.coroutines.CoroutineScope
|
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
|
|
||||||
|
|
@ -105,7 +105,7 @@ class AppActionMenu {
|
||||||
workProfile,
|
workProfile,
|
||||||
editText.text.toString()
|
editText.text.toString()
|
||||||
)
|
)
|
||||||
CoroutineScope(Dispatchers.Default).launch {
|
activity.lifecycleScope.launch(Dispatchers.Default) {
|
||||||
activity.applySearch()
|
activity.applySearch()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -125,7 +125,7 @@ class AppActionMenu {
|
||||||
app.second.second
|
app.second.second
|
||||||
)
|
)
|
||||||
|
|
||||||
CoroutineScope(Dispatchers.Default).launch {
|
activity.lifecycleScope.launch(Dispatchers.Default) {
|
||||||
activity.applySearch()
|
activity.applySearch()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -135,7 +135,7 @@ class AppActionMenu {
|
||||||
editLayout.visibility = View.GONE
|
editLayout.visibility = View.GONE
|
||||||
textView.visibility = View.GONE
|
textView.visibility = View.GONE
|
||||||
actionMenu.visibility = View.GONE
|
actionMenu.visibility = View.GONE
|
||||||
CoroutineScope(Dispatchers.Default).launch {
|
activity.lifecycleScope.launch {
|
||||||
sharedPreferenceManager.setAppHidden(activity, appInfo.packageName, workProfile, true)
|
sharedPreferenceManager.setAppHidden(activity, appInfo.packageName, workProfile, true)
|
||||||
activity.refreshAppMenu()
|
activity.refreshAppMenu()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,22 +9,21 @@ import android.graphics.BlendMode
|
||||||
import android.graphics.BlendModeColorFilter
|
import android.graphics.BlendModeColorFilter
|
||||||
import android.graphics.Color
|
import android.graphics.Color
|
||||||
import android.os.UserHandle
|
import android.os.UserHandle
|
||||||
import android.view.Gravity
|
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.widget.EditText
|
|
||||||
import android.widget.FrameLayout
|
import android.widget.FrameLayout
|
||||||
import android.widget.LinearLayout
|
import android.widget.LinearLayout
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
import androidx.core.content.res.ResourcesCompat
|
import androidx.core.content.res.ResourcesCompat
|
||||||
import androidx.preference.PreferenceManager
|
import androidx.preference.PreferenceManager
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
|
import com.google.android.material.textfield.TextInputEditText
|
||||||
|
|
||||||
|
|
||||||
class AppMenuAdapter(
|
class AppMenuAdapter(
|
||||||
private val activity: Context,
|
private val activity: Context,
|
||||||
var apps: MutableList<Pair<LauncherActivityInfo, Pair<UserHandle, Int>>>,
|
private var apps: MutableList<Pair<LauncherActivityInfo, Pair<UserHandle, Int>>>,
|
||||||
private val itemClickListener: OnItemClickListener,
|
private val itemClickListener: OnItemClickListener,
|
||||||
private val shortcutListener: OnShortcutListener,
|
private val shortcutListener: OnShortcutListener,
|
||||||
private val itemLongClickListener: OnItemLongClickListener,
|
private val itemLongClickListener: OnItemLongClickListener,
|
||||||
|
|
@ -36,6 +35,8 @@ class AppMenuAdapter(
|
||||||
|
|
||||||
private val sharedPreferenceManager = SharedPreferenceManager()
|
private val sharedPreferenceManager = SharedPreferenceManager()
|
||||||
private var preferences = PreferenceManager.getDefaultSharedPreferences(activity)
|
private var preferences = PreferenceManager.getDefaultSharedPreferences(activity)
|
||||||
|
private val uiUtils = UIUtils()
|
||||||
|
private val appUtils = AppUtils()
|
||||||
|
|
||||||
interface OnItemClickListener {
|
interface OnItemClickListener {
|
||||||
fun onItemClick(appInfo: LauncherActivityInfo, userHandle: UserHandle)
|
fun onItemClick(appInfo: LauncherActivityInfo, userHandle: UserHandle)
|
||||||
|
|
@ -62,7 +63,7 @@ class AppMenuAdapter(
|
||||||
val textView: TextView = listItem.findViewById(R.id.app_name)
|
val textView: TextView = listItem.findViewById(R.id.app_name)
|
||||||
val actionMenuLayout: LinearLayout = listItem.findViewById(R.id.action_menu)
|
val actionMenuLayout: LinearLayout = listItem.findViewById(R.id.action_menu)
|
||||||
private val editView: LinearLayout = listItem.findViewById(R.id.rename_view)
|
private val editView: LinearLayout = listItem.findViewById(R.id.rename_view)
|
||||||
val editText: EditText = editView.findViewById(R.id.app_name_edit)
|
val editText: TextInputEditText = editView.findViewById(R.id.app_name_edit)
|
||||||
|
|
||||||
init {
|
init {
|
||||||
actionMenuLayout.visibility = View.INVISIBLE
|
actionMenuLayout.visibility = View.INVISIBLE
|
||||||
|
|
@ -119,51 +120,18 @@ class AppMenuAdapter(
|
||||||
holder.textView.setCompoundDrawablesWithIntrinsicBounds(ResourcesCompat.getDrawable(activity.resources, R.drawable.ic_empty, null),null,ResourcesCompat.getDrawable(activity.resources, R.drawable.ic_empty, null),null)
|
holder.textView.setCompoundDrawablesWithIntrinsicBounds(ResourcesCompat.getDrawable(activity.resources, R.drawable.ic_empty, null),null,ResourcesCompat.getDrawable(activity.resources, R.drawable.ic_empty, null),null)
|
||||||
}
|
}
|
||||||
|
|
||||||
when (preferences.getString("appMenuAlignment", "left")) {
|
uiUtils.setAppAlignment(activity, preferences, holder.textView, holder.editText)
|
||||||
"left" -> {
|
|
||||||
holder.textView.setCompoundDrawablesWithIntrinsicBounds(holder.textView.compoundDrawables.filterNotNull().first(),null, ResourcesCompat.getDrawable(activity.resources, R.drawable.ic_empty, null), null)
|
|
||||||
holder.textView.gravity = Gravity.CENTER_VERTICAL or Gravity.START
|
|
||||||
}
|
|
||||||
"center" -> {
|
|
||||||
holder.textView.setCompoundDrawablesWithIntrinsicBounds(holder.textView.compoundDrawables.filterNotNull().first(),null,holder.textView.compoundDrawables.filterNotNull().first(), null)
|
|
||||||
holder.textView.gravity = Gravity.CENTER
|
|
||||||
|
|
||||||
}
|
uiUtils.setAppSize(preferences, holder.textView, holder.editText)
|
||||||
"right" -> {
|
|
||||||
holder.textView.setCompoundDrawablesWithIntrinsicBounds(ResourcesCompat.getDrawable(activity.resources, R.drawable.ic_empty, null),null, holder.textView.compoundDrawables.filterNotNull().first(), null)
|
|
||||||
holder.textView.gravity = Gravity.CENTER_VERTICAL or Gravity.END
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
when (preferences.getString("appMenuSize", "medium")) {
|
val appInfo = appUtils.getAppInfo(
|
||||||
"small" -> {
|
|
||||||
holder.textView.textSize = 24F
|
|
||||||
holder.editText.textSize = 24F
|
|
||||||
}
|
|
||||||
|
|
||||||
"medium" -> {
|
|
||||||
holder.textView.textSize = 26F
|
|
||||||
holder.editText.textSize = 26F
|
|
||||||
}
|
|
||||||
|
|
||||||
"large" -> {
|
|
||||||
holder.textView.textSize = 28F
|
|
||||||
holder.editText.textSize = 28F
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
val appUtils = AppUtils()
|
|
||||||
var appInfo = appUtils.getAppInfo(
|
|
||||||
launcherApps,
|
launcherApps,
|
||||||
app.first.applicationInfo.packageName,
|
app.first.applicationInfo.packageName,
|
||||||
app.second.second
|
app.second.second
|
||||||
)
|
)
|
||||||
|
|
||||||
holder.textView.setTextColor(Color.parseColor(preferences?.getString("textColor", "#FFF3F3F3")))
|
holder.textView.setTextColor(Color.parseColor(preferences?.getString("textColor", "#FFF3F3F3")))
|
||||||
var appLabel: CharSequence = ""
|
val appLabel: CharSequence = appInfo?.loadLabel(activity.packageManager) ?: "Removing..."
|
||||||
appLabel = appInfo?.loadLabel(activity.packageManager) ?: "Removing..."
|
|
||||||
|
|
||||||
println(appLabel)
|
|
||||||
|
|
||||||
if (appInfo != null) {
|
if (appInfo != null) {
|
||||||
holder.textView.text = sharedPreferenceManager.getAppName(
|
holder.textView.text = sharedPreferenceManager.getAppName(
|
||||||
|
|
@ -192,28 +160,9 @@ class AppMenuAdapter(
|
||||||
return apps.size
|
return apps.size
|
||||||
}
|
}
|
||||||
|
|
||||||
fun addApp(position: Int, app: Pair<LauncherActivityInfo, Pair<UserHandle, Int>>) {
|
|
||||||
apps.add(position, app)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun removeApp(position: Int) {
|
|
||||||
apps.removeAt(position)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun updateApp(position: Int, app: Pair<LauncherActivityInfo, Pair<UserHandle, Int>>) {
|
|
||||||
apps[position] = app
|
|
||||||
}
|
|
||||||
|
|
||||||
fun moveApp(position: Int, newPosition: Int) {
|
|
||||||
val app = apps.removeAt(position)
|
|
||||||
apps.add(newPosition, app)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressLint("NotifyDataSetChanged")
|
@SuppressLint("NotifyDataSetChanged")
|
||||||
fun updateApps(newApps: List<Pair<LauncherActivityInfo, Pair<UserHandle, Int>>>) {
|
fun updateApps(newApps: List<Pair<LauncherActivityInfo, Pair<UserHandle, Int>>>) {
|
||||||
apps = newApps.toMutableList()
|
apps = newApps.toMutableList()
|
||||||
notifyDataSetChanged()
|
notifyDataSetChanged()
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -10,7 +10,6 @@ import android.widget.Toast
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
import java.lang.reflect.InvocationTargetException
|
|
||||||
|
|
||||||
class AppUtils {
|
class AppUtils {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@ import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.content.IntentFilter
|
import android.content.IntentFilter
|
||||||
import android.os.BatteryManager
|
import android.os.BatteryManager
|
||||||
import android.widget.TextClock
|
|
||||||
|
|
||||||
class BatteryReceiver(private val activity: MainActivity) : BroadcastReceiver() {
|
class BatteryReceiver(private val activity: MainActivity) : BroadcastReceiver() {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,21 +2,16 @@ package eu.ottop.yamlauncher
|
||||||
|
|
||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.pm.ApplicationInfo
|
|
||||||
import android.content.pm.LauncherActivityInfo
|
import android.content.pm.LauncherActivityInfo
|
||||||
import android.os.UserHandle
|
import android.os.UserHandle
|
||||||
import android.view.Gravity
|
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.widget.EditText
|
|
||||||
import android.widget.FrameLayout
|
import android.widget.FrameLayout
|
||||||
import android.widget.LinearLayout
|
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
import androidx.core.content.res.ResourcesCompat
|
import androidx.core.content.res.ResourcesCompat
|
||||||
import androidx.preference.PreferenceManager
|
import androidx.preference.PreferenceManager
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import kotlin.time.Duration.Companion.seconds
|
|
||||||
|
|
||||||
class GestureAppsAdapter(
|
class GestureAppsAdapter(
|
||||||
private val activity: Context,
|
private val activity: Context,
|
||||||
|
|
@ -27,6 +22,7 @@ class GestureAppsAdapter(
|
||||||
|
|
||||||
private val sharedPreferenceManager = SharedPreferenceManager()
|
private val sharedPreferenceManager = SharedPreferenceManager()
|
||||||
private var preferences = PreferenceManager.getDefaultSharedPreferences(activity)
|
private var preferences = PreferenceManager.getDefaultSharedPreferences(activity)
|
||||||
|
private val uiUtils = UIUtils()
|
||||||
|
|
||||||
interface OnItemClickListener {
|
interface OnItemClickListener {
|
||||||
fun onItemClick(appInfo: LauncherActivityInfo, profile: Int)
|
fun onItemClick(appInfo: LauncherActivityInfo, profile: Int)
|
||||||
|
|
@ -35,14 +31,8 @@ class GestureAppsAdapter(
|
||||||
inner class AppViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
|
inner class AppViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
|
||||||
private val listItem: FrameLayout = itemView.findViewById(R.id.list_item)
|
private val listItem: FrameLayout = itemView.findViewById(R.id.list_item)
|
||||||
val textView: TextView = listItem.findViewById(R.id.app_name)
|
val textView: TextView = listItem.findViewById(R.id.app_name)
|
||||||
private val actionMenuLayout: LinearLayout = listItem.findViewById(R.id.action_menu)
|
|
||||||
private val editView: LinearLayout = listItem.findViewById(R.id.rename_view)
|
|
||||||
val editText: EditText = editView.findViewById(R.id.app_name_edit)
|
|
||||||
|
|
||||||
init {
|
init {
|
||||||
actionMenuLayout.visibility = View.INVISIBLE
|
|
||||||
editView.visibility = View.INVISIBLE
|
|
||||||
|
|
||||||
textView.setOnClickListener {
|
textView.setOnClickListener {
|
||||||
val position = bindingAdapterPosition
|
val position = bindingAdapterPosition
|
||||||
val app = apps[position].first
|
val app = apps[position].first
|
||||||
|
|
@ -68,38 +58,9 @@ class GestureAppsAdapter(
|
||||||
holder.textView.setCompoundDrawablesWithIntrinsicBounds(ResourcesCompat.getDrawable(activity.resources, R.drawable.ic_empty, null),null,null,null)
|
holder.textView.setCompoundDrawablesWithIntrinsicBounds(ResourcesCompat.getDrawable(activity.resources, R.drawable.ic_empty, null),null,null,null)
|
||||||
}
|
}
|
||||||
|
|
||||||
when (preferences.getString("appMenuAlignment", "left")) {
|
uiUtils.setAppAlignment(activity, preferences, holder.textView)
|
||||||
"left" -> {
|
|
||||||
holder.textView.setCompoundDrawablesWithIntrinsicBounds(holder.textView.compoundDrawables.filterNotNull().first(),null, null, null)
|
|
||||||
holder.textView.gravity = Gravity.CENTER_VERTICAL or Gravity.START
|
|
||||||
}
|
|
||||||
"center" -> {
|
|
||||||
holder.textView.setCompoundDrawablesWithIntrinsicBounds(holder.textView.compoundDrawables.filterNotNull().first(),null,holder.textView.compoundDrawables.filterNotNull().first(), null)
|
|
||||||
holder.textView.gravity = Gravity.CENTER
|
|
||||||
|
|
||||||
}
|
uiUtils.setAppSize(preferences, holder.textView)
|
||||||
"right" -> {
|
|
||||||
holder.textView.setCompoundDrawablesWithIntrinsicBounds(null,null, holder.textView.compoundDrawables.filterNotNull().first(), null)
|
|
||||||
holder.textView.gravity = Gravity.CENTER_VERTICAL or Gravity.END
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
when (preferences.getString("appMenuSize", "medium")) {
|
|
||||||
"small" -> {
|
|
||||||
holder.textView.textSize = 24F
|
|
||||||
holder.editText.textSize = 24F
|
|
||||||
}
|
|
||||||
|
|
||||||
"medium" -> {
|
|
||||||
holder.textView.textSize = 26F
|
|
||||||
holder.editText.textSize = 26F
|
|
||||||
}
|
|
||||||
|
|
||||||
"large" -> {
|
|
||||||
holder.textView.textSize = 28F
|
|
||||||
holder.editText.textSize = 28F
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
val appInfo = app.first.activityInfo.applicationInfo
|
val appInfo = app.first.activityInfo.applicationInfo
|
||||||
holder.textView.text = sharedPreferenceManager.getAppName(activity, app.first.applicationInfo.packageName,app.second.second, holder.itemView.context.packageManager.getApplicationLabel(appInfo))
|
holder.textView.text = sharedPreferenceManager.getAppName(activity, app.first.applicationInfo.packageName,app.second.second, holder.itemView.context.packageManager.getApplicationLabel(appInfo))
|
||||||
|
|
|
||||||
|
|
@ -9,18 +9,15 @@ import android.os.Bundle
|
||||||
import android.os.UserHandle
|
import android.os.UserHandle
|
||||||
import android.text.Editable
|
import android.text.Editable
|
||||||
import android.text.TextWatcher
|
import android.text.TextWatcher
|
||||||
import androidx.fragment.app.Fragment
|
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.widget.EditText
|
import androidx.fragment.app.Fragment
|
||||||
import android.widget.Toast
|
|
||||||
import androidx.core.content.ContextCompat.getSystemService
|
|
||||||
import androidx.fragment.app.setFragmentResult
|
import androidx.fragment.app.setFragmentResult
|
||||||
import androidx.lifecycle.lifecycleScope
|
import androidx.lifecycle.lifecycleScope
|
||||||
import androidx.preference.Preference
|
import androidx.preference.PreferenceManager
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import com.google.android.material.textfield.TextInputEditText
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
|
|
@ -58,13 +55,19 @@ class GestureAppsFragment : Fragment(), GestureAppsAdapter.OnItemClickListener {
|
||||||
}
|
}
|
||||||
val recyclerView = view.findViewById<RecyclerView>(R.id.gesture_app_recycler)
|
val recyclerView = view.findViewById<RecyclerView>(R.id.gesture_app_recycler)
|
||||||
val appMenuEdgeFactory = AppMenuEdgeFactory(requireActivity())
|
val appMenuEdgeFactory = AppMenuEdgeFactory(requireActivity())
|
||||||
|
val uiUtils = UIUtils()
|
||||||
|
val preferences = PreferenceManager.getDefaultSharedPreferences(requireContext())
|
||||||
|
|
||||||
recyclerView.edgeEffectFactory = appMenuEdgeFactory
|
recyclerView.edgeEffectFactory = appMenuEdgeFactory
|
||||||
recyclerView.adapter = adapter
|
recyclerView.adapter = adapter
|
||||||
|
|
||||||
recyclerView.scrollToPosition(0)
|
recyclerView.scrollToPosition(0)
|
||||||
|
|
||||||
val searchView = view.findViewById<EditText>(R.id.gestureAppSearch)
|
val searchView = view.findViewById<TextInputEditText>(R.id.gestureAppSearch)
|
||||||
|
|
||||||
|
uiUtils.setMenuTitleAlignment(preferences, view.findViewById(R.id.gesture_menutitle))
|
||||||
|
uiUtils.setSearchAlignment(preferences, searchView)
|
||||||
|
uiUtils.setSearchSize(preferences, searchView)
|
||||||
|
|
||||||
recyclerView.addOnLayoutChangeListener { _, _, top, _, bottom, _, oldTop, _, oldBottom ->
|
recyclerView.addOnLayoutChangeListener { _, _, top, _, bottom, _, oldTop, _, oldBottom ->
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ import android.view.accessibility.AccessibilityManager
|
||||||
import androidx.appcompat.app.AppCompatActivity.ACCESSIBILITY_SERVICE
|
import androidx.appcompat.app.AppCompatActivity.ACCESSIBILITY_SERVICE
|
||||||
|
|
||||||
class GestureUtils {
|
class GestureUtils {
|
||||||
|
|
||||||
fun getSwipeInfo(preferences: SharedPreferences, launcherApps: LauncherApps, direction: String): Pair<LauncherActivityInfo?, Int?> {
|
fun getSwipeInfo(preferences: SharedPreferences, launcherApps: LauncherApps, direction: String): Pair<LauncherActivityInfo?, Int?> {
|
||||||
val app = preferences.getString("${direction}SwipeApp", "")?.split("§splitter§")
|
val app = preferences.getString("${direction}SwipeApp", "")?.split("§splitter§")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,25 +2,20 @@ package eu.ottop.yamlauncher
|
||||||
|
|
||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.pm.ApplicationInfo
|
|
||||||
import android.content.pm.LauncherActivityInfo
|
import android.content.pm.LauncherActivityInfo
|
||||||
import android.os.UserHandle
|
import android.os.UserHandle
|
||||||
import android.view.Gravity
|
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.widget.EditText
|
|
||||||
import android.widget.FrameLayout
|
import android.widget.FrameLayout
|
||||||
import android.widget.LinearLayout
|
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
import androidx.core.content.res.ResourcesCompat
|
import androidx.core.content.res.ResourcesCompat
|
||||||
import androidx.preference.PreferenceManager
|
import androidx.preference.PreferenceManager
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import kotlin.time.Duration.Companion.seconds
|
|
||||||
|
|
||||||
class HiddenAppsAdapter(
|
class HiddenAppsAdapter(
|
||||||
private val activity: Context,
|
private val activity: Context,
|
||||||
var apps: MutableList<Pair<LauncherActivityInfo, Pair<UserHandle, Int>>>,
|
private var apps: MutableList<Pair<LauncherActivityInfo, Pair<UserHandle, Int>>>,
|
||||||
private val itemClickListener: OnItemClickListener
|
private val itemClickListener: OnItemClickListener
|
||||||
) :
|
) :
|
||||||
RecyclerView.Adapter<HiddenAppsAdapter.AppViewHolder>() {
|
RecyclerView.Adapter<HiddenAppsAdapter.AppViewHolder>() {
|
||||||
|
|
@ -28,6 +23,8 @@ class HiddenAppsAdapter(
|
||||||
private val sharedPreferenceManager = SharedPreferenceManager()
|
private val sharedPreferenceManager = SharedPreferenceManager()
|
||||||
private var preferences = PreferenceManager.getDefaultSharedPreferences(activity)
|
private var preferences = PreferenceManager.getDefaultSharedPreferences(activity)
|
||||||
|
|
||||||
|
private val uiUtils = UIUtils()
|
||||||
|
|
||||||
interface OnItemClickListener {
|
interface OnItemClickListener {
|
||||||
fun onItemClick(appInfo: LauncherActivityInfo, profile: Int)
|
fun onItemClick(appInfo: LauncherActivityInfo, profile: Int)
|
||||||
}
|
}
|
||||||
|
|
@ -35,13 +32,8 @@ class HiddenAppsAdapter(
|
||||||
inner class AppViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
|
inner class AppViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
|
||||||
private val listItem: FrameLayout = itemView.findViewById(R.id.list_item)
|
private val listItem: FrameLayout = itemView.findViewById(R.id.list_item)
|
||||||
val textView: TextView = listItem.findViewById(R.id.app_name)
|
val textView: TextView = listItem.findViewById(R.id.app_name)
|
||||||
private val actionMenuLayout: LinearLayout = listItem.findViewById(R.id.action_menu)
|
|
||||||
private val editView: LinearLayout = listItem.findViewById(R.id.rename_view)
|
|
||||||
val editText: EditText = editView.findViewById(R.id.app_name_edit)
|
|
||||||
|
|
||||||
init {
|
init {
|
||||||
actionMenuLayout.visibility = View.INVISIBLE
|
|
||||||
editView.visibility = View.INVISIBLE
|
|
||||||
|
|
||||||
textView.setOnClickListener {
|
textView.setOnClickListener {
|
||||||
val position = bindingAdapterPosition
|
val position = bindingAdapterPosition
|
||||||
|
|
@ -68,38 +60,9 @@ class HiddenAppsAdapter(
|
||||||
holder.textView.setCompoundDrawablesWithIntrinsicBounds(ResourcesCompat.getDrawable(activity.resources, R.drawable.ic_empty, null),null,null,null)
|
holder.textView.setCompoundDrawablesWithIntrinsicBounds(ResourcesCompat.getDrawable(activity.resources, R.drawable.ic_empty, null),null,null,null)
|
||||||
}
|
}
|
||||||
|
|
||||||
when (preferences.getString("appMenuAlignment", "left")) {
|
uiUtils.setAppAlignment(activity, preferences, holder.textView)
|
||||||
"left" -> {
|
|
||||||
holder.textView.setCompoundDrawablesWithIntrinsicBounds(holder.textView.compoundDrawables.filterNotNull().first(),null, null, null)
|
|
||||||
holder.textView.gravity = Gravity.CENTER_VERTICAL or Gravity.START
|
|
||||||
}
|
|
||||||
"center" -> {
|
|
||||||
holder.textView.setCompoundDrawablesWithIntrinsicBounds(holder.textView.compoundDrawables.filterNotNull().first(),null,holder.textView.compoundDrawables.filterNotNull().first(), null)
|
|
||||||
holder.textView.gravity = Gravity.CENTER
|
|
||||||
|
|
||||||
}
|
uiUtils.setAppSize(preferences, holder.textView)
|
||||||
"right" -> {
|
|
||||||
holder.textView.setCompoundDrawablesWithIntrinsicBounds(null,null, holder.textView.compoundDrawables.filterNotNull().first(), null)
|
|
||||||
holder.textView.gravity = Gravity.CENTER_VERTICAL or Gravity.END
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
when (preferences.getString("appMenuSize", "medium")) {
|
|
||||||
"small" -> {
|
|
||||||
holder.textView.textSize = 24F
|
|
||||||
holder.editText.textSize = 24F
|
|
||||||
}
|
|
||||||
|
|
||||||
"medium" -> {
|
|
||||||
holder.textView.textSize = 26F
|
|
||||||
holder.editText.textSize = 26F
|
|
||||||
}
|
|
||||||
|
|
||||||
"large" -> {
|
|
||||||
holder.textView.textSize = 28F
|
|
||||||
holder.editText.textSize = 28F
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
val appInfo = app.first.activityInfo.applicationInfo
|
val appInfo = app.first.activityInfo.applicationInfo
|
||||||
holder.textView.text = sharedPreferenceManager.getAppName(activity, app.first.applicationInfo.packageName,app.second.second, holder.itemView.context.packageManager.getApplicationLabel(appInfo))
|
holder.textView.text = sharedPreferenceManager.getAppName(activity, app.first.applicationInfo.packageName,app.second.second, holder.itemView.context.packageManager.getApplicationLabel(appInfo))
|
||||||
|
|
|
||||||
|
|
@ -8,26 +8,26 @@ import android.os.Bundle
|
||||||
import android.os.UserHandle
|
import android.os.UserHandle
|
||||||
import android.text.Editable
|
import android.text.Editable
|
||||||
import android.text.TextWatcher
|
import android.text.TextWatcher
|
||||||
import androidx.fragment.app.Fragment
|
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.view.inputmethod.InputMethodManager
|
import android.view.inputmethod.InputMethodManager
|
||||||
import android.widget.EditText
|
import androidx.fragment.app.Fragment
|
||||||
import androidx.preference.PreferenceManager
|
import androidx.preference.PreferenceManager
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
|
import com.google.android.material.textfield.TextInputEditText
|
||||||
|
|
||||||
class HiddenAppsFragment : Fragment(), HiddenAppsAdapter.OnItemClickListener {
|
class HiddenAppsFragment : Fragment(), HiddenAppsAdapter.OnItemClickListener {
|
||||||
private val appUtils = AppUtils()
|
private val appUtils = AppUtils()
|
||||||
private val sharedPreferenceManager = SharedPreferenceManager()
|
private val sharedPreferenceManager = SharedPreferenceManager()
|
||||||
private var adapter: HiddenAppsAdapter? = null
|
private var adapter: HiddenAppsAdapter? = null
|
||||||
private var stringUtils = StringUtils()
|
private var stringUtils = StringUtils()
|
||||||
|
private val uiUtils = UIUtils()
|
||||||
|
|
||||||
override fun onCreateView(
|
override fun onCreateView(
|
||||||
inflater: LayoutInflater, container: ViewGroup?,
|
inflater: LayoutInflater, container: ViewGroup?,
|
||||||
savedInstanceState: Bundle?
|
savedInstanceState: Bundle?
|
||||||
): View? {
|
): View? {
|
||||||
// Inflate the layout for this fragment
|
|
||||||
return inflater.inflate(R.layout.fragment_hidden_apps, container, false)
|
return inflater.inflate(R.layout.fragment_hidden_apps, container, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -37,13 +37,18 @@ class HiddenAppsFragment : Fragment(), HiddenAppsAdapter.OnItemClickListener {
|
||||||
adapter = HiddenAppsAdapter(requireContext(), appUtils.getHiddenApps(activity as Activity).toMutableList(), this)
|
adapter = HiddenAppsAdapter(requireContext(), appUtils.getHiddenApps(activity as Activity).toMutableList(), this)
|
||||||
val recyclerView = view.findViewById<RecyclerView>(R.id.hidden_app_recycler)
|
val recyclerView = view.findViewById<RecyclerView>(R.id.hidden_app_recycler)
|
||||||
val appMenuEdgeFactory = AppMenuEdgeFactory(requireActivity())
|
val appMenuEdgeFactory = AppMenuEdgeFactory(requireActivity())
|
||||||
|
val preferences = PreferenceManager.getDefaultSharedPreferences(requireContext())
|
||||||
|
|
||||||
recyclerView.edgeEffectFactory = appMenuEdgeFactory
|
recyclerView.edgeEffectFactory = appMenuEdgeFactory
|
||||||
recyclerView.adapter = adapter
|
recyclerView.adapter = adapter
|
||||||
|
|
||||||
recyclerView.scrollToPosition(0)
|
recyclerView.scrollToPosition(0)
|
||||||
|
|
||||||
val searchView = view.findViewById<EditText>(R.id.hiddenAppSearch)
|
val searchView = view.findViewById<TextInputEditText>(R.id.hiddenAppSearch)
|
||||||
|
|
||||||
|
uiUtils.setMenuTitleAlignment(preferences, view.findViewById(R.id.hidden_menutitle))
|
||||||
|
uiUtils.setSearchAlignment(preferences, searchView)
|
||||||
|
uiUtils.setSearchSize(preferences, searchView)
|
||||||
|
|
||||||
recyclerView.addOnLayoutChangeListener { _, _, top, _, bottom, _, oldTop, _, oldBottom ->
|
recyclerView.addOnLayoutChangeListener { _, _, top, _, bottom, _, oldTop, _, oldBottom ->
|
||||||
|
|
||||||
|
|
@ -113,7 +118,7 @@ class HiddenAppsFragment : Fragment(), HiddenAppsAdapter.OnItemClickListener {
|
||||||
setMessage("Are you sure you want to unhide $appName?")
|
setMessage("Are you sure you want to unhide $appName?")
|
||||||
setPositiveButton("Yes") { _, _ ->
|
setPositiveButton("Yes") { _, _ ->
|
||||||
// Perform action on confirmation
|
// Perform action on confirmation
|
||||||
performConfirmedAction(appInfo, appName, profile)
|
performConfirmedAction(appInfo, profile)
|
||||||
}
|
}
|
||||||
|
|
||||||
setNegativeButton("Cancel") { _, _ ->
|
setNegativeButton("Cancel") { _, _ ->
|
||||||
|
|
@ -121,15 +126,11 @@ class HiddenAppsFragment : Fragment(), HiddenAppsAdapter.OnItemClickListener {
|
||||||
}.create().show()
|
}.create().show()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun performConfirmedAction(appInfo: LauncherActivityInfo, appName: String, profile: Int) {
|
private fun performConfirmedAction(appInfo: LauncherActivityInfo, profile: Int) {
|
||||||
sharedPreferenceManager.setAppVisible(requireContext(), appInfo.applicationInfo.packageName, profile)
|
sharedPreferenceManager.setAppVisible(requireContext(), appInfo.applicationInfo.packageName, profile)
|
||||||
adapter?.updateApps(appUtils.getHiddenApps(requireActivity()))
|
adapter?.updateApps(appUtils.getHiddenApps(requireActivity()))
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun handleCancellation() {
|
|
||||||
// Handle the cancellation of the dialog
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onItemClick(appInfo: LauncherActivityInfo, profile: Int) {
|
override fun onItemClick(appInfo: LauncherActivityInfo, profile: Int) {
|
||||||
showConfirmationDialog(appInfo, sharedPreferenceManager.getAppName(requireContext(), appInfo.applicationInfo.packageName,profile, requireContext().packageManager.getApplicationLabel(appInfo.applicationInfo)).toString(), profile)
|
showConfirmationDialog(appInfo, sharedPreferenceManager.getAppName(requireContext(), appInfo.applicationInfo.packageName,profile, requireContext().packageManager.getApplicationLabel(appInfo.applicationInfo)).toString(), profile)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,18 +5,15 @@ import android.content.Context
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.text.Editable
|
import android.text.Editable
|
||||||
import android.text.TextWatcher
|
import android.text.TextWatcher
|
||||||
import androidx.fragment.app.Fragment
|
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.view.inputmethod.InputMethodManager
|
import android.view.inputmethod.InputMethodManager
|
||||||
import android.widget.EditText
|
import androidx.fragment.app.Fragment
|
||||||
import androidx.fragment.app.setFragmentResult
|
|
||||||
import androidx.lifecycle.lifecycleScope
|
import androidx.lifecycle.lifecycleScope
|
||||||
import androidx.preference.Preference
|
|
||||||
import androidx.preference.PreferenceManager
|
import androidx.preference.PreferenceManager
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import com.google.android.material.textfield.TextInputEditText
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
|
|
@ -27,6 +24,7 @@ class LocationFragment : Fragment(), LocationListAdapter.OnItemClickListener {
|
||||||
private val weatherSystem = WeatherSystem()
|
private val weatherSystem = WeatherSystem()
|
||||||
private val sharedPreferenceManager = SharedPreferenceManager()
|
private val sharedPreferenceManager = SharedPreferenceManager()
|
||||||
private val stringUtils = StringUtils()
|
private val stringUtils = StringUtils()
|
||||||
|
private val uiUtils = UIUtils()
|
||||||
|
|
||||||
override fun onCreateView(
|
override fun onCreateView(
|
||||||
inflater: LayoutInflater, container: ViewGroup?,
|
inflater: LayoutInflater, container: ViewGroup?,
|
||||||
|
|
@ -39,10 +37,12 @@ class LocationFragment : Fragment(), LocationListAdapter.OnItemClickListener {
|
||||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
super.onViewCreated(view, savedInstanceState)
|
super.onViewCreated(view, savedInstanceState)
|
||||||
|
|
||||||
val searchView = view.findViewById<EditText>(R.id.locationSearch)
|
val searchView = view.findViewById<TextInputEditText>(R.id.locationSearch)
|
||||||
|
|
||||||
var locationList = mutableListOf<Map<String, String>>()
|
var locationList = mutableListOf<Map<String, String>>()
|
||||||
|
|
||||||
|
val preferences = PreferenceManager.getDefaultSharedPreferences(requireContext())
|
||||||
|
|
||||||
stringUtils.setLink(requireActivity().findViewById(R.id.locationLink), getString(R.string.location_link))
|
stringUtils.setLink(requireActivity().findViewById(R.id.locationLink), getString(R.string.location_link))
|
||||||
|
|
||||||
lifecycleScope.launch(Dispatchers.IO) {
|
lifecycleScope.launch(Dispatchers.IO) {
|
||||||
|
|
@ -54,6 +54,9 @@ class LocationFragment : Fragment(), LocationListAdapter.OnItemClickListener {
|
||||||
adapter = LocationListAdapter(requireContext(), locationList, this)
|
adapter = LocationListAdapter(requireContext(), locationList, this)
|
||||||
val recyclerView = view.findViewById<RecyclerView>(R.id.locationrecycler)
|
val recyclerView = view.findViewById<RecyclerView>(R.id.locationrecycler)
|
||||||
val appMenuEdgeFactory = AppMenuEdgeFactory(requireActivity())
|
val appMenuEdgeFactory = AppMenuEdgeFactory(requireActivity())
|
||||||
|
uiUtils.setMenuTitleAlignment(preferences, view.findViewById(R.id.location_menutitle))
|
||||||
|
uiUtils.setSearchAlignment(preferences, searchView)
|
||||||
|
uiUtils.setSearchSize(preferences, searchView)
|
||||||
|
|
||||||
recyclerView.edgeEffectFactory = appMenuEdgeFactory
|
recyclerView.edgeEffectFactory = appMenuEdgeFactory
|
||||||
recyclerView.adapter = adapter
|
recyclerView.adapter = adapter
|
||||||
|
|
|
||||||
|
|
@ -2,28 +2,23 @@ package eu.ottop.yamlauncher
|
||||||
|
|
||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.pm.LauncherActivityInfo
|
|
||||||
import android.view.Gravity
|
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.widget.EditText
|
|
||||||
import android.widget.FrameLayout
|
|
||||||
import android.widget.LinearLayout
|
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
import androidx.constraintlayout.widget.ConstraintLayout
|
import androidx.constraintlayout.widget.ConstraintLayout
|
||||||
import androidx.core.content.res.ResourcesCompat
|
|
||||||
import androidx.preference.PreferenceManager
|
import androidx.preference.PreferenceManager
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
|
|
||||||
class LocationListAdapter(
|
class LocationListAdapter(
|
||||||
activity: Context,
|
private val activity: Context,
|
||||||
var apps: MutableList<Map<String, String>>,
|
private var apps: MutableList<Map<String, String>>,
|
||||||
private val itemClickListener: OnItemClickListener
|
private val itemClickListener: OnItemClickListener
|
||||||
) :
|
) :
|
||||||
RecyclerView.Adapter<LocationListAdapter.AppViewHolder>() {
|
RecyclerView.Adapter<LocationListAdapter.AppViewHolder>() {
|
||||||
|
|
||||||
private var preferences = PreferenceManager.getDefaultSharedPreferences(activity)
|
private var preferences = PreferenceManager.getDefaultSharedPreferences(activity)
|
||||||
|
private val uiUtils = UIUtils()
|
||||||
|
|
||||||
interface OnItemClickListener {
|
interface OnItemClickListener {
|
||||||
fun onItemClick(name: String?, latitude: String?, longitude: String?)
|
fun onItemClick(name: String?, latitude: String?, longitude: String?)
|
||||||
|
|
@ -56,42 +51,12 @@ class LocationListAdapter(
|
||||||
override fun onBindViewHolder(holder: AppViewHolder, position: Int) {
|
override fun onBindViewHolder(holder: AppViewHolder, position: Int) {
|
||||||
val app = apps[position]
|
val app = apps[position]
|
||||||
|
|
||||||
when (preferences.getString("appMenuAlignment", "left")) {
|
uiUtils.setAppAlignment(activity, preferences, holder.textView, null ,holder.regionText)
|
||||||
"left" -> {
|
|
||||||
holder.textView.gravity = Gravity.CENTER_VERTICAL or Gravity.START
|
|
||||||
holder.regionText.gravity = Gravity.CENTER_VERTICAL or Gravity.START
|
|
||||||
}
|
|
||||||
"center" -> {
|
|
||||||
holder.textView.gravity = Gravity.CENTER
|
|
||||||
holder.regionText.gravity = Gravity.CENTER
|
|
||||||
|
|
||||||
|
uiUtils.setAppSize(preferences, holder.textView, null, holder.regionText)
|
||||||
}
|
|
||||||
"right" -> {
|
|
||||||
holder.textView.gravity = Gravity.CENTER_VERTICAL or Gravity.END
|
|
||||||
holder.regionText.gravity = Gravity.CENTER_VERTICAL or Gravity.END
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
when (preferences.getString("appMenuSize", "medium")) {
|
|
||||||
"small" -> {
|
|
||||||
holder.textView.textSize = 24F
|
|
||||||
holder.regionText.textSize = 14F
|
|
||||||
}
|
|
||||||
|
|
||||||
"medium" -> {
|
|
||||||
holder.textView.textSize = 26F
|
|
||||||
holder.regionText.textSize = 16F
|
|
||||||
}
|
|
||||||
|
|
||||||
"large" -> {
|
|
||||||
holder.textView.textSize = 28F
|
|
||||||
holder.regionText.textSize = 18F
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
holder.textView.text = app["name"]
|
holder.textView.text = app["name"]
|
||||||
holder.regionText.text = "${app["region"]}${app["country"]}"
|
holder.regionText.text = activity.getString(R.string.region_text, app["region"], app["country"])
|
||||||
|
|
||||||
holder.textView.visibility = View.VISIBLE
|
holder.textView.visibility = View.VISIBLE
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -44,49 +44,47 @@ import kotlin.math.abs
|
||||||
|
|
||||||
class MainActivity : AppCompatActivity(), SharedPreferences.OnSharedPreferenceChangeListener, AppMenuAdapter.OnItemClickListener, AppMenuAdapter.OnShortcutListener, AppMenuAdapter.OnItemLongClickListener {
|
class MainActivity : AppCompatActivity(), SharedPreferences.OnSharedPreferenceChangeListener, AppMenuAdapter.OnItemClickListener, AppMenuAdapter.OnShortcutListener, AppMenuAdapter.OnItemLongClickListener {
|
||||||
|
|
||||||
private lateinit var binding: ActivityMainBinding
|
private val weatherSystem = WeatherSystem()
|
||||||
private lateinit var gestureDetector: GestureDetector
|
private val appUtils = AppUtils()
|
||||||
private lateinit var shortcutGestureDetector: GestureDetector
|
private val stringUtils = StringUtils()
|
||||||
private lateinit var launcherApps: LauncherApps
|
private val uiUtils = UIUtils()
|
||||||
private lateinit var installedApps: List<Pair<LauncherActivityInfo, Pair<UserHandle, Int>>>
|
private val gestureUtils = GestureUtils()
|
||||||
|
|
||||||
|
private var appActionMenu = AppActionMenu()
|
||||||
|
private val appMenuLinearLayoutManager = AppMenuLinearLayoutManager(this@MainActivity)
|
||||||
|
private val appMenuEdgeFactory = AppMenuEdgeFactory(this@MainActivity)
|
||||||
|
|
||||||
|
private val sharedPreferenceManager = SharedPreferenceManager()
|
||||||
|
|
||||||
|
private val animations = Animations()
|
||||||
|
|
||||||
|
private lateinit var clock: TextClock
|
||||||
|
private var clockMargin = 0
|
||||||
|
private lateinit var dateText: TextClock
|
||||||
|
private var dateElements = mutableListOf<String>()
|
||||||
|
|
||||||
private lateinit var recyclerView: RecyclerView
|
private lateinit var recyclerView: RecyclerView
|
||||||
private lateinit var searchView: TextInputEditText
|
private lateinit var searchView: TextInputEditText
|
||||||
private var adapter: AppMenuAdapter? = null
|
private var adapter: AppMenuAdapter? = null
|
||||||
private var batteryReceiver: BatteryReceiver? = null
|
private var batteryReceiver: BatteryReceiver? = null
|
||||||
|
|
||||||
private var appActionMenu = AppActionMenu()
|
private lateinit var binding: ActivityMainBinding
|
||||||
private val sharedPreferenceManager = SharedPreferenceManager()
|
private lateinit var launcherApps: LauncherApps
|
||||||
private val appUtils = AppUtils()
|
private lateinit var installedApps: List<Pair<LauncherActivityInfo, Pair<UserHandle, Int>>>
|
||||||
private val appMenuLinearLayoutManager = AppMenuLinearLayoutManager(this@MainActivity)
|
|
||||||
private val appMenuEdgeFactory = AppMenuEdgeFactory(this@MainActivity)
|
private lateinit var preferences: SharedPreferences
|
||||||
private val animations = Animations()
|
|
||||||
|
private var isBatteryReceiverRegistered = false
|
||||||
|
var isJobActive = true
|
||||||
|
|
||||||
private val swipeThreshold = 100
|
private val swipeThreshold = 100
|
||||||
private val swipeVelocityThreshold = 100
|
private val swipeVelocityThreshold = 100
|
||||||
|
|
||||||
private lateinit var clock: TextClock
|
|
||||||
private var clockMargin = 0
|
|
||||||
|
|
||||||
private lateinit var dateText: TextClock
|
|
||||||
|
|
||||||
private lateinit var preferences: SharedPreferences
|
|
||||||
|
|
||||||
private val stringUtils = StringUtils()
|
|
||||||
|
|
||||||
private var dateElements = mutableListOf<String>()
|
|
||||||
|
|
||||||
private val weatherSystem = WeatherSystem()
|
|
||||||
|
|
||||||
private lateinit var uiUtils: UIUtils
|
|
||||||
private lateinit var gestureUtils: GestureUtils
|
|
||||||
|
|
||||||
private var isBatteryReceiverRegistered = false
|
|
||||||
|
|
||||||
private lateinit var leftSwipeActivity: Pair<LauncherActivityInfo?, Int?>
|
private lateinit var leftSwipeActivity: Pair<LauncherActivityInfo?, Int?>
|
||||||
private lateinit var rightSwipeActivity: Pair<LauncherActivityInfo?, Int?>
|
private lateinit var rightSwipeActivity: Pair<LauncherActivityInfo?, Int?>
|
||||||
|
|
||||||
var isJobActive = true
|
private lateinit var gestureDetector: GestureDetector
|
||||||
|
private lateinit var shortcutGestureDetector: GestureDetector
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
|
|
@ -140,8 +138,6 @@ class MainActivity : AppCompatActivity(), SharedPreferences.OnSharedPreferenceCh
|
||||||
launcherApps = getSystemService(Context.LAUNCHER_APPS_SERVICE) as LauncherApps
|
launcherApps = getSystemService(Context.LAUNCHER_APPS_SERVICE) as LauncherApps
|
||||||
|
|
||||||
preferences = PreferenceManager.getDefaultSharedPreferences(this)
|
preferences = PreferenceManager.getDefaultSharedPreferences(this)
|
||||||
uiUtils = UIUtils()
|
|
||||||
gestureUtils = GestureUtils()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setPreferences() {
|
private fun setPreferences() {
|
||||||
|
|
@ -211,6 +207,9 @@ class MainActivity : AppCompatActivity(), SharedPreferences.OnSharedPreferenceCh
|
||||||
Toast.makeText(this, "Long click to select an app", Toast.LENGTH_SHORT).show()
|
Toast.makeText(this, "Long click to select an app", Toast.LENGTH_SHORT).show()
|
||||||
}
|
}
|
||||||
textView.setOnLongClickListener {
|
textView.setOnLongClickListener {
|
||||||
|
uiUtils.setMenuTitleAlignment(preferences, binding.menutitle)
|
||||||
|
binding.menutitle.visibility = View.VISIBLE
|
||||||
|
|
||||||
adapter?.shortcutTextView = textView
|
adapter?.shortcutTextView = textView
|
||||||
toAppMenu()
|
toAppMenu()
|
||||||
|
|
||||||
|
|
@ -305,7 +304,7 @@ class MainActivity : AppCompatActivity(), SharedPreferences.OnSharedPreferenceCh
|
||||||
}
|
}
|
||||||
|
|
||||||
"shortcutAlignment" -> {
|
"shortcutAlignment" -> {
|
||||||
uiUtils.setShortcutSize(preferences, binding.homeView)
|
uiUtils.setShortcutAlignment(preferences, binding.homeView)
|
||||||
}
|
}
|
||||||
|
|
||||||
"searchAlignment" -> {
|
"searchAlignment" -> {
|
||||||
|
|
@ -369,7 +368,6 @@ class MainActivity : AppCompatActivity(), SharedPreferences.OnSharedPreferenceCh
|
||||||
val handler = Handler(Looper.getMainLooper())
|
val handler = Handler(Looper.getMainLooper())
|
||||||
handler.postDelayed({
|
handler.postDelayed({
|
||||||
try {
|
try {
|
||||||
binding.menutitle.visibility = View.VISIBLE
|
|
||||||
searchView.setText(R.string.empty)
|
searchView.setText(R.string.empty)
|
||||||
}
|
}
|
||||||
catch (_: UninitializedPropertyAccessException) {
|
catch (_: UninitializedPropertyAccessException) {
|
||||||
|
|
@ -554,8 +552,10 @@ class MainActivity : AppCompatActivity(), SharedPreferences.OnSharedPreferenceCh
|
||||||
}
|
}
|
||||||
|
|
||||||
suspend fun applySearch() {
|
suspend fun applySearch() {
|
||||||
|
withContext(Dispatchers.Default) {
|
||||||
filterItems(searchView.text.toString())
|
filterItems(searchView.text.toString())
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
override fun onNewIntent(intent: Intent) {
|
override fun onNewIntent(intent: Intent) {
|
||||||
|
|
@ -737,7 +737,6 @@ class MainActivity : AppCompatActivity(), SharedPreferences.OnSharedPreferenceCh
|
||||||
ScreenLockService::class.java
|
ScreenLockService::class.java
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
println("enabled")
|
|
||||||
val intent = Intent(this@MainActivity, ScreenLockService::class.java)
|
val intent = Intent(this@MainActivity, ScreenLockService::class.java)
|
||||||
intent.action = "LOCK_SCREEN"
|
intent.action = "LOCK_SCREEN"
|
||||||
startService(intent)
|
startService(intent)
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,7 @@
|
||||||
package eu.ottop.yamlauncher
|
package eu.ottop.yamlauncher
|
||||||
|
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.View
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import android.widget.AdapterView
|
|
||||||
import androidx.core.content.ContextCompat
|
|
||||||
import eu.ottop.yamlauncher.databinding.ActivitySettingsBinding
|
import eu.ottop.yamlauncher.databinding.ActivitySettingsBinding
|
||||||
|
|
||||||
class SettingsActivity : AppCompatActivity() {
|
class SettingsActivity : AppCompatActivity() {
|
||||||
|
|
|
||||||
|
|
@ -16,8 +16,6 @@ class SettingsFragment : PreferenceFragmentCompat() {
|
||||||
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
|
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
|
||||||
setPreferencesFromResource(R.xml.root_preferences, rootKey)
|
setPreferencesFromResource(R.xml.root_preferences, rootKey)
|
||||||
|
|
||||||
val weatherSystem = WeatherSystem()
|
|
||||||
|
|
||||||
val gpsLocationPref: SwitchPreference? = findPreference("gps_location")
|
val gpsLocationPref: SwitchPreference? = findPreference("gps_location")
|
||||||
manualLocationPref = findPreference("manual_location")
|
manualLocationPref = findPreference("manual_location")
|
||||||
val leftSwipePref = findPreference<Preference?>("leftSwipeApp")
|
val leftSwipePref = findPreference<Preference?>("leftSwipeApp")
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package eu.ottop.yamlauncher
|
package eu.ottop.yamlauncher
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
import android.content.SharedPreferences
|
import android.content.SharedPreferences
|
||||||
import android.graphics.BlendMode
|
import android.graphics.BlendMode
|
||||||
import android.graphics.BlendModeColorFilter
|
import android.graphics.BlendModeColorFilter
|
||||||
|
|
@ -15,10 +16,11 @@ import android.view.WindowInsetsController
|
||||||
import android.widget.LinearLayout
|
import android.widget.LinearLayout
|
||||||
import android.widget.TextClock
|
import android.widget.TextClock
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
|
import androidx.core.content.res.ResourcesCompat
|
||||||
import androidx.core.view.children
|
import androidx.core.view.children
|
||||||
import com.google.android.material.textfield.TextInputEditText
|
import com.google.android.material.textfield.TextInputEditText
|
||||||
|
|
||||||
class UIUtils() {
|
class UIUtils {
|
||||||
|
|
||||||
fun setBackground(window: Window, preferences: SharedPreferences) {
|
fun setBackground(window: Window, preferences: SharedPreferences) {
|
||||||
window.setBackgroundDrawable(ColorDrawable(Color.parseColor("#00000000")))
|
window.setBackgroundDrawable(ColorDrawable(Color.parseColor("#00000000")))
|
||||||
|
|
@ -64,14 +66,15 @@ class UIUtils() {
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setSearchColors(preferences: SharedPreferences, searchView: TextInputEditText) {
|
fun setSearchColors(preferences: SharedPreferences, searchView: TextInputEditText) {
|
||||||
|
val color = Color.parseColor(preferences.getString("textColor", "#FFF3F3F3"))
|
||||||
val viewTreeObserver = searchView.viewTreeObserver
|
val viewTreeObserver = searchView.viewTreeObserver
|
||||||
|
|
||||||
val globalLayoutListener = object : ViewTreeObserver.OnGlobalLayoutListener {
|
val globalLayoutListener = object : ViewTreeObserver.OnGlobalLayoutListener {
|
||||||
override fun onGlobalLayout() {
|
override fun onGlobalLayout() {
|
||||||
searchView.setTextColor(Color.parseColor(preferences.getString("textColor", "#FFF3F3F3")))
|
searchView.setTextColor(color)
|
||||||
searchView.setHintTextColor(setAlpha(Color.parseColor(preferences.getString("textColor", "#FFF3F3F3")), "A9"))
|
searchView.setHintTextColor(setAlpha(Color.parseColor(preferences.getString("textColor", "#FFF3F3F3")), "A9"))
|
||||||
searchView.compoundDrawables[0].mutate().colorFilter =
|
searchView.compoundDrawables[0].mutate().colorFilter =
|
||||||
BlendModeColorFilter(Color.parseColor(preferences.getString("textColor", "#FFF3F3F3")), BlendMode.SRC_ATOP)
|
BlendModeColorFilter(color, BlendMode.SRC_ATOP)
|
||||||
|
|
||||||
if (viewTreeObserver.isAlive) {
|
if (viewTreeObserver.isAlive) {
|
||||||
viewTreeObserver.removeOnGlobalLayoutListener(this)
|
viewTreeObserver.removeOnGlobalLayoutListener(this)
|
||||||
|
|
@ -85,8 +88,9 @@ class UIUtils() {
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setClockAlignment(preferences: SharedPreferences, clock: TextClock, dateText: TextClock) {
|
fun setClockAlignment(preferences: SharedPreferences, clock: TextClock, dateText: TextClock) {
|
||||||
setTextAlignment(clock, preferences.getString("clockAlignment", "left"))
|
val alignment = preferences.getString("clockAlignment", "left")
|
||||||
setTextAlignment(dateText, preferences.getString("clockAlignment", "left"))
|
setTextAlignment(clock, alignment)
|
||||||
|
setTextAlignment(dateText, alignment)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setShortcutAlignment(preferences: SharedPreferences, shortcuts: LinearLayout) {
|
fun setShortcutAlignment(preferences: SharedPreferences, shortcuts: LinearLayout) {
|
||||||
|
|
@ -128,10 +132,44 @@ class UIUtils() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun setAppAlignment(activity: Context, preferences: SharedPreferences, textView: TextView, editText: TextInputEditText? = null, regionText: TextView? = null) {
|
||||||
|
val alignment = preferences.getString("appMenuAlignment", "left")
|
||||||
|
setTextGravity(textView, alignment)
|
||||||
|
|
||||||
|
if (regionText != null) {
|
||||||
|
setTextGravity(textView, alignment)
|
||||||
|
setTextGravity(regionText, alignment)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
when (alignment) {
|
||||||
|
"left" -> {
|
||||||
|
textView.setCompoundDrawablesWithIntrinsicBounds(textView.compoundDrawables.filterNotNull().first(),null, ResourcesCompat.getDrawable(activity.resources, R.drawable.ic_empty, null), null)
|
||||||
|
editText?.gravity = Gravity.CENTER_VERTICAL or Gravity.START
|
||||||
|
|
||||||
|
}
|
||||||
|
"center" -> {
|
||||||
|
textView.setCompoundDrawablesWithIntrinsicBounds(textView.compoundDrawables.filterNotNull().first(),null, textView.compoundDrawables.filterNotNull().first(), null)
|
||||||
|
editText?.gravity = Gravity.CENTER_VERTICAL or Gravity.END
|
||||||
|
|
||||||
|
}
|
||||||
|
"right" -> {
|
||||||
|
textView.setCompoundDrawablesWithIntrinsicBounds(ResourcesCompat.getDrawable(activity.resources, R.drawable.ic_empty, null),null, textView.compoundDrawables.filterNotNull().first(), null)
|
||||||
|
editText?.gravity = Gravity.CENTER_VERTICAL or Gravity.END
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
fun setSearchAlignment(preferences: SharedPreferences, searchView: TextInputEditText) {
|
fun setSearchAlignment(preferences: SharedPreferences, searchView: TextInputEditText) {
|
||||||
setTextAlignment(searchView, preferences.getString("searchAlignment", "left"))
|
setTextAlignment(searchView, preferences.getString("searchAlignment", "left"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun setMenuTitleAlignment(preferences: SharedPreferences, menuTitle: TextView) {
|
||||||
|
setTextGravity(menuTitle, preferences.getString("appMenuAlignment", "left"))
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
private fun setTextAlignment(view: TextView, alignment: String?) {
|
private fun setTextAlignment(view: TextView, alignment: String?) {
|
||||||
view.textAlignment = when (alignment) {
|
view.textAlignment = when (alignment) {
|
||||||
"left" -> View.TEXT_ALIGNMENT_VIEW_START
|
"left" -> View.TEXT_ALIGNMENT_VIEW_START
|
||||||
|
|
@ -144,6 +182,18 @@ class UIUtils() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun setTextGravity(view: TextView, alignment: String?) {
|
||||||
|
view.gravity = when (alignment) {
|
||||||
|
"left" -> Gravity.CENTER_VERTICAL or Gravity.START
|
||||||
|
|
||||||
|
"center" -> Gravity.CENTER
|
||||||
|
|
||||||
|
"right" -> Gravity.CENTER_VERTICAL or Gravity.END
|
||||||
|
|
||||||
|
else -> Gravity.CENTER_VERTICAL or Gravity.START
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fun setClockSize(preferences: SharedPreferences, clock: TextClock) {
|
fun setClockSize(preferences: SharedPreferences, clock: TextClock) {
|
||||||
setTextSize(clock, preferences.getString("clockSize","medium"), 48F, 58F, 68F)
|
setTextSize(clock, preferences.getString("clockSize","medium"), 48F, 58F, 68F)
|
||||||
}
|
}
|
||||||
|
|
@ -197,6 +247,17 @@ class UIUtils() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun setAppSize(preferences: SharedPreferences, textView: TextView, editText: TextInputEditText? = null, regionText: TextView? = null) {
|
||||||
|
val size = preferences.getString("appMenuSize", "medium")
|
||||||
|
setTextSize(textView, size, 24F, 26F, 28F)
|
||||||
|
if (editText != null) {
|
||||||
|
setTextSize(editText, size, 24F, 26F, 28F)
|
||||||
|
}
|
||||||
|
if (regionText != null) {
|
||||||
|
setTextSize(regionText, size, 14F, 16F, 18F)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fun setSearchSize(preferences: SharedPreferences, searchView: TextInputEditText) {
|
fun setSearchSize(preferences: SharedPreferences, searchView: TextInputEditText) {
|
||||||
setTextSize(searchView, preferences.getString("searchSize", "medium"), 21F, 23F, 25F)
|
setTextSize(searchView, preferences.getString("searchSize", "medium"), 21F, 23F, 25F)
|
||||||
}
|
}
|
||||||
|
|
@ -227,5 +288,4 @@ class UIUtils() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -1,29 +1,19 @@
|
||||||
package eu.ottop.yamlauncher
|
package eu.ottop.yamlauncher
|
||||||
|
|
||||||
import android.Manifest
|
import android.Manifest
|
||||||
import android.app.Activity
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.pm.PackageManager
|
import android.content.pm.PackageManager
|
||||||
import android.location.Location
|
import android.location.Location
|
||||||
import android.location.LocationListener
|
|
||||||
import android.location.LocationManager
|
import android.location.LocationManager
|
||||||
import android.os.Handler
|
|
||||||
import android.os.Looper
|
|
||||||
import android.widget.Toast
|
|
||||||
import androidx.core.app.ActivityCompat
|
import androidx.core.app.ActivityCompat
|
||||||
import androidx.core.content.ContextCompat
|
import androidx.core.content.ContextCompat
|
||||||
import androidx.preference.PreferenceManager
|
import androidx.preference.PreferenceManager
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.asExecutor
|
|
||||||
import kotlinx.coroutines.coroutineScope
|
|
||||||
import kotlinx.coroutines.delay
|
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import kotlinx.coroutines.withContext
|
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
import java.net.HttpURLConnection
|
import java.net.HttpURLConnection
|
||||||
import java.net.URL
|
import java.net.URL
|
||||||
import kotlin.coroutines.coroutineContext
|
|
||||||
|
|
||||||
class WeatherSystem {
|
class WeatherSystem {
|
||||||
|
|
||||||
|
|
@ -134,7 +124,7 @@ class WeatherSystem {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
currentWeather = "$weatherType ${currentData.getInt("temperature_2m").toString()}"
|
currentWeather = "$weatherType ${currentData.getInt("temperature_2m")}"
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,5 +26,6 @@
|
||||||
<string name="weather_link"><![CDATA[Weather data by <a href="https://open-meteo.com/">Open-Meteo.com</a><br>(<a href="https://creativecommons.org/licenses/by/4.0/">CC BY 4.0</a>)]]></string>
|
<string name="weather_link"><![CDATA[Weather data by <a href="https://open-meteo.com/">Open-Meteo.com</a><br>(<a href="https://creativecommons.org/licenses/by/4.0/">CC BY 4.0</a>)]]></string>
|
||||||
<string name="location_link"><![CDATA[Location data by <a href="https://open-meteo.com/">Open-Meteo.com</a> (<a href="https://creativecommons.org/licenses/by/4.0/">CC BY 4.0</a>)]]></string>
|
<string name="location_link"><![CDATA[Location data by <a href="https://open-meteo.com/">Open-Meteo.com</a> (<a href="https://creativecommons.org/licenses/by/4.0/">CC BY 4.0</a>)]]></string>
|
||||||
<string name="accessibility_service_description">Idk this is my service</string>
|
<string name="accessibility_service_description">Idk this is my service</string>
|
||||||
|
<string name="region_text">%1$s%2$s</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
@ -5,6 +5,7 @@ pluginManagement {
|
||||||
gradlePluginPortal()
|
gradlePluginPortal()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencyResolutionManagement {
|
dependencyResolutionManagement {
|
||||||
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
|
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
|
||||||
repositories {
|
repositories {
|
||||||
|
|
@ -15,4 +16,3 @@ dependencyResolutionManagement {
|
||||||
|
|
||||||
rootProject.name = "Yam Launcher"
|
rootProject.name = "Yam Launcher"
|
||||||
include(":app")
|
include(":app")
|
||||||
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue