List of usage examples for android.widget FrameLayout FrameLayout
public FrameLayout(@NonNull Context context)
From source file:de.vanita5.twittnuker.fragment.support.StaggeredGridFragment.java
/** * Provide default implementation to return a simple list view. Subclasses * can override to replace with their own layout. If doing so, the returned * view hierarchy <em>must</em> have a ListView whose id is * {@link android.R.id#list android.R.id.list} and can optionally have a * sibling view id {@link android.R.id#empty android.R.id.empty} that is to * be shown when the list is empty./* w w w. j a v a2 s . co m*/ * * <p> * If you are overriding this method with your own custom content, consider * including the standard layout {@link android.R.layout#list_content} in * your layout file, so that you continue to retain all of the standard * behavior of ListFragment. In particular, this is currently the only way * to have the built-in indeterminant progress state be shown. */ @Override public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) { final Context context = getActivity(); final FrameLayout root = new FrameLayout(context); // ------------------------------------------------------------------ final LinearLayout pframe = new LinearLayout(context); pframe.setId(INTERNAL_PROGRESS_CONTAINER_ID); pframe.setOrientation(LinearLayout.VERTICAL); pframe.setVisibility(View.GONE); pframe.setGravity(Gravity.CENTER); final ProgressBar progress = new ProgressBar(context, null, android.R.attr.progressBarStyleLarge); pframe.addView(progress, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)); root.addView(pframe, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); // ------------------------------------------------------------------ final FrameLayout lframe = new FrameLayout(context); lframe.setId(INTERNAL_LIST_CONTAINER_ID); final TextView tv = new TextView(getActivity()); tv.setId(INTERNAL_EMPTY_ID); tv.setGravity(Gravity.CENTER); lframe.addView(tv, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); final StaggeredGridView lv = (StaggeredGridView) inflater.inflate(R.layout.staggered_gridview, lframe, false); lv.setId(android.R.id.list); lv.setDrawSelectorOnTop(false); lframe.addView(lv, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); root.addView(lframe, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); // ------------------------------------------------------------------ root.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); return root; }
From source file:com.origamilabs.library.app.StaggeredGridFragment.java
/** * Provide default implementation to return a simple list view. Subclasses * can override to replace with their own layout. If doing so, the returned * view hierarchy <em>must</em> have a StaggeredGridView whose id is * {@link android.R.id#list android.R.id.list} and can optionally have a * sibling view id {@link android.R.id#empty android.R.id.empty} that is to * be shown when the list is empty./* ww w. j a va2s .c o m*/ * * <p> * If you are overriding this method with your own custom content, consider * including the standard layout {@link android.R.layout#list_content} in * your layout file, so that you continue to retain all of the standard * behavior of ListFragment. In particular, this is currently the only way * to have the built-in indeterminant progress state be shown. */ @Override public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) { final Context context = getActivity(); final FrameLayout root = new FrameLayout(context); // ------------------------------------------------------------------ final LinearLayout pframe = new LinearLayout(context); pframe.setId(INTERNAL_PROGRESS_CONTAINER_ID); pframe.setOrientation(LinearLayout.VERTICAL); pframe.setVisibility(View.GONE); pframe.setGravity(Gravity.CENTER); final ProgressBar progress = new ProgressBar(context, null, android.R.attr.progressBarStyleLarge); pframe.addView(progress, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)); root.addView(pframe, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); // ------------------------------------------------------------------ final FrameLayout lframe = new FrameLayout(context); lframe.setId(INTERNAL_LIST_CONTAINER_ID); final TextView tv = new TextView(getActivity()); tv.setId(INTERNAL_EMPTY_ID); tv.setGravity(Gravity.CENTER); lframe.addView(tv, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); final StaggeredGridView lv = new StaggeredGridView(getActivity()); lv.setId(android.R.id.list); lv.setDrawSelectorOnTop(false); lframe.addView(lv, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); root.addView(lframe, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); // ------------------------------------------------------------------ root.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); return root; }
From source file:org.telegram.ui.PrivacySettingsActivity.java
@Override public View createView(Context context) { actionBar.setBackButtonImage(R.drawable.ic_ab_back); actionBar.setAllowOverlayTitle(true); actionBar.setTitle(LocaleController.getString("PrivacySettings", R.string.PrivacySettings)); actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() { @Override//from w ww .j a v a 2 s . c om public void onItemClick(int id) { if (id == -1) { finishFragment(); } } }); listAdapter = new ListAdapter(context); fragmentView = new FrameLayout(context); FrameLayout frameLayout = (FrameLayout) fragmentView; frameLayout.setBackgroundColor(ContextCompat.getColor(context, R.color.settings_background)); ListView listView = new ListView(context); listView.setDivider(null); listView.setDividerHeight(0); listView.setVerticalScrollBarEnabled(false); listView.setDrawSelectorOnTop(true); frameLayout.addView(listView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT)); listView.setAdapter(listAdapter); listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapterView, View view, final int i, long l) { if (i == blockedRow) { presentFragment(new BlockedUsersActivity()); } else if (i == sessionsRow) { presentFragment(new SessionsActivity()); } else if (i == deleteAccountRow) { if (getParentActivity() == null) { return; } AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity()); builder.setTitle(LocaleController.getString("DeleteAccountTitle", R.string.DeleteAccountTitle)); builder.setItems( new CharSequence[] { LocaleController.formatPluralString("Months", 1), LocaleController.formatPluralString("Months", 3), LocaleController.formatPluralString("Months", 6), LocaleController.formatPluralString("Years", 1) }, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { int value = 0; if (which == 0) { value = 30; } else if (which == 1) { value = 90; } else if (which == 2) { value = 182; } else if (which == 3) { value = 365; } final ProgressDialog progressDialog = new ProgressDialog(getParentActivity()); progressDialog .setMessage(LocaleController.getString("Loading", R.string.Loading)); progressDialog.setCanceledOnTouchOutside(false); progressDialog.setCancelable(false); progressDialog.show(); final TLRPC.TL_account_setAccountTTL req = new TLRPC.TL_account_setAccountTTL(); req.ttl = new TLRPC.TL_accountDaysTTL(); req.ttl.days = value; ConnectionsManager.getInstance().sendRequest(req, new RequestDelegate() { @Override public void run(final TLObject response, final TLRPC.TL_error error) { AndroidUtilities.runOnUIThread(new Runnable() { @Override public void run() { try { progressDialog.dismiss(); } catch (Exception e) { FileLog.e("tmessages", e); } if (response instanceof TLRPC.TL_boolTrue) { ContactsController.getInstance() .setDeleteAccountTTL(req.ttl.days); listAdapter.notifyDataSetChanged(); } } }); } }); } }); builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null); showDialog(builder.create()); } else if (i == lastSeenRow) { presentFragment(new PrivacyControlActivity(false)); } else if (i == groupsRow) { presentFragment(new PrivacyControlActivity(true)); } else if (i == passwordRow) { presentFragment(new TwoStepVerificationActivity(0)); } else if (i == passcodeRow) { if (UserConfig.passcodeHash.length() > 0) { presentFragment(new PasscodeActivity(2)); } else { presentFragment(new PasscodeActivity(0)); } } else if (i == secretWebpageRow) { if (MessagesController.getInstance().secretWebpagePreview == 1) { MessagesController.getInstance().secretWebpagePreview = 0; } else { MessagesController.getInstance().secretWebpagePreview = 1; } ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", Activity.MODE_PRIVATE) .edit().putInt("secretWebpage2", MessagesController.getInstance().secretWebpagePreview) .commit(); if (view instanceof TextCheckCell) { ((TextCheckCell) view) .setChecked(MessagesController.getInstance().secretWebpagePreview == 1); } } } }); return fragmentView; }
From source file:org.dvbviewer.controller.ui.base.BaseListFragment.java
/** * Provide default implementation to return a simple list view. Subclasses * can override to replace with their own layout. If doing so, the * returned view hierarchy <em>must</em> have a ListView whose id * is {@link android.R.id#list android.R.id.list} and can optionally * have a sibling view id {@link android.R.id#empty android.R.id.empty} * that is to be shown when the list is empty. * /* w w w . j a va 2 s . co m*/ * <p>If you are overriding this method with your own custom content, * consider including the standard layout {@link android.R.layout#list_content} * in your layout file, so that you continue to retain all of the standard * behavior of ListFragment. In particular, this is currently the only * way to have the built-in indeterminant progress state be shown. * * @param inflater the inflater * @param container the container * @param savedInstanceState the saved instance state * @return the view * @author RayBa * @date 07.04.2013 */ @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final Context context = getActivity(); if (layoutRessource > 0) { View v = getLayoutInflater(savedInstanceState).inflate(layoutRessource, null); return v; } else { FrameLayout root = new FrameLayout(context); // ------------------------------------------------------------------ LinearLayout pframe = new LinearLayout(context); pframe.setId(INTERNAL_PROGRESS_CONTAINER_ID); pframe.setOrientation(LinearLayout.VERTICAL); pframe.setVisibility(View.GONE); pframe.setGravity(Gravity.CENTER); ProgressBar progress = new ProgressBar(context, null, android.R.attr.progressBarStyle); pframe.addView(progress, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)); root.addView(pframe, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT)); // ------------------------------------------------------------------ FrameLayout lframe = new FrameLayout(context); lframe.setId(INTERNAL_LIST_CONTAINER_ID); TextView tv = new TextView(getActivity()); tv.setId(INTERNAL_EMPTY_ID); tv.setGravity(Gravity.CENTER); tv.setTextAppearance(getActivity(), android.R.style.TextAppearance_Medium); lframe.addView(tv, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT)); ListView lv = new ListView(getActivity()); lv.setId(android.R.id.list); lv.setDrawSelectorOnTop(false); lframe.addView(lv, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT)); root.addView(lframe, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT)); // ------------------------------------------------------------------ root.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT)); return root; } }
From source file:com.waz.zclient.ui.cursor.CursorToolbar.java
private void createItems() { LayoutInflater inflater = LayoutInflater.from(getContext()); int diameter = getResources().getDimensionPixelSize(R.dimen.cursor__menu_button__diameter); int rightMargin; /*/*from w ww . j a v a2s .co m*/ As long as 4 mainItems are shown in the toolbar, they are spread out equally in phone */ rightMargin = CursorUtils.getMarginBetweenCursorButtons(getContext()); CursorIconButton cursorIconButton; for (int i = 0; i < cursorItems.size(); i++) { final CursorMenuItem item = cursorItems.get(i); final FrameLayout buttonContainer = new FrameLayout(getContext()); buttonContainer.setId(item.resId); cursorIconButton = (CursorIconButton) inflater.inflate(R.layout.cursor__item, this, false); cursorIconButton.setText(item.glyphResId); cursorIconButton .setPressedBackgroundColor(ContextCompat.getColor(getContext(), R.color.light_graphite)); switch (item) { case CAMERA: cursorIconButtonCamera = cursorIconButton; break; case AUDIO_MESSAGE: cursorIconButtonAudio = cursorIconButton; break; } if (item == CursorMenuItem.DUMMY) { cursorIconButton.initTextColor(ContextCompat.getColor(getContext(), R.color.transparent)); cursorIconButton .setPressedBackgroundColor(ContextCompat.getColor(getContext(), R.color.transparent)); cursorIconButton.setBackgroundColor(ContextCompat.getColor(getContext(), R.color.transparent)); } buttonContainer.setTag(item); buttonContainer.setLongClickable(true); buttonContainer.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View view, MotionEvent motionEvent) { CursorMenuItem item = (CursorMenuItem) view.getTag(); touchedButtonContainer = buttonContainer; if (callback != null && item == CursorMenuItem.AUDIO_MESSAGE) { callback.onMotionEvent(item, motionEvent); } detector.onTouchEvent(motionEvent); return false; } }); FrameLayout.LayoutParams paramsButton = new FrameLayout.LayoutParams(diameter, diameter); paramsButton.gravity = Gravity.CENTER; buttonContainer.addView(cursorIconButton, paramsButton); LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(buttonWidth, ViewGroup.LayoutParams.MATCH_PARENT); if (i < cursorItems.size() - 1) { params.rightMargin = rightMargin; } addView(buttonContainer, params); } }
From source file:com.b44t.ui.Components.PasscodeView.java
public PasscodeView(final Context context) { super(context); setWillNotDraw(false);//w ww .java 2s .c o m setVisibility(GONE); backgroundFrameLayout = new FrameLayout(context); addView(backgroundFrameLayout); LayoutParams layoutParams = (LayoutParams) backgroundFrameLayout.getLayoutParams(); layoutParams.width = LayoutHelper.MATCH_PARENT; layoutParams.height = LayoutHelper.MATCH_PARENT; backgroundFrameLayout.setLayoutParams(layoutParams); passwordFrameLayout = new FrameLayout(context); addView(passwordFrameLayout); layoutParams = (LayoutParams) passwordFrameLayout.getLayoutParams(); layoutParams.width = LayoutHelper.MATCH_PARENT; layoutParams.height = LayoutHelper.MATCH_PARENT; layoutParams.gravity = Gravity.TOP | Gravity.LEFT; passwordFrameLayout.setLayoutParams(layoutParams); ImageView imageView = new ImageView(context); imageView.setScaleType(ImageView.ScaleType.FIT_XY); imageView.setImageResource(R.drawable.ic_launcher /* EDIT BY MR -- was: passcode_logo */); passwordFrameLayout.addView(imageView); layoutParams = (LayoutParams) imageView.getLayoutParams(); if (AndroidUtilities.density < 1) { layoutParams.width = AndroidUtilities.dp(30); layoutParams.height = AndroidUtilities.dp(30); } else { layoutParams.width = AndroidUtilities.dp(40); layoutParams.height = AndroidUtilities.dp(40); } layoutParams.gravity = Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM; layoutParams.bottomMargin = AndroidUtilities.dp(100); imageView.setLayoutParams(layoutParams); passcodeTextView = new TextView(context); passcodeTextView.setTextColor(0xffffffff); passcodeTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14); passcodeTextView.setGravity(Gravity.CENTER_HORIZONTAL); passwordFrameLayout.addView(passcodeTextView); layoutParams = (LayoutParams) passcodeTextView.getLayoutParams(); layoutParams.width = LayoutHelper.WRAP_CONTENT; layoutParams.height = LayoutHelper.WRAP_CONTENT; layoutParams.bottomMargin = AndroidUtilities.dp(62); layoutParams.gravity = Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL; passcodeTextView.setLayoutParams(layoutParams); passwordEditText = new EditText(context); passwordEditText.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 36); passwordEditText.setTextColor(0xffffffff); passwordEditText.setMaxLines(1); passwordEditText.setLines(1); passwordEditText.setGravity(Gravity.CENTER_HORIZONTAL); passwordEditText.setSingleLine(true); passwordEditText.setImeOptions(EditorInfo.IME_ACTION_DONE); passwordEditText.setTypeface(Typeface.DEFAULT); passwordEditText.setBackgroundDrawable(null); AndroidUtilities.clearCursorDrawable(passwordEditText); passwordFrameLayout.addView(passwordEditText); layoutParams = (FrameLayout.LayoutParams) passwordEditText.getLayoutParams(); layoutParams.height = LayoutHelper.WRAP_CONTENT; layoutParams.width = LayoutHelper.MATCH_PARENT; layoutParams.leftMargin = AndroidUtilities.dp(70); layoutParams.rightMargin = AndroidUtilities.dp(70); layoutParams.bottomMargin = AndroidUtilities.dp(6); layoutParams.gravity = Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL; passwordEditText.setLayoutParams(layoutParams); passwordEditText.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) { if (i == EditorInfo.IME_ACTION_DONE) { processDone(false); return true; } return false; } }); passwordEditText.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) { } @Override public void afterTextChanged(Editable s) { if (passwordEditText.length() == 4 && UserConfig.passcodeType == 0) { processDone(false); } } }); passwordEditText.setCustomSelectionActionModeCallback(new ActionMode.Callback() { public boolean onPrepareActionMode(ActionMode mode, Menu menu) { return false; } public void onDestroyActionMode(ActionMode mode) { } public boolean onCreateActionMode(ActionMode mode, Menu menu) { return false; } public boolean onActionItemClicked(ActionMode mode, MenuItem item) { return false; } }); checkImage = new ImageView(context); checkImage.setImageResource(R.drawable.passcode_check); checkImage.setScaleType(ImageView.ScaleType.CENTER); checkImage.setBackgroundResource(R.drawable.bar_selector_lock); passwordFrameLayout.addView(checkImage); layoutParams = (LayoutParams) checkImage.getLayoutParams(); layoutParams.width = AndroidUtilities.dp(60); layoutParams.height = AndroidUtilities.dp(60); layoutParams.bottomMargin = AndroidUtilities.dp(4); layoutParams.rightMargin = AndroidUtilities.dp(10); layoutParams.gravity = Gravity.BOTTOM | Gravity.RIGHT; checkImage.setLayoutParams(layoutParams); checkImage.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { processDone(false); } }); FrameLayout lineFrameLayout = new FrameLayout(context); lineFrameLayout.setBackgroundColor(0x26ffffff); passwordFrameLayout.addView(lineFrameLayout); layoutParams = (LayoutParams) lineFrameLayout.getLayoutParams(); layoutParams.width = LayoutHelper.MATCH_PARENT; layoutParams.height = AndroidUtilities.dp(1); layoutParams.gravity = Gravity.BOTTOM | Gravity.LEFT; layoutParams.leftMargin = AndroidUtilities.dp(20); layoutParams.rightMargin = AndroidUtilities.dp(20); lineFrameLayout.setLayoutParams(layoutParams); numbersFrameLayout = new FrameLayout(context); addView(numbersFrameLayout); layoutParams = (LayoutParams) numbersFrameLayout.getLayoutParams(); layoutParams.width = LayoutHelper.MATCH_PARENT; layoutParams.height = LayoutHelper.MATCH_PARENT; layoutParams.gravity = Gravity.TOP | Gravity.LEFT; numbersFrameLayout.setLayoutParams(layoutParams); lettersTextViews = new ArrayList<>(10); numberTextViews = new ArrayList<>(10); numberFrameLayouts = new ArrayList<>(10); for (int a = 0; a < 10; a++) { TextView textView = new TextView(context); textView.setTextColor(0xffffffff); textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 36); textView.setGravity(Gravity.CENTER); textView.setText(String.format(Locale.US, "%d", a)); numbersFrameLayout.addView(textView); layoutParams = (LayoutParams) textView.getLayoutParams(); layoutParams.width = AndroidUtilities.dp(50); layoutParams.height = AndroidUtilities.dp(50); layoutParams.gravity = Gravity.TOP | Gravity.LEFT; textView.setLayoutParams(layoutParams); numberTextViews.add(textView); textView = new TextView(context); textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 12); textView.setTextColor(0x7fffffff); textView.setGravity(Gravity.CENTER); numbersFrameLayout.addView(textView); layoutParams = (LayoutParams) textView.getLayoutParams(); layoutParams.width = AndroidUtilities.dp(50); layoutParams.height = AndroidUtilities.dp(20); layoutParams.gravity = Gravity.TOP | Gravity.LEFT; textView.setLayoutParams(layoutParams); switch (a) { case 0: textView.setText("+"); break; case 2: textView.setText("ABC"); break; case 3: textView.setText("DEF"); break; case 4: textView.setText("GHI"); break; case 5: textView.setText("JKL"); break; case 6: textView.setText("MNO"); break; case 7: textView.setText("PQRS"); break; case 8: textView.setText("TUV"); break; case 9: textView.setText("WXYZ"); break; default: break; } lettersTextViews.add(textView); } eraseView = new ImageView(context); eraseView.setScaleType(ImageView.ScaleType.CENTER); eraseView.setImageResource(R.drawable.passcode_delete); numbersFrameLayout.addView(eraseView); layoutParams = (LayoutParams) eraseView.getLayoutParams(); layoutParams.width = AndroidUtilities.dp(50); layoutParams.height = AndroidUtilities.dp(50); layoutParams.gravity = Gravity.TOP | Gravity.LEFT; eraseView.setLayoutParams(layoutParams); for (int a = 0; a < 11; a++) { FrameLayout frameLayout = new FrameLayout(context); frameLayout.setBackgroundResource(R.drawable.bar_selector_lock); frameLayout.setTag(a); if (a == 10) { frameLayout.setOnLongClickListener(new OnLongClickListener() { @Override public boolean onLongClick(View v) { passwordEditText.setText(""); return true; } }); } frameLayout.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { int tag = (Integer) v.getTag(); switch (tag) { case 0: appendCharacter("0"); break; case 1: appendCharacter("1"); break; case 2: appendCharacter("2"); break; case 3: appendCharacter("3"); break; case 4: appendCharacter("4"); break; case 5: appendCharacter("5"); break; case 6: appendCharacter("6"); break; case 7: appendCharacter("7"); break; case 8: appendCharacter("8"); break; case 9: appendCharacter("9"); break; case 10: String text = passwordEditText.getText().toString(); if (text.length() > 0) { passwordEditText.setText(text.substring(0, text.length() - 1)); } break; } if (passwordEditText.getText().toString().length() == 4) { processDone(false); } } }); numberFrameLayouts.add(frameLayout); } for (int a = 10; a >= 0; a--) { FrameLayout frameLayout = numberFrameLayouts.get(a); numbersFrameLayout.addView(frameLayout); layoutParams = (LayoutParams) frameLayout.getLayoutParams(); layoutParams.width = AndroidUtilities.dp(100); layoutParams.height = AndroidUtilities.dp(100); layoutParams.gravity = Gravity.TOP | Gravity.LEFT; frameLayout.setLayoutParams(layoutParams); } }
From source file:com.hackensack.umc.activity.ProfileSelfieActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (savedInstanceState != null) { imageUri = Uri.parse(savedInstanceState.getString(Constant.CAPTURE_IMAGE_URI)); }// w ww . j av a 2 s . c o m //setContentView(R.layout.activity_profile_selfie); getSupportActionBar().setDisplayHomeAsUpEnabled(true); frameLayout = new FrameLayout(this); // creating LayoutParams FrameLayout.LayoutParams frameLayoutParam = new FrameLayout.LayoutParams( FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT); // set LinearLayout as a root element of the screen setContentView(frameLayout, frameLayoutParam); layoutInflater = LayoutInflater.from(this); View mainView = layoutInflater.inflate(R.layout.activity_profile_selfie, null, false); infalteXml(mainView); frameLayout.addView(mainView); //setContentView(R.layout.activity_list); }
From source file:com.chute.components.android.imagesharer.activity.DialogActivity.java
@Override public View getWebView() { webView = new WebView(getApplicationContext()); webView.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY); webView.setWebViewClient(new BaseWebViewClient()); webView.getSettings().setJavaScriptEnabled(true); webView.getSettings().setDomStorageEnabled(true); webView.setKeepScreenOn(true);/*from w ww . jav a 2 s.c o m*/ webView.getSettings().setBuiltInZoomControls(true); webView.getSettings().setUserAgentString( "Mozilla/5.0 (Linux; U; Android 2.0; en-us; Droid Build/ESD20) AppleWebKit/530.17 (KHTML, like Gecko) Version/4.0 Mobile Safari/530.17"); webView.getSettings().setAllowFileAccess(true); webView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true); FrameLayout frameLayout = new FrameLayout(getApplicationContext()); frameLayout.setMinimumHeight(150); progressBar = new ProgressBar(getApplicationContext()); FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(100, 100); layoutParams.gravity = Gravity.CENTER; progressBar.setLayoutParams(layoutParams); frameLayout.addView(webView); frameLayout.addView(progressBar); return frameLayout; }
From source file:com.harlan.jxust.ui.view.bottombar.BottomBarBadge.java
protected BottomBarBadge(Context context, int position, final View tabToAddTo, // Rhyming accidentally! That's a Smoove Move! int backgroundColor) { super(context); ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); setLayoutParams(params);/*from ww w . ja va 2 s .c o m*/ setGravity(Gravity.CENTER); MiscUtils.setTextAppearance(this, R.style.BB_BottomBarBadge_Text); int three = MiscUtils.dpToPixel(context, 3); ShapeDrawable backgroundCircle = BadgeCircle.make(three * 3, backgroundColor); setPadding(three, three, three, three); setBackgroundCompat(backgroundCircle); FrameLayout container = new FrameLayout(context); container.setLayoutParams(params); ViewGroup parent = (ViewGroup) tabToAddTo.getParent(); parent.removeView(tabToAddTo); container.addView(tabToAddTo); container.addView(this); parent.addView(container, position); container.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { @SuppressWarnings("deprecation") @Override public void onGlobalLayout() { adjustPositionAndSize(tabToAddTo); } }); }
From source file:com.hackensack.umc.activity.ProfileSelfiewithCropActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //setContentView(R.layout.activity_profile_selfie); getSupportActionBar().setDisplayHomeAsUpEnabled(true); if (savedInstanceState != null) { try {/*from w w w .j av a 2s . c o m*/ imageUri = Uri.parse(savedInstanceState.getString("image-path")); } catch (Exception e) { } } frameLayout = new FrameLayout(this); // creating LayoutParams FrameLayout.LayoutParams frameLayoutParam = new FrameLayout.LayoutParams( FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT); // set LinearLayout as a root element of the screen setContentView(frameLayout, frameLayoutParam); layoutInflater = LayoutInflater.from(this); View mainView = layoutInflater.inflate(R.layout.activity_profile_selfie, null, false); infalteXml(mainView); frameLayout.addView(mainView); //setContentView(R.layout.activity_list); }