Merge "Added no transiton animation option to animation demos." into mnc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
522c7f5ab8
@@ -59,5 +59,9 @@
|
||||
android:text="@string/activity_zoom_thumbnail_animation">
|
||||
</Button>
|
||||
|
||||
<Button android:id="@+id/no_animation"
|
||||
android:layout_width="wrap_content" android:layout_height="wrap_content"
|
||||
android:text="@string/activity_no_animation">
|
||||
</Button>
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
@@ -77,6 +77,7 @@
|
||||
<string name="activity_modern_animation_zoom">Modern zoom in</string>
|
||||
<string name="activity_scale_up_animation">Scale up</string>
|
||||
<string name="activity_zoom_thumbnail_animation">Thumbnail zoom</string>
|
||||
<string name="activity_no_animation">No Animation</string>
|
||||
|
||||
<string name="activity_save_restore">App/Activity/Save & Restore State</string>
|
||||
<string name="save_restore_msg">Demonstration of saving and restoring activity state in onSaveInstanceState() and onCreate().</string>
|
||||
|
||||
@@ -24,6 +24,7 @@ import android.content.DialogInterface;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
@@ -56,6 +57,7 @@ App/Dialog/Alert Dialog
|
||||
* </table>
|
||||
*/
|
||||
public class AlertDialogSamples extends Activity {
|
||||
private static final String TAG = "AlertDialogSamples";
|
||||
private static final int DIALOG_YES_NO_MESSAGE = 1;
|
||||
private static final int DIALOG_YES_NO_LONG_MESSAGE = 2;
|
||||
private static final int DIALOG_LIST = 3;
|
||||
@@ -469,4 +471,9 @@ public class AlertDialogSamples extends Activity {
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEnterAnimationComplete() {
|
||||
Log.i(TAG, "onEnterAnimationComplete");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ import android.content.Intent;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Canvas;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.widget.Button;
|
||||
@@ -35,6 +36,8 @@ import android.widget.Button;
|
||||
* <p>Example of using a custom animation when transitioning between activities.</p>
|
||||
*/
|
||||
public class Animation extends Activity {
|
||||
private static final String TAG = "Animation";
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
@@ -55,6 +58,8 @@ public class Animation extends Activity {
|
||||
button.setOnClickListener(mScaleUpListener);
|
||||
button = (Button)findViewById(R.id.zoom_thumbnail_animation);
|
||||
button.setOnClickListener(mZoomThumbnailListener);
|
||||
button = (Button)findViewById(R.id.no_animation);
|
||||
button.setOnClickListener(mNoAnimationListener);
|
||||
} else {
|
||||
findViewById(R.id.modern_fade_animation).setEnabled(false);
|
||||
findViewById(R.id.modern_zoom_animation).setEnabled(false);
|
||||
@@ -63,8 +68,14 @@ public class Animation extends Activity {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEnterAnimationComplete() {
|
||||
Log.i(TAG, "onEnterAnimationComplete");
|
||||
}
|
||||
|
||||
private OnClickListener mFadeListener = new OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
Log.i(TAG, "Starting fade-in animation...");
|
||||
// Request the next activity transition (here starting a new one).
|
||||
startActivity(new Intent(Animation.this, AlertDialogSamples.class));
|
||||
// Supply a custom animation. This one will just fade the new
|
||||
@@ -77,6 +88,7 @@ public class Animation extends Activity {
|
||||
|
||||
private OnClickListener mZoomListener = new OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
Log.i(TAG, "Starting zoom-in animation...");
|
||||
// Request the next activity transition (here starting a new one).
|
||||
startActivity(new Intent(Animation.this, AlertDialogSamples.class));
|
||||
// This is a more complicated animation, involving transformations
|
||||
@@ -90,6 +102,7 @@ public class Animation extends Activity {
|
||||
|
||||
private OnClickListener mModernFadeListener = new OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
Log.i(TAG, "Starting modern-fade-in animation...");
|
||||
// Create the desired custom animation, involving transformations
|
||||
// on both this (exit) and the new (enter) activity. Note how for
|
||||
// the duration of the animation we force the exiting activity
|
||||
@@ -104,6 +117,7 @@ public class Animation extends Activity {
|
||||
|
||||
private OnClickListener mModernZoomListener = new OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
Log.i(TAG, "Starting modern-zoom-in animation...");
|
||||
// Create a more complicated animation, involving transformations
|
||||
// on both this (exit) and the new (enter) activity. Note how for
|
||||
// the duration of the animation we force the exiting activity
|
||||
@@ -118,6 +132,7 @@ public class Animation extends Activity {
|
||||
|
||||
private OnClickListener mScaleUpListener = new OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
Log.i(TAG, "Starting scale-up animation...");
|
||||
// Create a scale-up animation that originates at the button
|
||||
// being pressed.
|
||||
ActivityOptions opts = ActivityOptions.makeScaleUpAnimation(
|
||||
@@ -129,6 +144,7 @@ public class Animation extends Activity {
|
||||
|
||||
private OnClickListener mZoomThumbnailListener = new OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
Log.i(TAG, "Starting thumbnail-zoom animation...");
|
||||
// Create a thumbnail animation. We are going to build our thumbnail
|
||||
// just from the view that was pressed. We make sure the view is
|
||||
// not selected, because by the time the animation starts we will
|
||||
@@ -146,5 +162,13 @@ public class Animation extends Activity {
|
||||
v.setDrawingCacheEnabled(false);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private OnClickListener mNoAnimationListener = new OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
Log.i(TAG, "Starting no animation transition...");
|
||||
// Request the next activity transition (here starting a new one).
|
||||
startActivity(new Intent(Animation.this, AlertDialogSamples.class));
|
||||
overridePendingTransition(0, 0);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user