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


Java View.postDelayed方法代碼示例

本文整理匯總了Java中android.view.View.postDelayed方法的典型用法代碼示例。如果您正苦於以下問題:Java View.postDelayed方法的具體用法?Java View.postDelayed怎麽用?Java View.postDelayed使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.view.View的用法示例。


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

示例1: postOnAnimation

import android.view.View; //導入方法依賴的package包/類
private void postOnAnimation(View view, Runnable runnable) {
    if (Build.VERSION.SDK_INT >= 16) {
        view.postOnAnimation(runnable);
    } else {
        view.postDelayed(runnable, 16L);
    }
}
 
開發者ID:lanyuanxiaoyao,項目名稱:PicKing,代碼行數:8,代碼來源:Attacher.java

示例2: addViewShape

import android.view.View; //導入方法依賴的package包/類
private static void addViewShape(final View view) {
    try {
        GradientDrawable gd = new GradientDrawable();
        gd.setStroke(4, Color.RED);
        final Drawable background = view.getBackground();
        view.setBackgroundDrawable(gd);
        view.postDelayed(new Runnable() {
            @Override
            public void run() {
                view.setBackgroundDrawable(background);
            }
        }, 800);
    } catch (Throwable ignored) {

    }
}
 
開發者ID:w568w,項目名稱:fuckView,代碼行數:17,代碼來源:Hook.java

示例3: backToFinish

import android.view.View; //導入方法依賴的package包/類
public void backToFinish(View view) {
    if (mBackPressed + TIME_INTERVAL > System.currentTimeMillis()) {
        view.postDelayed(new Runnable() {
            @Override
            public void run() {
                finish();
                if (null != getActivity()) getActivity().supportFinishAfterTransition();
                android.os.Process.killProcess(android.os.Process.myPid());
            }
        }, 80);
        return;
    } else {
        showSnackbar(view, getString(R.string.back_exit));
    }
    mBackPressed = System.currentTimeMillis();
}
 
開發者ID:alphater,項目名稱:garras,代碼行數:17,代碼來源:BaseFragment.java

示例4: startExitAnimation

import android.view.View; //導入方法依賴的package包/類
public static void startExitAnimation(MoveData moveData, TimeInterpolator interpolator, final Runnable endAction) {
    if (Build.VERSION.SDK_INT >= 21) {
        endAction.run();
        return;
    }
    View view = moveData.toView;
    int duration = moveData.duration;
    int leftDelta = moveData.leftDelta;
    int topDelta = moveData.topDelta;
    float widthScale = moveData.widthScale;
    float heightScale = moveData.heightScale;
    view.animate()
            .setDuration(duration)
            .scaleX(widthScale).scaleY(heightScale)
            .setInterpolator(interpolator).
            translationX(leftDelta).translationY(topDelta);
    view.postDelayed(endAction, duration);
}
 
開發者ID:MSay2,項目名稱:Mire,代碼行數:19,代碼來源:TransitionAnimation.java

示例5: logout

import android.view.View; //導入方法依賴的package包/類
/**
 * 退出登陸操作需要傳遞一個View協助完成延遲檢測操作
 *
 * @param view     View
 * @param runnable 當清理完成後回調方法
 */
public static void logout(final View view, final Runnable runnable) {
    // 清除用戶緩存
    clearUserCache();
    // 等待緩存清理完成
    view.postDelayed(new Runnable() {
        @Override
        public void run() {
            view.removeCallbacks(this);
            User user = SharedPreferencesHelper.load(instances.application, User.class);
            // 判斷當前用戶信息是否清理成功
            if (user == null || user.getId() <= 0) {
                clearAndPostBroadcast(instances.application);
                runnable.run();
            } else {
                view.postDelayed(this, 200);
            }
        }
    }, 200);

}
 
開發者ID:hsj-xiaokang,項目名稱:OSchina_resources_android,代碼行數:27,代碼來源:AccountHelper.java

示例6: resetPressedView

import android.view.View; //導入方法依賴的package包/類
private void resetPressedView(final View pressedView) {
    if (pressedView!=null){
        pressedView.postDelayed(new Runnable() {
            @Override
            public void run() {
                if (pressedView!=null){
                    pressedView.setPressed(false);
                }

            }
        },50);
    }

    mIsPrepressed = false;
    mPressedView = null;
}
 
開發者ID:liu-xiao-dong,項目名稱:JD-Test,代碼行數:17,代碼來源:SimpleClickListener.java

示例7: onTouch

import android.view.View; //導入方法依賴的package包/類
@TargetApi(VERSION_CODES.HONEYCOMB_MR1)
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
  switch (motionEvent.getAction()) {
  case MotionEvent.ACTION_DOWN:
    view.postDelayed(repeater, VERSION.SDK_INT >= VERSION_CODES.HONEYCOMB_MR1
                               ? ViewConfiguration.getKeyRepeatTimeout()
                               : ViewConfiguration.getLongPressTimeout());
    performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP);
    return false;
  case MotionEvent.ACTION_CANCEL:
  case MotionEvent.ACTION_UP:
    view.removeCallbacks(repeater);
    return false;
  default:
    return false;
  }
}
 
開發者ID:XecureIT,項目名稱:PeSanKita-android,代碼行數:19,代碼來源:RepeatableImageKey.java

