當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。