Example usage for android.widget TextView setOnClickListener

List of usage examples for android.widget TextView setOnClickListener

Introduction

In this page you can find the example usage for android.widget TextView 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.minsheng.app.xunchedai.loan.activities.AddLoanActivity.java

public void initPopupWindowDraft(View v) {
    popupWindow = PopupWindowUtils.newPop(this, R.layout.pop_add_loan_activity_draft, v);
    TextView tv_save_draft = (TextView) popupWindow.getContentView().findViewById(R.id.save_draft);
    TextView tv_save_no = (TextView) popupWindow.getContentView().findViewById(R.id.save_no);
    TextView tv_cancel = (TextView) popupWindow.getContentView().findViewById(R.id.cancel);

    if (is_draft) {
        tv_save_draft.setText("?");
    }/*from  w  ww .j  a  va 2s. com*/
    tv_save_draft.setOnClickListener(this);
    tv_save_no.setOnClickListener(this);
    tv_cancel.setOnClickListener(this);
}

From source file:com.xunlei.shortvideo.activity.VideoPublishLocal3Activity.java

@Override
protected void postInitUI() {
    //        String fileName = parseVideoName(mVideoPath);
    //        if (Util.getChineseCount(fileName) >= CHINESE_FILE_NAME_LIMITER) {
    //            mTvTitle.append(fileName);
    //        }//from   w w  w .j  a  va2 s  . c o m
    //        File file = new File(mVideoPath);
    //        mVideoSurface = (SurfaceView) findViewById(R.id.surface_view);

    //        mVideoView.setContentUri(Uri.fromFile(file));
    //        mVideoView.setLoopedPlay(true);
    //        mVideoView.setLoadingEnable(true);
    mBottomOpBar = (LinearLayout) findViewById(R.id.bottom_opbar);
    mMvChooseContainer = (FrameLayout) findViewById(R.id.effect_chooser_container);
    mBtnChooseMv = (TextView) findViewById(R.id.mv);
    mFilterOpLayer = (FrameLayout) findViewById(R.id.filter);
    mFilterNameTv = (TextView) findViewById(R.id.filterName);

    mHorizontalScrollTipsView = (LinearLayout) findViewById(R.id.horizontal_scroll_tips);
    TextView known = (TextView) findViewById(R.id.known);
    if (SettingManager.isFirstEnterVideoEdit()) {
        mHorizontalScrollTipsView.setVisibility(View.VISIBLE);
        mHorizontalScrollTipsView.setOnClickListener(this);
        known.setOnClickListener(this);
    } else {
        mHorizontalScrollTipsView.setVisibility(View.GONE);
    }

}

From source file:com.trukr.shipper.fragment.RequestStatus.java

private void process() {
    more_Icon.setOnClickListener(new View.OnClickListener() {
        @Override// w  ww .  j  av  a 2 s. c  o  m
        public void onClick(View v) {
            showImageAlert();
        }
    });
    driverProfile.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            View popUpView = getLayoutInflater().inflate(R.layout.activity_map_popup, null);
            // inflating popup layout
            mpopup = new PopupWindow(popUpView, ViewGroup.LayoutParams.FILL_PARENT,
                    ViewGroup.LayoutParams.WRAP_CONTENT, true); //Creation of popup
            mpopup.setAnimationStyle(android.R.style.Animation_Dialog);
            mpopup.showAtLocation(popUpView, Gravity.BOTTOM, 0, 0);
            // Displaying popup
            RoundedImageView pop_up_driverimage = (RoundedImageView) popUpView.findViewById(R.id.pop_up_image);
            TextView driverName = (TextView) popUpView.findViewById(R.id.tv_drivername);
            TextView licenseNumber = (TextView) popUpView.findViewById(R.id.tv_driverlicenseno);
            TextView usDotnumber = (TextView) popUpView.findViewById(R.id.tv_usdotno);
            TextView mcNumber = (TextView) popUpView.findViewById(R.id.tv_mcno);
            TextView licensePlates = (TextView) popUpView.findViewById(R.id.tv_licenseplates);
            TextView checkSafetyRating = (TextView) popUpView.findViewById(R.id.tv_checksafetyrating);
            TextView insuranceDocument = (TextView) popUpView.findViewById(R.id.tv_insurancedocument);
            ImageView moreIcon = (ImageView) popUpView.findViewById(R.id.fragment_btn_currentjobs);
            moreIcon.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    showImageAlert();
                }
            });

            checkSafetyRating.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {

                    Intent i = new Intent(mContext, WebViewDisplay.class);
                    i.putExtra("insurancedocument", 1);
                    startActivity(i);
                }
            });
            insuranceDocument.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    Intent i = new Intent(mContext, WebViewDisplay.class);
                    i.putExtra("insuranceValue", insuranceValue);
                    startActivity(i);
                }
            });

            driverName.setText(driversname);
            System.out.println("driversimage--->" + driverImage);
            try {
                Picasso.with(getApplicationContext()).load(driverImage).into(pop_up_driverimage);
            } catch (Exception e) {
                e.printStackTrace();
            }
            licenseNumber.setText(": " + driverLicenseValue);
            usDotnumber.setText(": " + driverUsDotNumberValue);
            mcNumber.setText(": " + driverMcNumberValue);
            licensePlates.setText(": " + driverLicensePlatesValue);
            popup = (LinearLayout) popUpView.findViewById(R.id.map_activity_popup);
            RoundedImageView view = (RoundedImageView) popUpView.findViewById(R.id.pop_up_image);

            view.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    mpopup.dismiss();
                }
            });
        }
    });
    back.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            Intent intent = new Intent(mContext, SlidingDrawer.class);
            intent.putExtra("OrderStatus", 1);
            startActivity(intent);
        }
    });
    notification.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent intent = new Intent(RequestStatus.this, Notification.class);
            startActivity(intent);
        }
    });
}

