updating the remaining activity styles
This commit is contained in:
parent
a0d498d79f
commit
f246bca4b8
8 changed files with 264 additions and 177 deletions
|
@ -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) {
|
||||
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 super.onOptionsItemSelected(item)
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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
|
||||
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)
|
||||
}
|
||||
|
||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||
when (item.itemId) {
|
||||
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 super.onOptionsItemSelected(item)
|
||||
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() {
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -1,11 +1,32 @@
|
|||
<?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.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:layout_behavior="@string/appbar_scrolling_view_behavior">
|
||||
|
||||
<com.theartofdev.edmodo.cropper.CropImageView
|
||||
android:id="@+id/crop_image_view"
|
||||
android:layout_width="match_parent"
|
||||
|
@ -18,3 +39,4 @@
|
|||
layout="@layout/bottom_set_wallpaper_actions" />
|
||||
|
||||
</RelativeLayout>
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
|
|
|
@ -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"
|
||||
|
@ -65,4 +65,21 @@
|
|||
android:textColor="@android:color/white"
|
||||
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>
|
||||
|
|
|
@ -1,11 +1,33 @@
|
|||
<?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_coordinator"
|
||||
android:layout_width="match_parent"
|
||||
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/config_holder"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_margin="@dimen/activity_margin">
|
||||
android:layout_margin="@dimen/activity_margin"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/folder_picker_holder"
|
||||
|
@ -120,17 +142,12 @@
|
|||
|
||||
<Button
|
||||
android:id="@+id/config_save"
|
||||
style="@style/MyWidgetConfigSaveStyle"
|
||||
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" />
|
||||
android:text="@string/ok" />
|
||||
|
||||
</RelativeLayout>
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
|
|
Loading…
Reference in a new issue