Add Transactions toolbar menu items with their respective icons.

This commit is contained in:
Severiano Jaramillo 2018-12-19 10:08:24 -06:00
parent cee1753184
commit 26e1e427c9
10 changed files with 53 additions and 23 deletions

View file

@ -3,9 +3,7 @@ package cy.agorise.bitsybitshareswallet.fragments
import android.graphics.Point
import android.os.Bundle
import android.preference.PreferenceManager
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.view.*
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentActivity
import androidx.lifecycle.Observer
@ -32,7 +30,7 @@ class TransactionsFragment : Fragment() {
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
// setHasOptionsMenu(true)
setHasOptionsMenu(true)
return inflater.inflate(R.layout.fragment_transactions, container, false)
}
@ -54,6 +52,7 @@ class TransactionsFragment : Fragment() {
transfersDetailsAdapter.replaceAll(transfersDetails)
})
// Create bouncy effect when user tries to over scroll
rvTransactions.pivotX = getScreenWidth(activity) * 0.5f
pivotY1 = 0f
@ -94,7 +93,7 @@ class TransactionsFragment : Fragment() {
return size.y
}
// override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
// inflater.inflate(R.menu.menu_home, menu)
// }
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
inflater.inflate(R.menu.menu_transactions, menu)
}
}

View file

@ -23,7 +23,7 @@ class BounceTouchListener private constructor(
View.OnTouchListener {
private var downCalled = false
private val mContent: View
private val mContent: View = if (contentResId == -1) mMainView else mMainView.findViewById(contentResId)
private var mDownY: Float = 0.toFloat()
private var mSwipingDown: Boolean = false
private var mSwipingUp: Boolean = false
@ -34,10 +34,6 @@ class BounceTouchListener private constructor(
private var mMaxAbsTranslation = -99
init {
mContent = if (contentResId == -1) mMainView else mMainView.findViewById(contentResId)
}
override fun onTouch(view: View, motionEvent: MotionEvent): Boolean {
val action = MotionEventCompat.getActionMasked(motionEvent)

View file

@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="#FFFFFF"
android:viewportHeight="24.0" android:viewportWidth="24.0"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FF000000" android:pathData="M19,9h-4V3H9v6H5l7,7 7,-7zM5,18v2h14v-2H5z"/>
</vector>

View file

@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="#FFFFFF"
android:viewportHeight="24.0" android:viewportWidth="24.0"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FF000000" android:pathData="M10,18h4v-2h-4v2zM3,6v2h18L21,6L3,6zM6,13h12v-2L6,11v2z"/>
</vector>

View file

@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="#FFFFFF"
android:viewportHeight="24.0" android:viewportWidth="24.0"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FF000000" android:pathData="M15.5,14h-0.79l-0.28,-0.27C15.41,12.59 16,11.11 16,9.5 16,5.91 13.09,3 9.5,3S3,5.91 3,9.5 5.91,16 9.5,16c1.61,0 3.09,-0.59 4.23,-1.57l0.27,0.28v0.79l5,4.99L20.49,19l-4.99,-5zM9.5,14C7.01,14 5,11.99 5,9.5S7.01,5 9.5,5 14,7.01 14,9.5 11.99,14 9.5,14z"/>
</vector>

View file

@ -8,5 +8,4 @@
android:padding="@dimen/card_margin"
android:clipToPadding="false"
tools:listitem="@layout/item_transaction"
tools:itemCount="6"
android:layoutAnimation="@anim/layout_animation_from_bottom"/>
tools:itemCount="6"/>

View file

@ -3,7 +3,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/transactions_action"
android:id="@+id/transactions_dest"
android:icon="@drawable/ic_transactions"
android:title="@string/title_transactions"
app:showAsAction="always"/>

View file

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<menu
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item android:id="@+id/menuSearch"
android:icon="@drawable/ic_search"
android:title="@string/title_search"
app:actionViewClass="androidx.appcompat.widget.SearchView"
app:showAsAction="always"/>
<item
android:id="@+id/menuFilter"
android:icon="@drawable/ic_filter"
app:showAsAction="ifRoom"
android:title="@string/title_filter">
</item>
<item
android:id="@+id/menuExport"
android:icon="@drawable/ic_file_download"
app:showAsAction="ifRoom"
android:title="@string/title_export">
</item>
</menu>

View file

@ -35,14 +35,6 @@
app:exitAnim="@anim/slide_out_left"
app:popEnterAnim="@anim/slide_in_left"
app:popExitAnim="@anim/slide_out_right"/>
<action
android:id="@+id/transactions_action"
app:destination="@+id/transactions_dest"
app:enterAnim="@anim/slide_in_right"
app:exitAnim="@anim/slide_out_left"
app:popEnterAnim="@anim/slide_in_left"
app:popExitAnim="@anim/slide_out_right"/>
</fragment>
<fragment

View file

@ -76,5 +76,8 @@
</string>
<string name="text__coming_soon">Coming soon</string>
<string name="title_net_worth">Net Worth</string>
<string name="title_search">Search</string>
<string name="title_filter">Filter</string>
<string name="title_export">Export</string>
</resources>