more styling updates
This commit is contained in:
parent
970eb5a035
commit
a0d498d79f
6 changed files with 65 additions and 71 deletions
|
@ -8,10 +8,8 @@ import android.net.Uri
|
|||
import android.os.Bundle
|
||||
import android.provider.MediaStore
|
||||
import android.text.Html
|
||||
import android.view.Menu
|
||||
import android.view.MenuItem
|
||||
import android.view.View
|
||||
import android.view.WindowInsetsController
|
||||
import android.widget.RelativeLayout
|
||||
import com.simplemobiletools.commons.dialogs.PropertiesDialog
|
||||
import com.simplemobiletools.commons.extensions.*
|
||||
import com.simplemobiletools.commons.helpers.*
|
||||
|
@ -38,6 +36,9 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList
|
|||
var mIsVideo = false
|
||||
|
||||
public override fun onCreate(savedInstanceState: Bundle?) {
|
||||
showTransparentTop = true
|
||||
showTransparentNavigation = true
|
||||
|
||||
if (config.isUsingSystemTheme) {
|
||||
setTheme(R.style.AppTheme_Material)
|
||||
}
|
||||
|
@ -48,6 +49,8 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList
|
|||
return
|
||||
}
|
||||
|
||||
setupOptionsMenu()
|
||||
refreshMenuItems()
|
||||
handlePermission(PERMISSION_WRITE_STORAGE) {
|
||||
if (it) {
|
||||
checkIntent(savedInstanceState)
|
||||
|
@ -56,16 +59,10 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList
|
|||
finish()
|
||||
}
|
||||
}
|
||||
|
||||
if (isRPlus()) {
|
||||
window.insetsController?.setSystemBarsAppearance(0, WindowInsetsController.APPEARANCE_LIGHT_STATUS_BARS)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
supportActionBar?.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT))
|
||||
window.statusBarColor = Color.TRANSPARENT
|
||||
|
||||
if (config.bottomActions) {
|
||||
window.navigationBarColor = Color.TRANSPARENT
|
||||
|
@ -78,37 +75,46 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList
|
|||
}
|
||||
}
|
||||
|
||||
override fun onCreateOptionsMenu(menu: Menu): Boolean {
|
||||
menuInflater.inflate(R.menu.photo_video_menu, menu)
|
||||
private fun refreshMenuItems() {
|
||||
val visibleBottomActions = if (config.bottomActions) config.visibleBottomActions else 0
|
||||
|
||||
menu.apply {
|
||||
fragment_viewer_toolbar.menu.apply {
|
||||
findItem(R.id.menu_set_as).isVisible = mMedium?.isImage() == true && visibleBottomActions and BOTTOM_ACTION_SET_AS == 0
|
||||
findItem(R.id.menu_edit).isVisible = mMedium?.isImage() == true && mUri?.scheme == "file" && visibleBottomActions and BOTTOM_ACTION_EDIT == 0
|
||||
findItem(R.id.menu_properties).isVisible = mUri?.scheme == "file" && visibleBottomActions and BOTTOM_ACTION_PROPERTIES == 0
|
||||
findItem(R.id.menu_share).isVisible = visibleBottomActions and BOTTOM_ACTION_SHARE == 0
|
||||
findItem(R.id.menu_show_on_map).isVisible = visibleBottomActions and BOTTOM_ACTION_SHOW_ON_MAP == 0
|
||||
}
|
||||
|
||||
updateMenuItemColors(menu, forceWhiteIcons = true)
|
||||
return true
|
||||
}
|
||||
|
||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||
private fun setupOptionsMenu() {
|
||||
(fragment_viewer_appbar.layoutParams as RelativeLayout.LayoutParams).topMargin = statusBarHeight
|
||||
fragment_viewer_toolbar.apply {
|
||||
setTitleTextColor(Color.WHITE)
|
||||
overflowIcon = resources.getColoredDrawableWithColor(R.drawable.ic_three_dots_vector, Color.WHITE)
|
||||
navigationIcon = resources.getColoredDrawableWithColor(R.drawable.ic_arrow_left_vector, Color.WHITE)
|
||||
}
|
||||
|
||||
fragment_viewer_toolbar.setOnMenuItemClickListener { menuItem ->
|
||||
if (mMedium == null || mUri == null) {
|
||||
return true
|
||||
return@setOnMenuItemClickListener true
|
||||
}
|
||||
|
||||
when (item.itemId) {
|
||||
when (menuItem.itemId) {
|
||||
R.id.menu_set_as -> setAs(mUri!!.toString())
|
||||
R.id.menu_open_with -> openPath(mUri!!.toString(), true)
|
||||
R.id.menu_share -> sharePath(mUri!!.toString())
|
||||
R.id.menu_edit -> openEditor(mUri!!.toString())
|
||||
R.id.menu_properties -> showProperties()
|
||||
R.id.menu_show_on_map -> showFileOnMap(mUri!!.toString())
|
||||
else -> return super.onOptionsItemSelected(item)
|
||||
else -> return@setOnMenuItemClickListener false
|
||||
}
|
||||
return@setOnMenuItemClickListener true
|
||||
}
|
||||
|
||||
fragment_viewer_toolbar.setNavigationOnClickListener {
|
||||
finish()
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
private fun checkIntent(savedInstanceState: Bundle? = null) {
|
||||
|
@ -201,7 +207,7 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList
|
|||
|
||||
mIsVideo = type == TYPE_VIDEOS
|
||||
mMedium = Medium(null, filename, mUri.toString(), mUri!!.path!!.getParentPath(), 0, 0, file.length(), type, 0, false, 0L, 0)
|
||||
supportActionBar?.title = Html.fromHtml("<font color='${Color.WHITE.toHex()}'>${mMedium!!.name}</font>")
|
||||
fragment_viewer_toolbar.title = Html.fromHtml("<font color='${Color.WHITE.toHex()}'>${mMedium!!.name}</font>")
|
||||
bundle.putSerializable(MEDIUM, mMedium)
|
||||
|
||||
if (savedInstanceState == null) {
|
||||
|
@ -395,6 +401,12 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList
|
|||
if (!bottom_actions.isGone()) {
|
||||
bottom_actions.animate().alpha(newAlpha).start()
|
||||
}
|
||||
|
||||
fragment_viewer_toolbar.animate().alpha(newAlpha).withStartAction {
|
||||
fragment_viewer_toolbar.beVisible()
|
||||
}.withEndAction {
|
||||
fragment_viewer_toolbar.beVisibleIf(newAlpha == 1f)
|
||||
}.start()
|
||||
}
|
||||
|
||||
override fun videoEnded() = false
|
||||
|
|
|
@ -143,7 +143,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
|
|||
invalidateOptionsMenu()
|
||||
|
||||
val filename = getCurrentMedium()?.name ?: mPath.getFilenameFromPath()
|
||||
medium_viewer_toolbar?.title = filename
|
||||
medium_viewer_toolbar.title = filename
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
|
@ -221,6 +221,12 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
|
|||
|
||||
private fun setupOptionsMenu() {
|
||||
(medium_viewer_appbar.layoutParams as RelativeLayout.LayoutParams).topMargin = statusBarHeight
|
||||
medium_viewer_toolbar.apply {
|
||||
setTitleTextColor(Color.WHITE)
|
||||
overflowIcon = resources.getColoredDrawableWithColor(R.drawable.ic_three_dots_vector, Color.WHITE)
|
||||
navigationIcon = resources.getColoredDrawableWithColor(R.drawable.ic_arrow_left_vector, Color.WHITE)
|
||||
}
|
||||
|
||||
medium_viewer_toolbar.setOnMenuItemClickListener { menuItem ->
|
||||
if (getCurrentMedium() == null) {
|
||||
return@setOnMenuItemClickListener true
|
||||
|
|
|
@ -23,64 +23,48 @@
|
|||
android:id="@+id/grouping_dialog_radio_none"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="@dimen/medium_margin"
|
||||
android:paddingBottom="@dimen/medium_margin"
|
||||
android:text="@string/do_not_group_files" />
|
||||
|
||||
<com.simplemobiletools.commons.views.MyCompatRadioButton
|
||||
android:id="@+id/grouping_dialog_radio_last_modified_daily"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="@dimen/medium_margin"
|
||||
android:paddingBottom="@dimen/medium_margin"
|
||||
android:text="@string/by_last_modified_daily" />
|
||||
|
||||
<com.simplemobiletools.commons.views.MyCompatRadioButton
|
||||
android:id="@+id/grouping_dialog_radio_last_modified_monthly"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="@dimen/medium_margin"
|
||||
android:paddingBottom="@dimen/medium_margin"
|
||||
android:text="@string/by_last_modified_monthly" />
|
||||
|
||||
<com.simplemobiletools.commons.views.MyCompatRadioButton
|
||||
android:id="@+id/grouping_dialog_radio_date_taken_daily"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="@dimen/medium_margin"
|
||||
android:paddingBottom="@dimen/medium_margin"
|
||||
android:text="@string/by_date_taken_daily" />
|
||||
|
||||
<com.simplemobiletools.commons.views.MyCompatRadioButton
|
||||
android:id="@+id/grouping_dialog_radio_date_taken_monthly"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="@dimen/medium_margin"
|
||||
android:paddingBottom="@dimen/medium_margin"
|
||||
android:text="@string/by_date_taken_monthly" />
|
||||
|
||||
<com.simplemobiletools.commons.views.MyCompatRadioButton
|
||||
android:id="@+id/grouping_dialog_radio_file_type"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="@dimen/medium_margin"
|
||||
android:paddingBottom="@dimen/medium_margin"
|
||||
android:text="@string/by_file_type" />
|
||||
|
||||
<com.simplemobiletools.commons.views.MyCompatRadioButton
|
||||
android:id="@+id/grouping_dialog_radio_extension"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="@dimen/medium_margin"
|
||||
android:paddingBottom="@dimen/medium_margin"
|
||||
android:text="@string/by_extension" />
|
||||
|
||||
<com.simplemobiletools.commons.views.MyCompatRadioButton
|
||||
android:id="@+id/grouping_dialog_radio_folder"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="@dimen/medium_margin"
|
||||
android:paddingBottom="@dimen/medium_margin"
|
||||
android:text="@string/by_folder" />
|
||||
|
||||
</RadioGroup>
|
||||
|
@ -98,16 +82,12 @@
|
|||
android:id="@+id/grouping_dialog_radio_ascending"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="@dimen/medium_margin"
|
||||
android:paddingBottom="@dimen/medium_margin"
|
||||
android:text="@string/ascending" />
|
||||
|
||||
<com.simplemobiletools.commons.views.MyCompatRadioButton
|
||||
android:id="@+id/grouping_dialog_radio_descending"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="@dimen/medium_margin"
|
||||
android:paddingBottom="@dimen/medium_margin"
|
||||
android:text="@string/descending" />
|
||||
</RadioGroup>
|
||||
|
||||
|
|
|
@ -23,56 +23,42 @@
|
|||
android:id="@+id/sorting_dialog_radio_name"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="@dimen/medium_margin"
|
||||
android:paddingBottom="@dimen/medium_margin"
|
||||
android:text="@string/name" />
|
||||
|
||||
<com.simplemobiletools.commons.views.MyCompatRadioButton
|
||||
android:id="@+id/sorting_dialog_radio_path"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="@dimen/medium_margin"
|
||||
android:paddingBottom="@dimen/medium_margin"
|
||||
android:text="@string/path" />
|
||||
|
||||
<com.simplemobiletools.commons.views.MyCompatRadioButton
|
||||
android:id="@+id/sorting_dialog_radio_size"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="@dimen/medium_margin"
|
||||
android:paddingBottom="@dimen/medium_margin"
|
||||
android:text="@string/size" />
|
||||
|
||||
<com.simplemobiletools.commons.views.MyCompatRadioButton
|
||||
android:id="@+id/sorting_dialog_radio_last_modified"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="@dimen/medium_margin"
|
||||
android:paddingBottom="@dimen/medium_margin"
|
||||
android:text="@string/last_modified" />
|
||||
|
||||
<com.simplemobiletools.commons.views.MyCompatRadioButton
|
||||
android:id="@+id/sorting_dialog_radio_date_taken"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="@dimen/medium_margin"
|
||||
android:paddingBottom="@dimen/medium_margin"
|
||||
android:text="@string/date_taken" />
|
||||
|
||||
<com.simplemobiletools.commons.views.MyCompatRadioButton
|
||||
android:id="@+id/sorting_dialog_radio_random"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="@dimen/medium_margin"
|
||||
android:paddingBottom="@dimen/medium_margin"
|
||||
android:text="@string/random" />
|
||||
|
||||
<com.simplemobiletools.commons.views.MyCompatRadioButton
|
||||
android:id="@+id/sorting_dialog_radio_custom"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="@dimen/medium_margin"
|
||||
android:paddingBottom="@dimen/medium_margin"
|
||||
android:text="@string/custom" />
|
||||
|
||||
</RadioGroup>
|
||||
|
@ -92,16 +78,12 @@
|
|||
android:id="@+id/sorting_dialog_radio_ascending"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="@dimen/medium_margin"
|
||||
android:paddingBottom="@dimen/medium_margin"
|
||||
android:text="@string/ascending" />
|
||||
|
||||
<com.simplemobiletools.commons.views.MyCompatRadioButton
|
||||
android:id="@+id/sorting_dialog_radio_descending"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="@dimen/medium_margin"
|
||||
android:paddingBottom="@dimen/medium_margin"
|
||||
android:text="@string/descending" />
|
||||
</RadioGroup>
|
||||
|
||||
|
|
|
@ -23,16 +23,12 @@
|
|||
android:id="@+id/change_view_type_dialog_radio_grid"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="@dimen/medium_margin"
|
||||
android:paddingBottom="@dimen/medium_margin"
|
||||
android:text="@string/grid" />
|
||||
|
||||
<com.simplemobiletools.commons.views.MyCompatRadioButton
|
||||
android:id="@+id/change_view_type_dialog_radio_list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="@dimen/medium_margin"
|
||||
android:paddingBottom="@dimen/medium_margin"
|
||||
android:text="@string/list" />
|
||||
|
||||
</RadioGroup>
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/fragment_holder"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
@ -21,4 +22,21 @@
|
|||
layout="@layout/bottom_actions"
|
||||
android:visibility="gone" />
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:id="@+id/fragment_viewer_appbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentTop="true"
|
||||
android:background="@android:color/transparent"
|
||||
android:elevation="0dp"
|
||||
app:elevation="0dp">
|
||||
|
||||
<com.google.android.material.appbar.MaterialToolbar
|
||||
android:id="@+id/fragment_viewer_toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
app:menu="@menu/photo_video_menu"
|
||||
app:navigationIcon="@drawable/ic_arrow_left_vector" />
|
||||
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
</RelativeLayout>
|
||||
|
|
Loading…
Reference in a new issue