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.marshalchen.ultimaterecyclerview.UltimateRecyclerView.java
/** * Add ScrollBar of Recyclerview/*from ww w.j av a 2 s .c o m*/ */ protected void setScrollbars() { LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); switch (mScrollbarsStyle) { case SCROLLBARS_VERTICAL: mSwipeRefreshLayout.removeView(mRecyclerView); View verticalView = inflater.inflate(R.layout.vertical_recycler_view, mSwipeRefreshLayout, true); mRecyclerView = (RecyclerView) verticalView.findViewById(R.id.ultimate_list); break; case SCROLLBARS_HORIZONTAL: mSwipeRefreshLayout.removeView(mRecyclerView); View horizontalView = inflater.inflate(R.layout.horizontal_recycler_view, mSwipeRefreshLayout, true); mRecyclerView = (RecyclerView) horizontalView.findViewById(R.id.ultimate_list); break; default: break; } }
From source file:org.bwgz.quotation.activity.QuotationActivity.java
private void startLoadAnimation() { if (menu != null) { LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); ImageView iv = (ImageView) inflater.inflate(R.layout.refresh_action_view, null); Animation rotation = AnimationUtils.loadAnimation(this, R.anim.clockwise_refresh); rotation.setRepeatCount(Animation.INFINITE); iv.startAnimation(rotation);/*from w w w.j a v a 2 s. c om*/ MenuItem item = menu.findItem(R.id.actionbar_new); item.setActionView(iv); item.setEnabled(false); } }
From source file:com.citrus.sdk.fragments.SavedOptions.java
private void processCardFlow(final String txnId, final String signature, final String token) { final Dialog cvvDialog = new Dialog(getActivity()); LayoutInflater inflater = (LayoutInflater) getActivity().getApplicationContext() .getSystemService(Context.LAYOUT_INFLATER_SERVICE); cvvDialog.requestWindowFeature(Window.FEATURE_NO_TITLE); View view = inflater.inflate(R.layout.cvv, null); final EditText cvvEditText = (EditText) view.findViewById(R.id.cvvText); final TextView errorText = (TextView) view.findViewById(R.id.errorText); Button payButton = (Button) view.findViewById(R.id.payButton); payButton.setOnClickListener(new OnClickListener() { @Override/*from w ww . jav a 2 s.c o m*/ public void onClick(View v) { if (TextUtils.isEmpty(cvvEditText.getText().toString()) || cvvEditText.getText().toString().length() < 3) { errorText.setText("Invalid cvv"); } else { fillDetails(txnId, signature, token, cvvEditText.getText().toString()); cvvDialog.dismiss(); } } }); cvvDialog.setContentView(view); cvvDialog.show(); }
From source file:com.amsterdam.marktbureau.makkelijkemarkt.DagvergunningFragmentOverzicht.java
/** * Populate the koopman fragment item details item when the loader has finished * @param loader the cursor loader/*ww w . java 2 s . c om*/ * @param data data object containing one or more koopman rows with joined sollicitatie data */ @Override public void onLoadFinished(Loader<Cursor> loader, Cursor data) { if (data != null && data.moveToFirst()) { // get the markt id from the sharedprefs SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(getContext()); int marktId = settings.getInt(getContext().getString(R.string.sharedpreferences_key_markt_id), 0); // koopman photo Glide.with(getContext()) .load(data.getString(data.getColumnIndex(MakkelijkeMarktProvider.Koopman.COL_FOTO_URL))) .error(R.drawable.no_koopman_image).into(mKoopmanFotoImage); // koopman naam String naam = data.getString(data.getColumnIndex(MakkelijkeMarktProvider.Koopman.COL_VOORLETTERS)) + " " + data.getString(data.getColumnIndex(MakkelijkeMarktProvider.Koopman.COL_ACHTERNAAM)); mKoopmanVoorlettersAchternaamText.setText(naam); // koopman erkenningsnummer String erkenningsnummer = data .getString(data.getColumnIndex(MakkelijkeMarktProvider.Koopman.COL_ERKENNINGSNUMMER)); mErkenningsnummerText.setText(erkenningsnummer); // koopman sollicitaties View view = getView(); if (view != null) { LayoutInflater layoutInflater = (LayoutInflater) getActivity() .getSystemService(Context.LAYOUT_INFLATER_SERVICE); LinearLayout placeholderLayout = (LinearLayout) view.findViewById(R.id.sollicitaties_placeholder); placeholderLayout.removeAllViews(); // add multiple markt sollicitatie views to the koopman items while (!data.isAfterLast()) { // inflate sollicitatie layout and populate its view items View childLayout = layoutInflater.inflate(R.layout.dagvergunning_koopman_item_sollicitatie, null); // highlight the sollicitatie for the current markt if (data.getCount() > 1 && marktId > 0 && marktId == data .getInt(data.getColumnIndex(MakkelijkeMarktProvider.Sollicitatie.COL_MARKT_ID))) { childLayout.setBackgroundColor(ContextCompat.getColor(getContext(), R.color.primary)); } // markt afkorting String marktAfkorting = data .getString(data.getColumnIndex(MakkelijkeMarktProvider.Markt.COL_AFKORTING)); TextView marktAfkortingText = (TextView) childLayout .findViewById(R.id.sollicitatie_markt_afkorting); marktAfkortingText.setText(marktAfkorting); // koopman sollicitatienummer String sollicitatienummer = data.getString( data.getColumnIndex(MakkelijkeMarktProvider.Sollicitatie.COL_SOLLICITATIE_NUMMER)); TextView sollicitatienummerText = (TextView) childLayout .findViewById(R.id.sollicitatie_sollicitatie_nummer); sollicitatienummerText.setText(sollicitatienummer); // koopman sollicitatie status String sollicitatieStatus = data.getString(data.getColumnIndex("sollicitatie_status")); TextView sollicitatieStatusText = (TextView) childLayout.findViewById(R.id.sollicitatie_status); sollicitatieStatusText.setText(sollicitatieStatus); if (sollicitatieStatus != null && !sollicitatieStatus.equals("?") && !sollicitatieStatus.equals("")) { sollicitatieStatusText .setTextColor(ContextCompat.getColor(getContext(), android.R.color.white)); sollicitatieStatusText.setBackgroundColor(ContextCompat.getColor(getContext(), Utility.getSollicitatieStatusColor(getContext(), sollicitatieStatus))); } // add view and move cursor to next placeholderLayout.addView(childLayout, data.getPosition()); data.moveToNext(); } } } }
From source file:com.github.omadahealth.slidepager.lib.views.SlideChartView.java
/** * Bind the views, set the listeners and attrs * * @param context// w ww . j a va 2 s. c om */ private void init(Context context, TypedArray attributes, int pagePosition, OnSlidePageChangeListener pageListener) { if (!isInEditMode()) { this.mPagePosition = pagePosition; this.mUserPageListener = pageListener; LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); mBinding = DataBindingUtil.inflate(inflater, R.layout.view_chart_slide, this, true); mAttributes = attributes; loadStyledAttributes(attributes); injectViewsAndAttributes(); setListeners(); } }
From source file:aerizostudios.com.cropshop.MainActivity.java
@Override public void onMenuItemClick(View clickedView, int position) { if (position == 1) { AlertDialog.Builder alert = new AlertDialog.Builder(this); LayoutInflater inflater = (LayoutInflater) getApplicationContext() .getSystemService(Context.LAYOUT_INFLATER_SERVICE); View v = inflater.inflate(R.layout.photo_quality, null); alert.setView(v);/*from w ww.j av a 2s. co m*/ alert.setTitle("Select Photo Quality"); alert.setPositiveButton("OKAY", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { if (normal.isChecked()) { prefs = getSharedPreferences(prefName, MODE_PRIVATE); SharedPreferences.Editor editor = prefs.edit(); editor.putInt("res", 300); editor.commit(); } else { prefs = getSharedPreferences(prefName, MODE_PRIVATE); SharedPreferences.Editor editor = prefs.edit(); editor.putInt("res", 400); editor.commit(); } prefs = getSharedPreferences(prefName, MODE_PRIVATE); quality = prefs.getInt("res", 0); } }); alert.setNegativeButton("CANCEL", null); AlertD = alert.create(); AlertD.show(); normal = (RadioButton) AlertD.findViewById(R.id.normalQuality); high = (RadioButton) AlertD.findViewById(R.id.highQuality); Log.d("alert pref", "alert pref" + quality); if (quality == 300) normal.setChecked(true); else high.setChecked(true); } if (position == 2) { Uri uri = Uri.parse("market://details?id=" + getPackageName()); Intent myAppLinkToMarket = new Intent(Intent.ACTION_VIEW, uri); try { startActivity(myAppLinkToMarket); } catch (ActivityNotFoundException e) { Toast.makeText(this, " unable to find market app", Toast.LENGTH_LONG).show(); } } if (position == 3) { try { Intent i = new Intent(Intent.ACTION_SEND); i.setType("text/plain"); i.putExtra(Intent.EXTRA_SUBJECT, "CROP SHOP"); String sAux = "\nHey friends, Check out this COOL APP - CropShop - No Crop for Whatsapp and" + " Instagram. This app helps you post images on Whatsapp and Instagram without any need " + "of cropping them. It also adds Blur Effect to the Photos like Iphone and also" + " Instagram filters." + "This app allows you to share the photos" + " directly to Instagram,Facebook and Whatsapp from the App.\n" + "Download this app from the play store.\n"; sAux = sAux + "https://play.google.com/store/apps/details?id=aerizostudios.com.cropshop \n\n"; i.putExtra(Intent.EXTRA_TEXT, sAux); startActivity(Intent.createChooser(i, "choose one")); } catch (Exception e) { //e.toString(); } } if (position == 4) { startActivity(new Intent(this, Feedback.class)); } }
From source file:com.openerp.addons.messages.MessageDetail.java
/** * Sets the up list view./*from w ww.ja v a 2 s . co m*/ * * @param list * the new up list view */ private boolean setupListView(final List<OEListViewRows> list) { // Handling List View controls and keys String[] from = new String[] { "image", "email_from|name", "email_from|email", "body", "date", "partners", "starred", "vote_nb" }; int[] to = new int[] { R.id.imgUserPicture, R.id.txvMessageAuthor, R.id.txvAuthorEmail, R.id.webViewMessageBody, R.id.txvTime, R.id.txvTo, R.id.imgBtnStar, R.id.txvmessageVotenb }; // Creating instance for listAdapter listAdapter = new OEListViewAdapter(scope.context(), R.layout.message_detail_listview_items, list, from, to, db); listAdapter.toHTML("body", true); listAdapter.addImageColumn("image"); // listAdapter.layoutBackgroundColor("parent_id", // Color.parseColor("#aaaaaa"), Color.parseColor("#0099cc")); listAdapter.cleanDate("date", scope.User().getTimezone(), "MMM dd, yyyy, hh:mm a"); listAdapter.addViewListener(new OEListViewOnCreateListener() { @Override public View listViewOnCreateListener(final int position, View row_view, OEListViewRows row_data) { final int message_id = row_data.getRow_id(); final HashMap<String, Object> row_values = row_data.getRow_data(); /* handling vote control */ final TextView txvVote = (TextView) row_view.findViewById(R.id.txvmessageVotenb); final int vote_nb = Integer.parseInt(row_data.getRow_data().get("vote_nb").toString()); if (vote_nb == 0) { txvVote.setText(""); } final boolean hasVoted = Boolean.parseBoolean(row_data.getRow_data().get("has_voted").toString()); if (!hasVoted) { txvVote.setCompoundDrawablesWithIntrinsicBounds( getResources().getDrawable(R.drawable.ic_thumbs_up_unselected_dark_tablet), null, null, null); // txvVote.setBackgroundResource(R.drawable.vote_background_selector_gray); } else { // txvVote.setBackgroundResource(R.drawable.vote_background_selector_blue); txvVote.setCompoundDrawablesWithIntrinsicBounds( getResources().getDrawable(R.drawable.ic_thumbs_up_selected_dark_tablet), null, null, null); } txvVote.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { MessageVoteToggle voteToggle = new MessageVoteToggle(message_id, vote_nb, hasVoted); String newVote = ""; boolean btnvoted = false; if (hasVoted) { newVote = (vote_nb - 1) + ""; row_values.put("has_voted", "false"); } else { btnvoted = true; newVote = (vote_nb + 1) + ""; row_values.put("has_voted", "true"); } row_values.put("vote_nb", newVote); listAdapter.updateRow(position, new OEListViewRows(message_id, row_values)); voteToggle.execute((Void) null); txvVote.setText(newVote); if (!btnvoted) { txvVote.setCompoundDrawablesWithIntrinsicBounds( getResources().getDrawable(R.drawable.ic_thumbs_up_unselected_dark_tablet), null, null, null); // txvVote.setBackgroundResource(R.drawable.vote_background_selector_gray); } else { // txvVote.setBackgroundResource(R.drawable.vote_background_selector_blue); txvVote.setCompoundDrawablesWithIntrinsicBounds( getResources().getDrawable(R.drawable.ic_thumbs_up_selected_dark_tablet), null, null, null); } } }); /* handling attachments */ List<OEListViewRows> attachments = getAttachmentsOfMessage(row_data.getRow_id() + ""); int index = 0; if (attachments.size() > 0) { LayoutInflater vi = (LayoutInflater) scope.context().getApplicationContext() .getSystemService(Context.LAYOUT_INFLATER_SERVICE); View insertPoint = row_view.findViewById(R.id.gridAttachments); ((ViewGroup) insertPoint).removeAllViews(); for (OEListViewRows row : attachments) { View v = vi.inflate(R.layout.fragment_message_detail_attachment_grid_item, null, true); TextView txvAttachmentName = (TextView) v.findViewById(R.id.txvFileName); txvAttachmentName.setText(row.getRow_data().get("name").toString()); TextView txvAttachmentSize = (TextView) v.findViewById(R.id.txvFileSize); long fileSize = Long.parseLong(row.getRow_data().get("file_size").toString()); String file_size = OEFileSizeHelper.readableFileSize(fileSize); txvAttachmentSize.setText((file_size.equals("0")) ? " " : file_size); TextView txvAttachmentId = (TextView) v.findViewById(R.id.txvAttachmentId); txvAttachmentId.setText(String.valueOf(row.getRow_id())); ((ViewGroup) insertPoint).addView(v, index, new ViewGroup.LayoutParams( ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT)); v.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { int attachment_id = Integer.parseInt( ((TextView) v.findViewById(R.id.txvAttachmentId)).getText().toString()); OEBinaryDownloadHelper binaryDownload = new OEBinaryDownloadHelper(); binaryDownload.downloadBinary(attachment_id, db); } }); index++; } } else { row_view.findViewById(R.id.layoutMessageAttachments).setVisibility(View.GONE); } OEContactView oe_contactView = (OEContactView) row_view.findViewById(R.id.imgUserPicture); int partner_id = Integer.parseInt(row_data.getRow_data().get("partner_id").toString()); oe_contactView.assignPartnerId(partner_id); return row_view; } }); listAdapter.setItemClickListener(R.id.imgBtnReply, new ControlClickEventListener() { @Override public OEListViewRows controlClicked(int position, OEListViewRows row, View view) { Intent composeIntent = new Intent(scope.context(), MessageComposeActivty.class); composeIntent.putExtra("message_id", message_id); composeIntent.putExtra("send_reply", true); startActivityForResult(composeIntent, MESSAGE_REPLY); return null; } }); // Setting callback handler for boolean field value change. listAdapter.setBooleanEventOperation("starred", R.drawable.ic_action_starred, R.drawable.ic_action_unstarred, updateStarred); GridView lstview = (GridView) rootView.findViewById(R.id.lstMessageDetail); // Providing adapter to listview lstview.setAdapter(listAdapter); return true; }
From source file:com.irccloud.android.fragment.ChannelOptionsFragment.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { if (savedInstanceState != null && savedInstanceState.containsKey("cid") && cid == -1) { cid = savedInstanceState.getInt("cid"); bid = savedInstanceState.getInt("bid"); }// w w w . j a v a 2s .c o m Context ctx = getActivity(); if (ctx == null) return null; LayoutInflater inflater = (LayoutInflater) ctx.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View v = inflater.inflate(R.layout.dialog_channel_options, null); members = (SwitchCompat) v.findViewById(R.id.members); unread = (SwitchCompat) v.findViewById(R.id.unread); notifyAll = (SwitchCompat) v.findViewById(R.id.notifyAll); joinpart = (SwitchCompat) v.findViewById(R.id.joinpart); collapse = (SwitchCompat) v.findViewById(R.id.collapse); autosuggest = (SwitchCompat) v.findViewById(R.id.autosuggest); 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.maxwen.wallpaper.board.fragments.dialogs.DirectoryChooserDialog.java
private View createDialogView() { final LayoutInflater inflater = (LayoutInflater) getActivity() .getSystemService(Context.LAYOUT_INFLATER_SERVICE); final View view = inflater.inflate(R.layout.folder_dialog, null); mTextColor = ColorHelper.getAttributeColor(getActivity(), android.R.attr.textColorPrimary); mTextColorDisabled = ColorHelper.getAttributeColor(getActivity(), android.R.attr.listDivider); if (!TextUtils.isEmpty(mStartFolder)) { mCurrentDir = mStartFolder;//from ww w.j a va 2s . c om } else { mCurrentDir = mSDCardDirectory; } mSubDirs = getDirectories(mCurrentDir); mListAdapter = createListAdapter(mSubDirs); mListView = (ListView) view.findViewById(R.id.folders); mListView.setAdapter(mListAdapter); mListView.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { File f = mListAdapter.getItem(position); if (f.isFile()) { return; } if (f.getName().equals("..")) { if (!mCurrentDir.equals(mSDCardDirectory)) { // Navigate back to an upper directory mCurrentDir = new File(mCurrentDir).getParent(); } } else { // Navigate into the sub-directory mCurrentDir = mListAdapter.getItem(position).getAbsolutePath(); } updateDirectory(); } }); return view; }
From source file:fr.univsavoie.ltp.client.map.Popup.java
/** * Afficher une boite au milieu de la carte si aucun utilisateur est connects * pour proposer a l'invit, de se connecter ou s'incrire aupres du service LTP. *//*from www . j av a 2s. c o m*/ public final void popupGuest() { DisplayMetrics dm = new DisplayMetrics(); this.activity.getWindowManager().getDefaultDisplay().getMetrics(dm); //final int height = dm.heightPixels; final int width = dm.widthPixels; //final int height = dm.heightPixels; int popupWidth = (int) (width * 0.75); //int popupHeight = height / 2; // Inflate the popup_layout.xml LinearLayout viewGroup = (LinearLayout) this.activity.findViewById(R.id.popupGuest); LayoutInflater layoutInflater = (LayoutInflater) this.activity .getSystemService(Context.LAYOUT_INFLATER_SERVICE); final View layout = layoutInflater.inflate(R.layout.popup_guest, viewGroup); layout.setBackgroundResource(R.drawable.popup_gradient); // Crer le PopupWindow final PopupWindow popupGuest = new PopupWindow(layout, popupWidth, LayoutParams.WRAP_CONTENT, true); popupGuest.setBackgroundDrawable(new BitmapDrawable()); popupGuest.setOutsideTouchable(true); // Some offset to align the popup a bit to the right, and a bit down, relative to button's position. final int OFFSET_X = 0; final int OFFSET_Y = 0; // Displaying the popup at the specified location, + offsets. this.activity.findViewById(R.id.layoutMain).post(new Runnable() { public void run() { popupGuest.showAtLocation(layout, Gravity.CENTER, OFFSET_X, OFFSET_Y); } }); /* * Evenements composants du PopupWindow */ // Ecouteur d'vnement sur le bouton des paramtres Button btLogin = (Button) layout.findViewById(R.id.btnPopupLogin); btLogin.setOnClickListener(new OnClickListener() { public void onClick(View view) { // La constante CODE_MON_ACTIVITE reprsente lidentifiant de la requte // (requestCode) qui sera utilis plus tard pour identifier lactivit // renvoyant la valeur de retour. Intent i = new Intent(activity, LoginActivity.class); activity.startActivityForResult(i, 1); popupGuest.dismiss(); } }); // Ecouteur d'vnement sur le bouton des paramtres Button btSignup = (Button) layout.findViewById(R.id.btnPopupSignup); btSignup.setOnClickListener(new OnClickListener() { public void onClick(View view) { // La constante CODE_MON_ACTIVITE reprsente lidentifiant de la requte // (requestCode) qui sera utilis plus tard pour identifier lactivit // renvoyant la valeur de retour. Intent i = new Intent(activity, SignupActivity.class); activity.startActivityForResult(i, 3); popupGuest.dismiss(); } }); // Ecouteur d'vnement sur le bouton pour fermer l'application Button close = (Button) layout.findViewById(R.id.btnPopupClose); close.setOnClickListener(new OnClickListener() { public void onClick(View v) { popupGuest.dismiss(); } }); }