当前位置: 首页>>代码示例>>Java>>正文


Java Fade类代码示例

本文整理汇总了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();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:25,代码来源:MainActivity.java

示例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());
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:22,代码来源:Demo0Fragment.java

示例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);
}
 
开发者ID:rafjordao,项目名称:Nird2,代码行数:21,代码来源:SplashScreenActivity.java

示例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.

}
 
开发者ID:NullPointersInc,项目名称:Bella-Android,代码行数:19,代码来源:NewsActivity.java

示例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();
        }
    });
}
 
开发者ID:yanweiqiang,项目名称:MyWidgetSample,代码行数:25,代码来源:IndexViewTest.java

示例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;
}
 
开发者ID:SebastianRask,项目名称:Pocket-Plays-for-Twitch,代码行数:18,代码来源:LiveStreamActivity.java

示例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);
}
 
开发者ID:Sherchen,项目名称:AnimationsDemo,代码行数:17,代码来源:DetailActivity.java

示例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);
}
 
开发者ID:davideas,项目名称:AndroidBlueprints,代码行数:22,代码来源:SplashActivity.java

示例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();

}
 
开发者ID:gincos,项目名称:BeHealthy,代码行数:24,代码来源:MainFragment.java

示例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();
}
 
开发者ID:lekaha,项目名称:TwitterizedPhotoView,代码行数:27,代码来源:TwitterizedImageShowingActivity.java

示例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);
}
 
开发者ID:googlesamples,项目名称:android-unsplash,代码行数:27,代码来源:DetailActivity.java

示例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);
}
 
开发者ID:airbnb,项目名称:native-navigation,代码行数:17,代码来源:ScreenCoordinator.java

示例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();
}
 
开发者ID:fzymek,项目名称:FunWithAndroid,代码行数:20,代码来源:WelcomeFragmentStep1.java

示例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);

}
 
开发者ID:JamesKing9,项目名称:learn-newFeatures_Android_5.0,代码行数:17,代码来源:FadeActivity.java

示例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);
    }
 
开发者ID:googlesamples,项目名称:android-OurStreets,代码行数:20,代码来源:GalleryFragment.java


注:本文中的android.transition.Fade类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。