From source file:de.blinkt.openvpn.ActivityDashboard.java

@Override
protected void onCreate(android.os.Bundle savedInstanceState) {
    Log.i("ibVPN", "onCreate dashboard.");
    super.onCreate(savedInstanceState);
    // set theme by code, this will improve the speed.
    setTheme(R.style.blinkt_lolTheme);/*from  w  ww  . j  av a  2 s.  c o  m*/
    setContentView(R.layout.mydash);

    mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
    mDrawerList = (ListView) findViewById(R.id.left_drawer);

    myToolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(myToolbar);
    getSupportActionBar().setDisplayShowTitleEnabled(true);
    getSupportActionBar().setTitle("");
    getSupportActionBar().setHomeButtonEnabled(true);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    myToolbar.setNavigationIcon(R.drawable.ic_action_menu);
    myToolbar.setNavigationOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            mDrawerLayout.openDrawer(Gravity.LEFT);
            //  Toast.makeText(ActivityDashboard.this, "Back clicked!",     Toast.LENGTH_SHORT).show();
            Log.d("Clicked", "drawer open");
        }
    });

    findViewById(R.id.textview_checkip).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent intent = new Intent(ActivityDashboard.this, ActivityContactUs.class);
            startActivity(intent);
        }
    });

    // Set the adapter for the list view
    //   mDrawerList.setAdapter(new ArrayAdapter<String>(this,
    //           R.layout.drawer_list_item, mDrawerTitles));
    mDrawerTitles = new ArrayList<>();
    mDrawerTitles.add(new NavDrawerItem(R.drawable.ic_action_menu, "Settings"));
    mDrawerTitles.add(new NavDrawerItem(R.drawable.ic_action_menu, "Connection Log"));
    mDrawerTitles.add(new NavDrawerItem(R.drawable.ic_action_menu, "Purchase"));
    mDrawerTitles.add(new NavDrawerItem(R.drawable.ic_action_menu, "Log out"));

    mDrawerList.setAdapter(new NavDrawerAdapter(this, R.layout.drawer_list_item, mDrawerTitles));
    //         Set the list's click listener
    mDrawerList.setOnItemClickListener(new DrawerItemClickListener());

    //        Log.d("toolbartitle",myToolbar.getTitle().toString());

    m_manager = ProfileManager.getInstance(this);

    //        mPager = (ViewPager) findViewById(R.id.pager);

    // new the handler here, so it will not leak.
    if (m_handler == null)
        m_handler = new ExtendHandler(this);
    else
        m_handler.setContext(this);
    m_remote = new RemoteAPI(this, m_handler);
    m_timer = new Timer();

    setStatus(Status.Disconnected);

    // get data from intent.
    final Intent intent = getIntent();
    m_username = intent.getStringExtra("username");
    m_password = intent.getStringExtra("password");
    m_userid = intent.getStringExtra("userid");

    // delete the vpn log.
    File file = new File(getCacheDir(), "vpnlog.txt");
    if (file.exists())
        file.delete();
    //TODO fix On Register
    // get package and server name.
    Log.d("m_password", m_password);
    m_remote.getUserService(m_userid, m_password);
    m_waitdlg = ProgressDialog.show(this, "Loading Servers", "Waiting for server reply...", true, false);

    TextView view2 = (TextView) findViewById(R.id.textview_serverlist);
    VpnStatus.addStateListener(this);

    // start internet checker timer, will not stop this.

    view2.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent i = new Intent(ActivityDashboard.this, ActivityServerList.class);
            intent.putExtra("userid", m_userid);
            intent.putExtra("username", m_userid);
            intent.putExtra("password", m_password);

            startActivity(i);

        }
    });
    m_timer.schedule(new NetStateCheckTask(this), 3000, 3000);
    try {
        FileInputStream fi = new FileInputStream(getFilesDir() + "/setting.xml");
        Log.d("d", "get files directory : " + getFilesDir().toString());

        Properties xml = new Properties();
        xml.loadFromXML(fi);
        String first_login = xml.getProperty("FIRST_LOGIN");
        if (first_login == null) {
            xml.setProperty("FIRST_LOGIN", String.valueOf(new Date().getTime()));
            FileOutputStream fo = new FileOutputStream(getFilesDir() + "/setting.xml");
            xml.storeToXML(fo, null);
        }
    } catch (Exception e) {
        System.out.println(e);
    }
}

