From 6e48294f2a9714f18c6afeb54988f3d9674aa205 Mon Sep 17 00:00:00 2001 From: Viktor De Pasquale Date: Thu, 30 Jan 2020 16:31:43 +0100 Subject: [PATCH] Removed unnecessary files and merged styles --- .../model/entity/recycler/ConsoleRvItem.kt | 12 +++---- .../model/entity/recycler/SectionRvItem.kt | 11 ------- .../magisk/utils/DataBindingAdapters.kt | 20 ----------- app/src/main/res/layout/item_console.xml | 27 --------------- app/src/main/res/layout/item_console_md2.xml | 2 +- app/src/main/res/layout/item_section.xml | 33 ------------------- .../res/layout/swicher_caption_variant.xml | 10 ------ app/src/main/res/values-night/styles.xml | 4 --- app/src/main/res/values-v19/styles.xml | 4 --- app/src/main/res/values-v19/styles_md2.xml | 2 ++ app/src/main/res/values/styles.xml | 5 --- app/src/main/res/values/styles_md2.xml | 5 +++ app/src/main/res/values/styles_view_md2.xml | 2 +- app/src/main/res/values/view_card_styles.xml | 9 ----- .../main/res/values/view_dialog_styles.xml | 11 ------- .../main/res/values/view_divider_styles.xml | 18 ---------- .../main/res/values/view_progress_styles.xml | 10 ------ app/src/main/res/values/view_styles.xml | 6 ---- 18 files changed, 13 insertions(+), 178 deletions(-) delete mode 100644 app/src/main/java/com/topjohnwu/magisk/model/entity/recycler/SectionRvItem.kt delete mode 100644 app/src/main/res/layout/item_console.xml delete mode 100644 app/src/main/res/layout/item_section.xml delete mode 100644 app/src/main/res/layout/swicher_caption_variant.xml delete mode 100644 app/src/main/res/values-night/styles.xml delete mode 100644 app/src/main/res/values-v19/styles.xml delete mode 100644 app/src/main/res/values/styles.xml delete mode 100644 app/src/main/res/values/view_card_styles.xml delete mode 100644 app/src/main/res/values/view_dialog_styles.xml delete mode 100644 app/src/main/res/values/view_divider_styles.xml delete mode 100644 app/src/main/res/values/view_progress_styles.xml delete mode 100644 app/src/main/res/values/view_styles.xml diff --git a/app/src/main/java/com/topjohnwu/magisk/model/entity/recycler/ConsoleRvItem.kt b/app/src/main/java/com/topjohnwu/magisk/model/entity/recycler/ConsoleRvItem.kt index d5d391945..3b099a787 100644 --- a/app/src/main/java/com/topjohnwu/magisk/model/entity/recycler/ConsoleRvItem.kt +++ b/app/src/main/java/com/topjohnwu/magisk/model/entity/recycler/ConsoleRvItem.kt @@ -6,8 +6,8 @@ import androidx.databinding.ViewDataBinding import androidx.recyclerview.widget.RecyclerView import com.topjohnwu.magisk.R -open class ConsoleRvItem(val item: String) : LenientRvItem() { - override val layoutRes: Int = R.layout.item_console +class ConsoleItem(val item: String) : LenientRvItem() { + override val layoutRes = R.layout.item_console_md2 override fun onBindingBound(binding: ViewDataBinding, recyclerView: RecyclerView) { val view = binding.root as TextView @@ -21,10 +21,6 @@ open class ConsoleRvItem(val item: String) : LenientRvItem() { } } - override fun contentSameAs(other: ConsoleRvItem) = itemSameAs(other) - override fun itemSameAs(other: ConsoleRvItem) = item == other.item -} - -class ConsoleItem(item: String) : ConsoleRvItem(item) { - override val layoutRes = R.layout.item_console_md2 + override fun contentSameAs(other: ConsoleItem) = itemSameAs(other) + override fun itemSameAs(other: ConsoleItem) = item == other.item } \ No newline at end of file diff --git a/app/src/main/java/com/topjohnwu/magisk/model/entity/recycler/SectionRvItem.kt b/app/src/main/java/com/topjohnwu/magisk/model/entity/recycler/SectionRvItem.kt deleted file mode 100644 index 9aad6d59e..000000000 --- a/app/src/main/java/com/topjohnwu/magisk/model/entity/recycler/SectionRvItem.kt +++ /dev/null @@ -1,11 +0,0 @@ -package com.topjohnwu.magisk.model.entity.recycler - -import com.topjohnwu.magisk.R -import com.topjohnwu.magisk.databinding.ComparableRvItem - -class SectionRvItem(val text: String) : ComparableRvItem() { - override val layoutRes: Int = R.layout.item_section - - override fun contentSameAs(other: SectionRvItem) = itemSameAs(other) - override fun itemSameAs(other: SectionRvItem) = text == other.text -} \ No newline at end of file diff --git a/app/src/main/java/com/topjohnwu/magisk/utils/DataBindingAdapters.kt b/app/src/main/java/com/topjohnwu/magisk/utils/DataBindingAdapters.kt index 919abc2a5..ae23cfa29 100644 --- a/app/src/main/java/com/topjohnwu/magisk/utils/DataBindingAdapters.kt +++ b/app/src/main/java/com/topjohnwu/magisk/utils/DataBindingAdapters.kt @@ -9,9 +9,7 @@ import android.view.View import android.view.ViewAnimationUtils import android.view.ViewGroup import android.widget.ProgressBar -import android.widget.TextSwitcher import android.widget.TextView -import android.widget.ViewSwitcher import androidx.annotation.ColorInt import androidx.annotation.DrawableRes import androidx.appcompat.widget.AppCompatImageView @@ -287,24 +285,6 @@ fun View.setOnSelectClickListener(listener: View.OnClickListener, resetTime: Lon } } -@BindingAdapter("textCaptionVariant") -fun TextSwitcher.setTextBinding(text: CharSequence) { - tag as? ViewSwitcher.ViewFactory ?: ViewSwitcher.ViewFactory { - View.inflate(context, R.layout.swicher_caption_variant, null) - }.also { - tag = it - setFactory(it) - setInAnimation(context, R.anim.switcher_bottom_up) - setOutAnimation(context, R.anim.switcher_center_up) - } - - - val currentText = (currentView as? TextView)?.text - if (currentText != text) { - setText(text) - } -} - @BindingAdapter( "android:layout_marginLeft", "android:layout_marginTop", diff --git a/app/src/main/res/layout/item_console.xml b/app/src/main/res/layout/item_console.xml deleted file mode 100644 index 8fa6c0b93..000000000 --- a/app/src/main/res/layout/item_console.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/app/src/main/res/layout/item_console_md2.xml b/app/src/main/res/layout/item_console_md2.xml index 4db78d28f..d015fb33e 100644 --- a/app/src/main/res/layout/item_console_md2.xml +++ b/app/src/main/res/layout/item_console_md2.xml @@ -6,7 +6,7 @@ + type="com.topjohnwu.magisk.model.entity.recycler.ConsoleItem" /> - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layout/swicher_caption_variant.xml b/app/src/main/res/layout/swicher_caption_variant.xml deleted file mode 100644 index 02c1d64a7..000000000 --- a/app/src/main/res/layout/swicher_caption_variant.xml +++ /dev/null @@ -1,10 +0,0 @@ - - \ No newline at end of file diff --git a/app/src/main/res/values-night/styles.xml b/app/src/main/res/values-night/styles.xml deleted file mode 100644 index 0d2c4cc40..000000000 --- a/app/src/main/res/values-night/styles.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/app/src/main/res/values-v19/styles.xml b/app/src/main/res/values-v19/styles.xml deleted file mode 100644 index 2a7f9b3e4..000000000 --- a/app/src/main/res/values-v19/styles.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - @@ -13,6 +15,9 @@ diff --git a/app/src/main/res/values/styles_view_md2.xml b/app/src/main/res/values/styles_view_md2.xml index 2355e8f5e..4405dd2cf 100644 --- a/app/src/main/res/values/styles_view_md2.xml +++ b/app/src/main/res/values/styles_view_md2.xml @@ -1,7 +1,7 @@ - - - \ No newline at end of file diff --git a/app/src/main/res/values/view_dialog_styles.xml b/app/src/main/res/values/view_dialog_styles.xml deleted file mode 100644 index 7a1cc28e2..000000000 --- a/app/src/main/res/values/view_dialog_styles.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/app/src/main/res/values/view_divider_styles.xml b/app/src/main/res/values/view_divider_styles.xml deleted file mode 100644 index d77d43b1e..000000000 --- a/app/src/main/res/values/view_divider_styles.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/values/view_progress_styles.xml b/app/src/main/res/values/view_progress_styles.xml deleted file mode 100644 index 5d26132be..000000000 --- a/app/src/main/res/values/view_progress_styles.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/app/src/main/res/values/view_styles.xml b/app/src/main/res/values/view_styles.xml deleted file mode 100644 index 7cbd5ce8a..000000000 --- a/app/src/main/res/values/view_styles.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - -