mirror of
				https://github.com/SimpleMobileTools/Simple-App-Launcher.git
				synced 2025-06-05 21:49:21 +02:00 
			
		
		
		
	updating Commons with the new dialogs
This commit is contained in:
		| @@ -63,7 +63,7 @@ android { | |||||||
| } | } | ||||||
|  |  | ||||||
| dependencies { | dependencies { | ||||||
|     implementation 'com.github.SimpleMobileTools:Simple-Commons:4b8a3568df' |     implementation 'com.github.SimpleMobileTools:Simple-Commons:c070dff787' | ||||||
|     implementation 'androidx.multidex:multidex:2.0.1' |     implementation 'androidx.multidex:multidex:2.0.1' | ||||||
|     implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0' |     implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0' | ||||||
| } | } | ||||||
|   | |||||||
| @@ -2,12 +2,12 @@ package com.simplemobiletools.applauncher.dialogs | |||||||
|  |  | ||||||
| import android.app.Activity | import android.app.Activity | ||||||
| import android.view.ViewGroup | import android.view.ViewGroup | ||||||
| import androidx.appcompat.app.AlertDialog |  | ||||||
| import com.simplemobiletools.applauncher.R | import com.simplemobiletools.applauncher.R | ||||||
| import com.simplemobiletools.applauncher.adapters.AddLaunchersAdapter | import com.simplemobiletools.applauncher.adapters.AddLaunchersAdapter | ||||||
| import com.simplemobiletools.applauncher.extensions.dbHelper | import com.simplemobiletools.applauncher.extensions.dbHelper | ||||||
| import com.simplemobiletools.applauncher.models.AppLauncher | import com.simplemobiletools.applauncher.models.AppLauncher | ||||||
| import com.simplemobiletools.commons.extensions.areSystemAnimationsEnabled | import com.simplemobiletools.commons.extensions.areSystemAnimationsEnabled | ||||||
|  | import com.simplemobiletools.commons.extensions.getAlertDialogBuilder | ||||||
| import com.simplemobiletools.commons.extensions.setupDialogStuff | import com.simplemobiletools.commons.extensions.setupDialogStuff | ||||||
| import kotlinx.android.synthetic.main.dialog_add_launchers.view.* | import kotlinx.android.synthetic.main.dialog_add_launchers.view.* | ||||||
|  |  | ||||||
| @@ -21,10 +21,10 @@ class AddLaunchersDialog( | |||||||
|     private var adapter: AddLaunchersAdapter? = null |     private var adapter: AddLaunchersAdapter? = null | ||||||
|  |  | ||||||
|     init { |     init { | ||||||
|         AlertDialog.Builder(activity) |         activity.getAlertDialogBuilder() | ||||||
|             .setPositiveButton(R.string.ok) { dialogInterface, i -> confirmSelection() } |             .setPositiveButton(R.string.ok) { dialogInterface, i -> confirmSelection() } | ||||||
|             .setNegativeButton(R.string.cancel, null) |             .setNegativeButton(R.string.cancel, null) | ||||||
|             .create().apply { |             .apply { | ||||||
|                 activity.setupDialogStuff(view, this) { |                 activity.setupDialogStuff(view, this) { | ||||||
|                     adapter = AddLaunchersAdapter(activity, allLaunchers, shownLaunchers) |                     adapter = AddLaunchersAdapter(activity, allLaunchers, shownLaunchers) | ||||||
|                     view.add_launchers_holder.adapter = adapter |                     view.add_launchers_holder.adapter = adapter | ||||||
|   | |||||||
| @@ -1,10 +1,10 @@ | |||||||
| package com.simplemobiletools.applauncher.dialogs | package com.simplemobiletools.applauncher.dialogs | ||||||
|  |  | ||||||
| import androidx.appcompat.app.AlertDialog |  | ||||||
| import com.simplemobiletools.applauncher.R | import com.simplemobiletools.applauncher.R | ||||||
| import com.simplemobiletools.applauncher.extensions.config | import com.simplemobiletools.applauncher.extensions.config | ||||||
| import com.simplemobiletools.commons.activities.BaseSimpleActivity | import com.simplemobiletools.commons.activities.BaseSimpleActivity | ||||||
| import com.simplemobiletools.commons.extensions.beGoneIf | import com.simplemobiletools.commons.extensions.beGoneIf | ||||||
|  | import com.simplemobiletools.commons.extensions.getAlertDialogBuilder | ||||||
| import com.simplemobiletools.commons.extensions.setupDialogStuff | import com.simplemobiletools.commons.extensions.setupDialogStuff | ||||||
| import com.simplemobiletools.commons.helpers.SORT_BY_CUSTOM | import com.simplemobiletools.commons.helpers.SORT_BY_CUSTOM | ||||||
| import com.simplemobiletools.commons.helpers.SORT_BY_TITLE | import com.simplemobiletools.commons.helpers.SORT_BY_TITLE | ||||||
| @@ -17,10 +17,10 @@ class ChangeSortingDialog(val activity: BaseSimpleActivity, private val callback | |||||||
|     private var view = activity.layoutInflater.inflate(R.layout.dialog_change_sorting, null) |     private var view = activity.layoutInflater.inflate(R.layout.dialog_change_sorting, null) | ||||||
|  |  | ||||||
|     init { |     init { | ||||||
|         AlertDialog.Builder(activity) |         activity.getAlertDialogBuilder() | ||||||
|             .setPositiveButton(R.string.ok) { dialog, which -> dialogConfirmed() } |             .setPositiveButton(R.string.ok) { dialog, which -> dialogConfirmed() } | ||||||
|             .setNegativeButton(R.string.cancel, null) |             .setNegativeButton(R.string.cancel, null) | ||||||
|             .create().apply { |             .apply { | ||||||
|                 activity.setupDialogStuff(view, this, R.string.sort_by) |                 activity.setupDialogStuff(view, this, R.string.sort_by) | ||||||
|             } |             } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -2,35 +2,30 @@ package com.simplemobiletools.applauncher.dialogs | |||||||
|  |  | ||||||
| import android.app.Activity | import android.app.Activity | ||||||
| import android.view.ViewGroup | import android.view.ViewGroup | ||||||
| import androidx.appcompat.app.AlertDialog |  | ||||||
| import com.simplemobiletools.applauncher.R | import com.simplemobiletools.applauncher.R | ||||||
| import com.simplemobiletools.applauncher.extensions.dbHelper | import com.simplemobiletools.applauncher.extensions.dbHelper | ||||||
| import com.simplemobiletools.applauncher.models.AppLauncher | import com.simplemobiletools.applauncher.models.AppLauncher | ||||||
| import com.simplemobiletools.commons.extensions.setupDialogStuff | import com.simplemobiletools.commons.extensions.* | ||||||
| import com.simplemobiletools.commons.extensions.showKeyboard |  | ||||||
| import com.simplemobiletools.commons.extensions.toast |  | ||||||
| import com.simplemobiletools.commons.extensions.value |  | ||||||
| import kotlinx.android.synthetic.main.dialog_edit_launcher.view.* | import kotlinx.android.synthetic.main.dialog_edit_launcher.view.* | ||||||
|  |  | ||||||
| class EditDialog(val activity: Activity, val appLauncher: AppLauncher, val callback: () -> Unit) { | class EditDialog(val activity: Activity, val appLauncher: AppLauncher, val callback: () -> Unit) { | ||||||
|     var dialog: AlertDialog |     private var view = (activity.layoutInflater.inflate(R.layout.dialog_edit_launcher, null) as ViewGroup) | ||||||
|     var view = (activity.layoutInflater.inflate(R.layout.dialog_edit_launcher, null) as ViewGroup) |  | ||||||
|  |  | ||||||
|     init { |     init { | ||||||
|         view.edit_launcher_edittext.setText(appLauncher.title) |         view.edit_launcher_edittext.setText(appLauncher.title) | ||||||
|  |  | ||||||
|         dialog = AlertDialog.Builder(activity) |         activity.getAlertDialogBuilder() | ||||||
|             .setPositiveButton(R.string.ok, null) |             .setPositiveButton(R.string.ok, null) | ||||||
|             .setNegativeButton(R.string.cancel, null) |             .setNegativeButton(R.string.cancel, null) | ||||||
|                 .create().apply { |             .apply { | ||||||
|                     activity.setupDialogStuff(view, this, R.string.rename) { |                 activity.setupDialogStuff(view, this, R.string.rename) { alertDialog -> | ||||||
|                         showKeyboard(view.edit_launcher_edittext) |                     alertDialog.showKeyboard(view.edit_launcher_edittext) | ||||||
|                         getButton(android.app.AlertDialog.BUTTON_POSITIVE).setOnClickListener { |                     alertDialog.getButton(android.app.AlertDialog.BUTTON_POSITIVE).setOnClickListener { | ||||||
|                         val newName = view.edit_launcher_edittext.value |                         val newName = view.edit_launcher_edittext.value | ||||||
|                         if (!newName.isEmpty()) { |                         if (!newName.isEmpty()) { | ||||||
|                             if (activity.dbHelper.updateLauncherName(appLauncher.id, newName)) { |                             if (activity.dbHelper.updateLauncherName(appLauncher.id, newName)) { | ||||||
|                                 callback() |                                 callback() | ||||||
|                                     dismiss() |                                 alertDialog.dismiss() | ||||||
|                             } else { |                             } else { | ||||||
|                                 activity.toast(R.string.unknown_error_occurred) |                                 activity.toast(R.string.unknown_error_occurred) | ||||||
|                             } |                             } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user