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:app.hanks.com.conquer.activity.MainActivity.java

@Subscribe
public void goUserData(MenuPhotoClickEvent event) {
    if (drawerLayout.isDrawerOpen(Gravity.START)) {
        drawerLayout.closeDrawer(Gravity.START);
        //            A.goOtherActivity(context, UserDataActivity.class);
        userDataFlag = true;/*from   ww w  .  j  av  a2 s . c o  m*/
    }
}

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

@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2)
public void setDrawerIndicatorMode(int mode) {
    if (this.mode != mode) {
        this.mode = mode;
        ActionBar actionBar = activity.getActionBar();
        if (mode == MODE_DISABLED) {
            if (C.API_JELLY_BEAN_MR2) {
                actionBar.setHomeAsUpIndicator(null);
            }/*  ww  w.j av  a2 s . c o m*/
            actionBar.setDisplayHomeAsUpEnabled(false);
        } else {
            actionBar.setDisplayHomeAsUpEnabled(true);
            if (C.API_LOLLIPOP) {
                activity.getActionBar().setHomeAsUpIndicator(arrowDrawable);
                boolean open = drawerLayout.isDrawerOpen(Gravity.START) && arrowDrawable.position == 1f;
                if (!open) {
                    ValueAnimator animator = ValueAnimator.ofFloat(0f, 1f);
                    animator.setDuration(DRAWER_CLOSE_DURATION);
                    animator.addUpdateListener(new StateArrowAnimatorListener(mode == MODE_DRAWER));
                    animator.start();
                }
            } else {
                setActionBarUpIndicatorObsolete(mode == MODE_DRAWER ? slideDrawable : homeAsUpIndicator);
            }
        }
    }
}

From source file:andrupal.oauth.sample.HomeActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case android.R.id.home:
        drawer.openDrawer(Gravity.START);
        return true;
    }/*from  w  ww . j  av a  2 s . c  om*/

    return super.onOptionsItemSelected(item);
}

From source file:com.klinker.android.theme_spotlight.activity.SpotlightActivity.java

public void switchFragments(int position) {
    currentPosition = position;//from  w  w w.  ja  v  a  2 s  .  co m
    setUpFragment(position);
    showDualPane(mFragment);

    attachFragment(R.id.content_frame, mFragment);
    showTextLabel(true);

    boldDrawerItem(position);
    setupActionbar(position);
    mDrawer.closeDrawer(Gravity.START);
}

From source file:org.docrj.smartcard.reader.NavDrawer.java

public boolean onBackPressed() {
    if (mDrawerLayout.isDrawerOpen(Gravity.START | Gravity.LEFT)) {
        mDrawerLayout.closeDrawers();/*www .j  ava  2 s.c o  m*/
        return true;
    }
    return false;
}

From source file:com.antonioleiva.materialeverywhere.HomeActivity1.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setActionBarIcon(R.drawable.ic_ab_drawer);

    GridView gridView = (GridView) findViewById(R.id.gridView);
    gridView.setAdapter(new GridViewAdapter());
    gridView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override/*from  w  ww .j a va  2s  .c  o  m*/
        public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
            String url = (String) view.getTag();
            DetailActivity.launch(HomeActivity1.this, view.findViewById(R.id.image), url);

        }
    });

    drawer = (DrawerLayout) findViewById(R.id.drawer);
    drawer.setDrawerShadow(R.drawable.drawer_shadow, Gravity.START);

    NotificationManager notifier = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
    notifier.cancel(ACTION_NOTIFICATION_ID);

    //?  ?? 
    Intent intent1 = new Intent(this, HomeActivity1.class);
    PendingIntent viewPendingIntent = PendingIntent.getActivity(this, ACTION_NOTIFICATION_ID, intent1, 0);

    NotificationCompat.WearableExtender secondWearableExtender = new NotificationCompat.WearableExtender()
            .setContentIcon(R.drawable.ic_launcher).setContentIconGravity(Gravity.CENTER);
    //step4
    Notification secondPage = new NotificationCompat.Builder(this).setContentTitle("Step 4")
            .setContentText("  ? ? ? ?.")
            .extend(secondWearableExtender).build();
    //5 
    NotificationCompat.Action step5 = new NotificationCompat.Action(R.drawable.ic_launcher, "step5",
            viewPendingIntent);
    //step5
    Notification thirdPage = new NotificationCompat.Builder(this).setContentTitle("Step 5")
            .setContentText("    .")
            .extend(new NotificationCompat.WearableExtender().setContentIcon(R.drawable.ic_launcher)
                    .setContentIconGravity(Gravity.CENTER).setContentAction(0))

            .build();
    //step6
    Notification fourthPage = new NotificationCompat.Builder(this).setContentTitle("Step 6")
            .setContentText("   ? .")
            .extend(new NotificationCompat.WearableExtender().setContentIcon(R.drawable.ic_launcher)
                    .setContentIconGravity(Gravity.CENTER))
            .build();

    // ??   ? ?.
    //?,  ? 
    NotificationCompat.WearableExtender wearableOptions = new NotificationCompat.WearableExtender()
            .setContentIcon(R.drawable.ic_launcher).setContentIconGravity(Gravity.CENTER).addAction(step5)
            .addPage(secondPage).addPage(thirdPage).addPage(fourthPage);

    //  ? ? ?

    Notification notification = new NotificationCompat.Builder(this).setContentTitle("?")
            .setContentText("2").setUsesChronometer(true).setSmallIcon(R.drawable.ic_launcher)
            .extend(wearableOptions).setAutoCancel(true).build();
    //? 

    //  ? ? .
    NotificationManagerCompat.from(this).notify(RECIPE_NOTIFICATION_ID, notification);
}

