updating the remaining activity styles

This commit is contained in:
tibbi 2022-07-28 12:40:44 +02:00
parent a0d498d79f
commit f246bca4b8
8 changed files with 264 additions and 177 deletions

View file

@ -6,11 +6,10 @@ import android.content.Intent
import android.graphics.Bitmap
import android.net.Uri
import android.os.Bundle
import android.view.Menu
import android.view.MenuItem
import com.simplemobiletools.commons.dialogs.RadioGroupDialog
import com.simplemobiletools.commons.extensions.checkAppSideloading
import com.simplemobiletools.commons.extensions.toast
import com.simplemobiletools.commons.helpers.NavigationIcon
import com.simplemobiletools.commons.helpers.ensureBackgroundThread
import com.simplemobiletools.commons.helpers.isNougatPlus
import com.simplemobiletools.commons.models.RadioItem
@ -40,6 +39,7 @@ class SetWallpaperActivity : SimpleActivity(), CropImageView.OnCropImageComplete
return
}
setupOptionsMenu()
if (intent.data == null) {
val pickIntent = Intent(applicationContext, MainActivity::class.java)
pickIntent.action = Intent.ACTION_PICK
@ -51,19 +51,31 @@ class SetWallpaperActivity : SimpleActivity(), CropImageView.OnCropImageComplete
handleImage(intent)
}
override fun onCreateOptionsMenu(menu: Menu): Boolean {
menuInflater.inflate(R.menu.menu_set_wallpaper, menu)
updateMenuItemColors(menu)
return true
override fun onResume() {
super.onResume()
setupToolbar(set_wallpaper_toolbar, NavigationIcon.Arrow)
}
override fun onOptionsItemSelected(item: MenuItem): Boolean {
when (item.itemId) {
R.id.save -> confirmWallpaper()
R.id.allow_changing_aspect_ratio -> crop_image_view.clearAspectRatio()
else -> return super.onOptionsItemSelected(item)
override fun onActivityResult(requestCode: Int, resultCode: Int, resultData: Intent?) {
if (requestCode == PICK_IMAGE) {
if (resultCode == Activity.RESULT_OK && resultData != null) {
handleImage(resultData)
} else {
finish()
}
}
super.onActivityResult(requestCode, resultCode, resultData)
}
private fun setupOptionsMenu() {
set_wallpaper_toolbar.setOnMenuItemClickListener { menuItem ->
when (menuItem.itemId) {
R.id.save -> confirmWallpaper()
R.id.allow_changing_aspect_ratio -> crop_image_view.clearAspectRatio()
else -> return@setOnMenuItemClickListener false
}
return@setOnMenuItemClickListener true
}
return true
}
private fun handleImage(intent: Intent) {
@ -158,15 +170,4 @@ class SetWallpaperActivity : SimpleActivity(), CropImageView.OnCropImageComplete
toast("${getString(R.string.image_editing_failed)}: ${result.error.message}")
}
}
override fun onActivityResult(requestCode: Int, resultCode: Int, resultData: Intent?) {
if (requestCode == PICK_IMAGE) {
if (resultCode == Activity.RESULT_OK && resultData != null) {
handleImage(resultData)
} else {
finish()
}
}
super.onActivityResult(requestCode, resultCode, resultData)
}
}

View file

@ -4,7 +4,6 @@ import android.app.Activity
import android.content.Intent
import android.os.Bundle
import android.text.TextUtils
import android.view.Menu
import com.google.gson.Gson
import com.google.gson.reflect.TypeToken
import com.simplemobiletools.commons.dialogs.*
@ -128,11 +127,6 @@ class SettingsActivity : SimpleActivity() {
}
}
override fun onCreateOptionsMenu(menu: Menu): Boolean {
updateMenuItemColors(menu)
return super.onCreateOptionsMenu(menu)
}
override fun onActivityResult(requestCode: Int, resultCode: Int, resultData: Intent?) {
super.onActivityResult(requestCode, resultCode, resultData)
if (requestCode == PICK_IMPORT_SOURCE_INTENT && resultCode == Activity.RESULT_OK && resultData != null && resultData.data != null) {

View file

@ -13,6 +13,7 @@ import android.os.Bundle
import android.os.Handler
import android.util.DisplayMetrics
import android.view.*
import android.widget.RelativeLayout
import android.widget.SeekBar
import com.google.android.exoplayer2.*
import com.google.android.exoplayer2.extractor.DefaultExtractorsFactory
@ -58,8 +59,13 @@ open class VideoPlayerActivity : SimpleActivity(), SeekBar.OnSeekBarChangeListen
private var mIgnoreCloseDown = false
public override fun onCreate(savedInstanceState: Bundle?) {
useDynamicTheme = false
showTransparentTop = true
showTransparentNavigation = true
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_video_player)
setupOptionsMenu()
setupOrientation()
checkNotchSupport()
initPlayer()
@ -105,19 +111,27 @@ open class VideoPlayerActivity : SimpleActivity(), SeekBar.OnSeekBarChangeListen
}
}
override fun onCreateOptionsMenu(menu: Menu): Boolean {
menuInflater.inflate(R.menu.menu_video_player, menu)
return true
}
override fun onOptionsItemSelected(item: MenuItem): Boolean {
when (item.itemId) {
R.id.menu_change_orientation -> changeOrientation()
R.id.menu_open_with -> openPath(mUri!!.toString(), true)
R.id.menu_share -> shareMediumPath(mUri!!.toString())
else -> return super.onOptionsItemSelected(item)
private fun setupOptionsMenu() {
(video_appbar.layoutParams as RelativeLayout.LayoutParams).topMargin = statusBarHeight
video_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)
}
video_toolbar.setOnMenuItemClickListener { menuItem ->
when (menuItem.itemId) {
R.id.menu_change_orientation -> changeOrientation()
R.id.menu_open_with -> openPath(mUri!!.toString(), true)
R.id.menu_share -> shareMediumPath(mUri!!.toString())
else -> return@setOnMenuItemClickListener false
}
return@setOnMenuItemClickListener true
}
video_toolbar.setNavigationOnClickListener {
finish()
}
return true
}
override fun onConfigurationChanged(newConfig: Configuration) {
@ -127,6 +141,12 @@ open class VideoPlayerActivity : SimpleActivity(), SeekBar.OnSeekBarChangeListen
video_surface_frame.onGlobalLayout {
video_surface_frame.controller.resetState()
}
if (!portrait && navigationBarRight && navigationBarWidth > 0) {
video_toolbar.setPadding(0, 0, navigationBarWidth, 0)
} else {
video_toolbar.setPadding(0, 0, 0, 0)
}
}
private fun setupOrientation() {
@ -141,7 +161,7 @@ open class VideoPlayerActivity : SimpleActivity(), SeekBar.OnSeekBarChangeListen
private fun initPlayer() {
mUri = intent.data ?: return
supportActionBar?.title = getFilenameFromUri(mUri!!)
video_toolbar.title = getFilenameFromUri(mUri!!)
initTimeHolder()
showSystemUI(true)
@ -459,6 +479,12 @@ open class VideoPlayerActivity : SimpleActivity(), SeekBar.OnSeekBarChangeListen
arrayOf(video_prev_file, video_next_file, video_curr_time, video_duration).forEach {
it.isClickable = !mIsFullscreen
}
video_appbar.animate().alpha(newAlpha).withStartAction {
video_appbar.beVisible()
}.withEndAction {
video_appbar.beVisibleIf(newAlpha == 1f)
}.start()
}
private fun initTimeHolder() {

View file

@ -836,6 +836,8 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
if (!portrait && navigationBarRight && navigationBarWidth > 0) {
medium_viewer_toolbar.setPadding(0, 0, navigationBarWidth, 0)
} else {
medium_viewer_toolbar.setPadding(0, 0, 0, 0)
}
}

View file

@ -3,6 +3,7 @@ package com.simplemobiletools.gallery.pro.activities
import android.app.Activity
import android.appwidget.AppWidgetManager
import android.content.Intent
import android.content.res.ColorStateList
import android.graphics.Color
import android.graphics.drawable.ColorDrawable
import android.os.Bundle
@ -69,6 +70,11 @@ class WidgetConfigureActivity : SimpleActivity() {
}
}
override fun onResume() {
super.onResume()
setupToolbar(config_toolbar)
}
private fun initVariables() {
mBgColor = config.widgetBgColor
mBgAlpha = Color.alpha(mBgColor) / 255f
@ -126,11 +132,13 @@ class WidgetConfigureActivity : SimpleActivity() {
mBgColor = mBgColorWithoutTransparency.adjustAlpha(mBgAlpha)
config_image_holder.background.applyColorFilter(mBgColor)
config_bg_color.setFillWithStroke(mBgColor, mBgColor)
config_save.backgroundTintList = ColorStateList.valueOf(getProperPrimaryColor())
}
private fun updateTextColor() {
config_folder_name.setTextColor(mTextColor)
config_text_color.setFillWithStroke(mTextColor, mTextColor)
config_save.setTextColor(getProperPrimaryColor().getContrastColor())
}
private fun pickBackgroundColor() {

View file

@ -1,20 +1,42 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/activity_set_wallpaper_holder"
android:id="@+id/set_wallpaper_coordinator"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.theartofdev.edmodo.cropper.CropImageView
android:id="@+id/crop_image_view"
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/set_wallpaper_app_bar_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/set_wallpaper_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@color/color_primary"
app:menu="@menu/menu_set_wallpaper"
app:title="@string/simple_wallpaper"
app:titleTextAppearance="@style/AppTheme.ActionBar.TitleTextStyle" />
</com.google.android.material.appbar.AppBarLayout>
<RelativeLayout
android:id="@+id/activity_set_wallpaper_holder"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:cropBackgroundColor="@color/crop_image_view_background"
app:cropInitialCropWindowPaddingRatio="0"/>
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<include
android:id="@+id/bottom_set_wallpaper_actions"
layout="@layout/bottom_set_wallpaper_actions"/>
<com.theartofdev.edmodo.cropper.CropImageView
android:id="@+id/crop_image_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:cropBackgroundColor="@color/crop_image_view_background"
app:cropInitialCropWindowPaddingRatio="0" />
</RelativeLayout>
<include
android:id="@+id/bottom_set_wallpaper_actions"
layout="@layout/bottom_set_wallpaper_actions" />
</RelativeLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/video_player_holder"
android:layout_width="match_parent"
@ -15,7 +15,7 @@
android:id="@+id/video_surface"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerInParent="true"/>
android:layout_centerInParent="true" />
</com.alexvasilkov.gestures.GestureFrameLayout>
@ -23,19 +23,19 @@
android:id="@+id/video_volume_controller"
android:layout_width="@dimen/media_side_slider_width"
android:layout_height="match_parent"
android:layout_alignParentEnd="true"/>
android:layout_alignParentEnd="true" />
<com.simplemobiletools.gallery.pro.views.MediaSideScroll
android:id="@+id/video_brightness_controller"
android:layout_width="@dimen/media_side_slider_width"
android:layout_height="match_parent"/>
android:layout_height="match_parent" />
<ImageView
android:id="@+id/top_shadow"
android:layout_width="match_parent"
android:layout_height="@dimen/default_status_action_height"
android:background="@drawable/gradient_background_flipped"
android:contentDescription="@null"/>
android:contentDescription="@null" />
<TextView
android:id="@+id/video_bottom_gradient"
@ -44,9 +44,9 @@
android:layout_alignTop="@+id/video_time_holder"
android:layout_alignParentBottom="true"
android:background="@drawable/gradient_background"
tools:ignore="UnknownIdInLayout"/>
tools:ignore="UnknownIdInLayout" />
<include layout="@layout/bottom_video_time_holder"/>
<include layout="@layout/bottom_video_time_holder" />
<TextView
android:id="@+id/slide_info"
@ -63,6 +63,23 @@
android:paddingRight="@dimen/activity_margin"
android:paddingBottom="@dimen/medium_margin"
android:textColor="@android:color/white"
android:textSize="@dimen/extra_big_text_size"/>
android:textSize="@dimen/extra_big_text_size" />
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/video_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/video_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:menu="@menu/menu_video_player"
app:navigationIcon="@drawable/ic_arrow_left_vector" />
</com.google.android.material.appbar.AppBarLayout>
</RelativeLayout>

View file

@ -1,136 +1,153 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/config_holder"
android:id="@+id/config_coordinator"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_margin="@dimen/activity_margin">
android:layout_height="match_parent">
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/config_app_bar_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/config_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@color/color_primary"
app:title="@string/app_launcher_name"
app:titleTextAppearance="@style/AppTheme.ActionBar.TitleTextStyle" />
</com.google.android.material.appbar.AppBarLayout>
<RelativeLayout
android:id="@+id/folder_picker_holder"
android:id="@+id/config_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="@dimen/activity_margin">
android:layout_centerHorizontal="true"
android:layout_margin="@dimen/activity_margin"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<RelativeLayout
android:id="@+id/folder_picker_show_folder_name_holder"
style="@style/SettingsHolderCheckboxStyle"
android:id="@+id/folder_picker_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground">
android:paddingBottom="@dimen/activity_margin">
<com.simplemobiletools.commons.views.MyAppCompatCheckbox
android:id="@+id/folder_picker_show_folder_name"
style="@style/SettingsCheckboxStyle"
<RelativeLayout
android:id="@+id/folder_picker_show_folder_name_holder"
style="@style/SettingsHolderCheckboxStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/show_folder_name" />
android:background="?attr/selectableItemBackground">
<com.simplemobiletools.commons.views.MyAppCompatCheckbox
android:id="@+id/folder_picker_show_folder_name"
style="@style/SettingsCheckboxStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/show_folder_name" />
</RelativeLayout>
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/folder_picker_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/folder_picker_show_folder_name_holder"
android:layout_marginTop="@dimen/small_margin"
android:layout_marginBottom="@dimen/normal_margin"
android:paddingStart="@dimen/activity_margin"
android:text="@string/folder_on_widget" />
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/folder_picker_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/folder_picker_label"
android:layout_marginStart="@dimen/activity_margin"
android:background="@drawable/button_background"
android:padding="@dimen/normal_margin"
tools:text="@string/internal" />
</RelativeLayout>
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/folder_picker_label"
<RelativeLayout
android:id="@+id/config_image_holder"
android:layout_width="160dp"
android:layout_height="wrap_content"
android:layout_below="@+id/folder_picker_holder"
android:layout_marginTop="@dimen/activity_margin"
android:background="@drawable/widget_round_background">
<com.simplemobiletools.commons.views.MySquareImageView
android:id="@+id/config_image"
android:layout_width="@dimen/widget_initial_size"
android:layout_height="@dimen/widget_initial_size"
android:layout_centerHorizontal="true"
android:layout_marginStart="@dimen/normal_margin"
android:layout_marginTop="@dimen/small_margin"
android:layout_marginEnd="@dimen/normal_margin"
android:layout_marginBottom="@dimen/small_margin" />
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/config_folder_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/config_image"
android:ellipsize="end"
android:gravity="center"
android:includeFontPadding="false"
android:lines="1"
android:paddingBottom="@dimen/small_margin"
android:textSize="@dimen/bigger_text_size"
tools:text="@string/internal" />
</RelativeLayout>
<ImageView
android:id="@+id/config_bg_color"
android:layout_width="@dimen/widget_colorpicker_size"
android:layout_height="@dimen/widget_colorpicker_size"
android:layout_above="@+id/config_text_color"
android:layout_margin="@dimen/tiny_margin" />
<RelativeLayout
android:id="@+id/config_bg_seekbar_holder"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignTop="@+id/config_bg_color"
android:layout_alignBottom="@+id/config_bg_color"
android:layout_marginStart="@dimen/medium_margin"
android:layout_toEndOf="@+id/config_bg_color"
android:background="@drawable/widget_config_seekbar_background">
<com.simplemobiletools.commons.views.MySeekBar
android:id="@+id/config_bg_seekbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:paddingLeft="@dimen/activity_margin"
android:paddingRight="@dimen/activity_margin" />
</RelativeLayout>
<ImageView
android:id="@+id/config_text_color"
android:layout_width="@dimen/widget_colorpicker_size"
android:layout_height="@dimen/widget_colorpicker_size"
android:layout_alignParentBottom="true"
android:layout_margin="@dimen/tiny_margin" />
<Button
android:id="@+id/config_save"
style="@style/MyWidgetConfigSaveStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/folder_picker_show_folder_name_holder"
android:layout_marginTop="@dimen/small_margin"
android:layout_marginBottom="@dimen/normal_margin"
android:paddingStart="@dimen/activity_margin"
android:text="@string/folder_on_widget" />
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/folder_picker_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/folder_picker_label"
android:layout_marginStart="@dimen/activity_margin"
android:background="@drawable/button_background"
android:padding="@dimen/normal_margin"
tools:text="@string/internal" />
android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true"
android:text="@string/ok" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/config_image_holder"
android:layout_width="160dp"
android:layout_height="wrap_content"
android:layout_below="@+id/folder_picker_holder"
android:layout_marginTop="@dimen/activity_margin"
android:background="@drawable/widget_round_background">
<com.simplemobiletools.commons.views.MySquareImageView
android:id="@+id/config_image"
android:layout_width="@dimen/widget_initial_size"
android:layout_height="@dimen/widget_initial_size"
android:layout_centerHorizontal="true"
android:layout_marginStart="@dimen/normal_margin"
android:layout_marginTop="@dimen/small_margin"
android:layout_marginEnd="@dimen/normal_margin"
android:layout_marginBottom="@dimen/small_margin" />
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/config_folder_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/config_image"
android:ellipsize="end"
android:gravity="center"
android:includeFontPadding="false"
android:lines="1"
android:paddingBottom="@dimen/small_margin"
android:textSize="@dimen/bigger_text_size"
tools:text="@string/internal" />
</RelativeLayout>
<ImageView
android:id="@+id/config_bg_color"
android:layout_width="@dimen/widget_colorpicker_size"
android:layout_height="@dimen/widget_colorpicker_size"
android:layout_above="@+id/config_text_color"
android:layout_margin="@dimen/tiny_margin" />
<RelativeLayout
android:id="@+id/config_bg_seekbar_holder"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignTop="@+id/config_bg_color"
android:layout_alignBottom="@+id/config_bg_color"
android:layout_marginStart="@dimen/medium_margin"
android:layout_toEndOf="@+id/config_bg_color"
android:background="@drawable/widget_config_seekbar_background">
<com.simplemobiletools.commons.views.MySeekBar
android:id="@+id/config_bg_seekbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:paddingLeft="@dimen/activity_margin"
android:paddingRight="@dimen/activity_margin" />
</RelativeLayout>
<ImageView
android:id="@+id/config_text_color"
android:layout_width="@dimen/widget_colorpicker_size"
android:layout_height="@dimen/widget_colorpicker_size"
android:layout_alignParentBottom="true"
android:layout_margin="@dimen/tiny_margin" />
<Button
android:id="@+id/config_save"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true"
android:background="@drawable/widget_config_seekbar_background"
android:fontFamily="sans-serif-light"
android:paddingLeft="@dimen/activity_margin"
android:paddingRight="@dimen/activity_margin"
android:text="@string/ok"
android:textColor="@color/dark_grey"
android:textFontWeight="400"
android:textSize="@dimen/big_text_size" />
</RelativeLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>