use of android.transition.TransitionInflater in project android_frameworks_base by ResurrectionRemix.
the class LoginActivityFromResources method sendMessage.
public void sendMessage(View view) {
if (mTransitionManager == null) {
TransitionInflater inflater = TransitionInflater.from(this);
mLoginScene = Scene.getSceneForLayout(mSceneRoot, R.layout.activity_login, this);
mPasswordScene = Scene.getSceneForLayout(mSceneRoot, R.layout.login_password, this);
mIncorrectPasswordScene = Scene.getSceneForLayout(mSceneRoot, R.layout.incorrect_password, this);
mUsernameTakenScene = Scene.getSceneForLayout(mSceneRoot, R.layout.username_taken, this);
mSuccessScene = Scene.getSceneForLayout(mSceneRoot, R.layout.success, this);
mNewUserScene = Scene.getSceneForLayout(mSceneRoot, R.layout.new_user, this);
mTransitionManager = inflater.inflateTransitionManager(R.transition.login_transition_mgr, mSceneRoot);
mCurrentScene = mLoginScene;
}
TextView textView = (TextView) view;
CharSequence text = textView.getText();
if (text.equals("Cancel")) {
applyScene(mLoginScene);
} else if (text.equals("Submit")) {
if (mCurrentScene == mLoginScene) {
applyScene(mPasswordScene);
} else if (mCurrentScene == mPasswordScene) {
applyScene(Math.random() < .5 ? mSuccessScene : mIncorrectPasswordScene);
} else if (mCurrentScene == mNewUserScene) {
applyScene(Math.random() < .5 ? mSuccessScene : mUsernameTakenScene);
}
} else if (text.equals("New User?")) {
applyScene(mNewUserScene);
} else if (text.equals("Okay")) {
if (mCurrentScene == mIncorrectPasswordScene) {
applyScene(mPasswordScene);
} else {
// username taken scene
applyScene(mNewUserScene);
}
} else if (text.equals("Reset")) {
applyScene(mLoginScene);
}
}
use of android.transition.TransitionInflater in project android_frameworks_base by ResurrectionRemix.
the class Fragment method loadTransition.
private static Transition loadTransition(Context context, TypedArray typedArray, Transition currentValue, Transition defaultValue, int id) {
if (currentValue != defaultValue) {
return currentValue;
}
int transitionId = typedArray.getResourceId(id, 0);
Transition transition = defaultValue;
if (transitionId != 0 && transitionId != com.android.internal.R.transition.no_transition) {
TransitionInflater inflater = TransitionInflater.from(context);
transition = inflater.inflateTransition(transitionId);
if (transition instanceof TransitionSet && ((TransitionSet) transition).getTransitionCount() == 0) {
transition = null;
}
}
return transition;
}
use of android.transition.TransitionInflater in project android_frameworks_base by DirtyUnicorns.
the class LoginActivityFromResources method sendMessage.
public void sendMessage(View view) {
if (mTransitionManager == null) {
TransitionInflater inflater = TransitionInflater.from(this);
mLoginScene = Scene.getSceneForLayout(mSceneRoot, R.layout.activity_login, this);
mPasswordScene = Scene.getSceneForLayout(mSceneRoot, R.layout.login_password, this);
mIncorrectPasswordScene = Scene.getSceneForLayout(mSceneRoot, R.layout.incorrect_password, this);
mUsernameTakenScene = Scene.getSceneForLayout(mSceneRoot, R.layout.username_taken, this);
mSuccessScene = Scene.getSceneForLayout(mSceneRoot, R.layout.success, this);
mNewUserScene = Scene.getSceneForLayout(mSceneRoot, R.layout.new_user, this);
mTransitionManager = inflater.inflateTransitionManager(R.transition.login_transition_mgr, mSceneRoot);
mCurrentScene = mLoginScene;
}
TextView textView = (TextView) view;
CharSequence text = textView.getText();
if (text.equals("Cancel")) {
applyScene(mLoginScene);
} else if (text.equals("Submit")) {
if (mCurrentScene == mLoginScene) {
applyScene(mPasswordScene);
} else if (mCurrentScene == mPasswordScene) {
applyScene(Math.random() < .5 ? mSuccessScene : mIncorrectPasswordScene);
} else if (mCurrentScene == mNewUserScene) {
applyScene(Math.random() < .5 ? mSuccessScene : mUsernameTakenScene);
}
} else if (text.equals("New User?")) {
applyScene(mNewUserScene);
} else if (text.equals("Okay")) {
if (mCurrentScene == mIncorrectPasswordScene) {
applyScene(mPasswordScene);
} else {
// username taken scene
applyScene(mNewUserScene);
}
} else if (text.equals("Reset")) {
applyScene(mLoginScene);
}
}
use of android.transition.TransitionInflater in project android_frameworks_base by DirtyUnicorns.
the class ResourceLoadingTest method sendMessage.
public void sendMessage(View view) {
if (mTransitionManager == null) {
try {
TransitionInflater inflater = TransitionInflater.from(this);
mTransitionManager = inflater.inflateTransitionManager(R.transition.my_transition_mgr, mSceneRoot);
Scene loadedScene = new Scene(mSceneRoot);
System.out.println("loadedScene = " + loadedScene);
Transition loadedTransition = inflater.inflateTransition(R.transition.my_transition);
System.out.println("loadedTransition = " + loadedTransition);
} catch (Exception e) {
System.out.println("Problem loading scene resource: " + e);
}
}
if (mCurrentScene == RESULTS_SCREEN) {
Scene scene = Scene.getSceneForLayout(mSceneRoot, R.layout.search_screen, this);
mTransitionManager.transitionTo(scene);
mCurrentScene = SEARCH_SCREEN;
} else {
Scene scene = Scene.getSceneForLayout(mSceneRoot, R.layout.results_screen, this);
mTransitionManager.transitionTo(scene);
mCurrentScene = RESULTS_SCREEN;
}
}
use of android.transition.TransitionInflater in project android_frameworks_base by AOSPA.
the class PopupWindow method getTransition.
private Transition getTransition(int resId) {
if (resId != 0 && resId != R.transition.no_transition) {
final TransitionInflater inflater = TransitionInflater.from(mContext);
final Transition transition = inflater.inflateTransition(resId);
if (transition != null) {
final boolean isEmpty = transition instanceof TransitionSet && ((TransitionSet) transition).getTransitionCount() == 0;
if (!isEmpty) {
return transition;
}
}
}
return null;
}
Aggregations