Example usage for android.view Gravity RIGHT

List of usage examples for android.view Gravity RIGHT

Introduction

In this page you can find the example usage for android.view Gravity RIGHT.

Prototype

int RIGHT

To view the source code for android.view Gravity RIGHT.

Click Source Link

Document

Push object to the right of its container, not changing its size.

Usage

From source file:com.farmerbb.taskbar.activity.ContextMenuActivity.java

@SuppressLint("RtlHardcoded")
@SuppressWarnings("deprecation")
@Override//ww w .  j  a  v  a 2s  .co  m
protected void onPostCreate(Bundle savedInstanceState) {
    super.onPostCreate(savedInstanceState);

    LocalBroadcastManager.getInstance(this)
            .sendBroadcast(new Intent("com.farmerbb.taskbar.CONTEXT_MENU_APPEARING"));

    boolean isNonAppMenu = !getIntent().hasExtra("package_name") && !getIntent().hasExtra("app_name");
    showStartMenu = getIntent().getBooleanExtra("launched_from_start_menu", false);
    isStartButton = isNonAppMenu && getIntent().getBooleanExtra("is_start_button", false);
    isOverflowMenu = isNonAppMenu && getIntent().getBooleanExtra("is_overflow_menu", false);
    contextMenuFix = getIntent().hasExtra("context_menu_fix");

    // Determine where to position the dialog on screen
    WindowManager.LayoutParams params = getWindow().getAttributes();
    DisplayManager dm = (DisplayManager) getSystemService(DISPLAY_SERVICE);
    Display display = dm.getDisplay(Display.DEFAULT_DISPLAY);

    int statusBarHeight = 0;
    int resourceId = getResources().getIdentifier("status_bar_height", "dimen", "android");
    if (resourceId > 0)
        statusBarHeight = getResources().getDimensionPixelSize(resourceId);

    if (showStartMenu) {
        int x = getIntent().getIntExtra("x", 0);
        int y = getIntent().getIntExtra("y", 0);
        int offset = getResources().getDimensionPixelSize(
                isOverflowMenu ? R.dimen.context_menu_offset_overflow : R.dimen.context_menu_offset);

        switch (U.getTaskbarPosition(this)) {
        case "bottom_left":
        case "bottom_vertical_left":
            params.gravity = Gravity.BOTTOM | Gravity.LEFT;
            params.x = x;
            params.y = display.getHeight() - y - offset;
            break;
        case "bottom_right":
        case "bottom_vertical_right":
            params.gravity = Gravity.BOTTOM | Gravity.LEFT;
            params.x = x - getResources().getDimensionPixelSize(R.dimen.context_menu_width) + offset + offset;
            params.y = display.getHeight() - y - offset;
            break;
        case "top_left":
        case "top_vertical_left":
            params.gravity = Gravity.TOP | Gravity.LEFT;
            params.x = x;
            params.y = y - offset + statusBarHeight;
            break;
        case "top_right":
        case "top_vertical_right":
            params.gravity = Gravity.TOP | Gravity.LEFT;
            params.x = x - getResources().getDimensionPixelSize(R.dimen.context_menu_width) + offset + offset;
            params.y = y - offset + statusBarHeight;
            break;
        }
    } else {
        LocalBroadcastManager.getInstance(this)
                .sendBroadcast(new Intent("com.farmerbb.taskbar.HIDE_START_MENU"));

        int x = getIntent().getIntExtra("x", display.getWidth());
        int y = getIntent().getIntExtra("y", display.getHeight());
        int offset = getResources().getDimensionPixelSize(R.dimen.icon_size);

        switch (U.getTaskbarPosition(this)) {
        case "bottom_left":
            params.gravity = Gravity.BOTTOM | Gravity.LEFT;
            params.x = isStartButton ? 0 : x;
            params.y = offset;
            break;
        case "bottom_vertical_left":
            params.gravity = Gravity.BOTTOM | Gravity.LEFT;
            params.x = offset;
            params.y = display.getHeight() - y - (isStartButton ? 0 : offset);
            break;
        case "bottom_right":
            params.gravity = Gravity.BOTTOM | Gravity.RIGHT;
            params.x = display.getWidth() - x;
            params.y = offset;
            break;
        case "bottom_vertical_right":
            params.gravity = Gravity.BOTTOM | Gravity.RIGHT;
            params.x = offset;
            params.y = display.getHeight() - y - (isStartButton ? 0 : offset);
            break;
        case "top_left":
            params.gravity = Gravity.TOP | Gravity.LEFT;
            params.x = isStartButton ? 0 : x;
            params.y = offset;
            break;
        case "top_vertical_left":
            params.gravity = Gravity.TOP | Gravity.LEFT;
            params.x = offset;
            params.y = isStartButton ? 0 : y - statusBarHeight;
            break;
        case "top_right":
            params.gravity = Gravity.TOP | Gravity.RIGHT;
            params.x = display.getWidth() - x;
            params.y = offset;
            break;
        case "top_vertical_right":
            params.gravity = Gravity.TOP | Gravity.RIGHT;
            params.x = offset;
            params.y = isStartButton ? 0 : y - statusBarHeight;
            break;
        }
    }

    params.width = getResources().getDimensionPixelSize(R.dimen.context_menu_width);
    params.dimAmount = 0;

    getWindow().setAttributes(params);

    View view = findViewById(android.R.id.list);
    if (view != null)
        view.setPadding(0, 0, 0, 0);

    generateMenu();

    IntentFilter intentFilter = new IntentFilter();
    intentFilter.addAction("com.farmerbb.taskbar.START_MENU_APPEARING");
    intentFilter.addAction("com.farmerbb.taskbar.DASHBOARD_APPEARING");

    LocalBroadcastManager.getInstance(this).registerReceiver(finishReceiver, intentFilter);
}

