Skip to content

Commit

Permalink
r
Browse files Browse the repository at this point in the history
  • Loading branch information
queuejw committed Oct 27, 2024
1 parent ba9295a commit f3f0904
Show file tree
Hide file tree
Showing 36 changed files with 280 additions and 271 deletions.
6 changes: 3 additions & 3 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,15 @@
android:exported="true">
</activity>
<activity
android:name="ru.dimon6018.metrolauncher.helpers.bsod.BsodScreen"
android:name="ru.dimon6018.metrolauncher.content.bsod.BsodScreen"
android:exported="true">
</activity>
<activity
android:name="ru.dimon6018.metrolauncher.helpers.bsod.recovery.Recovery"
android:name="ru.dimon6018.metrolauncher.content.bsod.recovery.Recovery"
android:exported="true">
</activity>
<activity
android:name="ru.dimon6018.metrolauncher.helpers.bsod.recovery.RecoveryOptions"
android:name="ru.dimon6018.metrolauncher.content.bsod.recovery.RecoveryOptions"
android:exported="true">
</activity>
<activity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import android.app.Application
import android.content.pm.ActivityInfo
import android.os.Bundle
import com.google.android.material.color.DynamicColors
import ru.dimon6018.metrolauncher.content.bsod.BsodDetector
import ru.dimon6018.metrolauncher.content.data.Prefs
import ru.dimon6018.metrolauncher.helpers.bsod.BsodDetector
import ru.dimon6018.metrolauncher.helpers.utils.Utils.Companion.launcherAccentTheme

