Add back action to screenshot page

This commit is contained in:
Rahul Kumar Patel
2021-02-16 09:28:23 +05:30
parent b6ccf6d3cf
commit 59e381b889
2 changed files with 36 additions and 1 deletions

View File

@@ -20,16 +20,19 @@
package com.aurora.store.view.ui.details
import android.os.Bundle
import android.view.MenuItem
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.PagerSnapHelper
import androidx.recyclerview.widget.RecyclerView
import com.aurora.Constants
import com.aurora.gplayapi.data.models.Artwork
import com.aurora.store.R
import com.aurora.store.databinding.ActivityScreenshotBinding
import com.aurora.store.util.extensions.close
import com.aurora.store.view.epoxy.views.LargeScreenshotViewModel_
import com.aurora.store.view.ui.commons.BaseActivity
import com.google.gson.reflect.TypeToken
import com.tonyodev.fetch2.Status
class ScreenshotActivity : BaseActivity() {
@@ -44,6 +47,7 @@ class ScreenshotActivity : BaseActivity() {
B = ActivityScreenshotBinding.inflate(layoutInflater)
setContentView(B.root)
attachToolbar()
attachRecycler()
if (intent != null) {
@@ -56,6 +60,27 @@ class ScreenshotActivity : BaseActivity() {
}
}
override fun onOptionsItemSelected(item: MenuItem): Boolean {
when (item.itemId) {
android.R.id.home -> {
onBackPressed()
return true
}
}
return super.onOptionsItemSelected(item)
}
private fun attachToolbar() {
setSupportActionBar(B.toolbar)
val actionBar = supportActionBar
if (actionBar != null) {
actionBar.setDisplayShowCustomEnabled(true)
actionBar.setDisplayHomeAsUpEnabled(true)
actionBar.elevation = 0f
actionBar.title = ""
}
}
private fun attachRecycler() {
B.recyclerView.apply {
layoutManager = LinearLayoutManager(

View File

@@ -19,13 +19,23 @@
<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:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:translationZ="1dp"
android:background="@color/colorTransparent"
app:layout_scrollFlags="enterAlways|exitUntilCollapsed" />
<com.airbnb.epoxy.EpoxyRecyclerView
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
tools:listitem="@layout/view_screenshot" />
</RelativeLayout>