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.albedinsky.android.ui.widget.SeekBarWidget.java

/**
 * Draws discrete indicator of this SeekBarWidget at its current position updated by
 * {@link #updateDiscreteIndicatorPosition(int, int)} according to the current progress.
 *
 * @param canvas Canvas on which to draw discrete indicator's drawable.
 *//*ww w.  j  a v  a 2  s .c o  m*/
private void drawDiscreteIndicator(Canvas canvas) {
    if (mDiscreteIndicatorHeight == 0) {
        return;
    }
    // todo: draw according to LTR/RTL layout direction.
    mDiscreteIndicator.draw(canvas);

    // Draw current progress over indicator's graphics.
    final Rect indicatorBounds = mDiscreteIndicator.getBounds();
    final Paint textPaint = DISCRETE_INDICATOR_TEXT_INFO.paint;
    textPaint.getTextBounds("0", 0, 1, mRect);
    final float textSize = mRect.height();
    final Rect textPadding = DISCRETE_INDICATOR_TEXT_INFO.padding;
    final int absoluteTextGravity = WidgetGravity.getAbsoluteGravity(DISCRETE_INDICATOR_TEXT_INFO.gravity,
            ViewCompat.getLayoutDirection(this));

    final float textX, textY;
    // Resolve horizontal text position according to the requested gravity.
    switch (absoluteTextGravity & Gravity.HORIZONTAL_GRAVITY_MASK) {
    case Gravity.CENTER_HORIZONTAL:
        textPaint.setTextAlign(Paint.Align.CENTER);
        textX = indicatorBounds.centerX();
        break;
    case Gravity.RIGHT:
        textPaint.setTextAlign(Paint.Align.RIGHT);
        textX = indicatorBounds.right - textPadding.right;
        break;
    case Gravity.LEFT:
    default:
        textPaint.setTextAlign(Paint.Align.LEFT);
        textX = indicatorBounds.left + textPadding.left;
        break;
    }
    // Resolve vertical text position according to the requested gravity.
    switch (absoluteTextGravity & Gravity.VERTICAL_GRAVITY_MASK) {
    case Gravity.CENTER_VERTICAL:
        textY = indicatorBounds.centerY() + textSize / 2f;
        break;
    case Gravity.BOTTOM:
        textY = indicatorBounds.bottom - textPadding.bottom;
        break;
    case Gravity.TOP:
    default:
        textY = indicatorBounds.top + textSize + textPadding.top;
        break;
    }
    canvas.drawText(Integer.toString(getProgress()), textX, textY, textPaint);
}

From source file:com.zyk.drawerlayout.widget.DrawerLayout.java

/**
 * @param size header/  ??dp/*from  ww  w .  ja  va2s .c o  m*/
 * @param gravity Gravity.LEFT add to left drawer or Gravity.RIGHT for the right or
 *                Gravity.TOP for the top or Gravity.BOTTOM for the bottom.
 *                GravityCompat.START or GravityCompat.END may also be used.
 */
public void setHeader(int size, @EdgeGravity int gravity) {
    final int absGravity = GravityCompat.getAbsoluteGravity(gravity, ViewCompat.getLayoutDirection(this));
    int s = (int) (size * density + 0.5f);
    if (absGravity == Gravity.LEFT) {
        mLeftHeader = s;
    } else if (absGravity == Gravity.TOP) {
        mTopHeader = s;
    } else if (absGravity == Gravity.RIGHT) {
        mRightHeader = s;
    } else {
        mBottomHeader = s;
    }
    invalidate();
}

From source file:com.skytree.epubtest.BookViewActivity.java

