View MyApplication.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyApplication : Application(){ | |
override fun onCreate() { | |
super.onCreate() | |
applyTheme() | |
} | |
private fun applyTheme() { | |
PreferenceManager.getDefaultSharedPreferences(this) | |
.getString(getString(R.string.key_app_theme), ThemeHelper.DEFAULT_MODE)?.apply { |
View try-catch-finally separation.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void delete(Page page) { | |
try { | |
deletePageAndAllReferences(page); | |
} | |
catch (Exception e) { | |
logError(e); | |
} | |
} | |
private void deletePageAndAllReferences(Page page) throws Exception { |
View gist:6668b85b943df4ff1ed63a410baf5649
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
╔=============|=====================╗==============================================================================| | |
║ AppState |Notification ║ Data | Both | | |
╠════════=════|════════=============╣===================|==========================================================| | |
║ Foreground | onMessageReceived ║ onMessageReceived | onMessageReceived | | |
║ Background | System tray ║ onMessageReceived | Notification: system tray. Data: in extras of the intent | | |
╚════════════=╩════════=============|===================|==========================================================| |
View CircularRevealActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
create a new circular reaveal on the give view. This view is initially invisible. In this case the view covers full screen | |
*/ | |
@TargetApi(Build.VERSION_CODES.LOLLIPOP) | |
private void createCircularReveal(final View view) { | |
// to get the center of FAB | |
int centerX = (int) mFab.getX() + mFab.getWidth() / 2; | |
int centerY = (int) mFab.getY(); | |
float finalRadius = (float) Math.hypot(view.getWidth(), view.getHeight()); |
View custom_animation.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<explode xmlns:android="http://schemas.android.com/apk/res/android"> | |
<targets> | |
<target android:excludeId="@android:id/statusBarBackground" /> | |
<target android:excludeId="@id/toolbar_container" /> | |
</targets> | |
</explode> |
View styles-v21.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<resources> | |
<style name="AppTheme" parent="BaseTheme"> | |
<!-- enable activity transitions --> | |
<item name="android:windowActivityTransitions">true</item> | |
<!-- enable window content transitions --> | |
<item name="android:windowContentTransitions">true</item> |
View SmallDotActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
public void onClick(View v) { | |
if (v instanceof Button) { | |
ImageView circleImage = (ImageView) findViewById(R.id.iv_circle); | |
Intent intent = new Intent(AnimationActivity.this,ImageDetailActivity.class); | |
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { | |
startActivity(intent, | |
ActivityOptions.makeSceneTransitionAnimation( | |
this, | |
new Pair<View, String>(circleImage, |
View styles-v21.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<resources> | |
<style name="BaseTheme" parent="Theme.AppCompat.Light.NoActionBar"> | |
<!-- Customize your theme here. --> | |
<item name="colorPrimary">@color/colorPrimary</item> | |
<item name="colorPrimaryDark">@color/colorPrimaryDark</item> | |
<item name="colorAccent">@color/colorAccent</item> | |
</style> |
View MarshmallowPermissions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example.logintutorial; | |
import android.Manifest; | |
import android.annotation.TargetApi; | |
import android.content.pm.PackageManager; | |
import android.os.Build; | |
import android.os.Bundle; | |
import android.support.annotation.NonNull; | |
import android.support.v4.app.ActivityCompat; | |
import android.support.v4.content.ContextCompat; |