Example usage for android.widget ImageView getVisibility

List of usage examples for android.widget ImageView getVisibility

Introduction

In this page you can find the example usage for android.widget ImageView getVisibility.

Prototype

@ViewDebug.ExportedProperty(mapping = { @ViewDebug.IntToString(from = VISIBLE, to = "VISIBLE"),
        @ViewDebug.IntToString(from = INVISIBLE, to = "INVISIBLE"),
        @ViewDebug.IntToString(from = GONE, to = "GONE") })
@Visibility
public int getVisibility() 

Source Link

Document

Returns the visibility status for this view.

Usage

From source file:ca.rmen.android.scrumchatter.meeting.detail.MeetingCursorAdapter.java

/**
 * Stop the animation drawable on this imageView and hide the imageView.
 *//* w w  w. ja  v  a 2s  . c  o m*/
private void stopAnimation(final ImageView imageView) {
    if (imageView.getVisibility() == View.VISIBLE) {
        Log.v(TAG, "stopAnimation");
        imageView.setVisibility(View.INVISIBLE);
        final AnimationDrawable animationDrawable = (AnimationDrawable) imageView.getDrawable();
        animationDrawable.setVisible(false, false);
    }
}

From source file:ca.rmen.android.scrumchatter.meeting.detail.MeetingCursorAdapter.java

/**
 * Show the imageView and start its animation drawable.
 *///from   w  ww. ja v  a  2  s . c  om
private void startAnimation(final ImageView imageView) {
    if (imageView.getVisibility() != View.VISIBLE) {
        Log.v(TAG, "startAnimation");
        imageView.setVisibility(View.VISIBLE);
        final AnimationDrawable animationDrawable = (AnimationDrawable) imageView.getDrawable();
        // On some devices, directly calling start() on the animation does not work.
        // We have to wait until the ImageView is visible before starting the animation.
        imageView.getViewTreeObserver().addOnGlobalLayoutListener(new OnGlobalLayoutListener() {
            @SuppressWarnings("deprecation")
            @Override
            public void onGlobalLayout() {
                if (!animationDrawable.isRunning()) {
                    imageView.post(() -> {
                        animationDrawable.setVisible(true, false);
                        animationDrawable.start();
                    });
                }
                imageView.getViewTreeObserver().removeGlobalOnLayoutListener(this);
            }
        });
    }
}

From source file:com.android.mail.ui.FolderItemView.java

/**
 * Sets the icon, if any. If the image view's visibility is set to gone, the text view will
 * be moved over to account for the change.
 */// w w w . jav  a 2 s  .c  om
public void setIcon(final Folder folder) {
    final ImageView folderIconView = (ImageView) findViewById(R.id.folder_icon);
    Folder.setIcon(folder, folderIconView);
    if (folderIconView.getVisibility() == View.GONE) {
        mFolderTextView.setPadding(
                getContext().getResources().getDimensionPixelSize(R.dimen.folder_list_item_left_offset), 0, 0,
                0 /* No top, right, bottom padding needed */);
    } else {
        // View recycling case
        mFolderTextView.setPadding(0, 0, 0, 0);
    }
}

From source file:eisene.riskspeedtools.BattleFrag.java

/**
 * Increments or decrements the number of defense dice to use on click.
 *//*www .  j a  v a2 s . co  m*/
public void defendDiceOnClick() {
    ImageView dDie2 = (ImageView) findViewById(R.id.defend_die_2);

    if (dDie2.getVisibility() == View.VISIBLE) {
        dDie2.setVisibility(View.INVISIBLE);
    } else {
        dDie2.setVisibility(View.VISIBLE);
    }
}

From source file:eisene.riskspeedtools.BattleFrag.java

/**
 * Gets the number of defend dice./*from  ww  w . j a  va  2 s. c  o  m*/
 * @return The number of defend dice.
 */
public int getNumDefendDice() {
    ImageView dDie2 = (ImageView) findViewById(R.id.defend_die_2);

    if (dDie2.getVisibility() == View.VISIBLE) {
        return 2;
    } else {
        return 1;
    }
}

From source file:eisene.riskspeedtools.BattleFrag.java

/**
 * Gets the number of attack dice./*w  w  w. j a  v a  2 s  .com*/
 * @return The number of attack dice.
 */
public int getNumAttackDice() {
    ImageView aDie2 = (ImageView) findViewById(R.id.attack_die_2);
    ImageView aDie3 = (ImageView) findViewById(R.id.attack_die_3);

    if (aDie3.getVisibility() == View.VISIBLE) {
        return 3;
    } else if (aDie2.getVisibility() == View.VISIBLE) {
        return 2;
    } else {
        return 1;
    }
}

From source file:eisene.riskspeedtools.BattleFrag.java

/**
 * Increments or decrements the number of attack dice to use on click.
 *//*  w  w  w. j  a va  2  s .  c  o m*/
