Example usage for android.widget ImageView setOnClickListener

List of usage examples for android.widget ImageView setOnClickListener

Introduction

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

Prototype

public void setOnClickListener(@Nullable OnClickListener l) 

Source Link

Document

Register a callback to be invoked when this view is clicked.

Usage

From source file:com.bt.download.android.gui.adapters.TransferListAdapter.java

private void populateBittorrentDownload(View view, BittorrentDownload download) {
    TextView title = findView(view, R.id.view_transfer_list_item_title);
    ProgressBar progress = findView(view, R.id.view_transfer_list_item_progress);
    TextView status = findView(view, R.id.view_transfer_list_item_status);
    TextView speed = findView(view, R.id.view_transfer_list_item_speed);
    TextView size = findView(view, R.id.view_transfer_list_item_size);
    ImageView buttonAction = findView(view, R.id.view_transfer_list_item_button_action);

    TextView seeds = findView(view, R.id.view_transfer_list_item_seeds);
    TextView peers = findView(view, R.id.view_transfer_list_item_peers);

    seeds.setText(context.get().getString(R.string.seeds_n, download.getSeeds()));
    peers.setText(context.get().getString(R.string.peers_n, download.getPeers()));

    title.setText(download.getDisplayName());
    progress.setProgress(download.getProgress());

    status.setText(TRANSFER_STATE_STRING_MAP.get(download.getStatus()));

    speed.setText(UIUtils.getBytesInHuman(download.getDownloadSpeed()) + "/s");
    size.setText(UIUtils.getBytesInHuman(download.getSize()));

    buttonAction.setTag(download);/*  w  w  w .j  a v  a  2  s .c o  m*/
    buttonAction.setOnClickListener(viewOnClickListener);
}

From source file:com.retroteam.studio.retrostudio.EditorLandscape.java

/**
 * Create all the views associated with a track.
 * @param waveDrawableID//from   w w w  .jav a 2  s  .c  o m
 * @param projectLoad
 * @return
 */

private ImageView addTrack(int waveDrawableID, boolean projectLoad) {
    //add the track with the measure adder to the view
    //get layout
    LinearLayout track_layout = (LinearLayout) findViewById(R.id.track_layout);

    //create track container
    HorizontalScrollView track_container = new HorizontalScrollView(getApplicationContext());
    track_container.setLayoutParams(new HorizontalScrollView.LayoutParams(
            HorizontalScrollView.LayoutParams.MATCH_PARENT, displaysize.y / 4));
    track_container.setBackground(getResources().getDrawable(R.color.track_container_bg));

    //create grid layout
    GridLayout track_grid = new GridLayout(getApplicationContext());
    track_grid.setColumnCount(100);
    track_grid.setRowCount(1);
    track_grid.setOrientation(GridLayout.HORIZONTAL);
    track_grid.setId(R.id.track_grid);

    //create linear layout for track id and wave
    LinearLayout track_identifier = new LinearLayout(getApplicationContext());
    track_identifier.setLayoutParams(new LinearLayout.LayoutParams(displaysize.x / 14, displaysize.y / 4));
    track_identifier.setOrientation(LinearLayout.VERTICAL);
    track_identifier.setBackgroundColor(getResources().getColor(R.color.black_overlay));

    //create textview for linear layout
    TextView track_num = new TextView(getApplicationContext());
    track_num.setText("1");
    track_num.setTextSize(45);
    track_num.setGravity(Gravity.CENTER | Gravity.CENTER_VERTICAL);

    //create imageview for linear layout
    ImageView track_type = new ImageView(getApplicationContext());
    track_type.setImageResource(waveDrawableID);
    track_type.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,
            LinearLayout.LayoutParams.MATCH_PARENT));

    //create "add measure" for grid layout
    ImageView add_measure = new ImageView(getApplicationContext());
    add_measure.setImageResource(R.drawable.measure_new);
    add_measure.setLayoutParams(new LinearLayout.LayoutParams((int) (displaysize.x / 3.32),
            LinearLayout.LayoutParams.MATCH_PARENT));
    if (projectLoad) {
        add_measure.setTag(R.id.TAG_ROW, trackReloadCounter);
        add_measure.setId(trackReloadCounter + 4200);
    } else {
        add_measure.setTag(R.id.TAG_ROW, theproject.size() - 1);
        add_measure.setId(theproject.size() - 1 + 4200);
    }

    add_measure.setTag(R.id.TAG_COLUMN, 0);
    add_measure.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            addMeasure(v, false);

        }
    });

    track_identifier.addView(track_num);
    if (projectLoad) {
        track_num.setText(Integer.toString(trackReloadCounter + 1));
        trackReloadCounter += 1;
    } else {
        track_num.setText(Integer.toString(theproject.size()));
    }
    track_num.setTextSize(45);
    track_identifier.addView(track_type);

    track_grid.addView(track_identifier);
    track_grid.addView(add_measure);

    track_container.addView(track_grid);

    track_layout.addView(track_container);

    return add_measure;

}

From source file:com.sim2dial.dialer.InCallActivity.java

private void displayConferenceHeader() {
    LinearLayout conferenceHeader = (LinearLayout) inflater.inflate(R.layout.conference_header, container,
            false);//ww w  .j ava  2  s. com

    ImageView conferenceState = (ImageView) conferenceHeader.findViewById(R.id.conferenceStatus);
    conferenceState.setOnClickListener(this);
    if (LinphoneManager.getLc().isInConference()) {
        conferenceState.setImageResource(R.drawable.play);
    } else {
        conferenceState.setImageResource(R.drawable.pause);
    }

    callsList.addView(conferenceHeader);
}

From source file:com.syncedsynapse.kore2.ui.AlbumDetailsFragment.java

/**
 * Display the songs//from  w  w w. ja v  a2  s .  com
 *
 * @param cursor Cursor with the data
 */
private void displaySongsList(Cursor cursor) {
    if (cursor.moveToFirst()) {
        songInfoList = new ArrayList<FileDownloadHelper.SongInfo>(cursor.getCount());
        do {
            View songView = LayoutInflater.from(getActivity()).inflate(R.layout.list_item_song, songListView,
                    false);
            TextView songTitle = (TextView) songView.findViewById(R.id.song_title);
            TextView trackNumber = (TextView) songView.findViewById(R.id.track_number);
            TextView duration = (TextView) songView.findViewById(R.id.duration);
            ImageView contextMenu = (ImageView) songView.findViewById(R.id.list_context_menu);

            // Add this song to the list
            FileDownloadHelper.SongInfo songInfo = new FileDownloadHelper.SongInfo(albumDisplayArtist,
                    albumTitle, cursor.getInt(AlbumSongsListQuery.SONGID),
                    cursor.getInt(AlbumSongsListQuery.TRACK), cursor.getString(AlbumSongsListQuery.TITLE),
                    cursor.getString(AlbumSongsListQuery.FILE));
            songInfoList.add(songInfo);

            songTitle.setText(songInfo.title);
            trackNumber.setText(String.valueOf(songInfo.track));
            duration.setText(UIUtils.formatTime(cursor.getInt(AlbumSongsListQuery.DURATION)));

            contextMenu.setTag(songInfo);
            contextMenu.setOnClickListener(songItemMenuClickListener);

            songView.setTag(songInfo);
            songView.setOnClickListener(songClickListener);
            songListView.addView(songView);
        } while (cursor.moveToNext());

        if (songInfoList.size() > 0) {
            downloadButton.setVisibility(View.VISIBLE);
            // Check if download dir exists
            FileDownloadHelper.SongInfo songInfo = new FileDownloadHelper.SongInfo(albumDisplayArtist,
                    albumTitle, 0, 0, null, null);
            if (songInfo.downloadDirectoryExists()) {
                Resources.Theme theme = getActivity().getTheme();
                TypedArray styledAttributes = theme.obtainStyledAttributes(new int[] { R.attr.colorAccent });
                downloadButton.setColorFilter(styledAttributes.getColor(0, R.color.accent_default));
                styledAttributes.recycle();
            } else {
                downloadButton.clearColorFilter();
            }
        }
    }
}

From source file:com.conferenceengineer.android.iosched.ui.SessionDetailFragment.java

