|
@@ -1,4 +1,4 @@
|
|
|
-package com.sduduzog.slimlauncher.ui.main
|
|
|
|
|
|
|
+package com.simplauncher.ui.main
|
|
|
|
|
|
|
|
import android.app.Activity
|
|
import android.app.Activity
|
|
|
import android.content.ActivityNotFoundException
|
|
import android.content.ActivityNotFoundException
|
|
@@ -23,7 +23,10 @@ import android.view.View.OnClickListener
|
|
|
import android.view.ViewGroup
|
|
import android.view.ViewGroup
|
|
|
import android.view.inputmethod.EditorInfo
|
|
import android.view.inputmethod.EditorInfo
|
|
|
import android.view.inputmethod.InputMethodManager
|
|
import android.view.inputmethod.InputMethodManager
|
|
|
|
|
+import android.widget.EditText
|
|
|
|
|
+import android.widget.ImageView
|
|
|
import android.widget.PopupMenu
|
|
import android.widget.PopupMenu
|
|
|
|
|
+import android.widget.TextView
|
|
|
import android.widget.Toast
|
|
import android.widget.Toast
|
|
|
import androidx.activity.result.ActivityResultLauncher
|
|
import androidx.activity.result.ActivityResultLauncher
|
|
|
import androidx.activity.result.contract.ActivityResultContracts.StartActivityForResult
|
|
import androidx.activity.result.contract.ActivityResultContracts.StartActivityForResult
|
|
@@ -33,33 +36,23 @@ import androidx.fragment.app.viewModels
|
|
|
import androidx.lifecycle.lifecycleScope
|
|
import androidx.lifecycle.lifecycleScope
|
|
|
import androidx.navigation.Navigation
|
|
import androidx.navigation.Navigation
|
|
|
import androidx.recyclerview.widget.LinearLayoutManager
|
|
import androidx.recyclerview.widget.LinearLayoutManager
|
|
|
-import com.jkuester.unlauncher.datastore.ClockType
|
|
|
|
|
-import com.jkuester.unlauncher.datastore.SearchBarPosition
|
|
|
|
|
-import com.jkuester.unlauncher.datastore.UnlauncherApp
|
|
|
|
|
-import com.sduduzog.slimlauncher.R
|
|
|
|
|
-import com.sduduzog.slimlauncher.adapters.AppDrawerAdapter
|
|
|
|
|
-import com.sduduzog.slimlauncher.adapters.HomeAdapter
|
|
|
|
|
-import com.sduduzog.slimlauncher.datasource.UnlauncherDataSource
|
|
|
|
|
-import com.sduduzog.slimlauncher.datasource.quickbuttonprefs.QuickButtonPreferencesRepository
|
|
|
|
|
-import com.sduduzog.slimlauncher.models.HomeApp
|
|
|
|
|
-import com.sduduzog.slimlauncher.models.MainViewModel
|
|
|
|
|
-import com.sduduzog.slimlauncher.ui.dialogs.RenameAppDisplayNameDialog
|
|
|
|
|
-import com.sduduzog.slimlauncher.utils.BaseFragment
|
|
|
|
|
-import com.sduduzog.slimlauncher.utils.OnLaunchAppListener
|
|
|
|
|
-import com.sduduzog.slimlauncher.utils.isSystemApp
|
|
|
|
|
|
|
+import androidx.recyclerview.widget.RecyclerView
|
|
|
|
|
+import com.simplauncher.datastore.ClockType
|
|
|
|
|
+import com.simplauncher.datastore.SearchBarPosition
|
|
|
|
|
+import com.simplauncher.datastore.UnlauncherApp
|
|
|
|
|
+import com.simplauncher.R
|
|
|
|
|
+import com.simplauncher.adapters.AppDrawerAdapter
|
|
|
|
|
+import com.simplauncher.adapters.HomeAdapter
|
|
|
|
|
+import com.simplauncher.datasource.UnlauncherDataSource
|
|
|
|
|
+import com.simplauncher.datasource.quickbuttonprefs.QuickButtonPreferencesRepository
|
|
|
|
|
+import com.simplauncher.models.HomeApp
|
|
|
|
|
+import com.simplauncher.models.MainViewModel
|
|
|
|
|
+import com.simplauncher.ui.dialogs.ManageAppFoldersDialog
|
|
|
|
|
+import com.simplauncher.ui.dialogs.RenameAppDisplayNameDialog
|
|
|
|
|
+import com.simplauncher.utils.BaseFragment
|
|
|
|
|
+import com.simplauncher.utils.OnLaunchAppListener
|
|
|
|
|
+import com.simplauncher.utils.isSystemApp
|
|
|
import dagger.hilt.android.AndroidEntryPoint
|
|
import dagger.hilt.android.AndroidEntryPoint
|
|
|
-import kotlinx.android.synthetic.main.home_fragment_content.app_drawer_edit_text
|
|
|
|
|
-import kotlinx.android.synthetic.main.home_fragment_content.app_drawer_fragment_list
|
|
|
|
|
-import kotlinx.android.synthetic.main.home_fragment_content.home_fragment_analog_time
|
|
|
|
|
-import kotlinx.android.synthetic.main.home_fragment_content.home_fragment_bin_time
|
|
|
|
|
-import kotlinx.android.synthetic.main.home_fragment_content.home_fragment_call
|
|
|
|
|
-import kotlinx.android.synthetic.main.home_fragment_content.home_fragment_camera
|
|
|
|
|
-import kotlinx.android.synthetic.main.home_fragment_content.home_fragment_date
|
|
|
|
|
-import kotlinx.android.synthetic.main.home_fragment_content.home_fragment_list
|
|
|
|
|
-import kotlinx.android.synthetic.main.home_fragment_content.home_fragment_list_exp
|
|
|
|
|
-import kotlinx.android.synthetic.main.home_fragment_content.home_fragment_options
|
|
|
|
|
-import kotlinx.android.synthetic.main.home_fragment_content.home_fragment_time
|
|
|
|
|
-import kotlinx.android.synthetic.main.home_fragment_default.home_fragment
|
|
|
|
|
import kotlinx.coroutines.Dispatchers
|
|
import kotlinx.coroutines.Dispatchers
|
|
|
import kotlinx.coroutines.launch
|
|
import kotlinx.coroutines.launch
|
|
|
import java.text.SimpleDateFormat
|
|
import java.text.SimpleDateFormat
|
|
@@ -80,6 +73,20 @@ class HomeFragment : BaseFragment(), OnLaunchAppListener {
|
|
|
private lateinit var appDrawerAdapter: AppDrawerAdapter
|
|
private lateinit var appDrawerAdapter: AppDrawerAdapter
|
|
|
private lateinit var uninstallAppLauncher: ActivityResultLauncher<Intent>
|
|
private lateinit var uninstallAppLauncher: ActivityResultLauncher<Intent>
|
|
|
|
|
|
|
|
|
|
+ // View references (content views come from <merge> include, so ViewBinding can't resolve them)
|
|
|
|
|
+ private var homeFragmentView: MotionLayout? = null
|
|
|
|
|
+ private var appDrawerEditText: EditText? = null
|
|
|
|
|
+ private var appDrawerFragmentList: RecyclerView? = null
|
|
|
|
|
+ private var homeFragmentTime: TextView? = null
|
|
|
|
|
+ private var homeFragmentDate: TextView? = null
|
|
|
|
|
+ private var homeFragmentAnalogTime: AnalogClockView? = null
|
|
|
|
|
+ private var homeFragmentBinTime: BinaryClockView? = null
|
|
|
|
|
+ private var homeFragmentList: RecyclerView? = null
|
|
|
|
|
+ private var homeFragmentListExp: RecyclerView? = null
|
|
|
|
|
+ private var homeFragmentCall: ImageView? = null
|
|
|
|
|
+ private var homeFragmentOptions: ImageView? = null
|
|
|
|
|
+ private var homeFragmentCamera: ImageView? = null
|
|
|
|
|
+
|
|
|
override fun onCreate(savedInstanceState: Bundle?) {
|
|
override fun onCreate(savedInstanceState: Bundle?) {
|
|
|
super.onCreate(savedInstanceState)
|
|
super.onCreate(savedInstanceState)
|
|
|
uninstallAppLauncher = registerForActivityResult(StartActivityForResult()) { refreshApps() }
|
|
uninstallAppLauncher = registerForActivityResult(StartActivityForResult()) { refreshApps() }
|
|
@@ -93,15 +100,44 @@ class HomeFragment : BaseFragment(), OnLaunchAppListener {
|
|
|
SearchBarPosition.top -> R.layout.home_fragment_default
|
|
SearchBarPosition.top -> R.layout.home_fragment_default
|
|
|
else -> R.layout.home_fragment_default
|
|
else -> R.layout.home_fragment_default
|
|
|
}
|
|
}
|
|
|
- return inflater.inflate(layout, container, false)
|
|
|
|
|
|
|
+ val view = inflater.inflate(layout, container, false)
|
|
|
|
|
+ homeFragmentView = view as MotionLayout
|
|
|
|
|
+ appDrawerEditText = view.findViewById(R.id.app_drawer_edit_text)
|
|
|
|
|
+ appDrawerFragmentList = view.findViewById(R.id.app_drawer_fragment_list)
|
|
|
|
|
+ homeFragmentTime = view.findViewById(R.id.home_fragment_time)
|
|
|
|
|
+ homeFragmentDate = view.findViewById(R.id.home_fragment_date)
|
|
|
|
|
+ homeFragmentAnalogTime = view.findViewById(R.id.home_fragment_analog_time)
|
|
|
|
|
+ homeFragmentBinTime = view.findViewById(R.id.home_fragment_bin_time)
|
|
|
|
|
+ homeFragmentList = view.findViewById(R.id.home_fragment_list)
|
|
|
|
|
+ homeFragmentListExp = view.findViewById(R.id.home_fragment_list_exp)
|
|
|
|
|
+ homeFragmentCall = view.findViewById(R.id.home_fragment_call)
|
|
|
|
|
+ homeFragmentOptions = view.findViewById(R.id.home_fragment_options)
|
|
|
|
|
+ homeFragmentCamera = view.findViewById(R.id.home_fragment_camera)
|
|
|
|
|
+ return view
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ override fun onDestroyView() {
|
|
|
|
|
+ super.onDestroyView()
|
|
|
|
|
+ homeFragmentView = null
|
|
|
|
|
+ appDrawerEditText = null
|
|
|
|
|
+ appDrawerFragmentList = null
|
|
|
|
|
+ homeFragmentTime = null
|
|
|
|
|
+ homeFragmentDate = null
|
|
|
|
|
+ homeFragmentAnalogTime = null
|
|
|
|
|
+ homeFragmentBinTime = null
|
|
|
|
|
+ homeFragmentList = null
|
|
|
|
|
+ homeFragmentListExp = null
|
|
|
|
|
+ homeFragmentCall = null
|
|
|
|
|
+ homeFragmentOptions = null
|
|
|
|
|
+ homeFragmentCamera = null
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
|
|
super.onViewCreated(view, savedInstanceState)
|
|
super.onViewCreated(view, savedInstanceState)
|
|
|
val adapter1 = HomeAdapter(this, unlauncherDataSource)
|
|
val adapter1 = HomeAdapter(this, unlauncherDataSource)
|
|
|
val adapter2 = HomeAdapter(this, unlauncherDataSource)
|
|
val adapter2 = HomeAdapter(this, unlauncherDataSource)
|
|
|
- home_fragment_list.adapter = adapter1
|
|
|
|
|
- home_fragment_list_exp.adapter = adapter2
|
|
|
|
|
|
|
+ homeFragmentList!!.adapter = adapter1
|
|
|
|
|
+ homeFragmentListExp!!.adapter = adapter2
|
|
|
|
|
|
|
|
val unlauncherAppsRepo = unlauncherDataSource.unlauncherAppsRepo
|
|
val unlauncherAppsRepo = unlauncherDataSource.unlauncherAppsRepo
|
|
|
|
|
|
|
@@ -129,16 +165,16 @@ class HomeFragment : BaseFragment(), OnLaunchAppListener {
|
|
|
|
|
|
|
|
setEventListeners()
|
|
setEventListeners()
|
|
|
|
|
|
|
|
- app_drawer_fragment_list.adapter = appDrawerAdapter
|
|
|
|
|
|
|
+ appDrawerFragmentList!!.adapter = appDrawerAdapter
|
|
|
|
|
|
|
|
unlauncherDataSource.corePreferencesRepo.liveData().observe(viewLifecycleOwner){ corePreferences ->
|
|
unlauncherDataSource.corePreferencesRepo.liveData().observe(viewLifecycleOwner){ corePreferences ->
|
|
|
- app_drawer_edit_text.visibility = if (corePreferences.showSearchBar) View.VISIBLE else View.GONE
|
|
|
|
|
|
|
+ appDrawerEditText!!.visibility = if (corePreferences.showSearchBar) View.VISIBLE else View.GONE
|
|
|
|
|
|
|
|
val clockType = corePreferences.clockType
|
|
val clockType = corePreferences.clockType
|
|
|
- home_fragment_time.visibility = if(clockType == ClockType.digital) View.VISIBLE else View.GONE
|
|
|
|
|
- home_fragment_analog_time.visibility = if(clockType == ClockType.analog) View.VISIBLE else View.GONE
|
|
|
|
|
- home_fragment_bin_time.visibility = if(clockType == ClockType.binary) View.VISIBLE else View.GONE
|
|
|
|
|
- home_fragment_date.visibility = if(clockType != ClockType.none) View.VISIBLE else View.GONE
|
|
|
|
|
|
|
+ homeFragmentTime!!.visibility = if(clockType == ClockType.digital) View.VISIBLE else View.GONE
|
|
|
|
|
+ homeFragmentAnalogTime!!.visibility = if(clockType == ClockType.analog) View.VISIBLE else View.GONE
|
|
|
|
|
+ homeFragmentBinTime!!.visibility = if(clockType == ClockType.binary) View.VISIBLE else View.GONE
|
|
|
|
|
+ homeFragmentDate!!.visibility = if(clockType != ClockType.none) View.VISIBLE else View.GONE
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -148,7 +184,7 @@ class HomeFragment : BaseFragment(), OnLaunchAppListener {
|
|
|
activity?.registerReceiver(receiver, IntentFilter(Intent.ACTION_TIME_TICK))
|
|
activity?.registerReceiver(receiver, IntentFilter(Intent.ACTION_TIME_TICK))
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- override fun getFragmentView(): ViewGroup = home_fragment
|
|
|
|
|
|
|
+ override fun getFragmentView(): ViewGroup = homeFragmentView!!
|
|
|
|
|
|
|
|
override fun onResume() {
|
|
override fun onResume() {
|
|
|
super.onResume()
|
|
super.onResume()
|
|
@@ -160,9 +196,9 @@ class HomeFragment : BaseFragment(), OnLaunchAppListener {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// scroll back to the top if user returns to this fragment
|
|
// scroll back to the top if user returns to this fragment
|
|
|
- val layoutManager = app_drawer_fragment_list.layoutManager as LinearLayoutManager
|
|
|
|
|
|
|
+ val layoutManager = appDrawerFragmentList!!.layoutManager as LinearLayoutManager
|
|
|
if (layoutManager.findFirstCompletelyVisibleItemPosition() != 0) {
|
|
if (layoutManager.findFirstCompletelyVisibleItemPosition() != 0) {
|
|
|
- app_drawer_fragment_list.scrollToPosition(0)
|
|
|
|
|
|
|
+ appDrawerFragmentList!!.scrollToPosition(0)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -192,11 +228,11 @@ class HomeFragment : BaseFragment(), OnLaunchAppListener {
|
|
|
// Do nothing, we've failed :(
|
|
// Do nothing, we've failed :(
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- home_fragment_time.setOnClickListener(launchShowAlarms)
|
|
|
|
|
- home_fragment_analog_time.setOnClickListener(launchShowAlarms)
|
|
|
|
|
- home_fragment_bin_time.setOnClickListener(launchShowAlarms)
|
|
|
|
|
|
|
+ homeFragmentTime!!.setOnClickListener(launchShowAlarms)
|
|
|
|
|
+ homeFragmentAnalogTime!!.setOnClickListener(launchShowAlarms)
|
|
|
|
|
+ homeFragmentBinTime!!.setOnClickListener(launchShowAlarms)
|
|
|
|
|
|
|
|
- home_fragment_date.setOnClickListener {
|
|
|
|
|
|
|
+ homeFragmentDate!!.setOnClickListener {
|
|
|
try {
|
|
try {
|
|
|
val builder = CalendarContract.CONTENT_URI.buildUpon().appendPath("time")
|
|
val builder = CalendarContract.CONTENT_URI.buildUpon().appendPath("time")
|
|
|
val intent = Intent(Intent.ACTION_VIEW, builder.build())
|
|
val intent = Intent(Intent.ACTION_VIEW, builder.build())
|
|
@@ -210,9 +246,9 @@ class HomeFragment : BaseFragment(), OnLaunchAppListener {
|
|
|
unlauncherDataSource.quickButtonPreferencesRepo.liveData()
|
|
unlauncherDataSource.quickButtonPreferencesRepo.liveData()
|
|
|
.observe(viewLifecycleOwner) { prefs ->
|
|
.observe(viewLifecycleOwner) { prefs ->
|
|
|
val leftButtonIcon = QuickButtonPreferencesRepository.RES_BY_ICON.getValue(prefs.leftButton.iconId)
|
|
val leftButtonIcon = QuickButtonPreferencesRepository.RES_BY_ICON.getValue(prefs.leftButton.iconId)
|
|
|
- home_fragment_call.setImageResource(leftButtonIcon)
|
|
|
|
|
|
|
+ homeFragmentCall!!.setImageResource(leftButtonIcon)
|
|
|
if (leftButtonIcon != R.drawable.ic_empty) {
|
|
if (leftButtonIcon != R.drawable.ic_empty) {
|
|
|
- home_fragment_call.setOnClickListener { view ->
|
|
|
|
|
|
|
+ homeFragmentCall!!.setOnClickListener { view ->
|
|
|
try {
|
|
try {
|
|
|
val pm = context?.packageManager!!
|
|
val pm = context?.packageManager!!
|
|
|
val intent = Intent(Intent.ACTION_DIAL)
|
|
val intent = Intent(Intent.ACTION_DIAL)
|
|
@@ -228,9 +264,9 @@ class HomeFragment : BaseFragment(), OnLaunchAppListener {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
val centerButtonIcon = QuickButtonPreferencesRepository.RES_BY_ICON.getValue(prefs.centerButton.iconId)
|
|
val centerButtonIcon = QuickButtonPreferencesRepository.RES_BY_ICON.getValue(prefs.centerButton.iconId)
|
|
|
- home_fragment_options.setImageResource(centerButtonIcon)
|
|
|
|
|
|
|
+ homeFragmentOptions!!.setImageResource(centerButtonIcon)
|
|
|
if (centerButtonIcon != R.drawable.ic_empty) {
|
|
if (centerButtonIcon != R.drawable.ic_empty) {
|
|
|
- home_fragment_options.setOnClickListener(
|
|
|
|
|
|
|
+ homeFragmentOptions!!.setOnClickListener(
|
|
|
Navigation.createNavigateOnClickListener(
|
|
Navigation.createNavigateOnClickListener(
|
|
|
R.id.action_homeFragment_to_optionsFragment
|
|
R.id.action_homeFragment_to_optionsFragment
|
|
|
)
|
|
)
|
|
@@ -238,9 +274,9 @@ class HomeFragment : BaseFragment(), OnLaunchAppListener {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
val rightButtonIcon = QuickButtonPreferencesRepository.RES_BY_ICON.getValue(prefs.rightButton.iconId)
|
|
val rightButtonIcon = QuickButtonPreferencesRepository.RES_BY_ICON.getValue(prefs.rightButton.iconId)
|
|
|
- home_fragment_camera.setImageResource(rightButtonIcon)
|
|
|
|
|
|
|
+ homeFragmentCamera!!.setImageResource(rightButtonIcon)
|
|
|
if (rightButtonIcon != R.drawable.ic_empty) {
|
|
if (rightButtonIcon != R.drawable.ic_empty) {
|
|
|
- home_fragment_camera.setOnClickListener {
|
|
|
|
|
|
|
+ homeFragmentCamera!!.setOnClickListener {
|
|
|
try {
|
|
try {
|
|
|
val intent = Intent(MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA)
|
|
val intent = Intent(MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA)
|
|
|
launchActivity(it, intent)
|
|
launchActivity(it, intent)
|
|
@@ -251,20 +287,20 @@ class HomeFragment : BaseFragment(), OnLaunchAppListener {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- app_drawer_edit_text.addTextChangedListener(appDrawerAdapter.searchBoxListener)
|
|
|
|
|
|
|
+ appDrawerEditText!!.addTextChangedListener(appDrawerAdapter.searchBoxListener)
|
|
|
|
|
|
|
|
- app_drawer_edit_text.setOnEditorActionListener { _, actionId, _ ->
|
|
|
|
|
|
|
+ appDrawerEditText!!.setOnEditorActionListener { _, actionId, _ ->
|
|
|
if(actionId == EditorInfo.IME_ACTION_DONE && appDrawerAdapter.itemCount > 0) {
|
|
if(actionId == EditorInfo.IME_ACTION_DONE && appDrawerAdapter.itemCount > 0) {
|
|
|
val firstApp = appDrawerAdapter.getFirstApp()
|
|
val firstApp = appDrawerAdapter.getFirstApp()
|
|
|
launchApp(firstApp.packageName, firstApp.className, firstApp.userSerial)
|
|
launchApp(firstApp.packageName, firstApp.className, firstApp.userSerial)
|
|
|
- home_fragment.transitionToStart()
|
|
|
|
|
|
|
+ homeFragmentView!!.transitionToStart()
|
|
|
true
|
|
true
|
|
|
} else {
|
|
} else {
|
|
|
false
|
|
false
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- home_fragment.setTransitionListener(object : TransitionListener {
|
|
|
|
|
|
|
+ homeFragmentView!!.setTransitionListener(object : TransitionListener {
|
|
|
override fun onTransitionCompleted(motionLayout: MotionLayout?, currentId: Int) {
|
|
override fun onTransitionCompleted(motionLayout: MotionLayout?, currentId: Int) {
|
|
|
val inputMethodManager = requireContext().getSystemService(Activity.INPUT_METHOD_SERVICE) as InputMethodManager
|
|
val inputMethodManager = requireContext().getSystemService(Activity.INPUT_METHOD_SERVICE) as InputMethodManager
|
|
|
|
|
|
|
@@ -280,10 +316,10 @@ class HomeFragment : BaseFragment(), OnLaunchAppListener {
|
|
|
// Check for preferences to open the keyboard
|
|
// Check for preferences to open the keyboard
|
|
|
// only if the search field is shown
|
|
// only if the search field is shown
|
|
|
if (preferences.showSearchBar && preferences.activateKeyboardInDrawer) {
|
|
if (preferences.showSearchBar && preferences.activateKeyboardInDrawer) {
|
|
|
- app_drawer_edit_text.requestFocus()
|
|
|
|
|
|
|
+ appDrawerEditText!!.requestFocus()
|
|
|
// show the keyboard and set focus to the EditText when swiping down
|
|
// show the keyboard and set focus to the EditText when swiping down
|
|
|
inputMethodManager.showSoftInput(
|
|
inputMethodManager.showSoftInput(
|
|
|
- app_drawer_edit_text,
|
|
|
|
|
|
|
+ appDrawerEditText!!,
|
|
|
InputMethodManager.SHOW_IMPLICIT
|
|
InputMethodManager.SHOW_IMPLICIT
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
@@ -309,8 +345,8 @@ class HomeFragment : BaseFragment(), OnLaunchAppListener {
|
|
|
updateDate()
|
|
updateDate()
|
|
|
when (unlauncherDataSource.corePreferencesRepo.get().clockType) {
|
|
when (unlauncherDataSource.corePreferencesRepo.get().clockType) {
|
|
|
ClockType.digital -> updateClockDigital()
|
|
ClockType.digital -> updateClockDigital()
|
|
|
- ClockType.analog -> home_fragment_analog_time.updateClock()
|
|
|
|
|
- ClockType.binary -> home_fragment_bin_time.updateClock()
|
|
|
|
|
|
|
+ ClockType.analog -> homeFragmentAnalogTime!!.updateClock()
|
|
|
|
|
+ ClockType.binary -> homeFragmentBinTime!!.updateClock()
|
|
|
else -> {}
|
|
else -> {}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -323,12 +359,12 @@ class HomeFragment : BaseFragment(), OnLaunchAppListener {
|
|
|
2 -> SimpleDateFormat("h:mm aa", Locale.getDefault())
|
|
2 -> SimpleDateFormat("h:mm aa", Locale.getDefault())
|
|
|
else -> DateFormat.getTimeFormat(context)
|
|
else -> DateFormat.getTimeFormat(context)
|
|
|
}
|
|
}
|
|
|
- home_fragment_time.text = fWatchTime.format(Date())
|
|
|
|
|
|
|
+ homeFragmentTime!!.text = fWatchTime.format(Date())
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private fun updateDate() {
|
|
private fun updateDate() {
|
|
|
val fWatchDate = SimpleDateFormat(getString(R.string.main_date_format), Locale.getDefault())
|
|
val fWatchDate = SimpleDateFormat(getString(R.string.main_date_format), Locale.getDefault())
|
|
|
- home_fragment_date.text = fWatchDate.format(Date())
|
|
|
|
|
|
|
+ homeFragmentDate!!.text = fWatchDate.format(Date())
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
override fun onLaunch(app: HomeApp, view: View) {
|
|
override fun onLaunch(app: HomeApp, view: View) {
|
|
@@ -336,12 +372,12 @@ class HomeFragment : BaseFragment(), OnLaunchAppListener {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
override fun onBack(): Boolean {
|
|
override fun onBack(): Boolean {
|
|
|
- home_fragment.transitionToStart()
|
|
|
|
|
|
|
+ homeFragmentView!!.transitionToStart()
|
|
|
return true
|
|
return true
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
override fun onHome() {
|
|
override fun onHome() {
|
|
|
- home_fragment.transitionToStart()
|
|
|
|
|
|
|
+ homeFragmentView!!.transitionToStart()
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
inner class ClockReceiver : BroadcastReceiver() {
|
|
inner class ClockReceiver : BroadcastReceiver() {
|
|
@@ -365,9 +401,9 @@ class HomeFragment : BaseFragment(), OnLaunchAppListener {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private fun resetAppDrawerEditText() {
|
|
private fun resetAppDrawerEditText() {
|
|
|
- app_drawer_edit_text.clearComposingText()
|
|
|
|
|
- app_drawer_edit_text.setText("")
|
|
|
|
|
- app_drawer_edit_text.clearFocus()
|
|
|
|
|
|
|
+ appDrawerEditText!!.clearComposingText()
|
|
|
|
|
+ appDrawerEditText!!.setText("")
|
|
|
|
|
+ appDrawerEditText!!.clearFocus()
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
inner class AppDrawerListener {
|
|
inner class AppDrawerListener {
|
|
@@ -390,11 +426,14 @@ class HomeFragment : BaseFragment(), OnLaunchAppListener {
|
|
|
}
|
|
}
|
|
|
R.id.hide -> {
|
|
R.id.hide -> {
|
|
|
unlauncherDataSource.unlauncherAppsRepo.updateDisplayInDrawer(app, false)
|
|
unlauncherDataSource.unlauncherAppsRepo.updateDisplayInDrawer(app, false)
|
|
|
- Toast.makeText(context, "Unhide under Unlauncher's Options > Customize Drawer > Visible Apps", Toast.LENGTH_LONG).show()
|
|
|
|
|
|
|
+ Toast.makeText(context, "Unhide under Simplauncher's Options > Customize Drawer > Visible Apps", Toast.LENGTH_LONG).show()
|
|
|
}
|
|
}
|
|
|
R.id.rename -> {
|
|
R.id.rename -> {
|
|
|
RenameAppDisplayNameDialog.getInstance(app, unlauncherDataSource.unlauncherAppsRepo).show(childFragmentManager, "AppListAdapter")
|
|
RenameAppDisplayNameDialog.getInstance(app, unlauncherDataSource.unlauncherAppsRepo).show(childFragmentManager, "AppListAdapter")
|
|
|
}
|
|
}
|
|
|
|
|
+ R.id.folders -> {
|
|
|
|
|
+ ManageAppFoldersDialog.getInstance(app, unlauncherDataSource.appDrawerFoldersRepo).show(childFragmentManager, "ManageFolders")
|
|
|
|
|
+ }
|
|
|
R.id.uninstall -> {
|
|
R.id.uninstall -> {
|
|
|
val intent = Intent(Intent.ACTION_DELETE)
|
|
val intent = Intent(Intent.ACTION_DELETE)
|
|
|
intent.data = Uri.parse("package:" + app.packageName)
|
|
intent.data = Uri.parse("package:" + app.packageName)
|
|
@@ -426,7 +465,7 @@ class HomeFragment : BaseFragment(), OnLaunchAppListener {
|
|
|
|
|
|
|
|
fun onAppClicked(app: UnlauncherApp) {
|
|
fun onAppClicked(app: UnlauncherApp) {
|
|
|
launchApp(app.packageName, app.className, app.userSerial)
|
|
launchApp(app.packageName, app.className, app.userSerial)
|
|
|
- home_fragment.transitionToStart()
|
|
|
|
|
|
|
+ homeFragmentView!!.transitionToStart()
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|