mirror of
https://gitlab.futo.org/videostreaming/grayjay.git
synced 2025-04-20 03:24:50 +00:00
Dialog improvement, prep dialog
This commit is contained in:
parent
fe97850835
commit
6a43568369
3 changed files with 24 additions and 4 deletions
|
@ -485,12 +485,15 @@ class Settings : FragmentedStorageFileJson() {
|
|||
var comments = CommentSettings();
|
||||
@Serializable
|
||||
class CommentSettings {
|
||||
var didAskPolycentricDefault: Boolean = false;
|
||||
|
||||
@FormField(R.string.default_comment_section, FieldForm.DROPDOWN, -1, 0)
|
||||
@DropdownFieldOptionsId(R.array.comment_sections)
|
||||
var defaultCommentSection: Int = 1;
|
||||
|
||||
@FormField(R.string.bad_reputation_comments_fading, FieldForm.TOGGLE, R.string.bad_reputation_comments_fading_description, 0)
|
||||
var badReputationCommentsFading: Boolean = true;
|
||||
|
||||
}
|
||||
|
||||
@FormField(R.string.downloads, "group", R.string.configure_downloading_of_videos, 7)
|
||||
|
|
|
@ -229,14 +229,15 @@ class UIDialogs {
|
|||
}
|
||||
};
|
||||
view.findViewById<LinearLayout>(R.id.dialog_buttons).apply {
|
||||
val center = actions.any { it?.center == true };
|
||||
val buttons = actions.map<Action, TextView> { act ->
|
||||
val buttonView = TextView(context);
|
||||
val dp10 = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 10f, resources.displayMetrics).toInt();
|
||||
val dp28 = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 28f, resources.displayMetrics).toInt();
|
||||
val dp14 = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 14.0f, resources.displayMetrics).toInt();
|
||||
buttonView.layoutParams = LinearLayout.LayoutParams(WRAP_CONTENT, WRAP_CONTENT).apply {
|
||||
if(actions.size > 1)
|
||||
this.marginEnd = if(actions.size > 2) dp14 else dp28;
|
||||
this.marginStart = if(actions.size >= 2) dp14 / 2 else dp28 / 2;
|
||||
this.marginEnd = if(actions.size >= 2) dp14 / 2 else dp28 / 2;
|
||||
};
|
||||
buttonView.setTextColor(Color.WHITE);
|
||||
buttonView.textSize = 14f;
|
||||
|
@ -258,7 +259,7 @@ class UIDialogs {
|
|||
|
||||
return@map buttonView;
|
||||
};
|
||||
if(actions.size <= 1)
|
||||
if(actions.size <= 1 || center)
|
||||
this.gravity = Gravity.CENTER;
|
||||
else
|
||||
this.gravity = Gravity.END;
|
||||
|
@ -509,11 +510,13 @@ class UIDialogs {
|
|||
val text: String;
|
||||
val action: ()->Unit;
|
||||
val style: ActionStyle;
|
||||
var center: Boolean;
|
||||
|
||||
constructor(text: String, action: ()->Unit, style: ActionStyle = ActionStyle.NONE) {
|
||||
constructor(text: String, action: ()->Unit, style: ActionStyle = ActionStyle.NONE, center: Boolean = false) {
|
||||
this.text = text;
|
||||
this.action = action;
|
||||
this.style = style;
|
||||
this.center = center;
|
||||
}
|
||||
}
|
||||
enum class ActionStyle {
|
||||
|
|
|
@ -612,6 +612,20 @@ class StateApp {
|
|||
Settings.instance.didFirstStart = true;
|
||||
Settings.instance.save();
|
||||
}
|
||||
/*
|
||||
if(!Settings.instance.comments.didAskPolycentricDefault) {
|
||||
UIDialogs.showDialog(context, R.drawable.neopass, "Default Comment Section", "Grayjay supports 2 comment sections, the Platform comments and Polycentric comments. You can easily toggle between them, but which would you like to be selected by default? This choice can be changed in settings.\n\nPolycentric is still under active development.", null, 1,
|
||||
UIDialogs.Action("Polycentric", {
|
||||
Settings.instance.comments.didAskPolycentricDefault = true;
|
||||
Settings.instance.comments.defaultCommentSection = 0;
|
||||
Settings.instance.save();
|
||||
}, UIDialogs.ActionStyle.PRIMARY, true),
|
||||
UIDialogs.Action("Platform", {
|
||||
Settings.instance.comments.didAskPolycentricDefault = true;
|
||||
Settings.instance.comments.defaultCommentSection = 1;
|
||||
Settings.instance.save();
|
||||
}, UIDialogs.ActionStyle.PRIMARY, true))
|
||||
}*/
|
||||
if(Settings.instance.backup.shouldAutomaticBackup()) {
|
||||
try {
|
||||
StateBackup.startAutomaticBackup();
|
||||
|
|
Loading…
Add table
Reference in a new issue