public void fillHighlightList() {
    Theme theme = getCurrentTheme();/*from   w ww  . ja v a2 s.com*/
    int textColor = theme.foregroundColor;
    this.listView.removeAllViews();
    Highlights highlights = sd.fetchAllHighlights(this.bookCode);
    for (int i = 0; i < highlights.getSize(); i++) {
        Highlight highlight = highlights.getHighlight(i);
        SkyLayout item = new SkyLayout(this);
        int ci = highlight.chapterIndex;
        if (rv.isRTL()) {
            ci = rv.getNumberOfChapters() - ci - 1;
        }
        String chapterTitle = rv.getChapterTitle(ci);
        if (chapterTitle == null || chapterTitle.isEmpty())
            chapterTitle = "Chapter " + ci;

        TextView chapterLabel = this.makeLabel(9899, chapterTitle, Gravity.LEFT, 16, textColor);
        setFrame(chapterLabel, ps(20), ps(5), this.listView.getWidth() - ps(20), ps(40));
        item.addView(chapterLabel);

        GradientDrawable textGrad = new GradientDrawable(Orientation.TOP_BOTTOM,
                new int[] { getBrighterColor(highlight.color), getDarkerColor(highlight.color) });
        TextView textLabel = this.makeLabel(9899, highlight.text, Gravity.LEFT, 16, Color.BLACK);
        setFrame(textLabel, ps(20), ps(5 + 40 + 5), this.listView.getWidth() - ps(20), ps(70));
        textLabel.setBackgroundDrawable(textGrad);
        textLabel.getBackground().setAlpha(180);

        item.addView(textLabel);

        int noteHeight = 0;

        if (highlight.isNote && highlight.note != null && highlight.note.length() != 0
                && !highlight.note.equalsIgnoreCase("null")) {
            TextView noteLabel = this.makeLabel(9899, highlight.note, Gravity.LEFT, 16, Color.BLACK);
            noteLabel.setTextColor(getDarkerColor(highlight.color));
            noteHeight = 70;
            setFrame(noteLabel, ps(20), ps(5 + 40 + 5 + 70 + 5), this.listView.getWidth() - ps(20),
                    ps(noteHeight));
            item.addView(noteLabel);
        }

        TextView dateLabel = this.makeLabel(9899, highlight.datetime, Gravity.RIGHT, 12, textColor);
        int lw = this.listView.getWidth();
        setFrame(dateLabel, 0, ps(5 + 40 + 5 + 70 + 5 + noteHeight + 5), lw, ps(40));
        item.addView(dateLabel);

        int itemHeight = ps(5 + 40 + 5 + 90 + 5 + noteHeight + 5 + 15 + 5);

        View lineView = new View(this);
        lineView.setBackgroundColor(Color.LTGRAY);
        setFrame(lineView, 0, itemHeight - ps(1), this.listView.getWidth(), ps(1));
        item.addView(lineView);

        setFrame(item, 0, 0, listView.getWidth(), itemHeight);
        item.setSkyLayoutListener(highlightListDelegate);
        item.setId(highlight.code);
        item.data = highlight;

        Button deleteButton = new Button(this);
        GradientDrawable grad = new GradientDrawable(Orientation.TOP_BOTTOM,
                new int[] { 0xffcf666e, 0xff671521 });
        grad.setStroke(ps(2), 0xff282828);
        deleteButton.setBackgroundDrawable(grad);
        deleteButton.setText(getString(R.string.delete));
        deleteButton.setTypeface(null, Typeface.BOLD);
        deleteButton.setTextColor(Color.WHITE);
        deleteButton.setTextSize(12);
        deleteButton.setId(highlight.code);
        deleteButton.setVisibility(View.INVISIBLE);
        deleteButton.setVisibility(View.GONE);
        deleteButton.setOnClickListener(deleteHighlightDelegate);
        int dw = ps(120);
        int dh = ps(50);
        setFrame(deleteButton, this.listView.getWidth() - dw, (itemHeight - dh) / 2, dw, dh);
        item.deleteControl = deleteButton;
        item.addView(deleteButton);

        this.listView.addView(item);
    }
}

From source file:com.klinker.android.launcher.launcher3.Launcher.java

@Override
public void onBackPressed() {
    if (mLauncherDrawer.isDrawerOpen(Gravity.LEFT)) {
        mLauncherDrawer.closeDrawer(Gravity.LEFT);
    } else if (mLauncherDrawer.isDrawerOpen(Gravity.RIGHT)) {
        mLauncherDrawer.closeDrawer(Gravity.RIGHT);
    } else if (isAllAppsVisible()) {
        showWorkspace(true);//from   www . j  a va  2s.co  m
    } else if (isWidgetsViewVisible()) {
        showOverviewMode(true);
    } else if (mWorkspace.isInOverviewMode()) {
        showWorkspace(true);
    } else if (mWorkspace.getOpenFolder() != null) {
        Folder openFolder = mWorkspace.getOpenFolder();
        if (openFolder.isEditingName()) {
            openFolder.dismissEditingName();
        } else {
            closeFolder();
        }
    } else {
        // run the gesture for back button
        GestureUtils.runGesture(this, Launcher.this, AppSettings.BACK_BUTTON);
    }
}

