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.arantius.tivocommander.Explore.java

public void doDelete(View v) {
    // FIXME: Fails when deleting the currently-playing show.
    getParent().setProgressBarIndeterminateVisibility(true);
    String newState = "deleted";
    if (v.getId() == R.id.explore_btn_undelete) {
        newState = "complete";
    }//w  w w.j a v a  2  s .co  m
    // (Un-)Delete the recording ...
    final RecordingUpdate req = new RecordingUpdate(mRecordingId, newState);
    MindRpc.addRequest(req, mDeleteListener);
}

From source file:com.nextgis.woody.activity.MainActivity.java

@Override
public void onClick(View v) {
    switch (v.getId()) {
    case R.id.add_tree:
        editTree(NOT_FOUND);//from  w  w  w  .  j a  va 2s  .  c o  m
        break;
    case R.id.permissioons:
        checkPermissions();
        break;
    }
}

From source file:com.foundstone.certinstaller.CertInstallerActivity.java

public void onClick(View v) {
    switch (v.getId()) {
    case R.id.test_cert_chain_button:
        testCertChain(getURL(), getIP(), getPort());
        break;/*from  w  w w .  j a v a  2  s. c o m*/
    case R.id.install_ca_button:
        installCACert(getURL(), getIP(), getPort());
        break;
    case R.id.install_site_cert_button:
        installSiteCert(getURL(), getIP(), getPort());
        break;
    default:
        break;
    }
}

From source file:com.kaichaohulian.baocms.activity.BusinessApplyThressActivity.java

@Override
public void onClick(View v) {
    switch (v.getId()) {
    case R.id.apply_img_license:
        indexType = 0;//  w w w .j  a  v  a  2 s  .c om
        photo();
        break;
    case R.id.apply_img_logo:
        indexType = 1;
        photo();
        break;
    case R.id.apply_img_corperate_image:
        indexType = 2;
        photo();
        break;
    case R.id.btn_next:
        InServer();
        break;
    }
}

From source file:com.eeshana.icstories.activities.UploadVideoActivity.java

@SuppressLint("NewApi")
@Override//from w ww  . j  a  v a2  s  .  co m
public void onClick(View v) {
    if (v.getId() == uploadButton.getId()) {
        if (connectionDetector.isConnectedToInternet()) {
            title = titleEditText.getText().toString();
            description = descriptionEditText.getText().toString();
            flag = isAssignment;
            my_location = locationEditText.getText().toString();
            if (title.equalsIgnoreCase("") || description.equalsIgnoreCase("")) {
                showCustomToast.showToast(UploadVideoActivity.this, "Title and Description both are required");
            } else {

                Log.e("location2", my_location);

                //new UplodTask(getApplicationContext()).execute();
                if (title.length() <= 30 && title.length() >= 4 && description.length() >= 4
                        && description.length() <= 150 && my_location.length() <= 30) {//&& my_location.matches(pattern) && title.matches(pattern) && description.matches(pattern)){
                    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
                        new UplodTask(getApplicationContext())
                                .executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
                    } else {
                        new UplodTask(getApplicationContext()).execute();
                    }

                } else {
                    //                  if(!title.matches(pattern)){
                    //                     titleEditText.setError("Title contains one or more invalid characters. Please check.");
                    //                  }
                    //                  if(!description.matches(pattern)){
                    //                     descriptionEditText.setError("Description contains one or more invalid characters. Please check");
                    //                  }
                    //                  if(!my_location.matches(pattern)){
                    //                     locationEditText.setError("Location contains one or more invalid characters. Please check");
                    //                  }
                    if (title.length() < 4) {
                        titleEditText.setError("Title must be min 4 characters.");
                    }
                    if (description.length() < 4) {
                        descriptionEditText.setError("Description must be min 4 characters.");
                    }
                    if (title.length() > 30) {
                        titleEditText.setError("Title must be max 30 characters.");
                    }
                    if (description.length() > 150) {
                        descriptionEditText.setError("Description must be max 150 characters.");
                    }
                    if (my_location.length() > 30) {
                        descriptionEditText.setError("Location must be max 30 characters.");
                    }
                }
            }
        } else {
            showCustomToast.showToast(UploadVideoActivity.this, "Please check your internet connection.");
        }
    } else if (v.getId() == isAssignmentButton.getId()) {
        if (isAssignment.equalsIgnoreCase("NO")) {
            isAssignment = "YES";
            isAssignmentButton.setText("YES");
        } else {
            isAssignment = "NO";
            isAssignmentButton.setText("NO");
        }
    } else if (v.getId() == wallRelativeLayout.getId()) {
        Intent i = new Intent(UploadVideoActivity.this, WallActivity.class);
        i.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
        startActivity(i);
        finish();
    } else if (v.getId() == settingsRelativeLayout.getId()) {
        Intent i = new Intent(UploadVideoActivity.this, SettingsActivity.class);
        i.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
        startActivity(i);
        finish();
    } else if (v.getId() == okButton.getId()) {
        //go to settings page to enable GPS
        Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
        startActivityForResult(intent, REQUEST_CODE);
        locationDialog.dismiss();
    } else if (v.getId() == cancelButton.getId()) {
        locationDialog.dismiss();
    }

}

