SetupWizard: Move reveal finish animation up to activity
Change-Id: I983cfcfad3fcd9808442917bb8b4ae7f8a8d7c2b
This commit is contained in:
parent
c5e5df96b1
commit
031e58ebc4
|
@ -17,31 +17,15 @@
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent"
|
||||||
|
android:background="@color/primary">
|
||||||
|
|
||||||
<FrameLayout android:id="@+id/page"
|
<ImageView
|
||||||
android:layout_width="match_parent"
|
android:id="@+id/brand_logo"
|
||||||
android:layout_height="0dp"
|
android:layout_width="match_parent"
|
||||||
android:layout_weight="1">
|
android:layout_height="match_parent"
|
||||||
|
android:src="@drawable/brand_finish"
|
||||||
|
android:scaleType="fitCenter"
|
||||||
|
android:padding="@dimen/content_margin_left"/>
|
||||||
|
|
||||||
<LinearLayout android:orientation="vertical"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:background="@color/primary">
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/brand_logo"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:src="@drawable/brand_finish"
|
|
||||||
android:scaleType="centerInside"/>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<ImageView android:id="@+id/reveal"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:background="@drawable/reveal"
|
|
||||||
android:visibility="invisible"/>
|
|
||||||
</FrameLayout>
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
|
@ -14,19 +14,33 @@
|
||||||
See the License for the specific language governing permissions and
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
-->
|
-->
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:id="@+id/root"
|
android:id="@+id/root"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:clickable="true">
|
android:clickable="true">
|
||||||
|
|
||||||
<FrameLayout android:id="@+id/content"
|
<LinearLayout android:orientation="vertical"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="0dp"
|
android:layout_height="match_parent"
|
||||||
android:layout_weight="1"
|
android:clickable="true">
|
||||||
style="@style/PageContainer"/>
|
|
||||||
|
|
||||||
<include layout="@layout/button_bar" />
|
<FrameLayout android:id="@+id/content"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
style="@style/PageContainer"/>
|
||||||
|
|
||||||
|
<include layout="@layout/button_bar" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<ImageView android:id="@+id/reveal"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="@drawable/reveal"
|
||||||
|
android:visibility="invisible"/>
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
|
@ -16,17 +16,13 @@
|
||||||
|
|
||||||
package com.cyanogenmod.setupwizard.setup;
|
package com.cyanogenmod.setupwizard.setup;
|
||||||
|
|
||||||
import com.cyanogenmod.setupwizard.R;
|
|
||||||
import com.cyanogenmod.setupwizard.ui.SetupPageFragment;
|
|
||||||
|
|
||||||
import android.animation.Animator;
|
|
||||||
import android.app.Fragment;
|
import android.app.Fragment;
|
||||||
import android.app.FragmentManager;
|
import android.app.FragmentManager;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
|
||||||
import android.view.View;
|
import com.cyanogenmod.setupwizard.R;
|
||||||
import android.view.ViewAnimationUtils;
|
import com.cyanogenmod.setupwizard.ui.SetupPageFragment;
|
||||||
|
|
||||||
public class FinishPage extends SetupPage {
|
public class FinishPage extends SetupPage {
|
||||||
|
|
||||||
|
@ -63,7 +59,7 @@ public class FinishPage extends SetupPage {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean doNextAction() {
|
public boolean doNextAction() {
|
||||||
mFinishFragment.animateOut(getCallbacks());
|
getCallbacks().onFinish();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,53 +75,14 @@ public class FinishPage extends SetupPage {
|
||||||
|
|
||||||
public static class FinishFragment extends SetupPageFragment {
|
public static class FinishFragment extends SetupPageFragment {
|
||||||
|
|
||||||
private View mReveal;
|
|
||||||
|
|
||||||
private Handler mHandler;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onActivityCreated(Bundle savedInstanceState) {
|
public void onActivityCreated(Bundle savedInstanceState) {
|
||||||
super.onActivityCreated(savedInstanceState);
|
super.onActivityCreated(savedInstanceState);
|
||||||
mHandler = new Handler();
|
|
||||||
getActivity().getWindow().setStatusBarColor(getResources().getColor(R.color.primary));
|
getActivity().getWindow().setStatusBarColor(getResources().getColor(R.color.primary));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void initializePage() {
|
protected void initializePage() {}
|
||||||
mReveal = mRootView.findViewById(R.id.reveal);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void animateOut(final SetupDataCallbacks callbacks) {
|
|
||||||
int cx = (mReveal.getLeft() + mReveal.getRight()) / 2;
|
|
||||||
int cy = (mReveal.getTop() + mReveal.getBottom()) / 2;
|
|
||||||
int finalRadius = Math.max(mReveal.getWidth(), mReveal.getHeight());
|
|
||||||
Animator anim =
|
|
||||||
ViewAnimationUtils.createCircularReveal(mReveal, cx, cy, 0, finalRadius);
|
|
||||||
|
|
||||||
anim.addListener(new Animator.AnimatorListener() {
|
|
||||||
@Override
|
|
||||||
public void onAnimationStart(Animator animation) {
|
|
||||||
mReveal.setVisibility(View.VISIBLE);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onAnimationEnd(Animator animation) {
|
|
||||||
mHandler.post(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
callbacks.onFinish();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onAnimationCancel(Animator animation) {}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onAnimationRepeat(Animator animation) {}
|
|
||||||
});
|
|
||||||
anim.start();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected int getLayoutResource() {
|
protected int getLayoutResource() {
|
||||||
|
|
|
@ -16,16 +16,19 @@
|
||||||
|
|
||||||
package com.cyanogenmod.setupwizard.ui;
|
package com.cyanogenmod.setupwizard.ui;
|
||||||
|
|
||||||
|
import android.animation.Animator;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.AppGlobals;
|
import android.app.AppGlobals;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.os.Handler;
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.view.ViewAnimationUtils;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
|
|
||||||
import com.cyanogenmod.setupwizard.R;
|
import com.cyanogenmod.setupwizard.R;
|
||||||
|
@ -48,9 +51,12 @@ public class SetupWizardActivity extends Activity implements SetupDataCallbacks
|
||||||
private View mRootView;
|
private View mRootView;
|
||||||
private Button mNextButton;
|
private Button mNextButton;
|
||||||
private Button mPrevButton;
|
private Button mPrevButton;
|
||||||
|
private View mReveal;
|
||||||
|
|
||||||
private AbstractSetupData mSetupData;
|
private AbstractSetupData mSetupData;
|
||||||
|
|
||||||
|
private final Handler mHandler = new Handler();
|
||||||
|
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.setup_main);
|
setContentView(R.layout.setup_main);
|
||||||
|
@ -63,6 +69,7 @@ public class SetupWizardActivity extends Activity implements SetupDataCallbacks
|
||||||
}
|
}
|
||||||
mNextButton = (Button) findViewById(R.id.next_button);
|
mNextButton = (Button) findViewById(R.id.next_button);
|
||||||
mPrevButton = (Button) findViewById(R.id.prev_button);
|
mPrevButton = (Button) findViewById(R.id.prev_button);
|
||||||
|
mReveal = findViewById(R.id.reveal);
|
||||||
mSetupData.registerListener(this);
|
mSetupData.registerListener(this);
|
||||||
mNextButton.setOnClickListener(new View.OnClickListener() {
|
mNextButton.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -210,7 +217,39 @@ public class SetupWizardActivity extends Activity implements SetupDataCallbacks
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFinish() {
|
public void onFinish() {
|
||||||
finishSetup();
|
animateOut();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void animateOut() {
|
||||||
|
int cx = (mReveal.getLeft() + mReveal.getRight()) / 2;
|
||||||
|
int cy = (mReveal.getTop() + mReveal.getBottom()) / 2;
|
||||||
|
int finalRadius = Math.max(mReveal.getWidth(), mReveal.getHeight());
|
||||||
|
Animator anim =
|
||||||
|
ViewAnimationUtils.createCircularReveal(mReveal, cx, cy, 0, finalRadius);
|
||||||
|
|
||||||
|
anim.addListener(new Animator.AnimatorListener() {
|
||||||
|
@Override
|
||||||
|
public void onAnimationStart(Animator animation) {
|
||||||
|
mReveal.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAnimationEnd(Animator animation) {
|
||||||
|
mHandler.post(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
finishSetup();;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAnimationCancel(Animator animation) {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAnimationRepeat(Animator animation) {}
|
||||||
|
});
|
||||||
|
anim.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleWhisperPushRegistration() {
|
private void handleWhisperPushRegistration() {
|
||||||
|
|
Loading…
Reference in New Issue