private void onSpeakersQueryComplete(Cursor cursor) {
    mSpeakersCursor = true;/*from  ww w .  j a v  a 2  s.c  o  m*/
    final ViewGroup speakersGroup = (ViewGroup) mRootView.findViewById(R.id.session_speakers_block);

    // Remove all existing speakers (everything but first child, which is the header)
    for (int i = speakersGroup.getChildCount() - 1; i >= 1; i--) {
        speakersGroup.removeViewAt(i);
    }

    final LayoutInflater inflater = getActivity().getLayoutInflater();

    boolean hasSpeakers = false;

    while (cursor.moveToNext()) {
        final String speakerName = cursor.getString(SpeakersQuery.SPEAKER_NAME);
        if (TextUtils.isEmpty(speakerName)) {
            continue;
        }

        final String speakerImageUrl = cursor.getString(SpeakersQuery.SPEAKER_IMAGE_URL);
        final String speakerCompany = cursor.getString(SpeakersQuery.SPEAKER_COMPANY);
        final String speakerUrl = cursor.getString(SpeakersQuery.SPEAKER_URL);
        final String speakerAbstract = cursor.getString(SpeakersQuery.SPEAKER_ABSTRACT);

        String speakerHeader = speakerName;
        if (!TextUtils.isEmpty(speakerCompany)) {
            speakerHeader += ", " + speakerCompany;
        }

        final View speakerView = inflater.inflate(R.layout.speaker_detail, speakersGroup, false);
        final TextView speakerHeaderView = (TextView) speakerView.findViewById(R.id.speaker_header);
        final ImageView speakerImageView = (ImageView) speakerView.findViewById(R.id.speaker_image);
        final TextView speakerAbstractView = (TextView) speakerView.findViewById(R.id.speaker_abstract);

        if (!TextUtils.isEmpty(speakerImageUrl) && mImageLoader != null) {
            mImageLoader.get(UIUtils.getConferenceImageUrl(speakerImageUrl), speakerImageView);
        }

        speakerHeaderView.setText(speakerHeader);
        speakerImageView.setContentDescription(getString(R.string.speaker_googleplus_profile, speakerHeader));
        UIUtils.setTextMaybeHtml(speakerAbstractView, speakerAbstract);

        if (!TextUtils.isEmpty(speakerUrl)) {
            speakerImageView.setEnabled(true);
            speakerImageView.setOnClickListener(new OnClickListener() {
                @Override
                public void onClick(View view) {
                    Intent speakerProfileIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(speakerUrl));
                    speakerProfileIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
                    startActivity(speakerProfileIntent);
                }
            });
        } else {
            speakerImageView.setEnabled(false);
            speakerImageView.setOnClickListener(null);
        }

        speakersGroup.addView(speakerView);
        hasSpeakers = true;
        mHasSummaryContent = true;
    }

    speakersGroup.setVisibility(hasSpeakers ? View.VISIBLE : View.GONE);

    // Show empty message when all data is loaded, and nothing to show
    if (mSessionCursor && !mHasSummaryContent) {
        mRootView.findViewById(android.R.id.empty).setVisibility(View.VISIBLE);
    }
}

From source file:com.sim2dial.dialer.InCallActivity.java

private boolean displayCallStatusIconAndReturnCallPaused(LinearLayout callView, LinphoneCall call) {
    boolean isCallPaused, isInConference;
    ImageView callState = (ImageView) callView.findViewById(R.id.callStatus);
    callState.setTag(call);/*from w  w  w .  j  a  v a  2  s  .c  o  m*/
    callState.setOnClickListener(this);

    if (call.getState() == State.Paused || call.getState() == State.PausedByRemote
            || call.getState() == State.Pausing) {
        callState.setImageResource(R.drawable.pause);
        isCallPaused = true;
        isInConference = false;
    } else if (call.getState() == State.OutgoingInit || call.getState() == State.OutgoingProgress
            || call.getState() == State.OutgoingRinging) {
        callState.setImageResource(R.drawable.call_state_ringing_default);
        isCallPaused = false;
        isInConference = false;
    } else {
        if (isConferenceRunning && call.isInConference()) {
            callState.setImageResource(R.drawable.remove);
            isInConference = true;
        } else {
            callState.setImageResource(R.drawable.play);
            isInConference = false;
        }
        isCallPaused = false;
    }

    return isCallPaused || isInConference;
}

From source file:com.microsoft.mimickeralarm.ringing.AlarmRingingFragment.java

@Nullable
@Override/*w w  w.ja v a 2 s . c  om*/
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    Logger.init(getActivity());
    Bundle args = getArguments();
    UUID alarmId = UUID.fromString(args.getString(ARGS_ALARM_ID));
    mAlarm = AlarmList.get(getContext()).getAlarm(alarmId);

    View view = inflater.inflate(R.layout.fragment_alarm_ringing, container, false);

    if (android.os.Build.VERSION.SDK_INT <= Build.VERSION_CODES.JELLY_BEAN) {
        TextView timeField = (TextView) view.findViewById(R.id.alarm_ringing_time);
        timeField.setText(DateTimeUtilities.getUserTimeString(getContext(), mAlarm.getTimeHour(),
                mAlarm.getTimeMinute()));
    }

    TextView dateField = (TextView) view.findViewById(R.id.alarm_ringing_date);
    dateField.setText(DateTimeUtilities.getFullDateStringForNow());

    String name = mAlarm.getTitle();
    TextView titleField = (TextView) view.findViewById(R.id.alarm_ringing_title);
    titleField.setText(name);

    ImageView dismissButton = (ImageView) view.findViewById(R.id.alarm_ringing_dismiss);
    dismissButton.setOnDragListener(new View.OnDragListener() {
        @Override
        public boolean onDrag(View v, DragEvent event) {
            switch (event.getAction()) {
            case DragEvent.ACTION_DROP:
                dismissAlarm();
                break;
            case DragEvent.ACTION_DRAG_ENDED:
                if (mShowClockOnDragEnd) {
                    mAlarmRingingClock.postDelayed(new Runnable() {
                        @Override
                        public void run() {
                            mAlarmRingingClock.setVisibility(View.VISIBLE);
                        }
                    }, SHOW_CLOCK_AFTER_UNSUCCESSFUL_DRAG_DELAY);
                }
                break;
            default:
                break;
            }
            return true;
        }
    });

    // Dismiss ringing if someone presses the dismiss button directly
    dismissButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            dismissAlarm();
        }
    });

    ImageView snoozeButton = (ImageView) view.findViewById(R.id.alarm_ringing_snooze);
    snoozeButton.setOnDragListener(new View.OnDragListener() {
        @Override
        public boolean onDrag(View v, DragEvent event) {
            switch (event.getAction()) {
            case DragEvent.ACTION_DROP:
                mCallback.onRingingSnooze();
                break;
            default:
                break;
            }
            return true;
        }
    });

    // Snooze ringing if someone presses the snooze button directly
    snoozeButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            mCallback.onRingingSnooze();
        }
    });

    // Allow the view to listen to the drag event to update arrow animations accordingly
    view.setOnDragListener(new View.OnDragListener() {
        @Override
        public boolean onDrag(View v, DragEvent event) {
            switch (event.getAction()) {
            case DragEvent.ACTION_DRAG_LOCATION:
                // Update the left/right arrow visibility based on the current drag location.
                onClockDragLocation(event.getX(), event.getY(), v.getWidth() / 2);
                break;
            case DragEvent.ACTION_DROP:
                // The user has dropped the drag, but it is dropped within the view, instead of the target
                // drop zones to dismiss or snooze.
                // Restore to show both left arrow and right arrow animations.
                mDragZone = DragZone.NEAR_MIDDLE_OF_VIEW;
                updateArrowsBasedOnDragZone(mDragZone);
                break;
            default:
                break;
            }
            return true;
        }
    });

    mAlarmRingingClock = (ImageView) view.findViewById(R.id.alarm_ringing_clock);
    mAlarmRingingClock.setOnTouchListener(new View.OnTouchListener() {
        @Override
        public boolean onTouch(View v, MotionEvent event) {
            if (event.getAction() == MotionEvent.ACTION_DOWN) {
                ClipData dragData = ClipData.newPlainText("", "");
                View.DragShadowBuilder shadow = new View.DragShadowBuilder(mAlarmRingingClock);
                mAlarmRingingClock.startDrag(dragData, shadow, null, 0);
                mAlarmRingingClock.setVisibility(View.INVISIBLE);
                return true;
            } else {
                return false;
            }

        }
    });

    initializeClockAnimation(view);

    Loggable.AppAction appAction = new Loggable.AppAction(Loggable.Key.APP_ALARM_RINGING);

    appAction.putJSON(mAlarm.toJSON());
    Logger.track(appAction);

    return view;
}

