本文整理汇总了Java中android.transition.Scene类的典型用法代码示例。如果您正苦于以下问题:Java Scene类的具体用法?Java Scene怎么用?Java Scene使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Scene类属于android.transition包,在下文中一共展示了Scene类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildScene
import android.transition.Scene; //导入依赖的package包/类
private Scene buildScene(ViewGroup sceneRoot, final TransitionLayout layout) {
final Scene scene = new Scene(sceneRoot, (View) layout);
scene.setEnterAction(new Runnable() {
@Override
public void run() {
boolean wasEmptyScene = (mCurrentScene == mEmptyScene);
setCurrentScene(scene, (ViewGroup) layout);
layout.onEnterAction(wasEmptyScene);
}
});
scene.setExitAction(new Runnable() {
@Override
public void run() {
removeAllViewsFromOverlay();
layout.onExitAction();
}
});
return scene;
}
示例2: onCreate
import android.transition.Scene; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_customized_transition);
ViewGroup container = (ViewGroup) findViewById(R.id.container);
scenes = new Scene[]{
Scene.getSceneForLayout(container, R.layout.activity_customized_transition_scene1, this),
Scene.getSceneForLayout(container, R.layout.activity_customized_transition_scene2, this),
};
container.setOnClickListener(this);
transition = new CircleViewTransition();
}
示例3: getContentScene
import android.transition.Scene; //导入依赖的package包/类
public Scene getContentScene() {
if (mPlugins.isEmpty()) {
return getOriginal().super_getContentScene();
}
final ListIterator<ActivityPlugin> iterator = mPlugins.listIterator(mPlugins.size());
final CallFun0<Scene> superCall = new CallFun0<Scene>("getContentScene()") {
@Override
public Scene call() {
if (iterator.hasPrevious()) {
return iterator.previous().getContentScene(this);
} else {
return getOriginal().super_getContentScene();
}
}
};
return superCall.call();
}
示例4: onCreate
import android.transition.Scene; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
mSceneRoot = (ViewGroup) findViewById(R.id.scene_root);
mScene1 = Scene.getSceneForLayout(mSceneRoot, R.layout.scene1, this);
mScene2 = Scene.getSceneForLayout(mSceneRoot, R.layout.scene2, this);
mTransition = new ChangeBounds();
mTransition.setDuration(DateUtils.SECOND_IN_MILLIS);
mTransition.setInterpolator(new AccelerateDecelerateInterpolator());
TransitionManager.go(mScene1);
mCurrentScene = mScene1;
findViewById(R.id.button).setOnClickListener(this);
}
示例5: onCreateView
import android.transition.Scene; //导入依赖的package包/类
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_initialize, container, false);
if (Is.greaterThanOrEqual(MARSHMALLOW)) {
view.findViewById(R.id.tutorial_accept)
.setOnClickListener(this);
ViewGroup sceneRoot = (ViewGroup) view.findViewById(R.id.scene_root);
sceneComplete = Scene.getSceneForLayout(sceneRoot, R.layout.scene_finished, getContext());
if (hasPermissions()) {
sceneComplete.enter();
}
} else {
view.findViewById(R.id.tutorial_done)
.setOnClickListener(this);
}
return view;
}
示例6: onCreate
import android.transition.Scene; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.transition);
mSceneRoot = (ViewGroup) findViewById(R.id.sceneRoot);
TransitionInflater inflater = TransitionInflater.from(this);
// Note that this is not the only way to create a Scene object, but that
// loading them from layout resources cooperates with the
// TransitionManager that we are also loading from resources, and which
// uses the same layout resource files to determine the scenes to transition
// from/to.
mScene1 = Scene.getSceneForLayout(mSceneRoot, R.layout.transition_scene1, this);
mScene2 = Scene.getSceneForLayout(mSceneRoot, R.layout.transition_scene2, this);
mScene3 = Scene.getSceneForLayout(mSceneRoot, R.layout.transition_scene3, this);
mTransitionManager = inflater.inflateTransitionManager(R.transition.transitions_mgr,
mSceneRoot);
}
示例7: onCreateView
import android.transition.Scene; //导入依赖的package包/类
@Nullable @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_scenes, container, false);
RadioGroup radioGroup = (RadioGroup) view.findViewById(R.id.select_scene);
radioGroup.setOnCheckedChangeListener(this);
mSceneRoot = (ViewGroup) view.findViewById(R.id.scene_root);
// A Scene can be instantiated from a live view hierarchy.
mScene1 = new Scene(mSceneRoot, mSceneRoot.findViewById(R.id.container));
// You can also inflate a generate a Scene from a layout resource file.
mScene2 = Scene.getSceneForLayout(mSceneRoot, R.layout.scene2, getContext());
// Another scene from a layout resource file.
mScene3 = Scene.getSceneForLayout(mSceneRoot, R.layout.scene3, getContext());
// We create a custom TransitionManager for Scene 3, in which ChangeBounds, Fade and
// ChangeImageTransform take place at the same time.
mTransitionManagerForScene3 = TransitionInflater.from(getContext()).inflateTransitionManager(R.anim.scene3_transition_manager, mSceneRoot);
return view;
}
示例8: changeToConfirmScene
import android.transition.Scene; //导入依赖的package包/类
/**
* 共享元素
*/
private void changeToConfirmScene() {
final LayoutOrderConfirmationBinding confBinding = prepareConfirmationBinding();
final Scene scene = new Scene(binding.content,
((ViewGroup) confBinding.getRoot()));
scene.setEnterAction(onEnterConfirmScene(confBinding));
final Transition transition = TransitionInflater.from(getContext())
.inflateTransition(R.transition.transition_confirmation_view);
TransitionManager.go(scene, transition);
}
示例9: setupViews
import android.transition.Scene; //导入依赖的package包/类
private void setupViews() {
stepButtons = new Button[4];
scenes = new Scene[4];
ViewGroup root = (ViewGroup) findViewById(R.id.scene_container);
stepButtons[0] = (Button) findViewById(R.id.step1);
stepButtons[1] = (Button) findViewById(R.id.step2);
stepButtons[2] = (Button) findViewById(R.id.step3);
stepButtons[3] = (Button) findViewById(R.id.step4);
for (int i = 0; i < stepButtons.length; i++) {
Button button = stepButtons[i];
final int sceneNumber = i;
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
transitionTo(sceneNumber);
}
});
}
scenes[0] = Scene.getSceneForLayout(root, R.layout.activity_scene_scene1, this);
scenes[1] = Scene.getSceneForLayout(root, R.layout.activity_scene_scene2, this);
scenes[2] = Scene.getSceneForLayout(root, R.layout.activity_scene_scene3, this);
scenes[3] = Scene.getSceneForLayout(root, R.layout.activity_scene_scene4, this);
}
示例10: onCreate
import android.transition.Scene; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_transition_manager);
radioGroup = (RadioGroup) findViewById(R.id.select_scene);
radioGroup.setOnCheckedChangeListener(this);
scene1Button = (RadioButton) findViewById(R.id.select_scene_1);
scene2Button = (RadioButton) findViewById(R.id.select_scene_2);
scene3Button = (RadioButton) findViewById(R.id.select_scene_3);
sceneRootView = (ViewGroup) findViewById(R.id.scene_root);
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
scenes[0] = new Scene(sceneRootView, findViewById(R.id.container));
} else {
scenes[0] = new Scene(sceneRootView, (ViewGroup) findViewById(R.id.container));
}
scenes[1] = Scene.getSceneForLayout(sceneRootView, R.layout.activity_transition_manager_scene2, this);
scenes[1].setExitAction(new Runnable() {
@Override
public void run() {
setTitle("Leave scene 2");
}
});
scenes[2] = Scene.getSceneForLayout(sceneRootView, R.layout.activity_transition_manager_scene3, this);
scenes[2].setEnterAction(new Runnable() {
@Override
public void run() {
setTitle("Now showing scene3");
}
});
scene3TransitionManager = TransitionInflater.from(this).inflateTransitionManager(R.transition.transition_manager_scene3, sceneRootView);
}
示例11: onCreate
import android.transition.Scene; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_live_demo);
ViewGroup container = (ViewGroup) findViewById(R.id.container);
scenes = new Scene[] {
Scene.getSceneForLayout(container, R.layout.activity_live_scene1, this),
Scene.getSceneForLayout(container, R.layout.activity_live_scene2, this),
};
setupViews();
}
示例12: getSceneType
import android.transition.Scene; //导入依赖的package包/类
/**
* Returns the type of the given scene.
*/
@SceneType public int getSceneType(Scene scene) {
if (scene == mChannelBannerScene) {
return SCENE_TYPE_CHANNEL_BANNER;
} else if (scene == mInputBannerScene) {
return SCENE_TYPE_INPUT_BANNER;
} else if (scene == mKeypadChannelSwitchScene) {
return SCENE_TYPE_KEYPAD_CHANNEL_SWITCH;
} else if (scene == mSelectInputScene) {
return SCENE_TYPE_SELECT_INPUT;
}
return SCENE_TYPE_EMPTY;
}
示例13: setCurrentScene
import android.transition.Scene; //导入依赖的package包/类
private void setCurrentScene(Scene scene, ViewGroup sceneView) {
if (mListener != null) {
mListener.onSceneChanged(getSceneType(mCurrentScene), getSceneType(scene));
}
mCurrentScene = scene;
mCurrentSceneView = sceneView;
// TODO: Is this a still valid call?
mMainActivity.updateKeyInputFocus();
}
示例14: onCreateView
import android.transition.Scene; //导入依赖的package包/类
@Nullable
@Override
public View onCreateView(final LayoutInflater inflater, final ViewGroup container,
final Bundle savedInstanceState) {
final View view = inflater.inflate(R.layout.fragment_search, container, false);
mSceneRoot = (ViewGroup) view.findViewById(R.id.sceneRoot);
mSceneMessage = new Scene(mSceneRoot, mSceneRoot.findViewById(R.id.container));
mSceneResults = Scene.getSceneForLayout(mSceneRoot, R.layout.fragment_search_results,
getActivity());
return view;
}
示例15: goToScene
import android.transition.Scene; //导入依赖的package包/类
private void goToScene(@NonNull final Scene scene) {
if (mSceneCurrent != scene) {
mSceneCurrent = scene;
if (mListView != null) {
mListView.clearOnScrollListeners();
}
TransitionManager.go(scene, mDefaultTransition);
}
}