Merge branch 'main' into feature/folders

This commit is contained in:
Ensar Sarajčić 2023-08-17 16:43:37 +02:00
commit b9e55d4934
39 changed files with 577 additions and 467 deletions

View File

@ -1,71 +0,0 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
def keystorePropertiesFile = rootProject.file("keystore.properties")
def keystoreProperties = new Properties()
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}
android {
compileSdkVersion 34
defaultConfig {
applicationId "com.simplemobiletools.launcher"
minSdkVersion 26
targetSdkVersion 34
versionCode 8
versionName "5.0.6"
setProperty("archivesBaseName", "launcher")
}
signingConfigs {
if (keystorePropertiesFile.exists()) {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile file(keystoreProperties['storeFile'])
storePassword keystoreProperties['storePassword']
}
}
}
buildTypes {
debug {
applicationIdSuffix ".debug"
}
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
if (keystorePropertiesFile.exists()) {
signingConfig signingConfigs.release
}
}
}
flavorDimensions "variants"
productFlavors {
core {}
fdroid {}
prepaid {}
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
lintOptions {
checkReleaseBuilds false
abortOnError false
}
}
dependencies {
implementation 'com.github.SimpleMobileTools:Simple-Commons:2a2c17151e'
kapt "androidx.room:room-compiler:2.5.2"
implementation "androidx.room:room-runtime:2.5.2"
annotationProcessor "androidx.room:room-compiler:2.5.2"
}

95
app/build.gradle.kts Normal file
View File

@ -0,0 +1,95 @@
import java.io.FileInputStream
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.jetbrains.kotlin.konan.properties.Properties
plugins {
alias(libs.plugins.android)
alias(libs.plugins.kotlinAndroid)
alias(libs.plugins.ksp)
}
val keystorePropertiesFile: File = rootProject.file("keystore.properties")
val keystoreProperties = Properties()
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(FileInputStream(keystorePropertiesFile))
}
android {
compileSdk = project.libs.versions.app.build.compileSDKVersion.get().toInt()
defaultConfig {
applicationId = libs.versions.app.version.appId.get()
minSdk = project.libs.versions.app.build.minimumSDK.get().toInt()
targetSdk = project.libs.versions.app.build.targetSDK.get().toInt()
versionName = project.libs.versions.app.version.versionName.get()
versionCode = project.libs.versions.app.version.versionCode.get().toInt()
setProperty("archivesBaseName", "launcher")
}
signingConfigs {
if (keystorePropertiesFile.exists()) {
register("release") {
keyAlias = keystoreProperties.getProperty("keyAlias")
keyPassword = keystoreProperties.getProperty("keyPassword")
storeFile = file(keystoreProperties.getProperty("storeFile"))
storePassword = keystoreProperties.getProperty("storePassword")
}
}
}
buildFeatures {
viewBinding = true
buildConfig = true
}
buildTypes {
debug {
applicationIdSuffix = ".debug"
}
release {
isMinifyEnabled = true
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
if (keystorePropertiesFile.exists()) {
signingConfig = signingConfigs.getByName("release")
}
}
}
flavorDimensions.add("variants")
productFlavors {
register("core")
register("fdroid")
register("prepaid")
}
sourceSets {
getByName("main").java.srcDirs("src/main/kotlin")
}
compileOptions {
val currentJavaVersionFromLibs = JavaVersion.valueOf(libs.versions.app.build.javaVersion.get().toString())
sourceCompatibility = currentJavaVersionFromLibs
targetCompatibility = currentJavaVersionFromLibs
}
tasks.withType<KotlinCompile> {
kotlinOptions.jvmTarget = project.libs.versions.app.build.kotlinJVMTarget.get()
}
namespace = libs.versions.app.version.appId.get()
lint {
checkReleaseBuilds = false
abortOnError = false
}
}
dependencies {
implementation(libs.simple.tools.commons)
implementation(libs.bundles.room)
ksp(libs.androidx.room.compiler)
}

View File

@ -44,13 +44,19 @@
android:configChanges="orientation|keyboardHidden|screenSize"
android:excludeFromRecents="true"
android:exported="true"
android:launchMode="singleTop"
android:launchMode="singleTask"
android:screenOrientation="portrait"
android:theme="@style/LauncherTheme">
<intent-filter>
<action android:name="android.content.pm.action.CONFIRM_PIN_SHORTCUT" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
@ -97,7 +103,6 @@
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
@ -116,7 +121,6 @@
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
@ -135,7 +139,6 @@
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
@ -154,7 +157,6 @@
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
@ -173,7 +175,6 @@
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
@ -192,7 +193,6 @@
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
@ -211,7 +211,6 @@
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
@ -230,7 +229,6 @@
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
@ -249,7 +247,6 @@
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
@ -268,7 +265,6 @@
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
@ -287,7 +283,6 @@
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
@ -306,7 +301,6 @@
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
@ -325,7 +319,6 @@
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
@ -344,7 +337,6 @@
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
@ -363,7 +355,6 @@
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
@ -382,7 +373,6 @@
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
@ -401,7 +391,6 @@
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
@ -420,7 +409,6 @@
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
@ -439,7 +427,6 @@
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>

View File

