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.hichinaschool.flashcards.anki.Feedback.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    Themes.applyTheme(this);
    super.onCreate(savedInstanceState);

    Resources res = getResources();

    Context context = getBaseContext();
    SharedPreferences sharedPreferences = AnkiDroidApp.getSharedPrefs(context);
    mReportErrorMode = sharedPreferences.getString("reportErrorMode", REPORT_ASK);

    mNonce = UUID.randomUUID().getMostSignificantBits();
    mFeedbackUrl = res.getString(R.string.feedback_post_url);
    mErrorUrl = res.getString(R.string.error_post_url);
    mImm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);

    mPostingFeedback = false;//from   w w w  .j  a  va2  s .  c  om
    initAllAlertDialogs();

    getErrorFiles();
    Intent i = getIntent();
    mAllowFeedback = (i.hasExtra("request") && (i.getIntExtra("request", 0) == DeckPicker.REPORT_FEEDBACK
            || i.getIntExtra("request", 0) == DeckPicker.RESULT_DB_ERROR))
            || mReportErrorMode.equals(REPORT_ASK);
    if (!mAllowFeedback) {
        if (mReportErrorMode.equals(REPORT_ALWAYS)) { // Always report
            try {
                String feedback = "Automatically sent";
                Connection.sendFeedback(mSendListener, new Payload(new Object[] { mFeedbackUrl, mErrorUrl,
                        feedback, mErrorReports, mNonce, getApplication(), true }));
                if (mErrorReports.size() > 0) {
                    mPostingFeedback = true;
                }
                if (feedback.length() > 0) {
                    mPostingFeedback = true;
                }
            } catch (Exception e) {
                Log.e(AnkiDroidApp.TAG, e.toString());
            }
            finish();
            if (AnkiDroidApp.SDK_VERSION > 4) {
                ActivityTransitionAnimation.slide(Feedback.this, ActivityTransitionAnimation.NONE);
            }
            return;
        } else if (mReportErrorMode.equals(REPORT_NEVER)) { // Never report
            deleteFiles(false, false);
            finish();
            if (AnkiDroidApp.SDK_VERSION > 4) {
                ActivityTransitionAnimation.slide(Feedback.this, ActivityTransitionAnimation.NONE);
            }
            return;
        }
    }

    View mainView = getLayoutInflater().inflate(R.layout.feedback, null);
    setContentView(mainView);
    Themes.setWallpaper(mainView);
    Themes.setTextViewStyle(findViewById(R.id.tvFeedbackDisclaimer));
    Themes.setTextViewStyle(findViewById(R.id.lvFeedbackErrorList));

    Button btnSend = (Button) findViewById(R.id.btnFeedbackSend);
    Button btnKeepLatest = (Button) findViewById(R.id.btnFeedbackKeepLatest);
    Button btnClearAll = (Button) findViewById(R.id.btnFeedbackClearAll);
    mEtFeedbackText = (EditText) findViewById(R.id.etFeedbackText);
    mLvErrorList = (ListView) findViewById(R.id.lvFeedbackErrorList);

    mErrorAdapter = new SimpleAdapter(this, mErrorReports, R.layout.error_item,
            new String[] { "name", "state", "result" },
            new int[] { R.id.error_item_text, R.id.error_item_progress, R.id.error_item_status });
    mErrorAdapter.setViewBinder(new SimpleAdapter.ViewBinder() {
        @Override
        public boolean setViewValue(View view, Object arg1, String text) {
            switch (view.getId()) {
            case R.id.error_item_progress:
                if (text.equals(STATE_UPLOADING)) {
                    view.setVisibility(View.VISIBLE);
                } else {
                    view.setVisibility(View.GONE);
                }
                return true;
            case R.id.error_item_status:
                if (text.length() == 0) {
                    view.setVisibility(View.GONE);
                    return true;
                } else {
                    view.setVisibility(View.VISIBLE);
                    return false;
                }
            }
            return false;
        }
    });

    btnClearAll.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            deleteFiles(false, false);
            refreshErrorListView();
            refreshInterface();
        }
    });

    mLvErrorList.setAdapter(mErrorAdapter);

    btnSend.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            if (!mPostingFeedback) {
                String feedback = mEtFeedbackText.getText().toString();
                Connection.sendFeedback(mSendListener, new Payload(new Object[] { mFeedbackUrl, mErrorUrl,
                        feedback, mErrorReports, mNonce, getApplication(), false }));
                if (mErrorReports.size() > 0) {
                    mPostingFeedback = true;
                }
                if (feedback.length() > 0) {
                    mPostingFeedback = true;
                }
                refreshInterface();
            }
        }
    });

    btnKeepLatest.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            deleteFiles(false, true);
            refreshErrorListView();
            refreshInterface();
        }
    });

    refreshInterface();

    getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN
            | WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);

}

From source file:com.heightechllc.breakify.MainActivity.java

@Override
public void onClick(View view) {
    switch (view.getId()) {
    case R.id.circle_timer:
        if (timerState == TIMER_STATE_RUNNING)
            pauseTimer();/*from  www.j av a  2  s  .c  o m*/
        else
            startTimer();

        break;
    case R.id.reset_btn:
        cancelScheduledAlarm();

        resetTimerUI(false);

        // Analytics
        if (mixpanel != null) {
            String eventName = getWorkState() == WORK_STATE_WORKING ? "Work timer reset" : "Break timer reset";
            mixpanel.track(eventName, null);
        }

        break;
    case R.id.skip_btn:
        skipToNextState();
    }
}

From source file:com.zira.registration.BackgroundCheckActivity.java