From source file:com.roger.lineselectionwebview.LSWebView.java

/**
 * ?//from   w  w  w  .ja  v a2  s .c o m
 */
private void drawImage() {
    int size = rectList.size();
    Rect endRect = rectList.get(size - 1);
    Rect realEndRect = endRect;

    // ?left???,,?
    if (size > 2) {
        Rect endPreRect = rectList.get(size - 2);
        if (endRect.left == endPreRect.left) {
            if (endRect.width() > endPreRect.width()) {
                realEndRect = endPreRect;
            } else {
                realEndRect = endRect;
            }
        }
    }

    Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.del);
    ImageView imageView = new ImageView(mContext);
    imageView.setImageBitmap(bitmap);
    imageView.setScaleType(ScaleType.CENTER);
    imageView.setTag(selectContext);
    MyAbsoluteLayout.LayoutParams lp = new MyAbsoluteLayout.LayoutParams(
            MyAbsoluteLayout.LayoutParams.WRAP_CONTENT, MyAbsoluteLayout.LayoutParams.WRAP_CONTENT,
            realEndRect.right, realEndRect.bottom);
    imageView.setLayoutParams(lp);

    imageView.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            String tag = (String) v.getTag();
            lineView.remove(tag);
            myLayout.removeView(v);
            if (onTextSelectListener != null) {
                onTextSelectListener.cancle(tag.split(SELECT_SPLIT)[0]);
            }
        }

    });
    myLayout.addView(imageView, lp);
}

From source file:com.silentcircle.silentphone2.dialogs.CryptoInfoDialog.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {

    AlertDialog.Builder builder = new AlertDialog.Builder(mParent);
    // Get the layout inflater
    LayoutInflater inflater = mParent.getLayoutInflater();

    CallState call = TiviPhoneService.calls.selectedCall;
    if (call == null)
        return null;

    String buildInfo = TiviPhoneService.getInfo(call.iEngID, call.iCallId, lbBuildInfo);
    if (ConfigurationUtilities.mTrace)
        Log.d(TAG, "ZRTP build information: " + buildInfo);

    // Inflate and set the layout for the dialog
    // set the SAS string to compare
    // Pass null as the parent view because its going in the dialog layout
    View view = inflater.inflate(R.layout.dialog_crypto_info, null, false);
    if (view == null)
        return null;

    TextView txtView = (TextView) view.findViewById(R.id.CryptoCryptoComponentsCipherInfo);
    txtView.setText(TiviPhoneService.getInfo(-1, call.iCallId, lbCipher));

    txtView = (TextView) view.findViewById(R.id.CryptoCryptoComponentsHashInfo);
    txtView.setText(TiviPhoneService.getInfo(call.iEngID, call.iCallId, lbHash));

    txtView = (TextView) view.findViewById(R.id.CryptoCryptoComponentsPkInfo);
    txtView.setText(TiviPhoneService.getInfo(call.iEngID, call.iCallId, lbKeyExchange));

    txtView = (TextView) view.findViewById(R.id.CryptoCryptoComponentsSauthInfo);
    txtView.setText(TiviPhoneService.getInfo(call.iEngID, call.iCallId, lbAuthTag));

    txtView = (TextView) view.findViewById(R.id.CryptoCryptoComponentsZhashInfo);
    txtView.setText(TiviPhoneService.getInfo(call.iEngID, call.iCallId, sdp_hash));

    txtView = (TextView) view.findViewById(R.id.CryptoPeerClientIdInfo);
    txtView.setText(TiviPhoneService.getInfo(call.iEngID, call.iCallId, lbClient));

    txtView = (TextView) view.findViewById(R.id.CryptoPeerClientProtoInfo);
    txtView.setText(TiviPhoneService.getInfo(call.iEngID, call.iCallId, lbVersion));

    txtView = (TextView) view.findViewById(R.id.CryptoCryptoComponentsTlsInfo);
    String tls = TiviPhoneService.getInfo(call.iEngID, -1, socket);
    txtView.setText(tls);// w  w w .ja v  a2 s  .c  o  m
    txtView.setSelected(true);

    txtView = (TextView) view.findViewById(R.id.CryptoPeerSecureSinceInfo);
    try {
        long since = Long.valueOf(TiviPhoneService.getInfo(call.iEngID, call.iCallId, secureSince));
        if (since <= 0) {
            txtView.setVisibility(View.GONE);
            view.findViewById(R.id.CryptoPeerSecureSince).setVisibility(View.GONE);
        } else {
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
            sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
            txtView.setText(sdf.format(new Date(since * 1000)));
        }
    } catch (NumberFormatException ignore) {
        txtView.setVisibility(View.GONE);
        view.findViewById(R.id.CryptoPeerSecureSince).setVisibility(View.GONE);
    }

    ImageView imgView = (ImageView) view.findViewById(R.id.CryptoSharedSecretsRs1Info);
    CompatibilityHelper.setBackground(imgView, getSharedSecretStatus(mParent, "rs1"));

    imgView = (ImageView) view.findViewById(R.id.CryptoSharedSecretsRs2Info);
    CompatibilityHelper.setBackground(imgView, getSharedSecretStatus(mParent, "rs2"));

    imgView = (ImageView) view.findViewById(R.id.CryptoSharedSecretsAuxInfo);
    CompatibilityHelper.setBackground(imgView, getSharedSecretStatus(mParent, "aux"));

    imgView = (ImageView) view.findViewById(R.id.CryptoSharedSecretsPbxInfo);
    CompatibilityHelper.setBackground(imgView, getSharedSecretStatus(mParent, "pbx"));

    txtView = (TextView) view.findViewById(R.id.CryptoPeerName);
    txtView.setText(call.zrtpPEER.toString());

    txtView = (TextView) view.findViewById(R.id.CryptoSasText);
    txtView.setText(call.bufSAS.toString());

    // if show verify SAS then SAS was not verified
    imgView = (ImageView) view.findViewById(R.id.CryptoPanelPadlock);
    if (call.iShowVerifySas)
        imgView.setImageResource(R.drawable.main_lock_locked);
    else
        imgView.setImageResource(R.drawable.main_lock_verified);
    imgView.setOnClickListener(this);

    // Add inflated view and action buttons
    builder.setView(view).setPositiveButton(R.string.close_dialog, new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int id) {
            mParent.dialogClosed();
        }
    });
    return builder.create();
}