From source file:com.ryan.ryanreader.activities.CaptchaActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {

    PrefsUtility.applyTheme(this);
    getSupportActionBar().setTitle(R.string.post_captcha_title);

    super.onCreate(savedInstanceState);

    final LoadingView loadingView = new LoadingView(this, R.string.download_waiting, true, true);
    setContentView(loadingView);//from   w w w . j  av a2s  . c  om

    final RedditAccount selectedAccount = RedditAccountManager.getInstance(this)
            .getAccount(getIntent().getStringExtra("username"));

    final CacheManager cm = CacheManager.getInstance(this);

    RedditAPI.newCaptcha(cm, new APIResponseHandler.NewCaptchaResponseHandler(this) {
        @Override
        protected void onSuccess(final String captchaId) {

            final URI captchaUrl = Constants.Reddit.getUri("/captcha/" + captchaId);

            cm.makeRequest(new CacheRequest(captchaUrl, RedditAccountManager.getAnon(), null,
                    Constants.Priority.CAPTCHA, 0, CacheRequest.DownloadType.FORCE, Constants.FileType.CAPTCHA,
                    false, false, true, CaptchaActivity.this) {
                @Override
                protected void onCallbackException(Throwable t) {
                    BugReportActivity.handleGlobalError(CaptchaActivity.this, t);
                }

                @Override
                protected void onDownloadNecessary() {
                }

                @Override
                protected void onDownloadStarted() {
                    loadingView.setIndeterminate(R.string.download_downloading);
                }

                @Override
                protected void onFailure(RequestFailureType type, Throwable t, StatusLine status,
                        String readableMessage) {
                    final RRError error = General.getGeneralErrorForFailure(CaptchaActivity.this, type, t,
                            status);
                    General.showResultDialog(CaptchaActivity.this, error);
                    finish();
                }

                @Override
                protected void onProgress(long bytesRead, long totalBytes) {
                    loadingView.setProgress(R.string.download_downloading,
                            (float) ((double) bytesRead / (double) totalBytes));
                }

                @Override
                protected void onSuccess(final CacheManager.ReadableCacheFile cacheFile, long timestamp,
                        UUID session, boolean fromCache, String mimetype) {

                    final Bitmap image;
                    try {
                        image = BitmapFactory.decodeStream(cacheFile.getInputStream());
                    } catch (IOException e) {
                        BugReportActivity.handleGlobalError(CaptchaActivity.this, e);
                        return;
                    }

                    new Handler(Looper.getMainLooper()).post(new Runnable() {
                        public void run() {

                            final LinearLayout ll = new LinearLayout(CaptchaActivity.this);
                            ll.setOrientation(LinearLayout.VERTICAL);

                            final ImageView captchaImg = new ImageView(CaptchaActivity.this);
                            ll.addView(captchaImg);
                            final LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) captchaImg
                                    .getLayoutParams();
                            layoutParams.setMargins(20, 20, 20, 20);
                            layoutParams.height = General.dpToPixels(context, 100);
                            captchaImg.setScaleType(ImageView.ScaleType.FIT_CENTER);

                            final EditText captchaText = new EditText(CaptchaActivity.this);
                            ll.addView(captchaText);
                            ((LinearLayout.LayoutParams) captchaText.getLayoutParams()).setMargins(20, 0, 20,
                                    20);
                            captchaText.setInputType(android.text.InputType.TYPE_CLASS_TEXT
                                    | android.text.InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD
                                    | InputType.TYPE_TEXT_FLAG_CAP_CHARACTERS);

                            captchaImg.setImageBitmap(image);

                            final Button submitButton = new Button(CaptchaActivity.this);
                            submitButton.setText(R.string.post_captcha_submit_button);
                            ll.addView(submitButton);
                            ((LinearLayout.LayoutParams) submitButton.getLayoutParams()).setMargins(20, 0, 20,
                                    20);
                            ((LinearLayout.LayoutParams) submitButton
                                    .getLayoutParams()).gravity = Gravity.RIGHT;
                            ((LinearLayout.LayoutParams) submitButton
                                    .getLayoutParams()).width = LinearLayout.LayoutParams.WRAP_CONTENT;

                            submitButton.setOnClickListener(new View.OnClickListener() {
                                public void onClick(View v) {
                                    final Intent result = new Intent();
                                    result.putExtra("captchaId", captchaId);
                                    result.putExtra("captchaText", captchaText.getText().toString());
                                    setResult(RESULT_OK, result);
                                    finish();
                                }
                            });

                            final ScrollView sv = new ScrollView(CaptchaActivity.this);
                            sv.addView(ll);
                            setContentView(sv);
                        }
                    });

                }
            });
        }

        @Override
        protected void onCallbackException(Throwable t) {
            BugReportActivity.handleGlobalError(CaptchaActivity.this, t);
        }

        @Override
        protected void onFailure(RequestFailureType type, Throwable t, StatusLine status,
                String readableMessage) {
            final RRError error = General.getGeneralErrorForFailure(CaptchaActivity.this, type, t, status);
            General.showResultDialog(CaptchaActivity.this, error);
            finish();
        }

        @Override
        protected void onFailure(APIFailureType type) {
            final RRError error = General.getGeneralErrorForFailure(CaptchaActivity.this, type);
            General.showResultDialog(CaptchaActivity.this, error);
            finish();
        }
    }, selectedAccount, this);
}