@Override
public void onClick(View v) {

    switch (v.getId()) {

    case R.id.dob:
        int mYear, mMonth, mDay;
        // Process to get Current Date
        final Calendar c = Calendar.getInstance();
        mYear = c.get(Calendar.YEAR);
        mMonth = c.get(Calendar.MONTH);
        mDay = c.get(Calendar.DAY_OF_MONTH);

        // Launch Date Picker Dialog
        DatePickerDialog dpd = new DatePickerDialog(BackgroundCheckActivity.this,
                new DatePickerDialog.OnDateSetListener() {

                    @Override/*w  w w.  ja va2  s. c  om*/
                    public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {

                        c.set(year, monthOfYear, dayOfMonth);
                        String selectedDate = mDateFormat.format(c.getTime());
                        String dateTosend = dateFormatToSend.format(c.getTime());
                        System.err.println("selectdate" + dateTosend);
                        DOB = dateTosend;//+String.valueOf(hours)+String.valueOf(minute)+String.valueOf(00);

                        dobTextView.setText(selectedDate);
                        /*   editor.putString("dob", selectedDate);
                           editor.commit();*/
                    }
                }, mYear, mMonth, mDay);
        dpd.show();

        break;
    case R.id.licenceExpiration:
        int Year, Month, Day;
        // Process to get Current Date
        final Calendar c1 = Calendar.getInstance();
        Year = c1.get(Calendar.YEAR);
        Month = c1.get(Calendar.MONTH);
        Day = c1.get(Calendar.DAY_OF_MONTH);

        // Launch Date Picker Dialog
        DatePickerDialog dpd1 = new DatePickerDialog(BackgroundCheckActivity.this,
                new DatePickerDialog.OnDateSetListener() {

                    @Override
                    public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {

                        c1.set(year, monthOfYear, dayOfMonth);
                        String selectedDate = mDateFormat.format(c1.getTime());
                        String dateTosend = dateFormatToSend.format(c1.getTime());
                        System.err.println("selectdate" + dateTosend);
                        licenceExpirationDate = dateTosend;//+String.valueOf(hours)+String.valueOf(minute)+String.valueOf(00);

                        licenceExpirationTextView.setText(selectedDate);
                        /*editor.putString("licenceExpirationDate", selectedDate);
                        editor.commit();*/

                    }
                }, Year, Month, Day);
        dpd1.show();

        break;

    case R.id.SaveAndCuntinue:

        emptyFieldCheck();
        //forwardToNextScreen();      
        break;

    default:

        break;
    }
}

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

public void goToRestaurantView(View view) {
    if (view.getId() == R.id.restaurantButton) {

        //Open URL in a browser

        //TODO Implement Action

        //End of Action Implementation

        //This is a navigation action
        //restaurantViewControllerInstance.parentController = self ;
        Intent restaurantViewIntent = new Intent(this, RestaurantView.class);

        startActivity(restaurantViewIntent);

    }//  www.  ja va  2 s. c o m
}

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

public void goToGroceryView(View view) {
    if (view.getId() == R.id.groceryButton) {

        //Open URL in a browser

        //TODO Implement Action

        //End of Action Implementation

        //This is a navigation action
        //groceryViewControllerInstance.parentController = self ;
        Intent groceryViewIntent = new Intent(this, GroceryView.class);

        startActivity(groceryViewIntent);

    }/*  w  w  w  .  j  a  v  a  2 s.  c o  m*/
}

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

public void goToGasView(View view) {
    if (view.getId() == R.id.gasButton) {

        //Open URL in a browser

        //TODO Implement Action

        //End of Action Implementation

        //This is a navigation action
        //gasStationViewControllerInstance.parentController = self ;
        Intent gasStationViewIntent = new Intent(this, GasStationView.class);

        startActivity(gasStationViewIntent);

    }//from  w  w w.j a  v a2s.c om
}

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

public void goToTeatherView(View view) {
    if (view.getId() == R.id.teatherButton) {

        //Open URL in a browser

        //TODO Implement Action

        //End of Action Implementation

        //This is a navigation action
        //theaterViewControllerInstance.parentController = self ;
        Intent theaterViewIntent = new Intent(this, TheaterView.class);

        startActivity(theaterViewIntent);

    }//from ww  w .j a v a2s . c  o  m
}

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

public void goToCouponView(View view) {
    if (view.getId() == R.id.couponButton) {

        //Open URL in a browser

        //TODO Implement Action

        //End of Action Implementation

        //This is a navigation action
        //couponViewControllerInstance.parentController = self ;
        Intent couponViewIntent = new Intent(this, CouponView.class);

        startActivity(couponViewIntent);

    }/*from   w ww .  j  a  va2 s  .  co m*/
}

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

public void goToLubeView(View view) {
    if (view.getId() == R.id.lubeButton) {

        //Open URL in a browser

        //TODO Implement Action

        //End of Action Implementation

        //This is a navigation action
        //lubeViewControllerInstance.parentController = self ;
        Intent lubeViewIntent = new Intent(this, LubeView.class);

        startActivity(lubeViewIntent);/*  ww w . ja  v a 2 s  .c o m*/

    }
}

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

public void goGameView(View view) {
    if (view.getId() == R.id.gameButton) {

        //Open URL in a browser

        //TODO Implement Action

        //End of Action Implementation

        //This is a navigation action
        //gameViewControllerInstance.parentController = self ;
        Intent gameViewIntent = new Intent(this, GameView.class);

        startActivity(gameViewIntent);/*from  w  ww .  j  a v a2  s .c o m*/

    }
}