Example usage for android.widget ImageView ImageView

List of usage examples for android.widget ImageView ImageView

Introduction

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

Prototype

public ImageView(Context context) 

Source Link

Usage

From source file:com.itude.mobile.mobbl.core.view.components.tabbar.MBDefaultActionBarBuilder.java

private ImageView getRotationImage() {
    RotateAnimation rotateAnimation = new RotateAnimation(0, 360, Animation.RELATIVE_TO_SELF, 0.5f,
            Animation.RELATIVE_TO_SELF, 0.5f);
    rotateAnimation.setDuration(1000L);/*from   w  ww.  j av  a 2 s.c  o m*/
    rotateAnimation.setRepeatMode(Animation.INFINITE);
    rotateAnimation.setRepeatCount(Animation.INFINITE);
    rotateAnimation.setFillEnabled(false);
    rotateAnimation.setInterpolator(new LinearInterpolator());

    Drawable drawable = MBResourceService.getInstance().getImageByID(_refreshToolDef.getIcon());
    ImageView rotationImage = new ImageView(_context);
    rotationImage.setImageDrawable(drawable);
    rotationImage.setAnimation(rotateAnimation);

    return rotationImage;
}

From source file:com.bb.hbx.activitiy.InsurancePlanActivity.java

@Override
protected void onRestart() {
    super.onRestart();
    ImageView dotView = new ImageView(mContext);
    LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(10, 10);
    lp.leftMargin = 10;/*from w  ww.j a v  a 2s . c o m*/
    dotView.setLayoutParams(lp);
    dotView.setBackgroundResource(R.drawable.dot_selected);
    dotView.setAlpha(0.38f);
    dotList.add(dotView);
    lin_add.addView(dotView);
    ComCarPropsBean.PlanListBean newBean = new ComCarPropsBean.PlanListBean();
    newBean.setSyxList(customSyxPlan);
    newBean.setJqxList(customJqxPlan);
    newBean.setFjxList(customFjxPlan);
    newBean.setQtxList(customQtxPlan);
    //planList.add(newBean);
    planList.add(prePosition, newBean);
    //?
    mCardAdapter.addViewCount();
    mCardAdapter.notifyDataSetChanged();
    vp_tb.setCurrentItem(prePosition);
}

