Example usage for android.view View getId

List of usage examples for android.view View getId

Introduction

In this page you can find the example usage for android.view View getId.

Prototype

@IdRes
@ViewDebug.CapturedViewProperty
public int getId() 

Source Link

Document

Returns this view's identifier.

Usage

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

private void recycleTag(GalleryItemViewTag tag, boolean cancelTask) {
    if (tag.layout != null) {
        for (int i = 0; i < tag.layout.getChildCount(); ++i) {
            View v = tag.layout.getChildAt(i);
            if (v instanceof FixedSubsamplingScaleImageView) {
                ((FixedSubsamplingScaleImageView) v).recycle();
            } else if (v != null && v.getId() == R.id.gallery_video_container) {
                try {
                    ((VideoView) v.findViewById(R.id.gallery_video_view)).stopPlayback();
                } catch (Exception e) {
                    Logger.e(TAG, "cannot release videoview", e);
                }/* w w w .  jav a  2 s  .c o  m*/
            } else if (v != null) {
                Object gifTag = v.getTag();
                if (gifTag != null && gifTag instanceof GifDrawable) {
                    ((GifDrawable) gifTag).recycle();
                }
            }
        }
        tag.layout.removeAllViews();
    }

    if (cancelTask && tag.downloadingTask != null)
        tag.downloadingTask.cancel();
    if (tag.timer != null)
        tag.timer.cancel();
    if (tag.audioPlayer != null) {
        try {
            tag.audioPlayer.release();
        } catch (Exception e) {
            Logger.e(TAG, "cannot release audio mediaplayer", e);
        } finally {
            tag.audioPlayer = null;
        }
    }

    System.gc();
}

From source file:com.hackensack.umc.activity.RegistrationDetailsActivity.java

@Override
public void onClick(View v) {
    switch (v.getId()) {
    case R.id.date_ll:
        showDatePickerDialog(RegistrationDetailsActivity.this, ((TextView) findViewById(R.id.date_tv)));
        break;//from w w  w.jav  a2  s  . c om
    case R.id.addr_rl:
        Intent intent = new Intent(RegistrationDetailsActivity.this, AddressActivity.class);
        if (mAddress != null) {
            intent.putExtra(AddressActivity.ADRESS_STR, mAddress);
        }
        startActivityForResult(intent, addressCode);
        break;
    case R.id.insurance_rl:
        Intent intent1 = new Intent(RegistrationDetailsActivity.this, InsuranceInfoActivity.class);
        if (mInsuranceInfo == null) {
            mInsuranceInfo = new InsuranceInfo();
        }
        mInsuranceInfo.setSubscriberName(mFname.getText().toString() + " " + mLname.getText().toString());
        mInsuranceInfo.setSubscriberDateOfBirth(birthDate);
        intent1.putExtra(InsuranceInfoActivity.INSURANCE_STR, mInsuranceInfo);

        startActivityForResult(intent1, insuranceCode);
        break;
    case R.id.add_phone:
        Log.v(TAG, "numberOfCellPhonell::" + String.valueOf(numberOfCellPhonell));

        if (numberOfCellPhonell == 1) {
            layoutWorkNumber.setVisibility(View.VISIBLE);
            numberOfCellPhonell++;

            Log.v(TAG, "numberOfCellPhonell::" + String.valueOf(numberOfCellPhonell));
            if (numberOfCellPhonell == 3) {
                btnAddPhone.setVisibility(View.GONE);
            }
        } else if (numberOfCellPhonell == 2) {
            layoutWorkNumber.setVisibility(View.VISIBLE);
            layoutHomeNumber.setVisibility(View.VISIBLE);
            numberOfCellPhonell++;
            Log.v(TAG, "numberOfCellPhonell::" + String.valueOf(numberOfCellPhonell));
            if (numberOfCellPhonell == 3) {
                btnAddPhone.setVisibility(View.GONE);
            }

        }

        break;
    /* case R.id.btnRemoveField:
        if (numberOfCellPhonell > 2) {
           *//* TableLayout linearRow = (TableLayout) v*//**//*.getParent()*//**//*.getParent().getParent().getParent();
                                                                                  if (((TableRow) v*//**//*.getParent()*//**//*.getParent().getParent()).getTag() != null) {
                                                                                                                              linearRow.removeView(linearRow.getChildAt(Integer.parseInt(((TableRow) v*//**//*.getParent()*//**//*.getParent().getParent()).getTag().toString())));
                                                                                                                                                                                                                                 }
                                                                                                                                                                                                                                 for (int i = Integer.parseInt(((TableRow) v*//**//*.getParent()*//**//*.getParent().getParent()).getTag().toString()); i != linearRow.getChildCount(); i++) {
                                                                                                                                                                                                                                                                                                       final View viewRow = linearRow.getChildAt(i);
                                                                                                                                                                                                                                                                                                       viewRow.setTag(i);
                                                                                                                                                                                                                                                                                                               
                                                                                                                                                                                                                                                                                                       }*//*
                                                                                                                                                                                                                                                                                                           numberOfCellPhonell--;
                                                                                                                                                                                                                                                                                                           findViewById(R.id.add_phone).setVisibility(View.VISIBLE);
                                                                                                                                                                                                                                                                                                           } else if (numberOfCellPhonell == 1) {
                                                                                                                                                                                                                                                                                                           //show error Dialog
                                                                                                                                                                                                                                                                                                           showErrorAlertDialog("Phone field is mandatory");
                                                                                                                                                                                                                                                                                                           }*/
    // break;

    }
}

