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:name="cy.agorise.crystalwallet.application.CrystalApplication"
android:allowBackup="true" android:allowBackup="true"
android:icon="@mipmap/ic_launcher" android:icon="@mipmap/ic_launcher"
android:label="@string/app_name" android:label=""
android:roundIcon="@mipmap/ic_launcher_round" android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true" android:supportsRtl="true"
android:theme="@style/AppTheme"> android:theme="@style/AppTheme">

View file

@ -2,7 +2,10 @@ package cy.agorise.crystalwallet.activities;
import android.content.Intent; import android.content.Intent;
import android.content.res.Resources; import android.content.res.Resources;
import android.graphics.drawable.AnimationDrawable;
import android.media.MediaPlayer;
import android.os.Bundle; import android.os.Bundle;
import android.support.design.widget.AppBarLayout;
import android.support.design.widget.FloatingActionButton; import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.TabLayout; import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment; 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.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity; import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar; 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.View;
import android.view.animation.LinearInterpolator; import android.view.animation.LinearInterpolator;
import android.widget.ImageButton; import android.widget.ImageButton;
@ -36,8 +42,8 @@ public class BoardActivity extends AppCompatActivity {
@BindView(R.id.pager) @BindView(R.id.pager)
public ViewPager mPager; public ViewPager mPager;
@BindView(R.id.btnGeneralSettings) //@BindView(R.id.btnGeneralSettings)
public ImageButton btnGeneralSettings; //public ImageButton btnGeneralSettings;
@BindView(R.id.fabSend) @BindView(R.id.fabSend)
public FloatingActionButton fabSend; public FloatingActionButton fabSend;
@ -56,6 +62,8 @@ public class BoardActivity extends AppCompatActivity {
*/ */
long cryptoNetAccountId; long cryptoNetAccountId;
private SurfaceView mSurfaceView;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
@ -68,6 +76,29 @@ public class BoardActivity extends AppCompatActivity {
Toolbar toolbar = findViewById(R.id.toolbar); Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(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()); boardAdapter = new BoardPagerAdapter(getSupportFragmentManager());
mPager.setAdapter(boardAdapter); mPager.setAdapter(boardAdapter);
@ -167,7 +198,7 @@ public class BoardActivity extends AppCompatActivity {
newFragment.show(ft, "SendDialog"); newFragment.show(ft, "SendDialog");
} }
@OnClick(R.id.btnGeneralSettings) //@OnClick(R.id.btnGeneralSettings)
public void onBtnGeneralSettingsClick(){ public void onBtnGeneralSettingsClick(){
Intent intent = new Intent(this, GeneralSettingsActivity.class); Intent intent = new Intent(this, GeneralSettingsActivity.class);
startActivity(intent); startActivity(intent);

View file

@ -2,47 +2,73 @@
<android.support.design.widget.CoordinatorLayout <android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main_content" android:id="@+id/main_content"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:fitsSystemWindows="true"> tools:context=".activities.BoardActivity">
<android.support.design.widget.AppBarLayout <android.support.design.widget.AppBarLayout
android:id="@+id/appbar" android:id="@+id/appbar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="@dimen/app_bar_height"
android:paddingTop="@dimen/appbar_padding_top" android:fitsSystemWindows="true"
android:background="@color/colorPrimary" android:background="@color/colorPrimary"
app:theme="@style/AppTheme.AppBarOverlay"> app:theme="@style/AppTheme.AppBarOverlay">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/toolbar_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
app:contentScrim="@color/transparent"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
app:toolbarId="@+id/toolbar">
<SurfaceView
android:id="@+id/surface_view"
android:layout_width="match_parent"
android:layout_height="@dimen/app_bar_height" />
<View
android:layout_width="match_parent"
android:layout_height="@dimen/app_bar_height"
android:background="@color/colorPrimaryTransparent"/>
<android.support.v7.widget.Toolbar <android.support.v7.widget.Toolbar
android:id="@+id/toolbar" android:id="@+id/toolbar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize" android:layout_height="?attr/actionBarSize"
android:layout_weight="1"
android:background="@color/transparent" android:background="@color/transparent"
app:layout_scrollFlags="scroll|enterAlways" android:layout_marginTop="8dp"
app:popupTheme="@style/AppTheme.PopupOverlay" app:layout_collapseMode="none"
app:title="Client Logo" app:popupTheme="@style/AppTheme.PopupOverlay">
app:titleTextColor="@color/white" >
<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 <cy.agorise.crystalwallet.util.CircularImageView
android:id="@+id/toolbar_logo" android:id="@+id/toolbar_logo"
android:src="@drawable/ken_code_gravatar"
android:layout_width="?attr/actionBarSize" android:layout_width="?attr/actionBarSize"
android:layout_height="match_parent" android:layout_height="?attr/actionBarSize"
android:layout_marginEnd="14dp"
android:layout_marginTop="4dp"
android:layout_marginBottom="4dp"
android:layout_gravity="end" android:layout_gravity="end"
android:background="@drawable/roundcorner"/> android:layout_marginEnd="40dp"
android:src="@drawable/ken_code_gravatar" />
</android.support.v7.widget.Toolbar> </android.support.v7.widget.Toolbar>
<android.support.design.widget.TabLayout <android.support.design.widget.TabLayout
android:id="@+id/tabs" android:id="@+id/tabs"
android:layout_gravity="bottom"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
app:layout_collapseMode="pin"
android:animateLayoutChanges="true"> android:animateLayoutChanges="true">
<android.support.design.widget.TabItem <android.support.design.widget.TabItem
@ -64,8 +90,12 @@
android:text="@string/contacts" /> android:text="@string/contacts" />
</android.support.design.widget.TabLayout> </android.support.design.widget.TabLayout>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout> </android.support.design.widget.AppBarLayout>
<!-- change height -->
<android.support.v4.view.ViewPager <android.support.v4.view.ViewPager
android:id="@+id/pager" android:id="@+id/pager"
android:layout_width="match_parent" android:layout_width="match_parent"
@ -102,7 +132,7 @@
app:srcCompat="@drawable/ic_person_add" /> app:srcCompat="@drawable/ic_person_add" />
<!-- Place settings button correctly --> <!-- Place settings button correctly -->
<!--
<RelativeLayout <RelativeLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -115,5 +145,5 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerHorizontal="true" android:layout_centerHorizontal="true"
android:background="@drawable/icon_setting" /> android:background="@drawable/icon_setting" />
</RelativeLayout> </RelativeLayout>-->
</android.support.design.widget.CoordinatorLayout> </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" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
@ -9,4 +9,4 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:id="@+id/vTransactionListView" /> 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="white">#ffffff</color>
<color name="pink">#f0006b</color> <color name="pink">#f0006b</color>
<color name="transparent">#00ffffff</color> <color name="transparent">#00ffffff</color>
<color name="colorPrimaryTransparent">#330099d6</color>
<color name="green">#147b00</color> <color name="green">#147b00</color>

View file

@ -6,7 +6,7 @@
<dimen name="tab_padding_bottom">16dp</dimen> <dimen name="tab_padding_bottom">16dp</dimen>
<dimen name="tab_label">14sp</dimen> <dimen name="tab_label">14sp</dimen>
<dimen name="custom_tab_layout_height">72dp</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="fab_margin">16dp</dimen>
<dimen name="text_margin">16dp</dimen> <dimen name="text_margin">16dp</dimen>
<dimen name="layout_margin">35sp</dimen> <dimen name="layout_margin">35sp</dimen>