From source file:com.cssweb.android.base.QuoteGridActivity.java

private void AddViewItem(String paramString, int paramInt1, LinearLayout paramLinearLayout, int paramInt2,
        int paramInt3, int paramInt4, boolean paramBoolean) {
    TextView localTextView = new TextView(this);
    float f = this.mFontSize;

    localTextView.setTextSize(f);/*from  ww w.jav  a 2 s . c o m*/
    //??4?
    if (paramInt2 == paramInt4 && paramInt3 == 0 && nameOrcode) {

        if (this.mPaint.measureText(paramString) > textWeight)
            localTextView.setTextSize(13);
    }

    if (n2 == paramInt2) {
        String str = (n1 == 0) ? paramString + low : (n1 == 1) ? paramString + top : paramString;
        localTextView.setText(str);
    } else {
        localTextView.setText(paramString);
    }
    localTextView.setGravity(Gravity.LEFT | Gravity.CENTER_VERTICAL);
    localTextView.setFocusable(paramBoolean);
    localTextView.setOnClickListener(mClickListener);
    localTextView.setOnLongClickListener(mLongClickListener);
    localTextView.setOnTouchListener(this); //touch
    localTextView.setTag(paramInt2);
    localTextView.setEnabled(paramBoolean);
    localTextView.setSingleLine(false);
    if (paramInt4 == 0 && paramInt3 >= 0) {//
        localTextView.setGravity(Gravity.CENTER);
        int i1 = this.residTitleCol;
        int i8 = 0;
        localTextView.setTextColor(paramInt1);
        if (paramInt3 == 0) {
            localDrawable = getResources().getDrawable(i1);
            i8 = localDrawable.getIntrinsicWidth();
        } else if (paramInt3 == 100) {
            localDrawable = getResources().getDrawable(this.residTitleScrollCol[2]);
            i8 = localDrawable.getIntrinsicWidth();
        } else if (paramInt3 == 13) {
            localDrawable = getResources().getDrawable(this.residTitleScrollCol[0]);
            i8 = localDrawable.getIntrinsicWidth();
            i8 += 20;
        } else if (paramInt3 == 8) {
            localDrawable = getResources().getDrawable(this.residTitleScrollCol[0]);
            i8 = localDrawable.getIntrinsicWidth();
            i8 += 10;
        } else if (paramInt3 % 2 == 0) {
            localDrawable = getResources().getDrawable(this.residTitleScrollCol[1]);
            i8 = localDrawable.getIntrinsicWidth();
        } else {
            localDrawable = getResources().getDrawable(this.residTitleScrollCol[0]);
            i8 = localDrawable.getIntrinsicWidth();
        }
        localTextView.setBackgroundDrawable(localDrawable);
        int i6 = localDrawable.getIntrinsicHeight();
        localTextView.setHeight(i6 + CssSystem.getTableTitleHeight(this));
        //int i9 = (int) Math.max(i8, mPaint.measureText(paramString));
        localTextView.setWidth(i8);
        paramLinearLayout.addView(localTextView);
        return;
    }
    if (paramInt4 != 0 && paramInt3 >= 0) {
        int i8 = 0;
        localTextView.setTextColor(paramInt1);
        if (paramInt3 == 0) {
            localDrawable = getResources().getDrawable(this.residCol);
            i8 = localDrawable.getIntrinsicWidth();
        } else if (paramInt3 == 100) {
            localDrawable = getResources().getDrawable(this.residScrollCol[2]);
            localTextView.setGravity(Gravity.RIGHT | Gravity.CENTER_VERTICAL);
            i8 = localDrawable.getIntrinsicWidth();
        } else if (paramInt3 == 13) {
            localDrawable = getResources().getDrawable(this.residScrollCol[0]);
            localTextView.setGravity(Gravity.RIGHT | Gravity.CENTER_VERTICAL);
            i8 = localDrawable.getIntrinsicWidth();
            i8 += 20;
            //localTextView.setWidth(i8+20);
        } else if (paramInt3 == 8) {
            localDrawable = getResources().getDrawable(this.residScrollCol[0]);
            localTextView.setGravity(Gravity.RIGHT | Gravity.CENTER_VERTICAL);
            i8 = localDrawable.getIntrinsicWidth();
            i8 += 10;
            //localTextView.setWidth(i8+20);
        } else if (paramInt3 % 2 == 0) {
            localDrawable = getResources().getDrawable(this.residScrollCol[1]);
            localTextView.setGravity(Gravity.RIGHT | Gravity.CENTER_VERTICAL);
            i8 = localDrawable.getIntrinsicWidth();
        } else {
            localDrawable = getResources().getDrawable(this.residScrollCol[0]);
            localTextView.setGravity(Gravity.RIGHT | Gravity.CENTER_VERTICAL);
            i8 = localDrawable.getIntrinsicWidth();
        }
        localTextView.setBackgroundDrawable(localDrawable);
        int i6 = localDrawable.getIntrinsicHeight();
        localTextView.setHeight(i6 + rowHeight);
        //int i9 = (int) Math.max(i8, mPaint.measureText(paramString));
        localTextView.setWidth(i8);
        paramLinearLayout.addView(localTextView);
        return;
    }
    //      if ((paramInt3 == j) && (paramInt4 == l)) {
    //         int i13 = this.residTitleScrollCol[l];
    //         localDrawable = localResources.getDrawable(i13);
    //         localTextView.setTextColor(paramInt1);
    //         localTextView.setBackgroundDrawable(localDrawable);
    //         paramLinearLayout.addView(localTextView);
    //         return;
    //      }
}