From source file:com.metinkale.prayerapp.BaseActivity.java

@SuppressLint("RtlHardcoded")
@Override/*from w ww. j a  va2 s .co m*/
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case android.R.id.home:
        mDrawerLayout.openDrawer(isRTL() ? Gravity.RIGHT : Gravity.LEFT);
        return true;
    default:
        return super.onOptionsItemSelected(item);
    }
}

From source file:angeloid.dreamnarae.SwipeyTabs.java

/**
 * Update the ellipsize of the text views
 *///from w  ww  .  ja v a 2 s. co  m
private void updateEllipsize() {
    if (mAdapter == null) {
        return;
    }

    final int count = mAdapter.getCount();

    for (int i = 0; i < count; i++) {
        TextView tab = (TextView) getChildAt(i);

        if (i < mCurrentPos) {
            tab.setEllipsize(null);
            tab.setGravity(Gravity.RIGHT | Gravity.CENTER_VERTICAL);
        } else if (i == mCurrentPos) {
            tab.setEllipsize(TruncateAt.END);
            tab.setGravity(Gravity.LEFT | Gravity.CENTER_VERTICAL);
        } else if (i > mCurrentPos) {
            tab.setEllipsize(null);
            tab.setGravity(Gravity.LEFT | Gravity.CENTER_VERTICAL);
        }
    }
}

From source file:org.quantumbadger.redreader.activities.CaptchaActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {

    PrefsUtility.applyTheme(this);
    getSupportActionBar().setTitle(R.string.post_captcha_title);

    super.onCreate(savedInstanceState);

    final LoadingView loadingView = new LoadingView(this, R.string.download_waiting, true, true);
    setContentView(loadingView);/*from w w w  .  j av  a 2 s .c  o  m*/

    final RedditAccount selectedAccount = RedditAccountManager.getInstance(this)
            .getAccount(getIntent().getStringExtra("username"));

    final CacheManager cm = CacheManager.getInstance(this);

    RedditAPI.newCaptcha(cm, new APIResponseHandler.NewCaptchaResponseHandler(this) {
        @Override
        protected void onSuccess(final String captchaId) {

            final URI captchaUrl = Constants.Reddit.getUri("/captcha/" + captchaId);

            cm.makeRequest(new CacheRequest(captchaUrl, RedditAccountManager.getAnon(), null,
                    Constants.Priority.CAPTCHA, 0, CacheRequest.DownloadType.FORCE, Constants.FileType.CAPTCHA,
                    false, false, true, CaptchaActivity.this) {
                @Override
                protected void onCallbackException(Throwable t) {
                    BugReportActivity.handleGlobalError(CaptchaActivity.this, t);
                }

                @Override
                protected void onDownloadNecessary() {
                }

                @Override
                protected void onDownloadStarted() {
                    loadingView.setIndeterminate(R.string.download_downloading);
                }

                @Override
                protected void onFailure(RequestFailureType type, Throwable t, StatusLine status,
                        String readableMessage) {
                    final RRError error = General.getGeneralErrorForFailure(CaptchaActivity.this, type, t,
                            status, url.toString());
                    General.showResultDialog(CaptchaActivity.this, error);
                    finish();
                }

                @Override
                protected void onProgress(long bytesRead, long totalBytes) {
                    loadingView.setProgress(R.string.download_downloading,
                            (float) ((double) bytesRead / (double) totalBytes));
                }

                @Override
                protected void onSuccess(final CacheManager.ReadableCacheFile cacheFile, long timestamp,
                        UUID session, boolean fromCache, String mimetype) {

                    final Bitmap image;
                    try {
                        image = BitmapFactory.decodeStream(cacheFile.getInputStream());
                    } catch (IOException e) {
                        BugReportActivity.handleGlobalError(CaptchaActivity.this, e);
                        return;
                    }

                    new Handler(Looper.getMainLooper()).post(new Runnable() {
                        public void run() {

                            final LinearLayout ll = new LinearLayout(CaptchaActivity.this);
                            ll.setOrientation(LinearLayout.VERTICAL);

                            final ImageView captchaImg = new ImageView(CaptchaActivity.this);
                            ll.addView(captchaImg);
                            final LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) captchaImg
                                    .getLayoutParams();
                            layoutParams.setMargins(20, 20, 20, 20);
                            layoutParams.height = General.dpToPixels(context, 100);
                            captchaImg.setScaleType(ImageView.ScaleType.FIT_CENTER);

                            final EditText captchaText = new EditText(CaptchaActivity.this);
                            ll.addView(captchaText);
                            ((LinearLayout.LayoutParams) captchaText.getLayoutParams()).setMargins(20, 0, 20,
                                    20);
                            captchaText.setInputType(android.text.InputType.TYPE_CLASS_TEXT
                                    | android.text.InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD
                                    | InputType.TYPE_TEXT_FLAG_CAP_CHARACTERS);

                            captchaImg.setImageBitmap(image);

                            final Button submitButton = new Button(CaptchaActivity.this);
                            submitButton.setText(R.string.post_captcha_submit_button);
                            ll.addView(submitButton);
                            ((LinearLayout.LayoutParams) submitButton.getLayoutParams()).setMargins(20, 0, 20,
                                    20);
                            ((LinearLayout.LayoutParams) submitButton
                                    .getLayoutParams()).gravity = Gravity.RIGHT;
                            ((LinearLayout.LayoutParams) submitButton
                                    .getLayoutParams()).width = LinearLayout.LayoutParams.WRAP_CONTENT;

                            submitButton.setOnClickListener(new View.OnClickListener() {
                                public void onClick(View v) {
                                    final Intent result = new Intent();
                                    result.putExtra("captchaId", captchaId);
                                    result.putExtra("captchaText", captchaText.getText().toString());
                                    setResult(RESULT_OK, result);
                                    finish();
                                }
                            });

                            final ScrollView sv = new ScrollView(CaptchaActivity.this);
                            sv.addView(ll);
                            setContentView(sv);
                        }
                    });

                }
            });
        }

        @Override
        protected void onCallbackException(Throwable t) {
            BugReportActivity.handleGlobalError(CaptchaActivity.this, t);
        }

        @Override
        protected void onFailure(RequestFailureType type, Throwable t, StatusLine status,
                String readableMessage) {
            final RRError error = General.getGeneralErrorForFailure(CaptchaActivity.this, type, t, status,
                    null);
            General.showResultDialog(CaptchaActivity.this, error);
            finish();
        }

        @Override
        protected void onFailure(APIFailureType type) {
            final RRError error = General.getGeneralErrorForFailure(CaptchaActivity.this, type);
            General.showResultDialog(CaptchaActivity.this, error);
            finish();
        }
    }, selectedAccount, this);
}

From source file:com.nikola.despotoski.drawerlayoutedgetoggle.DrawerLayoutEdgeToggle.java

@Override
public void onDrawerClosed(View arg0) {
    mHandle.setImageDrawable(mCloseDrawable);
    updateActionBar();/*from  www  . j a v  a 2 s  . c om*/
    mCurrentDrawable = mCloseDrawable;
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
        ViewHelper.setX(mHandle,
                mGravity == GravityCompat.END || mGravity == Gravity.RIGHT ? getScreenWidth() : 0);
        ViewHelper.setY(mHandle, mY);
    }

}

From source file:android.support.transition.Slide.java

/**
 * Change the edge that Views appear and disappear from.
 *
 * @param slideEdge The edge of the scene to use for Views appearing and disappearing. One of
 *                  {@link android.view.Gravity#LEFT}, {@link android.view.Gravity#TOP},
 *                  {@link android.view.Gravity#RIGHT}, {@link android.view.Gravity#BOTTOM},
 *                  {@link android.view.Gravity#START}, {@link android.view.Gravity#END}.
 *//* ww  w  . j a va  2  s .c  o m*/
public void setSlideEdge(@GravityFlag int slideEdge) {
    switch (slideEdge) {
    case Gravity.LEFT:
        mSlideCalculator = sCalculateLeft;
        break;
    case Gravity.TOP:
        mSlideCalculator = sCalculateTop;
        break;
    case Gravity.RIGHT:
        mSlideCalculator = sCalculateRight;
        break;
    case Gravity.BOTTOM:
        mSlideCalculator = sCalculateBottom;
        break;
    case Gravity.START:
        mSlideCalculator = sCalculateStart;
        break;
    case Gravity.END:
        mSlideCalculator = sCalculateEnd;
        break;
    default:
        throw new IllegalArgumentException("Invalid slide direction");
    }
    mSlideEdge = slideEdge;
    SidePropagation propagation = new SidePropagation();
    propagation.setSide(slideEdge);
    setPropagation(propagation);
}

From source file:com.cssweb.android.quote.QuoteDetail.java

/**
 * // w w w  .j a  va 2  s.  com
 * @param jArr
 * @param table
 * @param zrsp
 * @throws JSONException
 */
private void appendRow(JSONArray jArr, TableLayout table, double zrsp) throws JSONException {
    table.setStretchAllColumns(true);
    table.removeAllViews();

    if ("cf".equals(exchange.toLowerCase()) || "dc".equals(exchange.toLowerCase())
            || "sf".equals(exchange.toLowerCase()) || "cz".equals(exchange.toLowerCase())) {
        int len = jArr.length();
        int color = Utils.getTextColor(mContext, 0);
        for (int i = 0; i < len; i++) {
            LinearLayout linearLayout = (LinearLayout) findViewById(R.id.title23);
            linearLayout.setVisibility(View.VISIBLE);

            JSONArray jA = (JSONArray) jArr.get(i);
            TableRow row = (TableRow) LayoutInflater.from(this).inflate(R.layout.zr_quote_price_item, null);
            TextView t1 = (TextView) row.findViewById(R.id.zr_table_col1);
            TextView t2 = (TextView) row.findViewById(R.id.zr_table_col2);
            TextView t3 = (TextView) row.findViewById(R.id.zr_table_col3);
            TextView t4 = (TextView) row.findViewById(R.id.zr_table_col4);
            TextView t5 = (TextView) row.findViewById(R.id.zr_table_col5);
            t1.setText(jA.getString(4));
            t2.setText(Utils.dataFormation(jA.getDouble(0), Utils.getStockDigit(type)));
            t2.setTextColor(Utils.getTextColor(mContext, jA.getDouble(0), zrsp));
            t2.setGravity(Gravity.RIGHT | Gravity.CENTER_VERTICAL);
            double cjsl = Arith.round(jA.getDouble(1), 0);
            t3.setText(Utils.dataFormation(cjsl, 0));
            t3.setGravity(Gravity.RIGHT | Gravity.CENTER_VERTICAL);
            t4.setText(jA.getString(7));
            t5.setText(jA.getString(8));
            table.addView(row);
            if ("B".equals(jA.getString(6))) {
                color = Utils.getTextColor(mContext, 3);
                t3.setTextColor(color);
                t4.setTextColor(color);
                t5.setTextColor(color);
            } else if ("S".equals(jA.getString(6))) {
                color = Utils.getTextColor(mContext, 4);
                t3.setTextColor(color);
                t4.setTextColor(color);
                t5.setTextColor(color);
            } else {
                t3.setTextColor(color);
                t4.setTextColor(color);
                t5.setTextColor(color);
            }
        }
    } else {
        if (stocktype.charAt(0) == '0') {//
            //for (int i = jArr.length()-1; i >= 0; i--) {
            for (int i = 0; i <= jArr.length() - 1; i++) {
                JSONArray jA = (JSONArray) jArr.get(i);
                TableRow row = (TableRow) LayoutInflater.from(this).inflate(R.layout.zr_quote_price_item, null);
                TextView t1 = (TextView) row.findViewById(R.id.zr_table_col1);
                TextView t2 = (TextView) row.findViewById(R.id.zr_table_col2);
                TextView t3 = (TextView) row.findViewById(R.id.zr_table_col3);
                TextView t4 = (TextView) row.findViewById(R.id.zr_table_col4);
                t1.setText(jA.getString(4));
                t2.setText(Utils.dataFormation(jA.getDouble(0), Utils.getStockDigit(type)));
                t2.setTextColor(Utils.getTextColor(mContext, jA.getDouble(0), zrsp));
                t2.setGravity(Gravity.RIGHT | Gravity.CENTER_VERTICAL);
                double cjsl = Arith.round(jA.getDouble(1), 0);
                t3.setText(Utils.dataFormation(cjsl, 0));
                if (cjsl > 500)
                    t3.setTextColor(Utils.getTextColor(mContext, 6));
                else
                    t3.setTextColor(Utils.getTextColor(mContext, 1));
                t3.setGravity(Gravity.RIGHT | Gravity.CENTER_VERTICAL);
                t4.setText(jA.getString(6));
                if ("B".equals(jA.getString(6)))
                    t4.setTextColor(Utils.getTextColor(mContext, 3));
                else
                    t4.setTextColor(Utils.getTextColor(mContext, 4));
                table.addView(row);
            }
            //?
            int num = jArr.length();
            if (num < 16) {
                while (num < 16) {
                    TableRow row = (TableRow) LayoutInflater.from(this).inflate(R.layout.zr_quote_price_item,
                            null);
                    table.addView(row);
                    num++;
                }
            }
        } else if (stocktype.charAt(0) == '1' || stocktype.charAt(0) == '2') {//
            //for (int i = jArr.length()-1; i >= 0; i--) {
            for (int i = 0; i <= jArr.length() - 1; i++) {
                JSONArray jA = (JSONArray) jArr.get(i);
                TableRow row = (TableRow) LayoutInflater.from(this).inflate(R.layout.zr_quote_price_item, null);
                TextView t1 = (TextView) row.findViewById(R.id.zr_table_col1);
                TextView t2 = (TextView) row.findViewById(R.id.zr_table_col2);
                TextView t3 = (TextView) row.findViewById(R.id.zr_table_col4);
                t1.setText(jA.getString(4));
                t2.setText(Utils.dataFormation(jA.getDouble(0), Utils.getStockDigit(type)));
                t2.setTextColor(Utils.getTextColor(mContext, jA.getDouble(0), zrsp));
                t3.setText(Utils.getAmountFormat(jA.getDouble(5), true));
                t3.setTextColor(Utils.getTextColor(mContext, 1));
                table.addView(row);
            }
            //?
            int num = jArr.length();
            if (num < 16) {
                while (num < 16) {
                    TableRow row = (TableRow) LayoutInflater.from(this).inflate(R.layout.zr_quote_price_item,
                            null);
                    table.addView(row);
                    num++;
                }
            }
        }
    }

}

From source file:de.localtoast.launchit.BackgroundService.java

private WindowManager.LayoutParams getTouchAreaLayoutParams() {
    Settings settings = new Settings(getBaseContext());
    WindowManager.LayoutParams params = new WindowManager.LayoutParams(settings.getTouchAreaWidth(),
            settings.getTouchAreaHeight(), WindowManager.LayoutParams.TYPE_PHONE,
            receiveTouchEvents | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE, PixelFormat.TRANSLUCENT);

    int horizontalPos = Gravity.RIGHT;
    if (settings.isTouchAreaPositionLeftEdge()) {
        horizontalPos = Gravity.LEFT;//from   ww  w  . j  av a2s .co m
    }
    params.gravity = Gravity.TOP | horizontalPos;
    params.y = settings.getTouchAreaHorizontalPosition();
    return params;
}

From source file:com.chess.genesis.view.SwipeTabs.java

/**
 * Update the ellipsize of the text views
 *//*  w w w  .jav a2s .c  om*/
private void updateEllipsize() {
    if (mAdapter == null)
        return;

    final int count = mAdapter.getCount();

    for (int i = 0; i < count; i++) {
        final TextView tab = (TextView) getChildAt(i);

        if (i < mCurrentPos) {
            tab.setEllipsize(null);
            tab.setGravity(Gravity.LEFT | Gravity.CENTER_VERTICAL);
        } else if (i == mCurrentPos) {
            tab.setEllipsize(TruncateAt.END);
            tab.setGravity(Gravity.CENTER | Gravity.CENTER_VERTICAL);
        } else if (i > mCurrentPos) {
            tab.setEllipsize(null);
            tab.setGravity(Gravity.RIGHT | Gravity.CENTER_VERTICAL);
        }
    }
}