List of usage examples for android.view LayoutInflater from
public static LayoutInflater from(Context context)
From source file:cm.aptoide.pt.ManageRepo.java
private void editRepo(final String repo) { LayoutInflater li = LayoutInflater.from(this); View view = li.inflate(R.layout.addrepo, null); Builder p = new AlertDialog.Builder(this).setView(view); final AlertDialog alrt = p.create(); final EditText uri = (EditText) view.findViewById(R.id.edit_uri); uri.setText(repo);/* ww w. ja v a 2 s. c om*/ final EditText sec_user = (EditText) view.findViewById(R.id.sec_user); final EditText sec_pwd = (EditText) view.findViewById(R.id.sec_pwd); final CheckBox sec = (CheckBox) view.findViewById(R.id.secure_chk); sec.setOnCheckedChangeListener(new OnCheckedChangeListener() { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if (isChecked) { sec_user.setEnabled(true); sec_pwd.setEnabled(true); } else { sec_user.setEnabled(false); sec_pwd.setEnabled(false); } } }); String[] logins = null; logins = db.getLogin(repo); if (logins != null) { sec.setChecked(true); sec_user.setText(logins[0]); sec_pwd.setText(logins[1]); } else { sec.setChecked(false); } alrt.setIcon(android.R.drawable.ic_menu_add); alrt.setTitle("Edit repository"); alrt.setButton("Done", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { String new_repo = uri.getText().toString(); db.updateServer(repo, new_repo); if (sec.isChecked()) { db.addLogin(sec_user.getText().toString(), sec_pwd.getText().toString(), new_repo); } else { db.disableLogin(new_repo); } change = true; redraw(); } }); alrt.setButton2("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { return; } }); alert2.dismiss(); alrt.show(); }
From source file:com.ximai.savingsmore.save.activity.FourStepRegisterActivity.java
@Override public void onClick(View v) { switch (v.getId()) { case R.id.submit: if (store_name.getText() == null || TextUtils.isEmpty(store_name.getText())) { Toast.makeText(FourStepRegisterActivity.this, "??", Toast.LENGTH_SHORT).show(); } else if (phone_number.getText() == null || TextUtils.isEmpty(phone_number.getText())) { Toast.makeText(FourStepRegisterActivity.this, "?", Toast.LENGTH_SHORT).show(); } else if (address.getmTvRightText() == null || TextUtils.isEmpty(address.getmTvRightText())) { Toast.makeText(FourStepRegisterActivity.this, "?", Toast.LENGTH_SHORT).show(); } else if (xixiang_adress.getText() == null || TextUtils.isEmpty(xixiang_adress.getText())) { Toast.makeText(FourStepRegisterActivity.this, "", Toast.LENGTH_SHORT).show(); } else if (good_type.getmTvRightText() == null || TextUtils.isEmpty(good_type.getmTvRightText()) || good_type.getmTvRightText().equals("")) { Toast.makeText(FourStepRegisterActivity.this, "?", Toast.LENGTH_SHORT).show(); } else if (good_range.getmTvRightText() == null || TextUtils.isEmpty(good_range.getmTvRightText()) || good_range.getmTvRightText().equals("")) { Toast.makeText(FourStepRegisterActivity.this, "?", Toast.LENGTH_SHORT).show(); } else if (zhizhao_path == null || TextUtils.isEmpty(zhizhao_path)) { Toast.makeText(FourStepRegisterActivity.this, "?", Toast.LENGTH_SHORT).show(); } else {/*from w ww . j a v a 2 s. co m*/ myUserExtInfo.StoreName = store_name.getText().toString(); myUserExtInfo.OfficePhone = phone_number.getText().toString(); myUserExtInfo.WebSite = website.getText().toString(); userParameter.WeChat = weChat.getText().toString(); userParameter.Domicile = xixiang_adress.getText().toString(); myUserExtInfo.FoundingDate = create_date.getmTvRightText(); myUserExtInfo.BusinessLicenseNumber = zhizhao_number.getText().toString(); myUserExtInfo.LicenseKeyNumber = zhegnshu_number.getText().toString(); userParameter.UserDisplayName = lianxiren.getText().toString(); userParameter.Post = position.getText().toString(); //list_images.addAll(images); myUserExtInfo.Images = images; if (good_type.getmTvRightText().equals("???")) { myUserExtInfo.IsBag = "true"; } else { myUserExtInfo.IsBag = "false"; } list1.add(myBusinessScopes); userParameter.BusinessScopes = list1; userParameter.UserExtInfo = myUserExtInfo; if (a == b) { save_message(userParameter); } } break; case R.id.create_time: UsePicker.showYearMonthDay(FourStepRegisterActivity.this, new UsePicker.CallBack() { @Override public void callBack(String time) { create_date.getmTvRight_().setText(time); } }, create_date.getmTvRightText()); break; case R.id.head_image: isslinece = false; isItem = false; isheadImage = true; isZhengshu = false; showSetIconWindow(); break; case R.id.good_type: PopupWindowFromBottomUtil.shouWindowWithWheel( FourStepRegisterActivity.this, LayoutInflater.from(FourStepRegisterActivity.this) .inflate(R.layout.business_my_center_activity, null), list_type, new PopupWindowFromBottomUtil.Listener() { @Override public void confirm(String content, PopupWindow window) { good_type.getmTvRight_().setText(content); window.dismiss(); } }); break; case R.id.range: if (good_type.getmTvRightText().equals("???")) { PopupWindowFromBottomUtil.shouRange(FourStepRegisterActivity.this, LayoutInflater.from(FourStepRegisterActivity.this) .inflate(R.layout.business_my_center_activity, null), good_one_classify, new PopupWindowFromBottomUtil.Listener2() { @Override public void callBack(BaseMessage Id1, String content, PopupWindow popupWindow) { good_range.getmTvRight_().setText(content); // myDictNode.Name = Id1.Name; // myDictNode.SortNo = Id1.SortNo; // myDictNode.Id=Id1.Id; myBusinessScopes.DictNodeId = Id1.Id; popupWindow.dismiss(); } }); } else { PopupWindowFromBottomUtil.shouRange(FourStepRegisterActivity.this, LayoutInflater.from(FourStepRegisterActivity.this) .inflate(R.layout.business_my_center_activity, null), good_two_classify, new PopupWindowFromBottomUtil.Listener2() { @Override public void callBack(BaseMessage Id1, String content, PopupWindow popupWindow) { good_range.getmTvRight_().setText(content); // myDictNode.Name = Id1.Name; // myDictNode.SortNo = Id1.SortNo; // myDictNode.Id=Id1.Id; myBusinessScopes.DictNodeId = Id1.Id; popupWindow.dismiss(); } }); } break; case R.id.adress: PopupWindowFromBottomUtil.showAddress( FourStepRegisterActivity.this, LayoutInflater.from(FourStepRegisterActivity.this) .inflate(R.layout.business_my_center_activity, null), list, new PopupWindowFromBottomUtil.Listenre1() { @Override public void callBack(String Id1, String Id2, String Id3, String content, PopupWindow popupWindow) { if (null != Id1) { userParameter.ProvinceId = Id1; } if (null != Id2) { userParameter.CityId = Id2; } if (null != Id3) { userParameter.AreaId = Id3; } address.getmTvRight_().setText(content); popupWindow.dismiss(); } }); break; case R.id.liscense_item: isslinece = true; isItem = false; isheadImage = false; isZhengshu = false; showSetIconWindow(); break; case R.id.zhengshu_item: isItem = false; isheadImage = false; isslinece = false; isZhengshu = true; showSetIconWindow(); break; case R.id.btnCancel: setIconWindow.dismiss(); break; case R.id.btnCamera: openCamera(); setIconWindow.dismiss(); break; case R.id.btnAlbum: openAlbum(); setIconWindow.dismiss(); break; } }
From source file:com.development.androrb.listfolders.java
@Override protected Dialog onCreateDialog(int id) { switch (id) { case 1://from w ww . ja va2 s.com // This example shows how to add a custom layout to an AlertDialog LayoutInflater factory = LayoutInflater.from(this); final View textEntryView = factory.inflate(R.layout.login_dialog, null); EditText dusernamefield = (EditText) textEntryView.findViewById(R.id.username_edit); dusernamefield.setText(Username); EditText dpasswordfield = (EditText) textEntryView.findViewById(R.id.password_edit); dpasswordfield.setText(Password); return new AlertDialog.Builder(listfolders.this).setIcon(R.drawable.alert_dialog_icon) .setTitle("Login Data").setView(textEntryView) .setPositiveButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { Dialog curDialog = (Dialog) dialog; EditText dusernamefield = (EditText) curDialog.findViewById(R.id.username_edit); EditText dpasswordfield = (EditText) curDialog.findViewById(R.id.password_edit); String dusername = dusernamefield.getText().toString(); String dpassword = dpasswordfield.getText().toString(); SharedPreferences preferences = getPreferences(MODE_PRIVATE); SharedPreferences.Editor editor = preferences.edit(); editor.putString("UID", dusername); editor.commit(); editor.putString("PW", dpassword); editor.commit(); Intent mainIntent = new Intent(listfolders.this, listfolders.class); listfolders.this.startActivity(mainIntent); listfolders.this.finish(); /* User clicked OK so do some stuff */ } }).setNegativeButton("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { /* User clicked cancel so do some stuff */ } }).create(); case 2: // This example shows how to add a custom layout to an AlertDialog LayoutInflater factory2 = LayoutInflater.from(this); final View apiEntryView = factory2.inflate(R.layout.apikey, null); EditText dapikeyfield = (EditText) apiEntryView.findViewById(R.id.api_edit); dapikeyfield.setText(apikey); return new AlertDialog.Builder(listfolders.this).setIcon(R.drawable.alert_dialog_icon) .setTitle("API KEY").setView(apiEntryView) .setPositiveButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { Dialog curDialog = (Dialog) dialog; EditText dapikeyfield = (EditText) curDialog.findViewById(R.id.api_edit); String dapikey = dapikeyfield.getText().toString(); SharedPreferences preferences = getPreferences(MODE_PRIVATE); SharedPreferences.Editor editor = preferences.edit(); editor.putString("API", dapikey); editor.commit(); Intent mainIntent = new Intent(listfolders.this, listfolders.class); listfolders.this.startActivity(mainIntent); listfolders.this.finish(); /* User clicked OK so do some stuff */ } }).setNegativeButton("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { /* User clicked cancel so do some stuff */ } }).create(); case 3: // This example shows how to add a custom layout to an AlertDialog LayoutInflater factory3 = LayoutInflater.from(this); final View maxEntryView = factory3.inflate(R.layout.maxcount, null); EditText dmaxkeyfield = (EditText) maxEntryView.findViewById(R.id.maxcount_edit); dmaxkeyfield.setText(maxcount); dmaxkeyfield.setKeyListener(new NumberKeyListener() { @Override protected char[] getAcceptedChars() { char[] numberChars = { '1', '2', '3', '4', '5', '6', '7', '8', '9', '0' }; return numberChars; } @Override public int getInputType() { return InputType.TYPE_CLASS_NUMBER; } }); return new AlertDialog.Builder(listfolders.this).setIcon(R.drawable.alert_dialog_icon) .setTitle("Max Item p.Page").setView(maxEntryView) .setPositiveButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { Dialog curDialog = (Dialog) dialog; EditText dmaxkeyfield = (EditText) curDialog.findViewById(R.id.maxcount_edit); String dmaxcount = dmaxkeyfield.getText().toString(); int idmaxcount = Integer.parseInt(dmaxcount); if (idmaxcount < 10) dmaxcount = "10"; if (idmaxcount > 500) dmaxcount = "500"; SharedPreferences preferences = getPreferences(MODE_PRIVATE); SharedPreferences.Editor editor = preferences.edit(); editor.putString("MAX", dmaxcount); editor.commit(); Intent mainIntent = new Intent(listfolders.this, listfolders.class); listfolders.this.startActivity(mainIntent); listfolders.this.finish(); /* User clicked OK so do some stuff */ } }).setNegativeButton("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { /* User clicked cancel so do some stuff */ } }).create(); } return null; }
From source file:edu.missouri.niaaa.ema.activity.AdminManageActivity.java
private Dialog removeDialog(Context context) { LayoutInflater inflater = LayoutInflater.from(context); final View textEntryView = inflater.inflate(R.layout.remove_id, null); final CheckBox rm_check = (CheckBox) textEntryView.findViewById(R.id.rm_local); rm_check.setText(R.string.remove_local); AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setView(textEntryView);/*from w w w . ja v a2s. co m*/ builder.setCancelable(false); builder.setTitle(R.string.assign_remove_title); builder.setMessage(R.string.remove_msg); builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // TODO Auto-generated method stub cleanUp(ctx);//replace following // editor.putString(Utilities.SP_KEY_LOGIN_USERID, ""); // editor.putString(Utilities.SP_KEY_LOGIN_USERPWD, ""); // editor.putString(Utilities.SP_KEY_LOGIN_STUDY_STARTTIME, ""); // editor.commit(); // remove local file, if checked Log.d(TAG, "is checked " + rm_check.isChecked()); if (rm_check.isChecked()) { deleteDirectory(Utilities.PHONE_BASE_PATH); } setHints(); finish(); } }); builder.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // TODO Auto-generated method stub } }); return builder.create(); }
From source file:com.sawyer.advadapters.widget.NFJSONArrayAdapter.java
private void init(Context context, JSONArray objects) { mInflater = LayoutInflater.from(context); mContext = context; mObjects = objects; }
From source file:com.gsma.mobileconnect.helpers.AuthorizationService.java
/** * Handles the process between the MNO and the end user for the end user to * sign in/ authorize the application. The application hands over to the * browser during the authorization step. On completion the MNO redirects to * the application sending the completion information as URL parameters. * * @param config the mobile config * @param authUri the URI to the MNO's authorization page * @param scopes which is an application specified string value. * @param redirectUri which is the return point after the user has * authenticated/consented. * @param state which is application specified. * @param nonce which is application specified. * @param maxAge which is an integer value. * @param acrValues which is an application specified. * @param context The Android context * @param listener The listener used to alert the activity to the change * @param response The information captured in the discovery phase. * @param hmapExtraOptions A HashMap containing additional authorization options * @throws UnsupportedEncodingException// w w w . jav a2 s .c o m */ public void authorize(final MobileConnectConfig config, String authUri, final String scopes, final String redirectUri, final String state, final String nonce, final int maxAge, final String acrValues, final Context context, final AuthorizationListener listener, final DiscoveryResponse response, final HashMap<String, Object> hmapExtraOptions) throws UnsupportedEncodingException { final JsonNode discoveryResponseWrapper = response.getResponseData(); final JsonNode discoveryResponseJsonNode = discoveryResponseWrapper.get("response"); String clientId = null; String clientSecret = null; try { clientId = AndroidJsonUtils.getExpectedStringValue(discoveryResponseJsonNode, "client_id"); } catch (final NoFieldException e) { e.printStackTrace(); } Log.d(TAG, "clientId = " + clientId); try { clientSecret = AndroidJsonUtils.getExpectedStringValue(discoveryResponseJsonNode, "client_secret"); } catch (final NoFieldException e) { e.printStackTrace(); } Log.d(TAG, "clientSecret = " + clientSecret); try { Log.d(TAG, "clientSecret = " + clientId); Log.d(TAG, "authUri = " + authUri); Log.d(TAG, "responseType = code"); Log.d(TAG, "clientId = " + clientSecret); Log.d(TAG, "scopes = " + scopes); Log.d(TAG, "returnUri = " + redirectUri); Log.d(TAG, "state = " + state); Log.d(TAG, "nonce = " + nonce); Log.d(TAG, "maxAge = " + maxAge); Log.d(TAG, "acrValues = " + acrValues); if (authUri == null) { authUri = ""; } String requestUri = authUri; if (authUri.indexOf("?") == -1) { requestUri += "?"; } else if (authUri.indexOf("&") == -1) { requestUri += "&"; } final String charSet = Charset.defaultCharset().name(); requestUri += "response_type=" + URLEncoder.encode("code", charSet); requestUri += "&client_id=" + URLEncoder.encode(clientId, charSet); requestUri += "&scope=" + URLEncoder.encode(scopes, charSet); requestUri += "&redirect_uri=" + URLEncoder.encode(redirectUri, charSet); requestUri += "&state=" + URLEncoder.encode(state, charSet); requestUri += "&nonce=" + URLEncoder.encode(nonce, charSet); // requestUri += "&prompt=" + URLEncoder.encode(prompt.value(), charSet); requestUri += "&max_age=" + URLEncoder.encode(Integer.toString(maxAge), charSet); requestUri += "&acr_values=" + URLEncoder.encode(acrValues); if (hmapExtraOptions != null && hmapExtraOptions.size() > 0) { for (final String key : hmapExtraOptions.keySet()) { requestUri += "&" + key + "=" + URLEncoder.encode(hmapExtraOptions.get(key).toString(), charSet); } } final RelativeLayout webViewLayout = (RelativeLayout) LayoutInflater.from(context) .inflate(R.layout.layout_web_view, null); final InteractableWebView webView = (InteractableWebView) webViewLayout.findViewById(R.id.web_view); final ProgressBar progressBar = (ProgressBar) webViewLayout.findViewById(R.id.progressBar); final DiscoveryAuthenticationDialog dialog = new DiscoveryAuthenticationDialog(context); if (webView.getParent() != null) { ((ViewGroup) webView.getParent()).removeView(webView); } dialog.setContentView(webView); webView.setWebChromeClient(new WebChromeClient() { @Override public void onCloseWindow(final WebView w) { super.onCloseWindow(w); Log.d(TAG, "Window close"); w.setVisibility(View.INVISIBLE); w.destroy(); } }); final AuthorizationWebViewClient client = new AuthorizationWebViewClient(dialog, progressBar, listener, redirectUri, config, response); webView.setWebViewClient(client); dialog.setOnDismissListener(new DialogInterface.OnDismissListener() { @Override public void onDismiss(final DialogInterface dialogInterface) { Log.e("Auth Dialog", "dismissed"); dialogInterface.dismiss(); closeWebViewAndNotify(listener, webView); } }); webView.loadUrl(requestUri); try { dialog.show(); } catch (final WindowManager.BadTokenException exception) { Log.e("Discovery Dialog", exception.getMessage()); } } catch (final NullPointerException e) { Log.d(TAG, "NullPointerException=" + e.getMessage(), e); } }
From source file:android.support.v7ox.app.AppCompatDelegateImplV7.java
private ViewGroup createSubDecor() { TypedArray a = mContext.obtainStyledAttributes(R.styleable.AppCompatTheme); if (!a.hasValue(R.styleable.AppCompatTheme_windowActionBar_ox)) { a.recycle();//from www.j av a 2s.com throw new IllegalStateException( "You need to use a Theme.AppCompat theme (or descendant) with this activity."); } if (a.getBoolean(R.styleable.AppCompatTheme_windowNoTitle_ox, false)) { requestWindowFeature(Window.FEATURE_NO_TITLE); } else if (a.getBoolean(R.styleable.AppCompatTheme_windowActionBar_ox, false)) { // Don't allow an action bar if there is no title. requestWindowFeature(FEATURE_SUPPORT_ACTION_BAR); } if (a.getBoolean(R.styleable.AppCompatTheme_windowActionBarOverlay_ox, false)) { requestWindowFeature(FEATURE_SUPPORT_ACTION_BAR_OVERLAY); } if (a.getBoolean(R.styleable.AppCompatTheme_windowActionModeOverlay_ox, false)) { requestWindowFeature(FEATURE_ACTION_MODE_OVERLAY); } mIsFloating = a.getBoolean(R.styleable.AppCompatTheme_android_windowIsFloating, false); a.recycle(); final LayoutInflater inflater = LayoutInflater.from(mContext); ViewGroup subDecor = null; if (!mWindowNoTitle) { if (mIsFloating) { // If we're floating, inflate the dialog title decor subDecor = (ViewGroup) inflater.inflate(R.layout.abc_dialog_title_material, null); // Floating windows can never have an action bar, reset the flags mHasActionBar = mOverlayActionBar = false; } else if (mHasActionBar) { /** * This needs some explanation. As we can not use the android:theme attribute * pre-L, we emulate it by manually creating a LayoutInflater using a * ContextThemeWrapper pointing to actionBarTheme. */ TypedValue outValue = new TypedValue(); mContext.getTheme().resolveAttribute(R.attr.actionBarTheme_ox, outValue, true); Context themedContext; if (outValue.resourceId != 0) { themedContext = new ContextThemeWrapper(mContext, outValue.resourceId); } else { themedContext = mContext; } // Now inflate the view using the themed context and set it as the content view subDecor = (ViewGroup) LayoutInflater.from(themedContext).inflate(R.layout.abc_screen_toolbar, null); mDecorContentParent = (DecorContentParent) subDecor.findViewById(R.id.decor_content_parent); mDecorContentParent.setWindowCallback(getWindowCallback()); /** * Propagate features to DecorContentParent */ if (mOverlayActionBar) { mDecorContentParent.initFeature(FEATURE_SUPPORT_ACTION_BAR_OVERLAY); } if (mFeatureProgress) { mDecorContentParent.initFeature(Window.FEATURE_PROGRESS); } if (mFeatureIndeterminateProgress) { mDecorContentParent.initFeature(Window.FEATURE_INDETERMINATE_PROGRESS); } } } else { if (mOverlayActionMode) { subDecor = (ViewGroup) inflater.inflate(R.layout.abc_screen_simple_overlay_action_mode, null); } else { subDecor = (ViewGroup) inflater.inflate(R.layout.abc_screen_simple, null); } if (Build.VERSION.SDK_INT >= 21) { // If we're running on L or above, we can rely on ViewCompat's // setOnApplyWindowInsetsListener ViewCompat.setOnApplyWindowInsetsListener(subDecor, new OnApplyWindowInsetsListener() { @Override public WindowInsetsCompat onApplyWindowInsets(View v, WindowInsetsCompat insets) { final int top = insets.getSystemWindowInsetTop(); final int newTop = updateStatusGuard(top); if (top != newTop) { insets = insets.replaceSystemWindowInsets(insets.getSystemWindowInsetLeft(), newTop, insets.getSystemWindowInsetRight(), insets.getSystemWindowInsetBottom()); } // Now apply the insets on our view return ViewCompat.onApplyWindowInsets(v, insets); } }); } else { // Else, we need to use our own FitWindowsViewGroup handling ((FitWindowsViewGroup) subDecor) .setOnFitSystemWindowsListener(new FitWindowsViewGroup.OnFitSystemWindowsListener() { @Override public void onFitSystemWindows(Rect insets) { insets.top = updateStatusGuard(insets.top); } }); } } if (subDecor == null) { throw new IllegalArgumentException("AppCompat does not support the current theme features: { " + "windowActionBar: " + mHasActionBar + ", windowActionBarOverlay: " + mOverlayActionBar + ", android:windowIsFloating: " + mIsFloating + ", windowActionModeOverlay: " + mOverlayActionMode + ", windowNoTitle: " + mWindowNoTitle + " }"); } if (mDecorContentParent == null) { mTitleView = (TextView) subDecor.findViewById(R.id.title); } // Make the decor optionally fit system windows, like the window's decor ViewUtils.makeOptionalFitsSystemWindows(subDecor); final ViewGroup decorContent = (ViewGroup) mWindow.findViewById(android.R.id.content); final ContentFrameLayout abcContent = (ContentFrameLayout) subDecor .findViewById(R.id.action_bar_activity_content); // There might be Views already added to the Window's content view so we need to // migrate them to our content view while (decorContent.getChildCount() > 0) { final View child = decorContent.getChildAt(0); decorContent.removeViewAt(0); abcContent.addView(child); } // Now set the Window's content view with the decor mWindow.setContentView(subDecor); // Change our content FrameLayout to use the android.R.id.content id. // Useful for fragments. decorContent.setId(View.NO_ID); abcContent.setId(android.R.id.content); // The decorContent may have a foreground drawable set (windowContentOverlay). // Remove this as we handle it ourselves if (decorContent instanceof FrameLayout) { decorContent.setForeground(null); } abcContent.setAttachListener(new ContentFrameLayout.OnAttachListener() { @Override public void onAttachedFromWindow() { } @Override public void onDetachedFromWindow() { dismissPopups(); } }); return subDecor; }
From source file:system.info.reader.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); //getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); DisplayMetrics dm = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(dm); resolutions = Properties.resolution(dm); Properties.resolution = resolutions[0] + "*" + resolutions[1]; int tabHeight = 30, tabWidth = 80; if (dm.widthPixels >= 480) { tabHeight = 40;//from w ww .j a va 2 s .com tabWidth = 120; } tabHost = getTabHost(); LayoutInflater.from(this).inflate(R.layout.main, tabHost.getTabContentView(), true); tabHost.addTab( tabHost.newTabSpec("tab1").setIndicator(getString(R.string.brief)).setContent(R.id.PropertyList)); tabHost.addTab( tabHost.newTabSpec("tab2").setIndicator(getString(R.string.online)).setContent(R.id.ViewServer)); tabHost.addTab( tabHost.newTabSpec("tab3").setIndicator(getString(R.string.apps)).setContent(R.id.sViewApps)); tabHost.addTab( tabHost.newTabSpec("tab4").setIndicator(getString(R.string.process)).setContent(R.id.sViewProcess)); tabHost.addTab(tabHost.newTabSpec("tab5").setIndicator("Services").setContent(R.id.sViewCpu)); tabHost.addTab(tabHost.newTabSpec("tab6").setIndicator("Tasks").setContent(R.id.sViewMem)); //tabHost.addTab(tabHost.newTabSpec("tab7") // .setIndicator("Vending") // .setContent(R.id.sViewDisk)); AppsText = (TextView) findViewById(R.id.TextViewApps); ProcessText = (TextView) findViewById(R.id.TextViewProcess); ServiceText = (TextView) findViewById(R.id.TextViewCpu); TaskText = (TextView) findViewById(R.id.TextViewMem); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(tabWidth, tabHeight); for (int i = 0; i < tabHost.getTabWidget().getChildCount(); i++) tabHost.getTabWidget().getChildAt(i).setLayoutParams(lp); properList = (ListView) findViewById(R.id.PropertyList); Properties.properListItem = new ArrayList<HashMap<String, Object>>(); properListItemAdapter = new SimpleAdapter(this, Properties.properListItem, R.layout.property_list, new String[] { "ItemTitle", "ItemText" }, new int[] { R.id.ItemTitle, R.id.ItemText }); properList.setAdapter(properListItemAdapter); properList.setOnItemClickListener(mpropertyCL); //will support app list later //appList = (ListView)findViewById(R.id.AppList); //Properties.appListItem = new ArrayList<HashMap<String, Object>>(); //SimpleAdapter appListItemAdapter = new SimpleAdapter(this, Properties.appListItem, // R.layout.app_list, // new String[] {"ItemTitle", "ItemText"}, // new int[] {R.id.ItemTitle, R.id.ItemText} // ); //appList.setAdapter(appListItemAdapter); serverWeb = (WebView) findViewById(R.id.ViewServer); WebSettings webSettings = serverWeb.getSettings(); webSettings.setJavaScriptEnabled(true); webSettings.setUserAgentString("sys.info.trial" + versionCode); webSettings.setTextSize(WebSettings.TextSize.SMALLER); serverWeb.setWebViewClient(new WebViewClient() { public boolean shouldOverrideUrlLoading(WebView view, String url) { view.loadUrl(url); return false;//this will not launch browser when redirect. } public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) { handler.proceed(); } }); PackageManager pm = getPackageManager(); try { PackageInfo pi = pm.getPackageInfo("sys.info.trial", 0); version = "v" + pi.versionName; versionCode = pi.versionCode; List<PackageInfo> apps = getPackageManager().getInstalledPackages(0); nApk = Integer.toString(apps.size()); apklist = ""; for (PackageInfo app : apps) { apklist += app.packageName + "\t(" + app.versionName + ")\n"; } } catch (NameNotFoundException e) { e.printStackTrace(); } showDialog(0); initPropList(); //refresh(); PageTask task = new PageTask(); task.execute(""); }
From source file:com.safecell.ManageProfile_Activity.java
void displayDialog(String title, String inputText, final int position) { LayoutInflater li = LayoutInflater.from(this); View dialogView = li.inflate(R.layout.dialog_edittext_input, null); dialogInputEditText = (EditText) dialogView.findViewById(R.id.DialogEditTextInputEditText); dialogInputEditText.setText(inputText); dialogInputEditText.setInputType(setInputTypeKeyBoard(position)); AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(title).setInverseBackgroundForced(true).setView(dialogView).setCancelable(false) .setPositiveButton("Ok", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { String text = dialogInputEditText.getText().toString(); if (!text.equalsIgnoreCase("")) { if (position == 2) { if (validationForEmailAddress(text)) { setDialogValuesListArrayAdapter(position); dialog.cancel(); } else { dialog.cancel(); }//from ww w .ja v a2s . c o m } else { setDialogValuesListArrayAdapter(position); dialog.cancel(); } } else { Toast.makeText(context, "Blank not allowed.", Toast.LENGTH_SHORT).show(); } } }).setNegativeButton("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel(); } }); AlertDialog alert = builder.create(); alert.show(); alert.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE); }
From source file:edu.missouri.niaaa.pain.activity.AdminManageActivity.java
private Dialog removeDialog(Context context) { LayoutInflater inflater = LayoutInflater.from(context); final View textEntryView = inflater.inflate(R.layout.remove_id, null); final CheckBox rm_check = (CheckBox) textEntryView.findViewById(R.id.rm_local); rm_check.setText(R.string.remove_local); AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setView(textEntryView);// w w w.ja v a 2 s . com builder.setCancelable(false); builder.setTitle(R.string.assign_remove_title); builder.setMessage(R.string.remove_msg); builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // TODO Auto-generated method stub cleanUp(ctx); cancelAlarms(ctx); // remove local file, if checked Log.d(TAG, "is checked " + rm_check.isChecked()); if (rm_check.isChecked()) { deleteDirectory(Util.PHONE_BASE_PATH); } setHints(); finish(); } }); builder.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // TODO Auto-generated method stub } }); return builder.create(); }