From source file:com.garlicg.screenrecord4cm.SettingsActivity.java

/**
 * Create auto stop setting view//from w w w .j  a v  a  2 s  .  co m
 */
private void createAutoStop(Bundle savedInstanceState) {

    // init value setup
    final TextView valueView = ViewFinder.byId(this, R.id.autoStopValue);
    int value = mPrefs.getAutoStopMilliSec();
    valueView.setText(value == 0 ? getString(R.string.no_seconds_only_manual_stop)
            : getString(R.string.plus_x_ms_later, value));

    // handle value from dialog callback
    final InputSecondDialogBuilder.Callback callback = new InputSecondDialogBuilder.Callback() {
        @Override
        public boolean onValidate(int value) {
            int msec = value * 100;
            //noinspection PointlessArithmeticExpression
            return msec >= 0 && msec <= 1 * 1000 * 1000 - 1; // 999
        }

        @Override
        public void onOk(int value) {
            int msec = value * 100;
            valueView.setText(msec == 0 ? getString(R.string.no_seconds_only_manual_stop)
                    : getString(R.string.plus_x_ms_later, msec));

            mPrefs.saveAutoStopMilliSec(msec);
        }
    };

    // show dialog on click
    valueView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            int value = mPrefs.getAutoStopMilliSec() / 100;
            AlertDialog ad = InputSecondDialogBuilder.build(v.getContext(), value,
                    getString(R.string.unit_00ms_later), callback);
            ad.show();
        }
    });
}

From source file:com.todoroo.astrid.activity.TaskEditFragment.java