From source file:com.app.jdy.activity.GoldActivity.java

@Override
public void onClick(View v) {
    switch (v.getId()) {
    case R.id.line_expeAnnuRevnue:
        resetOrder((LinearLayout) v);//from www . j ava  2 s  . c o m
        productList.clear();
        pageNumber = 1;
        notice_tip = "";
        new QueryProductListTask().execute();
        break;
    case R.id.line_minSubsAmount:
        resetOrder((LinearLayout) v);
        productList.clear();
        pageNumber = 1;
        notice_tip = "";
        new QueryProductListTask().execute();
        break;
    case R.id.line_period:
        resetOrder((LinearLayout) v);
        productList.clear();
        pageNumber = 1;
        notice_tip = "";
        new QueryProductListTask().execute();
        break;
    case R.id.right_img:
        if (flag == 0) {
            ((MainActivity) getParent()).showMenu();
            ((MainActivity) getParent()).editTextSelectAll();
        } else if (flag == 1) {
            menu.toggle(true);
        }
        break;
    case R.id.back_img:
        if (flag == 0) {
            title_tv.setText("");
            back_img.setVisibility(View.INVISIBLE);
            productList.clear();
            search_ProdType = null;
            search_keyWord = null;
            search_order = null;
            search_orderby = null;
            pageNumber = 1;
            new QueryProductListTask().execute();
        } else if (flag == 1) {
            if (search_ProdType != null) {
                title_tv.setText("?");
                productList.clear();
                search_ProdType = null;
                search_keyWord = null;
                search_order = null;
                search_orderby = null;
                pageNumber = 1;
                new QueryProductListTask().execute();
            } else {
                finish();
            }
        }
        break;
    default:
        break;
    }
}

From source file:org.yaoha.YaohaActivity.java

@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);
    menu.setHeaderTitle("Action");
    menu.add(0, v.getId(), 0, EDIT_FAV_STRING);
    menu.add(0, v.getId(), 0, EDIT_FAV_PIC);
    menu.add(0, v.getId(), 0, REMOVE_FAV);
}

From source file:auribises.com.visitorbook.Activites.VisitorEntryActivity.java

public void onclickhandler(View view) {
    if (view.getId() == R.id.buttonSubmit) {
        btnSubmit.setOnClickListener(this);

        visitorentry.setName(eTxtName.getText().toString().trim());
        visitorentry.setPhone(eTxtPhone.getText().toString().trim());
        visitorentry.setEmail(eTxtEmail.getText().toString().trim());
        visitorentry.setAddress(eTxtAddress.getText().toString().trim());
        visitorentry.setPurpose(eTxtPurpose.getText().toString().trim());
        visitorentry.setDate(eTxtDate.getText().toString().trim());
        visitorentry.setTime(eTxtTime.getText().toString().trim());
        visitorentry.setTeacher(eTxtTeacher.getText().toString().trim());
        visitorentry.setIDProofnumber(eTxtIDProofNumber.getText().toString().trim());
        visitorentry.setVehiclenumber(eTxtVehicleNumber.getText().toString().trim());

        //insertIntoDB();

        if (validateFields()) {
            if (isNetworkConected())
                insertIntoCloud();//from ww  w  .ja va 2s  .c o  m
        } else
            Toast.makeText(this, "Please connect to Internet", Toast.LENGTH_LONG).show();
    } else {
        Toast.makeText(this, "Please correct Input", Toast.LENGTH_LONG).show();
    }
}

From source file:net.idlesoft.android.apps.github.activities.Commit.java

protected void buildUi() {
    // Get the commit data for that commit ID so that we can get the
    // tree ID and filename.
    try {//from w w  w  .  j  a v  a 2s . c  om
        final ImageView authorImage = (ImageView) findViewById(R.id.commit_view_author_gravatar);
        final ImageView committerImage = (ImageView) findViewById(R.id.commit_view_committer_gravatar);

        // If the committer is the author then just show them as the
        // author, otherwise show
        // both people
        ((TextView) findViewById(R.id.commit_view_author_name)).setText(mAuthorName);
        if (mAuthorGravatar != null) {
            authorImage.setImageBitmap(mAuthorGravatar);
        } else {
            authorImage.setImageBitmap(Commit.loadGravatarByLoginName(Commit.this, mAuthor));
        }

        // Set the commit message
        ((TextView) findViewById(R.id.commit_view_message)).setText(mJson.getString("message"));

        final SimpleDateFormat dateFormat = new SimpleDateFormat(Hubroid.GITHUB_TIME_FORMAT);
        Date commit_time;
        Date current_time;
        String authorDate = "";

        try {
            commit_time = dateFormat.parse(mJson.getString("authored_date"));
            current_time = dateFormat.parse(dateFormat.format(new Date()));
            ((TextView) findViewById(R.id.commit_view_author_time))
                    .setText(Commit.getHumanDate(current_time, commit_time));

            commit_time = dateFormat.parse(mJson.getString("committed_date"));
            authorDate = Commit.getHumanDate(current_time, commit_time);

        } catch (final ParseException e) {
            e.printStackTrace();
        }

        if (!mAuthor.equals(mCommitter)) {
            // They are not the same person, make the author visible and
            // fill in the details
            ((LinearLayout) findViewById(R.id.commit_view_author_layout)).setVisibility(View.VISIBLE);
            ((TextView) findViewById(R.id.commit_view_committer_name)).setText(mCommitterName);
            ((TextView) findViewById(R.id.commit_view_committer_time)).setText(authorDate);
            if (mCommitterGravatar != null) {
                committerImage.setImageBitmap(mCommitterGravatar);
            } else {
                committerImage.setImageBitmap(Commit.loadGravatarByLoginName(Commit.this, mCommitter));
            }
        }

        final OnClickListener onGravatarClick = new OnClickListener() {
            public void onClick(final View v) {
                final Intent i = new Intent(Commit.this, Profile.class);
                if (v.getId() == authorImage.getId()) {
                    i.putExtra("username", mAuthor);
                } else if (v.getId() == committerImage.getId()) {
                    i.putExtra("username", mCommitter);
                } else {
                    return;
                }
                startActivity(i);
            }
        };

        if ((mAuthor != null) && !mAuthor.equals("")) {
            authorImage.setOnClickListener(onGravatarClick);
        }
        if ((mCommitter != null) && !mCommitter.equals("")) {
            committerImage.setOnClickListener(onGravatarClick);
        }

        int filesAdded, filesRemoved, filesChanged;

        try {
            filesAdded = mJson.getJSONArray("added").length();
        } catch (final JSONException e) {
            filesAdded = 0;
        }
        try {
            filesRemoved = mJson.getJSONArray("removed").length();
        } catch (final JSONException e) {
            filesRemoved = 0;
        }
        try {
            filesChanged = mJson.getJSONArray("modified").length();
        } catch (final JSONException e) {
            filesChanged = 0;
        }

        final Button filesAddedButton = (Button) findViewById(R.id.btn_commit_addedFiles);
        final Button filesRemovedButton = (Button) findViewById(R.id.btn_commit_removedFiles);
        final Button filesChangedButton = (Button) findViewById(R.id.btn_commit_changedFiles);

        Log.d("debug", filesAdded + " " + filesRemoved + " " + filesChanged);
        if (filesAdded > 0) {
            filesAddedButton.setText(filesAdded + " files added");
        } else {
            filesAddedButton.setVisibility(View.GONE);
        }
        if (filesRemoved > 0) {
            filesRemovedButton.setText(filesRemoved + " files removed");
        } else {
            filesRemovedButton.setVisibility(View.GONE);
        }
        if (filesChanged > 0) {
            filesChangedButton.setText(filesChanged + " files changed");
        } else {
            filesChangedButton.setVisibility(View.GONE);
        }

        filesAddedButton.setOnClickListener(new OnClickListener() {
            public void onClick(final View v) {
                final Intent i = new Intent(Commit.this, DiffFilesList.class);
                i.putExtra("type", "added");
                i.putExtra("json", mJson.toString());
                i.putExtra("repo_owner", mRepositoryOwner);
                i.putExtra("repo_name", mRepositoryName);
                startActivity(i);
            }
        });
        filesRemovedButton.setOnClickListener(new OnClickListener() {
            public void onClick(final View v) {
                final Intent i = new Intent(Commit.this, DiffFilesList.class);
                i.putExtra("type", "removed");
                i.putExtra("json", mJson.toString());
                i.putExtra("repo_owner", mRepositoryOwner);
                i.putExtra("repo_name", mRepositoryName);
                startActivity(i);
            }
        });
        filesChangedButton.setOnClickListener(new OnClickListener() {
            public void onClick(final View v) {
                final Intent i = new Intent(Commit.this, DiffFilesList.class);
                i.putExtra("type", "modified");
                i.putExtra("json", mJson.toString());
                i.putExtra("repo_owner", mRepositoryOwner);
                i.putExtra("repo_name", mRepositoryName);
                startActivity(i);
            }
        });
    } catch (final JSONException e) {
        e.printStackTrace();
    }
}