From source file:com.appolis.putaway.AcPutAwayDetails.java

/**
 * Process event for views/*from  ww w  . j  a  v  a2s . c  om*/
 */
@Override
public void onClick(View v) {
    Intent intent;
    switch (v.getId()) {
    case R.id.imgHome:
        Utilities.hideKeyboard(this);
        intent = new Intent(AcPutAwayDetails.this, MainActivity.class);
        intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
        startActivityForResult(intent, GlobalParams.LOGINSCREEN_TO_MAINSCREEN);
        break;

    case R.id.img_main_menu_scan_barcode:
        intent = new Intent(this, CaptureBarcodeCamera.class);
        startActivityForResult(intent, GlobalParams.AC_PUT_AWAY_LEVEL_TWO);
        break;

    case R.id.btnCancel:
        Utilities.hideKeyboard(this);
        finish();
        break;

    case R.id.btnOK:
        try {
            prepareJsonForm();
            PostItemAsyncTask postItemAsyncTask = new PostItemAsyncTask();
            postItemAsyncTask.execute();
        } catch (JSONException e) {

        } catch (Exception e) {

        }

        break;

    default:
        break;
    }
}

From source file:com.easemob.chatuidemo.adapter.MessageAdapter.java

@Override
public void onClick(View v) {
    switch (v.getId()) {
    case R.id.iv_avatar:
        Toast.makeText(context, "chuxianle", 0).show();
        Log.i("MessageAdaper", "?");
        context.startActivity(new Intent(context, Activity_boshu_FriMsg.class));
        break;/* w ww.j a v a2 s.c om*/
    }

}

From source file:com.towson.wavyleaf.Sighting.java

public void onToggle(View view) {

    //loop through all children in radiogroup.  In this case, two lin layouts
    for (int i = 0; i < rg.getChildCount(); i++) {
        View child = rg.getChildAt(i);

        //if child is lin layout (we already know all children are lin layouts)
        if (child instanceof LinearLayout) {

            //then loop through three toggles
            for (int j = 0; j < ((ViewGroup) child).getChildCount(); j++) {
                final ToggleButton tog = (ToggleButton) ((ViewGroup) child).getChildAt(j);

                //have only one togglebutton selected at one time
                if (tog != view)
                    tog.setChecked(false);
            }//from   w  w  w  .j  a v  a  2 s.  c  o m
        }
    }

    // Determine text to set to textview
    switch (view.getId()) {
    case R.id.bu_1:
        tvper_summary.setText("0%");
        etarea.setText("0");
        break;
    case R.id.bu_2:
        tvper_summary.setText("1-10%");
        etarea.setText("");
        break;
    case R.id.bu_3:
        tvper_summary.setText("10-25%");
        etarea.setText("");
        break;
    case R.id.bu_4:
        tvper_summary.setText("25-50%");
        etarea.setText("");
        break;
    case R.id.bu_5:
        tvper_summary.setText("50-75%");
        etarea.setText("");
        break;
    case R.id.bu_6:
        tvper_summary.setText("75-100%");
        etarea.setText("");
        break;
    default:
        tvper_summary.setText("");
    }
}

From source file:com.ieeton.user.activity.ChatActivity.java

/**
 * ?//  w  w  w . ja v a 2 s  .com
 * 
 * @param view
 */
