From d01f84c19847244b6975a7a95e23b3a6128281f2 Mon Sep 17 00:00:00 2001 From: Severiano Jaramillo Date: Thu, 25 Jan 2018 18:37:29 -0600 Subject: [PATCH] Improved ActivityIntro by adding animated backgroung and making the logo bigger --- .../activities/IntroActivity.java | 32 +++++++++++++- app/src/main/res/layout/activity_intro.xml | 43 +++++++++++++------ app/src/main/res/values/strings.xml | 2 + 3 files changed, 62 insertions(+), 15 deletions(-) diff --git a/app/src/main/java/cy/agorise/crystalwallet/activities/IntroActivity.java b/app/src/main/java/cy/agorise/crystalwallet/activities/IntroActivity.java index 42d53d2..f7057ae 100644 --- a/app/src/main/java/cy/agorise/crystalwallet/activities/IntroActivity.java +++ b/app/src/main/java/cy/agorise/crystalwallet/activities/IntroActivity.java @@ -7,9 +7,12 @@ import android.arch.lifecycle.ViewModelProvider; import android.arch.lifecycle.ViewModelProviders; import android.arch.paging.PagedList; import android.content.Intent; +import android.media.MediaPlayer; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v7.app.AppCompatActivity; +import android.view.SurfaceHolder; +import android.view.SurfaceView; import android.view.View; import android.widget.Button; @@ -39,6 +42,9 @@ public class IntroActivity extends AppCompatActivity { TransactionListViewModel transactionListViewModel; TransactionListView transactionListView; + @BindView(R.id.surface_view) + public SurfaceView mSurfaceView; + @BindView(R.id.btnCreateAccount) public Button btnCreateAccount; @@ -51,8 +57,30 @@ public class IntroActivity extends AppCompatActivity { setContentView(R.layout.activity_intro); ButterKnife.bind(this); + // Appbar animation + mSurfaceView.getHolder().addCallback(new SurfaceHolder.Callback() { + @Override + public void surfaceCreated(SurfaceHolder surfaceHolder) { + //Log.d(TAG,"surfaceCreated"); + MediaPlayer mediaPlayer = MediaPlayer.create(IntroActivity.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"); + } + }); + //Checks if the user has any seed created - AccountSeedListViewModel accountSeedListViewModel = ViewModelProviders.of(this).get(AccountSeedListViewModel.class); + /*AccountSeedListViewModel accountSeedListViewModel = ViewModelProviders.of(this).get(AccountSeedListViewModel.class); if (accountSeedListViewModel.accountSeedsCount() == 0){ //If the user doesn't have any seeds created, then @@ -65,7 +93,7 @@ public class IntroActivity extends AppCompatActivity { //Intent intent = new Intent(this, CreateSeedActivity.class); Intent intent = new Intent(this, BoardActivity.class); startActivity(intent); - } + }*/ /*CrystalDatabase db = CrystalDatabase.getAppDatabase(getApplicationContext()); List seeds = RandomSeedGenerator.generateSeeds(2); diff --git a/app/src/main/res/layout/activity_intro.xml b/app/src/main/res/layout/activity_intro.xml index b8a8c47..b2b5066 100644 --- a/app/src/main/res/layout/activity_intro.xml +++ b/app/src/main/res/layout/activity_intro.xml @@ -19,7 +19,8 @@ --> - + + + + + tools:layout_editor_absoluteY="114dp" + app:layout_constraintTop_toTopOf="@id/surface_view" + app:layout_constraintBottom_toBottomOf="@id/surface_view"/> + app:layout_constraintVertical_bias="0.4" + app:layout_constraintTop_toBottomOf="@id/surface_view" + app:layout_constraintVertical_chainStyle="packed" />