本文整理汇总了Java中android.transition.Fade类的典型用法代码示例。如果您正苦于以下问题:Java Fade类的具体用法?Java Fade怎么用?Java Fade使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Fade类属于android.transition包,在下文中一共展示了Fade类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import android.transition.Fade; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
if (Utils.hasLollipop()) requestWindowFeature(Window.FEATURE_CONTENT_TRANSITIONS);
super.onCreate(savedInstanceState);
if (Utils.hasLollipop()) {
getWindow().setEnterTransition(new Fade());
}
setContentView(R.layout.activity_main);
Log.d(TAG, "onCreate");
FlexibleAdapter.enableLogs(true);
// Initialize Toolbar, Drawer & FAB
initializeToolbar();
initializeDrawer();
initializeFab();
// Initialize Fragment containing Adapter & RecyclerView
initializeFragment(savedInstanceState);
// With FlexibleAdapter v5.0.0 we don't need to call this function anymore
// It is automatically called if Activity implements FlexibleAdapter.OnUpdateListener
//updateEmptyView();
}
示例2: initView
import android.transition.Fade; //导入依赖的package包/类
@Override
public void initView(Bundle savedInstanceState, View view) {
Random random = new Random();
FragmentUtils.setBackgroundColor(this, Color.rgb(random.nextInt(256), random.nextInt(256), random.nextInt(256)));
btnShowAboutFragment = (Button) view.findViewById(R.id.btn_show_about_fragment);
btnShowAboutFragment.setOnClickListener(this);
view.findViewById(R.id.btn_add_hide).setOnClickListener(this);
view.findViewById(R.id.btn_add_show).setOnClickListener(this);
view.findViewById(R.id.btn_add_child).setOnClickListener(this);
view.findViewById(R.id.btn_pop_to_root).setOnClickListener(this);
view.findViewById(R.id.btn_pop_add).setOnClickListener(this);
view.findViewById(R.id.btn_hide_show).setOnClickListener(this);
view.findViewById(R.id.btn_replace).setOnClickListener(this);
ivSharedElement = (ImageView) view.findViewById(R.id.iv_shared_element);
tvAboutFragment = (TextView) view.findViewById(R.id.tv_about_fragment);
demo0Fragment = this;
sharedElement = new FragmentUtils.SharedElement(ivSharedElement, getString(R.string.fragment_transition));
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
setExitTransition(new Fade());
}
}
示例3: onCreate
import android.transition.Fade; //导入依赖的package包/类
@Override
public void onCreate(Bundle state) {
super.onCreate(state);
if (Build.VERSION.SDK_INT >= 21) {
getWindow().setExitTransition(new Fade());
}
setPreferencesDefaults();
setContentView(R.layout.splash);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
startNextActivity();
supportFinishAfterTransition();
}
}, 500);
}
示例4: onCreate
import android.transition.Fade; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
Fade s = new Fade();
s.setDuration(1000);
getWindow().setEnterTransition(s);
super.onCreate(savedInstanceState);
/*setContentView(R.layout.newslayout);
if (savedInstanceState == null) {
getSupportFragmentManager().beginTransaction()
.add(R.id.newscontainer, new NewsFragment())
.commit();
}*/
// ATTENTION: This was auto-generated to implement the App Indexing API.
// See https://g.co/AppIndexing/AndroidStudio for more information.
}
示例5: onCreate
import android.transition.Fade; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
getWindow().requestFeature(Window.FEATURE_ACTIVITY_TRANSITIONS);
getWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS);
getWindow().setEnterTransition(new Fade());
}
setContentView(R.layout.activity_index_view);
recyclerView = findViewById(R.id.recycler_view);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
recyclerView.addItemDecoration(new DividerDecoration());
IndexViewAdapter adapter = new IndexViewAdapter(DataUtil.getItemDataList(555));
recyclerView.setAdapter(adapter);
final RecyclerIndex<Index> index = new RecyclerIndex<>(recyclerView);
index.attachIndex();
index.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(getBaseContext(), index.getData().getText(), Toast.LENGTH_SHORT).show();
}
});
}
示例6: constructTransitions
import android.transition.Fade; //导入依赖的package包/类
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
private TransitionSet constructTransitions() {
int[] slideTargets = {R.id.ChatRecyclerView, R.id.chat_input, R.id.chat_input_divider};
Transition slideTransition = new Slide(Gravity.BOTTOM);
Transition fadeTransition = new Fade();
for (int slideTarget : slideTargets) {
slideTransition.addTarget(slideTarget);
fadeTransition.excludeTarget(slideTarget, true);
}
TransitionSet set = new TransitionSet();
set.addTransition(slideTransition);
set.addTransition(fadeTransition);
return set;
}
示例7: handleTransitions
import android.transition.Fade; //导入依赖的package包/类
@RequiresApi(api = Build.VERSION_CODES.HONEYCOMB)
private void handleTransitions() {
useSysTransition = getIntent().getBooleanExtra(KEY_USE_SYS_TRANSITION, false);
if(useSysTransition) {
ivDetail.setVisibility(View.VISIBLE);
Fade fade = new Fade();
fade.setDuration(500);
getWindow().setEnterTransition(fade);
getWindow().setExitTransition(fade);
ChangeBounds changeBounds = new ChangeBounds();
getWindow().setSharedElementEnterTransition(changeBounds);
}
entity = (TransitionsEntity) getIntent().getSerializableExtra(KEY_ENTITY);
KLog.d(entity);
GlideUtils.displayImage(this, ivDetail, entity.getUrl(), R.drawable.def_placeholder);
}
示例8: onCreate
import android.transition.Fade; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
if (Utils.hasLollipop()) requestWindowFeature(Window.FEATURE_CONTENT_TRANSITIONS);
super.onCreate(savedInstanceState);
if (Utils.hasLollipop()) {
getWindow().setExitTransition(new Fade());
}
//TODO: Remove after evaluation testing
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
e.printStackTrace();
}
Intent intent = new Intent(this, MainActivity.class);
ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation(this);
ActivityCompat.startActivity(this, intent, options.toBundle());
ActivityCompat.finishAfterTransition(this);
}
示例9: openTaskDetail
import android.transition.Fade; //导入依赖的package包/类
public void openTaskDetail(){
Task clickedTask = adapter.getTask(mTaskViewPager.getCurrentItem());
Fragment taskDetailFragment = new TaskDetailFragment();
((TaskDetailFragment)taskDetailFragment).setDisplayedTask(clickedTask);
if(Build.VERSION.SDK_INT>=Build.VERSION_CODES.LOLLIPOP) {
Explode explode = new Explode();
explode.setDuration(300);
Fade fade = new Fade();
fade.setDuration(400);
taskDetailFragment.setEnterTransition(fade);
setExitTransition(explode);
setReenterTransition(explode);
}
getActivity().getSupportFragmentManager()
.beginTransaction()
.replace(R.id.content_frame, taskDetailFragment)
.addToBackStack(null)
.commit();
}
示例10: onCreate
import android.transition.Fade; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Force trigger System UI cover on this Activity
hideSystemUI();
showSystemUI();
// Avoid flash while transition from former Activity
postponeEnterTransition();
getWindow().setStatusBarColor(Color.TRANSPARENT);
getWindow().setNavigationBarColor(Color.TRANSPARENT);
getWindow().getDecorView().setBackgroundColor(Color.TRANSPARENT);
// Using the fade effect for Activity transition
Fade fade = new Fade();
fade.excludeTarget(android.R.id.statusBarBackground, true);
fade.excludeTarget(android.R.id.navigationBarBackground, true);
fade.excludeTarget(R.id.showing_image_view, true);
fade.setDuration(TRANSITION_DURATION);
applyTransitionToWindow(getWindow(), fade, true, true, true, true, true);
setContentView(R.layout.activity_twitterized_image_showing);
setupViews();
}
示例11: onCreate
import android.transition.Fade; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
setContentView(R.layout.activity_detail);
postponeEnterTransition();
TransitionSet transitions = new TransitionSet();
Slide slide = new Slide(Gravity.BOTTOM);
slide.setInterpolator(AnimationUtils.loadInterpolator(this,
android.R.interpolator.linear_out_slow_in));
slide.setDuration(getResources().getInteger(android.R.integer.config_shortAnimTime));
transitions.addTransition(slide);
transitions.addTransition(new Fade());
getWindow().setEnterTransition(transitions);
Intent intent = getIntent();
sharedElementCallback = new DetailSharedElementEnterCallback(intent);
setEnterSharedElementCallback(sharedElementCallback);
initialItem = intent.getIntExtra(IntentUtil.SELECTED_ITEM_POSITION, 0);
setUpViewPager(intent.<Photo>getParcelableArrayListExtra(IntentUtil.PHOTO));
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
toolbar.setNavigationOnClickListener(navigationOnClickListener);
super.onCreate(savedInstanceState);
}
示例12: setupFragmentForSharedElement
import android.transition.Fade; //导入依赖的package包/类
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void setupFragmentForSharedElement(
Fragment outFragment, Fragment inFragment, FragmentTransaction transaction, Bundle options) {
FragmentSharedElementTransition transition = new FragmentSharedElementTransition();
inFragment.setSharedElementEnterTransition(transition);
inFragment.setSharedElementReturnTransition(transition);
Fade fade = new Fade();
inFragment.setEnterTransition(fade);
inFragment.setReturnTransition(fade);
ViewGroup rootView = (ViewGroup) outFragment.getView();
ViewGroup transitionGroup = ViewUtils.findViewGroupWithTag(
rootView,
R.id.react_shared_element_group_id,
options.getString(TRANSITION_GROUP));
AutoSharedElementCallback.addSharedElementsToFragmentTransaction(transaction, transitionGroup);
}
示例13: onClickBegin
import android.transition.Fade; //导入依赖的package包/类
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
@OnClick(R.id.next)
public void onClickBegin(View view) {
//set behavior for this fragment
setExitTransition(new Slide(Gravity.START));
setReenterTransition(new Slide(Gravity.TOP));
WelcomeFragmentStep2 fragment = new WelcomeFragmentStep2();
//set behavior for new fragment transitions
fragment.setEnterTransition(new Fade());
fragment.setSharedElementEnterTransition(getNextButtonTransition());
getActivity().getFragmentManager().beginTransaction()
.replace(R.id.root, fragment)
.addSharedElement(next, "next")
.addToBackStack(null)
.commit();
}
示例14: onCreate
import android.transition.Fade; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS);
getWindow().setAllowEnterTransitionOverlap(true);
getWindow().setAllowReturnTransitionOverlap(true);
setContentView(R.layout.activity_animation);
Fade fade = new Fade();
fade.setDuration(5000);
//fade.addTarget(findViewById(R.id.view));
getWindow().setEnterTransition(fade);
getWindow().setExitTransition(fade);
}
示例15: GalleryFragment
import android.transition.Fade; //导入依赖的package包/类
public GalleryFragment() {
final Fade fade = new Fade();
fade.addTarget(R.id.appbar);
Explode explode = new Explode();
explode.excludeTarget(R.id.appbar, true);
Elevation elevation = new Elevation();
elevation.addTarget(R.id.gallery_card);
elevation.setStartDelay(250); // arbitrarily chosen delay
TransitionSet exit = new TransitionSet();
exit.addTransition(fade);
exit.addTransition(explode);
exit.addTransition(elevation);
setExitTransition(exit);
}