From source file:com.mobantica.DriverItRide.activities.ActivityLogin.java

@Override
public void onClick(View v) {
    switch (v.getId()) {

    case R.id.txt_login_forgot_password:
        AppUtils.getMobileImeiNo(ActivityLogin.this);
        AppUtils.getFCMToken(ActivityLogin.this);
        AppUtils.getDeviceIPAddress(ActivityLogin.this);
        Intent ii = new Intent(ActivityLogin.this, ActivityForgotPassword.class);
        ii.putExtra("activity", "forgotpassword");
        startActivity(ii);/*from   w  w w  .ja v  a  2  s  .  c o m*/
        overridePendingTransition(R.anim.slide_in_up, R.anim.slide_out_up);
        finish();
        break;

    case R.id.btn_login:
        AppUtils.getMobileImeiNo(ActivityLogin.this);
        AppUtils.getFCMToken(ActivityLogin.this);
        AppUtils.getDeviceIPAddress(ActivityLogin.this);
        AppUtils.hideKeyboard(ActivityLogin.this);
        if (valid()) {
            username = edt_login_username.getText().toString();
            password = edt_login_password.getText().toString();

            if (UtilFunctions.isNetworkAvailable(ActivityLogin.this)) {
                new LoginVerificationTask().execute();
            } else {
                Toast.makeText(getApplicationContext(), getResources().getString(R.string.ISAVAILABLE),
                        Toast.LENGTH_SHORT).show();
            }
        }
        break;

    case R.id.btn_login_sign_up:
        if (validited()) {
            AppUtils.getMobileImeiNo(ActivityLogin.this);
            AppUtils.getFCMToken(ActivityLogin.this);
            AppUtils.getDeviceIPAddress(ActivityLogin.this);
            Intent i = new Intent(ActivityLogin.this, ActivityForgotPassword.class);
            i.putExtra("activity", "signup");
            startActivity(i);
            overridePendingTransition(R.anim.slide_in_up, R.anim.slide_out_up);
            finish();
        }
        break;
    }
}