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.codejune.material.activities.SlidingActivity.java

private void configureToolbar() {
    Toolbar mainToolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(mainToolbar);//from  www.ja va 2  s .  c om
    getSupportActionBar().setTitle("Sliding");

    mainToolbar.setNavigationOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {

            if (mDrawerLayout.isDrawerOpen(Gravity.START)) {
                mDrawerLayout.closeDrawer(Gravity.START);

            } else {
                mDrawerLayout.openDrawer(Gravity.START);
            }
        }
    });
}

From source file:jp.bugscontrol.ui.ActivityServer.java

@Override
protected void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_server);

    drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
    progressBar = (ProgressBar) findViewById(R.id.progressbar);

    final Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);/* w w  w.  ja va  2 s . c  o m*/
    toolbar.setNavigationIcon(R.drawable.ic_drawer);
    toolbar.setNavigationOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            drawerLayout.openDrawer(Gravity.START);
        }
    });

    // Load ad
    final AdView adView = (AdView) findViewById(R.id.adView);
    final AdRequest adRequest = new AdRequest.Builder().build();
    adView.loadAd(adRequest);
}

From source file:com.art2cat.dev.moonlightnote.controller.settings.CommonSettingsFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    if (getArguments() != null) {
        mType = getArguments().getInt("type");
    }//from  www .  j ava  2 s . com
    LinearLayout linearLayout = new LinearLayout(getActivity());
    linearLayout.setOrientation(LinearLayout.VERTICAL);
    LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,
            LinearLayout.LayoutParams.MATCH_PARENT);
    linearLayout.setLayoutParams(params);
    ScrollView scrollView = new ScrollView(getActivity());
    scrollView.setLayoutParams(params);
    linearLayout.addView(scrollView);
    TextView textView = new TextView(getActivity());
    textView.setLayoutParams(params);
    int padding = getResources().getDimensionPixelOffset(R.dimen.padding);
    textView.setPadding(padding, padding, padding, padding);
    switch (mType) {
    case Constants.FRAGMENT_ABOUT:
        textView.setGravity(Gravity.CENTER);
        textView.setText(getContent());
        getActivity().setTitle(R.string.settings_about);
        break;
    case Constants.FRAGMENT_LICENSE:
        textView.setGravity(Gravity.CENTER);
        textView.setText(getContent());
        getActivity().setTitle(R.string.settings_license);
        break;
    case Constants.FRAGMENT_POLICY:
        textView.setGravity(Gravity.START);
        textView.setText(getContent());
        getActivity().setTitle(R.string.settings_policy);
        break;
    }
    setHasOptionsMenu(true);
    scrollView.addView(textView);
    return linearLayout;
}

From source file:com.uele.examples.loginviewsmvp.ui.view.MainScreen.java

@Override
protected void onFinishInflate() {
    super.onFinishInflate();
    ButterKnife.bind(this);

    toolbarView.setNavigationIcon(R.drawable.menu_icon);
    toolbarView.setNavigationOnClickListener(new OnClickListener() {
        @Override//from   www . j  av a2  s.  co  m
        public void onClick(View v) {
            drawerLayout.openDrawer(Gravity.START);
        }
    });

    /*
    swipeRefreshView.setColorSchemeResources(R.color.accent);
    swipeRefreshView.setOnRefreshListener(this);
    */
    recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
    recyclerView.addItemDecoration(
            new DividerItemDecoration(getContext(), VERTICAL_LIST, dividerPaddingStart, safeIsRtl()));
    //recyclerView.setAdapter(Adapter);
}

From source file:com.pyamsoft.zaptorch.service.OriginalCamera.java

OriginalCamera(final @NonNull Context context, final @NonNull VolumeServiceInteractor interactor) {
    super(context, interactor);
    Timber.d("OLD CAMERA API");
    opened = false;//from  w  w w.ja  v a2 s  .  c  om

    surfaceView = new SurfaceView(getAppContext());
    windowManager = (WindowManager) getAppContext().getSystemService(Context.WINDOW_SERVICE);

    params = new WindowManager.LayoutParams();
    params.width = 1;
    params.height = 1;
    params.gravity = Gravity.TOP | Gravity.START;
    params.format = PixelFormat.TRANSLUCENT;
    params.type = WindowManager.LayoutParams.TYPE_TOAST;
    params.flags = WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE
            | WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
            | WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
}

From source file:com.d2connect.droidltest.util.LPreviewUtilsImpl.java

