当前位置: 首页>>代码示例>>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;未经允许,请勿转载。