From source file:org.quantumbadger.redreader.activities.ImageViewActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);

    final SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
    final boolean solidblack = PrefsUtility.appearance_solidblack(this, sharedPreferences);

    if (solidblack)
        getWindow().setBackgroundDrawable(new ColorDrawable(Color.BLACK));

    final Intent intent = getIntent();

    mUrl = General.uriFromString(intent.getDataString());
    final RedditPost src_post = intent.getParcelableExtra("post");

    if (mUrl == null) {
        General.quickToast(this, "Invalid URL. Trying web browser.");
        revertToWeb();/*from w  ww .j a va 2s . co  m*/
        return;
    }

    Log.i("ImageViewActivity", "Loading URL " + mUrl.toString());

    final ProgressBar progressBar = new ProgressBar(this, null, android.R.attr.progressBarStyleHorizontal);

    final LinearLayout layout = new LinearLayout(this);
    layout.setOrientation(LinearLayout.VERTICAL);
    layout.addView(progressBar);

    CacheManager.getInstance(this)
            .makeRequest(mRequest = new CacheRequest(mUrl, RedditAccountManager.getAnon(), null,
                    Constants.Priority.IMAGE_VIEW, 0, CacheRequest.DownloadType.IF_NECESSARY,
                    Constants.FileType.IMAGE, false, false, false, this) {

                private void setContentView(View v) {
                    layout.removeAllViews();
                    layout.addView(v);
                    v.getLayoutParams().width = ViewGroup.LayoutParams.MATCH_PARENT;
                    v.getLayoutParams().height = ViewGroup.LayoutParams.MATCH_PARENT;
                }

                @Override
                protected void onCallbackException(Throwable t) {
                    BugReportActivity.handleGlobalError(context.getApplicationContext(),
                            new RRError(null, null, t));
                }

                @Override
                protected void onDownloadNecessary() {
                    AndroidApi.UI_THREAD_HANDLER.post(new Runnable() {
                        @Override
                        public void run() {
                            progressBar.setVisibility(View.VISIBLE);
                            progressBar.setIndeterminate(true);
                        }
                    });
                }

                @Override
                protected void onDownloadStarted() {
                }

                @Override
                protected void onFailure(final RequestFailureType type, Throwable t, StatusLine status,
                        final String readableMessage) {

                    final RRError error = General.getGeneralErrorForFailure(context, type, t, status,
                            url.toString());

                    AndroidApi.UI_THREAD_HANDLER.post(new Runnable() {
                        public void run() {
                            // TODO handle properly
                            mRequest = null;
                            progressBar.setVisibility(View.GONE);
                            layout.addView(new ErrorView(ImageViewActivity.this, error));
                        }
                    });
                }

                @Override
                protected void onProgress(final boolean authorizationInProgress, final long bytesRead,
                        final long totalBytes) {
                    AndroidApi.UI_THREAD_HANDLER.post(new Runnable() {
                        @Override
                        public void run() {
                            progressBar.setVisibility(View.VISIBLE);
                            progressBar.setIndeterminate(authorizationInProgress);
                            progressBar.setProgress((int) ((100 * bytesRead) / totalBytes));
                        }
                    });
                }

                @Override
                protected void onSuccess(final CacheManager.ReadableCacheFile cacheFile, long timestamp,
                        UUID session, boolean fromCache, final String mimetype) {

                    if (mimetype == null
                            || (!Constants.Mime.isImage(mimetype) && !Constants.Mime.isVideo(mimetype))) {
                        revertToWeb();
                        return;
                    }

                    final InputStream cacheFileInputStream;
                    try {
                        cacheFileInputStream = cacheFile.getInputStream();
                    } catch (IOException e) {
                        notifyFailure(RequestFailureType.PARSE, e, null,
                                "Could not read existing cached image.");
                        return;
                    }

                    if (cacheFileInputStream == null) {
                        notifyFailure(RequestFailureType.CACHE_MISS, null, null, "Could not find cached image");
                        return;
                    }

                    if (Constants.Mime.isVideo(mimetype)) {

                        AndroidApi.UI_THREAD_HANDLER.post(new Runnable() {
                            public void run() {

                                if (mIsDestroyed)
                                    return;
                                mRequest = null;

                                try {
                                    final RelativeLayout layout = new RelativeLayout(context);
                                    layout.setGravity(Gravity.CENTER);

                                    final VideoView videoView = new VideoView(ImageViewActivity.this);

                                    videoView.setVideoURI(cacheFile.getUri());
                                    layout.addView(videoView);
                                    setContentView(layout);

                                    layout.getLayoutParams().width = ViewGroup.LayoutParams.MATCH_PARENT;
                                    layout.getLayoutParams().height = ViewGroup.LayoutParams.MATCH_PARENT;
                                    videoView.setLayoutParams(
                                            new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
                                                    ViewGroup.LayoutParams.MATCH_PARENT));

                                    videoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
                                        @Override
                                        public void onPrepared(MediaPlayer mp) {
                                            mp.setLooping(true);
                                            videoView.start();
                                        }
                                    });

                                    videoView.setOnErrorListener(new MediaPlayer.OnErrorListener() {
                                        @Override
                                        public boolean onError(final MediaPlayer mediaPlayer, final int i,
                                                final int i1) {
                                            revertToWeb();
                                            return true;
                                        }
                                    });

                                    videoView.setOnTouchListener(new View.OnTouchListener() {
                                        @Override
                                        public boolean onTouch(final View view, final MotionEvent motionEvent) {
                                            finish();
                                            return true;
                                        }
                                    });

                                } catch (OutOfMemoryError e) {
                                    General.quickToast(context, R.string.imageview_oom);
                                    revertToWeb();

                                } catch (Throwable e) {
                                    General.quickToast(context, R.string.imageview_invalid_video);
                                    revertToWeb();
                                }
                            }
                        });

                    } else if (Constants.Mime.isImageGif(mimetype)) {

                        final PrefsUtility.GifViewMode gifViewMode = PrefsUtility
                                .pref_behaviour_gifview_mode(context, sharedPreferences);

                        if (gifViewMode == PrefsUtility.GifViewMode.INTERNAL_BROWSER) {
                            revertToWeb();
                            return;

                        } else if (gifViewMode == PrefsUtility.GifViewMode.EXTERNAL_BROWSER) {
                            AndroidApi.UI_THREAD_HANDLER.post(new Runnable() {
                                @Override
                                public void run() {
                                    LinkHandler.openWebBrowser(ImageViewActivity.this,
                                            Uri.parse(mUrl.toString()));
                                    finish();
                                }
                            });

                            return;
                        }

                        if (AndroidApi.isIceCreamSandwichOrLater()
                                && gifViewMode == PrefsUtility.GifViewMode.INTERNAL_MOVIE) {

                            AndroidApi.UI_THREAD_HANDLER.post(new Runnable() {
                                public void run() {

                                    if (mIsDestroyed)
                                        return;
                                    mRequest = null;

                                    try {
                                        final GIFView gifView = new GIFView(ImageViewActivity.this,
                                                cacheFileInputStream);
                                        setContentView(gifView);
                                        gifView.setOnClickListener(new View.OnClickListener() {
                                            public void onClick(View v) {
                                                finish();
                                            }
                                        });

                                    } catch (OutOfMemoryError e) {
                                        General.quickToast(context, R.string.imageview_oom);
                                        revertToWeb();

                                    } catch (Throwable e) {
                                        General.quickToast(context, R.string.imageview_invalid_gif);
                                        revertToWeb();
                                    }
                                }
                            });

                        } else {

                            gifThread = new GifDecoderThread(cacheFileInputStream,
                                    new GifDecoderThread.OnGifLoadedListener() {

                                        public void onGifLoaded() {
                                            AndroidApi.UI_THREAD_HANDLER.post(new Runnable() {
                                                public void run() {

                                                    if (mIsDestroyed)
                                                        return;
                                                    mRequest = null;

                                                    imageView = new ImageView(context);
                                                    imageView.setScaleType(ImageView.ScaleType.FIT_CENTER);
                                                    setContentView(imageView);
                                                    gifThread.setView(imageView);

                                                    imageView.setOnClickListener(new View.OnClickListener() {
                                                        public void onClick(View v) {
                                                            finish();
                                                        }
                                                    });
                                                }
                                            });
                                        }

                                        public void onOutOfMemory() {
                                            General.quickToast(context, R.string.imageview_oom);
                                            revertToWeb();
                                        }

                                        public void onGifInvalid() {
                                            General.quickToast(context, R.string.imageview_invalid_gif);
                                            revertToWeb();
                                        }
                                    });

                            gifThread.start();

                        }

                    } else {

                        final ImageTileSource imageTileSource;
                        try {

                            final long bytes = cacheFile.getSize();
                            final byte[] buf = new byte[(int) bytes];

                            try {
                                new DataInputStream(cacheFileInputStream).readFully(buf);
                            } catch (IOException e) {
                                throw new RuntimeException(e);
                            }

                            try {
                                imageTileSource = new ImageTileSourceWholeBitmap(buf);

                            } catch (Throwable t) {
                                Log.e("ImageViewActivity", "Exception when creating ImageTileSource", t);
                                General.quickToast(context, R.string.imageview_decode_failed);
                                revertToWeb();
                                return;
                            }

                        } catch (OutOfMemoryError e) {
                            General.quickToast(context, R.string.imageview_oom);
                            revertToWeb();
                            return;
                        }

                        AndroidApi.UI_THREAD_HANDLER.post(new Runnable() {
                            public void run() {

                                if (mIsDestroyed)
                                    return;
                                mRequest = null;
                                mImageViewDisplayerManager = new ImageViewDisplayListManager(imageTileSource,
                                        ImageViewActivity.this);
                                surfaceView = new RRGLSurfaceView(ImageViewActivity.this,
                                        mImageViewDisplayerManager);
                                setContentView(surfaceView);

                                surfaceView.setOnClickListener(new View.OnClickListener() {
                                    public void onClick(View v) {
                                        finish();
                                    }
                                });

                                if (mIsPaused) {
                                    surfaceView.onPause();
                                } else {
                                    surfaceView.onResume();
                                }
                            }
                        });
                    }
                }
            });

    final RedditPreparedPost post = src_post == null ? null
            : new RedditPreparedPost(this, CacheManager.getInstance(this), 0, src_post, -1, false, false, false,
                    false, RedditAccountManager.getInstance(this).getDefaultAccount(), false);

    final FrameLayout outerFrame = new FrameLayout(this);
    outerFrame.addView(layout);

    if (post != null) {

        final SideToolbarOverlay toolbarOverlay = new SideToolbarOverlay(this);

        final BezelSwipeOverlay bezelOverlay = new BezelSwipeOverlay(this,
                new BezelSwipeOverlay.BezelSwipeListener() {

                    public boolean onSwipe(BezelSwipeOverlay.SwipeEdge edge) {

                        toolbarOverlay.setContents(
                                post.generateToolbar(ImageViewActivity.this, false, toolbarOverlay));
                        toolbarOverlay.show(edge == BezelSwipeOverlay.SwipeEdge.LEFT
                                ? SideToolbarOverlay.SideToolbarPosition.LEFT
                                : SideToolbarOverlay.SideToolbarPosition.RIGHT);
                        return true;
                    }

                    public boolean onTap() {

                        if (toolbarOverlay.isShown()) {
                            toolbarOverlay.hide();
                            return true;
                        }

                        return false;
                    }
                });

        outerFrame.addView(bezelOverlay);
        outerFrame.addView(toolbarOverlay);

        bezelOverlay.getLayoutParams().width = android.widget.FrameLayout.LayoutParams.MATCH_PARENT;
        bezelOverlay.getLayoutParams().height = android.widget.FrameLayout.LayoutParams.MATCH_PARENT;

        toolbarOverlay.getLayoutParams().width = android.widget.FrameLayout.LayoutParams.MATCH_PARENT;
        toolbarOverlay.getLayoutParams().height = android.widget.FrameLayout.LayoutParams.MATCH_PARENT;

    }

    setContentView(outerFrame);
}

From source file:com.nextgis.ngm_clink_monitoring.fragments.MapFragment.java

protected void addMapButtons() {
    Context context = getActivity();

    if (mivZoomIn == null || mivZoomOut == null) {
        mivZoomIn = new ImageView(context);
        mivZoomIn.setImageResource(R.drawable.ic_plus);
        mivZoomIn.setId(ViewUtil.generateViewId());

        mivZoomOut = new ImageView(context);
        mivZoomOut.setImageResource(R.drawable.ic_minus);
        mivZoomOut.setId(ViewUtil.generateViewId());

        mivZoomIn.setOnClickListener(new OnClickListener() {
            public void onClick(View v) {
                mMapView.zoomIn();/*from   w  ww  .j a  va  2s .c  om*/
            }
        });

        mivZoomOut.setOnClickListener(new OnClickListener() {
            public void onClick(View v) {
                mMapView.zoomOut();
            }
        });
    }

    mButtonsRelativeLayout = (RelativeLayout) mMapRelativeLayout.findViewById(mButtonsRelativeLayoutId);

    if (null == mButtonsRelativeLayout) {
        mButtonsRelativeLayout = new RelativeLayout(context);
        mButtonsRelativeLayout.setId(mButtonsRelativeLayoutId);

        RelativeLayout.LayoutParams paramsButtonIn = new RelativeLayout.LayoutParams(
                RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
        RelativeLayout.LayoutParams paramsButtonOut = new RelativeLayout.LayoutParams(
                RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
        RelativeLayout.LayoutParams paramsButtonsRl = new RelativeLayout.LayoutParams(
                RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);

        paramsButtonIn.setMargins(mMargins + 5, mMargins - 5, mMargins + 5, mMargins + 5);
        paramsButtonOut.setMargins(mMargins + 5, mMargins + 5, mMargins + 5, mMargins - 5);

        paramsButtonOut.addRule(RelativeLayout.BELOW, mivZoomIn.getId());
        paramsButtonsRl.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
        paramsButtonsRl.addRule(RelativeLayout.CENTER_IN_PARENT);

        mButtonsRelativeLayout.addView(mivZoomIn, paramsButtonIn);
        mButtonsRelativeLayout.addView(mivZoomOut, paramsButtonOut);
        mMapRelativeLayout.addView(mButtonsRelativeLayout, paramsButtonsRl);
    }

    setZoomInEnabled(mMapView.canZoomIn());
    setZoomOutEnabled(mMapView.canZoomOut());
}

From source file:app.sunstreak.yourpisd.LoginActivity.java

/**
 * Shows the progress UI and hides the login form.
 *///from   ww w .j  a v  a2s  .co m
@TargetApi(Build.VERSION_CODES.HONEYCOMB_MR2)
private void showProgress(final boolean show) {
    // On Honeycomb MR2 we have the ViewPropertyAnimator APIs, which allow
    // for very easy animations. If available, use these APIs to fade-in
    // the progress spinner.
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) {

        int shortAnimTime = getResources().getInteger(android.R.integer.config_shortAnimTime);

        mLoginFormView.setVisibility(View.VISIBLE);
        mLoginFormView.animate().setDuration(shortAnimTime)
                //.translationY(-200)
                .alpha(show ? 0 : 1).setListener(new AnimatorListenerAdapter() {
                    @Override
                    public void onAnimationEnd(Animator animation) {
                        mLoginFormView.setVisibility(show ? View.GONE : View.VISIBLE);
                    }
                });
        mLoginStatusView.setVisibility(View.VISIBLE);
        mLoginStatusView.animate().setDuration(shortAnimTime).alpha(show ? 1 : 0)
                .setListener(new AnimatorListenerAdapter() {
                    @Override
                    public void onAnimationEnd(Animator animation) {
                        mLoginStatusView.setVisibility(show ? View.VISIBLE : View.GONE);
                    }
                });

        //            mLoginFormView.setVisibility(View.VISIBLE);
        //            mLoginFormView.animate().setDuration(500).setInterpolator(new DecelerateInterpolator())
        //                    .translationY(height*(show? -1 : 1)).setListener(new AnimatorListenerAdapter() {
        //            @Override
        //            public void onAnimationEnd(Animator animation) {
        //                    mLoginFormView.setVisibility(show ? View.INVISIBLE
        //                            : View.VISIBLE);
        //            }
        //         });
        //            mLoginStatusView.setVisibility(View.VISIBLE);
        //            mLoginStatusView.animate().setDuration(shortAnimTime).translationY(0)
        //         .setListener(new AnimatorListenerAdapter() {
        //            @Override
        //            public void onAnimationEnd(Animator animation) {
        //               mLoginStatusView.setVisibility(show ? View.VISIBLE
        //                     : View.INVISIBLE);
        //                    System.out.println("show loading: " + show);
        //            }
        //         });

        if (DateHelper.isAprilFools()) {
            mLoginStatusView.removeAllViews();

            try {
                ImageView img = new ImageView(this);
                //noinspection ResourceType
                img.setId(1337);
                InputStream is = getAssets().open("nyan.png");
                img.setImageBitmap(BitmapFactory.decodeStream(is));
                is.close();
                TextView april = new TextView(this);
                april.setText(
                        "Today and tomorrow, we shall pay \"homage\" to the numerous poor designs of the internet");
                april.setGravity(Gravity.CENTER_HORIZONTAL);
                mLoginStatusView.addView(img);
                mLoginStatusView.addView(april);

                RotateAnimation rotateAnimation1 = new RotateAnimation(0, 360, Animation.RELATIVE_TO_SELF, 0.5f,
                        Animation.RELATIVE_TO_SELF, 0.5f);
                rotateAnimation1.setInterpolator(new LinearInterpolator());
                rotateAnimation1.setDuration(500);
                rotateAnimation1.setRepeatCount(Animation.INFINITE);
                img.startAnimation(rotateAnimation1);

            } catch (Exception e) {
                e.printStackTrace();
                return;
            }

        }

        //         mLoginStatusView.animate().setDuration(shortAnimTime)
        //               .alpha(show ? 1 : 0)
        //               .setListener(new AnimatorListenerAdapter() {
        //                  @Override
        //                  public void onAnimationEnd(Animator animation) {
        //                     mLoginStatusView.setVisibility(show ? View.VISIBLE
        //                           : View.GONE);
        //                  }
        //               });

        //         mLoginFormView.setVisibility(View.VISIBLE);
        //         mLoginFormView.animate().setDuration(shortAnimTime)
        //               .alpha(show ? 0 : 1)
        //               .setListener(new AnimatorListenerAdapter() {
        //                  @Override
        //                  public void onAnimationEnd(Animator animation) {
        //                     mLoginFormView.setVisibility(show ? View.GONE
        //                           : View.VISIBLE);
        //                  }
        //               });

    } /* else if(getIntent().getExtras().getBoolean("Refresh")){
        // The ViewPropertyAnimator APIs are not available, so simply show
        // and hide the relevant UI components.
        mLoginStatusView.setVisibility(show ? View.VISIBLE : View.GONE);
        mLoginFormView.setVisibility(show ? View.GONE : View.VISIBLE);
      }*/

}

From source file:com.android.contacts.common.list.ContactListItemView.java

/**
 * Sets whether the video calling icon is shown.  For the video calling icon to be shown,
 * {@link #mSupportVideoCallIcon} must be {@code true}.
 *
 * @param showVideoCallIcon {@code true} if the video calling icon is shown, {@code false}
 *      otherwise./*  ww  w.java2  s  .com*/
 * @param listener Listener to notify when the video calling icon is clicked.
 * @param position The position in the adapater of the video calling icon.
 */
public void setShowVideoCallIcon(boolean showVideoCallIcon, PhoneNumberListAdapter.Listener listener,
        int position) {
    mShowVideoCallIcon = showVideoCallIcon;
    mPhoneNumberListAdapterListener = listener;
    mPosition = position;

    if (mShowVideoCallIcon) {
        if (mVideoCallIcon == null) {
            mVideoCallIcon = new ImageView(getContext());
            addView(mVideoCallIcon);
        }
        mVideoCallIcon.setContentDescription(getContext().getString(R.string.description_search_video_call));
        mVideoCallIcon.setImageResource(R.drawable.ic_search_video_call);
        mVideoCallIcon.setScaleType(ScaleType.CENTER);
        mVideoCallIcon.setVisibility(View.VISIBLE);
        mVideoCallIcon.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                // Inform the adapter that the video calling icon was clicked.
                if (mPhoneNumberListAdapterListener != null) {
                    mPhoneNumberListAdapterListener.onVideoCallIconClicked(mPosition);
                }
            }
        });
    } else {
        if (mVideoCallIcon != null) {
            mVideoCallIcon.setVisibility(View.GONE);
        }
    }
}

From source file:ac.robinson.ticqr.TicQRActivity.java

private void addTickHighlight(TickBoxHolder tickBox) {
    int tickIcon = R.drawable.ic_highlight_tick;
    Drawable tickDrawable = getResources().getDrawable(tickIcon);

    ImageView tickHighlight = new ImageView(TicQRActivity.this);
    tickHighlight.setImageResource(tickIcon);
    RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(
            ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    layoutParams.leftMargin = mImageView.getLeft() + Math.round(tickBox.imagePosition.x)
            - (tickDrawable.getIntrinsicWidth() / 2);
    layoutParams.topMargin = mImageView.getTop() + Math.round(tickBox.imagePosition.y)
            - (tickDrawable.getIntrinsicHeight() / 2);

    ((RelativeLayout) findViewById(R.id.tick_highlight_holder)).addView(tickHighlight, layoutParams);
    tickHighlight.startAnimation(AnimationUtils.loadAnimation(this, R.anim.pulse));

    tickHighlight.setOnClickListener(mTickClickListener);
    tickHighlight.setTag(tickBox);/*from   ww  w .  j a  va  2s .c o m*/
}

From source file:com.android.contacts.list.ContactListItemView.java

/**
 * Sets whether the video calling icon is shown.  For the video calling icon to be shown,
 * {@link #mSupportVideoCallIcon} must be {@code true}.
 *
 * @param showVideoCallIcon {@code true} if the video calling icon is shown, {@code false}
 *      otherwise.//from   w  w w.j a  v  a  2 s . co m
 * @param listener Listener to notify when the video calling icon is clicked.
 * @param position The position in the adapater of the video calling icon.
 */
public void setShowVideoCallIcon(boolean showVideoCallIcon, PhoneNumberListAdapter.Listener listener,
        int position) {
    mShowVideoCallIcon = showVideoCallIcon;
    mPhoneNumberListAdapterListener = listener;
    mPosition = position;

    if (mShowVideoCallIcon) {
        if (mVideoCallIcon == null) {
            mVideoCallIcon = new ImageView(getContext());
            addView(mVideoCallIcon);
        }
        mVideoCallIcon.setContentDescription(getContext().getString(R.string.description_search_video_call));
        mVideoCallIcon.setImageResource(R.drawable.quantum_ic_videocam_vd_theme_24);
        mVideoCallIcon.setScaleType(ScaleType.CENTER);
        mVideoCallIcon.setVisibility(View.VISIBLE);
        mVideoCallIcon.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                // Inform the adapter that the video calling icon was clicked.
                if (mPhoneNumberListAdapterListener != null) {
                    mPhoneNumberListAdapterListener.onVideoCallIconClicked(mPosition);
                }
            }
        });
    } else {
        if (mVideoCallIcon != null) {
            mVideoCallIcon.setVisibility(View.GONE);
        }
    }
}

