chore: code cleanup

This commit is contained in:
Josia Pietsch 2024-08-05 15:10:37 +02:00
parent 5e841a9106
commit 888dc032c1
Signed by: jrpie
GPG key ID: E70B571D66986A2D
10 changed files with 19 additions and 19 deletions

View file

@ -121,11 +121,11 @@ class HomeActivity: UIObject, AppCompatActivity(),
this@HomeActivity.runOnUiThread {
val t = timeFormat.format(Date())
if (binding.homeLowerView.text != t)
binding.homeLowerView.setText(t)
binding.homeLowerView.text = t
val d = dateFormat.format(Date())
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 {
if (e1 == null) return false;
if (e1 == null) return false
val width = displayMetrics.widthPixels
val height = displayMetrics.heightPixels
@ -184,15 +184,15 @@ class HomeActivity: UIObject, AppCompatActivity(),
if (edgeActions) {
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){
gesture = gesture?.let{it.getEdgeVariant(Gesture.Edge.RIGHT)};
gesture = gesture?.let{it.getEdgeVariant(Gesture.Edge.RIGHT)}
}
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){
gesture = gesture?.let{it.getEdgeVariant(Gesture.Edge.BOTTOM)};
gesture = gesture?.let{it.getEdgeVariant(Gesture.Edge.BOTTOM)}
}
}
gesture?.invoke(this)

View file

@ -27,7 +27,7 @@ class ListFragmentApps : Fragment(), UIObject {
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
): View {
binding = ListAppsBinding.inflate(inflater)
return binding.root
}

View file

@ -22,7 +22,7 @@ class ListFragmentOther : Fragment() {
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
): View {
binding = ListOtherBinding.inflate(inflater)
return binding.root
}

View file

@ -40,7 +40,7 @@ SettingsFragmentActions : Fragment(), UIObject {
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
): View {
getPreferences(requireContext()).registerOnSharedPreferenceChangeListener(sharedPreferencesListener)
binding = SettingsActionsBinding.inflate(inflater, container, false)
return binding!!.root

View file

@ -28,11 +28,11 @@ import java.lang.Exception
class SettingsFragmentActionsRecycler : Fragment(), UIObject {
private lateinit var binding: SettingsActionsRecyclerBinding
public var actionViewAdapter: ActionsRecyclerAdapter? = null
var actionViewAdapter: ActionsRecyclerAdapter? = null
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
): View {
binding = SettingsActionsRecyclerBinding.inflate(inflater, container, false)
return binding.root
}
@ -128,7 +128,7 @@ class ActionsRecyclerAdapter(val activity: Activity):
&& (edgeActions || !it.isEdgeVariant())} as ArrayList<Gesture>
}
public fun updateActions() {
fun updateActions() {
val doubleActions = getPreferences(activity).getBoolean(PREF_DOUBLE_ACTIONS_ENABLED, false)
val edgeActions = getPreferences(activity).getBoolean(PREF_EDGE_ACTIONS_ENABLED, false)
this.gesturesList.clear()

View file

@ -45,7 +45,7 @@ class SettingsFragmentLauncher : Fragment(), UIObject {
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
): View {
binding = SettingsLauncherBinding.inflate(inflater, container, false)
return binding.root
}
@ -81,7 +81,7 @@ class SettingsFragmentLauncher : Fragment(), UIObject {
preferences.edit()
.putBoolean(pref, isChecked)
.apply()
onChange(isChecked);
onChange(isChecked)
}
}

View file

@ -33,7 +33,7 @@ class SettingsFragmentMeta : Fragment(), UIObject {
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
): View {
binding = SettingsMetaBinding.inflate(inflater, container, false)
return binding.root
}

View file

@ -19,7 +19,7 @@ class TutorialFragmentConcept : Fragment(), UIObject {
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
): View {
val binding = TutorialConceptBinding.inflate(inflater, container, false)
binding.tutorialConceptBadgeVersion.text = BuildConfig.VERSION_NAME
return binding.root

View file

@ -21,7 +21,7 @@ class TutorialFragmentFinish : Fragment(), UIObject {
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
): View {
binding = TutorialFinishBinding.inflate(inflater, container, false)
return binding.root
}

View file

@ -19,7 +19,7 @@ class TutorialFragmentStart : Fragment(), UIObject {
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
): View {
binding = TutorialStartBinding.inflate(inflater, container, false)
return binding.root
}