Example usage for android.view Gravity START

List of usage examples for android.view Gravity START

Introduction

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

Prototype

int START

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

Click Source Link

Document

Push object to x-axis position at the start of its container, not changing its size.

Usage

From source file:com.bradbergeron.splitviewcontrollerdemo.activities.MainActivity.java

@Override
public void onBackPressed() {
    if (mDrawerLayout.isDrawerOpen(Gravity.START)) {
        mDrawerLayout.closeDrawer(Gravity.START);

        return;/*  w w w .  j a  v  a2s. co m*/
    }

    final FragmentManager fragmentManager = getFragmentManager();

    if (fragmentManager.getBackStackEntryCount() > 0) {
        fragmentManager.popBackStackImmediate();

        return;
    }

    super.onBackPressed();
}

From source file:com.mishiranu.dashchan.util.DrawerToggle.java

@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2)
public void syncState() {
    if (mode != MODE_DISABLED) {
        if (C.API_LOLLIPOP) {
            arrowDrawable.setPosition(mode == MODE_UP || drawerLayout.isDrawerOpen(Gravity.START) ? 1f : 0f);
            activity.getActionBar().setHomeAsUpIndicator(arrowDrawable);
        } else {//from  ww  w.j  av  a  2s .c  o  m
            slideDrawable.setPosition(drawerLayout.isDrawerOpen(Gravity.START) ? 1f : 0f);
            setActionBarUpIndicatorObsolete(mode == MODE_DRAWER ? slideDrawable : homeAsUpIndicator);
        }
    }
}

From source file:com.ephemeraldreams.gallyshuttle.ui.MainActivity.java

@Override
public void onBackPressed() {
    if (drawerLayout.isDrawerOpen(Gravity.START)) {
        drawerLayout.closeDrawers();//w w  w  .ja  v  a2s.c om
    } else {
        super.onBackPressed();
    }
}

From source file:com.oprisnik.navdrawer.widget.NavDrawerLayout.java

public NavDrawerLayout(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    mEntryList = new ArrayList<NavDrawerEntry>();
    mEntryMap = new HashMap<NavDrawerEntry, View>();
    mHandler = new Handler();
    setDrawerShadow(R.drawable.drawer_shadow, Gravity.START);

    int color = Utils.getAttrColor(R.attr.colorPrimaryDark, context);
    setStatusBarBackgroundColor(color);/*from   w w  w.  j  a v  a  2s . c o m*/

    TypedArray a = context.getTheme().obtainStyledAttributes(attrs, R.styleable.NavDrawerLayout, defStyle, 0);
    try {
        mHasHeader = a.getBoolean(R.styleable.NavDrawerLayout_hasHeader, mHasHeader);
        mHeaderLayoutRes = a.getResourceId(R.styleable.NavDrawerLayout_headerLayout, mHeaderLayoutRes);
    } finally {
        a.recycle();
    }
}

From source file:com.github.pennyfive.cinemafinlando.ui.activity.generic.DrawerActivity.java

@Override
public boolean onPrepareOptionsMenu(Menu menu) {
    if (drawer.isDrawerOpen(Gravity.START)) {
        // Hide contextual menu items when drawer is open, as advised in Design Guidelines.
        hideMenuItems(menu);// w w  w  .  j ava2  s.c  o m
    }
    return super.onPrepareOptionsMenu(menu);
}

From source file:com.chromium.fontinstaller.ui.main.MainActivity.java

@Override
public void onBackPressed() {
    if (drawerLayout.isDrawerOpen(Gravity.START | Gravity.LEFT)) {
        drawerLayout.closeDrawers();//from  w w  w  .j  ava  2s. c  o m
        return;
    }
    super.onBackPressed();
}

From source file:com.grayfox.android.app.activity.MainActivity.java

private void setupNavigationDrawer() {
    drawerToggle = new ActionBarDrawerToggle(this, drawerLayout, toolbar, R.string.drawer_open,
            R.string.drawer_close);//from   www . j ava  2s .  co  m
    drawerLayout.setDrawerShadow(R.drawable.drawer_shadow, Gravity.START);
    drawerLayout.setStatusBarBackground(R.color.primary_dark);
    drawerLayout.setDrawerListener(drawerToggle);
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setHomeButtonEnabled(true);
    setupDrawerMenu();
}

From source file:ac.robinson.bettertogether.ConnectionSetupActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_connection_setup);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);/* w ww.  j  a  va  2 s .  co  m*/

    mBarcodeScannerView = (CompoundBarcodeView) findViewById(R.id.barcode_scanner);
    mCreateHotspotView = (LinearLayout) findViewById(R.id.create_hotspot_view);

    mPluginViewAdapter = new PluginAdapter(ConnectionSetupActivity.this, ConnectionSetupActivity.this);
    mPluginView = (RecyclerView) findViewById(R.id.plugin_view);
    mPluginView.setLayoutManager(
            new LinearLayoutManager(ConnectionSetupActivity.this, LinearLayoutManager.HORIZONTAL, false));
    mPluginView.setHasFixedSize(true);
    mPluginView.setAdapter(mPluginViewAdapter);
    new GravitySnapHelper(Gravity.START, false, mPluginViewAdapter).attachToRecyclerView(mPluginView);

    mQRView = (ImageView) findViewById(R.id.qr_image);
    mFooterText = (TextView) findViewById(R.id.footer_text);

    mConnectionProgressView = (LinearLayout) findViewById(R.id.connecting_hotspot_progress_indicator);
    mConnectionProgressUpdate = (TextView) findViewById(R.id.connecting_hotspot_progress_update_text);

    mConnectionMode = ConnectionMode.SCANNING;
    if (savedInstanceState != null) {
        mConnectionMode = (ConnectionMode) savedInstanceState.getSerializable("mConnectionMode");
    }

    String existingHotspot = getIntent().getStringExtra(RECONNECT_EXISTING_HOTSPOT);
    if (existingHotspot != null) {
        setHotspotUrl(existingHotspot);
        mConnectionMode = ConnectionMode.CONNECTION_INITIATED_CLIENT; // reconnect to existing hotspot if requested
    }

    initialiseCaptureManager(savedInstanceState);

    switch (mConnectionMode) {
    case CONNECTION_INITIATED_HOTSPOT:
        setupHotspotUI();
        break;
    case CONNECTION_INITIATED_CLIENT:
        setupClientUI();
        break;
    case SCANNING:
        break; // nothing to do
    default:
        break;
    }

    updatePluginList();
}

From source file:com.jaspervanriet.huntingthatproduct.Activities.BaseActivity.java

protected void closeNavDrawer() {
    if (mDrawer != null) {
        mDrawer.closeDrawer(Gravity.START);
    }
}

From source file:net.mm2d.dmsexplorer.CdsListActivity.java

private void onCdsItemClick(final View v, final View accent, int position, CdsObject object) {
    if (object.isContainer()) {
        browse(position, object.getObjectId(), object.getTitle(), true);
        return;/*w w w .j  av  a 2s  .  c om*/
    }
    if (mTwoPane) {
        if (mSelectedObject != null && mSelectedObject.equals(object)) {
            return;
        }
        mCdsDetailFragment = CdsDetailFragment.newInstance(mServer.getUdn(), object);
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            mCdsDetailFragment.setEnterTransition(new Slide(Gravity.START));
        }
        getSupportFragmentManager().beginTransaction().replace(R.id.cds_detail_container, mCdsDetailFragment)
                .commit();
    } else {
        final Intent intent = CdsDetailActivity.makeIntent(v.getContext(), mServer.getUdn(), object);
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            startActivity(intent, ActivityOptions
                    .makeSceneTransitionAnimation(CdsListActivity.this, accent, "share").toBundle());
        } else {
            startActivity(intent);
        }
    }
    mSelectedObject = object;
    mCdsListAdapter.setSelection(position);
}