@ -9,31 +9,38 @@ import com.simplemobiletools.commons.helpers.NavigationIcon
import com.simplemobiletools.commons.helpers.ensureBackgroundThread
import com.simplemobiletools.commons.interfaces.RefreshRecyclerViewListener
import com.simplemobiletools.commons.views.MyGridLayoutManager
import com.simplemobiletools.launcher.R
import com.simplemobiletools.launcher.adapters.HiddenIconsAdapter
import com.simplemobiletools.launcher.databinding.ActivityHiddenIconsBinding
import com.simplemobiletools.launcher.extensions.config
import com.simplemobiletools.launcher.extensions.getDrawableForPackageName
import com.simplemobiletools.launcher.extensions.hiddenIconsDB
import com.simplemobiletools.launcher.models.HiddenIcon
import kotlinx.android.synthetic.main.activity_hidden_icons.*
class HiddenIconsActivity : SimpleActivity(), RefreshRecyclerViewListener {
private lateinit var binding: ActivityHiddenIconsBinding
override fun onCreate(savedInstanceState: Bundle?) {
isMaterialActivity = true
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_hidden_icons)
binding = ActivityHiddenIconsBinding.inflate(layoutInflater)
setContentView(binding.root)
updateIcons()
updateMaterialActivityViews(manage_hidden_icons_coordinator, manage_hidden_icons_list, useTransparentNavigation = true, useTopSearchMenu = false)
setupMaterialScrollListener(manage_hidden_icons_list, manage_hidden_icons_toolbar)
updateMaterialActivityViews(
binding.manageHiddenIconsCoordinator,
binding.manageHiddenIconsList,
useTransparentNavigation = true,
useTopSearchMenu = false
)
setupMaterialScrollListener(binding.manageHiddenIconsList, binding.manageHiddenIconsToolbar)
val layoutManager = manage_hidden_icons_list.layoutManager as MyGridLayoutManager
val layoutManager = binding.manageHiddenIconsList.layoutManager as MyGridLayoutManager
layoutManager.spanCount = config.drawerColumnCount
}
override fun onResume() {
super.onResume()
setupToolbar(manage_hidden_icons_toolbar, NavigationIcon.Arrow)
setupToolbar(binding.manageHiddenIconsToolbar, NavigationIcon.Arrow)
}
private fun updateIcons() {
@ -48,7 +55,7 @@ class HiddenIconsActivity : SimpleActivity(), RefreshRecyclerViewListener {
val hiddenIconsEmpty = hiddenIcons.isEmpty()
runOnUiThread {
manage_hidden_icons_placeholder.beVisibleIf(hiddenIconsEmpty)
binding.manageHiddenIconsPlaceholder.beVisibleIf(hiddenIconsEmpty)
}
if (hiddenIcons.isNotEmpty()) {
@ -77,9 +84,9 @@ class HiddenIconsActivity : SimpleActivity(), RefreshRecyclerViewListener {
}
runOnUiThread {
HiddenIconsAdapter(this, hiddenIcons, this, manage_hidden_icons_list) {
HiddenIconsAdapter(this, hiddenIcons, this, binding.manageHiddenIconsList) {
}.apply {
manage_hidden_icons_list.adapter = this
binding.manageHiddenIconsList.adapter = this
}
}
}

View File

@ -33,26 +33,24 @@ import androidx.core.view.GestureDetectorCompat
import androidx.core.view.WindowCompat
import androidx.core.view.isVisible
import androidx.core.view.iterator
import androidx.viewbinding.ViewBinding
import com.simplemobiletools.commons.extensions.*
import com.simplemobiletools.commons.helpers.*
import com.simplemobiletools.launcher.BuildConfig
import com.simplemobiletools.launcher.R
import com.simplemobiletools.launcher.dialogs.FolderIconsDialog
import com.simplemobiletools.launcher.databinding.ActivityMainBinding
import com.simplemobiletools.launcher.databinding.AllAppsFragmentBinding
import com.simplemobiletools.launcher.databinding.WidgetsFragmentBinding
import com.simplemobiletools.launcher.dialogs.RenameItemDialog
import com.simplemobiletools.launcher.extensions.*
import com.simplemobiletools.launcher.fragments.AllAppsFragment
import com.simplemobiletools.launcher.fragments.MyFragment
import com.simplemobiletools.launcher.fragments.WidgetsFragment
import com.simplemobiletools.launcher.helpers.*
import com.simplemobiletools.launcher.interfaces.FlingListener
import com.simplemobiletools.launcher.interfaces.ItemMenuListener
import com.simplemobiletools.launcher.models.AppLauncher
import com.simplemobiletools.launcher.models.HiddenIcon
import com.simplemobiletools.launcher.models.HomeScreenGridItem
import kotlinx.android.synthetic.main.activity_main.*
import kotlinx.android.synthetic.main.activity_main.view.*
import kotlinx.android.synthetic.main.all_apps_fragment.view.*
import kotlinx.android.synthetic.main.widgets_fragment.view.*
import kotlin.math.abs
class MainActivity : SimpleActivity(), FlingListener {
@ -72,8 +70,10 @@ class MainActivity : SimpleActivity(), FlingListener {
private var mActionOnCanBindWidget: ((granted: Boolean) -> Unit)? = null
private var mActionOnWidgetConfiguredWidget: ((granted: Boolean) -> Unit)? = null
private var mActionOnAddShortcut: ((shortcutId: String, label: String, icon: Drawable) -> Unit)? = null
private var wasJustPaused: Boolean = false
private lateinit var mDetector: GestureDetectorCompat
private lateinit var binding: ActivityMainBinding
val menuListener: ItemMenuListener = object : ItemMenuListener {
override fun onAnyClick() {
@ -89,7 +89,7 @@ class MainActivity : SimpleActivity(), FlingListener {
}
override fun resize(gridItem: HomeScreenGridItem) {
home_screen_grid.widgetLongPressed(gridItem)
binding.homeScreenGrid.root.widgetLongPressed(gridItem)
}
override fun appInfo(gridItem: HomeScreenGridItem) {
@ -97,7 +97,7 @@ class MainActivity : SimpleActivity(), FlingListener {
}
override fun remove(gridItem: HomeScreenGridItem) {
home_screen_grid.removeAppIcon(gridItem)
binding.homeScreenGrid.root.removeAppIcon(gridItem)
}
override fun uninstall(gridItem: HomeScreenGridItem) {
@ -117,7 +117,7 @@ class MainActivity : SimpleActivity(), FlingListener {
}
}
val yOffset = resources.getDimension(R.dimen.long_press_anchor_button_offset_y) * (visibleMenuItems - 1)
home_screen_popup_menu_anchor.y -= yOffset
binding.homeScreenPopupMenuAnchor.y -= yOffset
}
}
@ -131,7 +131,8 @@ class MainActivity : SimpleActivity(), FlingListener {
useDynamicTheme = false
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
binding = ActivityMainBinding.inflate(layoutInflater)
setContentView(binding.root)
appLaunched(BuildConfig.APPLICATION_ID)
mDetector = GestureDetectorCompat(this, MyGestureListener(this))
@ -143,7 +144,7 @@ class MainActivity : SimpleActivity(), FlingListener {
mWidgetsFragmentY = mScreenHeight
mMoveGestureThreshold = resources.getDimensionPixelSize(R.dimen.move_gesture_threshold)
arrayOf(all_apps_fragment as MyFragment, widgets_fragment as MyFragment).forEach { fragment ->
arrayOf(binding.allAppsFragment.root as MyFragment<*>, binding.widgetsFragment.root as MyFragment<*>).forEach { fragment ->
fragment.setupFragment(this)
fragment.y = mScreenHeight.toFloat()
fragment.beVisible()
@ -151,17 +152,28 @@ class MainActivity : SimpleActivity(), FlingListener {
handleIntentAction(intent)
home_screen_grid.itemClickListener = {
binding.homeScreenGrid.root.itemClickListener = {
performItemClick(it)
}
home_screen_grid.itemLongClickListener = {
performItemLongClick(home_screen_grid.getClickableRect(it).left.toFloat(), it)
binding.homeScreenGrid.root.itemLongClickListener = {
performItemLongClick(binding.homeScreenGrid.root.getClickableRect(it).left.toFloat(), it)
}
}
override fun onNewIntent(intent: Intent?) {
super.onNewIntent(intent)
if (wasJustPaused) {
if (isAllAppsFragmentExpanded()) {
hideFragment(binding.allAppsFragment)
}
if (isWidgetsFragmentExpanded()) {
hideFragment(binding.widgetsFragment)
}
} else {
closeAppDrawer()
closeWidgetsFragment()
}
if (intent != null) {
handleIntentAction(intent)
}
@ -201,14 +213,14 @@ class MainActivity : SimpleActivity(), FlingListener {
)
runOnUiThread {
home_screen_grid.skipToPage(page)
binding.homeScreenGrid.root.skipToPage(page)
}
// delay showing the shortcut both to let the user see adding it in realtime and hackily avoid concurrent modification exception at HomeScreenGrid
Thread.sleep(2000)
try {
item.accept()
home_screen_grid.storeAndShowGridItem(gridItem)
binding.homeScreenGrid.root.storeAndShowGridItem(gridItem)
} catch (ignored: IllegalStateException) {
}
}
@ -243,18 +255,19 @@ class MainActivity : SimpleActivity(), FlingListener {
override fun onStart() {
super.onStart()
home_screen_grid.appWidgetHost.startListening()
binding.homeScreenGrid.root.appWidgetHost.startListening()
}
override fun onResume() {
super.onResume()
wasJustPaused = false
updateStatusbarColor(Color.TRANSPARENT)
main_holder.onGlobalLayout {
binding.mainHolder.onGlobalLayout {
if (isPiePlus()) {
val addTopPadding = main_holder.rootWindowInsets?.displayCutout != null
(all_apps_fragment as AllAppsFragment).setupViews(addTopPadding)
(widgets_fragment as WidgetsFragment).setupViews(addTopPadding)
val addTopPadding = binding.mainHolder.rootWindowInsets?.displayCutout != null
binding.allAppsFragment.root.setupViews(addTopPadding)
binding.widgetsFragment.root.setupViews(addTopPadding)
updateStatusbarColor(Color.TRANSPARENT)
}
}
@ -276,7 +289,7 @@ class MainActivity : SimpleActivity(), FlingListener {
showIcon
}.toMutableList() as ArrayList<AppLauncher>
(all_apps_fragment as AllAppsFragment).gotLaunchers(mCachedLaunchers)
binding.allAppsFragment.root.gotLaunchers(mCachedLaunchers)
}
refetchLaunchers()
@ -287,27 +300,34 @@ class MainActivity : SimpleActivity(), FlingListener {
window.navigationBarColor = Color.TRANSPARENT
}
home_screen_grid?.resizeGrid(
binding.homeScreenGrid.root.resizeGrid(
newRowCount = config.homeRowCount,
newColumnCount = config.homeColumnCount
)
(all_apps_fragment as? AllAppsFragment)?.onResume()
binding.allAppsFragment.root.onResume()
}
override fun onStop() {
super.onStop()
home_screen_grid?.appWidgetHost?.stopListening()
binding.homeScreenGrid.root.appWidgetHost?.stopListening()
wasJustPaused = false
}
override fun onPause() {
super.onPause()
wasJustPaused = true
}
@SuppressLint("MissingSuperCall")
override fun onBackPressed() {
if (isAllAppsFragmentExpanded()) {
if ((all_apps_fragment as? AllAppsFragment)?.onBackPressed() == false) {
hideFragment(all_apps_fragment)
if (!binding.allAppsFragment.root.onBackPressed()) {
hideFragment(binding.allAppsFragment)
}
} else if (isWidgetsFragmentExpanded()) {
hideFragment(widgets_fragment)
} else if (home_screen_grid.resize_frame.isVisible) {
home_screen_grid.hideResizeLines()
hideFragment(binding.widgetsFragment)
} else if (binding.homeScreenGrid.resizeFrame.isVisible) {
binding.homeScreenGrid.root.hideResizeLines()
} else {
// this is a home launcher app, avoid glitching by pressing Back
//super.onBackPressed()
@ -342,8 +362,8 @@ class MainActivity : SimpleActivity(), FlingListener {
override fun onConfigurationChanged(newConfig: Configuration) {
super.onConfigurationChanged(newConfig)
(all_apps_fragment as? AllAppsFragment)?.onConfigurationChanged()
(widgets_fragment as? WidgetsFragment)?.onConfigurationChanged()
binding.allAppsFragment.root.onConfigurationChanged()
binding.widgetsFragment.root.onConfigurationChanged()
}
override fun onTouchEvent(event: MotionEvent?): Boolean {
@ -364,8 +384,8 @@ class MainActivity : SimpleActivity(), FlingListener {
MotionEvent.ACTION_DOWN -> {
mTouchDownX = event.x.toInt()
mTouchDownY = event.y.toInt()
mAllAppsFragmentY = all_apps_fragment.y.toInt()
mWidgetsFragmentY = widgets_fragment.y.toInt()
mAllAppsFragmentY = binding.allAppsFragment.root.y.toInt()
mWidgetsFragmentY = binding.widgetsFragment.root.y.toInt()
mIgnoreUpEvent = false
}
@ -382,13 +402,13 @@ class MainActivity : SimpleActivity(), FlingListener {
if (mLongPressedIcon != null && (mOpenPopupMenu != null || mOpenFolderDialog != null) && hasFingerMoved) {
mOpenPopupMenu?.dismiss()
mOpenPopupMenu = null
home_screen_grid.itemDraggingStarted(mLongPressedIcon!!)
hideFragment(all_apps_fragment)
binding.homeScreenGrid.root.itemDraggingStarted(mLongPressedIcon!!)
hideFragment(binding.allAppsFragment)
mOpenFolderDialog?.dismiss()
}
if (mLongPressedIcon != null && hasFingerMoved) {
home_screen_grid.draggedItemMoved(event.x.toInt(), event.y.toInt())
binding.homeScreenGrid.root.draggedItemMoved(event.x.toInt(), event.y.toInt())
}
if (hasFingerMoved && !mIgnoreMoveEvents) {
@ -396,10 +416,10 @@ class MainActivity : SimpleActivity(), FlingListener {
if (isWidgetsFragmentExpanded()) {
val newY = mWidgetsFragmentY - diffY
widgets_fragment.y = Math.min(Math.max(0f, newY), mScreenHeight.toFloat())
binding.widgetsFragment.root.y = Math.min(Math.max(0f, newY), mScreenHeight.toFloat())
} else if (mLongPressedIcon == null) {
val newY = mAllAppsFragmentY - diffY
all_apps_fragment.y = Math.min(Math.max(0f, newY), mScreenHeight.toFloat())
binding.allAppsFragment.root.y = Math.min(Math.max(0f, newY), mScreenHeight.toFloat())
}
}
@ -414,19 +434,19 @@ class MainActivity : SimpleActivity(), FlingListener {
mLongPressedIcon = null
mLastTouchCoords = Pair(-1f, -1f)
resetFragmentTouches()
home_screen_grid.itemDraggingStopped()
binding.homeScreenGrid.root.itemDraggingStopped()
if (!mIgnoreUpEvent) {
if (all_apps_fragment.y < mScreenHeight * 0.5) {
showFragment(all_apps_fragment)
if (binding.allAppsFragment.root.y < mScreenHeight * 0.5) {
showFragment(binding.allAppsFragment)
} else if (isAllAppsFragmentExpanded()) {
hideFragment(all_apps_fragment)
hideFragment(binding.allAppsFragment)
}
if (widgets_fragment.y < mScreenHeight * 0.5) {
showFragment(widgets_fragment)
if (binding.widgetsFragment.root.y < mScreenHeight * 0.5) {
showFragment(binding.widgetsFragment)
} else if (isWidgetsFragmentExpanded()) {
hideFragment(widgets_fragment)
hideFragment(binding.widgetsFragment)
}
}
}
@ -442,8 +462,8 @@ class MainActivity : SimpleActivity(), FlingListener {
private fun refetchLaunchers() {
val launchers = getAllAppLaunchers()
(all_apps_fragment as AllAppsFragment).gotLaunchers(launchers)
(widgets_fragment as WidgetsFragment).getAppWidgets()
binding.allAppsFragment.root.gotLaunchers(launchers)
binding.widgetsFragment.root.getAppWidgets()
var hasDeletedAnything = false
mCachedLaunchers.map { it.packageName }.forEach { packageName ->
@ -455,7 +475,7 @@ class MainActivity : SimpleActivity(), FlingListener {
}
if (hasDeletedAnything) {
home_screen_grid.fetchGridItems()
binding.homeScreenGrid.root.fetchGridItems()
mOpenFolderDialog?.fetchItems()
}
@ -465,52 +485,52 @@ class MainActivity : SimpleActivity(), FlingListener {
ensureBackgroundThread {
getDefaultAppPackages(launchers)
config.wasHomeScreenInit = true
home_screen_grid.fetchGridItems()
binding.homeScreenGrid.root.fetchGridItems()
}
}
}
fun isAllAppsFragmentExpanded() = all_apps_fragment.y != mScreenHeight.toFloat()
fun isAllAppsFragmentExpanded() = binding.allAppsFragment.root.y != mScreenHeight.toFloat()
private fun isWidgetsFragmentExpanded() = widgets_fragment.y != mScreenHeight.toFloat()
private fun isWidgetsFragmentExpanded() = binding.widgetsFragment.root.y != mScreenHeight.toFloat()
fun startHandlingTouches(touchDownY: Int) {
mLongPressedIcon = null
mTouchDownY = touchDownY
mAllAppsFragmentY = all_apps_fragment.y.toInt()
mWidgetsFragmentY = widgets_fragment.y.toInt()
mAllAppsFragmentY = binding.allAppsFragment.root.y.toInt()
mWidgetsFragmentY = binding.widgetsFragment.root.y.toInt()
mIgnoreUpEvent = false
}
private fun showFragment(fragment: View) {
ObjectAnimator.ofFloat(fragment, "y", 0f).apply {
private fun showFragment(fragment: ViewBinding) {
ObjectAnimator.ofFloat(fragment.root, "y", 0f).apply {
duration = ANIMATION_DURATION
interpolator = DecelerateInterpolator()
start()
}
window.navigationBarColor = resources.getColor(R.color.semitransparent_navigation)
home_screen_grid.fragmentExpanded()
home_screen_grid.hideResizeLines()
fragment.performAccessibilityAction(AccessibilityNodeInfo.ACTION_ACCESSIBILITY_FOCUS, null)
binding.homeScreenGrid.root.fragmentExpanded()
binding.homeScreenGrid.root.hideResizeLines()
fragment.root.performAccessibilityAction(AccessibilityNodeInfo.ACTION_ACCESSIBILITY_FOCUS, null)
}
private fun hideFragment(fragment: View) {
ObjectAnimator.ofFloat(fragment, "y", mScreenHeight.toFloat()).apply {
private fun hideFragment(fragment: ViewBinding) {
ObjectAnimator.ofFloat(fragment.root, "y", mScreenHeight.toFloat()).apply {
duration = ANIMATION_DURATION
interpolator = DecelerateInterpolator()
start()
}
window.navigationBarColor = Color.TRANSPARENT
home_screen_grid.fragmentCollapsed()
Handler().postDelayed({
if (fragment is AllAppsFragment) {
fragment.all_apps_grid.scrollToPosition(0)
fragment.touchDownY = -1
} else if (fragment is WidgetsFragment) {
fragment.widgets_list.scrollToPosition(0)
fragment.touchDownY = -1
binding.homeScreenGrid.root.fragmentCollapsed()
Handler(Looper.getMainLooper()).postDelayed({
if (fragment is AllAppsFragmentBinding) {
fragment.allAppsGrid.scrollToPosition(0)
fragment.root.touchDownY = -1
} else if (fragment is WidgetsFragmentBinding) {
fragment.widgetsList.scrollToPosition(0)
fragment.root.touchDownY = -1
}
}, ANIMATION_DURATION)
}
@ -520,34 +540,56 @@ class MainActivity : SimpleActivity(), FlingListener {
return
}
val (x, y) = home_screen_grid.intoViewSpaceCoords(eventX, eventY)
val (x, y) = binding.homeScreenGrid.root.intoViewSpaceCoords(eventX, eventY)
mIgnoreMoveEvents = true
val clickedGridItem = home_screen_grid.isClickingGridItem(x.toInt(), y.toInt())
val clickedGridItem = binding.homeScreenGrid.root.isClickingGridItem(x.toInt(), y.toInt())
if (clickedGridItem != null) {
performItemLongClick(x, clickedGridItem)
return
}
main_holder.performHapticFeedback()
binding.mainHolder.performHapticFeedback()
showMainLongPressMenu(x, y)
}
fun homeScreenClicked(eventX: Float, eventY: Float) {
home_screen_grid.hideResizeLines()
val (x, y) = home_screen_grid.intoViewSpaceCoords(eventX, eventY)
val clickedGridItem = home_screen_grid.isClickingGridItem(x.toInt(), y.toInt())
binding.homeScreenGrid.root.hideResizeLines()
val (x, y) = binding.homeScreenGrid.root.intoViewSpaceCoords(eventX, eventY)
val clickedGridItem = binding.homeScreenGrid.root.isClickingGridItem(x.toInt(), y.toInt())
if (clickedGridItem != null) {
performItemClick(clickedGridItem)
}
}
fun closeAppDrawer() {
fun closeAppDrawer(delayed: Boolean = false) {
if (isAllAppsFragmentExpanded()) {
Handler(Looper.getMainLooper()).postDelayed({
all_apps_fragment.y = mScreenHeight.toFloat()
all_apps_fragment.all_apps_grid.scrollToPosition(0)
home_screen_grid.fragmentCollapsed()
}, APP_DRAWER_CLOSE_DELAY)
val close = {
binding.allAppsFragment.root.y = mScreenHeight.toFloat()
binding.allAppsFragment.allAppsGrid.scrollToPosition(0)
binding.allAppsFragment.root.touchDownY = -1
binding.homeScreenGrid.root.fragmentCollapsed()
}
if (delayed) {
Handler(Looper.getMainLooper()).postDelayed(close, APP_DRAWER_CLOSE_DELAY)
} else {
close()
}
}
}
fun closeWidgetsFragment(delayed: Boolean = false) {
if (isWidgetsFragmentExpanded()) {
val close = {
binding.widgetsFragment.root.y = mScreenHeight.toFloat()
binding.widgetsFragment.widgetsList.scrollToPosition(0)
binding.widgetsFragment.root.touchDownY = -1
binding.homeScreenGrid.root.fragmentCollapsed()
}
if (delayed) {
Handler(Looper.getMainLooper()).postDelayed(close, APP_DRAWER_CLOSE_DELAY)
} else {
close()
}
}
}
@ -559,7 +601,7 @@ class MainActivity : SimpleActivity(), FlingListener {
val id = clickedGridItem.shortcutId
val packageName = clickedGridItem.packageName
val userHandle = android.os.Process.myUserHandle()
val shortcutBounds = home_screen_grid.getClickableRect(clickedGridItem)
val shortcutBounds = binding.homeScreenGrid.root.getClickableRect(clickedGridItem)
val launcherApps = applicationContext.getSystemService(Context.LAUNCHER_APPS_SERVICE) as LauncherApps
launcherApps.startShortcut(packageName, id, shortcutBounds, null, userHandle)
}
@ -570,8 +612,8 @@ class MainActivity : SimpleActivity(), FlingListener {
mOpenFolderDialog = FolderIconsDialog(
activity = this,
folder = folder,
iconWidth = home_screen_grid.getCurrentCellSize(),
iconPadding = home_screen_grid.getCurrentCellMargin(),
iconWidth = binding.homeScreenGrid.root.getCurrentCellSize(),
iconPadding = binding.homeScreenGrid.root.getCurrentCellMargin(),
dismissListener = {
mOpenFolderDialog = null
},
@ -583,10 +625,10 @@ class MainActivity : SimpleActivity(), FlingListener {
private fun performItemLongClick(x: Float, clickedGridItem: HomeScreenGridItem) {
if (clickedGridItem.type == ITEM_TYPE_ICON || clickedGridItem.type == ITEM_TYPE_SHORTCUT) {
main_holder.performHapticFeedback()
binding.mainHolder.performHapticFeedback()
}
val anchorY = home_screen_grid.sideMargins.top + (clickedGridItem.top * home_screen_grid.cellHeight.toFloat())
val anchorY = binding.homeScreenGrid.root.sideMargins.top + (clickedGridItem.top * binding.homeScreenGrid.root.cellHeight.toFloat())
showHomeIconMenu(x, anchorY, clickedGridItem, false)
}
@ -596,36 +638,36 @@ class MainActivity : SimpleActivity(), FlingListener {
}
fun showHomeIconMenu(x: Float, y: Float, gridItem: HomeScreenGridItem, isOnAllAppsFragment: Boolean) {
home_screen_grid.hideResizeLines()
binding.homeScreenGrid.root.hideResizeLines()
mLongPressedIcon = gridItem
val anchorY = if (isOnAllAppsFragment || gridItem.type == ITEM_TYPE_WIDGET) {
val iconSize = realScreenSize.x / config.drawerColumnCount
y - iconSize / 2f
} else {
val clickableRect = home_screen_grid.getClickableRect(gridItem)
clickableRect.top.toFloat() - home_screen_grid.getCurrentIconSize() / 2f
val clickableRect = binding.homeScreenGrid.root.getClickableRect(gridItem)
clickableRect.top.toFloat() - binding.homeScreenGrid.root.getCurrentIconSize() / 2f
}
home_screen_popup_menu_anchor.x = x
home_screen_popup_menu_anchor.y = anchorY
binding.homeScreenPopupMenuAnchor.x = x
binding.homeScreenPopupMenuAnchor.y = anchorY
if (mOpenPopupMenu == null) {
mOpenPopupMenu = handleGridItemPopupMenu(home_screen_popup_menu_anchor, gridItem, isOnAllAppsFragment, menuListener)
mOpenPopupMenu = handleGridItemPopupMenu(binding.homeScreenPopupMenuAnchor, gridItem, isOnAllAppsFragment, menuListener)
}
}
fun widgetLongPressedOnList(gridItem: HomeScreenGridItem) {
mLongPressedIcon = gridItem
hideFragment(widgets_fragment)
home_screen_grid.itemDraggingStarted(mLongPressedIcon!!)
hideFragment(binding.widgetsFragment)
binding.homeScreenGrid.root.itemDraggingStarted(mLongPressedIcon!!)
}
private fun showMainLongPressMenu(x: Float, y: Float) {
home_screen_grid.hideResizeLines()
home_screen_popup_menu_anchor.x = x
home_screen_popup_menu_anchor.y = y - resources.getDimension(R.dimen.long_press_anchor_button_offset_y) * 2
binding.homeScreenGrid.root.hideResizeLines()
binding.homeScreenPopupMenuAnchor.x = x
binding.homeScreenPopupMenuAnchor.y = y - resources.getDimension(R.dimen.long_press_anchor_button_offset_y) * 2
val contextTheme = ContextThemeWrapper(this, getPopupMenuTheme())
PopupMenu(contextTheme, home_screen_popup_menu_anchor, Gravity.TOP or Gravity.END).apply {
PopupMenu(contextTheme, binding.homeScreenPopupMenuAnchor, Gravity.TOP or Gravity.END).apply {
inflate(R.menu.menu_home_screen)
setOnMenuItemClickListener { item ->
when (item.itemId) {
@ -639,19 +681,19 @@ class MainActivity : SimpleActivity(), FlingListener {
}
private fun resetFragmentTouches() {
(widgets_fragment as WidgetsFragment).apply {
binding.widgetsFragment.root.apply {
touchDownY = -1
ignoreTouches = false
}
(all_apps_fragment as AllAppsFragment).apply {
binding.allAppsFragment.root.apply {
touchDownY = -1
ignoreTouches = false
}
}
private fun showWidgetsFragment() {
showFragment(widgets_fragment)
showFragment(binding.widgetsFragment)
}
private fun hideIcon(item: HomeScreenGridItem) {
@ -660,14 +702,14 @@ class MainActivity : SimpleActivity(), FlingListener {
hiddenIconsDB.insert(hiddenIcon)
runOnUiThread {
(all_apps_fragment as AllAppsFragment).hideIcon(item)
binding.allAppsFragment.root.hideIcon(item)
}
}
}
private fun renameItem(homeScreenGridItem: HomeScreenGridItem) {
RenameItemDialog(this, homeScreenGridItem) {
home_screen_grid.fetchGridItems()
binding.homeScreenGrid.root.fetchGridItems()
}
}
@ -677,7 +719,7 @@ class MainActivity : SimpleActivity(), FlingListener {
startActivity(this)
}
} catch (e: ActivityNotFoundException) {
toast(R.string.no_app_found)
toast(com.simplemobiletools.commons.R.string.no_app_found)
} catch (e: Exception) {
showErrorToast(e)
}
@ -720,7 +762,7 @@ class MainActivity : SimpleActivity(), FlingListener {
override fun onFlingUp() {
if (!isWidgetsFragmentExpanded()) {
mIgnoreUpEvent = true
showFragment(all_apps_fragment)
showFragment(binding.allAppsFragment)
}
}
@ -728,9 +770,9 @@ class MainActivity : SimpleActivity(), FlingListener {
override fun onFlingDown() {
mIgnoreUpEvent = true
if (isAllAppsFragmentExpanded()) {
hideFragment(all_apps_fragment)
hideFragment(binding.allAppsFragment)
} else if (isWidgetsFragmentExpanded()) {
hideFragment(widgets_fragment)
hideFragment(binding.widgetsFragment)
} else {
try {
Class.forName("android.app.StatusBarManager").getMethod("expandNotificationsPanel").invoke(getSystemService("statusbar"))
@ -741,12 +783,12 @@ class MainActivity : SimpleActivity(), FlingListener {
override fun onFlingRight() {
mIgnoreUpEvent = true
home_screen_grid.prevPage(redraw = true)
binding.homeScreenGrid.root.prevPage(redraw = true)
}
override fun onFlingLeft() {
mIgnoreUpEvent = true
home_screen_grid.nextPage(redraw = true)
binding.homeScreenGrid.root.nextPage(redraw = true)
}
@SuppressLint("WrongConstant")

View File

@ -10,29 +10,32 @@ import com.simplemobiletools.commons.models.FAQItem
import com.simplemobiletools.commons.models.RadioItem
import com.simplemobiletools.launcher.BuildConfig
import com.simplemobiletools.launcher.R
import com.simplemobiletools.launcher.databinding.ActivitySettingsBinding
import com.simplemobiletools.launcher.extensions.config
import com.simplemobiletools.launcher.helpers.MAX_COLUMN_COUNT
import com.simplemobiletools.launcher.helpers.MAX_ROW_COUNT
import com.simplemobiletools.launcher.helpers.MIN_COLUMN_COUNT
import com.simplemobiletools.launcher.helpers.MIN_ROW_COUNT
import kotlinx.android.synthetic.main.activity_settings.*
import java.util.Locale
import kotlin.system.exitProcess
class SettingsActivity : SimpleActivity() {
private lateinit var binding: ActivitySettingsBinding
override fun onCreate(savedInstanceState: Bundle?) {
isMaterialActivity = true
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_settings)
binding = ActivitySettingsBinding.inflate(layoutInflater)
setContentView(binding.root)
updateMaterialActivityViews(settings_coordinator, settings_holder, useTransparentNavigation = true, useTopSearchMenu = false)
setupMaterialScrollListener(settings_nested_scrollview, settings_toolbar)
updateMaterialActivityViews(binding.settingsCoordinator, binding.settingsHolder, useTransparentNavigation = true, useTopSearchMenu = false)
setupMaterialScrollListener(binding.settingsNestedScrollview, binding.settingsToolbar)
setupOptionsMenu()
}
override fun onResume() {
super.onResume()
setupToolbar(settings_toolbar, NavigationIcon.Arrow)
setupToolbar(binding.settingsToolbar, NavigationIcon.Arrow)
refreshMenuItems()
setupPurchaseThankYou()
@ -45,20 +48,20 @@ class SettingsActivity : SimpleActivity() {
setupHomeColumnCount()
setupLanguage()
setupManageHiddenIcons()
updateTextColors(settings_holder)
updateTextColors(binding.settingsHolder)
arrayOf(
settings_color_customization_section_label,
settings_general_settings_label,
settings_drawer_settings_label,
settings_home_screen_label
binding.settingsColorCustomizationSectionLabel,
binding.settingsGeneralSettingsLabel,
binding.settingsDrawerSettingsLabel,
binding.settingsHomeScreenLabel
).forEach {
it.setTextColor(getProperPrimaryColor())
}
}
private fun setupOptionsMenu() {
settings_toolbar.setOnMenuItemClickListener { menuItem ->
binding.settingsToolbar.setOnMenuItemClickListener { menuItem ->
when (menuItem.itemId) {
R.id.about -> launchAbout()
R.id.more_apps_from_us -> launchMoreAppsFromUsIntent()
@ -69,50 +72,50 @@ class SettingsActivity : SimpleActivity() {
}
private fun refreshMenuItems() {
settings_toolbar.menu.apply {
findItem(R.id.more_apps_from_us).isVisible = !resources.getBoolean(R.bool.hide_google_relations)
binding.settingsToolbar.menu.apply {
findItem(R.id.more_apps_from_us).isVisible = !resources.getBoolean(com.simplemobiletools.commons.R.bool.hide_google_relations)
}
}
private fun setupPurchaseThankYou() {
settings_purchase_thank_you_holder.beGoneIf(isOrWasThankYouInstalled())
settings_purchase_thank_you_holder.setOnClickListener {
binding.settingsPurchaseThankYouHolder.beGoneIf(isOrWasThankYouInstalled())
binding.settingsPurchaseThankYouHolder.setOnClickListener {
launchPurchaseThankYouIntent()
}
}
private fun setupCustomizeColors() {
settings_color_customization_label.text = getCustomizeColorsString()
settings_color_customization_holder.setOnClickListener {
binding.settingsColorCustomizationLabel.text = getCustomizeColorsString()
binding.settingsColorCustomizationHolder.setOnClickListener {
startCustomizationActivity()
}
}
private fun setupUseEnglish() {
settings_use_english_holder.beVisibleIf((config.wasUseEnglishToggled || Locale.getDefault().language != "en") && !isTiramisuPlus())
settings_use_english.isChecked = config.useEnglish
settings_use_english_holder.setOnClickListener {
settings_use_english.toggle()
config.useEnglish = settings_use_english.isChecked
binding.settingsUseEnglishHolder.beVisibleIf((config.wasUseEnglishToggled || Locale.getDefault().language != "en") && !isTiramisuPlus())
binding.settingsUseEnglish.isChecked = config.useEnglish
binding.settingsUseEnglishHolder.setOnClickListener {
binding.settingsUseEnglish.toggle()
config.useEnglish = binding.settingsUseEnglish.isChecked
exitProcess(0)
}
}
private fun setupCloseAppDrawerOnOtherAppOpen() {
settings_close_app_drawer_on_other_app.isChecked = config.closeAppDrawer
settings_close_app_drawer_on_other_app_holder.setOnClickListener {
settings_close_app_drawer_on_other_app.toggle()
config.closeAppDrawer = settings_close_app_drawer_on_other_app.isChecked
binding.settingsCloseAppDrawerOnOtherApp.isChecked = config.closeAppDrawer
binding.settingsCloseAppDrawerOnOtherAppHolder.setOnClickListener {
binding.settingsCloseAppDrawerOnOtherApp.toggle()
config.closeAppDrawer = binding.settingsCloseAppDrawerOnOtherApp.isChecked
}
}
private fun setupDrawerColumnCount() {
val currentColumnCount = config.drawerColumnCount
settings_drawer_column_count.text = currentColumnCount.toString()
settings_drawer_column_count_holder.setOnClickListener {
binding.settingsDrawerColumnCount.text = currentColumnCount.toString()
binding.settingsDrawerColumnCountHolder.setOnClickListener {
val items = ArrayList<RadioItem>()
for (i in 1..MAX_COLUMN_COUNT) {
items.add(RadioItem(i, resources.getQuantityString(R.plurals.column_counts, i, i)))
items.add(RadioItem(i, resources.getQuantityString(com.simplemobiletools.commons.R.plurals.column_counts, i, i)))
}
RadioGroupDialog(this, items, currentColumnCount) {
@ -127,20 +130,20 @@ class SettingsActivity : SimpleActivity() {
private fun setupDrawerSearchBar() {
val showSearchBar = config.showSearchBar
settings_show_search_bar.isChecked = showSearchBar
settings_drawer_search_holder.setOnClickListener {
settings_show_search_bar.toggle()
config.showSearchBar = settings_show_search_bar.isChecked
binding.settingsShowSearchBar.isChecked = showSearchBar
binding.settingsDrawerSearchHolder.setOnClickListener {
binding.settingsShowSearchBar.toggle()
config.showSearchBar = binding.settingsShowSearchBar.isChecked
}
}
private fun setupHomeRowCount() {
val currentRowCount = config.homeRowCount
settings_home_screen_row_count.text = currentRowCount.toString()
settings_home_screen_row_count_holder.setOnClickListener {
binding.settingsHomeScreenRowCount.text = currentRowCount.toString()
binding.settingsHomeScreenRowCountHolder.setOnClickListener {
val items = ArrayList<RadioItem>()
for (i in MIN_ROW_COUNT..MAX_ROW_COUNT) {
items.add(RadioItem(i, resources.getQuantityString(R.plurals.row_counts, i, i)))
items.add(RadioItem(i, resources.getQuantityString(com.simplemobiletools.commons.R.plurals.row_counts, i, i)))
}
RadioGroupDialog(this, items, currentRowCount) {
@ -155,11 +158,11 @@ class SettingsActivity : SimpleActivity() {
private fun setupHomeColumnCount() {
val currentColumnCount = config.homeColumnCount
settings_home_screen_column_count.text = currentColumnCount.toString()
settings_home_screen_column_count_holder.setOnClickListener {
binding.settingsHomeScreenColumnCount.text = currentColumnCount.toString()
binding.settingsHomeScreenColumnCountHolder.setOnClickListener {
val items = ArrayList<RadioItem>()
for (i in MIN_COLUMN_COUNT..MAX_COLUMN_COUNT) {
items.add(RadioItem(i, resources.getQuantityString(R.plurals.column_counts, i, i)))
items.add(RadioItem(i, resources.getQuantityString(com.simplemobiletools.commons.R.plurals.column_counts, i, i)))
}
RadioGroupDialog(this, items, currentColumnCount) {
@ -173,15 +176,15 @@ class SettingsActivity : SimpleActivity() {
}
private fun setupLanguage() {
settings_language.text = Locale.getDefault().displayLanguage
settings_language_holder.beVisibleIf(isTiramisuPlus())
settings_language_holder.setOnClickListener {
binding.settingsLanguage.text = Locale.getDefault().displayLanguage
binding.settingsLanguageHolder.beVisibleIf(isTiramisuPlus())
binding.settingsLanguageHolder.setOnClickListener {
launchChangeAppLanguageIntent()
}
}
private fun setupManageHiddenIcons() {
settings_manage_hidden_icons_holder.setOnClickListener {
binding.settingsManageHiddenIconsHolder.setOnClickListener {
startActivity(Intent(this, HiddenIconsActivity::class.java))
}
}
@ -190,9 +193,9 @@ class SettingsActivity : SimpleActivity() {
val licenses = 0L
val faqItems = ArrayList<FAQItem>()
if (!resources.getBoolean(R.bool.hide_google_relations)) {
faqItems.add(FAQItem(R.string.faq_2_title_commons, R.string.faq_2_text_commons))
faqItems.add(FAQItem(R.string.faq_6_title_commons, R.string.faq_6_text_commons))
if (!resources.getBoolean(com.simplemobiletools.commons.R.bool.hide_google_relations)) {
faqItems.add(FAQItem(com.simplemobiletools.commons.R.string.faq_2_title_commons, com.simplemobiletools.commons.R.string.faq_2_text_commons))
faqItems.add(FAQItem(com.simplemobiletools.commons.R.string.faq_6_title_commons, com.simplemobiletools.commons.R.string.faq_6_text_commons))
}
startAboutActivity(R.string.app_name, licenses, BuildConfig.VERSION_NAME, faqItems, true)

View File

@ -9,12 +9,10 @@ import com.simplemobiletools.commons.adapters.MyRecyclerViewAdapter
import com.simplemobiletools.commons.views.MyRecyclerView
import com.simplemobiletools.launcher.R
import com.simplemobiletools.launcher.activities.MainActivity
import com.simplemobiletools.launcher.databinding.ItemLauncherLabelBinding
import com.simplemobiletools.launcher.extensions.handleGridItemPopupMenu
import com.simplemobiletools.launcher.interfaces.ItemMenuListenerAdapter
import com.simplemobiletools.launcher.models.HomeScreenGridItem
import kotlinx.android.synthetic.main.item_launcher_label.view.launcher_icon
import kotlinx.android.synthetic.main.item_launcher_label.view.launcher_label
import kotlinx.android.synthetic.main.item_launcher_label.view.popup_anchor
class FolderIconsAdapter(
activity: BaseSimpleActivity, var items: MutableList<HomeScreenGridItem>, private val iconPadding: Int,
@ -40,7 +38,7 @@ class FolderIconsAdapter(
override fun prepareActionMode(menu: Menu) {}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
return createViewHolder(R.layout.item_launcher_label, parent)
return createViewHolder(ItemLauncherLabelBinding.inflate(layoutInflater, parent, false).root)
}
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
@ -58,18 +56,18 @@ class FolderIconsAdapter(
}
private fun setupView(view: View, item: HomeScreenGridItem) {
view.apply {
launcher_label.text = item.title
launcher_label.setTextColor(textColor)
launcher_icon.setPadding(iconPadding, iconPadding, iconPadding, 0)
launcher_icon.setImageDrawable(item.drawable)
ItemLauncherLabelBinding.bind(view).apply {
launcherLabel.text = item.title
launcherLabel.setTextColor(textColor)
launcherIcon.setPadding(iconPadding, iconPadding, iconPadding, 0)
launcherIcon.setImageDrawable(item.drawable)
val mainListener = (activity as? MainActivity)?.menuListener
setOnClickListener { itemClick(item) }
setOnLongClickListener {
popup_anchor.y = launcher_icon.y
activity.handleGridItemPopupMenu(popup_anchor, item, false, object : ItemMenuListenerAdapter() {
root.setOnClickListener { itemClick(item) }
root.setOnLongClickListener {
popupAnchor.y = launcherIcon.y
activity.handleGridItemPopupMenu(popupAnchor, item, false, object : ItemMenuListenerAdapter() {
override fun appInfo(gridItem: HomeScreenGridItem) {
mainListener?.appInfo(gridItem)
}
@ -95,7 +93,7 @@ class FolderIconsAdapter(
}
}
val yOffset = resources.getDimension(R.dimen.long_press_anchor_button_offset_y) * (visibleMenuItems - 1)
popup_anchor.y -= yOffset
popupAnchor.y -= yOffset
}
})
true

View File

@ -15,9 +15,9 @@ import com.simplemobiletools.commons.helpers.ensureBackgroundThread
import com.simplemobiletools.commons.interfaces.RefreshRecyclerViewListener
import com.simplemobiletools.commons.views.MyRecyclerView
import com.simplemobiletools.launcher.R
import com.simplemobiletools.launcher.databinding.ItemHiddenIconBinding
import com.simplemobiletools.launcher.extensions.hiddenIconsDB
import com.simplemobiletools.launcher.models.HiddenIcon
import kotlinx.android.synthetic.main.item_hidden_icon.view.*
class HiddenIconsAdapter(
activity: BaseSimpleActivity,
@ -56,7 +56,9 @@ class HiddenIconsAdapter(
override fun onActionModeDestroyed() {}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = createViewHolder(R.layout.item_hidden_icon, parent)
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
return createViewHolder(ItemHiddenIconBinding.inflate(layoutInflater, parent, false).root)
}
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
val folder = hiddenIcons[position]
@ -101,11 +103,11 @@ class HiddenIconsAdapter(
}
private fun setupView(view: View, icon: HiddenIcon) {
view.apply {
hidden_icon_holder?.isSelected = selectedKeys.contains(icon.hashCode())
hidden_icon_label.text = icon.title
hidden_icon_label.setTextColor(textColor)
hidden_icon.setPadding(iconPadding, iconPadding, iconPadding, 0)
ItemHiddenIconBinding.bind(view).apply {
hiddenIconHolder.isSelected = selectedKeys.contains(icon.hashCode())
hiddenIconLabel.text = icon.title
hiddenIconLabel.setTextColor(textColor)
hiddenIcon.setPadding(iconPadding, iconPadding, iconPadding, 0)
val factory = DrawableCrossFadeFactory.Builder(150).setCrossFadeEnabled(true).build()
@ -113,7 +115,7 @@ class HiddenIconsAdapter(
.load(icon.drawable)
.diskCacheStrategy(DiskCacheStrategy.RESOURCE)
.transition(DrawableTransitionOptions.withCrossFade(factory))
.into(hidden_icon)
.into(hiddenIcon)
}
}
}

View File

@ -14,11 +14,11 @@ import com.simplemobiletools.commons.extensions.getProperTextColor
import com.simplemobiletools.commons.extensions.realScreenSize
import com.simplemobiletools.launcher.R
import com.simplemobiletools.launcher.activities.SimpleActivity
import com.simplemobiletools.launcher.databinding.ItemLauncherLabelBinding
import com.simplemobiletools.launcher.extensions.config
import com.simplemobiletools.launcher.interfaces.AllAppsListener
import com.simplemobiletools.launcher.models.AppLauncher
import com.simplemobiletools.launcher.models.HomeScreenGridItem
import kotlinx.android.synthetic.main.item_launcher_label.view.*
class LaunchersAdapter(
val activity: SimpleActivity,
@ -44,8 +44,8 @@ class LaunchersAdapter(
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_launcher_label, parent, false)
return ViewHolder(view)
val binding = ItemLauncherLabelBinding.inflate(LayoutInflater.from(parent.context), parent, false)
return ViewHolder(binding.root)
}
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
@ -103,10 +103,11 @@ class LaunchersAdapter(
inner class ViewHolder(view: View) : RecyclerView.ViewHolder(view) {
fun bindView(launcher: AppLauncher): View {
val binding = ItemLauncherLabelBinding.bind(itemView)
itemView.apply {
launcher_label.text = launcher.title
launcher_label.setTextColor(textColor)
launcher_icon.setPadding(iconPadding, iconPadding, iconPadding, 0)
binding.launcherLabel.text = launcher.title
binding.launcherLabel.setTextColor(textColor)
binding.launcherIcon.setPadding(iconPadding, iconPadding, iconPadding, 0)
val factory = DrawableCrossFadeFactory.Builder(150).setCrossFadeEnabled(true).build()
val placeholderDrawable = activity.resources.getColoredDrawableWithColor(R.drawable.placeholder_drawable, launcher.thumbnailColor)
@ -116,7 +117,7 @@ class LaunchersAdapter(
.placeholder(placeholderDrawable)
.diskCacheStrategy(DiskCacheStrategy.RESOURCE)
.transition(DrawableTransitionOptions.withCrossFade(factory))
.into(launcher_icon)
.into(binding.launcherIcon)
setOnClickListener { itemClick(launcher) }
setOnLongClickListener { view ->

View File

@ -9,15 +9,15 @@ import com.bumptech.glide.Glide
import com.simplemobiletools.commons.extensions.getProperTextColor
import com.simplemobiletools.launcher.R
import com.simplemobiletools.launcher.activities.SimpleActivity
import com.simplemobiletools.launcher.databinding.ItemWidgetListItemsHolderBinding
import com.simplemobiletools.launcher.databinding.ItemWidgetListSectionBinding
import com.simplemobiletools.launcher.databinding.ItemWidgetPreviewBinding
import com.simplemobiletools.launcher.helpers.WIDGET_LIST_ITEMS_HOLDER
import com.simplemobiletools.launcher.helpers.WIDGET_LIST_SECTION
import com.simplemobiletools.launcher.interfaces.WidgetsFragmentListener
import com.simplemobiletools.launcher.models.WidgetsListItem
import com.simplemobiletools.launcher.models.WidgetsListItemsHolder
import com.simplemobiletools.launcher.models.WidgetsListSection
import kotlinx.android.synthetic.main.item_widget_list_items_holder.view.*
import kotlinx.android.synthetic.main.item_widget_list_section.view.*
import kotlinx.android.synthetic.main.item_widget_preview.view.*
class WidgetsAdapter(
val activity: SimpleActivity,
@ -29,13 +29,13 @@ class WidgetsAdapter(
private var textColor = activity.getProperTextColor()
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
val layoutId = when (viewType) {
WIDGET_LIST_SECTION -> R.layout.item_widget_list_section
else -> R.layout.item_widget_list_items_holder
val inflater = LayoutInflater.from(parent.context)
val binding = when (viewType) {
WIDGET_LIST_SECTION -> ItemWidgetListSectionBinding.inflate(inflater, parent, false)
else -> ItemWidgetListItemsHolderBinding.inflate(inflater, parent, false)
}
val view = LayoutInflater.from(parent.context).inflate(layoutId, parent, false)
return ViewHolder(view)
return ViewHolder(binding.root)
}
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
@ -56,43 +56,44 @@ class WidgetsAdapter(
}
private fun setupListSection(view: View, section: WidgetsListSection) {
view.apply {
widget_app_title.text = section.appTitle
widget_app_title.setTextColor(textColor)
widget_app_icon.setImageDrawable(section.appIcon)
ItemWidgetListSectionBinding.bind(view).apply {
widgetAppTitle.text = section.appTitle
widgetAppTitle.setTextColor(textColor)
widgetAppIcon.setImageDrawable(section.appIcon)
}
}
private fun setupListItemsHolder(view: View, listItem: WidgetsListItemsHolder) {
view.widget_list_items_holder.removeAllViews()
view.widget_list_items_scroll_view.scrollX = 0
val binding = ItemWidgetListItemsHolderBinding.bind(view)
binding.widgetListItemsHolder.removeAllViews()
binding.widgetListItemsScrollView.scrollX = 0
listItem.widgets.forEachIndexed { index, widget ->
val imageSize = activity.resources.getDimension(R.dimen.widget_preview_size).toInt()
val widgetPreview = LayoutInflater.from(activity).inflate(R.layout.item_widget_preview, null)
view.widget_list_items_holder.addView(widgetPreview)
val widgetPreview = ItemWidgetPreviewBinding.inflate(LayoutInflater.from(activity))
binding.widgetListItemsHolder.addView(widgetPreview.root)
val endMargin = if (index == listItem.widgets.size - 1) {
activity.resources.getDimension(R.dimen.medium_margin).toInt()
activity.resources.getDimension(com.simplemobiletools.commons.R.dimen.medium_margin).toInt()
} else {
0
}
widgetPreview.widget_title.apply {
widgetPreview.widgetTitle.apply {
text = widget.widgetTitle
setTextColor(textColor)
}
widgetPreview.widget_size.apply {
widgetPreview.widgetSize.apply {
text = if (widget.isShortcut) {
activity.getString(R.string.shortcut)
activity.getString(com.simplemobiletools.commons.R.string.shortcut)
} else {
"${widget.widthCells} x ${widget.heightCells}"
}
setTextColor(textColor)
}
(widgetPreview.widget_image.layoutParams as RelativeLayout.LayoutParams).apply {
marginStart = activity.resources.getDimension(R.dimen.activity_margin).toInt()
(widgetPreview.widgetImage.layoutParams as RelativeLayout.LayoutParams).apply {
marginStart = activity.resources.getDimension(com.simplemobiletools.commons.R.dimen.activity_margin).toInt()
marginEnd = endMargin
width = imageSize
height = imageSize
@ -100,11 +101,11 @@ class WidgetsAdapter(
Glide.with(activity)
.load(widget.widgetPreviewImage)
.into(widgetPreview.widget_image)
.into(widgetPreview.widgetImage)
widgetPreview.setOnClickListener { itemClick() }
widgetPreview.root.setOnClickListener { itemClick() }
widgetPreview.setOnLongClickListener { view ->
widgetPreview.root.setOnLongClickListener { view ->
widgetsFragmentListener.onWidgetLongPressed(widget)
true
}

View File

@ -1,21 +1,19 @@
package com.simplemobiletools.launcher.dialogs
import android.graphics.drawable.BitmapDrawable
import android.view.View
import androidx.appcompat.app.AlertDialog
import com.simplemobiletools.commons.activities.BaseSimpleActivity
import com.simplemobiletools.commons.extensions.getAlertDialogBuilder
import com.simplemobiletools.commons.extensions.setupDialogStuff
import com.simplemobiletools.commons.helpers.ensureBackgroundThread
import com.simplemobiletools.commons.views.AutoGridLayoutManager
import com.simplemobiletools.launcher.R
import com.simplemobiletools.launcher.adapters.FolderIconsAdapter
import com.simplemobiletools.launcher.databinding.DialogFolderIconsBinding
import com.simplemobiletools.launcher.extensions.getDrawableForPackageName
import com.simplemobiletools.launcher.extensions.homeScreenGridItemsDB
import com.simplemobiletools.launcher.helpers.ITEM_TYPE_ICON
import com.simplemobiletools.launcher.helpers.ITEM_TYPE_SHORTCUT
import com.simplemobiletools.launcher.models.HomeScreenGridItem
import kotlinx.android.synthetic.main.dialog_folder_icons.view.dialog_folder_icons_grid
class FolderIconsDialog(
val activity: BaseSimpleActivity,
@ -26,11 +24,11 @@ class FolderIconsDialog(
private val itemClick: (HomeScreenGridItem) -> Unit
) {
private var dialog: AlertDialog? = null
private val view: View = activity.layoutInflater.inflate(R.layout.dialog_folder_icons, null)
private val binding = DialogFolderIconsBinding.inflate(activity.layoutInflater)
init {
view.dialog_folder_icons_grid.layoutManager = AutoGridLayoutManager(activity, iconWidth)
binding.dialogFolderIconsGrid.layoutManager = AutoGridLayoutManager(activity, iconWidth)
ensureBackgroundThread {
val items = activity.homeScreenGridItemsDB.getFolderItems(folder.id!!)
@ -42,23 +40,23 @@ class FolderIconsDialog(
}
}
activity.runOnUiThread {
initDialog(items, view)
initDialog(items, binding)
}
}
}
private fun initDialog(items: List<HomeScreenGridItem>, view: View) {
view.dialog_folder_icons_grid.adapter = FolderIconsAdapter(activity, items.toMutableList(), iconPadding, view.dialog_folder_icons_grid) {
private fun initDialog(items: List<HomeScreenGridItem>, binding: DialogFolderIconsBinding) {
binding.dialogFolderIconsGrid.adapter = FolderIconsAdapter(activity, items.toMutableList(), iconPadding, binding.dialogFolderIconsGrid) {
it as HomeScreenGridItem
itemClick(it)
dialog?.dismiss()
}
activity.getAlertDialogBuilder()
.setNegativeButton(R.string.cancel, null)
.setNegativeButton(com.simplemobiletools.commons.R.string.cancel, null)
.setOnDismissListener { dismissListener() }
.apply {
activity.setupDialogStuff(view, this, 0, folder.title) { alertDialog ->
activity.setupDialogStuff(binding.root, this, 0, folder.title) { alertDialog ->
dialog = alertDialog
}
}
@ -75,7 +73,7 @@ class FolderIconsDialog(
}
}
activity.runOnUiThread {
(view.dialog_folder_icons_grid.adapter as FolderIconsAdapter).updateItems(items)
(binding.dialogFolderIconsGrid.adapter as FolderIconsAdapter).updateItems(items)
}
}
}

View File

@ -2,41 +2,39 @@ package com.simplemobiletools.launcher.dialogs
import android.app.Activity
import android.app.AlertDialog
import android.view.ViewGroup
import com.simplemobiletools.commons.extensions.*
import com.simplemobiletools.commons.helpers.ensureBackgroundThread
import com.simplemobiletools.commons.helpers.mydebug
import com.simplemobiletools.launcher.R
import com.simplemobiletools.launcher.databinding.DialogRenameItemBinding
import com.simplemobiletools.launcher.extensions.homeScreenGridItemsDB
import com.simplemobiletools.launcher.models.HomeScreenGridItem
import kotlinx.android.synthetic.main.dialog_rename_item.view.*
class RenameItemDialog(val activity: Activity, val item: HomeScreenGridItem, val callback: () -> Unit) {
init {
val view = (activity.layoutInflater.inflate(R.layout.dialog_rename_item, null) as ViewGroup)
view.rename_item_edittext.setText(item.title)
val binding = DialogRenameItemBinding.inflate(activity.layoutInflater)
val view = binding.root
binding.renameItemEdittext.setText(item.title)
activity.getAlertDialogBuilder()
.setPositiveButton(R.string.ok, null)
.setNegativeButton(R.string.cancel, null)
.setPositiveButton(com.simplemobiletools.commons.R.string.ok, null)
.setNegativeButton(com.simplemobiletools.commons.R.string.cancel, null)
.apply {
activity.setupDialogStuff(view, this, R.string.rename) { alertDialog ->
alertDialog.showKeyboard(view.rename_item_edittext)
activity.setupDialogStuff(view, this, com.simplemobiletools.commons.R.string.rename) { alertDialog ->
alertDialog.showKeyboard(binding.renameItemEdittext)
alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener {
val newTitle = view.rename_item_edittext.value
if (!newTitle.isEmpty()) {
val newTitle = binding.renameItemEdittext.value
if (newTitle.isNotEmpty()) {
ensureBackgroundThread {
val result = activity.homeScreenGridItemsDB.updateItemTitle(newTitle, item.id!!)
if (result == 1) {
callback()
alertDialog.dismiss()
} else {
activity.toast(R.string.unknown_error_occurred)
activity.toast(com.simplemobiletools.commons.R.string.unknown_error_occurred)
}
}
} else {
activity.toast(R.string.value_cannot_be_empty)
activity.toast(com.simplemobiletools.commons.R.string.value_cannot_be_empty)
}
}
}

View File

@ -10,18 +10,17 @@ import android.view.WindowManager
import com.simplemobiletools.commons.extensions.*
import com.simplemobiletools.commons.helpers.isRPlus
import com.simplemobiletools.commons.views.MyGridLayoutManager
import com.simplemobiletools.launcher.R
import com.simplemobiletools.launcher.activities.MainActivity
import com.simplemobiletools.launcher.adapters.LaunchersAdapter
import com.simplemobiletools.launcher.databinding.AllAppsFragmentBinding
import com.simplemobiletools.launcher.extensions.config
import com.simplemobiletools.launcher.extensions.launchApp
import com.simplemobiletools.launcher.helpers.ITEM_TYPE_ICON
import com.simplemobiletools.launcher.interfaces.AllAppsListener
import com.simplemobiletools.launcher.models.AppLauncher
import com.simplemobiletools.launcher.models.HomeScreenGridItem
import kotlinx.android.synthetic.main.all_apps_fragment.view.*
class AllAppsFragment(context: Context, attributeSet: AttributeSet) : MyFragment(context, attributeSet), AllAppsListener {
class AllAppsFragment(context: Context, attributeSet: AttributeSet) : MyFragment<AllAppsFragmentBinding>(context, attributeSet), AllAppsListener {
private var lastTouchCoords = Pair(0f, 0f)
var touchDownY = -1
var ignoreTouches = false
@ -30,8 +29,9 @@ class AllAppsFragment(context: Context, attributeSet: AttributeSet) : MyFragment
@SuppressLint("ClickableViewAccessibility")
override fun setupFragment(activity: MainActivity) {
this.activity = activity
this.binding = AllAppsFragmentBinding.bind(this)
all_apps_grid.setOnTouchListener { v, event ->
binding.allAppsGrid.setOnTouchListener { v, event ->
if (event.actionMasked == MotionEvent.ACTION_UP || event.actionMasked == MotionEvent.ACTION_CANCEL) {
touchDownY = -1
}
@ -42,30 +42,26 @@ class AllAppsFragment(context: Context, attributeSet: AttributeSet) : MyFragment
@SuppressLint("NotifyDataSetChanged")
fun onResume() {
if (all_apps_grid?.layoutManager == null || all_apps_grid?.adapter == null) {
if (binding.allAppsGrid.layoutManager == null || binding.allAppsGrid.adapter == null) {
return
}
val layoutManager = all_apps_grid.layoutManager as MyGridLayoutManager
val layoutManager = binding.allAppsGrid.layoutManager as MyGridLayoutManager
if (layoutManager.spanCount != context.config.drawerColumnCount) {
onConfigurationChanged()
// Force redraw due to changed item size
(all_apps_grid.adapter as LaunchersAdapter).notifyDataSetChanged()
(binding.allAppsGrid.adapter as LaunchersAdapter).notifyDataSetChanged()
}
}
fun onConfigurationChanged() {
if (all_apps_grid == null) {
return
}
all_apps_grid.scrollToPosition(0)
all_apps_fastscroller.resetManualScrolling()
binding.allAppsGrid.scrollToPosition(0)
binding.allAppsFastscroller.resetManualScrolling()
setupViews()
val layoutManager = all_apps_grid.layoutManager as MyGridLayoutManager
val layoutManager = binding.allAppsGrid.layoutManager as MyGridLayoutManager
layoutManager.spanCount = context.config.drawerColumnCount
val launchers = (all_apps_grid.adapter as LaunchersAdapter).launchers
val launchers = (binding.allAppsGrid.adapter as LaunchersAdapter).launchers
setupAdapter(launchers)
}
@ -87,7 +83,7 @@ class AllAppsFragment(context: Context, attributeSet: AttributeSet) : MyFragment
// pull the whole fragment down if it is scrolled way to the top and the users pulls it even further
if (touchDownY != -1) {
shouldIntercept = touchDownY - event.y.toInt() < 0 && all_apps_grid.computeVerticalScrollOffset() == 0
shouldIntercept = touchDownY - event.y.toInt() < 0 && binding.allAppsGrid.computeVerticalScrollOffset() == 0
if (shouldIntercept) {
activity?.startHandlingTouches(touchDownY)
touchDownY = -1
@ -113,20 +109,20 @@ class AllAppsFragment(context: Context, attributeSet: AttributeSet) : MyFragment
private fun setupAdapter(launchers: ArrayList<AppLauncher>) {
activity?.runOnUiThread {
val layoutManager = all_apps_grid.layoutManager as MyGridLayoutManager
val layoutManager = binding.allAppsGrid.layoutManager as MyGridLayoutManager
layoutManager.spanCount = context.config.drawerColumnCount
val currAdapter = all_apps_grid.adapter
val currAdapter = binding.allAppsGrid.adapter
if (currAdapter == null) {
LaunchersAdapter(activity!!, launchers, this) {
activity?.launchApp((it as AppLauncher).packageName, it.activityName)
if (activity?.config?.closeAppDrawer == true) {
activity?.closeAppDrawer()
activity?.closeAppDrawer(delayed = true)
}
ignoreTouches = false
touchDownY = -1
}.apply {
all_apps_grid.adapter = this
binding.allAppsGrid.adapter = this
}
} else {
(currAdapter as LaunchersAdapter).updateItems(launchers)
@ -135,7 +131,7 @@ class AllAppsFragment(context: Context, attributeSet: AttributeSet) : MyFragment
}
fun hideIcon(item: HomeScreenGridItem) {
(all_apps_grid.adapter as? LaunchersAdapter)?.hideIcon(item)
(binding.allAppsGrid.adapter as? LaunchersAdapter)?.hideIcon(item)
}
fun setupViews(addTopPadding: Boolean = hasTopPadding) {
@ -143,7 +139,7 @@ class AllAppsFragment(context: Context, attributeSet: AttributeSet) : MyFragment
return
}
all_apps_fastscroller.updateColors(context.getProperPrimaryColor())
binding.allAppsFastscroller.updateColors(context.getProperPrimaryColor())
var bottomListPadding = 0
var leftListPadding = 0
@ -169,29 +165,29 @@ class AllAppsFragment(context: Context, attributeSet: AttributeSet) : MyFragment
}
}
all_apps_grid.setPadding(0, 0, resources.getDimension(R.dimen.medium_margin).toInt(), bottomListPadding)
all_apps_fastscroller.setPadding(leftListPadding, 0, rightListPadding, 0)
binding.allAppsGrid.setPadding(0, 0, resources.getDimension(com.simplemobiletools.commons.R.dimen.medium_margin).toInt(), bottomListPadding)
binding.allAppsFastscroller.setPadding(leftListPadding, 0, rightListPadding, 0)
hasTopPadding = addTopPadding
val topPadding = if (addTopPadding) activity!!.statusBarHeight else 0
setPadding(0, topPadding, 0, 0)
background = ColorDrawable(context.getProperBackgroundColor())
(all_apps_grid.adapter as? LaunchersAdapter)?.updateTextColor(context.getProperTextColor())
(binding.allAppsGrid.adapter as? LaunchersAdapter)?.updateTextColor(context.getProperTextColor())
search_bar.beVisibleIf(context.config.showSearchBar)
search_bar.getToolbar()?.beGone()
search_bar.updateColors()
search_bar.setupMenu()
binding.searchBar.beVisibleIf(context.config.showSearchBar)
binding.searchBar.getToolbar()?.beGone()
binding.searchBar.updateColors()
binding.searchBar.setupMenu()
search_bar.onSearchTextChangedListener = {
(all_apps_grid.adapter as? LaunchersAdapter)?.updateSearchQuery(it)
binding.searchBar.onSearchTextChangedListener = {
(binding.allAppsGrid.adapter as? LaunchersAdapter)?.updateSearchQuery(it)
showNoResultsPlaceholderIfNeeded()
}
}
private fun showNoResultsPlaceholderIfNeeded() {
val itemCount = all_apps_grid.adapter?.itemCount
no_results_placeholder.beVisibleIf(itemCount != null && itemCount == 0)
val itemCount = binding.allAppsGrid.adapter?.itemCount
binding.noResultsPlaceholder.beVisibleIf(itemCount != null && itemCount == 0)
}
override fun onAppLauncherLongPressed(x: Float, y: Float, appLauncher: AppLauncher) {
@ -218,12 +214,12 @@ class AllAppsFragment(context: Context, attributeSet: AttributeSet) : MyFragment
activity?.showHomeIconMenu(x, y, gridItem, true)
ignoreTouches = true
search_bar.closeSearch()
binding.searchBar.closeSearch()
}
fun onBackPressed(): Boolean {
if (search_bar.isSearchOpen) {
search_bar.closeSearch()
if (binding.searchBar.isSearchOpen) {
binding.searchBar.closeSearch()
return true
}

View File

@ -3,10 +3,12 @@ package com.simplemobiletools.launcher.fragments
import android.content.Context
import android.util.AttributeSet
import android.widget.RelativeLayout
import androidx.viewbinding.ViewBinding
import com.simplemobiletools.launcher.activities.MainActivity
abstract class MyFragment(context: Context, attributeSet: AttributeSet) : RelativeLayout(context, attributeSet) {
abstract class MyFragment<BINDING : ViewBinding>(context: Context, attributeSet: AttributeSet) : RelativeLayout(context, attributeSet) {
protected var activity: MainActivity? = null
protected lateinit var binding: BINDING
abstract fun setupFragment(activity: MainActivity)
}

View File

@ -18,15 +18,15 @@ 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.databinding.WidgetsFragmentBinding
import com.simplemobiletools.launcher.extensions.config
import com.simplemobiletools.launcher.extensions.getInitialCellSize
import com.simplemobiletools.launcher.helpers.ITEM_TYPE_SHORTCUT
import com.simplemobiletools.launcher.helpers.ITEM_TYPE_WIDGET
import com.simplemobiletools.launcher.interfaces.WidgetsFragmentListener
import com.simplemobiletools.launcher.models.*
import kotlinx.android.synthetic.main.widgets_fragment.view.*
class WidgetsFragment(context: Context, attributeSet: AttributeSet) : MyFragment(context, attributeSet), WidgetsFragmentListener {
class WidgetsFragment(context: Context, attributeSet: AttributeSet) : MyFragment<WidgetsFragmentBinding>(context, attributeSet), WidgetsFragmentListener {
private var lastTouchCoords = Pair(0f, 0f)
var touchDownY = -1
var ignoreTouches = false
@ -35,9 +35,10 @@ class WidgetsFragment(context: Context, attributeSet: AttributeSet) : MyFragment
@SuppressLint("ClickableViewAccessibility")
override fun setupFragment(activity: MainActivity) {
this.activity = activity
this.binding = WidgetsFragmentBinding.bind(this)
getAppWidgets()
widgets_list.setOnTouchListener { v, event ->
binding.widgetsList.setOnTouchListener { v, event ->
if (event.actionMasked == MotionEvent.ACTION_UP || event.actionMasked == MotionEvent.ACTION_CANCEL) {
touchDownY = -1
}
@ -47,14 +48,14 @@ class WidgetsFragment(context: Context, attributeSet: AttributeSet) : MyFragment
}
fun onConfigurationChanged() {
if (widgets_list == null) {
if (binding.widgetsList == null) {
return
}
widgets_list.scrollToPosition(0)
binding.widgetsList.scrollToPosition(0)
setupViews()
val appWidgets = (widgets_list.adapter as WidgetsAdapter).widgetListItems
val appWidgets = (binding.widgetsList.adapter as WidgetsAdapter).widgetListItems
setupAdapter(appWidgets)
}
@ -76,7 +77,7 @@ class WidgetsFragment(context: Context, attributeSet: AttributeSet) : MyFragment
// pull the whole fragment down if it is scrolled way to the top and the users pulls it even further
if (touchDownY != -1) {
shouldIntercept = touchDownY - event.y.toInt() < 0 && widgets_list.computeVerticalScrollOffset() == 0
shouldIntercept = touchDownY - event.y.toInt() < 0 && binding.widgetsList.computeVerticalScrollOffset() == 0
if (shouldIntercept) {
activity?.startHandlingTouches(touchDownY)
touchDownY = -1
@ -159,14 +160,14 @@ class WidgetsFragment(context: Context, attributeSet: AttributeSet) : MyFragment
private fun setupAdapter(widgetsListItems: ArrayList<WidgetsListItem>) {
activity?.runOnUiThread {
val currAdapter = widgets_list.adapter
val currAdapter = binding.widgetsList.adapter
if (currAdapter == null) {
WidgetsAdapter(activity!!, widgetsListItems, this) {
context.toast(R.string.touch_hold_widget)
ignoreTouches = false
touchDownY = -1
}.apply {
widgets_list.adapter = this
binding.widgetsList.adapter = this
}
} else {
(currAdapter as WidgetsAdapter).updateItems(widgetsListItems)
@ -179,7 +180,7 @@ class WidgetsFragment(context: Context, attributeSet: AttributeSet) : MyFragment
return
}
widgets_fastscroller.updateColors(context.getProperPrimaryColor())
binding.widgetsFastscroller.updateColors(context.getProperPrimaryColor())
var bottomListPadding = 0
var leftListPadding = 0
@ -205,14 +206,14 @@ class WidgetsFragment(context: Context, attributeSet: AttributeSet) : MyFragment
}
}
widgets_list.setPadding(0, 0, 0, bottomListPadding)
widgets_fastscroller.setPadding(leftListPadding, 0, rightListPadding, 0)
binding.widgetsList.setPadding(0, 0, 0, bottomListPadding)
binding.widgetsFastscroller.setPadding(leftListPadding, 0, rightListPadding, 0)
hasTopPadding = addTopPadding
val topPadding = if (addTopPadding) activity!!.statusBarHeight else 0
setPadding(0, topPadding, 0, 0)
background = ColorDrawable(context.getProperBackgroundColor())
(widgets_list.adapter as? WidgetsAdapter)?.updateTextColor(context.getProperTextColor())
(binding.widgetsList.adapter as? WidgetsAdapter)?.updateTextColor(context.getProperTextColor())
}
private fun getAppMetadataFromPackage(packageName: String): WidgetsListSection? {

View File

@ -31,12 +31,12 @@ import com.simplemobiletools.commons.helpers.ensureBackgroundThread
import com.simplemobiletools.commons.helpers.isSPlus
import com.simplemobiletools.launcher.R
import com.simplemobiletools.launcher.activities.MainActivity
import com.simplemobiletools.launcher.databinding.HomeScreenGridBinding
import com.simplemobiletools.launcher.extensions.config
import com.simplemobiletools.launcher.extensions.getDrawableForPackageName
import com.simplemobiletools.launcher.extensions.homeScreenGridItemsDB
import com.simplemobiletools.launcher.helpers.*
import com.simplemobiletools.launcher.models.HomeScreenGridItem
import kotlinx.android.synthetic.main.activity_main.view.*
import kotlin.math.abs
import kotlin.math.floor
import kotlin.math.max
@ -45,6 +45,7 @@ import kotlin.math.min
class HomeScreenGrid(context: Context, attrs: AttributeSet, defStyle: Int) : RelativeLayout(context, attrs, defStyle) {
constructor(context: Context, attrs: AttributeSet) : this(context, attrs, 0)
private lateinit var binding: HomeScreenGridBinding
private var columnCount = context.config.homeColumnCount
private var rowCount = context.config.homeRowCount
private var cellXCoords = ArrayList<Int>(columnCount)
@ -55,8 +56,8 @@ class HomeScreenGrid(context: Context, attrs: AttributeSet, defStyle: Int) : Rel
private var extraYMargin = 0
private var iconMargin = (context.resources.getDimension(R.dimen.icon_side_margin) * 5 / columnCount).toInt()
private var labelSideMargin = context.resources.getDimension(R.dimen.small_margin).toInt()
private var roundedCornerRadius = context.resources.getDimension(R.dimen.activity_margin)
private var labelSideMargin = context.resources.getDimension(com.simplemobiletools.commons.R.dimen.small_margin).toInt()
private var roundedCornerRadius = context.resources.getDimension(com.simplemobiletools.commons.R.dimen.activity_margin)
private var pageIndicatorRadius = context.resources.getDimension(R.dimen.page_indicator_dot_radius)
private var pageIndicatorMargin = context.resources.getDimension(R.dimen.page_indicator_margin)
private var textPaint: TextPaint
@ -117,13 +118,13 @@ class HomeScreenGrid(context: Context, attrs: AttributeSet, defStyle: Int) : Rel
textPaint = TextPaint(Paint.ANTI_ALIAS_FLAG).apply {
color = Color.WHITE
textSize = context.resources.getDimension(R.dimen.smaller_text_size)
textSize = context.resources.getDimension(com.simplemobiletools.commons.R.dimen.smaller_text_size)
setShadowLayer(2f, 0f, 0f, Color.BLACK)
}
dragShadowCirclePaint = Paint(Paint.ANTI_ALIAS_FLAG).apply {
color = context.resources.getColor(R.color.hint_white)
strokeWidth = context.resources.getDimension(R.dimen.small_margin)
color = context.resources.getColor(com.simplemobiletools.commons.R.color.hint_white)
strokeWidth = context.resources.getDimension(com.simplemobiletools.commons.R.dimen.small_margin)
style = Paint.Style.STROKE
}
@ -131,11 +132,11 @@ class HomeScreenGrid(context: Context, attrs: AttributeSet, defStyle: Int) : Rel
strokeWidth = context.resources.getDimension(R.dimen.page_indicator_stroke_width)
}
currentPageIndicatorPaint = Paint(Paint.ANTI_ALIAS_FLAG).apply {
color = context.resources.getColor(R.color.white)
color = context.resources.getColor(android.R.color.white)
style = Paint.Style.FILL
}
val sideMargin = context.resources.getDimension(R.dimen.normal_margin).toInt()
val sideMargin = context.resources.getDimension(com.simplemobiletools.commons.R.dimen.normal_margin).toInt()
sideMargins.apply {
top = context.statusBarHeight
bottom = context.navigationBarHeight
@ -146,6 +147,11 @@ class HomeScreenGrid(context: Context, attrs: AttributeSet, defStyle: Int) : Rel
fetchGridItems()
}
override fun onFinishInflate() {
super.onFinishInflate()
binding = HomeScreenGridBinding.bind(this)
}
fun fetchGridItems() {
ensureBackgroundThread {
val providers = appWidgetManager.installedProviders
@ -154,7 +160,8 @@ class HomeScreenGrid(context: Context, attrs: AttributeSet, defStyle: Int) : Rel
if (item.type == ITEM_TYPE_ICON) {
item.drawable = context.getDrawableForPackageName(item.packageName)
} else if (item.type == ITEM_TYPE_FOLDER) {
item.drawable = resources.getColoredDrawableWithColor(R.drawable.ic_folder_vector, context.getProperPrimaryColor())
item.drawable =
resources.getColoredDrawableWithColor(com.simplemobiletools.commons.R.drawable.ic_folder_vector, context.getProperPrimaryColor())
} else if (item.type == ITEM_TYPE_SHORTCUT) {
if (item.icon != null) {
item.drawable = BitmapDrawable(item.icon)
@ -218,7 +225,8 @@ class HomeScreenGrid(context: Context, attrs: AttributeSet, defStyle: Int) : Rel
draggedItem = draggedGridItem
if (draggedItem!!.drawable == null) {
if (draggedItem?.type == ITEM_TYPE_FOLDER) {
draggedItem!!.drawable = resources.getColoredDrawableWithColor(R.drawable.ic_folder_vector, context.getProperPrimaryColor())
draggedItem!!.drawable =
resources.getColoredDrawableWithColor(com.simplemobiletools.commons.R.drawable.ic_folder_vector, context.getProperPrimaryColor())
} else {
draggedItem!!.drawable = context.getDrawableForPackageName(draggedGridItem.packageName)
}
@ -311,20 +319,20 @@ class HomeScreenGrid(context: Context, attrs: AttributeSet, defStyle: Int) : Rel
redrawGrid()
val widgetView = widgetViews.firstOrNull { it.tag == resizedWidget!!.widgetId }
resize_frame.beGone()
binding.resizeFrame.beGone()
if (widgetView != null) {
val viewX = widgetView.x.toInt()
val viewY = widgetView.y.toInt()
val frameRect = Rect(viewX, viewY, viewX + widgetView.width, viewY + widgetView.height)
val otherGridItems = gridItems.filter { it.widgetId != item.widgetId }.toMutableList() as ArrayList<HomeScreenGridItem>
resize_frame.updateFrameCoords(frameRect, cellWidth, cellHeight, sideMargins, item, otherGridItems)
resize_frame.beVisible()
resize_frame.z = 1f // make sure the frame isnt behind the widget itself
resize_frame.onClickListener = {
binding.resizeFrame.updateFrameCoords(frameRect, cellWidth, cellHeight, sideMargins, item, otherGridItems)
binding.resizeFrame.beVisible()
binding.resizeFrame.z = 1f // make sure the frame isnt behind the widget itself
binding.resizeFrame.onClickListener = {
hideResizeLines()
}
resize_frame.onResizeListener = { cellsRect ->
binding.resizeFrame.onResizeListener = { cellsRect ->
item.left = cellsRect.left
item.top = cellsRect.top
item.right = cellsRect.right
@ -341,7 +349,7 @@ class HomeScreenGrid(context: Context, attrs: AttributeSet, defStyle: Int) : Rel
widgetView.ignoreTouches = true
widgetView.setOnTouchListener { v, event ->
resize_frame.onTouchEvent(event)
binding.resizeFrame.onTouchEvent(event)
return@setOnTouchListener true
}
}
@ -352,7 +360,7 @@ class HomeScreenGrid(context: Context, attrs: AttributeSet, defStyle: Int) : Rel
return
}
resize_frame.beGone()
binding.resizeFrame.beGone()
widgetViews.firstOrNull { it.tag == resizedWidget!!.widgetId }?.apply {
ignoreTouches = false
setOnTouchListener(null)
@ -454,7 +462,7 @@ class HomeScreenGrid(context: Context, attrs: AttributeSet, defStyle: Int) : Rel
val parentItem = potentialParent!!.copy(
type = ITEM_TYPE_FOLDER,
id = null,
title = resources.getString(R.string.folder)
title = resources.getString(com.simplemobiletools.commons.R.string.folder)
)
ensureBackgroundThread {
val newId = context.homeScreenGridItemsDB.insert(parentItem)
@ -795,7 +803,7 @@ class HomeScreenGrid(context: Context, attrs: AttributeSet, defStyle: Int) : Rel
val drawableX = cellXCoords[item.left] + iconMargin + extraXMargin + sideMargins.left + (width * xFactor).toInt()
val drawable = if (item.type == ITEM_TYPE_FOLDER) {
resources.getColoredDrawableWithColor(R.drawable.ic_folder_vector, context.getProperPrimaryColor())
resources.getColoredDrawableWithColor(com.simplemobiletools.commons.R.drawable.ic_folder_vector, context.getProperPrimaryColor())
} else {
item.drawable!!
}

View File

@ -47,10 +47,12 @@ class MyAppWidgetHostView(context: Context) : AppWidgetHostView(context) {
currentCoords.y = event.rawY
actionDownMS = System.currentTimeMillis()
}
MotionEvent.ACTION_MOVE -> {
currentCoords.x = event.rawX
currentCoords.y = event.rawY
}
MotionEvent.ACTION_UP, MotionEvent.ACTION_CANCEL -> {
longPressHandler.removeCallbacksAndMessages(null)
}

View File

@ -48,7 +48,7 @@ class MyAppWidgetResizeFrame(context: Context, attrs: AttributeSet, defStyle: In
resizeWidgetLinePaint = Paint(Paint.ANTI_ALIAS_FLAG).apply {
color = Color.WHITE
strokeWidth = context.resources.getDimension(R.dimen.tiny_margin)
strokeWidth = context.resources.getDimension(com.simplemobiletools.commons.R.dimen.tiny_margin)
style = Paint.Style.STROKE
}
@ -122,6 +122,7 @@ class MyAppWidgetResizeFrame(context: Context, attrs: AttributeSet, defStyle: In
dragDirection = DRAGGING_BOTTOM
}
}
MotionEvent.ACTION_MOVE -> {
val minWidth = minResizeWidthCells * cellWidth
val minHeight = minResizeHeightCells * cellHeight
@ -152,6 +153,7 @@ class MyAppWidgetResizeFrame(context: Context, attrs: AttributeSet, defStyle: In
frameRect.left = wantedLeft
}
DRAGGING_TOP -> {
val newHeight = frameRect.bottom - event.rawY.toInt()
val wantedTop = if (newHeight >= minHeight) {
@ -178,6 +180,7 @@ class MyAppWidgetResizeFrame(context: Context, attrs: AttributeSet, defStyle: In
frameRect.top = wantedTop
}
DRAGGING_RIGHT -> {
val newWidth = event.rawX.toInt() - frameRect.left
val wantedRight = if (newWidth >= minWidth) {
@ -204,6 +207,7 @@ class MyAppWidgetResizeFrame(context: Context, attrs: AttributeSet, defStyle: In
frameRect.right = wantedRight
}
DRAGGING_BOTTOM -> {
val newHeight = event.rawY.toInt() - frameRect.top
val wantedBottom = if (newHeight >= minHeight) {
@ -240,6 +244,7 @@ class MyAppWidgetResizeFrame(context: Context, attrs: AttributeSet, defStyle: In
redrawFrame()
}
}
MotionEvent.ACTION_UP, MotionEvent.ACTION_CANCEL -> {
if (dragDirection == DRAGGING_NONE) {
onClickListener?.invoke()
@ -268,6 +273,7 @@ class MyAppWidgetResizeFrame(context: Context, attrs: AttributeSet, defStyle: In
frameRect.left = cellsRect.left * cellWidth + sideMargins.left
}
}
DRAGGING_TOP -> {
val wantedTop = roundToClosestMultiplyOfNumber(frameRect.top - sideMargins.top, cellHeight)
val wantedTopCellY = wantedTop / cellHeight
@ -288,6 +294,7 @@ class MyAppWidgetResizeFrame(context: Context, attrs: AttributeSet, defStyle: In
frameRect.top = cellsRect.top * cellHeight + sideMargins.top
}
}
DRAGGING_RIGHT -> {
val wantedRight = roundToClosestMultiplyOfNumber(frameRect.right - sideMargins.left, cellWidth)
val wantedRightCellX = wantedRight / cellWidth - 1
@ -308,6 +315,7 @@ class MyAppWidgetResizeFrame(context: Context, attrs: AttributeSet, defStyle: In
frameRect.right = (cellsRect.right + 1) * cellWidth + sideMargins.left
}
}
DRAGGING_BOTTOM -> {
val wantedBottom = roundToClosestMultiplyOfNumber(frameRect.bottom - sideMargins.top, cellHeight)
val wantedBottomCellY = wantedBottom / cellHeight - 1

View File

@ -4,18 +4,9 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.simplemobiletools.launcher.views.HomeScreenGrid
<include
android:id="@+id/home_screen_grid"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.simplemobiletools.launcher.views.MyAppWidgetResizeFrame
android:id="@+id/resize_frame"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone" />
</com.simplemobiletools.launcher.views.HomeScreenGrid>
layout="@layout/home_screen_grid" />
<include
android:id="@+id/all_apps_fragment"

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<com.simplemobiletools.launcher.views.HomeScreenGrid xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/home_screen_grid"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.simplemobiletools.launcher.views.MyAppWidgetResizeFrame
android:id="@+id/resize_frame"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone" />
</com.simplemobiletools.launcher.views.HomeScreenGrid>

View File

@ -19,4 +19,4 @@
Haven't found some strings? There's more at
https://github.com/SimpleMobileTools/Simple-Commons/tree/master/commons/src/main/res
-->
</resources>
</resources>

View File

@ -15,4 +15,4 @@
<string name="close_app_drawer_on_app_open">Tanca el calaix d\'aplicacions en obrir una aplicació</string>
<string name="home_screen_settings">Home screen</string>
<string name="widget_too_big">El giny és massa gros per a la mida de la pantalla d\'inici actual</string>
</resources>
</resources>

View File

@ -15,4 +15,4 @@
<string name="close_app_drawer_on_app_open">App-Schublade beim Öffnen einer App schließen</string>
<string name="home_screen_settings">Startbildschirm</string>
<string name="widget_too_big">Das Widget ist zu groß für den aktuellen Startbildschirm</string>
</resources>
</resources>

View File

@ -12,9 +12,9 @@
<string name="hidden_icons">Κρυφά εικονίδια</string>
<string name="hidden_icons_placeholder">Ορισμένες εφαρμογές δεν μπορούν να απεγκατασταθούν λόγω περιορισμών του συστήματος, αλλά μπορείτε να αποκρύψετε τα εικονίδια τους για να μην φαίνονται.</string>
<string name="app_drawer_settings">Συρτάρι εφαρμογών</string>
<string name="close_app_drawer_on_app_open">Close app drawer on opening an app</string>
<string name="home_screen_settings">Home screen</string>
<string name="widget_too_big">Widget is too big for current home screen size</string>
<string name="close_app_drawer_on_app_open">Κλείστε το συρτάρι εφαρμογών κατά το άνοιγμα μιας εφαρμογής</string>
<string name="home_screen_settings">Αρχική οθόνη</string>
<string name="widget_too_big">Το γραφικό είναι πολύ μεγάλο για το τρέχον μέγεθος της αρχικής οθόνης</string>
<!--
Haven't found some strings? There's more at
https://github.com/SimpleMobileTools/Simple-Commons/tree/master/commons/src/main/res

View File

@ -12,7 +12,7 @@
<string name="hidden_icons">Peidetud ikoonid</string>
<string name="hidden_icons_placeholder">Mõnda rakendust ei saa süsteemipiirangute tõttu eemaldada. Selleks, et neid mitte näha, võid vähemalt nende ikoonid ära peita.</string>
<string name="app_drawer_settings">Rakenduste kaust</string>
<string name="close_app_drawer_on_app_open">Close app drawer on opening an app</string>
<string name="close_app_drawer_on_app_open">Rakenduse avamisel sulge rakenduste kausta vaade</string>
<string name="home_screen_settings">Avaleht</string>
<string name="widget_too_big">Vidin on liiga suur praeguse ekraanimõõdu jaoks</string>
</resources>
</resources>

View File

@ -11,8 +11,8 @@
<string name="manage_hidden_icons">Rejtett ikonok kezelése</string>
<string name="hidden_icons">Rejtett ikonok</string>
<string name="hidden_icons_placeholder">Egyes alkalmazások rendszerkorlátozások miatt nem távolíthatók el, de legalább elrejtheti az ikonjaikat, hogy ne lássa őket.</string>
<string name="app_drawer_settings">App drawer</string>
<string name="close_app_drawer_on_app_open">Close app drawer on opening an app</string>
<string name="app_drawer_settings">Alkalmazásfiók</string>
<string name="close_app_drawer_on_app_open">Alkalmazásfiók bezárása egy alkalmazás megnyitásakor</string>
<string name="home_screen_settings">Home screen</string>
<string name="widget_too_big">Widget is too big for current home screen size</string>
</resources>
<string name="widget_too_big">A modul túl nagy az aktuális kezdőképernyő méretéhez</string>
</resources>

View File

@ -15,4 +15,4 @@
<string name="close_app_drawer_on_app_open">App-overzicht sluiten na het kiezen van een app</string>
<string name="home_screen_settings">Beginscherm</string>
<string name="widget_too_big">Widget is te groot voor de huidige afmetingen van het beginscherm</string>
</resources>
</resources>

View File

@ -15,4 +15,4 @@
<string name="close_app_drawer_on_app_open">Zamykaj szufladę aplikacji przy uruchomieniu aplikacji</string>
<string name="home_screen_settings">Ekran główny</string>
<string name="widget_too_big">Widżet jest za duży dla aktualnego rozmiaru ekranu głównego</string>
</resources>
</resources>

View File

@ -15,4 +15,4 @@
<string name="close_app_drawer_on_app_open">Закрывать боковую панель при открытии приложения</string>
<string name="home_screen_settings">Домашний экран</string>
<string name="widget_too_big">Виджет слишком велик для текущего размера домашнего экрана</string>
</resources>
</resources>

View File

@ -12,7 +12,7 @@
<string name="hidden_icons">Skryté ikonky</string>
<string name="hidden_icons_placeholder">Niektoré apky nemôžu byť odinštalované kvôli systémovým obmedzeniam, viete ich ale aspoň skryť, aby ste ich nevideli.</string>
<string name="app_drawer_settings">Zoznam apiek</string>
<string name="close_app_drawer_on_app_open">Close app drawer on opening an app</string>
<string name="close_app_drawer_on_app_open">Zavrieť zoznam apiek po spustení apky</string>
<string name="home_screen_settings">Domáca obrazovka</string>
<string name="widget_too_big">Widget je príliš veľký pre súčasnú domácu obrazovku</string>
<!--

View File

@ -15,4 +15,4 @@
<string name="close_app_drawer_on_app_open">Bir uygulama açıldığında uygulama çekmecesini kapat</string>
<string name="home_screen_settings">Ana ekran</string>
<string name="widget_too_big">Widget, şu anki ana ekran boyutu için çok büyük</string>
</resources>
</resources>

View File

@ -15,4 +15,4 @@
<string name="close_app_drawer_on_app_open">打开抽屉内应用时关闭抽屉</string>
<string name="home_screen_settings">主屏幕</string>
<string name="widget_too_big">小部件对当前屏幕尺寸而言太大了</string>
</resources>
</resources>

View File

@ -1,30 +0,0 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.7.10'
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.3.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}

5
build.gradle.kts Normal file
View File

@ -0,0 +1,5 @@
plugins {
alias(libs.plugins.android).apply(false)
alias(libs.plugins.kotlinAndroid).apply(false)
alias(libs.plugins.ksp).apply(false)
}

View File

@ -1,2 +1,3 @@
android.enableJetifier=true
android.useAndroidX=true
android.nonTransitiveRClass=true

37
gradle/libs.versions.toml Normal file
View File

@ -0,0 +1,37 @@
[versions]
#jetbrains
kotlin = "1.9.0"
#KSP
ksp = "1.9.0-1.0.12"
#Room
room = "2.6.0-alpha02"
#Simple tools
simple-commons = "c5a32fb1f3"
#Gradle
gradlePlugins-agp = "8.1.0"
#build
app-build-compileSDKVersion = "34"
app-build-targetSDK = "34"
app-build-minimumSDK = "26"
app-build-javaVersion = "VERSION_17"
app-build-kotlinJVMTarget = "17"
#versioning
app-version-appId = "com.simplemobiletools.launcher"
app-version-versionCode = "8"
app-version-versionName = "5.0.6"
[libraries]
#Room
androidx-room-runtime = { module = "androidx.room:room-runtime", version.ref = "room" }
androidx-room-ktx = { module = "androidx.room:room-ktx", version.ref = "room" }
androidx-room-compiler = { module = "androidx.room:room-compiler", version.ref = "room" }
#Simple Mobile Tools
simple-tools-commons = { module = "com.github.SimpleMobileTools:Simple-Commons", version.ref = "simple-commons" }
[bundles]
room = [
"androidx-room-ktx",
"androidx-room-runtime",
]
[plugins]
android = { id = "com.android.application", version.ref = "gradlePlugins-agp" }
kotlinAndroid = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" }

View File

@ -1,6 +1,6 @@
#Mon Aug 01 22:01:46 CEST 2022
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME

View File

@ -1 +0,0 @@
include ':app'

16
settings.gradle.kts Normal file
View File

@ -0,0 +1,16 @@
pluginManagement {
repositories {
gradlePluginPortal()
google()
mavenCentral()
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
maven { setUrl("https://jitpack.io") }
}
}
include(":app")