From source file:com.bookkos.bircle.CaptureActivity.java

private void setBookRegistView() {
    int bookRegistRelativeLayout_width = displayWidth;
    int bookRegistRelativeLayout_height = displayHeight / 4;
    int bookRegistRelativeLayout_x = 0;
    int bookRegistRelativeLayout_y = displayHeight;
    bookRegistRelativeLayout.setTranslationX(bookRegistRelativeLayout_x);
    bookRegistRelativeLayout.setTranslationY(bookRegistRelativeLayout_y);
    bookRegistRelativeLayout.setLayoutParams(
            new FrameLayout.LayoutParams(bookRegistRelativeLayout_width, bookRegistRelativeLayout_height));

    int bookRegistLinearLayout_width = displayWidth;
    int bookRegistLinearLayout_height = bookRegistRelativeLayout_height / 3;
    bookRegistLinearLayout.setLayoutParams(
            new RelativeLayout.LayoutParams(bookRegistLinearLayout_width, bookRegistLinearLayout_height));
    RelativeLayout.LayoutParams params1 = (RelativeLayout.LayoutParams) bookRegistLinearLayout
            .getLayoutParams();/*from ww  w . j  a  v a2 s. co m*/
    params1.addRule(RelativeLayout.ALIGN_PARENT_TOP);
    bookRegistLinearLayout.setLayoutParams(params1);

    int bookRegistListViewLinearLayout_width = displayWidth;
    int bookRegistListViewLinearLayout_height = bookRegistRelativeLayout_height * 2 / 3;
    bookRegistListViewLinearLayout.setLayoutParams(new RelativeLayout.LayoutParams(
            bookRegistListViewLinearLayout_width, bookRegistListViewLinearLayout_height));
    RelativeLayout.LayoutParams params2 = (RelativeLayout.LayoutParams) bookRegistListViewLinearLayout
            .getLayoutParams();
    params2.addRule(RelativeLayout.BELOW, R.id.book_regist_linear_layout);
    bookRegistListViewLinearLayout.setLayoutParams(params2);

    int bookRegistListView_width = bookRegistListViewLinearLayout_width;
    int bookRegistListView_height = bookRegistListViewLinearLayout_height;
    bookRegistListView.setLayoutParams(
            new LinearLayout.LayoutParams(bookRegistListView_width, bookRegistListView_height));
    bookRegistListView.setAdapter(bookListViewAdapter);

    int bookRegistTextView_width = displayWidth * 4 / 5;
    int bookRegistTextView_height = bookRegistLinearLayout_height;
    int bookRegistTextView_x = 0;
    int bookRegistTextView_y = displayHeight;
    bookRegistTextView.setLayoutParams(
            new LinearLayout.LayoutParams(bookRegistTextView_width, bookRegistTextView_height, Gravity.LEFT));
    bookRegistTextView.setText("??");
    bookRegistTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, textSize - displayInch * 1.5f);

    int bookRegistCancelButton_width = displayWidth / 5;
    int bookRegistCancelButton_height = bookRegistLinearLayout_height;
    int bookRegistCancelButton_x = 0;
    int bookRegistCancelButton_y = displayHeight;
    bookRegistCancelButton.setLayoutParams(new LinearLayout.LayoutParams(bookRegistCancelButton_width,
            bookRegistCancelButton_height, Gravity.RIGHT));
    bookRegistCancelButton.setText("");
    bookRegistCancelButton.setTextSize(TypedValue.COMPLEX_UNIT_DIP, textSize - displayInch * 1.5f);
    bookRegistCancelButton.setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
            animateTranslationY(bookRegistRelativeLayout, displayHeight - displayHeight / 4 - titleBarHeight,
                    displayHeight);
            arrayList.clear();
            bookListViewAdapter.clear();
            registButton.setEnabled(true);
            borrowReturnButton.setEnabled(true);
            registButton.setTextColor(Color.WHITE);
        }
    });
}

From source file:com.irccloud.android.activity.MainActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    AlertDialog.Builder builder;/*from w ww  .j  a  v  a 2 s .  c o  m*/
    AlertDialog dialog;

    switch (item.getItemId()) {
    case android.R.id.home:
        if (drawerLayout != null && findViewById(R.id.usersListFragment2) == null) {
            if (drawerLayout.isDrawerOpen(Gravity.LEFT))
                drawerLayout.closeDrawer(Gravity.LEFT);
            else if (drawerLayout.getDrawerLockMode(Gravity.LEFT) == DrawerLayout.LOCK_MODE_UNLOCKED)
                drawerLayout.openDrawer(Gravity.LEFT);
            drawerLayout.closeDrawer(Gravity.RIGHT);
        }
        break;
    case R.id.menu_whois:
        NetworkConnection.getInstance().whois(buffer.cid, buffer.name, null);
        break;
    case R.id.menu_identify:
        NickservFragment nsFragment = new NickservFragment();
        nsFragment.setCid(buffer.cid);
        nsFragment.show(getSupportFragmentManager(), "nickserv");
        break;
    case R.id.menu_add_network:
        addNetwork();
        break;
    case R.id.menu_channel_options:
        ChannelOptionsFragment newFragment = new ChannelOptionsFragment(buffer.cid, buffer.bid);
        newFragment.show(getSupportFragmentManager(), "channeloptions");
        break;
    case R.id.menu_buffer_options:
        BufferOptionsFragment bufferFragment = new BufferOptionsFragment(buffer.cid, buffer.bid, buffer.type);
        bufferFragment.show(getSupportFragmentManager(), "bufferoptions");
        break;
    case R.id.menu_userlist:
        if (drawerLayout != null) {
            if (drawerLayout.isDrawerOpen(Gravity.RIGHT)) {
                drawerLayout.closeDrawers();
            } else {
                if (findViewById(R.id.usersListFragment2) == null)
                    drawerLayout.closeDrawer(Gravity.LEFT);
                drawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED, Gravity.RIGHT);
                drawerLayout.openDrawer(Gravity.RIGHT);
            }
            if (!getSharedPreferences("prefs", 0).getBoolean("userSwipeTip", false)) {
                Toast.makeText(this, "Drag from the edge of the screen to quickly open and close the user list",
                        Toast.LENGTH_LONG).show();
                SharedPreferences.Editor editor = getSharedPreferences("prefs", 0).edit();
                editor.putBoolean("userSwipeTip", true);
                editor.commit();
            }
        }
        return true;
    case R.id.menu_ignore_list:
        Bundle args = new Bundle();
        args.putInt("cid", buffer.cid);
        IgnoreListFragment ignoreList = new IgnoreListFragment();
        ignoreList.setArguments(args);
        ignoreList.show(getSupportFragmentManager(), "ignorelist");
        return true;
    case R.id.menu_ban_list:
        NetworkConnection.getInstance().mode(buffer.cid, buffer.name, "b");
        return true;
    case R.id.menu_leave:
        if (ChannelsDataSource.getInstance().getChannelForBuffer(buffer.bid) == null)
            NetworkConnection.getInstance().join(buffer.cid, buffer.name, null);
        else
            NetworkConnection.getInstance().part(buffer.cid, buffer.name, null);
        return true;
    case R.id.menu_archive:
        if (buffer.archived == 0)
            NetworkConnection.getInstance().archiveBuffer(buffer.cid, buffer.bid);
        else
            NetworkConnection.getInstance().unarchiveBuffer(buffer.cid, buffer.bid);
        return true;
    case R.id.menu_delete:
        builder = new AlertDialog.Builder(MainActivity.this);
        builder.setInverseBackgroundForced(Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB);

        if (buffer.type.equals("console"))
            builder.setTitle("Delete Connection");
        else
            builder.setTitle("Delete History");

        if (buffer.type.equalsIgnoreCase("console"))
            builder.setMessage("Are you sure you want to remove this connection?");
        else if (buffer.type.equalsIgnoreCase("channel"))
            builder.setMessage("Are you sure you want to clear your history in " + buffer.name + "?");
        else
            builder.setMessage("Are you sure you want to clear your history with " + buffer.name + "?");

        builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {

            @Override
            public void onClick(DialogInterface dialog, int which) {
                dialog.dismiss();
            }
        });
        builder.setPositiveButton("Delete", new DialogInterface.OnClickListener() {

            @Override
            public void onClick(DialogInterface dialog, int which) {
                if (buffer.type.equals("console")) {
                    NetworkConnection.getInstance().deleteServer(buffer.cid);
                } else {
                    NetworkConnection.getInstance().deleteBuffer(buffer.cid, buffer.bid);
                }
                dialog.dismiss();
            }
        });
        dialog = builder.create();
        dialog.setOwnerActivity(MainActivity.this);
        dialog.show();
        return true;
    case R.id.menu_editconnection:
        if (!getResources().getBoolean(R.bool.isTablet)) {
            Intent i = new Intent(this, EditConnectionActivity.class);
            i.putExtra("cid", buffer.cid);
            startActivity(i);
        } else {
            EditConnectionFragment editFragment = new EditConnectionFragment();
            editFragment.setCid(buffer.cid);
            editFragment.show(getSupportFragmentManager(), "editconnection");
        }
        return true;
    case R.id.menu_disconnect:
        if (server != null && server.status != null && (server.status.equalsIgnoreCase("waiting_to_retry"))
                || (server.status.contains("connected") && !server.status.startsWith("dis"))) {
            NetworkConnection.getInstance().disconnect(buffer.cid, null);
        } else {
            NetworkConnection.getInstance().reconnect(buffer.cid);
        }
        return true;
    }
    return super.onOptionsItemSelected(item);
}

