Java Code Examples for android.widget.ImageButton#postDelayed()
The following examples show how to use
android.widget.ImageButton#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: MoonApsisView.java From SuntimesWidget with GNU General Public License v3.0 | 4 votes |
private void init(Context context, AttributeSet attrs) { SuntimesUtils.initDisplayStrings(context); LayoutInflater.from(context).inflate(R.layout.layout_view_moonapsis, this, true); content = (LinearLayout)findViewById(R.id.moonapsis_layout); card_layout = new LinearLayoutManager(context); card_layout.setOrientation(LinearLayoutManager.HORIZONTAL); card_view = (RecyclerView)findViewById(R.id.moonapsis_card); card_view.setHasFixedSize(true); card_view.setItemViewCacheSize(7); card_view.setLayoutManager(card_layout); card_adapter = new MoonApsisAdapter(context); card_adapter.setItemWidth(Resources.getSystem().getDisplayMetrics().widthPixels / 3); // initial width; 3 to screen; reassigned later in onSizeChanged card_view.setAdapter(card_adapter); card_view.scrollToPosition(MoonApsisAdapter.CENTER_POSITION); GravitySnapHelper snapHelper = new GravitySnapHelper(Gravity.START); // new LinearSnapHelper(); snapHelper.attachToRecyclerView(card_view); forwardButton = (ImageButton)findViewById(R.id.info_time_nextbtn); forwardButton.setOnClickListener(onResetClick1); forwardButton.setVisibility(GONE); backButton = (ImageButton)findViewById(R.id.info_time_prevbtn); backButton.setOnClickListener(onResetClick0); backButton.setVisibility(VISIBLE); backButton.postDelayed(new Runnable() { @Override public void run() { int position = card_layout.findFirstVisibleItemPosition(); if (position == MoonApsisAdapter.CENTER_POSITION) { ViewUtils.fadeOutButton(backButton, ViewUtils.ANIM_VERYLONG); } } }, 1200); card_view.setOnScrollListener(onScrollChanged); initTheme(context); if (isInEditMode()) { updateViews(context); } }
Example 2
Source File: MoonPhasesView1.java From SuntimesWidget with GNU General Public License v3.0 | 4 votes |
private void init(Context context, AttributeSet attrs) { initLocale(context); LayoutInflater.from(context).inflate(R.layout.layout_view_moonphases1, this, true); if (attrs != null) { LayoutParams lp = generateLayoutParams(attrs); centered = ((lp.gravity == Gravity.CENTER) || (lp.gravity == Gravity.CENTER_HORIZONTAL)); } empty = (TextView)findViewById(R.id.txt_empty); card_view = (RecyclerView)findViewById(R.id.moonphases_card); card_layout = new LinearLayoutManager(context); card_layout.setOrientation(LinearLayoutManager.HORIZONTAL); card_view.setHasFixedSize(true); card_view.setItemViewCacheSize(7); card_view.setLayoutManager(card_layout); card_adapter = new PhaseAdapter(context); card_adapter.setItemWidth(Resources.getSystem().getDisplayMetrics().widthPixels / 4); // initial width; reassigned later in onSizeChanged card_view.setAdapter(card_adapter); card_view.scrollToPosition(PhaseAdapter.CENTER_POSITION); GravitySnapHelper snapHelper = new GravitySnapHelper(Gravity.START); // new LinearSnapHelper(); snapHelper.attachToRecyclerView(card_view); //card_scroller = new CardAdapter.CardViewScroller(context); //card_view.setOnScrollListener(onCardScrollListener); forwardButton = (ImageButton)findViewById(R.id.info_time_nextbtn); forwardButton.setOnClickListener(onResetClick1); forwardButton.setVisibility(GONE); backButton = (ImageButton)findViewById(R.id.info_time_prevbtn); backButton.setOnClickListener(onResetClick0); backButton.setVisibility(VISIBLE); backButton.postDelayed(new Runnable() { @Override public void run() { int position = card_layout.findFirstVisibleItemPosition(); if (position == PhaseAdapter.CENTER_POSITION) { ViewUtils.fadeOutButton(backButton, ViewUtils.ANIM_VERYLONG); } } }, 1200); card_view.setOnScrollListener(onScrollChanged); initTheme(context); if (isInEditMode()) { updateViews(context); } }