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.canappi.connector.yp.yhere.HomeView.java

public void goToBakeryView(View view) {
    if (view.getId() == R.id.bakeryButton) {

        //Open URL in a browser

        //TODO Implement Action

        //End of Action Implementation

        //This is a navigation action
        //bakeryViewControllerInstance.parentController = self ;
        Intent bakeryViewIntent = new Intent(this, BakeryView.class);

        startActivity(bakeryViewIntent);

    }//from  w  w w .j  a  v  a 2 s  .com
}

From source file:com.canappi.connector.yp.yhere.HomeView.java

public void goToRepairView(View view) {
    if (view.getId() == R.id.repairButton) {

        //Open URL in a browser

        //TODO Implement Action

        //End of Action Implementation

        //This is a navigation action
        //repairViewControllerInstance.parentController = self ;
        Intent repairViewIntent = new Intent(this, RepairView.class);

        startActivity(repairViewIntent);

    }//from w  w  w .j av  a2 s  . c  om
}

From source file:com.canappi.connector.yp.yhere.HomeView.java

public void goToSearchView(View view) {
    if (view.getId() == R.id.findButton) {

        //Open URL in a browser

        //TODO Implement Action

        //End of Action Implementation

        //This is a navigation action
        //searchViewControllerInstance.parentController = self ;
        Intent searchViewIntent = new Intent(this, SearchView.class);

        searchViewIntent.putExtra("termQueryParameter", termEditText.getText());
        startActivity(searchViewIntent);

    }/*  w  w  w. jav a2 s  .  co  m*/
}

From source file:com.dattasmoon.pebble.plugin.NotificationService.java

private String dumpViewGroup(int depth, ViewGroup vg, String existing_text) {
    String text = "";
    Log.d(Constants.LOG_TAG, "root view, depth:" + depth + "; view: " + vg);
    for (int i = 0; i < vg.getChildCount(); ++i) {
        View v = vg.getChildAt(i);
        if (Constants.IS_LOGGABLE) {
            Log.d(Constants.LOG_TAG, "depth: " + depth + "; " + v.getClass().toString() + "; view: " + v);
        }/*  www  .jav  a2 s .  c  o  m*/
        if (v.getId() == android.R.id.title || v instanceof android.widget.Button
                || v.getClass().toString().contains("android.widget.DateTimeView")) {
            if (Constants.IS_LOGGABLE) {
                Log.d(Constants.LOG_TAG, "I am going to skip this, but if I didn't, the text would be: "
                        + ((TextView) v).getText().toString());
            }
            if (existing_text.isEmpty() && v.getId() == android.R.id.title) {
                if (Constants.IS_LOGGABLE) {
                    Log.d(Constants.LOG_TAG,
                            "I was going to skip this, but the existing text was empty, and I need something.");
                }
            } else {
                continue;
            }
        }

        if (v instanceof TextView) {
            TextView tv = (TextView) v;
            if (tv.getText().toString() == "..." || tv.getText().toString() == ""
                    || isInteger(tv.getText().toString())
                    || tv.getText().toString().trim().equalsIgnoreCase(existing_text)) {
                if (Constants.IS_LOGGABLE) {
                    Log.d(Constants.LOG_TAG,
                            "Text is: " + tv.getText().toString() + " but I am going to skip this");
                }
                continue;
            }
            text += tv.getText().toString() + "\n";
            if (Constants.IS_LOGGABLE) {
                Log.i(Constants.LOG_TAG, tv.getText().toString());
            }
        }
        if (v instanceof ViewGroup) {
            text += dumpViewGroup(depth + 1, (ViewGroup) v, existing_text);
        }
    }
    return text;
}

From source file:com.dzt.uberclone.HomeFragment.java

public void onClick(View v) {
    Fragment fragment;//from w  w w  .ja va2  s . c o m
    FragmentManager fragmentManager = getActivity().getSupportFragmentManager();
    switch (v.getId()) {
    default:
    case R.id.select_location:
        //Toast.makeText(getActivity(), "select location", Toast.LENGTH_SHORT).show();
        fragment = new SelectLocationFragment();
        fragmentManager.beginTransaction().replace(R.id.container, fragment).addToBackStack("selectlocation")
                .commit();
        break;
    case R.id.request_uber:
        SharedPreferences sp = getActivity().getSharedPreferences("Session", Context.MODE_PRIVATE);
        String email = sp.getString("email", "");

        StringBuilder sb = new StringBuilder();
        sb.append(getResources().getString(R.string.ip));
        sb.append("uber/request/send?user_id=");
        sb.append(email);
        sb.append("&user_lat=");
        sb.append(currentLocation.latitude);
        sb.append("&user_lon=");
        sb.append(currentLocation.longitude);

        URLpetition petition = new URLpetition("send uber request");
        petition.execute(sb.toString());

        break;
    }
}

From source file:bookapp.myapplication.LoginPage.java

@Override
public void onClick(View v) {
    if (!mGoogleApiClient.isConnecting()) {
        // We only process button clicks when GoogleApiClient is not transitioning
        // between connected and not connected.
        switch (v.getId()) {
        case R.id.sign_in_button:
            mStatus.setText(R.string.status_signing_in);
            mSignInProgress = STATE_SIGN_IN;
            mGoogleApiClient.connect();//from w  ww. j a  v  a2  s . c  om
            break;
        case R.id.sign_out_button:
            // We clear the default account on sign out so that Google Play
            // services will not return an onConnected callback without user
            // interaction.
            if (mGoogleApiClient.isConnected()) {
                Plus.AccountApi.clearDefaultAccount(mGoogleApiClient);
                mGoogleApiClient.disconnect();
            }
            onSignedOut();
            break;
        case R.id.revoke_access_button:
            // After we revoke permissions for the user with a GoogleApiClient
            // instance, we must discard it and create a new one.
            Plus.AccountApi.clearDefaultAccount(mGoogleApiClient);
            // Our sample has caches no user data from Google+, however we
            // would normally register a callback on revokeAccessAndDisconnect
            // to delete user data so that we comply with Google developer
            // policies.
            Plus.AccountApi.revokeAccessAndDisconnect(mGoogleApiClient);
            mGoogleApiClient = buildGoogleApiClient();
            mGoogleApiClient.connect();
            break;
        }
    }
}

From source file:com.spydiko.rotationmanager.MainActivity.java

@Override
public void onClick(View view) {
    //        Button temp = (Button) view;
    ImageView tmp;/*from   w  w  w .j  a  va2 s. co m*/
    vibe.vibrate(50);// Vibrate it's time you click something...
    switch (view.getId()) {
    case (R.id.button2):// Clear all button
        for (Model mdl : activities) {
            mdl.setSelectedPortrait(false);
            mdl.setSelectedLandscape(false);
            myapp.savePreferences(mdl.getPackageName(), false, true);
            myapp.savePreferences(mdl.getPackageName(), false, false);
        }
        lv.setAdapter(adapter);
        break;
    case (R.id.orientationButton):// Auto-Rotation button
        tmp = (ImageView) findViewById(view.getId());
        //******************
        //-----4state-------
        int state = AppSpecificOrientation.getCheck_button();
        state = (state + 1) % 5;
        switch (state) {
        case 0:
            tmp.setImageDrawable(getResources().getDrawable(R.drawable.auto_rotate_on));
            autoRotate.setTextColor(Color.GREEN);
            autoRotate.setText(getResources().getText(R.string.orientationOn));
            AppSpecificOrientation.setCheck_button(0);
            Settings.System.putInt(getContentResolver(), Settings.System.ACCELEROMETER_ROTATION, 1);
            break;
        case 1:
            tmp.setImageDrawable(getResources().getDrawable(R.drawable.auto_rotate_off));
            autoRotate.setTextColor(Color.RED);
            autoRotate.setText(getResources().getText(R.string.orientationOff));
            AppSpecificOrientation.setCheck_button(1);
            Settings.System.putInt(getContentResolver(), Settings.System.ACCELEROMETER_ROTATION, 0);
            break;
        case 2:
            tmp.setImageDrawable(getResources().getDrawable(R.drawable.forced_portrait));
            autoRotate.setTextColor(Color.CYAN);
            autoRotate.setText(getResources().getText(R.string.forced_portrait));
            AppSpecificOrientation.setCheck_button(2);
            break;
        case 3:
            tmp.setImageDrawable(getResources().getDrawable(R.drawable.forced_landscape));
            autoRotate.setTextColor(Color.CYAN);
            autoRotate.setText(getResources().getText(R.string.forced_landscape));
            AppSpecificOrientation.setCheck_button(3);
            break;
        case 4:
            tmp.setImageDrawable(getResources().getDrawable(R.drawable.forced_auto));
            autoRotate.setTextColor(Color.parseColor("#FFFFFF"));
            autoRotate.setText(getResources().getText(R.string.forced_auto));
            AppSpecificOrientation.setCheck_button(4);
            break;
        default:
            break;
        }
        break;
    }
}

From source file:com.example.igorklimov.popularmoviesdemo.fragments.DetailFragment.java

@Override
public void onClick(View v) {
    switch (v.getId()) {
    case R.id.fab:
        if (!fab.isActivated()) {
            if (!mInserted) {
                Toast.makeText(context, "Added to Favorites", LENGTH_SHORT).show();
                fab.setImageResource(R.drawable.star_on);
                if (isTabletPreference(context) || Utility.getSortByPreference(context) != 4) {
                    Utility.addToFavorite(cursor, context);
                } else {
                    toRemove = false;//www. java2s  . c o  m
                }
                fab.setActivated(true);
                mInserted = true;
            }
        } else {
            if (mInserted) {
                Toast.makeText(context, "Removed from Favorites", LENGTH_SHORT).show();
                fab.setImageResource(R.drawable.star_off);
                fab.setActivated(false);

                if (isTabletPreference(context) || Utility.getSortByPreference(context) != 4) {
                    Utility.removeFromFavorite(cursor, context);
                    MoviesGridFragment.sId = Utility.getId(context);
                    if (isTabletPreference(context) && Utility.getSortByPreference(context) == 4) {
                        MainActivity activity = (MainActivity) context;
                        activity.showDetails(MovieContract.FavoriteMovie.buildMovieUri(MoviesGridFragment.sId));
                    }
                } else {
                    toRemove = true;
                }
                mInserted = false;
            }
        }
        break;
    case R.id.play_button:
        if (mTrailerUri != null) {
            Log.d("TAG", "onClick: " + mTrailerUri);
            Intent intent = YouTubeStandalonePlayer.createVideoIntent(getActivity(), YOUTUBE_API_KEY,
                    mTrailerUri, 0, true, false);
            startActivity(intent);
        }
        break;
    }
}

From source file:com.googlecode.CallerLookup.Main.java

@Override
public void onClick(View v) {
    if (v.getId() == mTestButton.getId()) {
        String number = mTestInput.getText().toString();

        if (number.length() > 0) {
            String lookup = mURL.getText().toString();
            String regExp = mRegExp.getText().toString();

            savePreferences();//w ww  .jav  a 2s .com

            showDialog(DIALOG_PROGRESS);
            mLookupThread = new TestLookupThread(mHandler);
            mLookupThread.mURL = lookup;
            mLookupThread.mRegExp = regExp;
            mLookupThread.mNumber = number;
            mLookupThread.start();
        }
    }
}

From source file:com.ximai.savingsmore.save.activity.FourStepRegisterActivity.java

@Override
public void onClick(View v) {
    switch (v.getId()) {
    case R.id.submit:
        if (store_name.getText() == null || TextUtils.isEmpty(store_name.getText())) {
            Toast.makeText(FourStepRegisterActivity.this, "??", Toast.LENGTH_SHORT).show();
        } else if (phone_number.getText() == null || TextUtils.isEmpty(phone_number.getText())) {
            Toast.makeText(FourStepRegisterActivity.this, "?", Toast.LENGTH_SHORT).show();
        } else if (address.getmTvRightText() == null || TextUtils.isEmpty(address.getmTvRightText())) {
            Toast.makeText(FourStepRegisterActivity.this, "?", Toast.LENGTH_SHORT).show();
        } else if (xixiang_adress.getText() == null || TextUtils.isEmpty(xixiang_adress.getText())) {
            Toast.makeText(FourStepRegisterActivity.this, "", Toast.LENGTH_SHORT).show();
        } else if (good_type.getmTvRightText() == null || TextUtils.isEmpty(good_type.getmTvRightText())
                || good_type.getmTvRightText().equals("")) {
            Toast.makeText(FourStepRegisterActivity.this, "?", Toast.LENGTH_SHORT).show();
        } else if (good_range.getmTvRightText() == null || TextUtils.isEmpty(good_range.getmTvRightText())
                || good_range.getmTvRightText().equals("")) {
            Toast.makeText(FourStepRegisterActivity.this, "?", Toast.LENGTH_SHORT).show();
        } else if (zhizhao_path == null || TextUtils.isEmpty(zhizhao_path)) {
            Toast.makeText(FourStepRegisterActivity.this, "?", Toast.LENGTH_SHORT).show();
        } else {/*from   w  ww .j  av a 2s . c o m*/
            myUserExtInfo.StoreName = store_name.getText().toString();
            myUserExtInfo.OfficePhone = phone_number.getText().toString();
            myUserExtInfo.WebSite = website.getText().toString();
            userParameter.WeChat = weChat.getText().toString();
            userParameter.Domicile = xixiang_adress.getText().toString();
            myUserExtInfo.FoundingDate = create_date.getmTvRightText();
            myUserExtInfo.BusinessLicenseNumber = zhizhao_number.getText().toString();
            myUserExtInfo.LicenseKeyNumber = zhegnshu_number.getText().toString();
            userParameter.UserDisplayName = lianxiren.getText().toString();
            userParameter.Post = position.getText().toString();
            //list_images.addAll(images);
            myUserExtInfo.Images = images;
            if (good_type.getmTvRightText().equals("???")) {
                myUserExtInfo.IsBag = "true";
            } else {
                myUserExtInfo.IsBag = "false";
            }
            list1.add(myBusinessScopes);
            userParameter.BusinessScopes = list1;
            userParameter.UserExtInfo = myUserExtInfo;
            if (a == b) {
                save_message(userParameter);
            }
        }
        break;
    case R.id.create_time:
        UsePicker.showYearMonthDay(FourStepRegisterActivity.this, new UsePicker.CallBack() {
            @Override
            public void callBack(String time) {
                create_date.getmTvRight_().setText(time);

            }
        }, create_date.getmTvRightText());
        break;
    case R.id.head_image:
        isslinece = false;
        isItem = false;
        isheadImage = true;
        isZhengshu = false;
        showSetIconWindow();
        break;

    case R.id.good_type:
        PopupWindowFromBottomUtil.shouWindowWithWheel(
                FourStepRegisterActivity.this, LayoutInflater.from(FourStepRegisterActivity.this)
                        .inflate(R.layout.business_my_center_activity, null),
                list_type, new PopupWindowFromBottomUtil.Listener() {
                    @Override
                    public void confirm(String content, PopupWindow window) {
                        good_type.getmTvRight_().setText(content);
                        window.dismiss();
                    }
                });
        break;
    case R.id.range:
        if (good_type.getmTvRightText().equals("???")) {
            PopupWindowFromBottomUtil.shouRange(FourStepRegisterActivity.this,
                    LayoutInflater.from(FourStepRegisterActivity.this)
                            .inflate(R.layout.business_my_center_activity, null),
                    good_one_classify, new PopupWindowFromBottomUtil.Listener2() {
                        @Override
                        public void callBack(BaseMessage Id1, String content, PopupWindow popupWindow) {
                            good_range.getmTvRight_().setText(content);
                            //                            myDictNode.Name = Id1.Name;
                            //                            myDictNode.SortNo = Id1.SortNo;
                            //                            myDictNode.Id=Id1.Id;
                            myBusinessScopes.DictNodeId = Id1.Id;
                            popupWindow.dismiss();
                        }
                    });
        } else {
            PopupWindowFromBottomUtil.shouRange(FourStepRegisterActivity.this,
                    LayoutInflater.from(FourStepRegisterActivity.this)
                            .inflate(R.layout.business_my_center_activity, null),
                    good_two_classify, new PopupWindowFromBottomUtil.Listener2() {
                        @Override
                        public void callBack(BaseMessage Id1, String content, PopupWindow popupWindow) {
                            good_range.getmTvRight_().setText(content);
                            //                            myDictNode.Name = Id1.Name;
                            //                            myDictNode.SortNo = Id1.SortNo;
                            //                            myDictNode.Id=Id1.Id;
                            myBusinessScopes.DictNodeId = Id1.Id;
                            popupWindow.dismiss();
                        }
                    });
        }
        break;
    case R.id.adress:
        PopupWindowFromBottomUtil.showAddress(
                FourStepRegisterActivity.this, LayoutInflater.from(FourStepRegisterActivity.this)
                        .inflate(R.layout.business_my_center_activity, null),
                list, new PopupWindowFromBottomUtil.Listenre1() {
                    @Override
                    public void callBack(String Id1, String Id2, String Id3, String content,
                            PopupWindow popupWindow) {
                        if (null != Id1) {
                            userParameter.ProvinceId = Id1;
                        }
                        if (null != Id2) {
                            userParameter.CityId = Id2;
                        }
                        if (null != Id3) {
                            userParameter.AreaId = Id3;
                        }
                        address.getmTvRight_().setText(content);
                        popupWindow.dismiss();
                    }

                });
        break;
    case R.id.liscense_item:
        isslinece = true;
        isItem = false;
        isheadImage = false;
        isZhengshu = false;
        showSetIconWindow();
        break;
    case R.id.zhengshu_item:
        isItem = false;
        isheadImage = false;
        isslinece = false;
        isZhengshu = true;
        showSetIconWindow();
        break;
    case R.id.btnCancel:
        setIconWindow.dismiss();
        break;
    case R.id.btnCamera:
        openCamera();
        setIconWindow.dismiss();
        break;
    case R.id.btnAlbum:
        openAlbum();
        setIconWindow.dismiss();
        break;
    }
}