Removed unnecessary files and merged styles

This commit is contained in:
Viktor De Pasquale 2020-01-30 16:31:43 +01:00 committed by John Wu
parent dea607b148
commit 6e48294f2a
18 changed files with 13 additions and 178 deletions

View File

@ -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<ConsoleRvItem>() {
override val layoutRes: Int = R.layout.item_console
class ConsoleItem(val item: String) : LenientRvItem<ConsoleItem>() {
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<ConsoleRvItem>() {
}
}
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
}

View File

@ -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<SectionRvItem>() {
override val layoutRes: Int = R.layout.item_section
override fun contentSameAs(other: SectionRvItem) = itemSameAs(other)
override fun itemSameAs(other: SectionRvItem) = text == other.text
}

View File

@ -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",

View File

@ -1,27 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<data>
<variable
name="item"
type="com.topjohnwu.magisk.model.entity.recycler.ConsoleRvItem" />
<!--no actions are required-->
<variable
name="viewModel"
type="Object" />
</data>
<TextView
android:focusable="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="monospace"
android:text="@{item.item}"
android:textSize="10sp"
tools:text="@tools:sample/lorem/random" />
</layout>

View File

@ -6,7 +6,7 @@
<variable
name="item"
type="com.topjohnwu.magisk.model.entity.recycler.ConsoleRvItem" />
type="com.topjohnwu.magisk.model.entity.recycler.ConsoleItem" />
<!--no actions are required-->
<variable

View File

@ -1,33 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<data>
<variable
name="item"
type="com.topjohnwu.magisk.model.entity.recycler.SectionRvItem" />
<variable
name="viewModel"
type="Object" />
</data>
<!--Paddings are trimmed from default section title because recycler adds these paddings for us already-->
<androidx.appcompat.widget.AppCompatTextView
style="@style/Widget.Text.SectionTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="0dp"
android:paddingLeft="0dp"
android:paddingTop="@dimen/margin_generic"
android:paddingEnd="0dp"
android:paddingRight="0dp"
android:paddingBottom="0dp"
android:text="@{item.text}"
android:textAppearance="@style/TextAppearance.Emphasize"
tools:text="@string/update_available" />
</layout>

View File

@ -1,10 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.appcompat.widget.AppCompatTextView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:tools="http://schemas.android.com/tools"
android:ellipsize="middle"
android:gravity="start|center_vertical"
android:singleLine="true"
tools:text="@string/magisk"
android:textAppearance="@style/AppearanceFoundation.Caption.Variant" />

View File

@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
</resources>

View File

@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="SplashTheme" parent="SplashThemeBase.V19"/>
</resources>

View File

@ -1,6 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="SplashTheme" parent="SplashThemeBase.V19" />
<style name="Foundation.Compat">
<item name="android:windowTranslucentNavigation">true</item>
<item name="android:windowTranslucentStatus">true</item>

View File

@ -1,5 +0,0 @@
<resources>
<style name="SplashTheme" parent="SplashThemeBase"/>
</resources>

View File

@ -1,6 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="SplashTheme" parent="SplashThemeBase" />
<style name="Foundation" parent="Theme.MaterialComponents.Light.NoActionBar">
<item name="android:windowBackground">?colorSurface</item>
</style>
@ -13,6 +15,9 @@
<style name="WidgetFoundation" parent="android:Widget" />
<!-- {@deprecated Use WidgetFoundation instead.} -->
<style name="Widget" parent="WidgetFoundation" />
<style name="AppearanceFoundation">
<item name="android:fontFamily">@font/exo</item>
</style>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="W" parent="Widget" />
<style name="W" parent="android:Widget" />
<style name="W.Home" />

View File

@ -1,9 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Widget.Card" parent="Widget.MaterialComponents.CardView">
<item name="cardCornerRadius">@dimen/radius_generic</item>
<item name="cardElevation">0dp</item>
</style>
</resources>

View File

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Widget.DialogButton">
<item name="android:background">?attr/selectableItemBackground</item>
<item name="android:gravity">center</item>
<item name="android:layout_width">0dp</item>
<item name="android:layout_height">wrap_content</item>
</style>
</resources>

View File

@ -1,18 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Widget.Divider">
<item name="android:background">@color/colorCardStrokeInverse</item>
</style>
<style name="Widget.Divider.Horizontal">
<item name="android:layout_width">0dp</item>
<item name="android:layout_height">1dp</item>
</style>
<style name="Widget.Divider.Vertical">
<item name="android:layout_width">1dp</item>
<item name="android:layout_height">0dp</item>
</style>
</resources>

View File

@ -1,10 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Widget.Progress" parent="Widget.AppCompat.ProgressBar.Horizontal">
<item name="android:indeterminate">true</item>
<item name="android:layout_width">64dp</item>
<item name="android:layout_height">wrap_content</item>
</style>
</resources>

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Widget" />
</resources>