Skip to content

Commit

Permalink
Add scale-up transition from MainActivity -> OverviewActivity
Browse files Browse the repository at this point in the history
  • Loading branch information
nishantkp committed Dec 8, 2017
1 parent 140bccd commit ffab8d3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.example.android.udninventory;

import android.app.ActivityOptions;
import android.content.ContentUris;
import android.content.ContentValues;
import android.content.Intent;
Expand Down Expand Up @@ -67,8 +68,18 @@ public void onItemClick(AdapterView<?> parent, View view, int position, long id)
Intent intent = new Intent(MainActivity.this, OverviewActivity.class);
// Set uri as data field for Intent
intent.setData(currentItemUri);
// Launch the {@link EditorActivity} to display the current pet
startActivity(intent);
ActivityOptions options = null;
// If current SDK build is greater that API 16, then only perform scale up animation
// to start {@link Overview Activity}
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN) {
options = ActivityOptions.makeScaleUpAnimation(view, 0,
0, view.getWidth(), view.getHeight());
// Launch the {@link OverviewActivity} to display the current pet
startActivity(intent, options.toBundle());
} else {
// Otherwise current SDK build is less than 16, so start activity as usual
startActivity(intent);
}
}
});

Expand Down

0 comments on commit ffab8d3

Please sign in to comment.