Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
M
Magisk
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Magisk
Commits
87b6bf2c
Commit
87b6bf2c
authored
Aug 11, 2020
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove strip in settings item
parent
9df6b061
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
46 additions
and
101 deletions
+46
-101
build.gradle.kts
app/build.gradle.kts
+1
-1
SettingsItem.kt
...om/topjohnwu/magisk/model/entity/recycler/SettingsItem.kt
+8
-10
SettingsItems.kt
...in/java/com/topjohnwu/magisk/ui/settings/SettingsItems.kt
+10
-6
DataBindingAdapters.kt
...in/java/com/topjohnwu/magisk/utils/DataBindingAdapters.kt
+0
-1
dialog_settings_download_path.xml
app/src/main/res/layout/dialog_settings_download_path.xml
+1
-1
fragment_settings_md2.xml
app/src/main/res/layout/fragment_settings_md2.xml
+0
-1
item_settings_blank.xml
app/src/main/res/layout/item_settings_blank.xml
+4
-4
item_settings_input.xml
app/src/main/res/layout/item_settings_input.xml
+7
-34
item_settings_section.xml
app/src/main/res/layout/item_settings_section.xml
+2
-2
item_settings_selector.xml
app/src/main/res/layout/item_settings_selector.xml
+7
-34
item_settings_toggle.xml
app/src/main/res/layout/item_settings_toggle.xml
+6
-7
No files found.
app/build.gradle.kts
View file @
87b6bf2c
...
...
@@ -82,7 +82,7 @@ dependencies {
implementation
(
project
(
":app:signing"
))
implementation
(
"com.github.topjohnwu:jtar:1.0.0"
)
implementation
(
"com.github.topjohnwu:indeterminate-checkbox:1.0.
6
"
)
implementation
(
"com.github.topjohnwu:indeterminate-checkbox:1.0.
7
"
)
implementation
(
"com.jakewharton.timber:timber:4.7.1"
)
implementation
(
kotlin
(
"stdlib"
))
...
...
app/src/main/java/com/topjohnwu/magisk/model/entity/recycler/SettingsItem.kt
View file @
87b6bf2c
...
...
@@ -10,6 +10,7 @@ import com.topjohnwu.magisk.BR
import
com.topjohnwu.magisk.R
import
com.topjohnwu.magisk.databinding.ObservableItem
import
com.topjohnwu.magisk.utils.TransitiveText
import
com.topjohnwu.magisk.utils.asTransitive
import
com.topjohnwu.magisk.utils.set
import
com.topjohnwu.magisk.view.MagiskDialog
import
org.koin.core.KoinComponent
...
...
@@ -94,22 +95,20 @@ sealed class SettingsItem : ObservableItem<SettingsItem>() {
}
}
abstract
class
Input
:
Value
<
String
>()
,
KoinComponent
{
abstract
class
Input
:
Value
<
String
>()
{
override
val
layoutRes
=
R
.
layout
.
item_settings_input
open
val
showStrip
=
true
protected
val
resources
get
()
=
get
<
Resources
>()
protected
abstract
val
intermediate
:
String
?
protected
abstract
val
inputResult
:
String
?
override
fun
onPressed
(
view
:
View
)
{
MagiskDialog
(
view
.
context
)
.
applyTitle
(
title
.
getText
(
resources
))
.
applyTitle
(
title
.
getText
(
view
.
resources
))
.
applyView
(
getView
(
view
.
context
))
.
applyButton
(
MagiskDialog
.
ButtonType
.
POSITIVE
)
{
titleRes
=
android
.
R
.
string
.
ok
onClick
{
in
termediate
?.
let
{
result
->
in
putResult
?.
let
{
result
->
preventDismiss
=
false
value
=
result
it
.
dismiss
()
...
...
@@ -125,7 +124,6 @@ sealed class SettingsItem : ObservableItem<SettingsItem>() {
}
abstract
fun
getView
(
context
:
Context
):
View
}
abstract
class
Selector
:
Value
<
Int
>(),
KoinComponent
{
...
...
@@ -141,12 +139,12 @@ sealed class SettingsItem : ObservableItem<SettingsItem>() {
open
val
entryValues
get
()
=
resources
.
getArrayOrEmpty
(
entryValRes
)
@get
:
Bindable
val
selectedEntry
get
()
=
entries
.
getOrNull
(
value
)
override
val
description
:
TransitiveText
get
()
=
entries
.
getOrNull
(
value
)
?.
asTransitive
()
?:
TransitiveText
.
EMPTY
protected
inline
fun
<
reified
T
>
setS
(
new
:
T
,
old
:
T
,
setter
:
(
T
)
->
Unit
,
afterChanged
:
(
T
)
->
Unit
=
{})
{
setV
(
new
,
old
,
setter
,
BR
.
selectedEntry
,
BR
.
description
,
afterChanged
=
afterChanged
)
setV
(
new
,
old
,
setter
,
BR
.
description
,
afterChanged
=
afterChanged
)
}
private
fun
Resources
.
getArrayOrEmpty
(
id
:
Int
):
Array
<
String
>
=
...
...
app/src/main/java/com/topjohnwu/magisk/ui/settings/SettingsItems.kt
View file @
87b6bf2c
...
...
@@ -79,15 +79,15 @@ object ClearRepoCache : SettingsItem.Blank() {
object
Hide
:
SettingsItem
.
Input
()
{
override
val
title
=
R
.
string
.
settings_hide_manager_title
.
asTransitive
()
override
val
description
=
R
.
string
.
settings_hide_manager_summary
.
asTransitive
()
override
val
showStrip
=
false
override
var
value
=
resources
.
getString
(
R
.
string
.
re_app_name
)
@get
:
Bindable
override
var
value
=
"Manager"
set
(
value
)
=
setV
(
value
,
field
,
{
field
=
it
},
BR
.
error
)
@get
:
Bindable
val
isError
get
()
=
value
.
length
>
14
||
value
.
isBlank
()
override
val
intermediate
:
String
?
get
()
=
if
(
isError
)
null
else
value
override
val
inputResult
get
()
=
if
(
isError
)
null
else
value
override
fun
getView
(
context
:
Context
)
=
DialogSettingsAppNameBinding
.
inflate
(
LayoutInflater
.
from
(
context
)).
also
{
it
.
data
=
this
}.
root
...
...
@@ -105,8 +105,11 @@ fun HideOrRestore() =
object
DownloadPath
:
SettingsItem
.
Input
()
{
override
var
value
=
Config
.
downloadPath
set
(
value
)
=
setV
(
value
,
field
,
{
field
=
it
})
{
Config
.
downloadPath
=
it
}
override
val
title
=
R
.
string
.
settings_download_path_title
.
asTransitive
()
override
val
intermediate
:
String
?
override
val
description
get
()
=
path
.
asTransitive
()
override
val
inputResult
:
String
?
get
()
=
if
(
Utils
.
ensureDownloadPath
(
result
)
!=
null
)
result
else
null
@get
:
Bindable
...
...
@@ -135,7 +138,8 @@ object UpdateChannelUrl : SettingsItem.Input() {
override
val
title
=
R
.
string
.
settings_update_custom
.
asTransitive
()
override
var
value
=
Config
.
customChannelUrl
set
(
value
)
=
setV
(
value
,
field
,
{
field
=
it
})
{
Config
.
customChannelUrl
=
it
}
override
val
intermediate
:
String
?
get
()
=
result
override
val
inputResult
get
()
=
result
@get
:
Bindable
var
result
=
value
...
...
app/src/main/java/com/topjohnwu/magisk/utils/DataBindingAdapters.kt
View file @
87b6bf2c
...
...
@@ -259,7 +259,6 @@ fun setState(view: IndeterminateCheckBox, state: Boolean?) {
@InverseBindingAdapter
(
attribute
=
"state"
)
fun
getState
(
view
:
IndeterminateCheckBox
)
=
view
.
state
@BindingAdapter
(
"stateAttrChanged"
)
fun
setListeners
(
view
:
IndeterminateCheckBox
,
...
...
app/src/main/res/layout/dialog_settings_download_path.xml
View file @
87b6bf2c
...
...
@@ -17,7 +17,7 @@
android:orientation=
"vertical"
android:padding=
"@dimen/margin_generic"
>
<
androidx.appcompat.widget.AppCompat
TextView
<TextView
android:id=
"@+id/dialog_custom_download_title"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
...
...
app/src/main/res/layout/fragment_settings_md2.xml
View file @
87b6bf2c
...
...
@@ -30,7 +30,6 @@
android:paddingEnd=
"@dimen/l_50"
android:paddingBottom=
"@{viewModel.insets.bottom + (int) @dimen/l1}"
app:layoutManager=
"androidx.recyclerview.widget.LinearLayoutManager"
app:spanCount=
"1"
tools:layout_marginTop=
"24dp"
tools:listitem=
"@layout/item_settings_toggle"
tools:paddingTop=
"@dimen/l1"
/>
...
...
app/src/main/res/layout/item_settings_blank.xml
View file @
87b6bf2c
...
...
@@ -29,7 +29,7 @@
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
>
<
androidx.appcompat.widget.AppCompat
ImageView
<ImageView
android:id=
"@+id/blank_icon"
style=
"@style/WidgetFoundation.Icon"
gone=
"@{item.icon == 0}"
...
...
@@ -41,7 +41,7 @@
app:srcCompat=
"@{item.icon}"
tools:srcCompat=
"@drawable/ic_fingerprint"
/>
<
androidx.appcompat.widget.AppCompat
ImageView
<ImageView
android:id=
"@+id/blank_indicator"
style=
"@style/WidgetFoundation.Icon"
android:background=
"@null"
...
...
@@ -65,7 +65,7 @@
app:layout_constraintStart_toEndOf=
"@+id/blank_icon"
app:layout_constraintTop_toTopOf=
"parent"
>
<
androidx.appcompat.widget.AppCompat
TextView
<TextView
android:id=
"@+id/blank_title"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
...
...
@@ -77,7 +77,7 @@
tools:lines=
"2"
tools:text=
"@tools:sample/lorem/random"
/>
<
androidx.appcompat.widget.AppCompat
TextView
<TextView
android:id=
"@+id/blank_description"
gone=
"@{item.description.empty}"
android:layout_width=
"match_parent"
...
...
app/src/main/res/layout/item_settings_input.xml
View file @
87b6bf2c
...
...
@@ -29,25 +29,24 @@
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
>
<
androidx.appcompat.widget.AppCompat
ImageView
<ImageView
android:id=
"@+id/input_icon"
style=
"@style/WidgetFoundation.Icon"
gone=
"@{item.icon == 0}"
android:background=
"@null"
android:rotation=
"180"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintBottom_toTopOf=
"@+id/input_divider"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
app:srcCompat=
"@{item.icon}"
tools:srcCompat=
"@drawable/ic_fingerprint"
/>
<
androidx.appcompat.widget.AppCompat
ImageView
<ImageView
android:id=
"@+id/input_indicator"
style=
"@style/WidgetFoundation.Icon"
android:background=
"@null"
android:rotation=
"180"
app:layout_constraintBottom_to
TopOf=
"@+id/input_divider
"
app:layout_constraintBottom_to
BottomOf=
"parent
"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
app:srcCompat=
"@drawable/ic_back_md2"
/>
...
...
@@ -61,12 +60,12 @@
android:orientation=
"vertical"
android:paddingTop=
"@dimen/l1"
android:paddingBottom=
"@dimen/l1"
app:layout_constraintBottom_to
TopOf=
"@+id/input_divider
"
app:layout_constraintBottom_to
BottomOf=
"parent
"
app:layout_constraintEnd_toStartOf=
"@+id/input_indicator"
app:layout_constraintStart_toEndOf=
"@+id/input_icon"
app:layout_constraintTop_toTopOf=
"parent"
>
<
androidx.appcompat.widget.AppCompat
TextView
<TextView
android:id=
"@+id/input_title"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
...
...
@@ -78,7 +77,7 @@
tools:lines=
"1"
tools:text=
"@tools:sample/lorem/random"
/>
<
androidx.appcompat.widget.AppCompat
TextView
<TextView
android:id=
"@+id/input_description"
gone=
"@{item.description.empty}"
android:layout_width=
"match_parent"
...
...
@@ -90,34 +89,8 @@
</LinearLayout>
<View
android:id=
"@+id/input_divider"
gone=
"@{item.value.empty || !item.showStrip}"
android:layout_width=
"match_parent"
android:layout_height=
"0dp"
android:alpha=
".5"
android:background=
"?colorSurface"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/input_text"
/>
<androidx.appcompat.widget.AppCompatTextView
android:id=
"@+id/input_selection"
gone=
"@{item.value.empty || !item.showStrip}"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:paddingStart=
"@dimen/l1"
android:paddingTop=
"@dimen/l_75"
android:paddingEnd=
"@dimen/l1"
android:paddingBottom=
"@dimen/l_75"
android:text=
"@{item.value}"
android:textAppearance=
"@style/AppearanceFoundation.Tiny.Variant"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintStart_toStartOf=
"@+id/input_text"
app:layout_constraintTop_toTopOf=
"@+id/input_divider"
tools:text=
"@tools:sample/lorem"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</com.google.android.material.card.MaterialCardView>
</layout>
\ No newline at end of file
</layout>
app/src/main/res/layout/item_settings_section.xml
View file @
87b6bf2c
...
...
@@ -17,7 +17,7 @@
android:paddingTop=
"@dimen/l1"
android:paddingBottom=
"@dimen/l_50"
>
<
androidx.appcompat.widget.AppCompat
TextView
<TextView
gone=
"@{item.title.empty}"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
...
...
@@ -26,7 +26,7 @@
android:textStyle=
"bold"
tools:text=
"@tools:sample/lorem"
/>
<
androidx.appcompat.widget.AppCompat
TextView
<TextView
gone=
"@{item.description.empty}"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
...
...
app/src/main/res/layout/item_settings_selector.xml
View file @
87b6bf2c
...
...
@@ -29,25 +29,24 @@
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
>
<
androidx.appcompat.widget.AppCompat
ImageView
<ImageView
android:id=
"@+id/selector_icon"
style=
"@style/WidgetFoundation.Icon"
gone=
"@{item.icon == 0}"
android:background=
"@null"
android:rotation=
"180"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintBottom_toTopOf=
"@+id/selector_divider"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
app:srcCompat=
"@{item.icon}"
tools:srcCompat=
"@drawable/ic_fingerprint"
/>
<
androidx.appcompat.widget.AppCompat
ImageView
<ImageView
android:id=
"@+id/selector_indicator"
style=
"@style/WidgetFoundation.Icon"
android:background=
"@null"
android:rotation=
"180"
app:layout_constraintBottom_to
TopOf=
"@+id/selector_divider
"
app:layout_constraintBottom_to
BottomOf=
"parent
"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
app:srcCompat=
"@drawable/ic_back_md2"
/>
...
...
@@ -61,12 +60,12 @@
android:orientation=
"vertical"
android:paddingTop=
"@dimen/l1"
android:paddingBottom=
"@dimen/l1"
app:layout_constraintBottom_to
TopOf=
"@+id/selector_divider
"
app:layout_constraintBottom_to
BottomOf=
"parent
"
app:layout_constraintEnd_toStartOf=
"@+id/selector_indicator"
app:layout_constraintStart_toEndOf=
"@+id/selector_icon"
app:layout_constraintTop_toTopOf=
"parent"
>
<
androidx.appcompat.widget.AppCompat
TextView
<TextView
android:id=
"@+id/selector_title"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
...
...
@@ -78,7 +77,7 @@
tools:lines=
"1"
tools:text=
"@tools:sample/lorem/random"
/>
<
androidx.appcompat.widget.AppCompat
TextView
<TextView
android:id=
"@+id/selector_description"
gone=
"@{item.description.empty}"
android:layout_width=
"match_parent"
...
...
@@ -90,34 +89,8 @@
</LinearLayout>
<View
android:id=
"@+id/selector_divider"
gone=
"@{item.selectedEntry == null}"
android:layout_width=
"match_parent"
android:layout_height=
"0dp"
android:alpha=
".5"
android:background=
"?colorSurface"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/selector_text"
/>
<androidx.appcompat.widget.AppCompatTextView
android:id=
"@+id/selector_selection"
gone=
"@{item.selectedEntry == null}"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:paddingStart=
"@dimen/l1"
android:paddingTop=
"@dimen/l_75"
android:paddingEnd=
"@dimen/l1"
android:paddingBottom=
"@dimen/l_75"
android:text=
"@{item.selectedEntry}"
android:textAppearance=
"@style/AppearanceFoundation.Tiny.Variant"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintStart_toStartOf=
"@+id/selector_text"
app:layout_constraintTop_toTopOf=
"@+id/selector_divider"
tools:text=
"@tools:sample/lorem"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</com.google.android.material.card.MaterialCardView>
</layout>
\ No newline at end of file
</layout>
app/src/main/res/layout/item_settings_toggle.xml
View file @
87b6bf2c
...
...
@@ -31,7 +31,7 @@
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
>
<
androidx.appcompat.widget.AppCompat
ImageView
<ImageView
android:id=
"@+id/toggle_icon"
style=
"@style/WidgetFoundation.Icon"
gone=
"@{item.icon == 0}"
...
...
@@ -42,11 +42,10 @@
app:srcCompat=
"@{item.icon}"
tools:srcCompat=
"@drawable/ic_fingerprint"
/>
<
androidx.appcompat.widget.AppCompatImageView
<
com.google.android.material.switchmaterial.SwitchMaterial
android:id=
"@+id/toggle_indicator"
style=
"@style/WidgetFoundation.Switch
"
android:checked=
"@={item.value}
"
isEnabled=
"@{item.enabled}"
isSelected=
"@{item.value}"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginEnd=
"@dimen/l_25"
...
...
@@ -68,7 +67,7 @@
app:layout_constraintStart_toEndOf=
"@+id/toggle_icon"
app:layout_constraintTop_toTopOf=
"parent"
>
<
androidx.appcompat.widget.AppCompat
TextView
<TextView
android:id=
"@+id/toggle_title"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
...
...
@@ -80,7 +79,7 @@
tools:lines=
"1"
tools:text=
"@tools:sample/lorem/random"
/>
<
androidx.appcompat.widget.AppCompat
TextView
<TextView
android:id=
"@+id/toggle_description"
gone=
"@{item.description.empty}"
android:layout_width=
"match_parent"
...
...
@@ -96,4 +95,4 @@
</com.google.android.material.card.MaterialCardView>
</layout>
\ No newline at end of file
</layout>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment