當前位置: 首頁>>代碼示例>>Java>>正文


Java AnimRes類代碼示例

本文整理匯總了Java中android.support.annotation.AnimRes的典型用法代碼示例。如果您正苦於以下問題:Java AnimRes類的具體用法?Java AnimRes怎麽用?Java AnimRes使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


AnimRes類屬於android.support.annotation包,在下文中一共展示了AnimRes類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: startWithText

import android.support.annotation.AnimRes; //導入依賴的package包/類
/**
 * 根據字符串,啟動翻頁公告
 *
 * @param notice       字符串
 * @param inAnimResId  進入動畫的resID
 * @param outAnimResID 離開動畫的resID
 */
@SuppressWarnings("deprecation")
public void startWithText(final String notice, final @AnimRes int inAnimResId, final @AnimRes int outAnimResID) {
    if (TextUtils.isEmpty(notice)) return;
    getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
        @Override
        public void onGlobalLayout() {
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
                getViewTreeObserver().removeOnGlobalLayoutListener(this);
            } else {
                getViewTreeObserver().removeGlobalOnLayoutListener(this);
            }
            startWithFixedWidth(notice, inAnimResId, outAnimResID);
        }
    });
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:23,代碼來源:MarqueeView.java

示例2: startWithFixedWidth

import android.support.annotation.AnimRes; //導入依賴的package包/類
/**
 * 根據字符串和寬度,啟動翻頁公告
 *
 * @param notice 字符串
 */
private void startWithFixedWidth(String notice, @AnimRes int inAnimResId, @AnimRes int outAnimResID) {
    int noticeLength = notice.length();
    int width = Utils.px2dip(getContext(), getWidth());
    if (width == 0) {
        throw new RuntimeException("Please set the width of MarqueeView !");
    }
    int limit = width / textSize;
    List list = new ArrayList();

    if (noticeLength <= limit) {
        list.add(notice);
    } else {
        int size = noticeLength / limit + (noticeLength % limit != 0 ? 1 : 0);
        for (int i = 0; i < size; i++) {
            int startIndex = i * limit;
            int endIndex = ((i + 1) * limit >= noticeLength ? noticeLength : (i + 1) * limit);
            list.add(notice.substring(startIndex, endIndex));
        }
    }

    if (notices == null) notices = new ArrayList<>();
    notices.clear();
    notices.addAll(list);
    start(inAnimResId, outAnimResID);
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:31,代碼來源:MarqueeView.java

示例3: finishToActivity

import android.support.annotation.AnimRes; //導入依賴的package包/類
/**
 * 結束到指定 Activity
 *
 * @param activity      activity
 * @param isIncludeSelf 是否結束該 activity 自己
 * @param enterAnim     入場動畫
 * @param exitAnim      出場動畫
 */
public static boolean finishToActivity(@NonNull final Activity activity,
                                       final boolean isIncludeSelf,
                                       @AnimRes final int enterAnim,
                                       @AnimRes final int exitAnim) {
    List<Activity> activities = Utils.sActivityList;
    for (int i = activities.size() - 1; i >= 0; --i) {
        Activity aActivity = activities.get(i);
        if (aActivity.equals(activity)) {
            if (isIncludeSelf) {
                finishActivity(aActivity, enterAnim, exitAnim);
            }
            return true;
        }
        finishActivity(aActivity, enterAnim, exitAnim);
    }
    return false;
}
 
開發者ID:Blankj,項目名稱:AndroidUtilCode,代碼行數:26,代碼來源:ActivityUtils.java

示例4: finishOtherActivities

import android.support.annotation.AnimRes; //導入依賴的package包/類
/**
 * 結束所有其他類型的 Activity
 *
 * @param clz       Activity 類
 * @param enterAnim 入場動畫
 * @param exitAnim  出場動畫
 */
public static void finishOtherActivities(@NonNull final Class<?> clz,
                                         @AnimRes final int enterAnim,
                                         @AnimRes final int exitAnim) {
    List<Activity> activities = Utils.sActivityList;
    boolean flag = false;
    for (int i = activities.size() - 1; i >= 0; i--) {
        Activity activity = activities.get(i);
        if (activity.getClass().equals(clz)) {
            if (flag) {
                finishActivity(activity, enterAnim, exitAnim);
            } else {
                flag = true;
            }
        } else {
            finishActivity(activity, enterAnim, exitAnim);
        }
    }
}
 
開發者ID:Blankj,項目名稱:AndroidUtilCode,代碼行數:26,代碼來源:ActivityUtils.java

示例5: setInAndOutAnimation

import android.support.annotation.AnimRes; //導入依賴的package包/類
/**
 * 設置進入動畫和離開動畫
 *
 * @param inAnimResId  進入動畫的resID
 * @param outAnimResID 離開動畫的resID
 */
private void setInAndOutAnimation(@AnimRes int inAnimResId, @AnimRes int outAnimResID) {
    Animation inAnim = AnimationUtils.loadAnimation(getContext(), inAnimResId);
    if (hasSetAnimDuration) inAnim.setDuration(animDuration);
    setInAnimation(inAnim);

    Animation outAnim = AnimationUtils.loadAnimation(getContext(), outAnimResID);
    if (hasSetAnimDuration) outAnim.setDuration(animDuration);
    setOutAnimation(outAnim);
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:16,代碼來源:MarqueeView.java

示例6: startActivity

import android.support.annotation.AnimRes; //導入依賴的package包/類
/**
 * 啟動Activity
 *
 * @param cls       activity類
 * @param enterAnim 入場動畫
 * @param exitAnim  出場動畫
 */
public static void startActivity(@NonNull final Class<?> cls,
                                 @AnimRes final int enterAnim,
                                 @AnimRes final int exitAnim) {
    Context context = getActivityOrApp();
    startActivity(context, null, context.getPackageName(), cls.getName(),
            getOptionsBundle(context, enterAnim, exitAnim));
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:15,代碼來源:ActivityUtils.java

示例7: startActivities

import android.support.annotation.AnimRes; //導入依賴的package包/類
/**
 * 啟動Activity
 *
 * @param activity  activity
 * @param intents   意圖
 * @param enterAnim 入場動畫
 * @param exitAnim  出場動畫
 */
public static void startActivities(@NonNull final Activity activity,
                                   @NonNull final Intent[] intents,
                                   @AnimRes final int enterAnim,
                                   @AnimRes final int exitAnim) {
    startActivities(intents, activity, getOptionsBundle(activity, enterAnim, exitAnim));
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
        activity.overridePendingTransition(enterAnim, exitAnim);
    }
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:18,代碼來源:ActivityUtils.java

示例8: getAnimation

import android.support.annotation.AnimRes; //導入依賴的package包/類
@Override
public XmlResourceParser getAnimation(@AnimRes int id) throws NotFoundException {
    int realId = getCorrespondResIdStrictly(id);
    if (realId > 0) {
        return mSkinResources.getAnimation(realId);
    }
    return super.getAnimation(id);
}
 
開發者ID:Zeal27,項目名稱:SkinFramework,代碼行數:9,代碼來源:ComposedResources.java

示例9: runLayoutAnimation

import android.support.annotation.AnimRes; //導入依賴的package包/類
public static void runLayoutAnimation(final RecyclerView recyclerView, @AnimRes int res) {
    final Context context = recyclerView.getContext();
    final LayoutAnimationController controller = AnimationUtils.loadLayoutAnimation(context, res);

    recyclerView.setLayoutAnimation(controller);
    recyclerView.getAdapter().notifyDataSetChanged();
    recyclerView.scheduleLayoutAnimation();
}
 
開發者ID:afiqiqmal,項目名稱:MVP-Android,代碼行數:9,代碼來源:RecyclerViewUtils.java

示例10: setCustomAnimations

import android.support.annotation.AnimRes; //導入依賴的package包/類
@Override
public ExtraTransaction setCustomAnimations(@AnimRes int targetFragmentEnter
        , @AnimRes int currentFragmentPopExit) {
    mRecord.targetFragmentEnter = targetFragmentEnter;
    mRecord.currentFragmentPopExit = currentFragmentPopExit;
    mRecord.currentFragmentPopEnter = 0;
    mRecord.targetFragmentExit = 0;
    return this;
}
 
開發者ID:wzx54321,項目名稱:XinFramework,代碼行數:10,代碼來源:ExtraTransaction.java

示例11: setExitAnimations

import android.support.annotation.AnimRes; //導入依賴的package包/類
/**
 * Sets the exit animations.
 *
 * @param context Application context.
 * @param enterResId Resource ID of the "enter" animation for the application.
 * @param exitResId Resource ID of the "exit" animation for the browser.
 */
public Builder setExitAnimations(
        @NonNull Context context, @AnimRes int enterResId, @AnimRes int exitResId) {
    Bundle bundle = ActivityOptionsCompat.makeCustomAnimation(
            context, enterResId, exitResId).toBundle();
    mIntent.putExtra(EXTRA_EXIT_ANIMATION_BUNDLE, bundle);
    return this;
}
 
開發者ID:rkshuai,項目名稱:chromium-for-android-56-debug-video,代碼行數:15,代碼來源:CustomTabsIntent.java

示例12: setCustomAnimations

import android.support.annotation.AnimRes; //導入依賴的package包/類
/**
 * Set a Custom Animation to a Fragment transaction
 *
 * @param transaction  The transaction that will
 * @param enterAnim    The animation resource to be used when the next fragment enters.
 * @param exitAnim     The animation resource to be used when the current fragment exits.
 * @param popEnterAnim The animation resource to be used when the previous fragment enters on back pressed.
 * @param popExitAnim  The animation resource to be used when the current fragment exits on back pressed..
 */
private void setCustomAnimations(FragmentTransaction transaction, @AnimRes int enterAnim,
                                 @AnimRes int exitAnim, @AnimRes int popEnterAnim, @AnimRes int popExitAnim) {
    transaction.setCustomAnimations(
            enterAnim,
            exitAnim,
            popEnterAnim,
            popExitAnim
    );
}
 
開發者ID:Fueled,項目名稱:flowr,代碼行數:19,代碼來源:Flowr.java

示例13: setCustomTransactionAnimation

import android.support.annotation.AnimRes; //導入依賴的package包/類
/**
 * Set a Custom Animation to a Fragment transaction.
 *
 * @param enterAnim    The animation resource to be used when the next fragment enters.
 * @param exitAnim     The animation resource to be used when the current fragment exits.
 * @param popEnterAnim The animation resource to be used when the previous fragment enters on back pressed.
 * @param popExitAnim  The animation resource to be used when the current fragment exits on back pressed..
 */
public Builder setCustomTransactionAnimation(@AnimRes int enterAnim, @AnimRes int exitAnim,
                                             @AnimRes int popEnterAnim, @AnimRes int popExitAnim) {
    data.setEnterAnim(enterAnim);
    data.setExitAnim(exitAnim);
    data.setPopEnterAnim(popEnterAnim);
    data.setPopExitAnim(popExitAnim);
    return this;

}
 
開發者ID:Fueled,項目名稱:flowr,代碼行數:18,代碼來源:Flowr.java

示例14: replaceFragment

import android.support.annotation.AnimRes; //導入依賴的package包/類
/**
     * 替換fragement 並添加動畫
     */
    public void replaceFragment(@IdRes int id_content, @AnimRes int anim_in, @AnimRes int anim_out, Fragment fragment) {
        FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
//        transaction.setCustomAnimations(anim_in, anim_out);
        transaction.replace(id_content, fragment);
        transaction.commit();
    }
 
開發者ID:fengdongfei,項目名稱:CXJPadProject,代碼行數:10,代碼來源:BActivity.java

示例15: replaceFragmentWithBackStack

import android.support.annotation.AnimRes; //導入依賴的package包/類
/**
     * 替換fragement 並添加動畫
     * 替換fragement的同時對fragment進行“入back棧”操作 ,據我所知並不是真正的進入內存棧
     *
     * @param id_content
     * @param anim_in
     * @param anim_out
     * @param fragment
     */
    @Deprecated
    public void replaceFragmentWithBackStack(@IdRes int id_content, @AnimRes int anim_in, @AnimRes int anim_out, Fragment fragment) {
        String tag = fragment.getClass().getSimpleName();
        FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
//        transaction.setCustomAnimations(anim_in, anim_out);
        transaction.replace(id_content, fragment, tag);
        //記錄commit一次操作,與mFragmentManager.popBackStack();匹配使用
        transaction.addToBackStack(tag);
        //commitAllowingStateLoss 優於 commit 方法,當使用commit方法時,係統將進行狀態判斷,如果狀態(mStateSaved)已經保存,將發生"Can not perform this action after onSaveInstanceState"錯誤。
        //如果mNoTransactionsBecause已經存在,將發生"Can not perform this action inside of " + mNoTransactionsBecause錯誤。
        transaction.commitAllowingStateLoss();
    }
 
開發者ID:fengdongfei,項目名稱:CXJPadProject,代碼行數:22,代碼來源:BActivity.java


注:本文中的android.support.annotation.AnimRes類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。