Make improvements to Crystal's toolbar animation to avoud memory leaks.

This commit is contained in:
Severiano Jaramillo 2018-10-15 14:17:21 -05:00
parent b8fd519b1a
commit d367373d8e
4 changed files with 9 additions and 45 deletions

View file

@ -79,6 +79,8 @@ public class AccountSettingsActivity extends AppCompatActivity{
@Override @Override
public void surfaceDestroyed(SurfaceHolder surfaceHolder) { public void surfaceDestroyed(SurfaceHolder surfaceHolder) {
//Log.d(TAG,"surfaceDestroyed"); //Log.d(TAG,"surfaceDestroyed");
mediaPlayer.stop();
mediaPlayer.release();
} }
}); });

View file

@ -127,51 +127,6 @@ public class BoardActivity extends CustomActivity {
/* /*
* Listener tabLayout to resalt text when clicked * Listener tabLayout to resalt text when clicked
* */ * */
final TabLayout tabLayoutFinal = tabLayout;
// tabLayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
// @Override
// public void onTabSelected(final TabLayout.Tab tab) {
//
// globalActivity.runOnUiThread(new Runnable() {
// @Override
// public void run() {
//
// LinearLayout tabLayout = (LinearLayout)((ViewGroup) tabLayoutFinal.getChildAt(0)).getChildAt(tab.getPosition());
// tabLayout.setBackgroundColor(Color.TRANSPARENT);
// TextView tabTextView = (TextView) tabLayout.getChildAt(1);
// //tabTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP ,50);
// Spannable WordtoSpan = new SpannableString(tabTextView.getText());
// WordtoSpan.setSpan(new ForegroundColorSpan(Color.WHITE), 0, tabTextView.getText().length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
// tabTextView.setText(WordtoSpan);
// tabTextView.setTypeface(tabTextView.getTypeface(), Typeface.BOLD);
// }
// });
// }
//
// @Override
// public void onTabUnselected(final TabLayout.Tab tab) {
//
// globalActivity.runOnUiThread(new Runnable() {
// @Override
// public void run() {
//
// LinearLayout tabLayout = (LinearLayout)((ViewGroup) tabLayoutFinal.getChildAt(0)).getChildAt(tab.getPosition());
// TextView tabTextView = (TextView) tabLayout.getChildAt(1);
// //tabTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP ,50);
// Spannable WordtoSpan = new SpannableString(tabTextView.getText());
// WordtoSpan.setSpan(new ForegroundColorSpan(globalActivity.getResources().getColor(R.color.lightGrayClear)), 0, tabTextView.getText().length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
// tabTextView.setText(WordtoSpan);
// tabTextView.setTypeface(tabTextView.getTypeface(), Typeface.NORMAL);
// }
// });
// }
//
// @Override
// public void onTabReselected(TabLayout.Tab tab) {
//
//
// }
// });
// Appbar animation // Appbar animation
mSurfaceView.getHolder().addCallback(new SurfaceHolder.Callback() { mSurfaceView.getHolder().addCallback(new SurfaceHolder.Callback() {
@ -192,6 +147,8 @@ public class BoardActivity extends CustomActivity {
@Override @Override
public void surfaceDestroyed(SurfaceHolder surfaceHolder) { public void surfaceDestroyed(SurfaceHolder surfaceHolder) {
//Log.d(TAG,"surfaceDestroyed"); //Log.d(TAG,"surfaceDestroyed");
mediaPlayer.stop();
mediaPlayer.release();
} }
}); });

View file

@ -108,6 +108,9 @@ public class IntroActivity extends CustomActivity {
@Override @Override
public void surfaceDestroyed(SurfaceHolder surfaceHolder) { public void surfaceDestroyed(SurfaceHolder surfaceHolder) {
//Log.d(TAG,"surfaceDestroyed"); //Log.d(TAG,"surfaceDestroyed");
//Log.d(TAG,"surfaceDestroyed");
mediaPlayer.stop();
mediaPlayer.release();
} }
}); });

View file

@ -86,6 +86,8 @@ public class SettingsActivity extends AppCompatActivity{
@Override @Override
public void surfaceDestroyed(SurfaceHolder surfaceHolder) { public void surfaceDestroyed(SurfaceHolder surfaceHolder) {
//Log.d(TAG,"surfaceDestroyed"); //Log.d(TAG,"surfaceDestroyed");
mediaPlayer.stop();
mediaPlayer.release();
} }
}); });