List of usage examples for android.view Gravity END
int END
To view the source code for android.view Gravity END.
Click Source Link
From source file:android.support.transition.SidePropagation.java
private int getMaxDistance(ViewGroup sceneRoot) { switch (mSide) { case Gravity.LEFT: case Gravity.RIGHT: case Gravity.START: case Gravity.END: return sceneRoot.getWidth(); default:// w w w . j a v a 2 s. co m return sceneRoot.getHeight(); } }
From source file:org.odk.collect.android.fragments.AppListFragment.java
private void setupDrawerItems() { ArrayAdapter<String> adapter = new ArrayAdapter<String>(getContext(), android.R.layout.simple_list_item_1, sortingOptions) {/*ww w. j a v a 2 s . c o m*/ @Override public View getView(int position, View convertView, ViewGroup parent) { TextView textView = (TextView) super.getView(position, convertView, parent); if (position == getSelectedSortingOrder()) { textView.setBackgroundColor(ContextCompat.getColor(getContext(), R.color.light_blue)); } textView.setPadding(50, 0, 0, 0); return textView; } }; drawerList.setAdapter(adapter); drawerList.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { parent.getChildAt(selectedSortingOrder).setBackgroundColor(Color.TRANSPARENT); view.setBackgroundColor(ContextCompat.getColor(getContext(), R.color.light_blue)); performSelectedSearch(position); drawerLayout.closeDrawer(Gravity.END); } }); }
From source file:com.tooltip.Tooltip.java
private View getContentView(Builder builder) { GradientDrawable drawable = new GradientDrawable(); drawable.setColor(builder.mBackgroundColor); drawable.setCornerRadius(builder.mCornerRadius); int padding = (int) builder.mPadding; TextView textView = new TextView(builder.mContext); TextViewCompat.setTextAppearance(textView, builder.mTextAppearance); textView.setText(builder.mText);/* ww w . ja v a2s.c o m*/ textView.setPadding(padding, padding, padding, padding); textView.setLineSpacing(builder.mLineSpacingExtra, builder.mLineSpacingMultiplier); textView.setTypeface(builder.mTypeface, builder.mTextStyle); if (builder.mTextSize >= 0) { textView.setTextSize(TypedValue.TYPE_NULL, builder.mTextSize); } if (builder.mTextColor != null) { textView.setTextColor(builder.mTextColor); } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { textView.setBackground(drawable); } else { //noinspection deprecation textView.setBackgroundDrawable(drawable); } LinearLayout.LayoutParams textViewParams = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT, 0); textViewParams.gravity = Gravity.CENTER; textView.setLayoutParams(textViewParams); 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) Util.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(textView); mContentView.addView(mArrowView); } else { mContentView.addView(mArrowView); mContentView.addView(textView); } mContentView.setOnClickListener(mClickListener); mContentView.setOnLongClickListener(mLongClickListener); if (builder.isCancelable || builder.isDismissOnClick) { mContentView.setOnTouchListener(mTouchListener); } return mContentView; }
From source file:rebus.gitchat.ui.MainActivity.java
private void addHeader() { UserBean user = UserFactory.with(MainActivity.this, UserFactory.TYPE.GITTER).getUser(); HeaderView headerView = new HeaderView(MainActivity.this, false); headerView.username(user.getFullName()); headerView.email("@" + user.getName()); headerView.background().setBackgroundColor(getResources().getColor(R.color.primary)); headerView.setOnHeaderClickListener(new HeaderInterface.OnHeaderClickListener() { @Override//from w w w . j av a2 s . co m public void onClick(View view) { if (drawerLayout != null && drawerLayout.isDrawerOpen(GravityCompat.START)) { drawerLayout.closeDrawer(GravityCompat.START); } } }); headerView.setOnAvatarClickListener(new HeaderInterface.OnAvatarClickListener() { @Override public void onClick(View view) { } }); headerView.setArrow(new HeaderInterface.OnArrowClickListener() { @Override public void onClick(View view) { PopupMenu popupMenu = new PopupMenu(MainActivity.this, view); popupMenu.inflate(R.menu.popup_main); popupMenu.setGravity(Gravity.END); popupMenu.show(); popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem item) { if (item.getItemId() == R.id.logout) { UserFactory.with(MainActivity.this, UserFactory.TYPE.GITTER) .logOut(new UserFactory.LogOutCallBack() { @Override public void onSuccess() { Navigator.with(MainActivity.this).build().goTo(SplashActivity.class) .commit(); finish(); } }); } return false; } }); } }); Glide.with(MainActivity.this).load(user.getAvatar()).asBitmap().into(headerView.avatar()); navigationView.addHeaderView(headerView); }
From source file:com.lambdasoup.quickfit.ui.WorkoutListActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Timber.d("onCreate before inflate"); setContentView(R.layout.activity_workout_list); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar);//from w w w. j a va2 s . c o m //noinspection ConstantConditions toolbar.setTitle(getTitle()); fabAnimationDuration = getResources().getInteger(R.integer.fab_animation_duration); fab = (FloatingActionButton) findViewById(R.id.fab); //noinspection ConstantConditions fab.setOnClickListener(view -> addNewWorkout()); // need to set statelistdrawable referencing vector drawables programmatically, because // support library vector drawable support in 23.3.0 does not allow vector drawable // references in xml statelistdrawables if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { VectorDrawableCompat drawableAdd = VectorDrawableCompat.create(getResources(), R.drawable.ic_add_white_fat_24dp, getTheme()); VectorDrawableCompat drawableExpandLess = VectorDrawableCompat.create(getResources(), R.drawable.ic_expand_less_white_fat_24dp, getTheme()); StateListDrawable stateListDrawable = new StateListDrawable(); stateListDrawable.addState(new int[] { android.R.attr.state_activated }, drawableExpandLess); stateListDrawable.addState(new int[] {}, drawableAdd); fab.setImageDrawable(stateListDrawable); } fabBackgroundToActivated = BackgroundTintListAnimator.create(this, fab, R.color.colorAccent, R.color.colorPrimaryMediumLight, fabAnimationDuration); fabBackgroundToNotActivated = BackgroundTintListAnimator.create(this, fab, R.color.colorPrimaryMediumLight, R.color.colorAccent, fabAnimationDuration); masterDetailView = (MasterDetailLayout) findViewById(R.id.two_panes); if (masterDetailView != null) { // The detail container view will be present only in the // large-screen layouts (res/values-w900dp). // If this view is present, then the // activity should be in two-pane mode. isTwoPane = true; fabAddSchedule = findViewById(R.id.fab_add_schedule); //noinspection ConstantConditions fabAddSchedule.setOnClickListener(view -> addNewSchedule()); fabAddWorkout = findViewById(R.id.fab_add_workout); //noinspection ConstantConditions fabAddWorkout.setOnClickListener(view -> addNewWorkout()); setMiniFabOffsets(); masterDetailView.setAfterCollapse(() -> { CoordinatorLayout.LayoutParams fabLayoutParams = (CoordinatorLayout.LayoutParams) fab .getLayoutParams(); fabLayoutParams.setAnchorId(View.NO_ID); fabLayoutParams.gravity = Gravity.BOTTOM | Gravity.END; fab.setLayoutParams(fabLayoutParams); Fragment schedulesFragment = getSupportFragmentManager().findFragmentById(R.id.schedules_container); getSupportFragmentManager().beginTransaction().remove(schedulesFragment).commit(); }); } workoutsRecyclerView = (EmptyRecyclerView) findViewById(R.id.workout_list); workoutsAdapter = new WorkoutItemRecyclerViewAdapter(this, isTwoPane); workoutsAdapter.setOnWorkoutInteractionListener(this); workoutsRecyclerView.setAdapter(workoutsAdapter); workoutsRecyclerView.addItemDecoration(new DividerItemDecoration(this, false)); readIntentExtras(); if (savedInstanceState != null) { idToSelect = savedInstanceState.getLong(KEY_SHOW_WORKOUT_ID, NO_ID); if (idToSelect == NO_ID) { idToSelect = savedInstanceState.getLong(KEY_SELECTED_ITEM_ID, NO_ID); } } else { idToSelect = FIRST_ITEM_IF_EXISTS; } getLoaderManager().initLoader(0, null, this); Timber.d("onCreate finished"); }
From source file:ti.modules.titanium.ui.widget.TiUIDrawerLayout.java
public void toggleRight() { if (layout.isDrawerOpen(Gravity.END)) { closeRight(); } else { openRight(); } }
From source file:com.ymt.demo1.plates.exportConsult.ExportConsultMainActivity.java
protected void initTitle() { final MyTitle title = (MyTitle) findViewById(R.id.my_title); title.setTitleStyle(MyTitle.TitleStyle.RIGHT_ICON_L_R); title.setOnLeftActionClickListener(new MyTitle.OnLeftActionClickListener() { @Override// ww w. jav a 2 s.c om public void onClick() { finish(); } }); actionListener = new PopActionListener() { @Override public void onAction(String action) { switch (action) { case "?": if (!(TextUtils.isEmpty(AppContext.now_session_id))) { Intent intent = new Intent(ExportConsultMainActivity.this, ConsultNowActivity.class); startActivity(intent); } else { Intent intent = new Intent(ExportConsultMainActivity.this, SignInUpActivity.class); intent.putExtra("isFromConsult", true); startActivity(intent); } break; case "": if (TextUtils.isEmpty(AppContext.now_session_id)) { // Intent intent = new Intent(ExportConsultMainActivity.this, SignInUpActivity.class); intent.putExtra("is_back_to_main", false); startActivityForResult(intent, 1024); } else { // startActivity(new Intent(ExportConsultMainActivity.this, MyConsultActivity.class)); } break; case "?": startActivity(new Intent(ExportConsultMainActivity.this, MyHistoryConsultActivity.class)); break; default: break; } } @Override public void onDismiss() { } }; title.setOnRightActionClickListener(new MyTitle.OnRightActionClickListener() { @Override public void onRightLClick() { startActivity(new Intent(ExportConsultMainActivity.this, FullSearchActivity.class)); } @Override public void onRightRClick() { PopActionUtil popActionUtil = PopActionUtil.getInstance(ExportConsultMainActivity.this); if (TextUtils.isEmpty(AppContext.user_type)) { popActionUtil.setActions(new String[] { "?", "", "?" }); } else { switch (AppContext.user_type) { case "003": // case "004": // popActionUtil.setActions(new String[] { "" }); break; default: // popActionUtil.setActions(new String[] { "?", "", "?" }); break; } } PopupWindow popupWindow = popActionUtil.getSimpleTxtPopActionMenu(); popupWindow.showAtLocation(title.getRootView(), Gravity.TOP | Gravity.END, 10, 100); popActionUtil.setActionListener(actionListener); } }); }
From source file:ti.modules.titanium.ui.widget.TiUIDrawerLayout.java
public void openRight() { layout.openDrawer(Gravity.END); }
From source file:ti.modules.titanium.ui.widget.TiUIDrawerLayout.java
public void closeRight() { layout.closeDrawer(Gravity.END); }
From source file:ti.modules.titanium.ui.widget.TiUIDrawerLayout.java
public boolean isRightOpen() { return layout.isDrawerOpen(Gravity.END); }