forked from sduduzog/slim-launcher
-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(apps): Adds option to choose the alignment of apps (#161)
Co-authored-by: Matej Voboril <[email protected]>
- Loading branch information
Showing
8 changed files
with
114 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
app/src/main/java/com/sduduzog/slimlauncher/ui/dialogs/ChooseAlignmentDialog.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package com.sduduzog.slimlauncher.ui.dialogs | ||
|
||
import android.app.AlertDialog | ||
import android.app.Dialog | ||
import android.content.Context.MODE_PRIVATE | ||
import android.content.SharedPreferences | ||
import android.os.Bundle | ||
import androidx.core.content.edit | ||
import androidx.fragment.app.DialogFragment | ||
import com.sduduzog.slimlauncher.R | ||
|
||
class ChooseAlignmentDialog : DialogFragment() { | ||
|
||
private lateinit var settings: SharedPreferences | ||
|
||
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { | ||
val builder = AlertDialog.Builder(requireContext()) | ||
settings = requireContext().getSharedPreferences(getString(R.string.prefs_settings), MODE_PRIVATE) | ||
|
||
val active = settings.getInt(getString(R.string.prefs_settings_alignment), 3) | ||
builder.setTitle(R.string.choose_alignment_dialog_title) | ||
builder.setSingleChoiceItems(R.array.alignment_format_array, active) { dialogInterface, i -> | ||
dialogInterface.dismiss() | ||
settings.edit { | ||
putInt(getString(R.string.prefs_settings_alignment), i) | ||
} | ||
|
||
} | ||
return builder.create() | ||
} | ||
|
||
|
||
companion object { | ||
fun getInstance(): ChooseAlignmentDialog{ | ||
return ChooseAlignmentDialog() | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters