mirror of
https://github.com/He4eT/yamf_launcher.git
synced 2026-05-04 17:37:25 +00:00
Alignment is finally fixed holy shit
This commit is contained in:
parent
96fb764072
commit
e14eb149b2
6 changed files with 136 additions and 133 deletions
|
|
@ -49,7 +49,7 @@ class AppActionMenu {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
actionMenu.visibility = View.GONE
|
actionMenu.visibility = View.INVISIBLE
|
||||||
textView.visibility = View.VISIBLE
|
textView.visibility = View.VISIBLE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -59,23 +59,22 @@ class AppActionMenu {
|
||||||
intent.putExtra(Intent.EXTRA_USER, userHandle)
|
intent.putExtra(Intent.EXTRA_USER, userHandle)
|
||||||
activity.startActivity(intent)
|
activity.startActivity(intent)
|
||||||
|
|
||||||
actionMenu.visibility = View.GONE
|
actionMenu.visibility = View.INVISIBLE
|
||||||
textView.visibility = View.VISIBLE
|
textView.visibility = View.VISIBLE
|
||||||
}
|
}
|
||||||
|
|
||||||
actionMenu.findViewById<TextView>(R.id.rename).setOnClickListener {
|
actionMenu.findViewById<TextView>(R.id.rename).setOnClickListener {
|
||||||
textView.visibility = View.GONE
|
textView.visibility = View.INVISIBLE
|
||||||
editLayout.visibility = View.VISIBLE
|
editLayout.visibility = View.VISIBLE
|
||||||
actionMenu.visibility = View.GONE
|
actionMenu.visibility = View.INVISIBLE
|
||||||
val editText = editLayout.findViewById<EditText>(R.id.app_name)
|
val editText = editLayout.findViewById<EditText>(R.id.app_name_edit)
|
||||||
searchView.visibility = View.GONE
|
searchView.visibility = View.INVISIBLE
|
||||||
editText.requestFocus()
|
editText.requestFocus()
|
||||||
|
|
||||||
val handler = Handler(Looper.getMainLooper())
|
val handler = Handler(Looper.getMainLooper())
|
||||||
handler.postDelayed({
|
handler.postDelayed({
|
||||||
val imm = activity.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
|
val imm = activity.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
|
||||||
imm.showSoftInput(editText, InputMethodManager.SHOW_IMPLICIT)
|
imm.showSoftInput(editText, InputMethodManager.SHOW_IMPLICIT)
|
||||||
//binding.appList.scrollToDescendant(textView)
|
|
||||||
}, 100)
|
}, 100)
|
||||||
|
|
||||||
binding.root.addOnLayoutChangeListener {
|
binding.root.addOnLayoutChangeListener {
|
||||||
|
|
@ -83,7 +82,7 @@ class AppActionMenu {
|
||||||
if (bottom - top > oldBottom - oldTop) {
|
if (bottom - top > oldBottom - oldTop) {
|
||||||
editLayout.clearFocus()
|
editLayout.clearFocus()
|
||||||
|
|
||||||
editLayout.visibility = View.GONE
|
editLayout.visibility = View.INVISIBLE
|
||||||
textView.visibility = View.VISIBLE
|
textView.visibility = View.VISIBLE
|
||||||
searchView.visibility = View.VISIBLE
|
searchView.visibility = View.VISIBLE
|
||||||
}
|
}
|
||||||
|
|
@ -106,12 +105,12 @@ class AppActionMenu {
|
||||||
|
|
||||||
actionMenu.findViewById<TextView>(R.id.hide).setOnClickListener {
|
actionMenu.findViewById<TextView>(R.id.hide).setOnClickListener {
|
||||||
sharedPreferenceManager.setAppHidden(activity, appInfo.packageName, workProfile, true)
|
sharedPreferenceManager.setAppHidden(activity, appInfo.packageName, workProfile, true)
|
||||||
actionMenu.visibility = View.GONE
|
actionMenu.visibility = View.INVISIBLE
|
||||||
textView.visibility = View.GONE
|
textView.visibility = View.INVISIBLE
|
||||||
}
|
}
|
||||||
|
|
||||||
actionMenu.findViewById<TextView>(R.id.close).setOnClickListener {
|
actionMenu.findViewById<TextView>(R.id.close).setOnClickListener {
|
||||||
actionMenu.visibility = View.GONE
|
actionMenu.visibility = View.INVISIBLE
|
||||||
textView.visibility = View.VISIBLE
|
textView.visibility = View.VISIBLE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,9 +5,13 @@ import android.content.pm.LauncherActivityInfo
|
||||||
import android.content.pm.LauncherApps
|
import android.content.pm.LauncherApps
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.os.UserHandle
|
import android.os.UserHandle
|
||||||
|
import android.util.Log
|
||||||
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.ViewTreeObserver
|
||||||
|
import android.widget.EditText
|
||||||
|
import android.widget.FrameLayout
|
||||||
import android.widget.LinearLayout
|
import android.widget.LinearLayout
|
||||||
import android.widget.SearchView
|
import android.widget.SearchView
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
|
|
@ -69,7 +73,7 @@ class AppMenuActivity : AppCompatActivity(), AppMenuAdapter.OnItemClickListener,
|
||||||
editView: LinearLayout
|
editView: LinearLayout
|
||||||
) {
|
) {
|
||||||
// Handle the long click action here, for example, show additional options or information about the app
|
// Handle the long click action here, for example, show additional options or information about the app
|
||||||
textView.visibility = View.GONE
|
textView.visibility = View.INVISIBLE
|
||||||
actionMenuLayout.visibility = View.VISIBLE
|
actionMenuLayout.visibility = View.VISIBLE
|
||||||
val mainActivity = launcherApps.getActivityList(appInfo.applicationInfo.packageName, userHandle).firstOrNull()
|
val mainActivity = launcherApps.getActivityList(appInfo.applicationInfo.packageName, userHandle).firstOrNull()
|
||||||
appActionMenu.setActionListeners(this@AppMenuActivity, CoroutineScope(Dispatchers.Main), binding, textView, editView, actionMenuLayout, searchView, appInfo.applicationInfo, userHandle, userProfile, launcherApps, mainActivity)
|
appActionMenu.setActionListeners(this@AppMenuActivity, CoroutineScope(Dispatchers.Main), binding, textView, editView, actionMenuLayout, searchView, appInfo.applicationInfo, userHandle, userProfile, launcherApps, mainActivity)
|
||||||
|
|
@ -150,18 +154,12 @@ class AppMenuActivity : AppCompatActivity(), AppMenuAdapter.OnItemClickListener,
|
||||||
}
|
}
|
||||||
|
|
||||||
inner class AppViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
|
inner class AppViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
|
||||||
val textView: TextView = itemView.findViewById(R.id.app_name)
|
private val listItem: FrameLayout = itemView.findViewById(R.id.list_item)
|
||||||
|
val textView: TextView = listItem.findViewById(R.id.app_name)
|
||||||
|
val actionMenuLayout: LinearLayout = listItem.findViewById(R.id.action_menu)
|
||||||
|
val editView: LinearLayout = listItem.findViewById(R.id.rename_view)
|
||||||
|
|
||||||
init {
|
init {
|
||||||
val actionMenuLayout = LayoutInflater.from(itemView.context)
|
|
||||||
.inflate(R.layout.app_action_menu, itemView.findViewById(R.id.list_item), false) as LinearLayout
|
|
||||||
val editView = LayoutInflater.from(itemView.context)
|
|
||||||
.inflate(R.layout.rename_view, itemView.findViewById(R.id.list_item), false) as LinearLayout
|
|
||||||
val parentLayout: ViewGroup = itemView.findViewById(R.id.list_item)
|
|
||||||
parentLayout.addView(actionMenuLayout)
|
|
||||||
parentLayout.addView(editView)
|
|
||||||
actionMenuLayout.visibility = View.GONE
|
|
||||||
editView.visibility = View.GONE
|
|
||||||
itemView.setOnClickListener {
|
itemView.setOnClickListener {
|
||||||
val position = bindingAdapterPosition
|
val position = bindingAdapterPosition
|
||||||
if (position != RecyclerView.NO_POSITION) {
|
if (position != RecyclerView.NO_POSITION) {
|
||||||
|
|
@ -190,6 +188,11 @@ class AppMenuActivity : AppCompatActivity(), AppMenuAdapter.OnItemClickListener,
|
||||||
val app = apps[position]
|
val app = apps[position]
|
||||||
val appInfo = app.first.activityInfo.applicationInfo
|
val appInfo = app.first.activityInfo.applicationInfo
|
||||||
holder.textView.text = appInfo.loadLabel(holder.itemView.context.packageManager)
|
holder.textView.text = appInfo.loadLabel(holder.itemView.context.packageManager)
|
||||||
|
holder.editView.findViewById<EditText>(R.id.app_name_edit).setText(holder.textView.text)
|
||||||
|
holder.actionMenuLayout.viewTreeObserver.addOnGlobalLayoutListener {
|
||||||
|
Log.d("Yooo", position.toString())
|
||||||
|
// Perform any action you want here
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getItemCount(): Int {
|
override fun getItemCount(): Int {
|
||||||
|
|
|
||||||
|
|
@ -1,69 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
android:id="@+id/action_menu"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:gravity="center">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/info"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:background="#6F000000"
|
|
||||||
android:foreground="@drawable/app_action_foreground"
|
|
||||||
android:text="Info"
|
|
||||||
android:textAlignment="center"
|
|
||||||
android:textColor="#F3F3F3FF"
|
|
||||||
app:drawableTopCompat="@android:drawable/ic_menu_info_details" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/uninstall"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:background="#6F000000"
|
|
||||||
android:foreground="@drawable/app_action_foreground"
|
|
||||||
android:text="Uninstall"
|
|
||||||
android:textAlignment="center"
|
|
||||||
android:textColor="#F3F3F3FF"
|
|
||||||
app:drawableTopCompat="@android:drawable/ic_menu_delete" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/rename"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:background="#6F000000"
|
|
||||||
android:foreground="@drawable/app_action_foreground"
|
|
||||||
android:text="Rename"
|
|
||||||
android:textAlignment="center"
|
|
||||||
android:textColor="#F3F3F3FF"
|
|
||||||
app:drawableTopCompat="@android:drawable/ic_menu_edit" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/hide"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:background="#6F000000"
|
|
||||||
android:foreground="@drawable/app_action_foreground"
|
|
||||||
android:text="Hide"
|
|
||||||
android:textAlignment="center"
|
|
||||||
android:textColor="#F3F3F3FF"
|
|
||||||
app:drawableTopCompat="@android:drawable/ic_menu_view" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/close"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:background="#6F000000"
|
|
||||||
android:foreground="@drawable/app_action_foreground"
|
|
||||||
android:text="Close"
|
|
||||||
android:textAlignment="center"
|
|
||||||
android:textColor="#F3F3F3FF"
|
|
||||||
app:drawableTopCompat="@android:drawable/ic_menu_close_clear_cancel" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
@ -1,12 +1,52 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:id="@+id/list_item"
|
android:id="@+id/list_item"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:padding="0dp">
|
android:padding="0dp">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/rename_view"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingVertical="10dp"
|
||||||
|
android:visibility="invisible">
|
||||||
|
|
||||||
|
<com.google.android.material.textfield.TextInputEditText
|
||||||
|
android:id="@+id/app_name_edit"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:background="#6F000000"
|
||||||
|
android:clickable="true"
|
||||||
|
android:elegantTextHeight="false"
|
||||||
|
android:imeOptions="actionDone"
|
||||||
|
android:includeFontPadding="true"
|
||||||
|
android:paddingLeft="40dp"
|
||||||
|
android:paddingTop="10dp"
|
||||||
|
android:paddingRight="40dp"
|
||||||
|
android:paddingBottom="10dp"
|
||||||
|
android:selectAllOnFocus="true"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:textSize="28sp" />
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.AppCompatButton
|
||||||
|
android:id="@+id/button2"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:layout_weight="0.3"
|
||||||
|
android:background="#89000000"
|
||||||
|
android:gravity="center"
|
||||||
|
android:insetTop="0dp"
|
||||||
|
android:insetBottom="0dp"
|
||||||
|
android:text="Reset"
|
||||||
|
android:textColor="#F3F3F3" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/app_name"
|
android:id="@+id/app_name"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|
@ -21,4 +61,73 @@
|
||||||
android:textSize="28sp"
|
android:textSize="28sp"
|
||||||
android:visibility="visible" />
|
android:visibility="visible" />
|
||||||
|
|
||||||
</LinearLayout>
|
<LinearLayout
|
||||||
|
android:id="@+id/action_menu"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:gravity="center"
|
||||||
|
android:visibility="invisible">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/info"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:background="#6F000000"
|
||||||
|
android:foreground="@drawable/app_action_foreground"
|
||||||
|
android:text="Info"
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:textColor="#F3F3F3FF"
|
||||||
|
app:drawableTopCompat="@android:drawable/ic_menu_info_details" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/uninstall"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:background="#6F000000"
|
||||||
|
android:foreground="@drawable/app_action_foreground"
|
||||||
|
android:text="Uninstall"
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:textColor="#F3F3F3FF"
|
||||||
|
app:drawableTopCompat="@android:drawable/ic_menu_delete" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/rename"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:background="#6F000000"
|
||||||
|
android:foreground="@drawable/app_action_foreground"
|
||||||
|
android:text="Rename"
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:textColor="#F3F3F3FF"
|
||||||
|
app:drawableTopCompat="@android:drawable/ic_menu_edit" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/hide"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:background="#6F000000"
|
||||||
|
android:foreground="@drawable/app_action_foreground"
|
||||||
|
android:text="Hide"
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:textColor="#F3F3F3FF"
|
||||||
|
app:drawableTopCompat="@android:drawable/ic_menu_view" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/close"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:background="#6F000000"
|
||||||
|
android:foreground="@drawable/app_action_foreground"
|
||||||
|
android:text="Close"
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:textColor="#F3F3F3FF"
|
||||||
|
app:drawableTopCompat="@android:drawable/ic_menu_close_clear_cancel" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
|
|
|
||||||
|
|
@ -1,39 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
android:id="@+id/rename_view"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:paddingVertical="10dp">
|
|
||||||
|
|
||||||
<com.google.android.material.textfield.TextInputEditText
|
|
||||||
android:id="@+id/app_name"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:background="#6F000000"
|
|
||||||
android:clickable="true"
|
|
||||||
android:elegantTextHeight="false"
|
|
||||||
android:imeOptions="actionDone"
|
|
||||||
android:includeFontPadding="true"
|
|
||||||
android:paddingLeft="60dp"
|
|
||||||
android:paddingTop="10dp"
|
|
||||||
android:paddingRight="40dp"
|
|
||||||
android:paddingBottom="10dp"
|
|
||||||
android:selectAllOnFocus="true"
|
|
||||||
android:singleLine="true"
|
|
||||||
android:textSize="28sp" />
|
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatButton
|
|
||||||
android:id="@+id/button2"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:layout_weight="0.3"
|
|
||||||
android:background="#89000000"
|
|
||||||
android:gravity="center"
|
|
||||||
android:insetTop="0dp"
|
|
||||||
android:insetBottom="0dp"
|
|
||||||
android:text="Reset"
|
|
||||||
android:textColor="#F3F3F3" />
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
<item name="app_name" type="id" />
|
<item name="app_name_edit" type="id" />
|
||||||
</resources>
|
</resources>
|
||||||
Loading…
Add table
Add a link
Reference in a new issue