Animate Share icon in Receive and eReceipt.
- Created a Share icon animation using the ObjectAnimator API and used it in both eReceipt and Receive Transaction screens.
This commit is contained in:
parent
710ba72875
commit
b9bb333c7c
6 changed files with 55 additions and 6 deletions
|
@ -3,6 +3,7 @@ package cy.agorise.bitsybitshareswallet.fragments
|
|||
import android.Manifest
|
||||
import android.content.Intent
|
||||
import android.content.pm.PackageManager
|
||||
import android.graphics.drawable.Animatable
|
||||
import android.os.Bundle
|
||||
import android.preference.PreferenceManager
|
||||
import android.text.Html
|
||||
|
@ -125,6 +126,12 @@ class EReceiptFragment : Fragment() {
|
|||
|
||||
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
|
||||
inflater.inflate(R.menu.menu_e_receipt, menu)
|
||||
|
||||
// Animate the share icon
|
||||
val shareIcon = menu.findItem(R.id.menu_share).icon
|
||||
if (shareIcon is Animatable) {
|
||||
shareIcon.start()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||
|
|
|
@ -2,6 +2,7 @@ package cy.agorise.bitsybitshareswallet.fragments
|
|||
|
||||
import android.content.Intent
|
||||
import android.content.pm.PackageManager
|
||||
import android.graphics.drawable.Animatable
|
||||
import android.os.Bundle
|
||||
import android.preference.PreferenceManager
|
||||
import android.util.Log
|
||||
|
@ -311,6 +312,12 @@ class ReceiveTransactionFragment : ConnectedFragment() {
|
|||
|
||||
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
|
||||
inflater.inflate(R.menu.menu_receive_transaction, menu)
|
||||
|
||||
// Animate the share icon
|
||||
val shareIcon = menu.findItem(R.id.menu_share).icon
|
||||
if (shareIcon is Animatable) {
|
||||
shareIcon.start()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||
|
|
|
@ -1,5 +1,10 @@
|
|||
<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="M18,16.08c-0.76,0 -1.44,0.3 -1.96,0.77L8.91,12.7c0.05,-0.23 0.09,-0.46 0.09,-0.7s-0.04,-0.47 -0.09,-0.7l7.05,-4.11c0.54,0.5 1.25,0.81 2.04,0.81 1.66,0 3,-1.34 3,-3s-1.34,-3 -3,-3 -3,1.34 -3,3c0,0.24 0.04,0.47 0.09,0.7L8.04,9.81C7.5,9.31 6.79,9 6,9c-1.66,0 -3,1.34 -3,3s1.34,3 3,3c0.79,0 1.5,-0.31 2.04,-0.81l7.12,4.16c-0.05,0.21 -0.08,0.43 -0.08,0.65 0,1.61 1.31,2.92 2.92,2.92 1.61,0 2.92,-1.31 2.92,-2.92s-1.31,-2.92 -2.92,-2.92z"/>
|
||||
<group
|
||||
android:name="icon" >
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M18,16.08c-0.76,0 -1.44,0.3 -1.96,0.77L8.91,12.7c0.05,-0.23 0.09,-0.46 0.09,-0.7s-0.04,-0.47 -0.09,-0.7l7.05,-4.11c0.54,0.5 1.25,0.81 2.04,0.81 1.66,0 3,-1.34 3,-3s-1.34,-3 -3,-3 -3,1.34 -3,3c0,0.24 0.04,0.47 0.09,0.7L8.04,9.81C7.5,9.31 6.79,9 6,9c-1.66,0 -3,1.34 -3,3s1.34,3 3,3c0.79,0 1.5,-0.31 2.04,-0.81l7.12,4.16c-0.05,0.21 -0.08,0.43 -0.08,0.65 0,1.61 1.31,2.92 2.92,2.92 1.61,0 2.92,-1.31 2.92,-2.92s-1.31,-2.92 -2.92,-2.92z"/>
|
||||
</group>
|
||||
</vector>
|
||||
|
|
29
app/src/main/res/drawable/ic_share_animated.xml
Normal file
29
app/src/main/res/drawable/ic_share_animated.xml
Normal file
|
@ -0,0 +1,29 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<animated-vector
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:aapt="http://schemas.android.com/aapt"
|
||||
android:drawable="@drawable/ic_share">
|
||||
|
||||
<target android:name="icon">
|
||||
<aapt:attr name="android:animation" >
|
||||
<set android:ordering="together">
|
||||
<objectAnimator
|
||||
android:duration="700"
|
||||
android:repeatCount="infinite"
|
||||
android:repeatMode="reverse"
|
||||
android:propertyName="scaleX"
|
||||
android:valueFrom="1.1"
|
||||
android:valueTo="0.9"
|
||||
android:valueType="floatType"/>
|
||||
<objectAnimator
|
||||
android:duration="700"
|
||||
android:repeatCount="infinite"
|
||||
android:repeatMode="reverse"
|
||||
android:propertyName="scaleY"
|
||||
android:valueFrom="1.1"
|
||||
android:valueTo="0.9"
|
||||
android:valueType="floatType"/>
|
||||
</set>
|
||||
</aapt:attr>
|
||||
</target>
|
||||
</animated-vector>
|
|
@ -3,9 +3,10 @@
|
|||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<item android:id="@+id/menu_share"
|
||||
android:icon="@drawable/ic_share"
|
||||
android:title="@string/title_share"
|
||||
app:showAsAction="always"/>
|
||||
<item
|
||||
android:id="@+id/menu_share"
|
||||
android:icon="@drawable/ic_share_animated"
|
||||
android:title="@string/title_share"
|
||||
app:showAsAction="always"/>
|
||||
|
||||
</menu>
|
|
@ -4,7 +4,7 @@
|
|||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<item android:id="@+id/menu_share"
|
||||
android:icon="@drawable/ic_share"
|
||||
android:icon="@drawable/ic_share_animated"
|
||||
android:title="@string/title_share"
|
||||
app:showAsAction="always"/>
|
||||
|
||||
|
|
Loading…
Reference in a new issue