add the bottom action buttons to third party intent handling activity too
This commit is contained in:
parent
026f80aa20
commit
9aa8f553ca
|
@ -1,6 +1,7 @@
|
|||
package com.simplemobiletools.gallery.activities
|
||||
|
||||
import android.content.Intent
|
||||
import android.content.res.Configuration
|
||||
import android.graphics.Color
|
||||
import android.graphics.drawable.ColorDrawable
|
||||
import android.net.Uri
|
||||
|
@ -20,6 +21,7 @@ import com.simplemobiletools.gallery.fragments.VideoFragment
|
|||
import com.simplemobiletools.gallery.fragments.ViewPagerFragment
|
||||
import com.simplemobiletools.gallery.helpers.*
|
||||
import com.simplemobiletools.gallery.models.Medium
|
||||
import kotlinx.android.synthetic.main.bottom_actions.*
|
||||
import kotlinx.android.synthetic.main.fragment_holder.*
|
||||
import java.io.File
|
||||
|
||||
|
@ -46,6 +48,8 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList
|
|||
finish()
|
||||
}
|
||||
}
|
||||
|
||||
initBottomActions()
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
|
@ -99,7 +103,7 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList
|
|||
mFragment = if (mIsVideo) VideoFragment() else PhotoFragment()
|
||||
mFragment!!.listener = this
|
||||
mFragment!!.arguments = bundle
|
||||
supportFragmentManager.beginTransaction().replace(R.id.fragment_holder, mFragment).commit()
|
||||
supportFragmentManager.beginTransaction().replace(R.id.fragment_placeholder, mFragment).commit()
|
||||
}
|
||||
|
||||
if (config.blackBackground) {
|
||||
|
@ -112,6 +116,11 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList
|
|||
}
|
||||
}
|
||||
|
||||
override fun onConfigurationChanged(newConfig: Configuration?) {
|
||||
super.onConfigurationChanged(newConfig)
|
||||
initBottomActionsLayout()
|
||||
}
|
||||
|
||||
private fun sendViewPagerIntent(path: String) {
|
||||
Intent(this, ViewPagerActivity::class.java).apply {
|
||||
putExtra(IS_VIEW_INTENT, true)
|
||||
|
@ -153,6 +162,34 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList
|
|||
PropertiesDialog(this, mUri!!.path)
|
||||
}
|
||||
|
||||
private fun initBottomActions() {
|
||||
initBottomActionsLayout()
|
||||
initBottomActionButtons()
|
||||
}
|
||||
|
||||
private fun initBottomActionsLayout() {
|
||||
bottom_actions.layoutParams.height = resources.getDimension(R.dimen.bottom_actions_height).toInt() + navigationBarHeight
|
||||
if (config.bottomActions) {
|
||||
bottom_actions.beVisible()
|
||||
} else {
|
||||
bottom_actions.beGone()
|
||||
}
|
||||
}
|
||||
|
||||
private fun initBottomActionButtons() {
|
||||
bottom_properties.setOnClickListener {
|
||||
}
|
||||
|
||||
bottom_edit.setOnClickListener {
|
||||
}
|
||||
|
||||
bottom_share.setOnClickListener {
|
||||
}
|
||||
|
||||
bottom_delete.setOnClickListener {
|
||||
}
|
||||
}
|
||||
|
||||
override fun fragmentClicked() {
|
||||
mIsFullScreen = !mIsFullScreen
|
||||
if (mIsFullScreen) {
|
||||
|
@ -160,6 +197,10 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList
|
|||
} else {
|
||||
showSystemUI()
|
||||
}
|
||||
|
||||
if (!bottom_actions.isGone()) {
|
||||
bottom_actions.animate().alpha(if (mIsFullScreen) 0f else 1f).start()
|
||||
}
|
||||
}
|
||||
|
||||
override fun videoEnded() = false
|
||||
|
|
|
@ -45,6 +45,7 @@ import com.simplemobiletools.gallery.fragments.ViewPagerFragment
|
|||
import com.simplemobiletools.gallery.helpers.*
|
||||
import com.simplemobiletools.gallery.models.Medium
|
||||
import kotlinx.android.synthetic.main.activity_medium.*
|
||||
import kotlinx.android.synthetic.main.bottom_actions.*
|
||||
import java.io.File
|
||||
import java.io.FileOutputStream
|
||||
import java.io.InputStream
|
||||
|
|
|
@ -1,7 +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">
|
||||
|
@ -11,57 +10,8 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
<android.support.constraint.ConstraintLayout
|
||||
<include
|
||||
android:id="@+id/bottom_actions"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/bottom_actions_height"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:background="@drawable/gradient_background_lighter"
|
||||
android:paddingTop="@dimen/medium_margin">
|
||||
layout="@layout/bottom_actions"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/bottom_properties"
|
||||
style="@style/MyBorderlessBackgroundStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="@dimen/medium_margin"
|
||||
android:src="@drawable/ic_properties"
|
||||
app:layout_constraintEnd_toStartOf="@+id/bottom_edit"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toStartOf="parent"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/bottom_edit"
|
||||
style="@style/MyBorderlessBackgroundStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="@dimen/medium_margin"
|
||||
android:src="@drawable/ic_edit"
|
||||
app:layout_constraintEnd_toStartOf="@+id/bottom_share"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toEndOf="@+id/bottom_properties"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/bottom_share"
|
||||
style="@style/MyBorderlessBackgroundStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="@dimen/medium_margin"
|
||||
android:src="@drawable/ic_share"
|
||||
app:layout_constraintEnd_toStartOf="@+id/bottom_delete"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toEndOf="@+id/bottom_edit"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/bottom_delete"
|
||||
style="@style/MyBorderlessBackgroundStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="@dimen/medium_margin"
|
||||
android:src="@drawable/ic_delete"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toEndOf="@+id/bottom_share"/>
|
||||
|
||||
</android.support.constraint.ConstraintLayout>
|
||||
</RelativeLayout>
|
||||
|
|
|
@ -0,0 +1,56 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.constraint.ConstraintLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/bottom_actions_wrapper"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/bottom_actions_height"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:background="@drawable/gradient_background_lighter"
|
||||
android:paddingTop="@dimen/medium_margin">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/bottom_properties"
|
||||
style="@style/MyBorderlessBackgroundStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="@dimen/medium_margin"
|
||||
android:src="@drawable/ic_properties"
|
||||
app:layout_constraintEnd_toStartOf="@+id/bottom_edit"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toStartOf="parent"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/bottom_edit"
|
||||
style="@style/MyBorderlessBackgroundStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="@dimen/medium_margin"
|
||||
android:src="@drawable/ic_edit"
|
||||
app:layout_constraintEnd_toStartOf="@+id/bottom_share"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toEndOf="@+id/bottom_properties"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/bottom_share"
|
||||
style="@style/MyBorderlessBackgroundStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="@dimen/medium_margin"
|
||||
android:src="@drawable/ic_share"
|
||||
app:layout_constraintEnd_toStartOf="@+id/bottom_delete"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toEndOf="@+id/bottom_edit"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/bottom_delete"
|
||||
style="@style/MyBorderlessBackgroundStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="@dimen/medium_margin"
|
||||
android:src="@drawable/ic_delete"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toEndOf="@+id/bottom_share"/>
|
||||
|
||||
</android.support.constraint.ConstraintLayout>
|
|
@ -1,6 +1,17 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout
|
||||
<RelativeLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/fragment_holder"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/fragment_placeholder"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
<include
|
||||
android:id="@+id/bottom_actions"
|
||||
layout="@layout/bottom_actions"/>
|
||||
|
||||
</RelativeLayout>
|
||||
|
|
Loading…
Reference in New Issue