From source file:com.nttec.everychan.ui.presentation.BoardFragment.java

/**
 *  ?  ? ?//from  w w w  .  ja  va 2s.co  m
 * @param itemPosition ? ? (?)   listView
 * @param isTablet true, ?   (??   ? ??)
 * @param coordinates   ??
 */
private void showPostPopupDialog(final int itemPosition, final boolean isTablet, final Point coordinates,
        final String refererPost) {
    final int bgShadowResource = ThemeUtils.getThemeResId(activity.getTheme(), R.attr.dialogBackgroundShadow);
    final int bgColor = ThemeUtils.getThemeColor(activity.getTheme(), R.attr.activityRootBackground,
            Color.BLACK);
    final int measuredWidth = isTablet ? adapter.measureViewWidth(itemPosition) : -1; //? ??  ? 
    final View tmpV = new View(activity);
    final Dialog tmpDlg = new Dialog(activity);
    tmpDlg.getWindow().setBackgroundDrawableResource(bgShadowResource);
    tmpDlg.requestWindowFeature(Window.FEATURE_NO_TITLE);
    tmpDlg.setCanceledOnTouchOutside(true);
    tmpDlg.setContentView(tmpV);
    final Rect activityWindowRect;
    final int dlgWindowWidth;
    final int dlgWindowHeight;
    if (isTablet) {
        activityWindowRect = new Rect();
        activity.getWindow().getDecorView().getWindowVisibleDisplayFrame(activityWindowRect);
        dlgWindowWidth = Math.max(coordinates.x, activityWindowRect.width() - coordinates.x);
        dlgWindowHeight = Math.max(coordinates.y, activityWindowRect.height() - coordinates.y);
        tmpDlg.getWindow().setLayout(dlgWindowWidth, dlgWindowHeight);
    } else {
        activityWindowRect = null;
        dlgWindowWidth = -1;
        dlgWindowHeight = -1;
    }
    tmpDlg.show();

    Runnable next = new Runnable() {
        @SuppressLint("RtlHardcoded")
        @Override
        public void run() {
            int dlgWidth = tmpV.getWidth();
            int dlgHeight = tmpV.getHeight();
            tmpDlg.hide();
            tmpDlg.cancel();
            int newWidth = isTablet ? Math.min(measuredWidth, dlgWidth) : dlgWidth;

            View view = adapter.getView(itemPosition, null, null, newWidth, refererPost);
            view.setBackgroundColor(bgColor);
            //Logger.d(TAG, "measured: "+view.findViewById(R.id.post_frame_main).getMeasuredWidth()+
            //        "x"+view.findViewById(R.id.post_frame_main).getMeasuredHeight());

            Dialog dialog = new Dialog(activity);
            dialog.getWindow().setBackgroundDrawableResource(bgShadowResource);
            dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
            dialog.setCanceledOnTouchOutside(true);
            dialog.setContentView(view);
            if (isTablet) {
                view.findViewById(R.id.post_frame_main).measure(
                        MeasureSpec.makeMeasureSpec(newWidth, MeasureSpec.EXACTLY),
                        MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED));
                int newWindowWidth = dlgWindowWidth - dlgWidth + newWidth;
                int newWindowHeight = dlgWindowHeight - dlgHeight
                        + Math.min(view.findViewById(R.id.post_frame_main).getMeasuredHeight(), dlgHeight);
                dialog.getWindow().setLayout(newWindowWidth, newWindowHeight);
                WindowManager.LayoutParams params = dialog.getWindow().getAttributes();
                if (coordinates.x > activityWindowRect.width() - coordinates.x
                        && coordinates.x + newWindowWidth > activityWindowRect.width()) {
                    params.x = activityWindowRect.width() - coordinates.x;
                    params.gravity = Gravity.RIGHT;
                } else {
                    params.x = coordinates.x;
                    params.gravity = Gravity.LEFT;
                }
                if (coordinates.y > activityWindowRect.height() - coordinates.y
                        && coordinates.y + newWindowHeight > activityWindowRect.height()) {
                    params.y = activityWindowRect.height() - coordinates.y;
                    params.gravity |= Gravity.BOTTOM;
                } else {
                    params.y = coordinates.y;
                    params.gravity |= Gravity.TOP;
                }
                dialog.getWindow().setAttributes(params);

                //     
                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
                    CompatibilityImpl.setDimAmount(dialog.getWindow(), 0.1f);
                } else {
                    dialog.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
                }
            }
            dialog.show();
            dialogs.add(dialog);
        }
    };

    if (tmpV.getWidth() != 0) {
        next.run();
    } else {
        AppearanceUtils.callWhenLoaded(tmpDlg.getWindow().getDecorView(), next);
    }
}