@Override
public void onClick(View view) {

    int id = view.getId();
    if (id == R.id.btn_send) {// ??(?)
        String s = mEditTextContent.getText().toString();
        sendText(s);
    } else if (id == R.id.btn_take_picture) {
        selectPicFromCamera();// 
    } else if (id == R.id.btn_picture) {
        selectPicFromLocal(); // 
    } else if (id == R.id.btn_location) { // ?
        startActivityForResult(new Intent(this, BaiduMapActivity.class), REQUEST_CODE_MAP);
    } else if (id == R.id.iv_emoticons_normal) { // 
        more.setVisibility(View.VISIBLE);
        iv_emoticons_normal.setVisibility(View.INVISIBLE);
        iv_emoticons_checked.setVisibility(View.VISIBLE);
        btnContainer.setVisibility(View.GONE);
        emojiIconContainer.setVisibility(View.VISIBLE);
        hideKeyboard();
    } else if (id == R.id.iv_emoticons_checked) { // ??
        iv_emoticons_normal.setVisibility(View.VISIBLE);
        iv_emoticons_checked.setVisibility(View.INVISIBLE);
        btnContainer.setVisibility(View.VISIBLE);
        emojiIconContainer.setVisibility(View.GONE);
        more.setVisibility(View.GONE);

    } else if (id == R.id.btn_video) {
        // ?
        Intent intent = new Intent(ChatActivity.this, ImageGridActivity.class);
        startActivityForResult(intent, REQUEST_CODE_SELECT_VIDEO);
    } else if (id == R.id.btn_file) { // 
        selectFileFromLocal();
    } else if (id == R.id.btn_voice_call) { // ?
        if (!EMChatManager.getInstance().isConnected())
            Toast.makeText(this, "????", 0).show();
        else
            startActivity(new Intent(ChatActivity.this, VoiceCallActivity.class)
                    .putExtra("username", toChatUsername).putExtra("isComingCall", false));
    } else if (id == R.id.iv_call) {
        if (toChatUsername.equals(NetEngine.getSecretaryID())) {
            //??400???
            String number = NetEngine.getIvrNumber();
            if (number != null && !"".equals(number)) {
                Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + number));
                startActivity(intent);
            }
            return;
        }
        if (mUser == null) {
            return;
        }
        if (mUser.getSwitchMobile() == 0
                || TextUtils.isEmpty(mUser.getIvrMobile()) && TextUtils.isEmpty(mUser.getMobile())) {
            Utils.showToast(this, R.string.call_service_is_unavlable, Toast.LENGTH_SHORT);
            return;
        }
        String mobile = TextUtils.isEmpty(mUser.getIvrMobile()) ? mUser.getMobile() : mUser.getIvrMobile();
        mCallDialog = Utils.showCallDialog(this, mobile);

        //         String mobile = "";
        //         if (!TextUtils.isEmpty(mUser.getIvrMobile())){
        //            mobile = mUser.getIvrMobile();
        //         }else if (!TextUtils.isEmpty(mUser.getMobile())){
        //            mobile = mUser.getMobile();
        //         }
        //         if (!TextUtils.isEmpty(mobile)){
        //            Intent intent=new Intent(Intent.ACTION_CALL, Uri.parse("tel:"+mobile));
        //            startActivity(intent);
        //         }else{
        //            Utils.showToast(this, R.string.call_service_is_unavlable, Toast.LENGTH_SHORT);
        //         }

    } else if (view == mBackBtn) {
        finish();
    }
}

From source file:com.fvd.nimbus.BrowseActivity.java

public void onButtonClick(View v) {
    drawer.closeDrawer(GravityCompat.START);
    Intent ip = new Intent();
    switch (v.getId()) {
    case R.id.lbTakePhoto:
        ip.putExtra("act", "photo");
        ip.setClassName("com.fvd.nimbus", "com.fvd.nimbus.PaintActivity");
        startActivity(ip);/*w  ww  .ja v  a2s .  c  o  m*/
        break;
    case R.id.lbFromGallery:
        ip.putExtra("act", "picture");
        ip.setClassName("com.fvd.nimbus", "com.fvd.nimbus.PaintActivity");
        startActivity(ip);
        break;
    case R.id.lbPdfAnnotate:
        ip.setClassName("com.fvd.nimbus", "com.fvd.nimbus.ChoosePDFActivity");
        startActivity(ip);
        break;
    case R.id.libSettings:
        Intent inten = new Intent(getApplicationContext(), SettingsActivity.class);
        startActivityForResult(inten, SHOW_SETTINGS);
        overridePendingTransition(R.anim.carbon_slide_in, R.anim.carbon_slide_out);
        return;
    default:
        break;
    }
    overridePendingTransition(R.anim.carbon_slide_in, R.anim.carbon_slide_out);
    finish();
}

From source file:net.phase.wallet.Currency.java

@Override
public void onClick(View v) {
    int i = (Integer) v.getTag();

    if (v.getId() == R.id.updateButton) {
        updateWalletBalance(wallets[i], true, maxlength);
    } else {/*from   w  w w.ja  v a  2 s .  c  om*/
        if (wallets[i].transactions == null) {
            toastMessage("Please update wallet");
        } else {
            showTransactions(wallets[i]);
        }
    }
}