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:at.alladin.rmbt.android.views.ResultGraphView.java
/** * // ww w. j av a 2 s . co m * @param inflater * @return */ public View createView(ViewGroup vg) { final LayoutInflater inflater = (LayoutInflater) vg.getContext() .getSystemService(Context.LAYOUT_INFLATER_SERVICE); try { //view = inflater.inflate(R.layout.result_graph, vg, false); view = inflater.inflate(R.layout.result_graph, this); signalGraph = (CustomizableGraphView) view.findViewById(R.id.graph_signal); ulGraph = (CustomizableGraphView) view.findViewById(R.id.graph_upload); ulGraph.setShowLog10Lines(false); dlGraph = (CustomizableGraphView) view.findViewById(R.id.graph_download); dlGraph.setShowLog10Lines(false); signalProgress = (ProgressBar) view.findViewById(R.id.signal_progress); ulProgress = (ProgressBar) view.findViewById(R.id.upload_progress); dlProgress = (ProgressBar) view.findViewById(R.id.download_progress); } catch (Exception e) { e.printStackTrace(); } return view; }
From source file:com.hybris.mobile.adapter.FormAdapter.java
@SuppressWarnings({ "rawtypes", "unchecked" }) @Override/* www . j a va 2 s. c om*/ public View getView(final int position, View convertView, ViewGroup parent) { LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View rowView = inflater.inflate(R.layout.form_row, parent, false); LinearLayout lnr = (LinearLayout) rowView.findViewById(R.id.linear_layout_form); final Hashtable<String, Object> obj = (Hashtable<String, Object>) objects.get(position); String className = "com.hybris.mobile.view." + obj.get("cellIdentifier").toString(); Object someObj = null; try { Class cell; cell = Class.forName(className); Constructor constructor = cell.getConstructor(new Class[] { Context.class }); someObj = constructor.newInstance(this.context); } catch (Exception e) { LoggingUtils.e(LOG_TAG, "Error loading class \"" + className + "\". " + e.getLocalizedMessage(), Hybris.getAppContext()); } /* * Text Cell */ if (someObj != null && someObj instanceof HYFormTextEntryCell) { final HYFormTextEntryCell textCell = (HYFormTextEntryCell) someObj; if (isLastEditText(position)) { textCell.setImeDone(this); } lnr.addView(textCell); textCell.setId(position); if (obj.containsKey("inputType")) { Integer val = mInputTypes.get(obj.get("inputType").toString()); textCell.setContentInputType(val); } if (obj.containsKey("value")) { textCell.setContentText(obj.get("value").toString()); } if (obj.containsKey("keyboardType") && StringUtils.equals(obj.get("keyboardType").toString(), "UIKeyboardTypeEmailAddress")) { textCell.setContentInputType(mInputTypes.get("textEmailAddress")); } textCell.addContentChangedListener(new TextWatcher() { @Override public void onTextChanged(CharSequence s, int start, int before, int count) { } @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void afterTextChanged(Editable s) { obj.put("value", s.toString()); notifyFormDataChangedListner(); } }); textCell.setOnFocusChangeListener(new OnFocusChangeListener() { @Override public void onFocusChange(View v, boolean hasFocus) { if (!hasFocus) { textCell.setTextColor(context.getResources().getColor(R.color.textMedium)); if (!fieldIsValid(position)) { setIsValid(false); textCell.showMessage(true); } else { textCell.showMessage(false); } showInvalidField(); validateAllFields(); } else { textCell.setTextColor(context.getResources().getColor(R.color.textHighlighted)); setCurrentFocusIndex(position); } } }); textCell.setContentTitle(obj.get("title").toString()); if (obj.containsKey("error")) { textCell.setMessage(obj.get("error").toString()); } if (obj.containsKey("showerror")) { Boolean showerror = Boolean.parseBoolean(obj.get("showerror").toString()); textCell.showMessage(showerror); } else { textCell.showMessage(false); } if (currentFocusIndex == position) { textCell.setFocus(); } } /* * Secure Text Cell */ else if (someObj instanceof HYFormSecureTextEntryCell) { final HYFormSecureTextEntryCell secureTextCell = (HYFormSecureTextEntryCell) someObj; if (isLastEditText(position)) { secureTextCell.setImeDone(this); } lnr.addView(secureTextCell); secureTextCell.setId(position); if (obj.containsKey("value")) { secureTextCell.setContentText(obj.get("value").toString()); } if (obj.containsKey("inputType")) { Integer val = mInputTypes.get(obj.get("inputType").toString()); secureTextCell.setContentInputType(val); } secureTextCell.addContentChangedListener(new TextWatcher() { @Override public void onTextChanged(CharSequence s, int start, int before, int count) { } @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void afterTextChanged(Editable s) { obj.put("value", s.toString()); notifyFormDataChangedListner(); } }); secureTextCell.setOnFocusChangeListener(new OnFocusChangeListener() { @Override public void onFocusChange(View v, boolean hasFocus) { if (!hasFocus) { if (!fieldIsValid(position)) { setIsValid(false); secureTextCell.showMessage(true); } else { secureTextCell.showMessage(false); } showInvalidField(); validateAllFields(); } else { setCurrentFocusIndex(position); } } }); secureTextCell.setContentTitle(obj.get("title").toString()); if (obj.containsKey("error")) { secureTextCell.setMessage(obj.get("error").toString()); } if (obj.containsKey("showerror")) { Boolean showerror = Boolean.parseBoolean(obj.get("showerror").toString()); secureTextCell.showMessage(showerror); } else { secureTextCell.showMessage(false); } if (currentFocusIndex == position) { secureTextCell.setFocus(); } } else if (someObj instanceof HYFormTextSelectionCell) { setIsValid(fieldIsValid(position)); HYFormTextSelectionCell selectionTextCell = (HYFormTextSelectionCell) someObj; lnr.addView(selectionTextCell); if (StringUtils.isNotBlank((String) obj.get("value"))) { StringBuilder b = new StringBuilder(obj.get("value").toString()); selectionTextCell.setSpinnerText(b.replace(0, 1, b.substring(0, 1).toUpperCase()).toString()); } else { selectionTextCell.setSpinnerText(obj.get("title").toString()); } } else if (someObj instanceof HYFormTextSelectionCell2) { HYFormTextSelectionCell2 selectionTextCell = (HYFormTextSelectionCell2) someObj; lnr.addView(selectionTextCell); selectionTextCell.init(obj); } else if (someObj instanceof HYFormSwitchCell) { HYFormSwitchCell checkBox = (HYFormSwitchCell) someObj; lnr.addView(checkBox); checkBox.setCheckboxText(obj.get("title").toString()); if (StringUtils.isNotBlank((String) obj.get("value"))) { checkBox.setCheckboxChecked(Boolean.parseBoolean((String) obj.get("value"))); } checkBox.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { HYFormSwitchCell chk = (HYFormSwitchCell) v; chk.toggleCheckbox(); obj.put("value", String.valueOf(chk.isCheckboxChecked())); notifyFormDataChangedListner(); } }); } else if (someObj instanceof HYFormSubmitButton) { HYFormSubmitButton btnCell = (HYFormSubmitButton) someObj; lnr.addView(btnCell); btnCell.setButtonText(obj.get("title").toString()); btnCell.setOnButtonClickListener(new OnClickListener() { @Override public void onClick(View v) { submit(); } }); } return rowView; }
From source file:com.ds.avare.utils.FolderPreference.java
@Override protected View onCreateDialogView() { LayoutInflater layoutInflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View view = layoutInflater.inflate(R.layout.folder, null); mListView = (ListView) view.findViewById(R.id.folder_list); mPathView = (TextView) view.findViewById(R.id.folder_text_path); mButton = (Button) view.findViewById(R.id.folder_button_internal); mButtonSDCard = (Button) view.findViewById(R.id.folder_button_sdcard); mButtonExternal = (Button) view.findViewById(R.id.folder_button_external); /*//from w ww . ja va 2s . c o m * Bring up permission */ if (PackageManager.PERMISSION_GRANTED != ContextCompat.checkSelfPermission(mContext, Manifest.permission.WRITE_EXTERNAL_STORAGE)) { ActivityCompat.requestPermissions((Activity) mContext, new String[] { Manifest.permission.WRITE_EXTERNAL_STORAGE }, 101); } mButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { init(mContext.getFilesDir().getAbsolutePath()); loadFileList(); mListView.setAdapter(mAdapter); } }); mButtonExternal.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { /* * Bring up preferences */ String path = Environment.getExternalStorageDirectory().getAbsolutePath() + "/Android/data/" + "com.ds.avare"; new File(path).mkdirs(); init(path); loadFileList(); mListView.setAdapter(mAdapter); // Show help for kitkat+ users Toast.makeText(mContext, mContext.getString(R.string.folderHelp), Toast.LENGTH_LONG).show(); } }); mButtonSDCard.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { /* * Bring up preferences */ String path = "/" + "sdcard" + "/Android/data/" + "com.ds.avare"; new File(path).mkdirs(); init(path); loadFileList(); mListView.setAdapter(mAdapter); // Show help for kitkat+ users Toast.makeText(mContext, mContext.getString(R.string.folderHelp), Toast.LENGTH_LONG).show(); } }); /* * Load files from the disk in a list */ loadFileList(); mListView.setAdapter(mAdapter); /* * On click, change folders */ OnItemClickListener l = new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int which, long id) { mChosenFile = mFileList[which].file; File sel = new File(mPath + "/" + mChosenFile); if (sel.isDirectory() && sel.canRead()) { mFirstLevel = false; /* * Adds chosen directory to list */ mStr.add(mChosenFile); mFileList = null; mPath = new File(sel + ""); } /* * Checks if 'up' was clicked */ else if (mChosenFile.equals(mContext.getString(R.string.Up)) && !sel.exists()) { /* * present directory removed from list */ String s = mStr.remove(mStr.size() - 1); /* * mPath modified to exclude present directory */ mPath = new File(mPath.toString().substring(0, mPath.toString().lastIndexOf(s))); mFileList = null; /* * if there are no more directories in the list, then * its the first level */ if (mStr.isEmpty()) { mFirstLevel = true; } } else { /* * This directory is not writeable */ return; } /* * Reload after click */ loadFileList(); mListView.setAdapter(mAdapter); } }; mListView.setOnItemClickListener(l); return view; }
From source file:com.money.manager.ex.common.AmountInputDialog.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { LayoutInflater inflater = ((LayoutInflater) getActivity() .getSystemService(Context.LAYOUT_INFLATER_SERVICE)); View view = inflater.inflate(R.layout.input_amount_dialog, null); // set the decimal separator according to the locale setDecimalSeparator(view);//from ww w. ja v a 2s . c om // Numbers and Operators. OnClickListener numberClickListener = new OnClickListener() { @Override public void onClick(View v) { // Reset prior value/text (in some cases only). String existingValue = txtMain.getText().toString(); if (!mStartedTyping) { existingValue = ""; mStartedTyping = true; } txtMain.setText(existingValue.concat(((Button) v).getText().toString())); evalExpression(); } }; for (int id : idButtonKeyNum) { Button button = (Button) view.findViewById(id); button.setOnClickListener(numberClickListener); } OnClickListener operatorClickListener = new OnClickListener() { @Override public void onClick(View v) { String existingValue = txtMain.getText().toString(); mStartedTyping = true; txtMain.setText(existingValue.concat(((Button) v).getText().toString())); evalExpression(); } }; for (int id : idOperatorKeys) { Button button = (Button) view.findViewById(id); button.setOnClickListener(operatorClickListener); } // Clear button. 'C' Button clearButton = (Button) view.findViewById(R.id.buttonKeyClear); clearButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { mStartedTyping = true; txtMain.setText(""); evalExpression(); } }); // Equals button '=' Button buttonKeyEquals = (Button) view.findViewById(R.id.buttonKeyEqual); buttonKeyEquals.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // this is called only to reset the warning colour in the top box, if any. evalExpression(); showAmountInEntryField(); } }); // Delete button '<=' FontIconView deleteButton = (FontIconView) view.findViewById(R.id.deleteButton); if (deleteButton != null) { deleteButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { mStartedTyping = true; String currentNumber = txtMain.getText().toString(); currentNumber = deleteLastCharacterFrom(currentNumber); txtMain.setText(currentNumber); evalExpression(); } }); } // Amounts txtTop = (TextView) view.findViewById(R.id.textViewTop); mDefaultColor = txtTop.getCurrentTextColor(); txtMain = (TextView) view.findViewById(R.id.textViewMain); if (!TextUtils.isEmpty(mExpression)) { txtMain.setText(mExpression); } else { showAmountInEntryField(); } // evaluate the expression initially, in case there is an existing amount passed to the binaryDialog. evalExpression(); // Dialog MaterialDialog.Builder builder = new MaterialDialog.Builder(getActivity()).customView(view, false) .cancelable(false).onPositive(new MaterialDialog.SingleButtonCallback() { @Override public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) { if (!evalExpression()) return; EventBus.getDefault().post(new AmountEnteredEvent(mRequestId, getAmount())); dialog.dismiss(); } }).onNegative(new MaterialDialog.SingleButtonCallback() { @Override public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) { dialog.dismiss(); } }).autoDismiss(false).negativeText(android.R.string.cancel).positiveText(android.R.string.ok); return builder.show(); }
From source file:com.asksven.betterbatterystats.adapters.StatsAdapter.java
public View getView(int position, View convertView, ViewGroup viewGroup) { StatElement entry = m_listData.get(position); SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this.m_context); boolean bShowBars = sharedPrefs.getBoolean("show_gauge", false); if (LogSettings.DEBUG) { Log.i(TAG, "Values: " + entry.getVals()); }/* w w w . ja v a 2 s . c om*/ if (convertView == null) { LayoutInflater inflater = (LayoutInflater) m_context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); // depending on settings show new pie gauge or old bar gauge if (!bShowBars) { convertView = inflater.inflate(R.layout.stat_row, null); } else { convertView = inflater.inflate(R.layout.stat_row_gauge, null); } } final float scale = this.m_context.getResources().getDisplayMetrics().density; TextView tvName = (TextView) convertView.findViewById(R.id.TextViewName); ///////////////////////////////////////// // we do some stuff here to handle settings about font size and thumbnail size String fontSize = sharedPrefs.getString("medium_font_size", "16"); int mediumFontSize = Integer.parseInt(fontSize); //we need to change "since" fontsize tvName.setTextSize(TypedValue.COMPLEX_UNIT_SP, mediumFontSize); // We need to handle an exception here: Sensors do not have a name so we use the fqn instead if (entry instanceof SensorUsage) { tvName.setText(entry.getFqn(UidNameResolver.getInstance(m_context))); } else { tvName.setText(entry.getName()); } boolean bShowKb = sharedPrefs.getBoolean("enable_kb", true); ImageView iconKb = (ImageView) convertView.findViewById(R.id.imageKB); iconKb.setVisibility(View.INVISIBLE); TextView tvFqn = (TextView) convertView.findViewById(R.id.TextViewFqn); tvFqn.setText(entry.getFqn(UidNameResolver.getInstance(m_context))); TextView tvData = (TextView) convertView.findViewById(R.id.TextViewData); // for alarms the values is wakeups per hour so we need to take the time as reference for the text if (entry instanceof Alarm) { tvData.setText(entry.getData((long) m_timeSince)); } else { tvData.setText(entry.getData((long) m_maxValue)); } //LinearLayout myLayout = (LinearLayout) convertView.findViewById(R.id.LinearLayoutBar); LinearLayout myFqnLayout = (LinearLayout) convertView.findViewById(R.id.LinearLayoutFqn); LinearLayout myRow = (LinearLayout) convertView.findViewById(R.id.LinearLayoutEntry); // long press for "copy to clipboard" convertView.setOnLongClickListener(new OnItemLongClickListener(position)); if (!bShowBars) { GraphablePie gauge = (GraphablePie) convertView.findViewById(R.id.Gauge); ///////////////////////////////////////// // we do some stuff here to handle settings about font size and thumbnail size String iconDim = sharedPrefs.getString("thumbnail_size", "56"); int iconSize = Integer.parseInt(iconDim); int pixels = (int) (iconSize * scale + 0.5f); //we need to change "since" fontsize gauge.getLayoutParams().height = pixels; gauge.getLayoutParams().width = pixels; gauge.requestLayout(); //////////////////////////////////////////////////////////////////////////////////// if (entry instanceof NetworkUsage) { gauge.setValue(entry.getValues()[0], ((NetworkUsage) entry).getTotal()); } else { double max = m_maxValue; // avoid rounding errors leading to values > 100 % if (entry.getValues()[0] > max) { max = entry.getValues()[0]; Log.i(TAG, "Upping gauge max to " + max); } gauge.setValue(entry.getValues()[0], max); } } else { GraphableBars buttonBar = (GraphableBars) convertView.findViewById(R.id.ButtonBar); int iHeight = 10; try { iHeight = Integer.valueOf(sharedPrefs.getString("graph_bar_height", "10")); } catch (Exception e) { iHeight = 10; } if (iHeight == 0) { iHeight = 10; } buttonBar.setMinimumHeight(iHeight); buttonBar.setName(entry.getName()); buttonBar.setValues(entry.getValues(), m_maxValue); } ImageView iconView = (ImageView) convertView.findViewById(R.id.icon); LinearLayout iconLayout = (LinearLayout) convertView.findViewById(R.id.LayoutIcon); ///////////////////////////////////////// // we do some stuff here to handle settings about font size and thumbnail size String iconDim = sharedPrefs.getString("thumbnail_size", "56"); int iconSize = Integer.parseInt(iconDim); int pixels = (int) (iconSize * scale + 0.5f); //we need to change "since" fontsize iconView.getLayoutParams().width = pixels; iconView.getLayoutParams().height = pixels; iconView.requestLayout(); //n 20;setLay.setTextSize(TypedValue.COMPLEX_UNIT_DIP, iconSize); //////////////////////////////////////////////////////////////////////////////////// // add on click listener for the icon only if KB is enabled // if (bShowKb) // { // // set a click listener for the list // iconKb.setOnClickListener(new OnIconClickListener(position)); // } // show / hide fqn text if ((entry instanceof Process) || (entry instanceof State) || (entry instanceof Misc) || (entry instanceof NativeKernelWakelock) || (entry instanceof Alarm) || (entry instanceof SensorUsage)) { myFqnLayout.setVisibility(View.GONE); } else { myFqnLayout.setVisibility(View.VISIBLE); } // show / hide package icons (we show / hide the whole layout as it contains a margin that must be hidded as well if ((entry instanceof NativeKernelWakelock) || (entry instanceof State) || (entry instanceof Misc)) { iconView.setVisibility(View.GONE); } else { iconView.setVisibility(View.VISIBLE); iconView.setImageDrawable(entry.getIcon(UidNameResolver.getInstance(m_context))); // set a click listener for the list iconView.setOnClickListener(new OnPackageClickListener(position)); } // add on click listener for the list entry if details are availble if ((entry instanceof Alarm) || (entry instanceof NativeKernelWakelock) || (entry instanceof SensorUsage)) { convertView.setOnClickListener(new OnItemClickListener(position)); } // // show / hide set dividers // ListView myList = (ListView) convertView.getListView(); //findViewById(R.id.id.list); // myList.setDivider(new ColorDrawable(0x99F10529)); // myList.setDividerHeight(1); return convertView; }
From source file:com.scoreflex.ScoreflexView.java
/** * The constructor of the view.// ww w. j a va 2s.c om * @param activity The activity holding the view. * @param attrs * @param defStyle */ @SuppressWarnings("deprecation") public ScoreflexView(Activity activity, AttributeSet attrs, int defStyle) { super(activity, attrs, defStyle); // Keep a reference on the activity mParentActivity = activity; // Default layout params if (null == getLayoutParams()) { setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, Scoreflex.getDensityIndependantPixel(R.dimen.scoreflex_panel_height))); } // Set our background color setBackgroundColor(getContext().getResources().getColor(R.color.scoreflex_background_color)); // Create the top bar View topBar = new View(getContext()); topBar.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, getResources().getDimensionPixelSize(R.dimen.scoreflex_topbar_height), Gravity.TOP)); topBar.setBackgroundDrawable(getResources().getDrawable(R.drawable.scoreflex_gradient_background)); addView(topBar); // Create the retry button LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); mErrorLayout = (ViewGroup) inflater.inflate(R.layout.scoreflex_error_layout, null); if (mErrorLayout != null) { // Configure refresh button Button refreshButton = (Button) mErrorLayout.findViewById(R.id.scoreflex_retry_button); if (null != refreshButton) { refreshButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { if (null == Scoreflex.getPlayerId()) { setUserInterfaceState(new LoadingState()); loadUrlAfterLoggedIn(mInitialResource, mInitialRequestParams); } else if (null == mWebView.getUrl()) { setResource(mInitialResource); } else { mWebView.reload(); } } }); } // Configure cancel button Button cancelButton = (Button) mErrorLayout.findViewById(R.id.scoreflex_cancel_button); if (null != cancelButton) { cancelButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { close(); } }); } // Get hold of the message view mMessageView = (TextView) mErrorLayout.findViewById(R.id.scoreflex_error_message_view); addView(mErrorLayout); } // Create the close button mCloseButton = new ImageButton(getContext()); Drawable closeButtonDrawable = getResources().getDrawable(R.drawable.scoreflex_close_button); int closeButtonMargin = (int) ((getResources().getDimensionPixelSize(R.dimen.scoreflex_topbar_height) - closeButtonDrawable.getIntrinsicHeight()) / 2.0f); FrameLayout.LayoutParams closeButtonLayoutParams = new FrameLayout.LayoutParams( ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT, Gravity.TOP | Gravity.RIGHT); closeButtonLayoutParams.setMargins(0, closeButtonMargin, closeButtonMargin, 0); mCloseButton.setLayoutParams(closeButtonLayoutParams); mCloseButton.setImageDrawable(closeButtonDrawable); mCloseButton.setBackgroundDrawable(null); mCloseButton.setPadding(0, 0, 0, 0); mCloseButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { close(); } }); addView(mCloseButton); // Create the web view mWebView = new WebView(mParentActivity); mWebView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); // mWebView.setBackgroundColor(Color.RED); mWebView.setWebViewClient(new ScoreflexWebViewClient()); mWebView.setWebChromeClient(new WebChromeClient() { @Override public boolean onConsoleMessage(ConsoleMessage cm) { Log.d("Scoreflex", "javascript Error: " + String.format("%s @ %d: %s", cm.message(), cm.lineNumber(), cm.sourceId())); return true; } public void openFileChooser(ValueCallback<Uri> uploadMsg) { // mtbActivity.mUploadMessage = uploadMsg; mUploadMessage = uploadMsg; String fileName = "picture.jpg"; ContentValues values = new ContentValues(); values.put(MediaStore.Images.Media.TITLE, fileName); // mOutputFileUri = mParentActivity.getContentResolver().insert( // MediaStore.Images.Media.DATA, values); final List<Intent> cameraIntents = new ArrayList<Intent>(); final Intent captureIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); final PackageManager packageManager = mParentActivity.getPackageManager(); final List<ResolveInfo> listCam = packageManager.queryIntentActivities(captureIntent, 0); for (ResolveInfo res : listCam) { final String packageName = res.activityInfo.packageName; final Intent intent = new Intent(captureIntent); intent.setComponent(new ComponentName(res.activityInfo.packageName, res.activityInfo.name)); intent.setPackage(packageName); cameraIntents.add(intent); } // Filesystem. final Intent galleryIntent = new Intent(); galleryIntent.setType("image/*"); galleryIntent.setAction(Intent.ACTION_GET_CONTENT); // Chooser of filesystem options. final Intent chooserIntent = Intent.createChooser(galleryIntent, "Select Source please"); // Add the camera options. chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, cameraIntents.toArray(new Parcelable[] {})); mParentActivity.startActivityForResult(chooserIntent, Scoreflex.FILECHOOSER_RESULTCODE); } public void openFileChooser(ValueCallback<Uri> uploadMsg, String acceptType) { openFileChooser(uploadMsg); } public void openFileChooser(ValueCallback<Uri> uploadMsg, String acceptType, String capture) { openFileChooser(uploadMsg); } }); mWebView.getSettings().setJavaScriptEnabled(true); mWebView.getSettings().setDomStorageEnabled(true); mWebView.getSettings().setDatabasePath( getContext().getFilesDir().getPath() + "/data/" + getContext().getPackageName() + "/databases/"); addView(mWebView); TypedArray a = mParentActivity.obtainStyledAttributes(attrs, R.styleable.ScoreflexView, defStyle, 0); String resource = a.getString(R.styleable.ScoreflexView_resource); if (null != resource) setResource(resource); a.recycle(); // Create the animated spinner mProgressBar = (ProgressBar) ((LayoutInflater) getContext() .getSystemService(Context.LAYOUT_INFLATER_SERVICE)).inflate(R.layout.scoreflex_progress_bar, null); mProgressBar.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT, Gravity.CENTER)); addView(mProgressBar); LocalBroadcastManager.getInstance(activity).registerReceiver(mLoginReceiver, new IntentFilter(Scoreflex.INTENT_USER_LOGED_IN)); setUserInterfaceState(new InitialState()); }
From source file:com.farbod.labelledspinner.LabelledSpinner.java
/** * Inflates the layout and sets layout parameters *//*from ww w . j a v a 2s. c om*/ private void prepareLayout(Context context) { LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); inflater.inflate(R.layout.widget_labelled_spinner, this, true); setOrientation(LinearLayout.VERTICAL); setLayoutParams(new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)); }
From source file:it.jaschke.alexandria.model.view.BookDetailViewModel.java
/** * Removes all views from the {@link LinearLayout} and adds new ones for * the specified {@link Author}s.//from w w w.ja v a 2 s . c o m * * @param container {@link LinearLayout} that will contain the authors. * @param authors the {@link Author}s to be placed in the container. */ @BindingAdapter({ "bind:authors" }) public static void loadAuthorViews(LinearLayout container, List<Author> authors) { container.removeAllViews(); if (authors == null || authors.isEmpty()) { return; } LayoutInflater inflater = (LayoutInflater) container.getContext() .getSystemService(Context.LAYOUT_INFLATER_SERVICE); for (Author author : authors) { AuthorListItemBinding binding = DataBindingUtil.inflate(inflater, R.layout.list_item_author, container, false); AuthorListItemViewModel itemViewModel = new AuthorListItemViewModel(); itemViewModel.setAuthor(author); binding.setViewModel(itemViewModel); container.addView(binding.getRoot()); } }
From source file:com.mobilevue.vod.VideoControllerView.java
/** * Create the view that holds the widgets that control playback. Derived * classes can override this to create their own. * /*w w w .j a v a2s. c o m*/ * @return The controller view. * @hide This doesn't work as advertised */ protected View makeControllerView() { LayoutInflater inflate = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); if (mUseFastForward) mRoot = inflate.inflate(R.layout.media_controller, null); else { mRoot = inflate.inflate(R.layout.media_controller_live_tv_new, null); GetChannelsList(mRoot); } initControllerView(mRoot); return mRoot; }
From source file:com.linkbubble.util.YouTubeEmbedHelper.java
private AlertDialog getMultipleEmbedsDialog() { if (embedInfoMatchesIds()) { return getEmbedResultsDialog(); } else {//from w w w . j av a2s. co m AlertDialog.Builder builder = new AlertDialog.Builder(mContext); LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View view = inflater.inflate(R.layout.view_loading, null); TextView textView = (TextView) view.findViewById(R.id.loading_text); textView.setText(R.string.loading_youtube_embed_info); builder.setView(view); builder.setIcon(0); AlertDialog alertDialog = builder.create(); alertDialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT); if (mCurrentDownloadTask != null) { synchronized (mCurrentDownloadTask) { if (mCurrentDownloadTask != null) { mCurrentDownloadTask.cancel(true); } mCurrentDownloadTask = new DownloadYouTubeEmbedInfoTask(true, alertDialog); mCurrentDownloadTask.execute(null, null, null); } } else { mCurrentDownloadTask = new DownloadYouTubeEmbedInfoTask(true, alertDialog); mCurrentDownloadTask.execute(null, null, null); } return alertDialog; } }