public void attackDiceOnClick() {
    ImageView aDie2 = (ImageView) findViewById(R.id.attack_die_2);
    ImageView aDie3 = (ImageView) findViewById(R.id.attack_die_3);

    if (aDie3.getVisibility() == View.VISIBLE) {
        aDie3.setVisibility(View.INVISIBLE);
        isDiceCountIncreasing = false;
    } else if (aDie2.getVisibility() == View.VISIBLE) {
        if (isDiceCountIncreasing) {
            aDie3.setVisibility(View.VISIBLE);
        } else {
            aDie2.setVisibility(View.INVISIBLE);
        }
    } else {
        aDie2.setVisibility(View.VISIBLE);
        isDiceCountIncreasing = true;
    }
}

From source file:mad.codeforcommunity.CalendarView.java

public void loadEventView(View v) {
    TextView date = (TextView) v.findViewById(R.id.date);
    ImageView image = (ImageView) v.findViewById(R.id.date_icon);
    if (date instanceof TextView && !date.getText().equals("")) {
        if (image.getVisibility() == View.VISIBLE) {
            /*OLD CODE/*from w w  w .j a  va  2  s . c om*/
             * Intent intent = new Intent();
            String day = date.getText().toString();
            if(day.length()==1) {
              day = "0"+day;
            }
            // return chosen date as string format 
            intent.putExtra("date", android.text.format.DateFormat.format("yyyy-MM", month)+"-"+day);
            setResult(RESULT_OK, intent);
            finish();
             */

            Bundle extras = new Bundle();
            String day = date.getText().toString();
            if (day.length() == 1) {
                day = "0" + day;
            }
            // return chosen date as string format 
            extras.putString("date", android.text.format.DateFormat.format("yyyy-MM", month) + "-" + day);

            Intent intent = new Intent(CalendarView.this, EventView.class);
            intent.putExtras(extras);

            startActivity(intent);
        }

    }
}

From source file:com.scoreloop.android.coreui.BaseActivity.java

@Override
public void onWindowFocusChanged(final boolean hasFocus) {
    if (hasFocus) {
        final ImageView imageView = ((ImageView) getTopActivity().findViewById(R.id.progress_indicator));
        if ((imageView != null) && (imageView.getVisibility() == View.VISIBLE)) {
            final AnimationDrawable frameAnimation = (AnimationDrawable) imageView.getBackground();
            frameAnimation.start();//ww w . j  a  va2s. c  o m
        }
    }
}

From source file:mad.codeforcommunity.CalendarView.java

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.calendar);/*from w  w w  . j a va 2 s  .  com*/
    month = Calendar.getInstance();
    //  onNewIntent(getIntent());

    items = new ArrayList<String>();
    adapter = new CalendarAdapter(this, month);

    GridView gridview = (GridView) findViewById(R.id.gridview);
    gridview.setAdapter(adapter);

    handler = new Handler();
    handler.post(calendarUpdater);

    TextView title = (TextView) findViewById(R.id.title);
    title.setText(android.text.format.DateFormat.format("MMMM yyyy", month));

    TextView previous = (TextView) findViewById(R.id.previous);
    previous.setOnClickListener(new OnClickListener() {

        public void onClick(View v) {
            if (month.get(Calendar.MONTH) == month.getActualMinimum(Calendar.MONTH)) {
                month.set((month.get(Calendar.YEAR) - 1), month.getActualMaximum(Calendar.MONTH), 1);
            } else {
                month.set(Calendar.MONTH, month.get(Calendar.MONTH) - 1);
            }
            refreshCalendar();
        }
    });

    TextView next = (TextView) findViewById(R.id.next);
    next.setOnClickListener(new OnClickListener() {

        public void onClick(View v) {
            if (month.get(Calendar.MONTH) == month.getActualMaximum(Calendar.MONTH)) {
                month.set((month.get(Calendar.YEAR) + 1), month.getActualMinimum(Calendar.MONTH), 1);
            } else {
                month.set(Calendar.MONTH, month.get(Calendar.MONTH) + 1);
            }
            refreshCalendar();

        }
    });

    gridview.setOnItemClickListener(new OnItemClickListener() {
        public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
            TextView date = (TextView) v.findViewById(R.id.date);
            ImageView image = (ImageView) v.findViewById(R.id.date_icon);
            if (date instanceof TextView && !date.getText().equals("")) {
                if (image.getVisibility() == View.VISIBLE) {
                    /*OLD CODE
                     * Intent intent = new Intent();
                    String day = date.getText().toString();
                    if(day.length()==1) {
                       day = "0"+day;
                    }
                    // return chosen date as string format 
                    intent.putExtra("date", android.text.format.DateFormat.format("yyyy-MM", month)+"-"+day);
                    setResult(RESULT_OK, intent);
                    finish();
                    */

                    Bundle extras = new Bundle();
                    String day = date.getText().toString();
                    if (day.length() == 1) {
                        day = "0" + day;
                    }
                    // return chosen date as string format 
                    extras.putString("date",
                            android.text.format.DateFormat.format("yyyy-MM", month) + "-" + day);

                    Intent intent = new Intent(CalendarView.this, EventView.class);
                    intent.putExtras(extras);

                    startActivity(intent);
                }

            }

        }
    });
}