private void setupWaitingOnMe() {
    if (!isNewTask) {
        WaitingOnMe wom = waitingOnMeDao.findByTask(model.getUuid());
        if (wom != null) {
            final View waitingOnMe = getView().findViewById(R.id.waiting_on_me);
            waitingOnMe.setVisibility(View.VISIBLE);

            int themeColor = getResources().getColor(ThemeService.getTaskEditThemeColor());

            TextView dismiss = (TextView) waitingOnMe.findViewById(R.id.wom_dismiss);
            dismiss.setOnClickListener(new OnClickListener() {
                @Override/*from www .  j av  a  2s  .c  om*/
                public void onClick(View v) {
                    WaitingOnMe template = new WaitingOnMe();
                    template.setValue(WaitingOnMe.DELETED_AT, DateUtilities.now());
                    waitingOnMeDao.update(WaitingOnMe.TASK_UUID.eq(model.getUuid()), template);
                    waitingOnMe.setVisibility(View.GONE);
                }
            });
            dismiss.setTextColor(getResources().getColor(R.color.task_edit_deadline_gray));
            GradientDrawable gd = new GradientDrawable();
            gd.setColor(ThemeService.getDarkVsLight(Color.rgb(0xee, 0xee, 0xee), Color.rgb(0x22, 0x22, 0x22),
                    false));
            gd.setCornerRadius(4.0f);
            dismiss.setBackgroundDrawable(gd);

            TextView ack = (TextView) waitingOnMe.findViewById(R.id.wom_acknowledge);
            ack.setOnClickListener(new OnClickListener() {
                @Override
                public void onClick(View v) {
                    WaitingOnMe template = new WaitingOnMe();
                    template.setValue(WaitingOnMe.ACKNOWLEDGED, 1);
                    waitingOnMeDao.update(WaitingOnMe.TASK_UUID.eq(model.getUuid()), template);
                    waitingOnMe.setVisibility(View.GONE);
                }
            });
            ack.setTextColor(themeColor);
            gd = new GradientDrawable();
            gd.setColor(ThemeService.getDarkVsLight(Color.WHITE, Color.rgb(0x22, 0x22, 0x22), false));
            gd.setCornerRadius(4.0f);
            ack.setBackgroundDrawable(gd);

            TextView womText = (TextView) waitingOnMe.findViewById(R.id.wom_message);
            womText.setText(getWomText(wom));
            womText.setTextColor(themeColor);

            ImageView womIcon = (ImageView) waitingOnMe.findViewById(R.id.wom_icon);
            womIcon.setImageResource(ThemeService.getTaskEditDrawable(R.drawable.tea_icn_waiting,
                    R.drawable.tea_icn_waiting_lightblue));
        }
    }
}

From source file:com.tsp.clipsy.audio.RingdroidEditActivity.java

/**
 * Called from both onCreate and onConfigurationChanged
 * (if the user switched layouts)/*from w  ww . j  av  a2s  .com*/
 */
private void loadGui() {
    // Inflate our UI from its XML layout description.
    setContentView(R.layout.editor);

    DisplayMetrics metrics = new DisplayMetrics();
    getWindowManager().getDefaultDisplay().getMetrics(metrics);
    mDensity = metrics.density;

    mMarkerLeftInset = (int) (46 * mDensity);
    mMarkerRightInset = (int) (48 * mDensity);
    mMarkerTopOffset = (int) (10 * mDensity);
    mMarkerBottomOffset = (int) (10 * mDensity);

    mStartText = (TextView) findViewById(R.id.starttext);
    mStartText.addTextChangedListener(mTextWatcher);
    mEndText = (TextView) findViewById(R.id.endtext);
    mEndText.addTextChangedListener(mTextWatcher);

    mPlayButton = (ImageButton) findViewById(R.id.play);
    mPlayButton.setOnClickListener(mPlayListener);
    //mRewindButton = (ImageButton)findViewById(R.id.rew);
    //mRewindButton.setOnClickListener(mRewindListener);
    //mFfwdButton = (ImageButton)findViewById(R.id.ffwd);
    //mFfwdButton.setOnClickListener(mFfwdListener);

    TextView markStartButton = (TextView) findViewById(R.id.mark_start);
    markStartButton.setOnClickListener(mMarkStartListener);
    TextView markEndButton = (TextView) findViewById(R.id.mark_end);
    markEndButton.setOnClickListener(mMarkStartListener);

    enableDisableButtons();

    mWaveformView = (WaveformView) findViewById(R.id.waveform);
    mWaveformView.setListener(this);

    mInfo = (TextView) findViewById(R.id.info);
    mInfo.setText(mCaption);

    mMaxPos = 0;
    mLastDisplayedStartPos = -1;
    mLastDisplayedEndPos = -1;

    if (mSoundFile != null && !mWaveformView.hasSoundFile()) {
        mWaveformView.setSoundFile(mSoundFile);
        mWaveformView.recomputeHeights(mDensity);
        mMaxPos = mWaveformView.maxPos();
    }

    mStartMarker = (MarkerView) findViewById(R.id.startmarker);
    mStartMarker.setListener(this);
    mStartMarker.setAlpha(255);
    mStartMarker.setFocusable(true);
    mStartMarker.setFocusableInTouchMode(true);
    mStartVisible = true;

    mEndMarker = (MarkerView) findViewById(R.id.endmarker);
    mEndMarker.setListener(this);
    mEndMarker.setAlpha(255);
    mEndMarker.setFocusable(true);
    mEndMarker.setFocusableInTouchMode(true);
    mEndVisible = true;

    updateDisplay();
}

