mirror of
https://github.com/jrpie/Launcher.git
synced 2025-02-23 06:21:31 +01:00
chore: code cleanup
This commit is contained in:
parent
5e841a9106
commit
888dc032c1
10 changed files with 19 additions and 19 deletions
|
@ -121,11 +121,11 @@ class HomeActivity: UIObject, AppCompatActivity(),
|
||||||
this@HomeActivity.runOnUiThread {
|
this@HomeActivity.runOnUiThread {
|
||||||
val t = timeFormat.format(Date())
|
val t = timeFormat.format(Date())
|
||||||
if (binding.homeLowerView.text != t)
|
if (binding.homeLowerView.text != t)
|
||||||
binding.homeLowerView.setText(t)
|
binding.homeLowerView.text = t
|
||||||
|
|
||||||
val d = dateFormat.format(Date())
|
val d = dateFormat.format(Date())
|
||||||
if (binding.homeUpperView.text != d)
|
if (binding.homeUpperView.text != d)
|
||||||
binding.homeUpperView.setText(d)
|
binding.homeUpperView.text = d
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -146,7 +146,7 @@ class HomeActivity: UIObject, AppCompatActivity(),
|
||||||
|
|
||||||
override fun onFling(e1: MotionEvent?, e2: MotionEvent, dX: Float, dY: Float): Boolean {
|
override fun onFling(e1: MotionEvent?, e2: MotionEvent, dX: Float, dY: Float): Boolean {
|
||||||
|
|
||||||
if (e1 == null) return false;
|
if (e1 == null) return false
|
||||||
|
|
||||||
val width = displayMetrics.widthPixels
|
val width = displayMetrics.widthPixels
|
||||||
val height = displayMetrics.heightPixels
|
val height = displayMetrics.heightPixels
|
||||||
|
@ -184,15 +184,15 @@ class HomeActivity: UIObject, AppCompatActivity(),
|
||||||
|
|
||||||
if (edgeActions) {
|
if (edgeActions) {
|
||||||
if(max(e1.x, e2.x) < edgeStrictness * width){
|
if(max(e1.x, e2.x) < edgeStrictness * width){
|
||||||
gesture = gesture?.let{it.getEdgeVariant(Gesture.Edge.LEFT)};
|
gesture = gesture?.let{it.getEdgeVariant(Gesture.Edge.LEFT)}
|
||||||
} else if (min(e1.x, e2.x) > (1-edgeStrictness) * width){
|
} else if (min(e1.x, e2.x) > (1-edgeStrictness) * width){
|
||||||
gesture = gesture?.let{it.getEdgeVariant(Gesture.Edge.RIGHT)};
|
gesture = gesture?.let{it.getEdgeVariant(Gesture.Edge.RIGHT)}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(max(e1.y, e2.y) < edgeStrictness * height){
|
if(max(e1.y, e2.y) < edgeStrictness * height){
|
||||||
gesture = gesture?.let{it.getEdgeVariant(Gesture.Edge.TOP)};
|
gesture = gesture?.let{it.getEdgeVariant(Gesture.Edge.TOP)}
|
||||||
} else if (min(e1.y, e2.y) > (1-edgeStrictness) * height){
|
} else if (min(e1.y, e2.y) > (1-edgeStrictness) * height){
|
||||||
gesture = gesture?.let{it.getEdgeVariant(Gesture.Edge.BOTTOM)};
|
gesture = gesture?.let{it.getEdgeVariant(Gesture.Edge.BOTTOM)}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
gesture?.invoke(this)
|
gesture?.invoke(this)
|
||||||
|
|
|
@ -27,7 +27,7 @@ class ListFragmentApps : Fragment(), UIObject {
|
||||||
override fun onCreateView(
|
override fun onCreateView(
|
||||||
inflater: LayoutInflater, container: ViewGroup?,
|
inflater: LayoutInflater, container: ViewGroup?,
|
||||||
savedInstanceState: Bundle?
|
savedInstanceState: Bundle?
|
||||||
): View? {
|
): View {
|
||||||
binding = ListAppsBinding.inflate(inflater)
|
binding = ListAppsBinding.inflate(inflater)
|
||||||
return binding.root
|
return binding.root
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ class ListFragmentOther : Fragment() {
|
||||||
override fun onCreateView(
|
override fun onCreateView(
|
||||||
inflater: LayoutInflater, container: ViewGroup?,
|
inflater: LayoutInflater, container: ViewGroup?,
|
||||||
savedInstanceState: Bundle?
|
savedInstanceState: Bundle?
|
||||||
): View? {
|
): View {
|
||||||
binding = ListOtherBinding.inflate(inflater)
|
binding = ListOtherBinding.inflate(inflater)
|
||||||
return binding.root
|
return binding.root
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,7 @@ SettingsFragmentActions : Fragment(), UIObject {
|
||||||
override fun onCreateView(
|
override fun onCreateView(
|
||||||
inflater: LayoutInflater, container: ViewGroup?,
|
inflater: LayoutInflater, container: ViewGroup?,
|
||||||
savedInstanceState: Bundle?
|
savedInstanceState: Bundle?
|
||||||
): View? {
|
): View {
|
||||||
getPreferences(requireContext()).registerOnSharedPreferenceChangeListener(sharedPreferencesListener)
|
getPreferences(requireContext()).registerOnSharedPreferenceChangeListener(sharedPreferencesListener)
|
||||||
binding = SettingsActionsBinding.inflate(inflater, container, false)
|
binding = SettingsActionsBinding.inflate(inflater, container, false)
|
||||||
return binding!!.root
|
return binding!!.root
|
||||||
|
|
|
@ -28,11 +28,11 @@ import java.lang.Exception
|
||||||
class SettingsFragmentActionsRecycler : Fragment(), UIObject {
|
class SettingsFragmentActionsRecycler : Fragment(), UIObject {
|
||||||
|
|
||||||
private lateinit var binding: SettingsActionsRecyclerBinding
|
private lateinit var binding: SettingsActionsRecyclerBinding
|
||||||
public var actionViewAdapter: ActionsRecyclerAdapter? = null
|
var actionViewAdapter: ActionsRecyclerAdapter? = null
|
||||||
override fun onCreateView(
|
override fun onCreateView(
|
||||||
inflater: LayoutInflater, container: ViewGroup?,
|
inflater: LayoutInflater, container: ViewGroup?,
|
||||||
savedInstanceState: Bundle?
|
savedInstanceState: Bundle?
|
||||||
): View? {
|
): View {
|
||||||
binding = SettingsActionsRecyclerBinding.inflate(inflater, container, false)
|
binding = SettingsActionsRecyclerBinding.inflate(inflater, container, false)
|
||||||
return binding.root
|
return binding.root
|
||||||
}
|
}
|
||||||
|
@ -128,7 +128,7 @@ class ActionsRecyclerAdapter(val activity: Activity):
|
||||||
&& (edgeActions || !it.isEdgeVariant())} as ArrayList<Gesture>
|
&& (edgeActions || !it.isEdgeVariant())} as ArrayList<Gesture>
|
||||||
}
|
}
|
||||||
|
|
||||||
public fun updateActions() {
|
fun updateActions() {
|
||||||
val doubleActions = getPreferences(activity).getBoolean(PREF_DOUBLE_ACTIONS_ENABLED, false)
|
val doubleActions = getPreferences(activity).getBoolean(PREF_DOUBLE_ACTIONS_ENABLED, false)
|
||||||
val edgeActions = getPreferences(activity).getBoolean(PREF_EDGE_ACTIONS_ENABLED, false)
|
val edgeActions = getPreferences(activity).getBoolean(PREF_EDGE_ACTIONS_ENABLED, false)
|
||||||
this.gesturesList.clear()
|
this.gesturesList.clear()
|
||||||
|
|
|
@ -45,7 +45,7 @@ class SettingsFragmentLauncher : Fragment(), UIObject {
|
||||||
override fun onCreateView(
|
override fun onCreateView(
|
||||||
inflater: LayoutInflater, container: ViewGroup?,
|
inflater: LayoutInflater, container: ViewGroup?,
|
||||||
savedInstanceState: Bundle?
|
savedInstanceState: Bundle?
|
||||||
): View? {
|
): View {
|
||||||
binding = SettingsLauncherBinding.inflate(inflater, container, false)
|
binding = SettingsLauncherBinding.inflate(inflater, container, false)
|
||||||
return binding.root
|
return binding.root
|
||||||
}
|
}
|
||||||
|
@ -81,7 +81,7 @@ class SettingsFragmentLauncher : Fragment(), UIObject {
|
||||||
preferences.edit()
|
preferences.edit()
|
||||||
.putBoolean(pref, isChecked)
|
.putBoolean(pref, isChecked)
|
||||||
.apply()
|
.apply()
|
||||||
onChange(isChecked);
|
onChange(isChecked)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ class SettingsFragmentMeta : Fragment(), UIObject {
|
||||||
override fun onCreateView(
|
override fun onCreateView(
|
||||||
inflater: LayoutInflater, container: ViewGroup?,
|
inflater: LayoutInflater, container: ViewGroup?,
|
||||||
savedInstanceState: Bundle?
|
savedInstanceState: Bundle?
|
||||||
): View? {
|
): View {
|
||||||
binding = SettingsMetaBinding.inflate(inflater, container, false)
|
binding = SettingsMetaBinding.inflate(inflater, container, false)
|
||||||
return binding.root
|
return binding.root
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ class TutorialFragmentConcept : Fragment(), UIObject {
|
||||||
override fun onCreateView(
|
override fun onCreateView(
|
||||||
inflater: LayoutInflater, container: ViewGroup?,
|
inflater: LayoutInflater, container: ViewGroup?,
|
||||||
savedInstanceState: Bundle?
|
savedInstanceState: Bundle?
|
||||||
): View? {
|
): View {
|
||||||
val binding = TutorialConceptBinding.inflate(inflater, container, false)
|
val binding = TutorialConceptBinding.inflate(inflater, container, false)
|
||||||
binding.tutorialConceptBadgeVersion.text = BuildConfig.VERSION_NAME
|
binding.tutorialConceptBadgeVersion.text = BuildConfig.VERSION_NAME
|
||||||
return binding.root
|
return binding.root
|
||||||
|
|
|
@ -21,7 +21,7 @@ class TutorialFragmentFinish : Fragment(), UIObject {
|
||||||
override fun onCreateView(
|
override fun onCreateView(
|
||||||
inflater: LayoutInflater, container: ViewGroup?,
|
inflater: LayoutInflater, container: ViewGroup?,
|
||||||
savedInstanceState: Bundle?
|
savedInstanceState: Bundle?
|
||||||
): View? {
|
): View {
|
||||||
binding = TutorialFinishBinding.inflate(inflater, container, false)
|
binding = TutorialFinishBinding.inflate(inflater, container, false)
|
||||||
return binding.root
|
return binding.root
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ class TutorialFragmentStart : Fragment(), UIObject {
|
||||||
override fun onCreateView(
|
override fun onCreateView(
|
||||||
inflater: LayoutInflater, container: ViewGroup?,
|
inflater: LayoutInflater, container: ViewGroup?,
|
||||||
savedInstanceState: Bundle?
|
savedInstanceState: Bundle?
|
||||||
): View? {
|
): View {
|
||||||
binding = TutorialStartBinding.inflate(inflater, container, false)
|
binding = TutorialStartBinding.inflate(inflater, container, false)
|
||||||
return binding.root
|
return binding.root
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue