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:fiskinfoo.no.sintef.fiskinfoo.Implementation.FiskInfoUtility.java

public static int getRelativeTop(View myView) {
    if (myView.getId() == android.R.id.content)
        return myView.getTop();
    else//w ww. j ava2s .  c  o m
        return myView.getTop() + getRelativeTop((View) myView.getParent());
}

From source file:info.papdt.blacklight.support.Utility.java

public static void setActionBarTranslation(Activity activity, float y) {
    ViewGroup vg = (ViewGroup) activity.findViewById(android.R.id.content).getParent();
    int count = vg.getChildCount();

    if (DEBUG) {/*from   w ww .  jav a2s. c o m*/
        Log.d(TAG, "==========================");
    }

    // Get the class of action bar
    Class<?> actionBarContainer = null;
    Field isSplit = null;

    try {
        actionBarContainer = Class.forName("com.android.internal.widget.ActionBarContainer");
        isSplit = actionBarContainer.getDeclaredField("mIsSplit");
        isSplit.setAccessible(true);
    } catch (Exception e) {
        if (DEBUG) {
            Log.e(TAG, Log.getStackTraceString(e));
        }
    }

    for (int i = 0; i < count; i++) {
        View v = vg.getChildAt(i);

        if (v.getId() != android.R.id.content) {
            if (DEBUG) {
                Log.d(TAG, "Found View: " + v.getClass().getName());
            }

            try {
                if (actionBarContainer.isInstance(v)) {
                    if (DEBUG) {
                        Log.d(TAG, "Found ActionBarContainer");
                    }

                    if (isSplit.getBoolean(v)) {
                        if (DEBUG) {
                            Log.d(TAG, "Found Split Action Bar");
                        }

                        continue;
                    }
                }
            } catch (Exception e) {
                if (DEBUG) {
                    Log.e(TAG, Log.getStackTraceString(e));
                }
            }

            v.setTranslationY(y);
        }
    }

    if (DEBUG) {
        Log.d(TAG, "==========================");
    }
}

From source file:fr.shywim.antoinedaniel.utils.Utils.java

/**
 * First part of the click animation./*from w  w  w  .ja  v a2 s. c  o m*/
 *
 * @param context Any context.
 * @param v View who will have the effect.
 * @param isRoot Whether the passed view is the ViewGroup parent.
 */
public static void clickAnimDown(Context context, View v, boolean isRoot) {
    RelativeLayout root;
    if (isRoot)
        root = (RelativeLayout) v;
    else
        root = (RelativeLayout) v.getParent();
    final View rectView = new View(context);
    rectView.setId(R.id.rect_view_id);
    rectView.setVisibility(View.GONE);
    rectView.setBackgroundResource(R.drawable.square);
    RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(v.getMeasuredWidth(),
            v.getMeasuredHeight());
    params.addRule(RelativeLayout.ALIGN_TOP, v.getId());
    rectView.setLayoutParams(params);
    AlphaAnimation rectAnim = new AlphaAnimation(0f, 0.4f);
    rectAnim.setFillAfter(true);
    rectAnim.setInterpolator(new AccelerateInterpolator());
    rectAnim.setDuration(150);
    rectAnim.setAnimationListener(new Animation.AnimationListener() {
        @Override
        public void onAnimationStart(Animation animation) {
            rectView.setVisibility(View.VISIBLE);
        }

        @Override
        public void onAnimationEnd(Animation animation) {

        }

        @Override
        public void onAnimationRepeat(Animation animation) {

        }
    });
    root.addView(rectView);
    rectView.startAnimation(rectAnim);
}

From source file:com.elkriefy.android.apps.authenticationexample.MainActivity.java

public void ChooseMe(View view) {
    Intent nextPart = null;//from ww w  .j a  v a 2 s  .  co  m
    switch (view.getId()) {
    case R.id.Fingerprint_test:
        nextPart = new Intent(MainActivity.this, FingerPrintDialogMainActivity.class);
        break;
    case R.id.GraceCreds_test:
        nextPart = new Intent(MainActivity.this, CredGraceActivity.class);
        break;
    case R.id.clearText_test:
        nextPart = new Intent(MainActivity.this, ClearTextNetworkUsageActivity.class);
        break;
    }
    if (nextPart != null)
        startActivity(nextPart);

}

From source file:hongik.android.project.best.ReviewDetailActivity.java

public void reviewdetailClick(View view) {
    if (view.getId() == R.id.reviewdetail_button) {
        if (access.equals("STORE")) {
            this.finish();
        } else if (access.equals("HISTORY")) {
            Intent storeIntent = new Intent(this, StoreActivity.class);
            storeIntent.putExtra("LICENSE", license);
            startActivity(storeIntent);//from w w w.j  av  a  2  s . c  om
        }
    }
}

From source file:com.yanzhenjie.nohttp.sample.activity.json.JsonActivity.java

@Override
public void onClick(View v) {
    if (v.getId() == R.id.btn_object_reqeust) {
        Request<JSONObject> request = NoHttp.createJsonObjectRequest(Constants.URL_NOHTTP_JSONOBJECT);
        request(0, request, objectListener, true, true);
    } else if (v.getId() == R.id.btn_array_request) {
        Request<JSONArray> request = NoHttp.createJsonArrayRequest(Constants.URL_NOHTTP_JSONARRAY);
        request(1, request, arrayListener, true, true);
    }/*from  ww w  .ja  v a2 s . com*/
}

From source file:com.perfoct.nohttp.sample.activity.json.JsonActivity.java

@Override
public void onClick(View v) {
    if (v.getId() == R.id.btn_object_reqeust) {
        Request<JSONObject> request = NoHttp.createJsonObjectRequest(Constants.URL_NOHTTP_JSONOBJECT);
        CallServer.getRequestInstance().add(this, 0, request, objectListener, true, true);
    } else if (v.getId() == R.id.btn_array_request) {
        Request<JSONArray> request = NoHttp.createJsonArrayRequest(Constants.URL_NOHTTP_JSONARRAY);
        CallServer.getRequestInstance().add(this, 1, request, arrayListener, true, true);
    }/* w  w  w  . j a va 2 s  . c  o m*/
}

From source file:com.chess.genesis.dialog.GameDetailsDialog.java

@Override
public void onClick(final View v) {
    if (v.getId() == R.id.ok)
        saveToFile();/* ww  w.j av  a2s  .  com*/
    else
        dismiss();
}

From source file:com.guendouz.dzgeekhangout.SimpleHttpRequest.java

@Override
public void onClick(View v) {
    if (v.getId() == R.id.btnHttpRequest) {
        new SimpleHttpRequestMethod().execute();
    }/*w w w.  ja v a2s .  c  o  m*/

}

From source file:com.app.jdy.widget.SelectYearDialog.java

@Override
public void onClick(View v) {
    switch (v.getId()) {
    case R.id.select_year_button:
        if (Constants.SELECT_YEAR != "0") {
            dialogCallBackInter.refreshActivity(Constants.SELECT_YEAR);
            dismiss();/*from   w  w w.java 2s . c o  m*/
        } else {
            Toast.makeText(getContext(), "", Toast.LENGTH_SHORT).show();
        }
        break;

    default:
        break;
    }
}