mirror of
				https://github.com/SimpleMobileTools/Simple-App-Launcher.git
				synced 2025-06-05 21:49:21 +02:00 
			
		
		
		
	allow toggling app name labels
This commit is contained in:
		| @@ -22,7 +22,6 @@ import com.simplemobiletools.commons.models.Release | |||||||
| import com.simplemobiletools.commons.views.MyGridLayoutManager | import com.simplemobiletools.commons.views.MyGridLayoutManager | ||||||
| import com.simplemobiletools.commons.views.MyRecyclerView | import com.simplemobiletools.commons.views.MyRecyclerView | ||||||
| import kotlinx.android.synthetic.main.activity_main.* | import kotlinx.android.synthetic.main.activity_main.* | ||||||
| import java.util.* |  | ||||||
|  |  | ||||||
| class MainActivity : SimpleActivity(), RefreshRecyclerViewListener { | class MainActivity : SimpleActivity(), RefreshRecyclerViewListener { | ||||||
|     private val MAX_COLUMN_COUNT = 20 |     private val MAX_COLUMN_COUNT = 20 | ||||||
| @@ -94,6 +93,7 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener { | |||||||
|     override fun onOptionsItemSelected(item: MenuItem): Boolean { |     override fun onOptionsItemSelected(item: MenuItem): Boolean { | ||||||
|         when (item.itemId) { |         when (item.itemId) { | ||||||
|             R.id.sort -> showSortingDialog() |             R.id.sort -> showSortingDialog() | ||||||
|  |             R.id.toggle_app_name -> toggleAppName() | ||||||
|             R.id.increase_column_count -> increaseColumnCount() |             R.id.increase_column_count -> increaseColumnCount() | ||||||
|             R.id.reduce_column_count -> reduceColumnCount() |             R.id.reduce_column_count -> reduceColumnCount() | ||||||
|             R.id.settings -> launchSettings() |             R.id.settings -> launchSettings() | ||||||
| @@ -167,6 +167,11 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener { | |||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     private fun toggleAppName() { | ||||||
|  |         config.showAppName = !config.showAppName | ||||||
|  |         launchers_grid.adapter?.notifyDataSetChanged() | ||||||
|  |     } | ||||||
|  |  | ||||||
|     private fun increaseColumnCount() { |     private fun increaseColumnCount() { | ||||||
|         val newColumnCount = ++(launchers_grid.layoutManager as MyGridLayoutManager).spanCount |         val newColumnCount = ++(launchers_grid.layoutManager as MyGridLayoutManager).spanCount | ||||||
|         if (portrait) { |         if (portrait) { | ||||||
|   | |||||||
| @@ -4,6 +4,7 @@ import android.view.Menu | |||||||
| import android.view.MotionEvent | import android.view.MotionEvent | ||||||
| import android.view.View | import android.view.View | ||||||
| import android.view.ViewGroup | import android.view.ViewGroup | ||||||
|  | import androidx.core.view.isVisible | ||||||
| import androidx.recyclerview.widget.ItemTouchHelper | import androidx.recyclerview.widget.ItemTouchHelper | ||||||
| import androidx.recyclerview.widget.RecyclerView | import androidx.recyclerview.widget.RecyclerView | ||||||
| import com.qtalk.recyclerviewfastscroller.RecyclerViewFastScroller | import com.qtalk.recyclerviewfastscroller.RecyclerViewFastScroller | ||||||
| @@ -25,7 +26,6 @@ import com.simplemobiletools.commons.interfaces.StartReorderDragListener | |||||||
| import com.simplemobiletools.commons.views.MyRecyclerView | import com.simplemobiletools.commons.views.MyRecyclerView | ||||||
| import kotlinx.android.synthetic.main.item_launcher.view.* | import kotlinx.android.synthetic.main.item_launcher.view.* | ||||||
| import java.util.* | import java.util.* | ||||||
| import kotlin.collections.ArrayList |  | ||||||
|  |  | ||||||
| class LaunchersAdapter( | class LaunchersAdapter( | ||||||
|     activity: SimpleActivity, val launchers: ArrayList<AppLauncher>, val listener: RefreshRecyclerViewListener?, |     activity: SimpleActivity, val launchers: ArrayList<AppLauncher>, val listener: RefreshRecyclerViewListener?, | ||||||
| @@ -193,6 +193,8 @@ class LaunchersAdapter( | |||||||
|             if (isSelected) { |             if (isSelected) { | ||||||
|                 launcher_check?.background?.applyColorFilter(adjustedPrimaryColor) |                 launcher_check?.background?.applyColorFilter(adjustedPrimaryColor) | ||||||
|             } |             } | ||||||
|  |  | ||||||
|  |             launcher_label.isVisible = activity.config.showAppName | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -24,4 +24,8 @@ class Config(context: Context) : BaseConfig(context) { | |||||||
|     var landscapeColumnCnt: Int |     var landscapeColumnCnt: Int | ||||||
|         get() = prefs.getInt(LANDSCAPE_COLUMN_COUNT, context.resources.getInteger(R.integer.landscape_column_count)) |         get() = prefs.getInt(LANDSCAPE_COLUMN_COUNT, context.resources.getInteger(R.integer.landscape_column_count)) | ||||||
|         set(landscapeColumnCnt) = prefs.edit().putInt(LANDSCAPE_COLUMN_COUNT, landscapeColumnCnt).apply() |         set(landscapeColumnCnt) = prefs.edit().putInt(LANDSCAPE_COLUMN_COUNT, landscapeColumnCnt).apply() | ||||||
|  |  | ||||||
|  |     var showAppName: Boolean | ||||||
|  |         get() = prefs.getBoolean(SHOW_APP_NAME, true) | ||||||
|  |         set(showAppLabel) = prefs.edit().putBoolean(SHOW_APP_NAME, showAppLabel).apply() | ||||||
| } | } | ||||||
|   | |||||||
| @@ -4,6 +4,7 @@ const val WAS_REMOVE_INFO_SHOWN = "was_remove_info_shown" | |||||||
| const val CLOSE_APP = "close_app" | const val CLOSE_APP = "close_app" | ||||||
| const val PORTRAIT_COLUMN_COUNT = "portrait_column_count" | const val PORTRAIT_COLUMN_COUNT = "portrait_column_count" | ||||||
| const val LANDSCAPE_COLUMN_COUNT = "landscape_column_count" | const val LANDSCAPE_COLUMN_COUNT = "landscape_column_count" | ||||||
|  | const val SHOW_APP_NAME = "show_app_name" | ||||||
|  |  | ||||||
| val predefinedPackageNames = arrayListOf( | val predefinedPackageNames = arrayListOf( | ||||||
|     "com.simplemobiletools.calculator", |     "com.simplemobiletools.calculator", | ||||||
|   | |||||||
| @@ -6,6 +6,11 @@ | |||||||
|         android:icon="@drawable/ic_sort_vector" |         android:icon="@drawable/ic_sort_vector" | ||||||
|         android:title="@string/sort_by" |         android:title="@string/sort_by" | ||||||
|         app:showAsAction="ifRoom" /> |         app:showAsAction="ifRoom" /> | ||||||
|  |     <item | ||||||
|  |         android:id="@+id/toggle_app_name" | ||||||
|  |         android:icon="@drawable/ic_label_vector" | ||||||
|  |         android:title="@string/toggle_app_name" | ||||||
|  |         app:showAsAction="ifRoom" /> | ||||||
|     <item |     <item | ||||||
|         android:id="@+id/increase_column_count" |         android:id="@+id/increase_column_count" | ||||||
|         android:title="@string/increase_column_count" |         android:title="@string/increase_column_count" | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user