From source file:org.linphone.IncomingCallActivity.java

private void initDot() {
    viewGroup = (LinearLayout) findViewById(R.id.viewGroup);
    viewGroup.removeAllViews();/*w  w  w  .  ja  va  2 s .  c om*/
    LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(40, 40);
    layoutParams.setMargins(4, 3, 4, 3);
    Log.e("", "dot" + viewAdapter.getCount());
    dots = new ImageView[viewAdapter.getCount()];
    for (int i = 0; i < viewAdapter.getCount(); i++) {
        dot = new ImageView(IncomingCallActivity.this);

        dot.setLayoutParams(layoutParams);
        dots[i] = dot;
        dots[i].setTag(i);
        dots[i].setOnClickListener(onClick);

        if (i == 0) {
            dots[i].setBackgroundResource(R.drawable.dotc);
        } else {
            dots[i].setBackgroundResource(R.drawable.dotn);
        }

        viewGroup.addView(dots[i]);
    }
}

From source file:org.i_chera.wolfensteineditor.fragments.LevelFragment.java

@Override
public void createVisTile(int i, int j) {
    int ms = LevelContainer.MAPSIZE - 1;
    if (!Global.inBounds(i, 0, ms) || !Global.inBounds(j, 0, ms)) {
        //         Log.d(TAG, "Refused create " + i + " " + j);
        return;/* ww  w. j  av a 2s  .  c  o  m*/
    }
    if (getActivity() == null)
        return;
    mTileViews[i][j] = new ImageView(getActivity());
    mTileViews[i][j].setId(i * LevelContainer.MAPSIZE + j);
    RelativeLayout.LayoutParams rllp = new RelativeLayout.LayoutParams(mTileSize, mTileSize);
    rllp.leftMargin = j * mTileSize;
    rllp.topMargin = i * mTileSize;
    mTileViews[i][j].setLayoutParams(rllp);
    //      mTileViews[i][j].setOnClickListener(this);
    //      mTileViews[i][j].setOnTouchListener(this);
    //      mTileViews[i][j].setClickable(true);
    mGridLayout.addView(mTileViews[i][j]);

    updateGraphics(mTileViews[i][j], j, i);
}