@Override
public ActionBarDrawerToggleWrapper setupDrawerToggle(DrawerLayout drawerLayout,
        DrawerLayout.DrawerListener drawerListener) {
    // On L, use a different drawer indicator
    if (mActionBarToolbar != null) {
        mActionBarToolbar.setNavigationIcon(R.drawable.ic_drawer);
        mActionBarToolbar.setNavigationOnClickListener(new View.OnClickListener() {
            @Override/*  ww  w  .  j av a 2s  .c om*/
            public void onClick(View view) {
                if (mDrawerLayout.isDrawerOpen(Gravity.START)) {
                    mDrawerLayout.closeDrawer(Gravity.START);
                } else {
                    mDrawerLayout.openDrawer(Gravity.START);
                }
            }
        });
    } else {
        mActivity.getActionBar().setHomeAsUpIndicator(R.drawable.ic_drawer);
    }
    // On L, stub out the ActionBarDrawerToggle
    mDrawerLayout = drawerLayout;
    mDrawerLayout.setDrawerListener(drawerListener);
    mDrawerToggleWrapper = new ActionBarDrawerToggleWrapper();
    return mDrawerToggleWrapper;
}

From source file:com.kaliturin.blacklist.adapters.SMSConversationCursorAdapter.java

public SMSConversationCursorAdapter(Context context) {
    super(context, null, 0);
    paddingStart = new Padding(context, Gravity.START, 5, 50);
    paddingEnd = new Padding(context, Gravity.END, 5, 50);

    calendar.setTimeInMillis(System.currentTimeMillis());
    currentYear = calendar.get(Calendar.YEAR);
    currentDay = calendar.get(Calendar.DAY_OF_YEAR);
}

From source file:pl.allegro.foggerexample.ui.ComponentsActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.components_view);
    Injector.inject(this);
    ButterKnife.inject(this);

    if (savedInstanceState == null) {
        getFragmentManager().beginTransaction().add(R.id.fragmentPlaceholder, new ComponentsFragment(), "blur")
                .commit();/*from w  w  w .  ja va 2s  .co  m*/
    }

    drawerLayout.setDrawerShadow(R.drawable.drawer_shadow, Gravity.START);

    actionBarDrawerToggle = new ActionBarDrawerToggle(this, /* host Activity */
            drawerLayout, /* DrawerLayout object */
            R.drawable.ic_drawer, /* nav drawer icon to replace 'Up' caret */
            R.string.drawer_open, /* "open drawer" description */
            R.string.drawer_close /* "close drawer" description */
    ) {

        public void onDrawerClosed(View view) {
            getActionBar().setTitle(ComponentsActivity.this.getTitle());
        }

        public void onDrawerOpened(View drawerView) {
            getActionBar().setTitle(ComponentsActivity.this.getTitle());
        }
    };

    drawerLayout.setDrawerListener(actionBarDrawerToggle);
    getActionBar().setDisplayHomeAsUpEnabled(true);
    getActionBar().setHomeButtonEnabled(true);
    actionBarDrawerToggle.syncState();
}

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

private void initializeDrawerToggle() {
    drawerToggle = new ActionBarDrawerToggle(this, drawer, R.drawable.cinemafinlando_ic_navigation_drawer,
            R.string.drawer_open, R.string.drawer_close);
    drawer.setDrawerShadow(R.drawable.drawer_shadow, Gravity.START);
    drawer.setDrawerListener(this);
    getActionBar().setDisplayHomeAsUpEnabled(true);
    getActionBar().setHomeButtonEnabled(true);
}

From source file:org.chromium.chrome.browser.widget.ClipDrawableProgressBar.java

/**
 * Constructor for inflating from XML./*  w w  w  . j  a v  a 2s  . c o  m*/
 */
public ClipDrawableProgressBar(Context context, AttributeSet attrs) {
    super(context, attrs);
    mDesiredVisibility = getVisibility();

    assert attrs != null;
    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.ClipDrawableProgressBar, 0, 0);

    int foregroundColor = a.getColor(R.styleable.ClipDrawableProgressBar_progressBarColor, Color.TRANSPARENT);
    mBackgroundColor = a.getColor(R.styleable.ClipDrawableProgressBar_backgroundColor, Color.TRANSPARENT);
    assert foregroundColor != Color.TRANSPARENT;
    assert Color.alpha(
            foregroundColor) == 255 : "Currently ClipDrawableProgressBar only supports opaque progress bar color.";

    a.recycle();

    mForegroundDrawable = new ColorDrawable(foregroundColor);
    setImageDrawable(new ClipDrawable(mForegroundDrawable, Gravity.START, ClipDrawable.HORIZONTAL));
    setBackgroundColor(mBackgroundColor);
}