Java Code Examples for android.widget.TextView#postDelayed()
The following examples show how to use
android.widget.TextView#postDelayed() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: VideoListFragment.java From JZVideoDemo with MIT License | 6 votes |
public void removeVideoList() { mask.setVisibility(View.GONE); int size = mList.size() - 1; for (int i = size; i > 0; i--) { mList.remove(i); } mAdapter.notifyItemRangeRemoved(1, size); final View v = mRecycler.getChildAt(0); final int[] location = new int[2]; v.getLocationOnScreen(location); final PlayerContainer container = v.findViewById(R.id.container); final TextView title = v.findViewById(R.id.video_title); final RelativeLayout bottomLayout = v.findViewById(R.id.bottom_layout); title.postDelayed(new Runnable() { @Override public void run() { title.animate().alpha(0f).setDuration(DURATION); bottomLayout.animate().alpha(0f).setDuration(DURATION); container.animate().scaleX((float) mAttr.getWidth() / container.getWidth()) .scaleY((float) mAttr.getHeight() / container.getHeight()) .setDuration(DURATION); v.animate().translationY(mAttr.getY() - location[1] - (container.getHeight() - mAttr.getHeight()) / 2 - title.getHeight()).setDuration(DURATION); bgAnimator.reverse(); } }, 250); }
Example 2
Source File: HtmlView.java From Ruisi with Apache License 2.0 | 6 votes |
@Override public void notifyViewChange() { if (target == null) { return; } final TextView t = target.get(); if (isViewSet && t != null && spanned != null) { try { //这儿会有索引越界 t.removeCallbacks(updateRunable); t.postDelayed(updateRunable, 200); } catch (Exception ignored) { } } }
Example 3
Source File: ScanActivity.java From easyble-x with Apache License 2.0 | 5 votes |
void add(Device device) { Device dev = null; for (Device item : getItems()) { if (item.equals(device)) { dev = item; break; } } if (dev == null) { updateTimeMap.put(device.getAddress(), System.currentTimeMillis()); getItems().add(device); notifyDataSetChanged(); } else { Long time = updateTimeMap.get(device.getAddress()); if (time == null || System.currentTimeMillis() - time > 2000) { updateTimeMap.put(device.getAddress(), System.currentTimeMillis()); if (dev.getRssi() != device.getRssi()) { dev.setRssi(device.getRssi()); final TextView tvRssi = rssiViews.get(device.getAddress()); if (tvRssi != null) { tvRssi.setText("" + device.getRssi()); tvRssi.setTextColor(Color.BLACK); tvRssi.postDelayed(() -> tvRssi.setTextColor(0xFF909090), 800); } } } } }
Example 4
Source File: VideoListFragment.java From VideoDemoJava with MIT License | 5 votes |
public void removeVideoList() { int size = mList.size() - 1; for (int i = size; i > 0; i--) { mList.remove(i); } mAdapter.notifyItemRangeRemoved(1, size); final View view = mRecycler.getChildAt(0); final int[] location = new int[2]; view.getLocationOnScreen(location); final ImageView image = view.findViewById(R.id.adapter_video_list_image); final FrameLayout container = view.findViewById(R.id.adapter_video_list_container); final TextView title = view.findViewById(R.id.adapter_video_list_title); final LinearLayout bottom = view.findViewById(R.id.bottom_layout); title.postDelayed(new Runnable() { @Override public void run() { title.setVisibility(View.GONE); bottom.setVisibility(View.GONE); image.setVisibility(View.GONE); container.animate().scaleX((float) mAttr.getWidth() / container.getMeasuredWidth()) .scaleY((float) mAttr.getHeight() / container.getMeasuredHeight()) .setDuration(DURATION); view.animate().translationY(mAttr.getY() - location[1]).setDuration(DURATION); ObjectAnimator animator = ObjectAnimator.ofInt(mRoot, "backgroundColor", 0xff000000, 0x00000000); animator.setEvaluator(new ArgbEvaluator()); animator.setDuration(DURATION); animator.start(); } }, 250); }
Example 5
Source File: RxLinearActivity.java From MultiTypeRecyclerViewAdapter with Apache License 2.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); setTitle("Rx线性排布"); RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recyclerview); textView1 = (TextView) findViewById(R.id.text1); textView2 = (TextView) findViewById(R.id.text2); textView3 = (TextView) findViewById(R.id.text3); textView4 = (TextView) findViewById(R.id.text4); helper = new RxAdapterHelper(); SimpleRxHelperAdapter adapter = new SimpleRxHelperAdapter(helper); recyclerView.setLayoutManager(new LinearLayoutManager(this)); recyclerView.addItemDecoration(new StickyHeaderDecoration(adapter)); recyclerView.setAdapter(adapter); helper.notifyLoadingDataAndHeaderChanged(SimpleHelper.LEVEL_THIRD, 3); textView3.postDelayed(() -> { Random random = new Random(); int rand = random.nextInt(6); List<MultiHeaderEntity> list = new ArrayList<>(); for (int i = 0, size = rand + 1; i < size; i++) { list.add(new ThirdItem(String.format(Locale.getDefault(), "我是第三种类型%d", i), 12 + i)); } textView3.setText(String.format(Locale.getDefault(), "类型3的数量:%d", list.size())); helper.notifyModuleDataAndHeaderChanged(list, new HeaderThirdItem("我是第三种类型的头", IDUtil.getId()), SimpleHelper.LEVEL_THIRD); }, 3000); }
Example 6
Source File: LinearActivity.java From MultiTypeRecyclerViewAdapter with Apache License 2.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); setTitle("线性排布"); RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recyclerview); textView1 = (TextView) findViewById(R.id.text1); textView2 = (TextView) findViewById(R.id.text2); textView3 = (TextView) findViewById(R.id.text3); textView4 = (TextView) findViewById(R.id.text4); helper = new SimpleHelper(); SimpleHelperAdapter adapter = new SimpleHelperAdapter(helper); recyclerView.setLayoutManager(new LinearLayoutManager(this)); recyclerView.addItemDecoration(new StickyHeaderDecoration(adapter)); recyclerView.setAdapter(adapter); helper.notifyLoadingDataAndHeaderChanged(SimpleHelper.LEVEL_THIRD, 3); textView3.postDelayed(() -> { Random random = new Random(); int rand = random.nextInt(6); List<MultiHeaderEntity> list = new ArrayList<>(); for (int i = 0, size = rand + 1; i < size; i++) { list.add(new ThirdItem(String.format(Locale.getDefault(), "我是第三种类型%d", i), 12 + i)); } textView3.setText(String.format(Locale.getDefault(), "类型3的数量:%d", list.size())); helper.notifyModuleDataAndHeaderChanged(list, new HeaderThirdItem("我是第三种类型的头", IDUtil.getId()), SimpleHelper.LEVEL_THIRD); }, 3000); }
Example 7
Source File: SplashActivity.java From Android-skin-support with MIT License | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_splash); TextView buildTimeTv = findViewById(R.id.tv_build_time); buildTimeTv.setText(String.format(getString(R.string.splash_build_time), BuildConfig.BUILD_TIME)); buildTimeTv.postDelayed(new Runnable() { @Override public void run() { Intent intent = new Intent(SplashActivity.this, MainActivity.class); startActivity(intent); finish(); } }, 2000); }
Example 8
Source File: ComparePerformanceActivity.java From android-openGL-canvas with Apache License 2.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_compare_performace); hwBubblesView = (NormalBubblesView) findViewById(R.id.hw_bubble_view); swBubblesView = (SurfaceBubblesView) findViewById(R.id.sw_bubble_view); glBubblesView = (GLBubblesView) findViewById(R.id.gl_bubble_view); bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.ic_robot); hwBubblesView.setBitmap(bitmap); swBubblesView.setBitmap(bitmap); glBubblesView.setBitmap(bitmap); oneText = (TextView) findViewById(R.id.count_one); twoText = (TextView) findViewById(R.id.count_two); threeText = (TextView) findViewById(R.id.count_three); threeText.postDelayed(new Runnable() { @Override public void run() { if (isFinishing()) { return; } oneText.setText(String.format(Locale.CHINA, "hw canvas:%d", hwBubblesView.getCnt())); twoText.setText(String.format(Locale.CHINA, "sw canvas:%d", swBubblesView.getCnt())); threeText.setText(String.format(Locale.CHINA, "gl canvas:%d", glBubblesView.getCnt())); threeText.postDelayed(this, 500); } }, 500); new Thread(new Runnable() { @Override public void run() { } }).start(); }
Example 9
Source File: SplashActivity.java From DrySister with GNU Lesser General Public License v3.0 | 5 votes |
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_splash); TextView tv_logo = findViewById(R.id.tv_logo); tv_logo.postDelayed(this::jump,500L); }
Example 10
Source File: MainActivity.java From AndroidPlayground with MIT License | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); final TextView tv2 = (TextView) findViewById(R.id.mTv2); tv2.postDelayed(new Runnable() { @Override public void run() { tv2.setText("Hello world!"); tv2.setVisibility(View.VISIBLE); } }, 200); }
Example 11
Source File: InvitingDialogViewHolder.java From AndroidPlayground with MIT License | 5 votes |
public void setupView() { mRootView.setVisibility(View.VISIBLE); mAvatar = findById(mRootView, R.id.mToAvatar); Picasso.with(mContext).load(mToUserAvatar).into(mAvatar); CountdownView countdownView = findById(mRootView, R.id.mCountDownTimber); countdownView.start(INVITE_EXPIRE_MILLIS); countdownView.setOnCountdownEndListener(new CountdownView.OnCountdownEndListener() { @Override public void onEnd(CountdownView cv) { if (mController != null) { mController.denied(); } } }); TextView tvToUsername = findById(mRootView, R.id.mTvToUsername); tvToUsername.setText(mToUsername); // TODO simulate accepted tvToUsername.postDelayed(new Runnable() { @Override public void run() { if (mController != null) { mController.accepted(mFromUserAvatar, mFromUsername, mToUserAvatar, mToUsername, mToUid); } } }, 5000); }
Example 12
Source File: MainActivity.java From OneDrawable with Apache License 2.0 | 4 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); tvIcon1 = (TextView) findViewById(R.id.tv_icon_1); tvIcon2 = (TextView) findViewById(R.id.tv_icon_2); tvIcon3 = (TextView) findViewById(R.id.tv_icon_3); tvIcon4 = (TextView) findViewById(R.id.tv_icon_4); tvColor1 = (TextView) findViewById(R.id.tv_color_1); tvColor2 = (TextView) findViewById(R.id.tv_color_2); tvColor3 = (TextView) findViewById(R.id.tv_color_3); Drawable icon1 = OneDrawable.createBgDrawable(this, R.drawable.ic_action_add); tvIcon1.setBackgroundDrawable(icon1); tvIcon1.setClickable(true); tvIcon1.setEnabled(false); tvIcon1.postDelayed(new Runnable() { @Override public void run() { tvIcon1.setEnabled(true); } }, 3000); Drawable icon2 = OneDrawable.createBgDrawableWithDarkMode(this, R.drawable.ic_action_add, 0.4f); tvIcon2.setBackgroundDrawable(icon2); tvIcon2.setClickable(true); Drawable icon3 = OneDrawable.createBgDrawableWithAlphaMode(this, R.drawable.ic_action_name); tvIcon3.setBackgroundDrawable(icon3); tvIcon3.setClickable(true); Drawable icon4 = OneDrawable.createBgDrawableWithAlphaMode(this, R.drawable.ic_action_name, 0.3f); tvIcon4.setBackgroundDrawable(icon4); tvIcon4.setClickable(true); Drawable color1 = OneDrawable.createBgColorWithAlphaMode(this, getResources().getColor(R.color.colorPrimary)); tvColor1.setBackgroundDrawable(color1); tvColor1.setClickable(true); Drawable color2 = OneDrawable.createBgColor(this, getResources().getColor(R.color.colorAccent)); tvColor2.setBackgroundDrawable(color2); tvColor2.setClickable(true); tvColor2.setEnabled(false); tvColor2.postDelayed(new Runnable() { @Override public void run() { tvColor2.setEnabled(true); } }, 1000); Drawable color3 = OneDrawable.createBgColor(this, Color.parseColor("#cccccc")); tvColor3.setBackgroundDrawable(color3); tvColor3.setClickable(true); tvColor3.setEnabled(false); tvColor3.postDelayed(new Runnable() { @Override public void run() { tvColor3.setEnabled(true); } }, 1000); }
Example 13
Source File: RecordDetailActivity.java From UPMiss with GNU General Public License v3.0 | 4 votes |
@Override protected void onInit(Bundle savedInstanceState) { Intent intent = getIntent(); if (intent != null) { String id = intent.getStringExtra("Id"); mId = UUID.fromString(id); } // Init presenter mPresenter = new RecordDetailPresenter(this); // Init View mYearMonth = (TextView) findViewById(R.id.txt_year_month); mBrief = (TextView) findViewById(R.id.txt_brief); mOperation = findViewById(R.id.lay_scroll_operation); mSimpleDate = (SimpleDateView) findViewById(R.id.simple_date); mLunar = (TextView) findViewById(R.id.txt_lunar); mDate = (TextView) findViewById(R.id.txt_date); mTop = findViewById(R.id.lay_top); mDate.setTypeface(Typeface.createFromAsset(getAssets(), "fonts/Hero.otf")); AnimJagDrawable drawable = new AnimJagDrawable(); drawable.setFluCount(new Rect(0, 0, 0, 36)); mTop.setLayerType(View.LAYER_TYPE_SOFTWARE, null); mTop.setBackgroundDrawable(drawable); findViewById(R.id.container).setOnClickListener(this); findViewById(R.id.detail_btn_share).setOnClickListener(this); findViewById(R.id.detail_btn_save).setOnClickListener(this); findViewById(R.id.detail_btn_edit).setOnClickListener(this); findViewById(R.id.detail_btn_delete).setOnClickListener(this); mDate.postDelayed(new Runnable() { @Override public void run() { Animation anim = AnimationUtils.loadAnimation(RecordDetailActivity.this, R.anim.anim_record_detail_content_in); anim.setAnimationListener(new AnimationListener() { @Override public void onAnimationEnd(Animation animation) { super.onAnimationEnd(animation); mDate.setVisibility(View.VISIBLE); } }); mDate.clearAnimation(); mDate.startAnimation(anim); } }, 64); }
Example 14
Source File: MainActivity.java From AndroidPlayground with MIT License | 4 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mContainer = (RelativeLayout) findViewById(R.id.mRlContainer); mTextView = (TextView) findViewById(R.id.mTv); mTextView2 = (TextView) findViewById(R.id.mTv2); mTextView3 = (TextView) findViewById(R.id.mTv3); final MoveGestureDetector moveGestureDetector = new MoveGestureDetector(this, new SimpleOnMoveGestureListener() { @Override public boolean onMove(MoveGestureDetector detector) { Log.d("MainActivity", "" + mIsShowing + ", " + detector.getFocusDelta().y); if (mIsShowing) { mMoveUpY += detector.getFocusDelta().y; if (mMoveUpY > 0) { mMoveUpY = 0; } if (mMoveUpY < -TRIGGER_MOVED_Y) { hidePanel(); } } else { mMoveDownY += detector.getFocusDelta().y; if (mMoveDownY < 0) { mMoveDownY = 0; } if (mMoveDownY > TRIGGER_MOVED_Y) { showPanel(); } } return true; } }); mContainer.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { return moveGestureDetector.onTouchEvent(event); } }); mTextView.postDelayed(mHidingRunnable, 2000); }