Modified appbar animation to use video instead of images and added collapsing toolbar animation

This commit is contained in:
Severiano Jaramillo 2017-12-13 23:02:00 -06:00
parent efef66f4e9
commit aa12a4ec86
7 changed files with 115 additions and 53 deletions

View file

@ -8,7 +8,7 @@
android:name="cy.agorise.crystalwallet.application.CrystalApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:label=""
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">

View file

@ -2,7 +2,10 @@ package cy.agorise.crystalwallet.activities;
import android.content.Intent;
import android.content.res.Resources;
import android.graphics.drawable.AnimationDrawable;
import android.media.MediaPlayer;
import android.os.Bundle;
import android.support.design.widget.AppBarLayout;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
@ -13,6 +16,9 @@ import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.view.View;
import android.view.animation.LinearInterpolator;
import android.widget.ImageButton;
@ -36,8 +42,8 @@ public class BoardActivity extends AppCompatActivity {
@BindView(R.id.pager)
public ViewPager mPager;
@BindView(R.id.btnGeneralSettings)
public ImageButton btnGeneralSettings;
//@BindView(R.id.btnGeneralSettings)
//public ImageButton btnGeneralSettings;
@BindView(R.id.fabSend)
public FloatingActionButton fabSend;
@ -56,6 +62,8 @@ public class BoardActivity extends AppCompatActivity {
*/
long cryptoNetAccountId;
private SurfaceView mSurfaceView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@ -68,6 +76,29 @@ public class BoardActivity extends AppCompatActivity {
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
// Appbar animation
mSurfaceView = findViewById(R.id.surface_view);
mSurfaceView.getHolder().addCallback(new SurfaceHolder.Callback() {
@Override
public void surfaceCreated(SurfaceHolder surfaceHolder) {
//Log.d(TAG,"surfaceCreated");
MediaPlayer mediaPlayer = MediaPlayer.create(BoardActivity.this, R.raw.appbar_background);
mediaPlayer.setDisplay(mSurfaceView.getHolder());
mediaPlayer.setLooping(true);
mediaPlayer.start();
}
@Override
public void surfaceChanged(SurfaceHolder surfaceHolder, int i, int i1, int i2) {
//Log.d(TAG,"surfaceChanged");
}
@Override
public void surfaceDestroyed(SurfaceHolder surfaceHolder) {
//Log.d(TAG,"surfaceDestroyed");
}
});
boardAdapter = new BoardPagerAdapter(getSupportFragmentManager());
mPager.setAdapter(boardAdapter);
@ -167,7 +198,7 @@ public class BoardActivity extends AppCompatActivity {
newFragment.show(ft, "SendDialog");
}
@OnClick(R.id.btnGeneralSettings)
//@OnClick(R.id.btnGeneralSettings)
public void onBtnGeneralSettingsClick(){
Intent intent = new Intent(this, GeneralSettingsActivity.class);
startActivity(intent);

View file

@ -2,75 +2,105 @@
<android.support.design.widget.CoordinatorLayout
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:id="@+id/main_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
tools:context=".activities.BoardActivity">
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="@dimen/appbar_padding_top"
android:layout_height="@dimen/app_bar_height"
android:fitsSystemWindows="true"
android:background="@color/colorPrimary"
app:theme="@style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/toolbar_layout"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:layout_weight="1"
android:background="@color/transparent"
app:layout_scrollFlags="scroll|enterAlways"
app:popupTheme="@style/AppTheme.PopupOverlay"
app:title="Client Logo"
app:titleTextColor="@color/white" >
android:layout_height="match_parent"
android:fitsSystemWindows="true"
app:contentScrim="@color/transparent"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
app:toolbarId="@+id/toolbar">
<cy.agorise.crystalwallet.util.CircularImageView
android:id="@+id/toolbar_logo"
android:src="@drawable/ken_code_gravatar"
android:layout_width="?attr/actionBarSize"
android:layout_height="match_parent"
android:layout_marginEnd="14dp"
android:layout_marginTop="4dp"
android:layout_marginBottom="4dp"
android:layout_gravity="end"
android:background="@drawable/roundcorner"/>
<SurfaceView
android:id="@+id/surface_view"
android:layout_width="match_parent"
android:layout_height="@dimen/app_bar_height" />
</android.support.v7.widget.Toolbar>
<View
android:layout_width="match_parent"
android:layout_height="@dimen/app_bar_height"
android:background="@color/colorPrimaryTransparent"/>
<android.support.design.widget.TabLayout
android:id="@+id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:animateLayoutChanges="true">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@color/transparent"
android:layout_marginTop="8dp"
app:layout_collapseMode="none"
app:popupTheme="@style/AppTheme.PopupOverlay">
<android.support.design.widget.TabItem
android:id="@+id/tabItem"
android:layout_width="wrap_content"
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="40dp"
android:text="Client Logo"
android:textColor="@color/white"
android:textSize="22sp"
android:textStyle="bold"/>
<cy.agorise.crystalwallet.util.CircularImageView
android:id="@+id/toolbar_logo"
android:layout_width="?attr/actionBarSize"
android:layout_height="?attr/actionBarSize"
android:layout_gravity="end"
android:layout_marginEnd="40dp"
android:src="@drawable/ken_code_gravatar" />
</android.support.v7.widget.Toolbar>
<android.support.design.widget.TabLayout
android:id="@+id/tabs"
android:layout_gravity="bottom"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/balances" />
app:layout_collapseMode="pin"
android:animateLayoutChanges="true">
<android.support.design.widget.TabItem
android:id="@+id/tabItem2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/transactions" />
<android.support.design.widget.TabItem
android:id="@+id/tabItem"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/balances" />
<android.support.design.widget.TabItem
android:id="@+id/tabItem3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/contacts" />
<android.support.design.widget.TabItem
android:id="@+id/tabItem2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/transactions" />
<android.support.design.widget.TabItem
android:id="@+id/tabItem3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/contacts" />
</android.support.design.widget.TabLayout>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.TabLayout>
</android.support.design.widget.AppBarLayout>
<!-- change height -->
<android.support.v4.view.ViewPager
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"/>
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/fabReceive"
@ -102,7 +132,7 @@
app:srcCompat="@drawable/ic_person_add" />
<!-- Place settings button correctly -->
<!--
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -115,5 +145,5 @@
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:background="@drawable/icon_setting" />
</RelativeLayout>
</RelativeLayout>-->
</android.support.design.widget.CoordinatorLayout>

View file

@ -1,4 +1,4 @@
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
<android.support.v4.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
@ -9,4 +9,4 @@
android:layout_height="wrap_content"
android:id="@+id/vTransactionListView" />
</FrameLayout>
</android.support.v4.widget.NestedScrollView>

Binary file not shown.

View file

@ -8,6 +8,7 @@
<color name="white">#ffffff</color>
<color name="pink">#f0006b</color>
<color name="transparent">#00ffffff</color>
<color name="colorPrimaryTransparent">#330099d6</color>
<color name="green">#147b00</color>

View file

@ -6,7 +6,7 @@
<dimen name="tab_padding_bottom">16dp</dimen>
<dimen name="tab_label">14sp</dimen>
<dimen name="custom_tab_layout_height">72dp</dimen>
<dimen name="app_bar_height">70sp</dimen>
<dimen name="app_bar_height">140sp</dimen>
<dimen name="fab_margin">16dp</dimen>
<dimen name="text_margin">16dp</dimen>
<dimen name="layout_margin">35sp</dimen>