示例8: setUpSongListView

import android.view.View; //導入方法依賴的package包/類
private void setUpSongListView() {
    setUpSongListPadding();
    songListView.setScrollViewCallbacks(observableScrollViewCallbacks);
    songListView.addHeaderView(songListHeader);

    songAdapter = new ArtistSongAdapter(this, getArtist().getSongs(), this);
    songListView.setAdapter(songAdapter);

    final View contentView = getWindow().getDecorView().findViewById(android.R.id.content);
    contentView.postDelayed(new Runnable() {
        @Override
        public void run() {
            songListBackground.getLayoutParams().height = contentView.getHeight();
            observableScrollViewCallbacks.onScrollChanged(-(artistImageViewHeight + titleViewHeight), false, false);
        }
    }, 1000);
}
 
開發者ID:aliumujib,項目名稱:Orin,代碼行數:18,代碼來源:ArtistDetailActivity.java

示例9: postOnAnimation

import android.view.View; //導入方法依賴的package包/類
public static void postOnAnimation(View view, Runnable runnable) {
	if (VERSION.SDK_INT >= VERSION_CODES.JELLY_BEAN) {
		SDK16.postOnAnimation(view, runnable);
	} else {
		view.postDelayed(runnable, SIXTY_FPS_INTERVAL);
	}
}
 
開發者ID:liuke2016,項目名稱:filepicker,代碼行數:8,代碼來源:Compat.java

示例10: showSoftInput

import android.view.View; //導入方法依賴的package包/類
/**
 * 顯示軟鍵盤
 */
public static void showSoftInput(final View view) {
    if (view == null || view.getContext() == null) return;
    final InputMethodManager imm = (InputMethodManager) view.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
    view.requestFocus();
    view.postDelayed(new Runnable() {
        @Override
        public void run() {
            imm.showSoftInput(view, InputMethodManager.SHOW_FORCED);
        }
    }, SHOW_SPACE);
}
 
開發者ID:wzx54321,項目名稱:XinFramework,代碼行數:15,代碼來源:SupportHelper.java

示例11: updateAdapterScaleAndAlpha

import android.view.View; //導入方法依賴的package包/類
private void updateAdapterScaleAndAlpha(final float alpha, final float scale) {
    final List<View> pageViews = mAdapter.getViews();
    final int curPos = mViewPager.getCurrentItem();

    if(pageViews.size() > 0) {
        final View currentPage = pageViews.get(curPos);
        updateScaleAndAlpha(((ViewGroup)currentPage).getChildAt(0), 1.0F, mCurrentItemScale);

        if(pageViews.size() < 2) {
            return;
        }
        //make sure View's width & height are measured.
        currentPage.postDelayed(WXThread.secure(new Runnable() {
            @Override
            public void run() {
                //change left and right page's translation
                updateNeighbor(currentPage, alpha, scale);

            }
        }), 17);

        // make sure only display view current, left, right.
        int left = (curPos == 0) ? pageViews.size()-1 : curPos-1;
        int right = (curPos == pageViews.size()-1) ? 0 : curPos+1;
        for(int i =0; i<mAdapter.getRealCount(); i++) {
            if(i != left && i != curPos && i != right) {
                ((ViewGroup)pageViews.get(i)).getChildAt(0).setAlpha(0F);
            }
        }
    }
}
 
開發者ID:weexext,項目名稱:ucar-weex-core,代碼行數:32,代碼來源:WXSliderNeighbor.java

示例12: click4

import android.view.View; //導入方法依賴的package包/類
public void click4(View view) {
    mAdapter.notifyFirstLoading();
    view.postDelayed(new Runnable() {
        @Override
        public void run() {
            mAdapter.notifyFirst(getFirst());
        }
    }, 2000);
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:10,代碼來源:OpenCloseActivity.java

示例13: avoidDoubleClicks

import android.view.View; //導入方法依賴的package包/類
/***
 * To prevent from double clicking the row item and so prevents overlapping fragment.
 * **/
public static void avoidDoubleClicks(final View view) {
    final long DELAY_IN_MS = 500;
    if (!view.isClickable()) {
        return;
    }
    view.setClickable(false);
    view.postDelayed(new Runnable() {
        @Override
        public void run() {
            view.setClickable(true);
        }
    }, DELAY_IN_MS);
}
 
開發者ID:QuixomTech,項目名稱:DeviceInfo,代碼行數:17,代碼來源:Methods.java

示例14: click1

import android.view.View; //導入方法依賴的package包/類
public void click1(View view) {

        helper.notifyLoadingChanged();
        view.postDelayed(new Runnable() {
            @Override
            public void run() {
                helper.notifyDataSetChanged(initData());
            }
        }, 3000);

    }
 
開發者ID:crazysunj,項目名稱:MultiTypeRecyclerViewAdapter,代碼行數:12,代碼來源:RxStandardLinearActivity.java

示例15: postOnAnimation

import android.view.View; //導入方法依賴的package包/類
public static void postOnAnimation(View view, Runnable runnable) {
    if (VERSION.SDK_INT >= 16) {
        SDK16.postOnAnimation(view, runnable);
    } else {
        view.postDelayed(runnable, 16);
    }
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:8,代碼來源:ViewCompat.java


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