From source file:com.davisosa.structura.activities.base.BaseActivity.java

protected boolean isDrawerOpen() {
    return mDrawerLayout != null && mDrawerLayout.isDrawerOpen(Gravity.START);
}

From source file:com.example.testing.myapplication.module.pageSliding.PagerSlidingTabStrip.java

public PagerSlidingTabStrip(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);

    setFillViewport(true);/*w ww.j av a 2 s .  c o  m*/
    setWillNotDraw(false);

    tabsContainer = new LinearLayout(context);
    tabsContainer.setOrientation(LinearLayout.HORIZONTAL);
    tabsContainer.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
    tabsContainer.setGravity(Gravity.START);

    addView(tabsContainer);

    DisplayMetrics dm = getResources().getDisplayMetrics();

    scrollOffset = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, scrollOffset, dm);
    indicatorHeight = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, indicatorHeight, dm);
    //underlineHeight = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, underlineHeight, dm);
    dividerPadding = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dividerPadding, dm);
    tabPadding = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, tabPadding, dm);
    //dividerWidth = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dividerWidth, dm);
    //tabTextSize = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, tabTextSize, dm);

    // get system attrs (android:textSize and android:textColor)

    TypedArray a = context.obtainStyledAttributes(attrs, ATTRS);
    //tabTextSize = a.getDimensionPixelSize(0, tabTextSize);

    a.recycle();

    // get custom attrs

    a = context.obtainStyledAttributes(attrs, R.styleable.PagerSlidingTabStrip);

    indicatorColor = a.getColor(R.styleable.PagerSlidingTabStrip_pstsIndicatorColor, indicatorColor);
    //underlineColor = a.getColor(R.styleable.PagerSlidingTabStrip_pstsUnderlineColor, underlineColor);
    //dividerColor = a.getColor(R.styleable.PagerSlidingTabStrip_pstsDividerColor, dividerColor);
    indicatorHeight = a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_pstsIndicatorHeight,
            indicatorHeight);
    //underlineHeight =
    //        a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_pstsUnderlineHeight, underlineHeight);
    dividerPadding = a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_pstsDividerPadding,
            dividerPadding);
    tabPadding = a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_pstsTabPaddingLeftRight, tabPadding);
    tabBackgroundResId = a.getResourceId(R.styleable.PagerSlidingTabStrip_pstsTabBackground,
            tabBackgroundResId);
    shouldExpand = a.getBoolean(R.styleable.PagerSlidingTabStrip_pstsShouldExpand, shouldExpand);
    scrollOffset = a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_pstsScrollOffset, scrollOffset);
    textAllCaps = a.getBoolean(R.styleable.PagerSlidingTabStrip_pstsTextAllCaps, textAllCaps);
    mTabTextColor = a.getColorStateList(R.styleable.PagerSlidingTabStrip_pstsTabTextColor);

    a.recycle();

    rectPaint = new Paint();
    rectPaint.setAntiAlias(true);
    rectPaint.setStyle(Style.FILL);

    //dividerPaint = new Paint();
    //dividerPaint.setAntiAlias(true);
    //dividerPaint.setStrokeWidth(dividerWidth);

    defaultTabLayoutParams = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT,
            LayoutParams.MATCH_PARENT);
    expandedTabLayoutParams = new LinearLayout.LayoutParams(0, LayoutParams.MATCH_PARENT, 1.0f);

    if (locale == null) {
        locale = getResources().getConfiguration().locale;
    }
}

From source file:org.videolan.vlc.gui.view.PopupLayout.java

@SuppressWarnings("deprecation")
private void init(Context context) {
    mWindowManager = (WindowManager) context.getApplicationContext().getSystemService(Context.WINDOW_SERVICE);

    final WindowManager.LayoutParams params = new WindowManager.LayoutParams(
            VLCApplication.getAppResources().getDimensionPixelSize(R.dimen.video_pip_width),
            VLCApplication.getAppResources().getDimensionPixelSize(R.dimen.video_pip_heigth),
            WindowManager.LayoutParams.TYPE_PHONE, WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE,
            PixelFormat.OPAQUE);//w ww.  j  av  a2  s  .  co m

    params.gravity = Gravity.BOTTOM | Gravity.START;
    params.x = 50;
    params.y = 50;
    if (AndroidUtil.isHoneycombOrLater())
        mScaleGestureDetector = new ScaleGestureDetector(context, this);
    setOnTouchListener(this);
    mWindowManager.addView(this, params);
    mLayoutParams = (WindowManager.LayoutParams) getLayoutParams();

    updateWindowSize();
}

From source file:org.amahi.anywhere.activity.NavigationActivity.java

private void setUpNavigationDrawer() {
    this.navigationDrawerToggle = buildNavigationDrawerToggle();

    getDrawer().addDrawerListener(this);
    getDrawer().setDrawerShadow(R.drawable.bg_shadow_drawer, Gravity.START);
}