Skip to content

Instantly share code, notes, and snippets.

@KarthikKumarBA
KarthikKumarBA / MainActivity.java
Last active November 25, 2016 08:48
ExternalStorage
package karthik.saveexternaltorage;
import android.os.Environment;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
@KarthikKumarBA
KarthikKumarBA / CallingActivity.java
Created November 24, 2016 10:26
Activity Transition Overlap
private void setupWindowAnimations() {
// Re-enter transition is executed when returning back to this activity
Slide slideTransition = new Slide();
slideTransition.setSlideEdge(Gravity.LEFT);
slideTransition.setDuration(1000);
getWindow().setReenterTransition(slideTransition); // When MainActivity Re-enter the Screen
getWindow().setExitTransition(slideTransition); // When MainActivity Exits the Screen
// For overlap of Re Entering Activity - MainActivity.java and Exiting TransitionActivity.java
@KarthikKumarBA
KarthikKumarBA / CallingActivity.java
Created November 24, 2016 10:26
Activity Shared Element Transition
ImageView imageView = (ImageView) findViewById(R.id.image_star);
TextView textViewName = (TextView) findViewById(R.id.text_view_name);
Pair[] pairs = new Pair[2];
pairs[0] = new Pair<View, String>(imageView, "transition_star");
pairs[1] = new Pair<View, String>(textViewName, "transition_name");
ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(this, pairs);
Intent i = new Intent(this, TransitionActivity.class);
i.putExtra("KEY_TYPE", "SharedTransition");
@KarthikKumarBA
KarthikKumarBA / CallingActivity.java
Created November 24, 2016 10:26
Activity Transition Animations -> Explode, Fade and Slide Animation
/*Create an object of activity options to enable scene transition animation*/
ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(this);
/*Pass it to startActivity() method as the second parameter*/
startActivity(intent, options.toBundle());
<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="#ColorCode">
<!--Without mask, it will create a cborderless ripple-->
<item android:id="@android:id/mask"
android:drawable="@android:color/white"/>
</ripple>
@KarthikKumarBA
KarthikKumarBA / 0_reuse_code.js
Last active November 24, 2016 10:22
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console