From source file:de.vanita5.twittnuker.util.Utils.java

public static void showMenuItemToast(final View v, final CharSequence text, final boolean isBottomBar) {
    final int[] screenPos = new int[2];
    final Rect displayFrame = new Rect();
    v.getLocationOnScreen(screenPos);//from   w w  w  .  j a  v a2  s.  c o m
    v.getWindowVisibleDisplayFrame(displayFrame);
    final int width = v.getWidth();
    final int height = v.getHeight();
    final int screenWidth = v.getResources().getDisplayMetrics().widthPixels;
    final Toast cheatSheet = Toast.makeText(v.getContext(), text, Toast.LENGTH_SHORT);
    if (isBottomBar) {
        // Show along the bottom center
        cheatSheet.setGravity(Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL, 0, height);
    } else {
        // Show along the top; follow action buttons
        cheatSheet.setGravity(Gravity.TOP | Gravity.RIGHT, screenWidth - screenPos[0] - width / 2, height);
    }
    cheatSheet.show();
}

From source file:com.klinker.android.launcher.launcher3.Launcher.java

public void lockLauncherDrawer(boolean locked) {
    if (locked) {
        mLauncherDrawer.setDrawerLockMode(LauncherDrawerLayout.LOCK_MODE_LOCKED_CLOSED, Gravity.LEFT);
    } else {/*w  w  w .  j a  va 2s .c o m*/
        mLauncherDrawer.setDrawerLockMode(LauncherDrawerLayout.LOCK_MODE_UNLOCKED, Gravity.LEFT);
    }

    mLauncherDrawer.setDrawerLockMode(LauncherDrawerLayout.LOCK_MODE_UNLOCKED, Gravity.RIGHT);
}