mirror of
https://github.com/SimpleMobileTools/Simple-Launcher.git
synced 2025-03-03 02:37:59 +01:00
fixing some gesture related glitches
This commit is contained in:
parent
c39f8da9e7
commit
0f5ac6155d
@ -271,8 +271,7 @@ class MainActivity : SimpleActivity(), FlingListener {
|
||||
mIgnoreMoveEvents = false
|
||||
mLongPressedIcon = null
|
||||
mLastTouchCoords = Pair(-1f, -1f)
|
||||
(widgets_fragment as WidgetsFragment).ignoreTouches = false
|
||||
(all_apps_fragment as AllAppsFragment).ignoreTouches = false
|
||||
resetFragmentTouches()
|
||||
home_screen_grid.itemDraggingStopped()
|
||||
|
||||
if (!mIgnoreUpEvent) {
|
||||
@ -483,7 +482,7 @@ class MainActivity : SimpleActivity(), FlingListener {
|
||||
menu.findItem(R.id.uninstall).isVisible = gridItem.type == ITEM_TYPE_ICON
|
||||
menu.findItem(R.id.remove).isVisible = !isOnAllAppsFragment
|
||||
setOnMenuItemClickListener { item ->
|
||||
(all_apps_fragment as AllAppsFragment).ignoreTouches = false
|
||||
resetFragmentTouches()
|
||||
when (item.itemId) {
|
||||
R.id.resize -> home_screen_grid.widgetLongPressed(gridItem)
|
||||
R.id.app_info -> launchAppInfo(gridItem.packageName)
|
||||
@ -495,13 +494,25 @@ class MainActivity : SimpleActivity(), FlingListener {
|
||||
|
||||
setOnDismissListener {
|
||||
mOpenPopupMenu = null
|
||||
(all_apps_fragment as AllAppsFragment).ignoreTouches = false
|
||||
resetFragmentTouches()
|
||||
}
|
||||
|
||||
show()
|
||||
}
|
||||
}
|
||||
|
||||
private fun resetFragmentTouches() {
|
||||
(widgets_fragment as WidgetsFragment).apply {
|
||||
touchDownY = -1
|
||||
ignoreTouches = false
|
||||
}
|
||||
|
||||
(all_apps_fragment as AllAppsFragment).apply {
|
||||
touchDownY = -1
|
||||
ignoreTouches = false
|
||||
}
|
||||
}
|
||||
|
||||
private fun showWidgetsFragment() {
|
||||
showFragment(widgets_fragment)
|
||||
}
|
||||
@ -602,7 +613,8 @@ class MainActivity : SimpleActivity(), FlingListener {
|
||||
try {
|
||||
val defaultDialerPackage = (getSystemService(Context.TELECOM_SERVICE) as TelecomManager).defaultDialerPackage
|
||||
appLaunchers.firstOrNull { it.packageName == defaultDialerPackage }?.apply {
|
||||
val dialerIcon = HomeScreenGridItem(null, 0, ROW_COUNT - 1, 0, ROW_COUNT - 1, defaultDialerPackage, "", title, ITEM_TYPE_ICON, "", -1, "", "", null)
|
||||
val dialerIcon =
|
||||
HomeScreenGridItem(null, 0, ROW_COUNT - 1, 0, ROW_COUNT - 1, defaultDialerPackage, "", title, ITEM_TYPE_ICON, "", -1, "", "", null)
|
||||
homeScreenGridItems.add(dialerIcon)
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
@ -647,7 +659,8 @@ class MainActivity : SimpleActivity(), FlingListener {
|
||||
val resolveInfo = packageManager.resolveActivity(cameraIntent, PackageManager.MATCH_DEFAULT_ONLY)
|
||||
val defaultCameraPackage = resolveInfo!!.activityInfo.packageName
|
||||
appLaunchers.firstOrNull { it.packageName == defaultCameraPackage }?.apply {
|
||||
val cameraIcon = HomeScreenGridItem(null, 4, ROW_COUNT - 1, 4, ROW_COUNT - 1, defaultCameraPackage, "", title, ITEM_TYPE_ICON, "", -1, "", "", null)
|
||||
val cameraIcon =
|
||||
HomeScreenGridItem(null, 4, ROW_COUNT - 1, 4, ROW_COUNT - 1, defaultCameraPackage, "", title, ITEM_TYPE_ICON, "", -1, "", "", null)
|
||||
homeScreenGridItems.add(cameraIcon)
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
|
@ -7,7 +7,6 @@ import android.widget.RelativeLayout
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.bumptech.glide.Glide
|
||||
import com.simplemobiletools.commons.extensions.getProperTextColor
|
||||
import com.simplemobiletools.commons.extensions.toast
|
||||
import com.simplemobiletools.launcher.R
|
||||
import com.simplemobiletools.launcher.activities.SimpleActivity
|
||||
import com.simplemobiletools.launcher.helpers.WIDGET_LIST_ITEMS_HOLDER
|
||||
@ -23,7 +22,8 @@ import kotlinx.android.synthetic.main.item_widget_preview.view.*
|
||||
class WidgetsAdapter(
|
||||
val activity: SimpleActivity,
|
||||
var widgetListItems: ArrayList<WidgetsListItem>,
|
||||
val widgetsFragmentListener: WidgetsFragmentListener
|
||||
val widgetsFragmentListener: WidgetsFragmentListener,
|
||||
val itemClick: () -> Unit
|
||||
) : RecyclerView.Adapter<WidgetsAdapter.ViewHolder>() {
|
||||
|
||||
private var textColor = activity.getProperTextColor()
|
||||
@ -102,9 +102,7 @@ class WidgetsAdapter(
|
||||
.load(widget.widgetPreviewImage)
|
||||
.into(widgetPreview.widget_image)
|
||||
|
||||
widgetPreview.setOnClickListener {
|
||||
activity.toast(R.string.touch_hold_widget)
|
||||
}
|
||||
widgetPreview.setOnClickListener { itemClick() }
|
||||
|
||||
widgetPreview.setOnLongClickListener { view ->
|
||||
widgetsFragmentListener.onWidgetLongPressed(widget)
|
||||
|
@ -99,6 +99,8 @@ class AllAppsFragment(context: Context, attributeSet: AttributeSet) : MyFragment
|
||||
if (currAdapter == null) {
|
||||
LaunchersAdapter(activity!!, launchers, this) {
|
||||
activity?.launchApp((it as AppLauncher).packageName, it.activityName)
|
||||
ignoreTouches = false
|
||||
touchDownY = -1
|
||||
}.apply {
|
||||
all_apps_grid.adapter = this
|
||||
}
|
||||
@ -150,24 +152,24 @@ class AllAppsFragment(context: Context, attributeSet: AttributeSet) : MyFragment
|
||||
}
|
||||
|
||||
override fun onAppLauncherLongPressed(x: Float, y: Float, appLauncher: AppLauncher) {
|
||||
val gridItem =
|
||||
HomeScreenGridItem(
|
||||
null,
|
||||
-1,
|
||||
-1,
|
||||
-1,
|
||||
-1,
|
||||
appLauncher.packageName,
|
||||
appLauncher.activityName,
|
||||
appLauncher.title,
|
||||
ITEM_TYPE_ICON,
|
||||
"",
|
||||
-1,
|
||||
"",
|
||||
"",
|
||||
null,
|
||||
appLauncher.drawable
|
||||
)
|
||||
val gridItem = HomeScreenGridItem(
|
||||
null,
|
||||
-1,
|
||||
-1,
|
||||
-1,
|
||||
-1,
|
||||
appLauncher.packageName,
|
||||
appLauncher.activityName,
|
||||
appLauncher.title,
|
||||
ITEM_TYPE_ICON,
|
||||
"",
|
||||
-1,
|
||||
"",
|
||||
"",
|
||||
null,
|
||||
appLauncher.drawable
|
||||
)
|
||||
|
||||
activity?.showHomeIconMenu(x, y, gridItem, true)
|
||||
ignoreTouches = true
|
||||
}
|
||||
|
@ -15,6 +15,7 @@ import android.view.WindowManager
|
||||
import com.simplemobiletools.commons.extensions.*
|
||||
import com.simplemobiletools.commons.helpers.ensureBackgroundThread
|
||||
import com.simplemobiletools.commons.helpers.isRPlus
|
||||
import com.simplemobiletools.launcher.R
|
||||
import com.simplemobiletools.launcher.activities.MainActivity
|
||||
import com.simplemobiletools.launcher.adapters.WidgetsAdapter
|
||||
import com.simplemobiletools.launcher.extensions.getInitialCellSize
|
||||
@ -159,7 +160,11 @@ class WidgetsFragment(context: Context, attributeSet: AttributeSet) : MyFragment
|
||||
activity?.runOnUiThread {
|
||||
val currAdapter = widgets_list.adapter
|
||||
if (currAdapter == null) {
|
||||
WidgetsAdapter(activity!!, widgetsListItems, this).apply {
|
||||
WidgetsAdapter(activity!!, widgetsListItems, this) {
|
||||
context.toast(R.string.touch_hold_widget)
|
||||
ignoreTouches = false
|
||||
touchDownY = -1
|
||||
}.apply {
|
||||
widgets_list.adapter = this
|
||||
}
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user