List of usage examples for android.content Context LAYOUT_INFLATER_SERVICE
String LAYOUT_INFLATER_SERVICE
To view the source code for android.content Context LAYOUT_INFLATER_SERVICE.
Click Source Link
From source file:com.cn21.speedtest.service.LogService.java
private void createSystemWindow() { final WindowManager.LayoutParams lp = new WindowManager.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY, //WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN 0, PixelFormat.TRANSLUCENT); final LayoutInflater inflator = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); final WindowManager wm = (WindowManager) getSystemService(WINDOW_SERVICE); mLogListView = (ListView) inflator.inflate(R.layout.window_log, null); mLogBuffer = new LinkedList<LogLine>(); mLogBufferFiltered = new LinkedList<LogLine>(); mAdapter = new LogAdapter(this, mLogBufferFiltered); mLogListView.setAdapter(mAdapter);// ww w . j ava2 s . c o m wm.addView(mLogListView, lp); }
From source file:com.irccloud.android.fragment.BufferOptionsFragment.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { Context ctx = getActivity();/*from ww w . j av a 2 s . c o m*/ if (ctx == null) return null; LayoutInflater inflater = (LayoutInflater) ctx.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View v = inflater.inflate(R.layout.dialog_buffer_options, null); unread = (SwitchCompat) v.findViewById(R.id.unread); joinpart = (SwitchCompat) v.findViewById(R.id.joinpart); collapse = (SwitchCompat) v.findViewById(R.id.collapse); expandDisco = (SwitchCompat) v.findViewById(R.id.expandDisco); if (savedInstanceState != null && bid == -1 && savedInstanceState.containsKey("bid")) { bid = savedInstanceState.getInt("bid"); cid = savedInstanceState.getInt("cid"); type = savedInstanceState.getString("type"); } if (type != null && type.equalsIgnoreCase("console")) { joinpart.setVisibility(View.GONE); collapse.setVisibility(View.GONE); } else { expandDisco.setVisibility(View.GONE); } return new AlertDialog.Builder(ctx) .setInverseBackgroundForced(Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) .setTitle("Display Options").setView(v).setPositiveButton("Save", new SaveClickListener()) .setNegativeButton("Cancel", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }).create(); }
From source file:com.android.packageinstaller.PackageInstallerActivity.java
private void startInstallConfirm() { TabHost tabHost = (TabHost) findViewById(android.R.id.tabhost); tabHost.setup();//from w ww . j ava2 s . co m tabHost.setVisibility(View.VISIBLE); ViewPager viewPager = (ViewPager) findViewById(R.id.pager); TabsAdapter adapter = new TabsAdapter(this, tabHost, viewPager); // If the app supports runtime permissions the new permissions will // be requested at runtime, hence we do not show them at install. boolean supportsRuntimePermissions = mPkgInfo.applicationInfo.targetSdkVersion >= Build.VERSION_CODES.M; boolean permVisible = false; mScrollView = null; mOkCanInstall = false; int msg = 0; AppSecurityPermissions perms = new AppSecurityPermissions(this, mPkgInfo); final int N = perms.getPermissionCount(AppSecurityPermissions.WHICH_ALL); if (mAppInfo != null) { msg = (mAppInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0 ? R.string.install_confirm_question_update_system : R.string.install_confirm_question_update; mScrollView = new CaffeinatedScrollView(this); mScrollView.setFillViewport(true); boolean newPermissionsFound = false; if (!supportsRuntimePermissions) { newPermissionsFound = (perms.getPermissionCount(AppSecurityPermissions.WHICH_NEW) > 0); if (newPermissionsFound) { permVisible = true; mScrollView.addView(perms.getPermissionsView(AppSecurityPermissions.WHICH_NEW)); } } if (!supportsRuntimePermissions && !newPermissionsFound) { LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); TextView label = (TextView) inflater.inflate(R.layout.label, null); label.setText(R.string.no_new_perms); mScrollView.addView(label); } adapter.addTab(tabHost.newTabSpec(TAB_ID_NEW).setIndicator(getText(R.string.newPerms)), mScrollView); } else { findViewById(R.id.tabscontainer).setVisibility(View.GONE); findViewById(R.id.spacer).setVisibility(View.VISIBLE); } if (!supportsRuntimePermissions && N > 0) { permVisible = true; LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); View root = inflater.inflate(R.layout.permissions_list, null); if (mScrollView == null) { mScrollView = (CaffeinatedScrollView) root.findViewById(R.id.scrollview); } ((ViewGroup) root.findViewById(R.id.permission_list)) .addView(perms.getPermissionsView(AppSecurityPermissions.WHICH_ALL)); adapter.addTab(tabHost.newTabSpec(TAB_ID_ALL).setIndicator(getText(R.string.allPerms)), root); } if (!permVisible) { if (mAppInfo != null) { // This is an update to an application, but there are no // permissions at all. msg = (mAppInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0 ? R.string.install_confirm_question_update_system_no_perms : R.string.install_confirm_question_update_no_perms; findViewById(R.id.spacer).setVisibility(View.VISIBLE); } else { // This is a new application with no permissions. msg = R.string.install_confirm_question_no_perms; } tabHost.setVisibility(View.INVISIBLE); mScrollView = null; } if (msg != 0) { ((TextView) findViewById(R.id.install_confirm_question)).setText(msg); } mInstallConfirm.setVisibility(View.VISIBLE); mOk.setEnabled(true); if (mScrollView == null) { // There is nothing to scroll view, so the ok button is immediately // set to install. mOk.setText(R.string.install); mOkCanInstall = true; } else { mScrollView.setFullScrollAction(new Runnable() { @Override public void run() { mOk.setText(R.string.install); mOkCanInstall = true; } }); } }
From source file:com.arksh.summer.ui.zone.widget.ExpandableTextView.java
/** * ?viwe/*from w w w. ja v a2 s .c o m*/ */ private void findViews() { LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); inflater.inflate(R.layout.item_expand_shink, this); mTvContent = (TextView) findViewById(R.id.expandable_text); mTvContent.setOnClickListener(this); mTvExpandCollapse = (TextView) findViewById(R.id.expand_collapse); if (showExpandCollapseDrawable) { mTvExpandCollapse.setCompoundDrawablesWithIntrinsicBounds(null, null, mCollapsed ? mExpandDrawable : mCollapseDrawable, null); } mTvExpandCollapse.setText( mCollapsed ? getResources().getString(R.string.expand) : getResources().getString(R.string.shink)); mTvExpandCollapse.setOnClickListener(this); mTvContent.setTextColor(contentTextColor); mTvContent.getPaint().setTextSize(contentTextSize); mTvExpandCollapse.setTextColor(collapseExpandTextColor); mTvExpandCollapse.getPaint().setTextSize(collapseExpandTextSize); //?? LayoutParams lp = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); lp.gravity = grarity; mTvExpandCollapse.setLayoutParams(lp); }
From source file:cc.echonet.coolmicapp.MainActivity.java
private void goAbout() { Log.d("MainActivity", "goAbout() "); LayoutInflater inflater = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View popUpView = inflater.inflate(R.layout.popup_about, null, false); final PopupWindow popUp = new PopupWindow(this); Button close = (Button) popUpView.findViewById(R.id.cmdPopUpDismiss); close.setOnClickListener(new View.OnClickListener() { public void onClick(View popupView) { popUp.dismiss();/*w w w . ja v a 2 s .c om*/ } }); ((TextView) popUpView.findViewById(R.id.txtVersion)).setText(BuildConfig.VERSION_NAME); ((TextView) popUpView.findViewById(R.id.txtBuildType)).setText(BuildConfig.BUILD_TYPE); ((TextView) popUpView.findViewById(R.id.txtGITBranch)).setText(BuildConfig.GIT_BRANCH); ((TextView) popUpView.findViewById(R.id.txtGITRevision)).setText(BuildConfig.GIT_REVISION); ((TextView) popUpView.findViewById(R.id.txtGITAuthor)).setText(BuildConfig.GIT_AUTHOR); ((TextView) popUpView.findViewById(R.id.txtGITDirty)).setText(BuildConfig.GIT_DIRTY); popUpView.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED); popUp.setContentView(popUpView); Log.d("MainActivity", String.format("h: %s w: %s h: %s w: %s", popUp.getHeight(), popUp.getWidth(), popUpView.getMeasuredHeight(), popUpView.getMeasuredWidth())); popUp.setHeight(popUpView.getMeasuredHeight()); popUp.setWidth(popUpView.getMeasuredWidth()); popUp.showAtLocation(popUpView, Gravity.CENTER, 0, 0); Log.d("MainActivity", "goAbout() end "); }
From source file:fr.cph.chicago.activity.StationActivity.java
@SuppressWarnings("unchecked") @Override//from w w w .j a va 2 s . c o m protected final void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); ChicagoTracker.checkTrainData(this); if (!this.isFinishing()) { // Load data DataHolder dataHolder = DataHolder.getInstance(); this.mTrainData = dataHolder.getTrainData(); mIds = new HashMap<String, Integer>(); // Load right xml setContentView(R.layout.activity_station); // Get station id from bundle extra if (mStationId == null) { mStationId = getIntent().getExtras().getInt("stationId"); } // Get station from station id mStation = mTrainData.getStation(mStationId); MultiMap<String, String> reqParams = new MultiValueMap<String, String>(); reqParams.put("mapid", String.valueOf(mStation.getId())); new LoadData().execute(reqParams); // Call google street api to load image new DisplayGoogleStreetPicture().execute(mStation.getStops().get(0).getPosition()); this.mIsFavorite = isFavorite(); TextView textView = (TextView) findViewById(R.id.activity_bike_station_station_name); textView.setText(mStation.getName().toString()); mStreetViewImage = (ImageView) findViewById(R.id.activity_bike_station_streetview_image); mStreetViewText = (TextView) findViewById(R.id.activity_bike_station_steetview_text); mMapImage = (ImageView) findViewById(R.id.activity_bike_station_map_image); mDirectionImage = (ImageView) findViewById(R.id.activity_bike_station_map_direction); mFavoritesImage = (ImageView) findViewById(R.id.activity_bike_station_favorite_star); if (mIsFavorite) { mFavoritesImage.setImageDrawable(getResources().getDrawable(R.drawable.ic_save_active)); } mFavoritesImage.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { StationActivity.this.switchFavorite(); } }); LinearLayout stopsView = (LinearLayout) findViewById(R.id.activity_bike_station_details); this.mParamsStop = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); Map<TrainLine, List<Stop>> stops = mStation.getStopByLines(); CheckBox checkBox = null; for (Entry<TrainLine, List<Stop>> e : stops.entrySet()) { final TrainLine line = e.getKey(); List<Stop> stopss = e.getValue(); Collections.sort(stopss); LayoutInflater layoutInflater = (LayoutInflater) ChicagoTracker.getAppContext() .getSystemService(Context.LAYOUT_INFLATER_SERVICE); View view = layoutInflater.inflate(R.layout.activity_station_line_title, null); TextView lineTextView = (TextView) view.findViewById(R.id.activity_bus_station_value); lineTextView.setText(line.toStringWithLine()); TextView lineColorTextView = (TextView) view.findViewById(R.id.activity_bus_color); lineColorTextView.setBackgroundColor(line.getColor()); stopsView.addView(view); for (final Stop stop : stopss) { LinearLayout line2 = new LinearLayout(this); line2.setOrientation(LinearLayout.HORIZONTAL); line2.setLayoutParams(mParamsStop); checkBox = new CheckBox(this); checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { Preferences.saveTrainFilter(mStationId, line, stop.getDirection(), isChecked); } }); checkBox.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // Update timing MultiMap<String, String> reqParams = new MultiValueMap<String, String>(); reqParams.put("mapid", String.valueOf(mStation.getId())); new LoadData().execute(reqParams); } }); checkBox.setChecked(Preferences.getTrainFilter(mStationId, line, stop.getDirection())); checkBox.setText(stop.getDirection().toString()); checkBox.setTextColor(getResources().getColor(R.color.grey)); line2.addView(checkBox); stopsView.addView(line2); LinearLayout line3 = new LinearLayout(this); line3.setOrientation(LinearLayout.VERTICAL); line3.setLayoutParams(mParamsStop); int id3 = Util.generateViewId(); line3.setId(id3); mIds.put(line.toString() + "_" + stop.getDirection().toString(), id3); stopsView.addView(line3); } } getActionBar().setDisplayHomeAsUpEnabled(true); Util.trackScreen(this, R.string.analytics_train_details); } }
From source file:edu.cens.loci.ui.PlaceViewActivity.java
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // parse incoming data final Intent intent = getIntent(); final String action = intent.getAction(); if (Intent.ACTION_VIEW.equals(action)) { mUri = intent.getData();//w w w.j a v a 2 s . com if (mUri == null) { MyLog.e(LociConfig.D.ERROR, TAG, "intent.getData() is empty, exiting."); finish(); } MyLog.d(LociConfig.D.UI.DEBUG, TAG, "mUri=" + mUri.toString()); } else { MyLog.e(LociConfig.D.ERROR, TAG, "Unknown action, exiting."); finish(); return; } mPlaceId = LociProvider.checkPlaceIdUri(mUri); if (mPlaceId < 0) { MyLog.e(LociConfig.D.ERROR, TAG, "Invalid uri, exiting."); finish(); } mInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.place_view); mNameView = (TextView) findViewById(R.id.name); mMapView = (MapView) findViewById(R.id.map); mListView = (ListView) findViewById(R.id.place_data); mListView.setOnItemClickListener(this); mListView.setScrollBarStyle(ListView.SCROLLBARS_OUTSIDE_OVERLAY); mListView.setEmptyView(findViewById(android.R.id.empty)); mDbUtils = new LociDbUtils(this); mPlace = mDbUtils.getPlace(mPlaceId); //DEBUG MyLog.d(LociConfig.D.UI.DEBUG, TAG, "viewing..." + mPlace.toString()); mHandler = new NotifyingAsyncQueryHandler(this, this); // The order they're added to mSections dictates the order they are diplayed in the list. mSections.add(mGpsEntries); mSections.add(mWifiEntries); mSections.add(mPostalEntries); mSections.add(mTagEntries); mSections.add(mWebsiteEntries); mSections.add(mOtherEntries); }
From source file:com.app.sniffy.MainActivity.java
public void showTerms() { LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); final View dialoglayout = inflater.inflate(R.layout.terms, null); WebView webView = (WebView) dialoglayout.findViewById(R.id.termsView); webView.loadUrl("file:///android_asset/license.html"); AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle("Terms & Conditions"); builder.setView(dialoglayout).setCancelable(false).setPositiveButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { CheckBox checkBox = (CheckBox) dialoglayout.findViewById(R.id.checkBox); if (checkBox.isChecked()) { SharedPreferences.Editor editor = settings.edit(); editor.putBoolean("userconsent", true); editor.commit(); try { new GetKey(context).execute( new URI(Utils.getConfigProperty(getResources(), "generate-key") + mDeviceId + Utils.getConfigProperty(getResources(), "securekey"))); } catch (URISyntaxException e1) { Log.d("main activity key generate", e1.toString()); }/*from w w w.j a va2s . c om*/ } else { showTerms(); } } }); AlertDialog alert = builder.create(); alert.show(); }
From source file:com.github.shareme.gwsmaterialuikit.library.toast.ToastCompat.java
/** * Make a standard toast that just contains a text view. * * @param context The context to use. Usually your {@link android.app.Application} * or {@link android.app.Activity} object. * @param text The text to show. Can be formatted text. * @param duration How long to display the message. Either {@link #LENGTH_SHORT} or * {@link #LENGTH_LONG}/*from ww w . j a v a 2 s. com*/ * */ public static ToastCompat makeText(Context context, String text, @Duration int duration) { ToastCompat result = new ToastCompat(context); LayoutInflater inflate = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View v = inflate.inflate(Resources.getSystem().getIdentifier("transient_notification", "layout", "android"), null); TextView tv = (TextView) v.findViewById(Resources.getSystem().getIdentifier("message", "id", "android")); tv.setText(text); result.mNextView = v; result.mDuration = duration; return result; }
From source file:com.adguard.android.commons.BrowserUtils.java
public static void showBrowserInstallDialog(final Context context) { // Touch listener for changing colors of CardViews View.OnTouchListener touchListener = new View.OnTouchListener() { @Override/*from w ww .j a v a 2 s . co m*/ public boolean onTouch(View v, MotionEvent event) { int action = event.getActionMasked(); if (action == MotionEvent.ACTION_DOWN) { ((CardView) v).setCardBackgroundColor(R.color.card_view_background_pressed); } else if (action == MotionEvent.ACTION_UP || action == MotionEvent.ACTION_CANCEL || action == MotionEvent.ACTION_OUTSIDE) { ((CardView) v).setCardBackgroundColor(R.color.white); } return false; } }; final LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); final View dialogLayout = inflater.inflate(R.layout.select_browser_dialog, null); AlertDialog.Builder builder = new AlertDialog.Builder(context, R.style.AlertDialog); builder.setNegativeButton(android.R.string.cancel, null); builder.setView(dialogLayout); final AlertDialog dialog = builder.create(); View cardView = dialogLayout.findViewById(R.id.browser_yandex); cardView.setOnTouchListener(touchListener); cardView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { ActivityUtils.startMarket(context, YANDEX_BROWSER_PACKAGE, REFERRER); dialog.dismiss(); } }); cardView = dialogLayout.findViewById(R.id.browser_samsung); cardView.setOnTouchListener(touchListener); cardView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { ActivityUtils.startMarket(context, SAMSUNG_BROWSER_PACKAGE, null); dialog.dismiss(); } }); dialog.show(); }