├── .idea ├── .name ├── copyright │ └── profiles_settings.xml ├── scopes │ └── scope_settings.xml ├── encodings.xml ├── vcs.xml ├── modules.xml ├── gradle.xml ├── compiler.xml └── misc.xml ├── app ├── .gitignore ├── src │ ├── main │ │ ├── res │ │ │ ├── mipmap-hdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-mdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── values │ │ │ │ ├── strings.xml │ │ │ │ ├── dimens.xml │ │ │ │ ├── color.xml │ │ │ │ └── styles.xml │ │ │ ├── anim │ │ │ │ ├── slide_up.xml │ │ │ │ ├── slide_down.xml │ │ │ │ ├── slide_in_right.xml │ │ │ │ ├── slide_out_right.xml │ │ │ │ ├── scale_up.xml │ │ │ │ └── scale_down.xml │ │ │ ├── menu │ │ │ │ └── menu_main.xml │ │ │ ├── values-w820dp │ │ │ │ └── dimens.xml │ │ │ ├── drawable │ │ │ │ ├── circle.xml │ │ │ │ ├── circle_button.xml │ │ │ │ └── circle_shadow.xml │ │ │ ├── layout │ │ │ │ ├── fragment_thing_list.xml │ │ │ │ ├── fragment_overaly.xml │ │ │ │ ├── list_item.xml │ │ │ │ ├── toolbar_container.xml │ │ │ │ ├── activity_base.xml │ │ │ │ └── fragment_thing_detail.xml │ │ │ └── values-v21 │ │ │ │ └── style.xml │ │ ├── java │ │ │ └── com │ │ │ │ └── toddway │ │ │ │ └── sandbox │ │ │ │ ├── Thing.java │ │ │ │ ├── ThingRecyclerAdapter.java │ │ │ │ ├── Navigator.java │ │ │ │ ├── BitmapUtil.java │ │ │ │ ├── ThingListFragment.java │ │ │ │ ├── OverScrollView.java │ │ │ │ ├── BaseRecyclerAdapter.java │ │ │ │ ├── ThingDetailFragment.java │ │ │ │ ├── BaseActivity.java │ │ │ │ ├── OverlayFragment.java │ │ │ │ └── TransitionHelper.java │ │ └── AndroidManifest.xml │ └── androidTest │ │ └── java │ │ └── com │ │ └── toddway │ │ └── sandbox │ │ └── ApplicationTest.java ├── proguard-rules.pro ├── build.gradle └── app.iml ├── settings.gradle ├── .gitignore ├── img └── activity-transitions.gif ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradle.properties ├── Sandbox.iml ├── gradlew.bat ├── README.md └── gradlew /.idea/.name: -------------------------------------------------------------------------------- 1 | Sandbox -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .gradle 2 | /local.properties 3 | /.idea/workspace.xml 4 | /.idea/libraries 5 | .DS_Store 6 | /build 7 | -------------------------------------------------------------------------------- /.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /img/activity-transitions.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/toddway/MaterialTransitions/HEAD/img/activity-transitions.gif -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/toddway/MaterialTransitions/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/toddway/MaterialTransitions/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/toddway/MaterialTransitions/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/toddway/MaterialTransitions/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/toddway/MaterialTransitions/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /.idea/scopes/scope_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | -------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Sandbox 3 | Hello world! 4 | Settings 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 6 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Wed Apr 10 15:27:10 PDT 2013 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip 7 | -------------------------------------------------------------------------------- /app/src/main/java/com/toddway/sandbox/Thing.java: -------------------------------------------------------------------------------- 1 | package com.toddway.sandbox; 2 | 3 | public class Thing { 4 | public String text; 5 | public String color; 6 | public Thing(String text, String color) { 7 | this.text = text; 8 | this.color = color; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /app/src/main/res/anim/slide_up.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/values/color.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | @android:color/holo_purple 4 | #ccaa66cc 5 | @android:color/holo_purple 6 | #EEEEEE 7 | -------------------------------------------------------------------------------- /app/src/main/res/anim/slide_down.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/anim/slide_in_right.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/anim/slide_out_right.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/anim/scale_up.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/anim/scale_down.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/menu/menu_main.xml: -------------------------------------------------------------------------------- 1 | 4 | 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 64dp 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/circle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/toddway/sandbox/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package com.toddway.sandbox; 2 | 3 | import android.app.Application; 4 | import android.test.ApplicationTestCase; 5 | 6 | /** 7 | * Testing Fundamentals 8 | */ 9 | public class ApplicationTest extends ApplicationTestCase { 10 | public ApplicationTest() { 11 | super(Application.class); 12 | } 13 | } -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_thing_list.xml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /app/src/main/res/values-v21/style.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17 | 18 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /usr/local/android-sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 10 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_overaly.xml: -------------------------------------------------------------------------------- 1 | 2 | 11 | 20 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 14 | 15 | # When configured, Gradle will run in incubating parallel mode. 16 | # This option should only be used with decoupled projects. More details, visit 17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 18 | # org.gradle.parallel=true -------------------------------------------------------------------------------- /Sandbox.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /app/src/main/java/com/toddway/sandbox/ThingRecyclerAdapter.java: -------------------------------------------------------------------------------- 1 | package com.toddway.sandbox; 2 | 3 | import android.view.LayoutInflater; 4 | import android.view.View; 5 | import android.view.ViewGroup; 6 | import android.widget.TextView; 7 | 8 | import butterknife.InjectView; 9 | 10 | 11 | public class ThingRecyclerAdapter extends BaseRecyclerAdapter { 12 | 13 | @Override 14 | public ThingHolder onCreateViewHolder(ViewGroup parent, int viewType) { 15 | View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_item, parent, false); 16 | return new ThingHolder(view); 17 | } 18 | 19 | public class ThingHolder extends BaseRecyclerAdapter.ViewHolder { 20 | @InjectView(R.id.title) 21 | TextView titleTextView; 22 | 23 | public ThingHolder(View itemView) { 24 | super(itemView); 25 | } 26 | 27 | public void populate(Thing item) { 28 | titleTextView.setText(item.text); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 22 5 | buildToolsVersion "21.1.2" 6 | 7 | defaultConfig { 8 | applicationId "com.toddway.sandbox" 9 | minSdkVersion 19 10 | targetSdkVersion 22 11 | versionCode 1 12 | versionName "1.0" 13 | buildConfigField "String", "BUILD_TIME", "\"${buildTime()}\"" 14 | } 15 | buildTypes { 16 | release { 17 | minifyEnabled false 18 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 19 | } 20 | } 21 | } 22 | 23 | dependencies { 24 | compile fileTree(dir: 'libs', include: ['*.jar']) 25 | compile 'com.android.support:appcompat-v7:22.0.0' 26 | compile 'com.android.support:support-v13:22.+' 27 | compile 'com.android.support:recyclerview-v7:22.0.+' 28 | compile 'com.android.support:cardview-v7:22.0.+' 29 | compile 'com.jakewharton:butterknife:5.1.2' 30 | compile 'com.balysv.materialmenu:material-menu-toolbar:1.5.1' 31 | } 32 | 33 | 34 | import java.text.SimpleDateFormat 35 | def buildTime() { 36 | def df = new SimpleDateFormat("M/d/yy hh:mm a") 37 | return df.format(new Date()) 38 | } -------------------------------------------------------------------------------- /app/src/main/res/drawable/circle_button.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /app/src/main/res/layout/list_item.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 23 | 24 | 31 | 32 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /app/src/main/res/layout/toolbar_container.xml: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 19 | 20 | 21 | 27 | 38 | 48 | 49 | -------------------------------------------------------------------------------- /app/src/main/java/com/toddway/sandbox/Navigator.java: -------------------------------------------------------------------------------- 1 | package com.toddway.sandbox; 2 | 3 | 4 | import android.content.Intent; 5 | import android.support.v4.app.ActivityCompat; 6 | import android.support.v4.app.ActivityOptionsCompat; 7 | import android.support.v4.util.Pair; 8 | import android.support.v4.view.ViewCompat; 9 | import android.view.View; 10 | 11 | public class Navigator { 12 | 13 | public static int ANIM_DURATION = 350; 14 | 15 | public static void launchDetail(BaseActivity fromActivity, View fromView, Thing item, View backgroundView) { 16 | ViewCompat.setTransitionName(fromView, "detail_element"); 17 | ViewCompat.setTransitionName(fromActivity.findViewById(R.id.fab), "fab"); 18 | ActivityOptionsCompat options = 19 | TransitionHelper.makeOptionsCompat( 20 | fromActivity, 21 | Pair.create(fromView, "detail_element"), 22 | Pair.create(fromActivity.findViewById(R.id.fab), "fab") 23 | ); 24 | Intent intent = new Intent(fromActivity, BaseActivity.class); 25 | intent.putExtra("item_text", item.text); 26 | intent.putExtra("fragment_resource_id", R.layout.fragment_thing_detail); 27 | 28 | if (backgroundView != null) BitmapUtil.storeBitmapInIntent(BitmapUtil.createBitmap(backgroundView), intent); 29 | 30 | ActivityCompat.startActivity(fromActivity, intent, options.toBundle()); 31 | 32 | fromActivity.overridePendingTransition(R.anim.slide_up, R.anim.scale_down); 33 | } 34 | 35 | public static void launchOverlay(BaseActivity fromActivity, View fromView, View backgroundView) { 36 | ActivityOptionsCompat options = 37 | TransitionHelper.makeOptionsCompat( 38 | fromActivity 39 | ); 40 | Intent intent = new Intent(fromActivity, BaseActivity.class); 41 | intent.putExtra("fragment_resource_id", R.layout.fragment_overaly); 42 | 43 | if (backgroundView != null) BitmapUtil.storeBitmapInIntent(BitmapUtil.createBitmap(backgroundView), intent); 44 | 45 | ActivityCompat.startActivity(fromActivity, intent, options.toBundle()); 46 | 47 | fromActivity.overridePendingTransition(R.anim.slide_up, R.anim.scale_down); 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /app/src/main/java/com/toddway/sandbox/BitmapUtil.java: -------------------------------------------------------------------------------- 1 | package com.toddway.sandbox; 2 | 3 | import android.content.Intent; 4 | import android.graphics.Bitmap; 5 | import android.graphics.Canvas; 6 | import android.util.LruCache; 7 | import android.view.View; 8 | 9 | import java.util.UUID; 10 | 11 | 12 | public class BitmapUtil { 13 | private static LruCache mMemoryCache; 14 | static { 15 | final int maxMemory = (int) (Runtime.getRuntime().maxMemory() / 1024); 16 | final int cacheSize = maxMemory / 8; // Use 1/8th of the available memory for this memory cache. 17 | mMemoryCache = new LruCache(cacheSize) { 18 | @Override 19 | protected int sizeOf(String key, Bitmap bitmap) { 20 | return bitmap.getByteCount() / 1024; // The cache size will be measured in kilobytes rather than number of items. 21 | } 22 | }; 23 | } 24 | 25 | public static void storeBitmapInIntent(Bitmap bitmap, Intent intent) { 26 | String key = "bitmap_" + UUID.randomUUID(); 27 | storeBitmapInMemCache(key, bitmap); 28 | intent.putExtra("bitmap_id", key); 29 | 30 | // ByteArrayOutputStream bs = new ByteArrayOutputStream(); 31 | // bitmap.compress(Bitmap.CompressFormat.PNG, 0, bs); 32 | // intent.putExtra("background", bs.toByteArray()); 33 | } 34 | 35 | public static void storeBitmapInMemCache(String key, Bitmap bitmap) { 36 | if (getBitmapFromMemCache(key) == null) { 37 | mMemoryCache.put(key, bitmap); 38 | } 39 | } 40 | 41 | public static Bitmap getBitmapFromMemCache(String key) { 42 | return mMemoryCache.get(key); 43 | } 44 | 45 | public static Bitmap fetchBitmapFromIntent(Intent intent) { 46 | String key = intent.getStringExtra("bitmap_id"); 47 | // byte[] byteArray = intent.getByteArrayExtra("background"); 48 | // Bitmap bitmap = BitmapFactory.decodeByteArray(byteArray, 0, byteArray.length); 49 | return getBitmapFromMemCache(key); 50 | } 51 | 52 | public static Bitmap createBitmap(View v) { 53 | Bitmap bitmap = Bitmap.createBitmap(v.getWidth(), v.getHeight(), Bitmap.Config.ARGB_8888); 54 | Canvas canvas = new Canvas(bitmap); 55 | v.draw(canvas); 56 | return bitmap; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_base.xml: -------------------------------------------------------------------------------- 1 | 9 | 10 | 11 | 17 | 18 | 19 | 20 | 25 | 26 | 30 | 31 | 36 | 37 |