diff --git a/app/build.gradle b/app/build.gradle index ac1b874..e6e2452 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -11,6 +11,11 @@ kapt { } } +repositories { + mavenCentral() + maven { url 'https://maven.google.com' } +} + android { compileSdkVersion 27 defaultConfig { @@ -65,9 +70,6 @@ dependencies { //testCompile 'com.android.support.test:runner:1.0.1' implementation 'com.afollestad.material-dialogs:core:0.9.6.0' implementation 'com.android.support:appcompat-v7:27.1.1' - implementation 'com.github.bumptech.glide:glide:4.7.1' - // Glide v4 uses this new annotation processor -- see https://bumptech.github.io/glide/doc/generatedapi.html - annotationProcessor 'com.github.bumptech.glide:compiler:4.7.1' implementation 'com.android.support:support-v4:27.1.1' implementation 'com.android.support:design:27.1.1' implementation 'com.android.support:cardview-v7:27.1.1' @@ -119,5 +121,9 @@ dependencies { kapt "android.arch.lifecycle:compiler:1.1.1" kapt "android.arch.persistence.room:compiler:1.1.0" + // Glide dependencies + implementation 'com.github.bumptech.glide:glide:4.7.1' + annotationProcessor 'com.github.bumptech.glide:compiler:4.7.1' + debugImplementation 'com.amitshekhar.android:debug-db:1.0.4' } diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro index f1505cd..8c4d86d 100644 --- a/app/proguard-rules.pro +++ b/app/proguard-rules.pro @@ -23,3 +23,10 @@ # If you keep the line number information, uncomment this to # hide the original source file name. #-renamesourcefileattribute SourceFile + +-keep public class * implements com.bumptech.glide.module.GlideModule +-keep public class * extends com.bumptech.glide.module.AppGlideModule +-keep public enum com.bumptech.glide.load.ImageHeaderParser$** { + **[] $VALUES; + public *; +} \ No newline at end of file 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 d66a163..d8bfc68 100644 --- a/app/src/main/java/cy/agorise/crystalwallet/activities/IntroActivity.java +++ b/app/src/main/java/cy/agorise/crystalwallet/activities/IntroActivity.java @@ -2,15 +2,15 @@ package cy.agorise.crystalwallet.activities; import android.arch.lifecycle.ViewModelProviders; import android.content.Intent; -import android.media.MediaPlayer; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentTransaction; -import android.view.SurfaceHolder; -import android.view.SurfaceView; import android.view.View; import android.widget.Button; +import android.widget.ImageView; +import com.bumptech.glide.Glide; +import com.bumptech.glide.request.RequestOptions; import com.thekhaeng.pushdownanim.PushDownAnim; import butterknife.BindView; @@ -22,19 +22,19 @@ import cy.agorise.crystalwallet.viewmodels.AccountSeedListViewModel; public class IntroActivity extends CustomActivity { - @BindView(R.id.surface_view) - public SurfaceView mSurfaceView; + @BindView(R.id.ivAnimation) + ImageView ivAnimation; @BindView(R.id.btnCreateAccount) - public Button btnCreateAccount; + Button btnCreateAccount; @BindView(R.id.btnImportAccount) - public Button btnImportAccount; + Button btnImportAccount; /* * For the window animation * */ - private MediaPlayer mediaPlayer; +// private MediaPlayer mediaPlayer; @@ -46,8 +46,13 @@ public class IntroActivity extends CustomActivity { ButterKnife.bind(this); + Glide.with(this) + .load(R.drawable.appbar_background) + .apply(new RequestOptions().centerCrop()) + .into(ivAnimation); + /* - * Integration of library with button efects + * Integration of library with button effects * */ PushDownAnim.setPushDownAnimTo(btnCreateAccount) .setOnClickListener( new View.OnClickListener(){ @@ -64,53 +69,23 @@ public class IntroActivity extends CustomActivity { } } ); - // Appbar animation - mSurfaceView.getHolder().addCallback(new SurfaceHolder.Callback() { - @Override - public void surfaceCreated(SurfaceHolder surfaceHolder) { - //Log.d(TAG,"surfaceCreated"); - mediaPlayer = MediaPlayer.create(IntroActivity.this, R.raw.appbar_background); - mediaPlayer.setDisplay(mSurfaceView.getHolder()); - mediaPlayer.setLooping(true); - mediaPlayer.start(); - } + //Checks if the user has any seed created + AccountSeedListViewModel accountSeedListViewModel = ViewModelProviders.of(this).get(AccountSeedListViewModel.class); - @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"); - //Log.d(TAG,"surfaceDestroyed"); - mediaPlayer.stop(); - mediaPlayer.release(); - } - }); - - //this.getApplication().registerActivityLifecycleCallbacks(CrystalSecurityMonitor.getInstance(this)); - - - - - //Checks if the user has any seed created - AccountSeedListViewModel accountSeedListViewModel = ViewModelProviders.of(this).get(AccountSeedListViewModel.class); - - if (accountSeedListViewModel.accountSeedsCount() == 0) { - //If the user doesn't have any seeds created, then - //send the user to create/import an account - //Intent intent = new Intent(this, AccountSeedsManagementActivity.class); - //Intent intent = new Intent(this, ImportSeedActivity.class); - //Intent intent = new Intent(this, CreateSeedActivity.class); - //startActivity(intent); - } else { - //Intent intent = new Intent(this, CreateSeedActivity.class); - Intent intent = new Intent(this, BoardActivity.class); - //Intent intent = new Intent(this, PocketRequestActivity.class); - startActivity(intent); - finish(); - } + if (accountSeedListViewModel.accountSeedsCount() == 0) { + //If the user doesn't have any seeds created, then + //send the user to create/import an account + //Intent intent = new Intent(this, AccountSeedsManagementActivity.class); + //Intent intent = new Intent(this, ImportSeedActivity.class); + //Intent intent = new Intent(this, CreateSeedActivity.class); + //startActivity(intent); + } else { + //Intent intent = new Intent(this, CreateSeedActivity.class); + Intent intent = new Intent(this, BoardActivity.class); + //Intent intent = new Intent(this, PocketRequestActivity.class); + startActivity(intent); + finish(); + } /*CrystalDatabase db = CrystalDatabase.getAppDatabase(getApplicationContext()); List seeds = RandomSeedGenerator.generateSeeds(2); @@ -154,17 +129,6 @@ public class IntroActivity extends CustomActivity { startActivity(intent); } - @Override - protected void onDestroy() { - super.onDestroy(); - - //Release the media player - if(mediaPlayer!=null){ - mediaPlayer.release(); - mediaPlayer = null; - } - } - @OnClick(R.id.btnImportAccount) public void importAccount() { FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); diff --git a/app/src/main/java/cy/agorise/crystalwallet/util/MyAppGlideModule.java b/app/src/main/java/cy/agorise/crystalwallet/util/MyAppGlideModule.java new file mode 100644 index 0000000..4965fba --- /dev/null +++ b/app/src/main/java/cy/agorise/crystalwallet/util/MyAppGlideModule.java @@ -0,0 +1,13 @@ +package cy.agorise.crystalwallet.util; + +import com.bumptech.glide.annotation.GlideModule; +import com.bumptech.glide.module.AppGlideModule; + + +/** + * This function is used to generate a local Glide API accessible by a GlideApp call + * which makes it easier to use more advanced Glide methods. + * {more information - https://bumptech.github.io/glide/doc/generatedapi.html} + */ +@GlideModule +public class MyAppGlideModule extends AppGlideModule {} diff --git a/app/src/main/res/drawable/appbar_background.gif b/app/src/main/res/drawable/appbar_background.gif new file mode 100644 index 0000000..0b609d5 Binary files /dev/null and b/app/src/main/res/drawable/appbar_background.gif differ diff --git a/app/src/main/res/layout/activity_intro.xml b/app/src/main/res/layout/activity_intro.xml index 3f7805d..6a1fe1a 100644 --- a/app/src/main/res/layout/activity_intro.xml +++ b/app/src/main/res/layout/activity_intro.xml @@ -9,8 +9,8 @@ android:background="@color/colorPrimary" tools:context="cy.agorise.crystalwallet.activities.IntroActivity"> - + app:layout_constraintTop_toTopOf="@id/ivAnimation" + app:layout_constraintStart_toStartOf="@id/ivAnimation" + app:layout_constraintEnd_toEndOf="@id/ivAnimation" + app:layout_constraintBottom_toBottomOf="@id/ivAnimation"/> + app:layout_constraintTop_toTopOf="@id/ivAnimation" + app:layout_constraintBottom_toBottomOf="@id/ivAnimation"/>