List of usage examples for android.view Gravity START
int START
To view the source code for android.view Gravity START.
Click Source Link
From source file:ti.modules.titanium.ui.widget.TiUIDrawerLayout.java
private void initLeft() { if (leftFrame != null) { return;//from w w w .j a va 2s . co m } leftFrame = new FrameLayout(proxy.getActivity()); LayoutParams frameLayout = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT); frameLayout.gravity = Gravity.START; leftFrame.setLayoutParams(frameLayout); layout.addView(leftFrame); if (drawerToggle == null) { initDrawerToggle(); } }
From source file:edu.ptu.navpattern.tooltip.Tooltip.java
private View getContentView(final Builder builder) { GradientDrawable drawable = new GradientDrawable(); drawable.setColor(builder.mBackgroundColor); drawable.setCornerRadius(builder.mCornerRadius); LinearLayout vgContent = new LinearLayout(builder.mContext); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { vgContent.setBackground(drawable); } else {//ww w . java 2s.co m //noinspection deprecation vgContent.setBackgroundDrawable(drawable); } int padding = (int) builder.mPadding; vgContent.setPadding(padding, padding, padding, padding); vgContent.setOrientation(LinearLayout.VERTICAL); LinearLayout.LayoutParams textViewParams = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT, 0); textViewParams.gravity = Gravity.CENTER; textViewParams.topMargin = 1; vgContent.setLayoutParams(textViewParams); vgContent.setDividerDrawable(vgContent.getResources().getDrawable(R.drawable.divider_line)); vgContent.setShowDividers(LinearLayout.SHOW_DIVIDER_MIDDLE); if (builder.itemText != null && builder.itemText.length > 0) { for (int i = 0; i < builder.itemText.length; i++) { TextView textView = new TextView(builder.mContext); textView.setText(builder.itemText[i]); textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 44); textView.setTextColor(0xffffffff); textView.setGravity(Gravity.CENTER_VERTICAL); if (builder.itemLogo != null && builder.itemLogo.length > i) { Drawable drawableLeft = builder.mContext.getResources().getDrawable(builder.itemLogo[i]); /// ??,??. // drawableLeft.setBounds(0, 0, drawable.getMinimumWidth(), drawable.getMinimumHeight()); // textView.setCompoundDrawables(drawableLeft, null, null, null); // textView.setCompoundDrawablePadding(4); // textView.setBackgroundDrawable(drawableLeft); LinearLayout linearLayout = new LinearLayout(builder.mContext); linearLayout.setMinimumHeight((int) dpToPx(44f)); linearLayout.setOrientation(LinearLayout.HORIZONTAL); linearLayout.setGravity(Gravity.CENTER_VERTICAL); ImageView icon = new ImageView(builder.mContext); icon.setImageDrawable(drawableLeft); linearLayout.addView(icon); linearLayout.addView(textView); vgContent.addView(linearLayout); final int position = i; linearLayout.setClickable(false); linearLayout.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (builder.mOnItemClickListener != null) { builder.mOnItemClickListener.onClick(position); } mTouchListener.onTouch(v, MotionEvent.obtain(SystemClock.uptimeMillis(), SystemClock.uptimeMillis(), MotionEvent.ACTION_UP, v.getLeft() + 5, v.getTop() + 5, 0)); } }); } else { vgContent.addView(textView); final int position = i; textView.setClickable(false); textView.setMinimumHeight((int) dpToPx(44f)); textView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (builder.mOnItemClickListener != null) { builder.mOnItemClickListener.onClick(position); } mTouchListener.onTouch(v, null); } }); } } } mArrowView = new ImageView(builder.mContext); mArrowView.setImageDrawable(builder.mArrowDrawable); LinearLayout.LayoutParams arrowLayoutParams; if (mGravity == Gravity.TOP || mGravity == Gravity.BOTTOM) { arrowLayoutParams = new LinearLayout.LayoutParams((int) builder.mArrowWidth, (int) builder.mArrowHeight, 0); } else { arrowLayoutParams = new LinearLayout.LayoutParams((int) builder.mArrowHeight, (int) builder.mArrowWidth, 0); } arrowLayoutParams.gravity = Gravity.CENTER; mArrowView.setLayoutParams(arrowLayoutParams); mContentView = new LinearLayout(builder.mContext); mContentView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)); mContentView.setOrientation(mGravity == Gravity.START || mGravity == Gravity.END ? LinearLayout.HORIZONTAL : LinearLayout.VERTICAL); padding = (int) dpToPx(5); switch (mGravity) { case Gravity.START: mContentView.setPadding(0, 0, padding, 0); break; case Gravity.TOP: case Gravity.BOTTOM: mContentView.setPadding(padding, 0, padding, 0); break; case Gravity.END: mContentView.setPadding(padding, 0, 0, 0); break; } if (mGravity == Gravity.TOP || mGravity == Gravity.START) { mContentView.addView(vgContent); mContentView.addView(mArrowView); } else { mContentView.addView(mArrowView); mContentView.addView(vgContent); } if (builder.isCancelable || builder.isDismissOnClick) { mContentView.setOnTouchListener(mTouchListener); } return mContentView; }
From source file:com.hrs.filltheform.dialog.FillTheFormDialog.java
private void setUpInitialDialogPosition() { final Rect outBounds = new Rect(); selectedNodeInfo.getBoundsInScreen(outBounds); dialogParams.gravity = Gravity.START | Gravity.TOP; dialogParams.width = model.getNormalDialogWidth(); dialogParams.height = model.getNormalDialogHeight(); dialogParams.x = outBounds.right - dialogInitialOffset; dialogParams.y = outBounds.top;//from w w w. java2s . com model.setDialogPosition(dialogParams.x, dialogParams.y); }
From source file:com.klinker.android.theme_spotlight.activity.SpotlightActivity.java
@Override public boolean onPrepareOptionsMenu(Menu menu) { boolean drawerOpen = mDrawer.isDrawerOpen(Gravity.START); menu.findItem(R.id.search).setVisible(!drawerOpen && searchable); return super.onPrepareOptionsMenu(menu); }
From source file:com.sonymobile.android.media.testmediaplayer.filebrowsing.MediaBrowser.java
private void startMediaPlayer(String path, boolean useUri) { if (mMediaPlayer.getState() != MediaPlayer.State.IDLE) { mMainActivity.reset();//ww w. jav a 2 s .c o m } try { if (LOGS_ENABLED) Log.d(TAG, "Setting datasource to: " + path); if (useUri) { // Method not used until fixed in framework // mMediaPlayer.setDataSource(mContext, // MediaStore.Video.Media.getContentUri(path)); mMediaPlayer.setDataSource(path); } else { mMediaPlayer.setDataSource(path); } mMediaPlayer.prepareAsync(); mDrawerLayout.closeDrawer(Gravity.START); } catch (IllegalStateException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } }
From source file:com.maskyn.fileeditorpro.activity.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { // set the windows background ThemeUtils.setWindowsBackground(this); // super!!/* w ww . jav a2 s.c om*/ super.onCreate(savedInstanceState); // setup the layout setContentView(R.layout.activity_home); toolbar = (Toolbar) findViewById(R.id.my_awesome_toolbar); setSupportActionBar(toolbar); // setup the navigation drawer setupNavigationDrawer(); // reset text editor setupTextEditor(); hideTextEditor(); /* First Time we open this activity */ if (savedInstanceState == null) { // Open mDrawerLayout.openDrawer(Gravity.START); // Set the default title getSupportActionBar().setTitle(getString(R.string.nome_app_turbo_editor)); } // parse the intent parseIntent(getIntent()); // show a dialog with the changelog showChangeLog(); }
From source file:com.github.shareme.gwsmaterialuikit.library.material.widget.EditText.java
private LabelView getLabelView() { if (mLabelView == null) { mLabelView = new LabelView(getContext()); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) mLabelView.setTextDirection(mIsRtl ? TEXT_DIRECTION_RTL : TEXT_DIRECTION_LTR); mLabelView.setGravity(Gravity.START); mLabelView.setSingleLine(true);/*from w w w. j a v a 2 s. co m*/ } return mLabelView; }
From source file:com.tooltip.Tooltip.java
private PointF calculateLocation() { PointF location = new PointF(); final RectF anchorRect = Util.calculateRectInWindow(mAnchorView); final PointF anchorCenter = new PointF(anchorRect.centerX(), anchorRect.centerY()); switch (mGravity) { case Gravity.START: location.x = anchorRect.left - mContentView.getWidth() - mMargin; location.y = anchorCenter.y - mContentView.getHeight() / 2f; break;//from w w w .j a v a 2 s . c o m case Gravity.END: location.x = anchorRect.right + mMargin; location.y = anchorCenter.y - mContentView.getHeight() / 2f; break; case Gravity.TOP: location.x = anchorCenter.x - mContentView.getWidth() / 2f; location.y = anchorRect.top - mContentView.getHeight() - mMargin; break; case Gravity.BOTTOM: location.x = anchorCenter.x - mContentView.getWidth() / 2f; location.y = anchorRect.bottom + mMargin; break; } return location; }
From source file:com.ruesga.rview.BaseActivity.java
private void configureFullDrawer() { if (getDrawerLayout() != null) { ActionBarDrawerToggle drawerToggle = new ActionBarDrawerToggle(this, getDrawerLayout(), getContentBinding().toolbar, 0, 0); getDrawerLayout().addDrawerListener(drawerToggle); getDrawerLayout().setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED, Gravity.START); drawerToggle.syncState();// w w w.ja v a 2 s .co m } else { final ViewGroup.LayoutParams params = getContentBinding().drawerLayout.getLayoutParams(); if (!(params instanceof SlidingPaneLayout.LayoutParams)) { getContentBinding().drawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED, Gravity.START); } if (mModel.hasForceSinglePanel) { // Someones is requesting a single panel in a multipanel layout // Just hide the multipanel mModel.hasMiniDrawer = false; } } }
From source file:com.cyanogenmod.filemanager.ui.widgets.ActionBarDrawerToggle.java
/** * Synchronize the state of the drawer indicator/affordance with the linked * DrawerLayout.//from ww w . jav a 2s . com * * <p> * This should be called from your <code>Activity</code>'s * {@link Activity#onPostCreate(android.os.Bundle) onPostCreate} method to * synchronize after the DrawerLayout's instance state has been restored, * and any other time when the state may have diverged in such a way that * the ActionBarDrawerToggle was not notified. (For example, if you stop * forwarding appropriate drawer events for a period of time.) * </p> */ public void syncState() { if (mDrawerLayout.isDrawerOpen(Gravity.START)) { mSlider.setPosition(1); } else { mSlider.setPosition(0); } if (mDrawerIndicatorEnabled) { setActionBarUpIndicator(mSlider, mDrawerLayout.isDrawerOpen(Gravity.START) ? mCloseDrawerContentDescRes : mOpenDrawerContentDescRes); } }