Change background animation in IntroActivity from Video to GIF.

The video background animation was giving errors on Android Lollipop and wasn't displaying correctly. Searching on the internet I found that the encoding of the video could be the problem but tested with many different encoding profiles (H.264 high, main, baseline) and none of them solved the issue so I finally gave up and converted the video back to a GIF and used that one.
This commit is contained in:
Severiano Jaramillo 2018-10-25 11:51:53 -05:00
parent 4ba6299822
commit 36d97e8166
6 changed files with 68 additions and 78 deletions

View file

@ -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'
}

View file

@ -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 *;
}

View file

@ -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,36 +69,6 @@ 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();
}
@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);
@ -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();

View file

@ -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 {}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 MiB

View file

@ -9,8 +9,8 @@
android:background="@color/colorPrimary"
tools:context="cy.agorise.crystalwallet.activities.IntroActivity">
<SurfaceView
android:id="@+id/surface_view"
<ImageView
android:id="@+id/ivAnimation"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintDimensionRatio="2:1.2"
@ -22,10 +22,10 @@
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"/>
app:layout_constraintTop_toTopOf="@id/ivAnimation"
app:layout_constraintStart_toStartOf="@id/ivAnimation"
app:layout_constraintEnd_toEndOf="@id/ivAnimation"
app:layout_constraintBottom_toBottomOf="@id/ivAnimation"/>
<ImageView
android:id="@+id/ivLogo"
@ -34,8 +34,8 @@
android:contentDescription="@string/crystal_logo"
android:src="@drawable/crystal_logo"
tools:layout_editor_absoluteY="114dp"
app:layout_constraintTop_toTopOf="@id/surface_view"
app:layout_constraintBottom_toBottomOf="@id/surface_view"/>
app:layout_constraintTop_toTopOf="@id/ivAnimation"
app:layout_constraintBottom_toBottomOf="@id/ivAnimation"/>
<TextView
android:id="@+id/tvNewUser"
@ -48,7 +48,7 @@
app:layout_constraintBottom_toTopOf="@+id/btnCreateAccount"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintVertical_bias="0.4"
app:layout_constraintTop_toBottomOf="@id/surface_view"
app:layout_constraintTop_toBottomOf="@id/ivAnimation"
app:layout_constraintVertical_chainStyle="packed" />
<Button