From source file:com.near.chimerarevo.fragments.PostFragment.java

private void addGallery(final String[] imgUrls) {
    numGalleries++;/*from w  w  w.j ava 2s .c  om*/
    if (!PreferenceManager.getDefaultSharedPreferences(getActivity()).getBoolean("load_imgs_pref", true)
            || numGalleries > Integer.parseInt(PreferenceManager.getDefaultSharedPreferences(getActivity())
                    .getString("gallery_num_pref", "20")))
        return;
    HorizontalScrollView hsv = new HorizontalScrollView(getActivity());
    LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
    params.gravity = Gravity.CENTER_HORIZONTAL;
    params.setMargins(10, 10, 10, 0);
    hsv.setLayoutParams(params);

    LinearLayout container = new LinearLayout(getActivity());
    container.setOrientation(LinearLayout.HORIZONTAL);
    for (int i = 0; i < imgUrls.length; i++) {
        final ImageView img = new ImageView(getActivity());
        LayoutParams imgPar = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
        if (i == 0)
            imgPar.setMargins(5, 10, 0, 10);
        else
            imgPar.setMargins(10, 10, 0, 10);
        img.setLayoutParams(imgPar);
        img.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
        container.addView(img);

        final DisplayImageOptions options = new DisplayImageOptions.Builder().cacheOnDisk(false)
                .cacheInMemory(true).showImageOnLoading(R.drawable.empty_cr).bitmapConfig(Bitmap.Config.RGB_565)
                .imageScaleType(ImageScaleType.EXACTLY).delayBeforeLoading(200).build();
        ImageLoader.getInstance().displayImage(imgUrls[i], img, options);

        final int k = i;
        img.setClickable(true);
        img.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                final Dialog dialog = new Dialog(getActivity());
                dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
                dialog.setContentView(R.layout.img_dialog_layout);
                ImageLoader.getInstance().displayImage(imgUrls[k].split("\\?resize=")[0],
                        ((TouchImageView) dialog.findViewById(R.id.dialog_image)), options);
                dialog.setCancelable(true);
                dialog.show();
            }
        });
    }
    hsv.addView(container);
    lay.addView(hsv);
}