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.blueverdi.rosietheriveter.MoreFragment.java

public void onClick(View v) {
    switch (v.getId()) {
    case R.id.infoButton:
        Intent i = new Intent(getActivity(), SiteActivity.class);
        i.putExtra(Site.PARCEL_NAME, (Site) v.getTag());
        startActivity(i);/* ww w.j  a v a2s  . c om*/
        getActivity().overridePendingTransition(R.anim.zoom_in, 0);
        break;
    case R.id.tourButton:
        Site s = (Site) v.getTag();
        if (myTour.getSiteByName(s.getString(Site.NAME)) == null) {
            myTour.addSite(s);
        }
        Toast.makeText(getActivity(), getString(R.string.added_to_tour), Toast.LENGTH_SHORT).show();
    }
}

From source file:com.insthub.O2OMobile.Activity.C17_ApplyFormActivity.java

/**
 * popwindow//from   w  w w  .  java2  s.c om
 *
 * @param parent
 */
private void showPopWindow(View parent) {
    int id = parent.getId();
    switch (id) {
    case R.id.service_type:
        if (mServiceListPopwindow == null) {
            LayoutInflater layoutInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            mServicePopwindowView = layoutInflater.inflate(R.layout.service_type_popwindow, null);
            mServicePopwindowListView = (ListView) mServicePopwindowView
                    .findViewById(R.id.service_type_pop_listview);
            mServiceListPopwindow = new PopupWindow(mServicePopwindowView, parent.getWidth(),
                    AbsoluteLayout.LayoutParams.WRAP_CONTENT, true);

        }
        if (mServiceTypePopAdapter == null) {
            mServiceTypePopAdapter = new ServiceTypePopAdapter(this, mServiceModel.publicServiceTypeList);
            mServicePopwindowListView.setAdapter(mServiceTypePopAdapter);
        }
        mServiceListPopwindow.setFocusable(true);
        // ?
        mServiceListPopwindow.setOutsideTouchable(true);
        mServiceTypeArrow.setImageResource(R.drawable.b4_arrow_up);
        // Back???
        mServiceListPopwindow.setBackgroundDrawable(new BitmapDrawable());
        mServiceListPopwindow.showAsDropDown(parent);
        mServiceListPopwindow.setOnDismissListener(new PopupWindow.OnDismissListener() {
            @Override
            public void onDismiss() {
                mServiceTypeArrow.setImageResource(R.drawable.b3_arrow_down);
            }
        });
        mServicePopwindowListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                SERVICE_TYPE serviceType = mServiceTypeList.get(position);
                mServiceTypeId = serviceType.id;
                mServiceTypeTitle.setText(serviceType.title);
                mServiceModel.publicIsSecondCategory = false;
                mServiceModel.getCategoryList(mServiceTypeId);
                mServiceListPopwindow.dismiss();
            }
        });
        break;
    case R.id.first_category:
        if (mFirstCategoryListPopwindow == null) {
            LayoutInflater layoutInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            mFirstCategoryPopWindowView = layoutInflater.inflate(R.layout.first_category_popwindow, null);
            mFirstCategoryPopWindowListView = (ListView) mFirstCategoryPopWindowView
                    .findViewById(R.id.first_category_pop_listview);
            mFirstCategoryListPopwindow = new PopupWindow(mFirstCategoryPopWindowView, parent.getWidth(),
                    AbsoluteLayout.LayoutParams.WRAP_CONTENT, true);

        }
        if (mFirstCategoryPopAdapter == null) {
            mFirstCategoryPopAdapter = new FirstCategoryPopAdapter(this, mFirstCategoryList);
            mFirstCategoryPopWindowListView.setAdapter(mFirstCategoryPopAdapter);
        } else {
            mFirstCategoryPopAdapter.publicFirstCategoryList = mFirstCategoryList;
            mFirstCategoryPopAdapter.notifyDataSetChanged();
        }
        mFirstCategoryListPopwindow.setFocusable(true);
        // ?
        mFirstCategoryListPopwindow.setOutsideTouchable(true);
        mFirstCategoryArrow.setImageResource(R.drawable.b4_arrow_up);
        // Back???
        mFirstCategoryListPopwindow.setBackgroundDrawable(new BitmapDrawable());
        mFirstCategoryListPopwindow.showAsDropDown(parent);
        mFirstCategoryListPopwindow.setOnDismissListener(new PopupWindow.OnDismissListener() {
            @Override
            public void onDismiss() {
                mFirstCategoryArrow.setImageResource(R.drawable.b3_arrow_down);
            }
        });
        mFirstCategoryPopWindowListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                SERVICE_CATEGORY service_category = mFirstCategoryList.get(position);
                mFirstClassServiceCategory = service_category.id;
                mFirstCategoryTitle.setText(service_category.title);
                mServiceModel.publicIsSecondCategory = true;
                mServiceModel.getCategoryList(mFirstClassServiceCategory);
                mFirstCategoryListPopwindow.dismiss();
            }
        });
        break;
    case R.id.second_category:
        if (mSecondCategoryListPopwindow == null) {
            LayoutInflater layoutInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            mSecondCategoryPopWindowView = layoutInflater.inflate(R.layout.second_category_popwindow, null);
            mSecondCategoryPopWindowListView = (ListView) mSecondCategoryPopWindowView
                    .findViewById(R.id.second_category_pop_listview);
            mSecondCategoryListPopwindow = new PopupWindow(mSecondCategoryPopWindowView, parent.getWidth(),
                    AbsoluteLayout.LayoutParams.WRAP_CONTENT, true);

        }
        if (mSecondCategoryPopAdapter == null) {
            mSecondCategoryPopAdapter = new SecondCategoryPopAdapter(this, mSecondCategoryList);
            mSecondCategoryPopWindowListView.setAdapter(mSecondCategoryPopAdapter);
        } else {
            mSecondCategoryPopAdapter.publicSecondCategoryList = mSecondCategoryList;
            mSecondCategoryPopAdapter.notifyDataSetChanged();
        }

        mSecondCategoryListPopwindow.setFocusable(true);
        // ?
        mSecondCategoryListPopwindow.setOutsideTouchable(true);
        mSecondCategoryArrow.setImageResource(R.drawable.b4_arrow_up);
        // Back???
        mSecondCategoryListPopwindow.setBackgroundDrawable(new BitmapDrawable());
        mSecondCategoryListPopwindow.showAsDropDown(parent);
        mSecondCategoryListPopwindow.setOnDismissListener(new PopupWindow.OnDismissListener() {
            @Override
            public void onDismiss() {
                mSecondCategoryArrow.setImageResource(R.drawable.b3_arrow_down);
            }
        });
        mSecondCategoryPopWindowListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                SERVICE_CATEGORY service_category = mSecondCategoryList.get(position);
                mSecondVlassServiceCategory = service_category.id;
                mSecondCategoryTitle.setText(service_category.title);
                mServiceModel.publicIsSecondCategory = true;
                mSecondCategoryListPopwindow.dismiss();
            }
        });
        break;
    }

}

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

@Override
public void onClick(View v) {
    switch (v.getId()) {
    case R.id.left_button:
        onPrevious();/* w  w w .ja  va 2s  . c o  m*/
        break;
    case R.id.right_button:
        onNext();
        break;
    }
}

From source file:com.twentyfourseven.zira.DriverProfileInformation.java

@Override
public void onClick(View v) {
    // TODO Auto-generated method stub
    switch (v.getId()) {
    case R.id.btnSeeDriverLocation:
        // Building Parameters tripId and DriverId
        if (Util.isNetworkAvailable(DriverProfileInformation.this)) {
            ArrayList<NameValuePair> params = new ArrayList<NameValuePair>();
            params.add(new BasicNameValuePair("DriverId", mTripDetailsModel.getGetTrip_DriverId()));
            params.add(new BasicNameValuePair("TripId", SingleTon.getInstance().getDriverTripId()));

            Log.d("tag", "GetDriver Location::" + params.toString());
            AsyncTaskForZira mWebPageTask1 = new AsyncTaskForZira(DriverProfileInformation.this,
                    "GetDriverLocation", params, false, "");
            mWebPageTask1.delegate = (AsyncResponseForZira) DriverProfileInformation.this;
            mWebPageTask1.execute();//from  ww w . ja  v a2  s .c o  m
        } else {
            Util.alertMessage(DriverProfileInformation.this, "Please check your internet connection");
        }
        break;
    case R.id.imageView_Message:
        InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
        imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0);
        layoutDialog.setVisibility(View.VISIBLE);
        break;
    case R.id.buttonSend:
        try {
            InputMethodManager imm1 = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);
            imm1.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);
        } catch (Exception e) {
            // TODO: handle exception
        }
        if (edtMessage.getText().length() == 0) {
            Util.alertMessage(DriverProfileInformation.this, "Please Write Message");
        } else {

            String userid = mTripDetailsModel.getGetTrip_DriverId();
            String message = edtMessage.getText().toString();
            String trigger = "sms";
            Log.i("tag", "userid:" + userid);
            Log.i("tag", "message:" + message);
            Log.i("tag", "trigger:" + trigger);
            // Building Parameters
            if (Util.isNetworkAvailable(DriverProfileInformation.this)) {
                ArrayList<NameValuePair> params1 = new ArrayList<NameValuePair>();
                params1.add(new BasicNameValuePair("Id", userid));
                params1.add(new BasicNameValuePair("message", message));
                params1.add(new BasicNameValuePair("trigger", trigger));

                Log.d("tag", "SendRequest::" + params1.toString());
                AsyncTaskForZira mWebPageTask = new AsyncTaskForZira(DriverProfileInformation.this,
                        sendMessages, params1, true, "Sending message...");
                mWebPageTask.delegate = (AsyncResponseForZira) DriverProfileInformation.this;
                mWebPageTask.execute();
            } else {
                Util.alertMessage(DriverProfileInformation.this, "Please check your internet connection");
            }
            //            new SendMessageParsing().execute();
            edtMessage.setText("");
        }

        break;
    case R.id.imageViewDelete:
        try {
            InputMethodManager imm1 = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);
            imm1.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);
        } catch (Exception e) {
            // TODO: handle exception
        }
        edtMessage.setText("");
        layoutDialog.setVisibility(View.GONE);
        break;

    /*case R.id.imageView_Phone:
               
       Intent callIntent = new Intent(Intent.ACTION_CALL);
       callIntent.setData(Uri.parse(jsonmobileno));
       startActivity(callIntent);
       System.err.println("callllllllll");
       break;*/
    }

}

From source file:com.google.cast.samples.games.codelab.DrawingFragment.java

@Override
public void onClick(View v) {
    switch (v.getId()) {
    case R.id.clearButton:
        onClearClicked();//from   w  w w.  ja va  2 s .  com
        break;
    case R.id.doneButton:
        onDoneClicked();
        break;
    }
}

From source file:com.google.samples.quickstart.signin.MainActivity.java

@Override
public void onClick(View v) {
    switch (v.getId()) {
    case R.id.sign_in_button:
        onSignInClicked();/*ww  w. j  a v a2 s.  c  om*/
        break;
    case R.id.sign_out_button:
        onSignOutClicked();
        break;
    case R.id.disconnect_button:
        onDisconnectClicked();
        break;
    }
}

From source file:li.barter.fragments.EditProfileFragment.java

@Override
public void onClick(final View v) {
    switch (v.getId()) {
    case R.id.text_current_location: {

        final Intent editLocationIntent = new Intent(getActivity(), SelectPreferredLocationActivity.class);
        startActivityForResult(editLocationIntent, AppConstants.RequestCodes.EDIT_PREFERRED_LOCATION);
        break;/* w  w w.j  a va2 s  .c o m*/
    }

    case R.id.image_profile_pic: {
        showChoosePictureSourceDialog();
        break;
    }
    }
}

From source file:li.barter.fragments.LoginFragment.java

@Override
public void onClick(final View v) {

    switch (v.getId()) {

    case R.id.button_facebook_login: {
        GoogleAnalyticsManager.getInstance()
                .sendEvent(new EventBuilder(Categories.CONVERSION, Actions.SIGN_IN_ATTEMPT).set(ParamKeys.TYPE,
                        ParamValues.FACEBOOK));
        final Session session = Session.getActiveSession();
        if (!session.isOpened() && !session.isClosed()) {
            session.openForRead(new Session.OpenRequest(this)
                    .setPermissions(Arrays.asList(AppConstants.FBPERMISSIONS)).setCallback(this));
        } else {//from   w  w  w.  j  a  v  a  2  s  .c om
            Session.openActiveSession(getActivity(), this, true, this);
        }
        break;
    }

    case R.id.button_google_login: {
        GoogleAnalyticsManager.getInstance()
                .sendEvent(new EventBuilder(Categories.CONVERSION, Actions.SIGN_IN_ATTEMPT).set(ParamKeys.TYPE,
                        ParamValues.GOOGLE));
        ((AuthActivity) getActivity()).getPlusManager().login();
        break;
    }

    case R.id.button_submit: {
        if (isInputValid()) {
            GoogleAnalyticsManager.getInstance()
                    .sendEvent(new EventBuilder(Categories.CONVERSION, Actions.SIGN_IN_ATTEMPT)
                            .set(ParamKeys.TYPE, ParamValues.EMAIL));
            login(mEmailEditText.getText().toString(), mPasswordEditText.getText().toString());
        }
        break;
    }

    case R.id.forgot_password: {
        showForgotPasswordDialog();

    }
    }
}

From source file:com.ola.insta.BookingAcivity.java

@Override
public void onClick(View v) {
    // TODO Auto-generated method stub
    switch (v.getId()) {
    case R.id.btnSpeak:
        promptSpeechInput();//from  w  ww. ja  va  2 s  . c o m
        break;

    default:
        break;
    }
}

From source file:com.mercandalli.android.apps.files.user.LoginRegisterActivity.java

@Override
public void onClick(View v) {
    final int viewId = v.getId();
    switch (viewId) {
    case R.id.activity_register_login_gg_sign:
        onGoogleSignInClicked();/*  w  w  w  . jav  a2s.c  o m*/
        break;
    case R.id.activity_register_login_signin:
        if (mListFragment[getCurrentFragmentIndex()] != null) {
            if (mListFragment[getCurrentFragmentIndex()] instanceof RegistrationFragment) {
                ((RegistrationFragment) mListFragment[getCurrentFragmentIndex()]).inscription();
            } else if (mListFragment[getCurrentFragmentIndex()] instanceof LoginFragment) {
                ((LoginFragment) mListFragment[getCurrentFragmentIndex()]).login();
            }
        }
        break;
    }
}