All dialogs now use proper toolbars

This commit is contained in:
Corewala 2022-01-08 17:10:58 -05:00
parent 42ad53708d
commit a4ecd82004
12 changed files with 136 additions and 274 deletions

View File

@ -5,12 +5,10 @@ import android.content.Intent
import android.net.Uri import android.net.Uri
import android.os.Handler import android.os.Handler
import android.os.Looper import android.os.Looper
import android.view.MenuInflater
import android.view.View import android.view.View
import android.widget.Toast import android.widget.Toast
import androidx.appcompat.app.AppCompatDialog import androidx.appcompat.app.AppCompatDialog
import androidx.appcompat.widget.PopupMenu import androidx.appcompat.widget.PopupMenu
import androidx.core.view.MenuCompat
import androidx.core.view.forEach import androidx.core.view.forEach
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import com.google.android.material.snackbar.BaseTransientBottomBar import com.google.android.material.snackbar.BaseTransientBottomBar
@ -22,9 +20,6 @@ import corewala.buran.io.database.bookmarks.BookmarksDatasource
import corewala.buran.ui.CREATE_BOOKMARK_EXPORT_FILE_REQ import corewala.buran.ui.CREATE_BOOKMARK_EXPORT_FILE_REQ
import corewala.buran.ui.CREATE_BOOKMARK_IMPORT_FILE_REQ import corewala.buran.ui.CREATE_BOOKMARK_IMPORT_FILE_REQ
import corewala.visible import corewala.visible
import kotlinx.android.synthetic.main.dialog_about.view.*
import kotlinx.android.synthetic.main.dialog_bookmarks.view.close_tab_dialog
import kotlinx.android.synthetic.main.dialog_history.view.*
import org.json.JSONObject import org.json.JSONObject
import java.io.BufferedReader import java.io.BufferedReader
import java.io.InputStreamReader import java.io.InputStreamReader
@ -46,45 +41,44 @@ class BookmarksDialog(
setContentView(view) setContentView(view)
view.close_tab_dialog.setOnClickListener { view.bookmarks_toolbar.setNavigationIcon(R.drawable.vector_close)
view.bookmarks_toolbar.setNavigationOnClickListener {
dismiss() dismiss()
} }
view.bookmark_overflow.setOnClickListener { menu -> view.bookmarks_toolbar.menu.forEach { menu ->
val popup = PopupMenu(view.context, view.bookmark_overflow) menu.setOnMenuItemClickListener { item ->
val inflater: MenuInflater = popup.menuInflater when(item.itemId){
inflater.inflate(R.menu.history_overflow_menu, popup.menu) R.id.menu_action_import_bookmarks -> {
popup.setOnMenuItemClickListener { menuItem -> val intent = Intent(Intent.ACTION_OPEN_DOCUMENT)
if(menuItem.itemId == R.id.menu_action_import_bookmarks){ intent.addCategory(Intent.CATEGORY_OPENABLE)
val intent = Intent(Intent.ACTION_OPEN_DOCUMENT) intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
intent.addCategory(Intent.CATEGORY_OPENABLE) intent.type = "application/json"
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) context.startActivityForResult(intent, CREATE_BOOKMARK_IMPORT_FILE_REQ)
intent.type = "application/json" }
context.startActivityForResult(intent, CREATE_BOOKMARK_IMPORT_FILE_REQ) R.id.menu_action_export_bookmarks -> {
}else if(menuItem.itemId == R.id.menu_action_export_bookmarks){ val intent = Intent(Intent.ACTION_CREATE_DOCUMENT)
val intent = Intent(Intent.ACTION_CREATE_DOCUMENT) intent.addCategory(Intent.CATEGORY_OPENABLE)
intent.addCategory(Intent.CATEGORY_OPENABLE) intent.type = "application/json"
intent.type = "application/json" intent.putExtra(Intent.EXTRA_TITLE, "buran_bookmarks.json")
intent.putExtra(Intent.EXTRA_TITLE, "buran_bookmarks.json") context.startActivityForResult(intent, CREATE_BOOKMARK_EXPORT_FILE_REQ)
context.startActivityForResult(intent, CREATE_BOOKMARK_EXPORT_FILE_REQ) }
else -> {
}
} }
true true
} }
MenuCompat.setGroupDividerEnabled(popup.menu, true)
popup.show()
} }
//None as yet //None as yet
/*
view.bookmarks_toolbar.inflateMenu(R.menu.add_bookmarks) view.bookmarks_toolbar.inflateMenu(R.menu.add_bookmarks)
view.bookmarks_toolbar.setOnMenuItemClickListener { _ -> view.bookmarks_toolbar.setOnMenuItemClickListener { _ ->
true true
} }
*/
view.bookmarks_recycler.layoutManager = LinearLayoutManager(context) view.bookmarks_recycler.layoutManager = LinearLayoutManager(context)
bookmarksAdapter = BookmarksAdapter({ bookmark -> bookmarksAdapter = BookmarksAdapter({ bookmark ->
@ -120,10 +114,7 @@ class BookmarksDialog(
Handler(Looper.getMainLooper()).post { Handler(Looper.getMainLooper()).post {
when { when {
/*
bookmarks.isEmpty() -> view.bookmarks_empty_layout.visible(true) bookmarks.isEmpty() -> view.bookmarks_empty_layout.visible(true)
*/
else -> bookmarksAdapter.update(bookmarks) else -> bookmarksAdapter.update(bookmarks)
} }
} }
@ -240,9 +231,7 @@ class BookmarksDialog(
bookmarkDatasource.add(bookmarkEntries.toTypedArray()){ bookmarkDatasource.add(bookmarkEntries.toTypedArray()){
bookmarkDatasource.get { bookmarks -> bookmarkDatasource.get { bookmarks ->
Handler(Looper.getMainLooper()).post { Handler(Looper.getMainLooper()).post {
view.bookmarks_empty_layout.visible(false) view.bookmarks_empty_layout.visible(false)
bookmarksAdapter.update(bookmarks) bookmarksAdapter.update(bookmarks)
when { when {
skipped > 0 -> { skipped > 0 -> {

View File

@ -1,20 +1,27 @@
package corewala.buran.ui.content_image package corewala.buran.ui.content_image
import android.content.Context import android.content.Context
import android.content.Intent
import android.graphics.Bitmap import android.graphics.Bitmap
import android.net.Uri import android.net.Uri
import android.view.MenuInflater import android.view.MenuInflater
import android.view.View import android.view.View
import androidx.appcompat.app.AppCompatDialog import androidx.appcompat.app.AppCompatDialog
import androidx.appcompat.widget.PopupMenu import androidx.appcompat.widget.PopupMenu
import androidx.core.view.forEach
import kotlinx.android.synthetic.main.dialog_content_image.view.* import kotlinx.android.synthetic.main.dialog_content_image.view.*
import corewala.buran.R import corewala.buran.R
import corewala.buran.io.GemState import corewala.buran.io.GemState
import corewala.buran.ui.CREATE_BOOKMARK_EXPORT_FILE_REQ
import corewala.buran.ui.CREATE_BOOKMARK_IMPORT_FILE_REQ
import kotlinx.android.synthetic.main.dialog_bookmarks.view.*
import kotlinx.android.synthetic.main.dialog_content_text.view.*
import java.io.FileOutputStream import java.io.FileOutputStream
object ImageDialog { object ImageDialog {
fun show(context: Context, state: GemState.ResponseImage, onDownloadRequest: (state: GemState.ResponseImage) -> Unit){ fun show(context: Context, state: GemState.ResponseImage, onDownloadRequest: (state: GemState.ResponseImage) -> Unit){
val dialog = AppCompatDialog(context, R.style.AppTheme) val dialog = AppCompatDialog(context, R.style.AppTheme)
val view = View.inflate(context, R.layout.dialog_content_image, null) val view = View.inflate(context, R.layout.dialog_content_image, null)
@ -22,24 +29,24 @@ object ImageDialog {
view.image_view.setImageURI(state.cacheUri) view.image_view.setImageURI(state.cacheUri)
view.close_image_content_dialog.setOnClickListener { view.image_toolbar.setNavigationIcon(R.drawable.vector_close)
view.image_toolbar.setNavigationOnClickListener {
dialog.dismiss() dialog.dismiss()
} }
view.image_overflow.setOnClickListener { view.image_toolbar.menu.forEach { menu ->
val overflowMenu = PopupMenu(context, view.image_overflow) menu.setOnMenuItemClickListener { item ->
val inflater: MenuInflater = overflowMenu.menuInflater when(item.itemId){
inflater.inflate(R.menu.image_overflow_menu, overflowMenu.menu) R.id.image_overflow_save_image -> {
overflowMenu.setOnMenuItemClickListener { menuItem -> onDownloadRequest(state)
if(menuItem.itemId == R.id.image_overflow_save_image){ }
onDownloadRequest(state) else -> {
}
} }
true true
} }
overflowMenu.show()
} }
dialog.show() dialog.show()
} }

View File

@ -6,6 +6,7 @@ import androidx.appcompat.app.AppCompatDialog
import kotlinx.android.synthetic.main.dialog_content_text.view.* import kotlinx.android.synthetic.main.dialog_content_text.view.*
import corewala.buran.R import corewala.buran.R
import corewala.buran.io.GemState import corewala.buran.io.GemState
import kotlinx.android.synthetic.main.dialog_bookmarks.view.*
object TextDialog { object TextDialog {
@ -17,11 +18,13 @@ object TextDialog {
view.text_content.text = state.content view.text_content.text = state.content
view.close_text_content_dialog.setOnClickListener { view.text_toolbar.setNavigationIcon(R.drawable.vector_close)
view.text_toolbar.setNavigationOnClickListener {
dialog.dismiss() dialog.dismiss()
} }
dialog.show() dialog.show()
} }
} }

View File

@ -12,6 +12,7 @@ import kotlinx.android.synthetic.main.dialog_about.view.*
import kotlinx.coroutines.GlobalScope import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import corewala.buran.R import corewala.buran.R
import kotlinx.android.synthetic.main.dialog_content_text.view.*
import java.lang.StringBuilder import java.lang.StringBuilder
import java.security.SecureRandom import java.security.SecureRandom
import java.security.Security import java.security.Security
@ -27,7 +28,8 @@ object AboutDialog {
val view = View.inflate(context, R.layout.dialog_about, null) val view = View.inflate(context, R.layout.dialog_about, null)
dialog.setContentView(view) dialog.setContentView(view)
view.close_tab_dialog.setOnClickListener { view.about_toolbar.setNavigationIcon(R.drawable.vector_close)
view.about_toolbar.setNavigationOnClickListener {
dialog.dismiss() dialog.dismiss()
} }

View File

@ -3,49 +3,52 @@ package corewala.buran.ui.modals_menus.history
import android.content.Context import android.content.Context
import android.os.Handler import android.os.Handler
import android.os.Looper import android.os.Looper
import android.view.MenuInflater
import android.view.View import android.view.View
import android.widget.Toast import android.widget.Toast
import androidx.appcompat.app.AppCompatDialog import androidx.appcompat.app.AppCompatDialog
import androidx.appcompat.widget.PopupMenu import androidx.core.view.forEach
import androidx.core.view.MenuCompat
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import kotlinx.android.synthetic.main.dialog_about.view.close_tab_dialog
import kotlinx.android.synthetic.main.dialog_history.view.* import kotlinx.android.synthetic.main.dialog_history.view.*
import corewala.buran.R import corewala.buran.R
import corewala.buran.io.database.history.BuranHistory import corewala.buran.io.database.history.BuranHistory
import kotlinx.android.synthetic.main.dialog_bookmarks.view.*
object HistoryDialog { object HistoryDialog {
fun show(context: Context, history: BuranHistory, onHistoryItem: (address: String) -> Unit){ fun show(context: Context, history: BuranHistory, onHistoryItem: (address: String) -> Unit){
val dialog = AppCompatDialog(context, R.style.AppTheme) val dialog = AppCompatDialog(context, R.style.AppTheme)
val view = View.inflate(context, R.layout.dialog_history, null) val view = View.inflate(context, R.layout.dialog_history, null)
dialog.setContentView(view) dialog.setContentView(view)
view.close_tab_dialog.setOnClickListener { view.history_toolbar.setNavigationIcon(R.drawable.vector_close)
view.history_toolbar.setNavigationOnClickListener {
dialog.dismiss() dialog.dismiss()
} }
view.history_overflow.setOnClickListener { view.history_toolbar.menu.forEach { menu ->
val popup = PopupMenu(view.context, view.history_overflow) menu.setOnMenuItemClickListener { item ->
val inflater: MenuInflater = popup.menuInflater when(item.itemId){
inflater.inflate(R.menu.history_overflow_menu, popup.menu) R.id.menu_action_clear_history -> {
popup.setOnMenuItemClickListener { menuItem -> history.clear {
if(menuItem.itemId == R.id.history_overflow_clear_history){ Handler(Looper.getMainLooper()).post {
history.clear { Toast.makeText(context, context.getString(R.string.history_cleared), Toast.LENGTH_SHORT).show()
Handler(Looper.getMainLooper()).post { }
dialog.dismiss()
Toast.makeText(context, context.getString(R.string.history_cleared), Toast.LENGTH_SHORT).show()
} }
} }
}else if(menuItem.itemId == R.id.history_overflow_clear_runtime_cache){ R.id.menu_action_clear_runtime_cache -> {
dialog.dismiss() Toast.makeText(context, context.getString(R.string.runtime_cache_cleared), Toast.LENGTH_SHORT).show()
Toast.makeText(context, context.getString(R.string.runtime_cache_cleared), Toast.LENGTH_SHORT).show() }
else -> {
}
} }
true true
} }
MenuCompat.setGroupDividerEnabled(popup.menu, true) }
popup.show()
view.history_toolbar.setOnMenuItemClickListener { _ ->
true
} }
view.history_recycler.layoutManager = LinearLayoutManager(context) view.history_recycler.layoutManager = LinearLayoutManager(context)

View File

@ -1,42 +1,21 @@
<?xml version="1.0" encoding="utf-8"?> <?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"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto">
xmlns:tools="http://schemas.android.com/tools"> <androidx.appcompat.widget.Toolbar
android:id="@+id/about_toolbar"
android:layout_width="match_parent"
android:layout_marginTop="@dimen/default_margin"
android:layout_height="@dimen/bar_height"
app:title="@string/about"/>
<RelativeLayout
android:id="@+id/header"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="@dimen/default_margin">
<androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/close_tab_dialog"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_alignParentStart="true"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:src="@drawable/vector_close" android:layout_marginTop="@dimen/button_margin"
android:layout_marginStart="@dimen/button_margin" android:layout_marginEnd="@dimen/button_margin"
android:layout_marginBottom="@dimen/button_margin"/>
<android.widget.TextView
android:id="@+id/header_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toRightOf="@id/close_tab_dialog"
android:layout_marginLeft="@dimen/screen_margin"
android:textSize="@dimen/h3_text_size"
android:text="@string/about"/>
</RelativeLayout>
<androidx.core.widget.NestedScrollView <androidx.core.widget.NestedScrollView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@+id/header"> android:layout_below="@+id/about_toolbar">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -118,8 +97,6 @@
android:alpha="0.5" android:alpha="0.5"
android:background="?attr/colorOnSurface" /> android:background="?attr/colorOnSurface" />
</LinearLayout> </LinearLayout>
</androidx.core.widget.NestedScrollView> </androidx.core.widget.NestedScrollView>

View File

@ -2,52 +2,21 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
xmlns:tools="http://schemas.android.com/tools"> xmlns:app="http://schemas.android.com/apk/res-auto">
<RelativeLayout <androidx.appcompat.widget.Toolbar
android:id="@+id/header" android:id="@+id/bookmarks_toolbar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_marginTop="@dimen/default_margin"
android:paddingTop="@dimen/default_margin"> android:layout_height="@dimen/bar_height"
app:menu="@menu/bookmark_overflow_menu"
app:title="@string/bookmarks"/>
<androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/close_tab_dialog"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_alignParentStart="true"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:src="@drawable/vector_close" android:layout_marginTop="@dimen/button_margin"
android:layout_marginStart="@dimen/button_margin" android:layout_marginEnd="@dimen/button_margin"
android:layout_marginBottom="@dimen/button_margin"/>
<android.widget.TextView
android:id="@+id/header_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toRightOf="@id/close_tab_dialog"
android:layout_marginLeft="@dimen/screen_margin"
android:textSize="@dimen/h3_text_size"
android:text="@string/bookmarks"/>
<androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/bookmark_overflow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_alignParentEnd="true"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:src="@drawable/vector_overflow" android:layout_marginTop="@dimen/button_margin"
android:layout_marginStart="@dimen/button_margin" android:layout_marginEnd="@dimen/button_margin"
android:layout_marginBottom="@dimen/button_margin"/>
</RelativeLayout>
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/bookmarks_recycler" android:id="@+id/bookmarks_recycler"
android:layout_below="@+id/header"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"/> android:layout_height="wrap_content"
android:layout_below="@+id/bookmarks_toolbar"/>
<RelativeLayout <RelativeLayout
android:id="@+id/bookmarks_empty_layout" android:id="@+id/bookmarks_empty_layout"

View File

@ -1,52 +1,23 @@
<?xml version="1.0" encoding="utf-8"?> <?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"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
xmlns:tools="http://schemas.android.com/tools"> xmlns:app="http://schemas.android.com/apk/res-auto">
<corewala.buran.ui.content_image.TouchImageView <corewala.buran.ui.content_image.TouchImageView
android:id="@+id/image_view" android:id="@+id/image_view"
android:scaleType="centerInside" android:scaleType="centerInside"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerHorizontal="true"
/>
<RelativeLayout
android:id="@+id/header"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:paddingTop="@dimen/default_margin"> android:layout_centerHorizontal="true"
/>
<androidx.appcompat.widget.AppCompatImageButton <androidx.appcompat.widget.Toolbar
android:id="@+id/close_image_content_dialog" android:id="@+id/image_toolbar"
android:layout_width="wrap_content" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_marginTop="@dimen/default_margin"
android:layout_centerVertical="true" android:layout_height="@dimen/bar_height"
android:layout_alignParentStart="true" app:menu="@menu/image_overflow_menu"
android:layout_margin="@dimen/button_margin" app:title="@string/image"/>
android:background="?android:attr/selectableItemBackgroundBorderless"
android:src="@drawable/vector_close"/>
<android.widget.TextView
android:id="@+id/header_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="48dp"
android:textSize="24sp"
android:text="@string/image"/>
<androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/image_overflow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_alignParentEnd="true"
android:layout_margin="@dimen/button_margin"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:src="@drawable/vector_overflow"/>
</RelativeLayout>
</RelativeLayout> </RelativeLayout>

View File

@ -1,53 +1,21 @@
<?xml version="1.0" encoding="utf-8"?> <?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"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
xmlns:tools="http://schemas.android.com/tools"> xmlns:app="http://schemas.android.com/apk/res-auto">
<RelativeLayout <androidx.appcompat.widget.Toolbar
android:id="@+id/header" android:id="@+id/text_toolbar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_marginTop="@dimen/default_margin"
android:paddingTop="@dimen/default_margin"> android:layout_height="@dimen/bar_height"
app:title="@string/text"/>
<androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/close_text_content_dialog"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_alignParentStart="true"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:src="@drawable/vector_close" android:layout_marginTop="@dimen/button_margin"
android:layout_marginStart="@dimen/button_margin" android:layout_marginEnd="@dimen/button_margin"
android:layout_marginBottom="@dimen/button_margin"/>
<android.widget.TextView
android:id="@+id/header_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toRightOf="@id/close_text_content_dialog"
android:layout_marginLeft="@dimen/screen_margin"
android:textSize="@dimen/h3_text_size"
android:text="@string/text"/>
<androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/history_overflow"
android:visibility="gone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_alignParentEnd="true"
android:layout_margin="@dimen/button_margin"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:src="@drawable/vector_overflow" />
</RelativeLayout>
<androidx.core.widget.NestedScrollView <androidx.core.widget.NestedScrollView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:padding="@dimen/default_margin" android:padding="@dimen/default_margin"
android:layout_below="@+id/header"> android:layout_below="@+id/text_toolbar">
<androidx.appcompat.widget.AppCompatTextView <androidx.appcompat.widget.AppCompatTextView
android:id="@+id/text_content" android:id="@+id/text_content"
@ -56,6 +24,6 @@
android:textSize="@dimen/default_text_size" android:textSize="@dimen/default_text_size"
android:textIsSelectable="true"/> android:textIsSelectable="true"/>
</androidx.core.widget.NestedScrollView> </androidx.core.widget.NestedScrollView>
</RelativeLayout> </RelativeLayout>

View File

@ -1,51 +1,20 @@
<?xml version="1.0" encoding="utf-8"?> <?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"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
xmlns:tools="http://schemas.android.com/tools"> xmlns:app="http://schemas.android.com/apk/res-auto">
<RelativeLayout <androidx.appcompat.widget.Toolbar
android:id="@+id/header" android:id="@+id/history_toolbar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_marginTop="@dimen/default_margin"
android:paddingTop="@dimen/default_margin"> android:layout_height="@dimen/bar_height"
app:menu="@menu/history_overflow_menu"
app:title="@string/history"/>
<androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/close_tab_dialog"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_alignParentStart="true"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:src="@drawable/vector_close" android:layout_marginTop="@dimen/button_margin"
android:layout_marginStart="@dimen/button_margin" android:layout_marginEnd="@dimen/button_margin"
android:layout_marginBottom="@dimen/button_margin"/>
<android.widget.TextView
android:id="@+id/header_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toRightOf="@id/close_tab_dialog"
android:layout_marginLeft="@dimen/screen_margin"
android:textSize="@dimen/h3_text_size"
android:text="@string/history"/>
<androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/history_overflow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_alignParentEnd="true"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:src="@drawable/vector_overflow" android:layout_marginTop="@dimen/button_margin"
android:layout_marginStart="@dimen/button_margin" android:layout_marginEnd="@dimen/button_margin"
android:layout_marginBottom="@dimen/button_margin"/>
</RelativeLayout>
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/history_recycler" android:id="@+id/history_recycler"
android:layout_below="@+id/header" android:layout_below="@+id/history_toolbar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"/> android:layout_height="wrap_content"/>

View File

@ -1,7 +1,11 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"> <menu xmlns:android="http://schemas.android.com/apk/res/android"
<item android:id="@+id/history_overflow_clear_history" xmlns:app="http://schemas.android.com/apk/res-auto">
android:title="@string/clear_history" /> <item android:id="@+id/menu_action_clear_history"
<item android:id="@+id/history_overflow_clear_runtime_cache" android:title="@string/clear_history"
android:title="@string/clear_cache" /> app:showAsAction="never"/>
<item android:id="@+id/menu_action_clear_runtime_cache"
android:title="@string/clear_cache"
app:showAsAction="never"/>
</menu> </menu>