mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-12-25 09:57:39 +00:00
Updated toolbar layout to match the new aesthetic
This commit is contained in:
parent
fdfa037dca
commit
b512528148
@ -5,6 +5,7 @@ import android.Manifest.permission.WRITE_EXTERNAL_STORAGE
|
|||||||
import android.content.res.Resources
|
import android.content.res.Resources
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import android.os.Handler
|
import android.os.Handler
|
||||||
|
import android.view.MenuItem
|
||||||
import androidx.core.os.postDelayed
|
import androidx.core.os.postDelayed
|
||||||
import androidx.databinding.ObservableArrayList
|
import androidx.databinding.ObservableArrayList
|
||||||
import com.topjohnwu.magisk.BR
|
import com.topjohnwu.magisk.BR
|
||||||
@ -86,7 +87,14 @@ class FlashViewModel(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun savePressed() = withPermissions(READ_EXTERNAL_STORAGE, WRITE_EXTERNAL_STORAGE)
|
fun onMenuItemClicked(item: MenuItem): Boolean {
|
||||||
|
when (item.itemId) {
|
||||||
|
R.id.action_save -> savePressed()
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun savePressed() = withPermissions(READ_EXTERNAL_STORAGE, WRITE_EXTERNAL_STORAGE)
|
||||||
.map { now }
|
.map { now }
|
||||||
.map { it.toTime(timeFormatStandard) }
|
.map { it.toTime(timeFormatStandard) }
|
||||||
.map { Const.MAGISK_INSTALL_LOG_FILENAME.format(it) }
|
.map { Const.MAGISK_INSTALL_LOG_FILENAME.format(it) }
|
||||||
|
@ -18,78 +18,38 @@
|
|||||||
<com.google.android.material.appbar.AppBarLayout
|
<com.google.android.material.appbar.AppBarLayout
|
||||||
style="@style/WidgetFoundation.Appbar"
|
style="@style/WidgetFoundation.Appbar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingLeft="@{viewModel.insets.left}"
|
||||||
<!--todo(diareuse) replace this with menus and navigation icon like a normal human being-->
|
android:paddingRight="@{viewModel.insets.right}">
|
||||||
|
|
||||||
<com.google.android.material.appbar.MaterialToolbar
|
<com.google.android.material.appbar.MaterialToolbar
|
||||||
style="@style/WidgetFoundation.Toolbar"
|
style="@style/WidgetFoundation.Toolbar"
|
||||||
|
onMenuClick="@{(item) -> viewModel.onMenuItemClicked(item)}"
|
||||||
|
onNavigationClick="@{() -> viewModel.backPressed()}"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:minHeight="?attr/actionBarSize"
|
android:minHeight="?attr/actionBarSize"
|
||||||
|
android:paddingTop="@{viewModel.insets.top}"
|
||||||
app:contentInsetLeft="0dp"
|
app:contentInsetLeft="0dp"
|
||||||
app:contentInsetStart="0dp"
|
app:contentInsetStart="0dp"
|
||||||
app:layout_scrollFlags="scroll|enterAlways">
|
app:menu="@menu/menu_flash"
|
||||||
|
app:navigationIcon="@drawable/ic_back_md2">
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
|
style="@style/Widget.Text.Emphasize"
|
||||||
|
movieBehavior="@{viewModel.loading}"
|
||||||
|
movieBehaviorText="@{viewModel.behaviorText}"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="?attr/actionBarSize"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="@{viewModel.insets.left}"
|
android:layout_gravity="center"
|
||||||
android:layout_marginTop="@{viewModel.insets.top}"
|
android:fontFamily="monospace"
|
||||||
android:layout_marginRight="@{viewModel.insets.right}"
|
android:gravity="center"
|
||||||
android:animateLayoutChanges="true">
|
android:textColor="?colorOnSurface"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
<FrameLayout
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
invisibleScale="@{viewModel.loading}"
|
app:layout_constraintRight_toRightOf="parent"
|
||||||
android:layout_width="0dp"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
android:layout_height="match_parent"
|
tools:text="Flashing..." />
|
||||||
android:background="?attr/selectableItemBackgroundBorderless"
|
|
||||||
android:onClick="@{() -> viewModel.backPressed()}"
|
|
||||||
app:layout_constraintDimensionRatio="1:1"
|
|
||||||
app:layout_constraintLeft_toLeftOf="parent">
|
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatImageView
|
|
||||||
style="@style/Widget.Icon"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:background="@android:color/transparent"
|
|
||||||
app:srcCompat="@drawable/ic_back"
|
|
||||||
app:tint="?colorOnSurface" />
|
|
||||||
|
|
||||||
</FrameLayout>
|
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatTextView
|
|
||||||
style="@style/Widget.Text.Emphasize"
|
|
||||||
movieBehavior="@{viewModel.loading}"
|
|
||||||
movieBehaviorText="@{viewModel.behaviorText}"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:fontFamily="monospace"
|
|
||||||
android:textColor="?colorOnSurface"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintLeft_toLeftOf="parent"
|
|
||||||
app:layout_constraintRight_toRightOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
|
||||||
tools:text="Flashing..." />
|
|
||||||
|
|
||||||
<FrameLayout
|
|
||||||
invisibleScale="@{viewModel.loading}"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:background="?attr/selectableItemBackgroundBorderless"
|
|
||||||
android:onClick="@{() -> viewModel.savePressed()}"
|
|
||||||
app:layout_constraintDimensionRatio="1:1"
|
|
||||||
app:layout_constraintRight_toRightOf="parent">
|
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatImageView
|
|
||||||
style="@style/Widget.Icon"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:background="@android:color/transparent"
|
|
||||||
app:srcCompat="@drawable/ic_save_compat"
|
|
||||||
app:tint="?colorOnSurface" />
|
|
||||||
|
|
||||||
</FrameLayout>
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
||||||
|
|
||||||
</com.google.android.material.appbar.MaterialToolbar>
|
</com.google.android.material.appbar.MaterialToolbar>
|
||||||
|
|
||||||
@ -109,10 +69,10 @@
|
|||||||
android:paddingBottom="@{viewModel.insets.bottom}"
|
android:paddingBottom="@{viewModel.insets.bottom}"
|
||||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
||||||
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
||||||
tools:listitem="@layout/item_console" />
|
tools:listitem="@layout/item_console_md2" />
|
||||||
|
|
||||||
<com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
|
<com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
|
||||||
invisibleScale="@{!viewModel.loaded || !viewModel.canShowReboot}"
|
gone="@{!viewModel.loaded || !viewModel.canShowReboot}"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="bottom|end"
|
android:layout_gravity="bottom|end"
|
||||||
|
9
app/src/main/res/menu/menu_flash.xml
Normal file
9
app/src/main/res/menu/menu_flash.xml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
|
<item
|
||||||
|
android:id="@+id/action_save"
|
||||||
|
android:icon="@drawable/ic_save_md2"
|
||||||
|
android:title="@string/menuSaveLog"
|
||||||
|
app:showAsAction="always" />
|
||||||
|
</menu>
|
Loading…
x
Reference in New Issue
Block a user