[UI] Migrate MaterialDialogs to material-components.

This commit is contained in:
Kuba Szczodrzyński 2021-03-30 15:26:52 +02:00
parent 4469323fe0
commit 37c0ff2ac7
15 changed files with 414 additions and 319 deletions

View File

@ -134,8 +134,6 @@ dependencies {
// Other dependencies
implementation "cat.ereza:customactivityoncrash:2.3.0"
implementation "com.afollestad.material-dialogs:commons:0.9.6.0"
implementation "com.afollestad.material-dialogs:core:0.9.6.0"
implementation "com.applandeo:material-calendar-view:1.5.0"
implementation "com.daimajia.swipelayout:library:1.2.0@aar"
implementation "com.github.antonKozyriatskyi:CircularProgressIndicator:1.2.2"

View File

@ -0,0 +1,44 @@
/*
* Copyright (c) Kuba Szczodrzyński 2021-3-30.
*/
package pl.szczodrzynski.edziennik.ui.dialogs
import android.text.InputType
import android.view.LayoutInflater
import androidx.core.view.isVisible
import androidx.core.widget.addTextChangedListener
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import com.google.android.material.textfield.TextInputEditText
import pl.szczodrzynski.edziennik.databinding.DialogEditTextBinding
import pl.szczodrzynski.edziennik.isNotNullNorBlank
fun MaterialAlertDialogBuilder.input(
message: CharSequence? = null,
type: Int = InputType.TYPE_CLASS_TEXT or InputType.TYPE_TEXT_FLAG_MULTI_LINE,
hint: CharSequence? = null,
value: CharSequence? = null,
changeListener: ((editText: TextInputEditText, input: String) -> Boolean)? = null,
positiveButton: Int? = null,
positiveListener: ((editText: TextInputEditText, input: String) -> Boolean)? = null
): MaterialAlertDialogBuilder {
val b = DialogEditTextBinding.inflate(LayoutInflater.from(context), null, false)
b.title.text = message
b.title.isVisible = message.isNotNullNorBlank()
b.text1.hint = hint
b.text1.inputType = type
b.text1.setText(value)
b.text1.addTextChangedListener { text ->
if (changeListener?.invoke(b.text1, text?.toString() ?: "") != false)
b.text1.error = null
}
if (positiveButton != null) {
setPositiveButton(positiveButton) { dialog, _ ->
if (positiveListener?.invoke(b.text1, b.text1.text?.toString() ?: "") != false)
dialog.dismiss()
}
}
setView(b.root)
return this
}

View File

@ -5,12 +5,11 @@
package pl.szczodrzynski.edziennik.ui.dialogs.home
import android.text.InputType
import android.widget.Toast
import androidx.appcompat.app.AlertDialog
import androidx.appcompat.app.AppCompatActivity
import com.afollestad.materialdialogs.MaterialDialog
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import pl.szczodrzynski.edziennik.R
import pl.szczodrzynski.edziennik.data.db.entity.Profile
import pl.szczodrzynski.edziennik.ui.dialogs.input
class StudentNumberDialog(
val activity: AppCompatActivity,
@ -22,25 +21,27 @@ class StudentNumberDialog(
private const val TAG = "StudentNumberDialog"
}
private lateinit var dialog: AlertDialog
init { run {
if (activity.isFinishing)
return@run
onShowListener?.invoke(TAG)
MaterialDialog.Builder(activity)
.title(R.string.card_lucky_number_set_title)
.content(R.string.card_lucky_number_set_text)
.inputType(InputType.TYPE_CLASS_NUMBER)
.input(null, if (profile.studentNumber == -1) "" else profile.studentNumber.toString()) { _: MaterialDialog?, input: CharSequence ->
try {
profile.studentNumber = input.toString().toInt()
} catch (e: Exception) {
Toast.makeText(activity, R.string.incorrect_format, Toast.LENGTH_SHORT).show()
}
MaterialAlertDialogBuilder(activity)
.setTitle(R.string.card_lucky_number_set_title)
.input(
message = activity.getString(R.string.card_lucky_number_set_text),
type = InputType.TYPE_CLASS_NUMBER,
hint = null,
value = if (profile.studentNumber == -1) null else profile.studentNumber.toString(),
positiveButton = R.string.ok,
positiveListener = { _, input ->
profile.studentNumber = input.toIntOrNull() ?: -1
true
}
.dismissListener {
onDismissListener?.invoke(TAG)
}.show()
)
.setNegativeButton(R.string.cancel, null)
.setOnDismissListener {
onDismissListener?.invoke(TAG)
}
.show()
}}
}

View File

@ -14,7 +14,7 @@ import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.afollestad.materialdialogs.MaterialDialog;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import com.mikepenz.iconics.typeface.library.community.material.CommunityMaterial;
import org.greenrobot.eventbus.EventBus;
@ -161,12 +161,12 @@ public class AnnouncementsFragment extends Fragment {
}
private void showAnnouncementDetailsDialog(AnnouncementFull announcement) {
MaterialDialog dialog = new MaterialDialog.Builder(activity)
.title(announcement.getSubject())
.customView(R.layout.dialog_announcement, true)
.positiveText(R.string.ok)
DialogAnnouncementBinding b = DialogAnnouncementBinding.inflate(LayoutInflater.from(activity), null, false);
new MaterialAlertDialogBuilder(activity)
.setTitle(announcement.getSubject())
.setView(b.getRoot())
.setPositiveButton(R.string.ok, null)
.show();
DialogAnnouncementBinding b = DialogAnnouncementBinding.bind(dialog.getCustomView());
b.text.setText(announcement.getTeacherName() +"\n\n"+ (announcement.getStartDate() != null ? announcement.getStartDate().getFormattedString() : "-") + (announcement.getEndDate() != null ? " do " + announcement.getEndDate().getFormattedString() : "")+"\n\n" +announcement.getText());
if (!announcement.getSeen() && app.getProfile().getLoginStoreType() != LOGIN_TYPE_LIBRUS) {
announcement.setSeen(true);

View File

@ -12,7 +12,7 @@ import android.widget.Button
import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity
import cat.ereza.customactivityoncrash.CustomActivityOnCrash
import com.afollestad.materialdialogs.MaterialDialog
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import kotlinx.coroutines.*
import pl.szczodrzynski.edziennik.App
import pl.szczodrzynski.edziennik.BuildConfig
@ -87,15 +87,13 @@ class CrashActivity : AppCompatActivity(), CoroutineScope {
}
val moreInfoButton = findViewById<Button>(R.id.crash_details_btn)
moreInfoButton.setOnClickListener { v: View? ->
MaterialDialog.Builder(this@CrashActivity)
.title(R.string.crash_details)
.content(Html.fromHtml(getErrorString(intent, false)))
.typeface(null, "RobotoMono-Regular.ttf")
.positiveText(R.string.close)
.neutralText(R.string.copy_to_clipboard)
.onNeutral { _, _ -> copyErrorToClipboard() }
.show()
moreInfoButton.setOnClickListener {
MaterialAlertDialogBuilder(this, R.style.AppTheme_MaterialAlertDialogMonospace)
.setTitle(R.string.crash_details)
.setMessage(Html.fromHtml(getErrorString(intent, false)))
.setPositiveButton(R.string.close, null)
.setNeutralButton(R.string.copy_to_clipboard) { _, _ -> copyErrorToClipboard() }
.show()
}
val errorInformation = CustomActivityOnCrash.getAllErrorDetailsFromIntent(this@CrashActivity, intent)

View File

@ -14,7 +14,7 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import com.afollestad.materialdialogs.MaterialDialog;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import com.google.android.material.textfield.TextInputEditText;
import com.google.gson.Gson;
import com.yuyh.jsonviewer.library.JsonRecyclerView;
@ -211,10 +211,10 @@ public class DebugFragment extends Fragment {
mRecyclerView.bindJson(result);
}
catch (Exception e) {
new MaterialDialog.Builder(getActivity())
.title("Result")
.content(result)
.positiveText(R.string.ok)
new MaterialAlertDialogBuilder(getActivity(), R.style.AppTheme_MaterialAlertDialogMonospace)
.setTitle("Result")
.setMessage(result)
.setPositiveButton(R.string.ok, null)
.show();
}
mRecyclerView.setTextSize(20);

View File

@ -10,7 +10,7 @@ import android.view.View
import android.view.ViewGroup
import androidx.core.view.isVisible
import androidx.recyclerview.widget.LinearLayoutManager
import com.afollestad.materialdialogs.MaterialDialog
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import com.google.gson.*
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
@ -18,6 +18,7 @@ import kotlinx.coroutines.Job
import pl.szczodrzynski.edziennik.*
import pl.szczodrzynski.edziennik.data.api.models.ApiError
import pl.szczodrzynski.edziennik.databinding.TemplateListPageFragmentBinding
import pl.szczodrzynski.edziennik.ui.dialogs.input
import pl.szczodrzynski.edziennik.ui.modules.base.lazypager.LazyFragment
import pl.szczodrzynski.edziennik.utils.SimpleDividerItemDecoration
import kotlin.coroutines.CoroutineContext
@ -87,51 +88,55 @@ class LabProfileFragment : LazyFragment(), CoroutineScope {
else -> objVal.toString()
}
MaterialDialog.Builder(activity)
.input("value", value, false) { _, input ->
val input = input.toString()
when (parent) {
is JsonObject -> {
val v = objVal as JsonPrimitive
when {
v.isString -> (parent as JsonObject)[objName] = input
v.isNumber -> (parent as JsonObject)[objName] = input.toLong()
v.isBoolean -> (parent as JsonObject)[objName] = input.toBoolean()
MaterialAlertDialogBuilder(activity)
.setTitle(item.key)
.input(
hint = "value",
value = value,
positiveButton = R.string.ok,
positiveListener = { _, input ->
when (parent) {
is JsonObject -> {
val v = objVal as JsonPrimitive
when {
v.isString -> (parent as JsonObject)[objName] = input
v.isNumber -> (parent as JsonObject)[objName] = input.toLong()
v.isBoolean -> (parent as JsonObject)[objName] = input.toBoolean()
}
}
is JsonArray -> {
}
is HashMap<*, *> -> app.config.set(objName, input)
else -> {
val field = parent::class.java.getDeclaredField(objName)
field.isAccessible = true
val newVal = when (objVal) {
is Int -> input.toInt()
is Boolean -> input.toBoolean()
is Float -> input.toFloat()
is Char -> input.toCharArray()[0]
is String -> input
is Long -> input.toLong()
is Double -> input.toDouble()
else -> input
}
field.set(parent, newVal)
}
}
is JsonArray -> {
when (item.key.substringBefore(":")) {
"App.profile" -> app.profileSave()
"App.profile.studentData" -> app.profileSave()
"App.profile.loginStore" -> app.db.loginStoreDao().add(loginStore)
}
is HashMap<*, *> -> app.config.set(objName, input)
else -> {
val field = parent::class.java.getDeclaredField(objName)
field.isAccessible = true
val newVal = when (objVal) {
is Int -> input.toInt()
is Boolean -> input.toBoolean()
is Float -> input.toFloat()
is Char -> input.toCharArray()[0]
is String -> input
is Long -> input.toLong()
is Double -> input.toDouble()
else -> input
}
field.set(parent, newVal)
}
showJson()
return@input true
}
when (item.key.substringBefore(":")) {
"App.profile" -> app.profileSave()
"App.profile.studentData" -> app.profileSave()
"App.profile.loginStore" -> app.db.loginStoreDao().add(loginStore)
}
showJson()
}
.title(item.key)
.positiveText(R.string.ok)
.negativeText(R.string.cancel)
)
.setNegativeButton(R.string.cancel, null)
.show()
}
catch (e: Exception) {

View File

@ -11,10 +11,11 @@ import androidx.appcompat.widget.PopupMenu
import androidx.fragment.app.Fragment
import androidx.lifecycle.Observer
import androidx.recyclerview.widget.LinearLayoutManager
import com.afollestad.materialdialogs.MaterialDialog
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import pl.szczodrzynski.edziennik.*
import pl.szczodrzynski.edziennik.data.db.entity.Grade
import pl.szczodrzynski.edziennik.databinding.FragmentGradesEditorBinding
import pl.szczodrzynski.edziennik.ui.dialogs.input
import pl.szczodrzynski.edziennik.utils.Colors
import pl.szczodrzynski.edziennik.utils.managers.GradesManager.Companion.YEAR_1_AVG_2_AVG
import pl.szczodrzynski.edziennik.utils.managers.GradesManager.Companion.YEAR_1_AVG_2_SEM
@ -72,12 +73,11 @@ class GradesEditorFragment : Fragment() {
semester = arguments.getInt("semester", 1)
if (subjectId == -1L) {
MaterialDialog.Builder(activity)
.title(R.string.error_occured)
.content(R.string.error_no_subject_id)
.positiveText(R.string.ok)
.onPositive { _, _ -> activity.navigateUp() }
.show()
MaterialAlertDialogBuilder(activity)
.setTitle(R.string.error_occured)
.setMessage(R.string.error_no_subject_id)
.setPositiveButton(R.string.ok) { _, _ -> activity.navigateUp() }
.show()
return
}
@ -193,12 +193,11 @@ class GradesEditorFragment : Fragment() {
app.db.subjectDao().getById(App.profileId, subjectId).observe(this, Observer { subject ->
if (subject == null || subject.id == -1L) {
MaterialDialog.Builder(activity)
.title(R.string.error_occured)
.content(R.string.error_no_subject_id)
.positiveText(R.string.ok)
.onPositive { _, _ -> activity.navigateUp() }
.show()
MaterialAlertDialogBuilder(activity)
.setTitle(R.string.error_occured)
.setMessage(R.string.error_no_subject_id)
.setPositiveButton(R.string.ok) { _, _ -> activity.navigateUp() }
.show()
return@Observer
}
@ -329,21 +328,24 @@ class GradesEditorFragment : Fragment() {
popup.setOnMenuItemClickListener { item ->
if (item.itemId == 100) {
MaterialDialog.Builder(v.context)
.title(R.string.grades_editor_add_grade_title)
.content(R.string.grades_editor_add_grade_weight)
.inputType(InputType.TYPE_NUMBER_FLAG_SIGNED)
.input(null, null) { _, input ->
MaterialAlertDialogBuilder(v.context)
.setTitle(R.string.grades_editor_add_grade_title)
.input(
message = v.context.getString(R.string.grades_editor_add_grade_weight),
type = InputType.TYPE_NUMBER_FLAG_SIGNED,
positiveButton = R.string.ok,
positiveListener = { _, input ->
try {
editorGrade.weight = input.toString().toFloat()
editorGrade.weight = input.toFloat()
callback()
} catch (e: Exception) {
e.printStackTrace()
}
true
}
.positiveText(R.string.ok)
.negativeText(R.string.cancel)
.show()
)
.setNegativeButton(R.string.cancel, null)
.show()
} else {
editorGrade.weight = item.itemId.toFloat()
callback()

View File

@ -9,12 +9,13 @@ import android.content.ContextWrapper
import android.text.InputType
import android.util.AttributeSet
import androidx.appcompat.app.AppCompatActivity
import com.afollestad.materialdialogs.MaterialDialog
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
import pl.szczodrzynski.edziennik.R
import pl.szczodrzynski.edziennik.crc16
import pl.szczodrzynski.edziennik.data.db.AppDb
import pl.szczodrzynski.edziennik.ui.dialogs.input
import pl.szczodrzynski.edziennik.utils.TextInputDropDown
class SubjectDropdown : TextInputDropDown {
@ -105,19 +106,25 @@ class SubjectDropdown : TextInputDropDown {
fun customNameDialog() {
activity ?: return
MaterialDialog.Builder(activity!!)
.title("Własny przedmiot")
.inputType(InputType.TYPE_CLASS_TEXT or InputType.TYPE_TEXT_VARIATION_SHORT_MESSAGE)
.input("Nazwa", "") { _: MaterialDialog?, input: CharSequence ->
customSubjectName = input.toString()
MaterialAlertDialogBuilder(activity!!)
.setTitle("Własny przedmiot")
.input(
hint = "Nazwa",
type = InputType.TYPE_CLASS_TEXT or InputType.TYPE_TEXT_VARIATION_SHORT_MESSAGE,
positiveButton = R.string.ok,
positiveListener = { _, input ->
customSubjectName = input
select(Item(
-1L * customSubjectName.crc16(),
customSubjectName,
tag = customSubjectName
-1L * customSubjectName.crc16(),
customSubjectName,
tag = customSubjectName
))
onCustomSubjectSelected?.invoke(customSubjectName)
true
}
.show()
)
.setNegativeButton(R.string.cancel, null)
.show()
}
fun selectSubject(subjectId: Long) {

View File

@ -8,17 +8,18 @@ import android.app.Activity;
import android.app.WallpaperManager;
import android.appwidget.AppWidgetManager;
import android.content.Intent;
import android.graphics.Color;
import android.database.DataSetObserver;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter;
import android.graphics.drawable.ColorDrawable;
import android.os.AsyncTask;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListAdapter;
import android.widget.SeekBar;
import com.afollestad.materialdialogs.MaterialDialog;
import com.afollestad.materialdialogs.simplelist.MaterialSimpleListAdapter;
import com.afollestad.materialdialogs.simplelist.MaterialSimpleListItem;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import com.google.gson.JsonObject;
import java.util.List;
@ -27,6 +28,7 @@ import pl.szczodrzynski.edziennik.App;
import pl.szczodrzynski.edziennik.R;
import pl.szczodrzynski.edziennik.data.db.entity.Profile;
import pl.szczodrzynski.edziennik.databinding.DialogWidgetConfigBinding;
import pl.szczodrzynski.edziennik.databinding.WidgetProfileDialogItemBinding;
import pl.szczodrzynski.edziennik.ui.widgets.luckynumber.WidgetLuckyNumberProvider;
import pl.szczodrzynski.edziennik.ui.widgets.notifications.WidgetNotificationsProvider;
import pl.szczodrzynski.edziennik.ui.widgets.timetable.WidgetTimetableProvider;
@ -96,45 +98,84 @@ public class WidgetConfigActivity extends Activity {
}
private void selectProfile() {
MaterialSimpleListAdapter adapter =
new MaterialSimpleListAdapter((dialog, index1, item) -> {
profileId = (int) item.getId();
profileName = item.toString();
if (profileList.size() > 1 && widgetType != WIDGET_LUCKY_NUMBER) {
profileList.add(
new Profile(-1,
0,
0,
getString(R.string.widget_config_all_profiles),
null,
"",
"",
null,
new JsonObject()
)
);
}
ListAdapter adapter = new ListAdapter() {
@Override public boolean areAllItemsEnabled() { return true; }
@Override public boolean isEnabled(int position) { return true; }
@Override public void registerDataSetObserver(DataSetObserver observer) { }
@Override public void unregisterDataSetObserver(DataSetObserver observer) { }
@Override public boolean hasStableIds() { return true; }
@Override public int getItemViewType(int position) { return 0; }
@Override public int getViewTypeCount() { return 1; }
@Override public boolean isEmpty() { return false; }
@Override public int getCount() { return profileList.size(); }
@Override public Object getItem(int position) { return profileList.get(position); }
@Override
public long getItemId(int position) {
return profileList.get(position).getId();
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
WidgetProfileDialogItemBinding b;
if (convertView == null) {
b = WidgetProfileDialogItemBinding.inflate(getLayoutInflater(), null, false);
}
else {
b = WidgetProfileDialogItemBinding.bind(convertView);
}
Profile profile = profileList.get(position);
b.name.setText(profile.getName());
b.subname.setText(profile.getSubname());
b.subname.setVisibility(profile.getSubname() == null ? View.GONE : View.VISIBLE);
b.image.setVisibility(profile.getId() == -1 ? View.GONE : View.VISIBLE);
if (profile.getId() == -1)
b.image.setImageDrawable(null);
else
b.image.setImageDrawable(profile.getImageDrawable(WidgetConfigActivity.this));
b.getRoot().setOnClickListener(v -> {
profileId = profile.getId();
profileName = profile.getName();
configure();
});
for (Profile profile : profileList) {
adapter.add(
new MaterialSimpleListItem.Builder(this)
.id(profile.getId())
.content(profile.getName())
.icon(profile.getImageDrawable(this))
.backgroundColor(Color.WHITE)
.build());
}
if (profileList.size() > 1 && widgetType != WIDGET_LUCKY_NUMBER) {
adapter.add(
new MaterialSimpleListItem.Builder(this)
.id(-1)
.content(R.string.widget_config_all_profiles)
.backgroundColor(Color.WHITE)
.build());
}
new MaterialDialog.Builder(this)
.title(R.string.choose_profile)
.adapter(adapter, null)
.dismissListener(dialog -> finish())
return b.getRoot();
}
};
new MaterialAlertDialogBuilder(this)
.setTitle(R.string.choose_profile)
.setAdapter(adapter, null)
.setOnDismissListener(dialog -> finish())
.show();
}
private void configure() {
MaterialDialog dialog = new MaterialDialog.Builder(this)
.title(R.string.widget_config_activity_customize)
.customView(R.layout.dialog_widget_config, true)
.dismissListener(dialog1 -> finish())
.positiveText(R.string.ok)
.negativeText(R.string.cancel)
.onPositive(((dialog1, which) -> {
b = DialogWidgetConfigBinding.inflate(getLayoutInflater(), null, false);
new MaterialAlertDialogBuilder(this)
.setTitle(R.string.widget_config_activity_customize)
.setView(b.getRoot())
.setOnDismissListener(dialog -> finish())
.setPositiveButton(R.string.ok, ((dialog, which) -> {
WidgetConfig config = new WidgetConfig(profileId, bigStyle, darkTheme, opacity);
JsonObject configs = app.getConfig().getWidgetConfigs();
configs.add(Integer.toString(mAppWidgetId), app.getGson().toJsonTree(config));
@ -165,10 +206,9 @@ public class WidgetConfigActivity extends Activity {
setResult(RESULT_OK, resultValue);
finish();
}))
.setNegativeButton(R.string.cancel, null)
.show();
b = DialogWidgetConfigBinding.bind(dialog.getCustomView());
b.setProfileName(profileName);
WallpaperManager wallpaperManager = WallpaperManager.getInstance(this);

View File

@ -1,16 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<layout>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="24dp">
<TextView
android:id="@+id/text"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_height="wrap_content"
android:autoLink="web|email"
android:textColor="?android:textColorPrimary"
android:textIsSelectable="true"
android:textSize="16sp" />
</LinearLayout>
</layout>
</ScrollView>

View File

@ -2,122 +2,129 @@
<layout 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">
<data>
<import type="android.view.View" />
<variable
name="profileName"
type="String" />
</data>
<LinearLayout
android:orientation="vertical"
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:textAppearance="@style/NavView.TextView.Helper"
android:visibility="@{profileName == null ? View.GONE : View.VISIBLE}"
android:text="@string/dialog_widget_config_profile" />
android:padding="24dp">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="0dp"
android:text="@{profileName}"
android:textIsSelectable="true"
android:visibility="@{profileName == null ? View.GONE : View.VISIBLE}"
tools:text="Władca Androida" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:textAppearance="@style/NavView.TextView.Helper"
android:text="@string/dialog_widget_timetable_config_theme" />
<RadioGroup
android:id="@+id/theme"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<RadioButton
android:id="@+id/themeLight"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:checked="true"
android:text="@string/theme_light" />
<RadioButton
android:id="@+id/themeDark"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/theme_dark" />
</RadioGroup>
<CheckBox
android:id="@+id/bigStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="@string/dialog_widget_timetable_config_big_style" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:textAppearance="@style/NavView.TextView.Helper"
android:text="@string/dialog_widget_timetable_config_opacity" />
<SeekBar
android:id="@+id/opacity"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:max="100"
android:progress="100" />
<TextView
android:id="@+id/opacityText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="0dp"
android:textIsSelectable="true"
android:gravity="end"
tools:text="100%" />
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_marginTop="16dp"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/wallpaper"
android:layout_width="0dp"
android:layout_height="0dp"
android:scaleType="center"
app:layout_constraintBottom_toBottomOf="@+id/widgetPreview"
app:layout_constraintEnd_toEndOf="@+id/widgetPreview"
app:layout_constraintStart_toStartOf="@+id/widgetPreview"
app:layout_constraintTop_toTopOf="@+id/widgetPreview"
tools:srcCompat="@tools:sample/backgrounds/scenic[4]"
tools:visibility="visible" />
<ImageView
android:id="@+id/widgetPreview"
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:padding="32dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/widget_timetable_preview" />
android:textAppearance="@style/NavView.TextView.Helper"
android:visibility="@{profileName == null ? View.GONE : View.VISIBLE}"
android:text="@string/dialog_widget_config_profile" />
</androidx.constraintlayout.widget.ConstraintLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="0dp"
android:text="@{profileName}"
android:textIsSelectable="true"
android:visibility="@{profileName == null ? View.GONE : View.VISIBLE}"
tools:text="Władca Androida" />
</LinearLayout>
</layout>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:textAppearance="@style/NavView.TextView.Helper"
android:text="@string/dialog_widget_timetable_config_theme" />
<RadioGroup
android:id="@+id/theme"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<RadioButton
android:id="@+id/themeLight"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:checked="true"
android:text="@string/theme_light" />
<RadioButton
android:id="@+id/themeDark"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/theme_dark" />
</RadioGroup>
<CheckBox
android:id="@+id/bigStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="@string/dialog_widget_timetable_config_big_style" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:textAppearance="@style/NavView.TextView.Helper"
android:text="@string/dialog_widget_timetable_config_opacity" />
<SeekBar
android:id="@+id/opacity"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:max="100"
android:progress="100" />
<TextView
android:id="@+id/opacityText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="0dp"
android:textIsSelectable="true"
android:gravity="end"
tools:text="100%" />
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_marginTop="16dp"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/wallpaper"
android:layout_width="0dp"
android:layout_height="0dp"
android:scaleType="center"
app:layout_constraintBottom_toBottomOf="@+id/widgetPreview"
app:layout_constraintEnd_toEndOf="@+id/widgetPreview"
app:layout_constraintStart_toStartOf="@+id/widgetPreview"
app:layout_constraintTop_toTopOf="@+id/widgetPreview"
tools:srcCompat="@tools:sample/backgrounds/scenic[4]"
tools:visibility="visible" />
<ImageView
android:id="@+id/widgetPreview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:padding="32dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/widget_timetable_preview" />
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>
</ScrollView>
</layout>

View File

@ -1,45 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:ignore="PrivateResource"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?selectableItemBackground"
android:focusable="true"
android:gravity="start|center_vertical"
android:minHeight="@dimen/md_simpleitem_height"
android:orientation="horizontal"
android:paddingHorizontal="@dimen/md_dialog_frame_margin">
<androidx.cardview.widget.CardView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/md_simplelist_icon_margin"
android:layout_marginRight="@dimen/md_simplelist_icon_margin"
android:innerRadius="0dp"
android:padding="0dp"
app:cardCornerRadius="20dp"
app:cardElevation="4dp">
<ImageView
android:id="@android:id/icon"
android:layout_width="@dimen/md_simplelist_icon"
android:layout_height="@dimen/md_simplelist_icon"
android:layout_gravity="start|center_vertical"
android:background="@drawable/gray_circle"
android:scaleType="centerCrop"
tools:background="#f5f5f5"
tools:ignore="ContentDescription"
tools:srcCompat="@tools:sample/backgrounds/scenic" />
</androidx.cardview.widget.CardView>
<TextView
android:id="@android:id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:textSize="@dimen/md_simplelist_textsize"
tools:text="Title" />
</LinearLayout>

View File

@ -0,0 +1,44 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?selectableItemBackground"
android:focusable="true"
android:gravity="center_vertical"
android:minHeight="62dp"
android:orientation="horizontal"
android:paddingHorizontal="24dp">
<com.mikepenz.materialdrawer.view.BezelImageView
android:id="@+id/image"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginEnd="16dp"
android:layout_marginRight="16dp"
android:scaleType="centerCrop"
tools:ignore="ContentDescription"
tools:srcCompat="@tools:sample/backgrounds/scenic" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:id="@+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="@style/NavView.TextView.Medium"
tools:text="Title" />
<TextView
android:id="@+id/subname"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="@style/NavView.TextView.Small"
tools:text="SubTitle" />
</LinearLayout>
</LinearLayout>

View File

@ -87,6 +87,12 @@
<item name="textColor">?android:textColorSecondary</item>
<item name="android:textColor">?android:textColorSecondary</item>
</style>
<style name="AppTheme.MaterialAlertDialogMonospace" parent="AppTheme.MaterialAlertDialog">
<item name="materialAlertDialogBodyTextStyle">@style/AppTheme.MaterialAlertDialogMonospace.BodyText</item>
</style>
<style name="AppTheme.MaterialAlertDialogMonospace.BodyText" parent="AppTheme.MaterialAlertDialog.BodyText">
<item name="android:typeface">monospace</item>
</style>
<style name="AppTheme" parent="NavView" />
@ -104,12 +110,6 @@
<item name="colorOnFab">#ffffff</item>
<item name="colorIcon">#8a000000</item>
<item name="md_dark_theme">false</item>
<item name="md_title_color">?android:textColorPrimary</item>
<item name="md_content_color">?android:textColorPrimary</item>
<item name="md_link_color">?colorAccent</item>
<item name="md_item_color">?android:textColorPrimary</item>
<item name="mal_color_primary">?android:textColorPrimary</item>
<item name="mal_color_secondary">?android:textColorSecondary</item>
<item name="mal_card_background">?colorSurface</item>
@ -136,12 +136,6 @@
<item name="colorOnFab">#ffffff</item>
<item name="colorIcon">#b4ffffff</item>
<item name="md_dark_theme">true</item>
<item name="md_title_color">?android:textColorPrimary</item>
<item name="md_content_color">?android:textColorPrimary</item>
<item name="md_link_color">?colorAccent</item>
<item name="md_item_color">?android:textColorPrimary</item>
<item name="mal_color_primary">@color/primaryTextDark</item>
<item name="mal_color_secondary">@color/secondaryTextDark</item>
<item name="mal_card_background">?colorSurface</item>