From source file:com.nttec.everychan.ui.gallery.GalleryActivity.java

private void setOnClickView(GalleryItemViewTag tag, String message, View.OnClickListener handler) {
    tag.thumbnailView.setVisibility(View.VISIBLE);
    tag.loadingView.setVisibility(View.GONE);
    TextView v = new TextView(GalleryActivity.this);
    v.setGravity(Gravity.CENTER);//from  www . ja  v a2 s.co m
    v.setText(getSpannedText(message));
    tag.layout.setVisibility(View.VISIBLE);
    tag.layout.addView(v);
    v.setOnClickListener(handler);
}

From source file:com.example.zf_android.trade.ApplyDetailActivity.java

private void setupItem(LinearLayout item, int itemType, final String key, final String value) {
    switch (itemType) {
    case ITEM_EDIT: {
        TextView tvKey = (TextView) item.findViewById(R.id.apply_detail_key);
        EditText etValue = (EditText) item.findViewById(R.id.apply_detail_value);

        if (!TextUtils.isEmpty(key))
            tvKey.setText(key);//from w  w w  .  j av  a2 s .  c  o m
        if (!TextUtils.isEmpty(value))
            etValue.setText(value);
        break;
    }
    case ITEM_CHOOSE: {
        TextView tvKey = (TextView) item.findViewById(R.id.apply_detail_key);
        TextView tvValue = (TextView) item.findViewById(R.id.apply_detail_value);

        if (!TextUtils.isEmpty(key))
            tvKey.setText(key);
        if (!TextUtils.isEmpty(value))
            tvValue.setText(value);
        break;
    }
    case ITEM_UPLOAD: {
        TextView tvKey = (TextView) item.findViewById(R.id.apply_detail_key);
        final TextView tvValue = (TextView) item.findViewById(R.id.apply_detail_value);

        if (!TextUtils.isEmpty(key))
            tvKey.setText(key);
        tvValue.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                uploadingTextView = tvValue;
                AlertDialog.Builder builder = new AlertDialog.Builder(ApplyDetailActivity.this);
                final String[] items = getResources().getStringArray(R.array.apply_detail_upload);
                builder.setItems(items, new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        switch (which) {
                        case 0: {
                            Intent intent = new Intent();
                            intent.setType("image/*");
                            intent.setAction(Intent.ACTION_GET_CONTENT);
                            startActivityForResult(intent, REQUEST_UPLOAD_IMAGE);
                            break;
                        }
                        case 1: {
                            String state = Environment.getExternalStorageState();
                            if (state.equals(Environment.MEDIA_MOUNTED)) {
                                Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
                                File outDir = Environment
                                        .getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);
                                if (!outDir.exists()) {
                                    outDir.mkdirs();
                                }
                                File outFile = new File(outDir, System.currentTimeMillis() + ".jpg");
                                photoPath = outFile.getAbsolutePath();
                                intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(outFile));
                                intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 1);
                                startActivityForResult(intent, REQUEST_TAKE_PHOTO);
                            } else {
                                CommonUtil.toastShort(ApplyDetailActivity.this,
                                        getString(R.string.toast_no_sdcard));
                            }
                            break;
                        }
                        }
                    }
                });
                builder.show();

            }
        });
        break;
    }
    case ITEM_VIEW: {
        TextView tvKey = (TextView) item.findViewById(R.id.apply_detail_key);
        ImageButton ibView = (ImageButton) item.findViewById(R.id.apply_detail_view);

        if (!TextUtils.isEmpty(key))
            tvKey.setText(key);
        ibView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent i = new Intent(ApplyDetailActivity.this, ImageViewer.class);
                i.putExtra("url", value);
                i.putExtra("justviewer", true);
                startActivity(i);
            }
        });
    }
    }
}