mirror of
https://github.com/SimpleMobileTools/Simple-App-Launcher.git
synced 2025-06-05 21:49:21 +02:00
updating commons
This commit is contained in:
@ -63,7 +63,7 @@ android {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'com.github.SimpleMobileTools:Simple-Commons:c070dff787'
|
||||
implementation 'com.github.SimpleMobileTools:Simple-Commons:903dad2409'
|
||||
implementation 'androidx.multidex:multidex:2.0.1'
|
||||
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
|
||||
}
|
||||
|
@ -2,8 +2,6 @@ package com.simplemobiletools.applauncher.activities
|
||||
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.view.Menu
|
||||
import android.view.MenuItem
|
||||
import com.simplemobiletools.applauncher.BuildConfig
|
||||
import com.simplemobiletools.applauncher.R
|
||||
import com.simplemobiletools.applauncher.adapters.LaunchersAdapter
|
||||
@ -36,6 +34,9 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_main)
|
||||
setupOptionsMenu()
|
||||
refreshMenuItems()
|
||||
|
||||
appLaunched(BuildConfig.APPLICATION_ID)
|
||||
setupEmptyView()
|
||||
setupLaunchers()
|
||||
@ -50,6 +51,7 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
setupToolbar(main_toolbar)
|
||||
if (mStoredTextColor != getProperTextColor()) {
|
||||
getGridAdapter()?.updateTextColor(getProperTextColor())
|
||||
}
|
||||
@ -72,33 +74,49 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
|
||||
storeStateVariables()
|
||||
}
|
||||
|
||||
override fun onCreateOptionsMenu(menu: Menu): Boolean {
|
||||
menuInflater.inflate(R.menu.menu, menu)
|
||||
private fun refreshMenuItems() {
|
||||
val currentColumnCount = if (portrait) {
|
||||
config.portraitColumnCnt
|
||||
} else {
|
||||
config.landscapeColumnCnt
|
||||
}
|
||||
|
||||
menu.apply {
|
||||
main_toolbar.menu.apply {
|
||||
findItem(R.id.increase_column_count).isVisible = currentColumnCount < MAX_COLUMN_COUNT
|
||||
findItem(R.id.reduce_column_count).isVisible = currentColumnCount > 1
|
||||
updateMenuItemColors(menu)
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||
when (item.itemId) {
|
||||
R.id.sort -> showSortingDialog()
|
||||
R.id.toggle_app_name -> toggleAppName()
|
||||
R.id.increase_column_count -> increaseColumnCount()
|
||||
R.id.reduce_column_count -> reduceColumnCount()
|
||||
R.id.settings -> launchSettings()
|
||||
R.id.about -> launchAbout()
|
||||
else -> return super.onOptionsItemSelected(item)
|
||||
private fun setupOptionsMenu() {
|
||||
main_toolbar.setOnMenuItemClickListener { menuItem ->
|
||||
when (menuItem.itemId) {
|
||||
R.id.sort -> {
|
||||
showSortingDialog()
|
||||
true
|
||||
}
|
||||
R.id.toggle_app_name -> {
|
||||
toggleAppName()
|
||||
true
|
||||
}
|
||||
R.id.increase_column_count -> {
|
||||
increaseColumnCount()
|
||||
true
|
||||
}
|
||||
R.id.reduce_column_count -> {
|
||||
reduceColumnCount()
|
||||
true
|
||||
}
|
||||
R.id.settings -> {
|
||||
launchSettings()
|
||||
true
|
||||
}
|
||||
R.id.about -> {
|
||||
launchAbout()
|
||||
true
|
||||
}
|
||||
else -> false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
private fun launchSettings() {
|
||||
@ -199,7 +217,7 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
|
||||
}
|
||||
|
||||
private fun columnCountChanged() {
|
||||
invalidateOptionsMenu()
|
||||
refreshMenuItems()
|
||||
getGridAdapter()?.apply {
|
||||
calculateIconWidth()
|
||||
notifyItemRangeChanged(0, launchers.size)
|
||||
|
@ -1,10 +1,10 @@
|
||||
package com.simplemobiletools.applauncher.activities
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.Menu
|
||||
import com.simplemobiletools.applauncher.R
|
||||
import com.simplemobiletools.applauncher.extensions.config
|
||||
import com.simplemobiletools.commons.extensions.*
|
||||
import com.simplemobiletools.commons.helpers.NavigationIcon
|
||||
import kotlinx.android.synthetic.main.activity_settings.*
|
||||
import java.util.*
|
||||
|
||||
@ -17,6 +17,7 @@ class SettingsActivity : SimpleActivity() {
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
setupToolbar(settings_toolbar, NavigationIcon.Arrow)
|
||||
|
||||
setupPurchaseThankYou()
|
||||
setupCustomizeColors()
|
||||
@ -33,11 +34,6 @@ class SettingsActivity : SimpleActivity() {
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCreateOptionsMenu(menu: Menu): Boolean {
|
||||
updateMenuItemColors(menu)
|
||||
return super.onCreateOptionsMenu(menu)
|
||||
}
|
||||
|
||||
private fun setupPurchaseThankYou() {
|
||||
settings_purchase_thank_you_holder.beGoneIf(isOrWasThankYouInstalled())
|
||||
|
||||
|
@ -1,33 +1,28 @@
|
||||
package com.simplemobiletools.applauncher.dialogs
|
||||
|
||||
import android.app.Activity
|
||||
import android.app.AlertDialog
|
||||
import android.view.ViewGroup
|
||||
import androidx.appcompat.widget.AppCompatEditText
|
||||
import com.simplemobiletools.applauncher.R
|
||||
import com.simplemobiletools.applauncher.extensions.dbHelper
|
||||
import com.simplemobiletools.applauncher.models.AppLauncher
|
||||
import com.simplemobiletools.commons.extensions.*
|
||||
import kotlinx.android.synthetic.main.dialog_edit_launcher.view.*
|
||||
|
||||
class EditDialog(val activity: Activity, val appLauncher: AppLauncher, val callback: () -> Unit) {
|
||||
|
||||
init {
|
||||
val layoutId = if (activity.baseConfig.isUsingSystemTheme) {
|
||||
R.layout.dialog_edit_launcher_material
|
||||
} else {
|
||||
R.layout.dialog_edit_launcher
|
||||
}
|
||||
|
||||
val view = (activity.layoutInflater.inflate(layoutId, null) as ViewGroup)
|
||||
view.findViewById<AppCompatEditText>(R.id.edit_launcher_edittext).setText(appLauncher.title)
|
||||
val view = (activity.layoutInflater.inflate(R.layout.dialog_edit_launcher, null) as ViewGroup)
|
||||
view.edit_launcher_edittext.setText(appLauncher.title)
|
||||
|
||||
activity.getAlertDialogBuilder()
|
||||
.setPositiveButton(R.string.ok, null)
|
||||
.setNegativeButton(R.string.cancel, null)
|
||||
.apply {
|
||||
activity.setupDialogStuff(view, this, R.string.rename) { alertDialog ->
|
||||
alertDialog.showKeyboard(view.findViewById(R.id.edit_launcher_edittext))
|
||||
alertDialog.getButton(android.app.AlertDialog.BUTTON_POSITIVE).setOnClickListener {
|
||||
val newName = view.findViewById<AppCompatEditText>(R.id.edit_launcher_edittext).value
|
||||
alertDialog.showKeyboard(view.edit_launcher_edittext)
|
||||
alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener {
|
||||
val newName = view.edit_launcher_edittext.value
|
||||
if (!newName.isEmpty()) {
|
||||
if (activity.dbHelper.updateLauncherName(appLauncher.id, newName)) {
|
||||
callback()
|
||||
|
@ -2,6 +2,35 @@
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/main_coordinator"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:id="@+id/main_app_bar_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<com.google.android.material.appbar.MaterialToolbar
|
||||
android:id="@+id/main_toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
android:background="@color/color_primary"
|
||||
app:menu="@menu/menu"
|
||||
app:title="@string/app_launcher_name"
|
||||
app:titleTextAppearance="@style/AppTheme.ActionBar.TitleTextStyle" />
|
||||
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
android:id="@+id/main_nested_scrollview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fillViewport="true"
|
||||
android:scrollbars="none"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior">
|
||||
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||
android:id="@+id/coordinator_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
@ -65,4 +94,6 @@
|
||||
android:layout_margin="@dimen/activity_margin"
|
||||
android:src="@drawable/ic_plus_vector" />
|
||||
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
|
@ -1,9 +1,33 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/settings_scrollview"
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/settings_coordinator"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:id="@+id/settings_app_bar_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<com.google.android.material.appbar.MaterialToolbar
|
||||
android:id="@+id/settings_toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
android:background="@color/color_primary"
|
||||
app:title="@string/settings"
|
||||
app:titleTextAppearance="@style/AppTheme.ActionBar.TitleTextStyle" />
|
||||
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
android:id="@+id/settings_nested_scrollview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fillViewport="true"
|
||||
android:scrollbars="none"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/settings_holder"
|
||||
android:layout_width="match_parent"
|
||||
@ -106,4 +130,5 @@
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
|
@ -5,12 +5,18 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="@dimen/activity_margin">
|
||||
|
||||
<com.simplemobiletools.commons.views.MyEditText
|
||||
<com.simplemobiletools.commons.views.MyTextInputLayout
|
||||
android:id="@+id/edit_launcher_hint"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/label">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/edit_launcher_edittext"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="textCapWords"
|
||||
android:textCursorDrawable="@null"
|
||||
android:textSize="@dimen/normal_text_size" />
|
||||
android:textSize="@dimen/bigger_text_size" />
|
||||
|
||||
</com.simplemobiletools.commons.views.MyTextInputLayout>
|
||||
</FrameLayout>
|
||||
|
@ -1,22 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/edit_launcher_holder"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="@dimen/activity_margin">
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/edit_launcher_hint"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/label">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/edit_launcher_edittext"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="textCapWords"
|
||||
android:textSize="@dimen/bigger_text_size" />
|
||||
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
</FrameLayout>
|
Reference in New Issue
Block a user