List of usage examples for android.view Gravity NO_GRAVITY
int NO_GRAVITY
To view the source code for android.view Gravity NO_GRAVITY.
Click Source Link
From source file:com.android.adcnx.adlib.plugin.AdConnectLibrary.java
private int getGravity(String gravity) { if (gravity.equalsIgnoreCase("bottom")) { return Gravity.BOTTOM; }/* w w w . j av a 2s.c o m*/ return Gravity.NO_GRAVITY; }
From source file:org.zywx.wbpalmstar.plugin.uexCalendarView.EUExCalendarView.java
private void addView2CurrentWindow(View child, RelativeLayout.LayoutParams parms) { int l = (int) (parms.leftMargin); int t = (int) (parms.topMargin); int w = parms.width; int h = parms.height; FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(w, h); lp.gravity = Gravity.NO_GRAVITY; lp.leftMargin = l;//from w ww. j av a 2 s. c o m lp.topMargin = t; adptLayoutParams(parms, lp); mBrwView.addViewToCurrentWindow(child, lp); }
From source file:com.android.talkbacktests.testsession.PopupViewTest.java
/** * Shows a PopupWindow at the anchor view with given window height and list size. *///from ww w . j av a2s.co m private void showPopupWindow(View button, int height, int listSize, boolean useDefaultInflater) { final Context context = button.getContext(); final ListView listView = new ListView(context); final BaseAdapter adapter; if (useDefaultInflater) { adapter = new ArrayAdapter<>(context, android.R.layout.simple_list_item_1, android.R.id.text1, createSampleArray(listSize)); } else { adapter = new MyAdapter(button.getContext(), createSampleArray(listSize)); } listView.setAdapter(adapter); listView.setVerticalScrollBarEnabled(true); listView.setBackgroundColor(0xFFFFFF); final PopupWindow window = new PopupWindow(listView, ViewGroup.LayoutParams.WRAP_CONTENT, height, true); window.setBackgroundDrawable(context.getResources().getDrawable(android.R.drawable.editbox_background)); listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) { if (window.isShowing()) { window.dismiss(); } } }); PopupWindowCompat.showAsDropDown(window, button, 0, 0, Gravity.NO_GRAVITY); }
From source file:com.anysoftkeyboard.keyboards.views.AnyKeyboardViewWithMiniKeyboard.java
protected void setPopupKeyboardWithView(int x, int y, int originX, int originY, View contentView) { mMiniKeyboardOriginX = originX;/* w w w . j ava2 s .c om*/ mMiniKeyboardOriginY = originY; mMiniKeyboardPopup.setContentView(contentView); CompatUtils.setPopupUnattachedToDecor(mMiniKeyboardPopup); mMiniKeyboardPopup.setWidth(contentView.getMeasuredWidth()); mMiniKeyboardPopup.setHeight(contentView.getMeasuredHeight()); mMiniKeyboardPopup.showAtLocation(this, Gravity.NO_GRAVITY, x, y); invalidateAllKeys(); }
From source file:com.oprisnik.navdrawer.widget.NavDrawerLayout.java
protected boolean isContentView(View child) { return ((LayoutParams) child.getLayoutParams()).gravity == Gravity.NO_GRAVITY; }
From source file:io.github.douglasjunior.androidSimpleTooltip.SimpleTooltip.java
public void show() { verifyDismissed();/*from w w w.jav a2 s.c o m*/ final ViewGroup rootView = (ViewGroup) mAnchorView.getRootView(); createOverlay(rootView); mContentLayout.getViewTreeObserver().addOnGlobalLayoutListener(mLocationLayoutListener); rootView.post(new Runnable() { @Override public void run() { mPopupWindow.showAtLocation(rootView, Gravity.NO_GRAVITY, rootView.getWidth(), rootView.getHeight()); } }); }
From source file:org.mariotaku.twidere.fragment.support.RetweetQuoteDialogFragment.java
@NonNull @Override/* www. j a va 2s . c om*/ public Dialog onCreateDialog(final Bundle savedInstanceState) { final Context wrapped = ThemeUtils.getDialogThemedContext(getActivity()); final AlertDialog.Builder builder = new AlertDialog.Builder(wrapped); final Context context = builder.getContext(); mValidator = new TwidereValidator(context); mPreferences = SharedPreferencesWrapper.getInstance(context, SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE, SharedPreferenceConstants.class); final LayoutInflater inflater = LayoutInflater.from(context); @SuppressLint("InflateParams") final View view = inflater.inflate(R.layout.dialog_status_quote_retweet, null); final StatusViewHolder holder = new StatusViewHolder(new DummyStatusHolderAdapter(context), view.findViewById(R.id.item_content)); final ParcelableStatus status = getStatus(); assert status != null; builder.setView(view); builder.setTitle(R.string.retweet_quote_confirm_title); if (isMyRetweet(status)) { builder.setPositiveButton(R.string.cancel_retweet, this); } else if (!status.user_is_protected) { builder.setPositiveButton(R.string.retweet, this); } builder.setNeutralButton(R.string.quote, this); builder.setNegativeButton(android.R.string.cancel, null); holder.displayStatus(status, null, false, true); view.findViewById(R.id.item_menu).setVisibility(View.GONE); view.findViewById(R.id.action_buttons).setVisibility(View.GONE); view.findViewById(R.id.item_content).setFocusable(false); view.findViewById(R.id.comment_container) .setVisibility(status.user_is_protected ? View.GONE : View.VISIBLE); mEditComment = (UserHashtagAutoCompleteEditText) view.findViewById(R.id.edit_comment); mEditComment.setAccountId(status.account_id); mEditComment.setLengthChecker(new METLengthChecker() { final String statusLink = LinkCreator.getTwitterStatusLink(status.user_screen_name, status.quote_id) .toString(); @Override public int getLength(CharSequence text) { return mValidator.getTweetLength(text + " " + statusLink); } }); mEditComment.setMaxCharacters(mValidator.getMaxTweetLength()); final boolean sendByEnter = mPreferences.getBoolean(KEY_QUICK_SEND); final EditTextEnterHandler enterHandler = EditTextEnterHandler.attach(mEditComment, new EditTextEnterHandler.EnterListener() { @Override public void onHitEnter() { final AsyncTwitterWrapper twitter = getTwitterWrapper(); final ParcelableStatus status = getStatus(); if (twitter == null || status == null) return; retweetOrQuote(twitter, status); dismiss(); } }, sendByEnter); enterHandler.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { final Dialog dialog = getDialog(); if (!(dialog instanceof AlertDialog)) return; final Button positiveButton = ((AlertDialog) dialog).getButton(AlertDialog.BUTTON_POSITIVE); if (positiveButton == null) return; positiveButton.setText(s.length() > 0 ? R.string.comment : R.string.retweet); } @Override public void afterTextChanged(Editable s) { } }); mCommentMenu = view.findViewById(R.id.comment_menu); mPopupMenu = new PopupMenu(context, mCommentMenu, Gravity.NO_GRAVITY, R.attr.actionOverflowMenuStyle, 0); mCommentMenu.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mPopupMenu.show(); } }); mCommentMenu.setOnTouchListener(mPopupMenu.getDragToOpenListener()); mPopupMenu.inflate(R.menu.menu_dialog_comment); final Menu menu = mPopupMenu.getMenu(); MenuUtils.setMenuItemAvailability(menu, R.id.quote_original_status, status.retweet_id > 0 || status.quote_id > 0); mPopupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem item) { if (item.isCheckable()) { item.setChecked(!item.isChecked()); return true; } return false; } }); return builder.create(); }
From source file:com.alburivan.slickform.tooltip.SimpleTooltip.java
public void show() { verifyDismissed();/*from w w w. j av a 2s.co m*/ mContentLayout.getViewTreeObserver().addOnGlobalLayoutListener(mLocationLayoutListener); mContentLayout.getViewTreeObserver().addOnGlobalLayoutListener(mAutoDismissLayoutListener); mRootView.post(new Runnable() { @Override public void run() { mPopupWindow.showAtLocation(mRootView, Gravity.NO_GRAVITY, mRootView.getWidth(), mRootView.getHeight()); } }); }
From source file:com.facebook.react.flat.RCTText.java
@ReactProp(name = ViewProps.TEXT_ALIGN) public void setTextAlign(@Nullable String textAlign) { if (textAlign == null || "auto".equals(textAlign)) { mAlignment = Gravity.NO_GRAVITY; } else if ("left".equals(textAlign)) { // left and right may yield potentially different results (relative to non-nodes) in cases // when supportsRTL="true" in the manifest. mAlignment = Gravity.LEFT;/* w w w . j ava 2s . com*/ } else if ("right".equals(textAlign)) { mAlignment = Gravity.RIGHT; } else if ("center".equals(textAlign)) { mAlignment = Gravity.CENTER; } else { throw new JSApplicationIllegalArgumentException("Invalid textAlign: " + textAlign); } notifyChanged(false); }
From source file:org.mariotaku.twidere.fragment.RetweetQuoteDialogFragment.java
@NonNull @Override/*from w w w .ja v a 2s . co m*/ public Dialog onCreateDialog(final Bundle savedInstanceState) { final AlertDialog.Builder builder = new AlertDialog.Builder(getContext()); final Context context = builder.getContext(); final ParcelableStatus status = getStatus(); assert status != null; final ParcelableCredentials credentials = ParcelableCredentialsUtils.getCredentials(getContext(), status.account_key); assert credentials != null; builder.setView(R.layout.dialog_status_quote_retweet); builder.setTitle(R.string.retweet_quote_confirm_title); builder.setPositiveButton(R.string.retweet, null); builder.setNegativeButton(android.R.string.cancel, null); builder.setNeutralButton(R.string.quote, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { final Intent intent = new Intent(INTENT_ACTION_QUOTE); final Menu menu = mPopupMenu.getMenu(); final MenuItem quoteOriginalStatus = menu.findItem(R.id.quote_original_status); intent.putExtra(EXTRA_STATUS, status); intent.putExtra(EXTRA_QUOTE_ORIGINAL_STATUS, quoteOriginalStatus.isChecked()); startActivity(intent); } }); final Dialog dialog = builder.create(); dialog.setOnShowListener(new DialogInterface.OnShowListener() { @Override public void onShow(DialogInterface dialogInterface) { final AlertDialog dialog = (AlertDialog) dialogInterface; final View itemContent = dialog.findViewById(R.id.item_content); final StatusTextCountView textCountView = (StatusTextCountView) dialog .findViewById(R.id.comment_text_count); final View itemMenu = dialog.findViewById(R.id.item_menu); final View actionButtons = dialog.findViewById(R.id.action_buttons); final View commentContainer = dialog.findViewById(R.id.comment_container); final ComposeEditText editComment = (ComposeEditText) dialog.findViewById(R.id.edit_comment); final View commentMenu = dialog.findViewById(R.id.comment_menu); assert itemContent != null && textCountView != null && itemMenu != null && actionButtons != null && commentContainer != null && editComment != null && commentMenu != null; final DummyItemAdapter adapter = new DummyItemAdapter(context); adapter.setShouldShowAccountsColor(true); final IStatusViewHolder holder = new StatusViewHolder(adapter, itemContent); holder.displayStatus(status, false, true); textCountView.setMaxLength(TwidereValidator.getTextLimit(credentials)); itemMenu.setVisibility(View.GONE); actionButtons.setVisibility(View.GONE); itemContent.setFocusable(false); final boolean useQuote = useQuote(!status.user_is_protected, credentials); commentContainer.setVisibility(useQuote ? View.VISIBLE : View.GONE); editComment.setAccountKey(status.account_key); final boolean sendByEnter = mPreferences.getBoolean(KEY_QUICK_SEND); final EditTextEnterHandler enterHandler = EditTextEnterHandler.attach(editComment, new EditTextEnterHandler.EnterListener() { @Override public boolean shouldCallListener() { return true; } @Override public boolean onHitEnter() { final ParcelableStatus status = getStatus(); if (status == null) return false; if (retweetOrQuote(credentials, status, SHOW_PROTECTED_CONFIRM)) { dismiss(); return true; } return false; } }, sendByEnter); enterHandler.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { updateTextCount(getDialog(), s, status, credentials); } @Override public void afterTextChanged(Editable s) { } }); mPopupMenu = new PopupMenu(context, commentMenu, Gravity.NO_GRAVITY, R.attr.actionOverflowMenuStyle, 0); commentMenu.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mPopupMenu.show(); } }); commentMenu.setOnTouchListener(mPopupMenu.getDragToOpenListener()); mPopupMenu.inflate(R.menu.menu_dialog_comment); final Menu menu = mPopupMenu.getMenu(); MenuUtils.setMenuItemAvailability(menu, R.id.quote_original_status, status.retweet_id != null || status.quoted_id != null); mPopupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem item) { if (item.isCheckable()) { item.setChecked(!item.isChecked()); return true; } return false; } }); dialog.getButton(DialogInterface.BUTTON_POSITIVE).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { boolean dismissDialog = false; if (editComment.length() > 0) { dismissDialog = retweetOrQuote(credentials, status, SHOW_PROTECTED_CONFIRM); } else if (isMyRetweet(status)) { mTwitterWrapper.cancelRetweetAsync(status.account_key, status.id, status.my_retweet_id); dismissDialog = true; } else if (useQuote(!status.user_is_protected, credentials)) { dismissDialog = retweetOrQuote(credentials, status, SHOW_PROTECTED_CONFIRM); } else { TwidereBugReporter.logException(new IllegalStateException(status.toString())); } if (dismissDialog) { dismiss(); } } }); updateTextCount(dialog, editComment.getText(), status, credentials); } }); return dialog; }