class Application : Application() {
Expand Down
54 changes: 27 additions & 27 deletions app/src/main/java/ru/dimon6018/metrolauncher/Main.kt
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import ru.dimon6018.metrolauncher.Application.Companion.PREFS
import ru.dimon6018.metrolauncher.Application.Companion.isAppOpened
import ru.dimon6018.metrolauncher.content.NewAllApps
import ru.dimon6018.metrolauncher.content.NewStart
import ru.dimon6018.metrolauncher.content.AllApps
import ru.dimon6018.metrolauncher.content.Start
import ru.dimon6018.metrolauncher.content.data.app.App
import ru.dimon6018.metrolauncher.content.data.bsod.BSOD
import ru.dimon6018.metrolauncher.content.oobe.WelcomeActivity
import ru.dimon6018.metrolauncher.content.settings.SettingsActivity
import ru.dimon6018.metrolauncher.databinding.MainScreenLaucnherBinding
import ru.dimon6018.metrolauncher.helpers.IconPackManager
import ru.dimon6018.metrolauncher.databinding.LauncherMainScreenBinding
import ru.dimon6018.metrolauncher.helpers.iconpack.IconPackManager
import ru.dimon6018.metrolauncher.helpers.disklru.CacheUtils.Companion.closeDiskCache
import ru.dimon6018.metrolauncher.helpers.disklru.CacheUtils.Companion.initDiskCache
import ru.dimon6018.metrolauncher.helpers.disklru.CacheUtils.Companion.loadIconFromDiskCache
Expand Down Expand Up @@ -80,7 +80,7 @@ class Main : AppCompatActivity() {
private var bottomViewReady = false
private var searching = false

private lateinit var binding: MainScreenLaucnherBinding
private lateinit var binding: LauncherMainScreenBinding

override fun onCreate(savedInstanceState: Bundle?) {
isDarkMode = resources.getBoolean(R.bool.isDark) && PREFS.appTheme != 2
Expand All @@ -97,7 +97,7 @@ class Main : AppCompatActivity() {
return
}

binding = MainScreenLaucnherBinding.inflate(layoutInflater)
binding = LauncherMainScreenBinding.inflate(layoutInflater)
mainViewModel = ViewModelProvider(this)[MainViewModel::class.java]
setContentView(binding.root)

Expand Down Expand Up @@ -158,8 +158,8 @@ class Main : AppCompatActivity() {
private fun setupBackPressedDispatcher() {
onBackPressedDispatcher.addCallback(this, object : OnBackPressedCallback(true) {
override fun handleOnBackPressed() {
if (binding.pager.currentItem != 0) {
binding.pager.currentItem -= 1
if (binding.mainPager.currentItem != 0) {
binding.mainPager.currentItem -= 1
} else if (searching && PREFS.isSearchBarEnabled) {
hideSearch()
}
Expand All @@ -168,7 +168,7 @@ class Main : AppCompatActivity() {
}

private fun setupViewPager() {
binding.pager.apply {
binding.mainPager.apply {
adapter = pagerAdapter
registerOnPageChangeCallback(createPageChangeCallback())
}
Expand All @@ -185,8 +185,8 @@ class Main : AppCompatActivity() {
position == 0 -> accentColor to onSurfaceColor
else -> onSurfaceColor to accentColor
}
binding.navigationStartBtn.setColorFilter(startColor)
binding.navigationSearchBtn.setColorFilter(searchColor)
binding.mainBottomBar.navigationStartBtn.setColorFilter(startColor)
binding.mainBottomBar.navigationSearchBtn.setColorFilter(searchColor)
}
}
}
Expand Down Expand Up @@ -221,7 +221,7 @@ class Main : AppCompatActivity() {
}

fun configureViewPagerScroll(enabled: Boolean) {
binding.pager.isUserInputEnabled = enabled
binding.mainPager.isUserInputEnabled = enabled
}

private suspend fun setMainViewModel() {
Expand Down Expand Up @@ -349,7 +349,7 @@ class Main : AppCompatActivity() {
private fun setupNavigationBar() {
if (bottomViewReady) return
bottomViewReady = true
binding.navigation.setBackgroundColor(getNavBarColor())
binding.mainBottomBar.navigationFrame.setBackgroundColor(getNavBarColor())
configureBottomBar()
}

Expand All @@ -359,7 +359,7 @@ class Main : AppCompatActivity() {
1 -> ContextCompat.getColor(this, android.R.color.background_light)
2 -> accentColorFromPrefs(this)
3 -> {
binding.navigation.visibility = View.GONE
binding.mainBottomBar.navigationFrame.visibility = View.GONE
return ContextCompat.getColor(this, android.R.color.transparent)
}
else -> launcherSurfaceColor(theme)
Expand All @@ -375,13 +375,13 @@ class Main : AppCompatActivity() {
}

private fun setupNavigationBarButtons() {
binding.navigationMain.visibility = View.VISIBLE
binding.navigationStartBtn.apply {
binding.mainBottomBar.navigationMain.visibility = View.VISIBLE
binding.mainBottomBar.navigationStartBtn.apply {
setImageDrawable(getNavBarIconDrawable())
setOnClickListener { binding.pager.setCurrentItem(0, true) }
setOnClickListener { binding.mainPager.setCurrentItem(0, true) }
}
binding.navigationSearchBtn.setOnClickListener {
if (PREFS.isAllAppsEnabled) binding.pager.setCurrentItem(1, true)
binding.mainBottomBar.navigationSearchBtn.setOnClickListener {
if (PREFS.isAllAppsEnabled) binding.mainPager.setCurrentItem(1, true)
}
}

Expand All @@ -398,17 +398,17 @@ class Main : AppCompatActivity() {

private fun setupSearchBar() {
filteredList = mutableListOf()
binding.navigationSearchBar.visibility = View.VISIBLE
binding.mainBottomBar.searchBarLayout.visibility = View.VISIBLE
searchAdapter = SearchAdapter(filteredList)
binding.searchBarRecyclerView.apply {
binding.mainSearchResults.searchBarRecyclerview.apply {
layoutManager = LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false)
adapter = searchAdapter
}
setupSearchEditText()
}

private fun setupSearchEditText() {
val editText = binding.searchBar.editText as? AutoCompleteTextView
val editText = binding.mainBottomBar.searchBar.editText as? AutoCompleteTextView
editText?.addTextChangedListener(object : TextWatcher {
override fun onTextChanged(s: CharSequence, start: Int, before: Int, count: Int) {
filterSearchText(s.toString(), mainViewModel.getAppList())
Expand All @@ -434,7 +434,7 @@ class Main : AppCompatActivity() {
private fun hideSearchResults() {
lifecycleScope.launch {
searching = false
binding.searchBarResults.apply {
binding.mainSearchResults.searchBarResultsLayout.apply {
if (PREFS.isTransitionAnimEnabled) {
ObjectAnimator.ofFloat(this, "alpha", 1f, 0f).start()
}
Expand All @@ -445,7 +445,7 @@ class Main : AppCompatActivity() {

private fun showSearchResults() {
searching = true
binding.searchBarResults.apply {
binding.mainSearchResults.searchBarResultsLayout.apply {
if (PREFS.isTransitionAnimEnabled) {
ObjectAnimator.ofFloat(this, "alpha", 0f, 1f).setDuration(100).start()
}
Expand Down Expand Up @@ -482,9 +482,9 @@ class Main : AppCompatActivity() {

override fun createFragment(position: Int): Fragment {
return when {
!PREFS.isAllAppsEnabled -> NewStart()
position == 1 -> NewAllApps()
else -> NewStart()
!PREFS.isAllAppsEnabled -> Start()
position == 1 -> AllApps()
else -> Start()
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ import ru.dimon6018.metrolauncher.content.data.app.App
import ru.dimon6018.metrolauncher.content.data.tile.Tile
import ru.dimon6018.metrolauncher.content.settings.SettingsActivity
import ru.dimon6018.metrolauncher.databinding.AbcBinding
import ru.dimon6018.metrolauncher.databinding.AllAppsScreenBinding
import ru.dimon6018.metrolauncher.databinding.AppBinding
import ru.dimon6018.metrolauncher.databinding.LauncherAllAppsScreenBinding
import ru.dimon6018.metrolauncher.helpers.receivers.PackageChangesReceiver
import ru.dimon6018.metrolauncher.helpers.ui.WPDialog
import ru.dimon6018.metrolauncher.helpers.utils.Utils
Expand All @@ -77,7 +77,7 @@ import ru.dimon6018.metrolauncher.helpers.utils.Utils.Companion.setUpApps
import ru.dimon6018.metrolauncher.helpers.utils.Utils.Companion.setViewInteractAnimation
import kotlin.random.Random

class NewAllApps: Fragment() {
class AllApps: Fragment() {

private lateinit var recyclerViewLM: LinearLayoutManager
private lateinit var decor: IOverScrollDecor
Expand All @@ -96,12 +96,12 @@ class NewAllApps: Fragment() {

private lateinit var mainViewModel: MainViewModel

private var _binding: AllAppsScreenBinding? = null
private var _binding: LauncherAllAppsScreenBinding? = null
private val binding get() = _binding!!


override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
_binding = AllAppsScreenBinding.inflate(inflater, container, false)
_binding = LauncherAllAppsScreenBinding.inflate(inflater, container, false)
Log.d("AllApps", "Init")
mainViewModel = ViewModelProvider(requireActivity())[MainViewModel::class.java]
binding.settingsBtn.apply {
Expand Down
Loading

0 comments on commit f3f0904

Please sign in to comment.