add "Set as" as an available bottom action at the fullscreen view
This commit is contained in:
parent
759de4e818
commit
3186d27d12
12 changed files with 55 additions and 17 deletions
|
@ -48,8 +48,6 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList
|
||||||
finish()
|
finish()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
initBottomActions()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
|
@ -88,14 +86,15 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList
|
||||||
showSystemUI(true)
|
showSystemUI(true)
|
||||||
val bundle = Bundle()
|
val bundle = Bundle()
|
||||||
val file = File(mUri.toString())
|
val file = File(mUri.toString())
|
||||||
|
val filename = getFilenameFromUri(mUri!!)
|
||||||
val type = when {
|
val type = when {
|
||||||
file.isImageFast() -> TYPE_IMAGES
|
filename.isImageFast() -> TYPE_IMAGES
|
||||||
file.isVideoFast() -> TYPE_VIDEOS
|
filename.isVideoFast() -> TYPE_VIDEOS
|
||||||
file.isGif() -> TYPE_GIFS
|
filename.isGif() -> TYPE_GIFS
|
||||||
else -> TYPE_RAWS
|
else -> TYPE_RAWS
|
||||||
}
|
}
|
||||||
|
|
||||||
mMedium = Medium(null, getFilenameFromUri(mUri!!), mUri.toString(), mUri!!.path.getParentPath(), 0, 0, file.length(), type, false, 0L)
|
mMedium = Medium(null, filename, mUri.toString(), mUri!!.path.getParentPath(), 0, 0, file.length(), type, false, 0L)
|
||||||
supportActionBar?.title = mMedium!!.name
|
supportActionBar?.title = mMedium!!.name
|
||||||
bundle.putSerializable(MEDIUM, mMedium)
|
bundle.putSerializable(MEDIUM, mMedium)
|
||||||
|
|
||||||
|
@ -114,6 +113,8 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList
|
||||||
val isFullscreen = visibility and View.SYSTEM_UI_FLAG_FULLSCREEN != 0
|
val isFullscreen = visibility and View.SYSTEM_UI_FLAG_FULLSCREEN != 0
|
||||||
mFragment?.fullscreenToggled(isFullscreen)
|
mFragment?.fullscreenToggled(isFullscreen)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
initBottomActions()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onConfigurationChanged(newConfig: Configuration?) {
|
override fun onConfigurationChanged(newConfig: Configuration?) {
|
||||||
|
@ -132,12 +133,13 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList
|
||||||
|
|
||||||
override fun onCreateOptionsMenu(menu: Menu): Boolean {
|
override fun onCreateOptionsMenu(menu: Menu): Boolean {
|
||||||
menuInflater.inflate(R.menu.photo_video_menu, menu)
|
menuInflater.inflate(R.menu.photo_video_menu, menu)
|
||||||
|
val visibleBottomActions = if (config.bottomActions) config.visibleBottomActions else 0
|
||||||
|
|
||||||
menu.apply {
|
menu.apply {
|
||||||
findItem(R.id.menu_set_as).isVisible = mMedium?.isImage() == true
|
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" && !config.bottomActions
|
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"
|
findItem(R.id.menu_properties).isVisible = mUri?.scheme == "file" && visibleBottomActions and BOTTOM_ACTION_PROPERTIES == 0
|
||||||
findItem(R.id.menu_share).isVisible = !config.bottomActions
|
findItem(R.id.menu_share).isVisible = visibleBottomActions and BOTTOM_ACTION_SHARE == 0
|
||||||
}
|
}
|
||||||
|
|
||||||
return true
|
return true
|
||||||
|
@ -183,7 +185,7 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList
|
||||||
}
|
}
|
||||||
|
|
||||||
val visibleBottomActions = if (config.bottomActions) config.visibleBottomActions else 0
|
val visibleBottomActions = if (config.bottomActions) config.visibleBottomActions else 0
|
||||||
bottom_edit.beVisibleIf(visibleBottomActions and BOTTOM_ACTION_EDIT != 0)
|
bottom_edit.beVisibleIf(visibleBottomActions and BOTTOM_ACTION_EDIT != 0 && mMedium?.isImage() == true)
|
||||||
bottom_edit.setOnClickListener {
|
bottom_edit.setOnClickListener {
|
||||||
if (mUri != null && bottom_actions.alpha == 1f) {
|
if (mUri != null && bottom_actions.alpha == 1f) {
|
||||||
openEditor(mUri!!.toString())
|
openEditor(mUri!!.toString())
|
||||||
|
@ -196,6 +198,11 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList
|
||||||
sharePath(mUri!!.toString())
|
sharePath(mUri!!.toString())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bottom_set_as.beVisibleIf(visibleBottomActions and BOTTOM_ACTION_SET_AS != 0 && mMedium?.isImage() == true)
|
||||||
|
bottom_set_as.setOnClickListener {
|
||||||
|
setAs(mUri!!.toString())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun fragmentClicked() {
|
override fun fragmentClicked() {
|
||||||
|
|
|
@ -296,6 +296,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
|
||||||
findItem(R.id.menu_edit).isVisible = visibleBottomActions and BOTTOM_ACTION_EDIT == 0
|
findItem(R.id.menu_edit).isVisible = visibleBottomActions and BOTTOM_ACTION_EDIT == 0
|
||||||
findItem(R.id.menu_rename).isVisible = visibleBottomActions and BOTTOM_ACTION_RENAME == 0
|
findItem(R.id.menu_rename).isVisible = visibleBottomActions and BOTTOM_ACTION_RENAME == 0
|
||||||
findItem(R.id.menu_rotate).isVisible = currentMedium.isImage() && visibleBottomActions and BOTTOM_ACTION_ROTATE == 0
|
findItem(R.id.menu_rotate).isVisible = currentMedium.isImage() && visibleBottomActions and BOTTOM_ACTION_ROTATE == 0
|
||||||
|
findItem(R.id.menu_set_as).isVisible = visibleBottomActions and BOTTOM_ACTION_SET_AS == 0
|
||||||
findItem(R.id.menu_save_as).isVisible = mRotationDegrees != 0
|
findItem(R.id.menu_save_as).isVisible = mRotationDegrees != 0
|
||||||
findItem(R.id.menu_hide).isVisible = !currentMedium.isHidden() && visibleBottomActions and BOTTOM_ACTION_TOGGLE_VISIBILITY == 0
|
findItem(R.id.menu_hide).isVisible = !currentMedium.isHidden() && visibleBottomActions and BOTTOM_ACTION_TOGGLE_VISIBILITY == 0
|
||||||
findItem(R.id.menu_unhide).isVisible = currentMedium.isHidden() && visibleBottomActions and BOTTOM_ACTION_TOGGLE_VISIBILITY == 0
|
findItem(R.id.menu_unhide).isVisible = currentMedium.isHidden() && visibleBottomActions and BOTTOM_ACTION_TOGGLE_VISIBILITY == 0
|
||||||
|
@ -842,6 +843,11 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
|
||||||
bottom_rename.setOnClickListener {
|
bottom_rename.setOnClickListener {
|
||||||
renameFile()
|
renameFile()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bottom_set_as.beVisibleIf(visibleBottomActions and BOTTOM_ACTION_SET_AS != 0)
|
||||||
|
bottom_set_as.setOnClickListener {
|
||||||
|
setAs(getCurrentPath())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun updateBottomActionIcons(medium: Medium?) {
|
private fun updateBottomActionIcons(medium: Medium?) {
|
||||||
|
|
|
@ -25,6 +25,7 @@ class ManageBottomActionsDialog(val activity: BaseSimpleActivity, val callback:
|
||||||
manage_bottom_actions_show_on_map.isChecked = actions and BOTTOM_ACTION_SHOW_ON_MAP != 0
|
manage_bottom_actions_show_on_map.isChecked = actions and BOTTOM_ACTION_SHOW_ON_MAP != 0
|
||||||
manage_bottom_actions_toggle_visibility.isChecked = actions and BOTTOM_ACTION_TOGGLE_VISIBILITY != 0
|
manage_bottom_actions_toggle_visibility.isChecked = actions and BOTTOM_ACTION_TOGGLE_VISIBILITY != 0
|
||||||
manage_bottom_actions_rename.isChecked = actions and BOTTOM_ACTION_RENAME != 0
|
manage_bottom_actions_rename.isChecked = actions and BOTTOM_ACTION_RENAME != 0
|
||||||
|
manage_bottom_actions_set_as.isChecked = actions and BOTTOM_ACTION_SET_AS != 0
|
||||||
}
|
}
|
||||||
|
|
||||||
AlertDialog.Builder(activity)
|
AlertDialog.Builder(activity)
|
||||||
|
@ -60,6 +61,8 @@ class ManageBottomActionsDialog(val activity: BaseSimpleActivity, val callback:
|
||||||
result += BOTTOM_ACTION_TOGGLE_VISIBILITY
|
result += BOTTOM_ACTION_TOGGLE_VISIBILITY
|
||||||
if (manage_bottom_actions_rename.isChecked)
|
if (manage_bottom_actions_rename.isChecked)
|
||||||
result += BOTTOM_ACTION_RENAME
|
result += BOTTOM_ACTION_RENAME
|
||||||
|
if (manage_bottom_actions_set_as.isChecked)
|
||||||
|
result += BOTTOM_ACTION_SET_AS
|
||||||
}
|
}
|
||||||
|
|
||||||
activity.config.visibleBottomActions = result
|
activity.config.visibleBottomActions = result
|
||||||
|
|
|
@ -144,5 +144,6 @@ const val BOTTOM_ACTION_SLIDESHOW = 128
|
||||||
const val BOTTOM_ACTION_SHOW_ON_MAP = 256
|
const val BOTTOM_ACTION_SHOW_ON_MAP = 256
|
||||||
const val BOTTOM_ACTION_TOGGLE_VISIBILITY = 512
|
const val BOTTOM_ACTION_TOGGLE_VISIBILITY = 512
|
||||||
const val BOTTOM_ACTION_RENAME = 1024
|
const val BOTTOM_ACTION_RENAME = 1024
|
||||||
|
const val BOTTOM_ACTION_SET_AS = 2048
|
||||||
|
|
||||||
const val DEFAULT_BOTTOM_ACTIONS = BOTTOM_ACTION_TOGGLE_FAVORITE or BOTTOM_ACTION_EDIT or BOTTOM_ACTION_SHARE or BOTTOM_ACTION_DELETE
|
const val DEFAULT_BOTTOM_ACTIONS = BOTTOM_ACTION_TOGGLE_FAVORITE or BOTTOM_ACTION_EDIT or BOTTOM_ACTION_SHARE or BOTTOM_ACTION_DELETE
|
||||||
|
|
BIN
app/src/main/res/drawable-hdpi/ic_set_as.png
Normal file
BIN
app/src/main/res/drawable-hdpi/ic_set_as.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 301 B |
BIN
app/src/main/res/drawable-xhdpi/ic_set_as.png
Normal file
BIN
app/src/main/res/drawable-xhdpi/ic_set_as.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 413 B |
BIN
app/src/main/res/drawable-xxhdpi/ic_set_as.png
Normal file
BIN
app/src/main/res/drawable-xxhdpi/ic_set_as.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 509 B |
BIN
app/src/main/res/drawable-xxxhdpi/ic_set_as.png
Normal file
BIN
app/src/main/res/drawable-xxxhdpi/ic_set_as.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 670 B |
|
@ -126,8 +126,19 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:padding="@dimen/medium_margin"
|
android:padding="@dimen/medium_margin"
|
||||||
android:src="@drawable/ic_rename_new"
|
android:src="@drawable/ic_rename_new"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="@+id/bottom_set_as"
|
||||||
app:layout_constraintHorizontal_bias="0.5"
|
app:layout_constraintHorizontal_bias="0.5"
|
||||||
app:layout_constraintStart_toEndOf="@+id/bottom_toggle_file_visibility"/>
|
app:layout_constraintStart_toEndOf="@+id/bottom_toggle_file_visibility"/>
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/bottom_set_as"
|
||||||
|
style="@style/MyBorderlessBackgroundStyle"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:padding="@dimen/medium_margin"
|
||||||
|
android:src="@drawable/ic_set_as"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintHorizontal_bias="0.5"
|
||||||
|
app:layout_constraintStart_toEndOf="@+id/bottom_rename"/>
|
||||||
|
|
||||||
</android.support.constraint.ConstraintLayout>
|
</android.support.constraint.ConstraintLayout>
|
||||||
|
|
|
@ -102,5 +102,13 @@
|
||||||
android:paddingTop="@dimen/activity_margin"
|
android:paddingTop="@dimen/activity_margin"
|
||||||
android:text="@string/rename"/>
|
android:text="@string/rename"/>
|
||||||
|
|
||||||
|
<com.simplemobiletools.commons.views.MyAppCompatCheckbox
|
||||||
|
android:id="@+id/manage_bottom_actions_set_as"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingBottom="@dimen/activity_margin"
|
||||||
|
android:paddingTop="@dimen/activity_margin"
|
||||||
|
android:text="@string/set_as"/>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
|
|
|
@ -73,10 +73,6 @@
|
||||||
android:id="@+id/menu_move_to"
|
android:id="@+id/menu_move_to"
|
||||||
android:title="@string/move_to"
|
android:title="@string/move_to"
|
||||||
app:showAsAction="never"/>
|
app:showAsAction="never"/>
|
||||||
<item
|
|
||||||
android:id="@+id/menu_set_as"
|
|
||||||
android:title="@string/set_as"
|
|
||||||
app:showAsAction="never"/>
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/menu_open_with"
|
android:id="@+id/menu_open_with"
|
||||||
android:title="@string/open_with"
|
android:title="@string/open_with"
|
||||||
|
@ -104,6 +100,11 @@
|
||||||
android:icon="@drawable/ic_slideshow"
|
android:icon="@drawable/ic_slideshow"
|
||||||
android:title="@string/slideshow"
|
android:title="@string/slideshow"
|
||||||
app:showAsAction="ifRoom"/>
|
app:showAsAction="ifRoom"/>
|
||||||
|
<item
|
||||||
|
android:id="@+id/menu_set_as"
|
||||||
|
android:icon="@drawable/ic_set_as"
|
||||||
|
android:title="@string/set_as"
|
||||||
|
app:showAsAction="ifRoom"/>
|
||||||
<item
|
<item
|
||||||
android:id="@+id/menu_rename"
|
android:id="@+id/menu_rename"
|
||||||
android:icon="@drawable/ic_rename_new"
|
android:icon="@drawable/ic_rename_new"
|
||||||
|
|
|
@ -18,8 +18,9 @@
|
||||||
app:showAsAction="ifRoom"/>
|
app:showAsAction="ifRoom"/>
|
||||||
<item
|
<item
|
||||||
android:id="@+id/menu_set_as"
|
android:id="@+id/menu_set_as"
|
||||||
|
android:icon="@drawable/ic_set_as"
|
||||||
android:title="@string/set_as"
|
android:title="@string/set_as"
|
||||||
app:showAsAction="never"/>
|
app:showAsAction="ifRoom"/>
|
||||||
<item
|
<item
|
||||||
android:id="@+id/menu_open_with"
|
android:id="@+id/menu_open_with"
|
||||||
android:title="@string/open_with"
|
android:title="@string/open_with"
|
||||||
|
|
Loading…
Reference in a new issue