Improved ActivityIntro by adding animated backgroung and making the logo bigger

master
Severiano Jaramillo 2018-01-25 18:37:29 -06:00
parent cf31baa88c
commit d01f84c198
3 changed files with 62 additions and 15 deletions

View File

@ -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<AccountSeed> seeds = RandomSeedGenerator.generateSeeds(2);

View File

@ -19,7 +19,8 @@
</cy.agorise.crystalwallet.views.TransactionListView>
</RelativeLayout>
-->
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
<android.support.constraint.ConstraintLayout
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/activity_intro"
@ -28,31 +29,47 @@
android:background="@color/colorPrimary"
tools:context="cy.agorise.crystalwallet.activities.IntroActivity">
<SurfaceView
android:id="@+id/surface_view"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintDimensionRatio="2:1.2"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<View
android:layout_width="0dp"
android:layout_height="0dp"
android:background="@color/colorPrimaryTransparent"
app:layout_constraintTop_toTopOf="@id/surface_view"
app:layout_constraintStart_toStartOf="@id/surface_view"
app:layout_constraintEnd_toEndOf="@id/surface_view"
app:layout_constraintBottom_toBottomOf="@id/surface_view"/>
<ImageView
android:id="@+id/ivLogo"
android:layout_width="wrap_content"
android:layout_height="60dp"
android:layout_height="100dp"
android:contentDescription="@string/crystal_logo"
android:src="@drawable/crystal_logo"
app:layout_constraintBottom_toTopOf="@+id/tvNewUser"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintVertical_bias="0.4"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_chainStyle="packed" />
tools:layout_editor_absoluteY="114dp"
app:layout_constraintTop_toTopOf="@id/surface_view"
app:layout_constraintBottom_toBottomOf="@id/surface_view"/>
<TextView
android:id="@+id/tvNewUser"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="32dp"
android:layout_marginTop="80dp"
android:text="@string/new_user"
android:textColor="@color/white"
android:textSize="16sp"
app:layout_constraintBottom_toTopOf="@+id/btnCreateAccount"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/ivLogo" />
app:layout_constraintVertical_bias="0.4"
app:layout_constraintTop_toBottomOf="@id/surface_view"
app:layout_constraintVertical_chainStyle="packed" />
<Button
android:id="@+id/btnCreateAccount"
@ -62,7 +79,7 @@
android:layout_marginStart="32dp"
android:layout_marginTop="8dp"
android:background="@color/colorPrimaryDark"
android:text="Create Account"
android:text="@string/create_account"
android:textAllCaps="false"
android:textColor="@color/white"
android:textSize="20sp"
@ -94,7 +111,7 @@
android:layout_marginStart="32dp"
android:layout_marginTop="8dp"
android:background="@color/colorPrimaryDark"
android:text="Import Account"
android:text="@string/import_account"
android:textAllCaps="false"
android:textColor="@color/white"
android:textSize="20sp"

View File

@ -501,4 +501,6 @@
<string name="connection_status">Connection status</string>
<string name="people_icon">People icon</string>
<string name="camera_feed_to_scan_qr">Camera feed to scan QR</string>
<string name="create_account">Create Account</string>
<string name="import_account">Import Account</string>
</resources>