List of usage examples for android.view LayoutInflater from
public static LayoutInflater from(Context context)
From source file:net.olejon.mdapp.ClinicalTrialsCardsAdapter.java
@Override public ClinicalTrialsViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) { View view = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.activity_clinicaltrials_card, viewGroup, false);//from ww w . j a v a2s . c o m return new ClinicalTrialsViewHolder(view); }
From source file:net.olejon.mdapp.LvhCategoriesAdapter.java
@Override public CategoryViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) { View view = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.activity_lvh_categories_card, viewGroup, false);// ww w. java2s . co m return new CategoryViewHolder(view); }
From source file:de.vanita5.twittnuker.popup.AccountSelectorPopupWindow.java
public AccountSelectorPopupWindow(Context context, View anchor) { mContext = context;/*from w w w.ja v a 2 s.co m*/ mAnchor = anchor; final int themeAttr; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { themeAttr = android.R.attr.actionOverflowMenuStyle; } else { themeAttr = android.R.attr.popupMenuStyle; } mAdapter = new AccountsGridAdapter(context); final Resources resources = context.getResources(); final LayoutInflater inflater = LayoutInflater.from(context); final int themeColor = ThemeUtils.getUserAccentColor(context); if (!(context instanceof Factory)) { inflater.setFactory2(new ThemedViewFactory(themeColor)); } final View contentView = inflater.inflate(R.layout.popup_account_selector, null); mGridView = (GridView) contentView.findViewById(R.id.grid_view); mGridView.setAdapter(mAdapter); mGridView.setChoiceMode(AbsListView.CHOICE_MODE_MULTIPLE); mGridView.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { if (mAccountSelectionListener == null) return; mAccountSelectionListener.onSelectionChanged(getSelectedAccountIds()); } }); mPopup = new PopupWindow(context, null, themeAttr); mPopup.setFocusable(true); mPopup.setWidth(Utils.getActionBarHeight(context) * 2); mPopup.setWindowLayoutMode(0, ViewGroup.LayoutParams.WRAP_CONTENT); mPopup.setContentView(contentView); }
From source file:com.aibasis.parent.adapter.ChatAllHistoryAdapter.java
public ChatAllHistoryAdapter(Context context, int textViewResourceId, List<EMConversation> objects) { super(context, textViewResourceId, objects); this.conversationList = objects; copyConversationList = new ArrayList<EMConversation>(); copyConversationList.addAll(objects); inflater = LayoutInflater.from(context); }
From source file:com.doomy.decode.ResultDialogFragment.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { LayoutInflater mLayoutInflater = LayoutInflater.from(getActivity()); View mView = mLayoutInflater.inflate(R.layout.view_result, null); TextView mTextViewFormat = (TextView) mView.findViewById(R.id.textViewFormat); TextView mTextViewContent = (TextView) mView.findViewById(R.id.textViewContent); if (mTitle.equals("EAN 13") && mMessage.startsWith("978")) { GetResponseTask mGetResponseTask = new GetResponseTask(); mGetResponseTask.execute(mMessage); try {/*from www.j a v a 2 s. co m*/ if (mGetResponseTask.get().equals("")) { mTitle = "ISBN"; mTextViewContent.setText(mMessage); } else { mTitle = "ISBN"; mMessage = mGetResponseTask.get(); SpannableString mSpan = new SpannableString(mMessage); mSpan.setSpan(new UnderlineSpan(), 0, mMessage.length(), 0); mTextViewContent.setText(mSpan); mTextViewContent.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { createURLIntent(makeURLSearch(mMessage)); } }); } } catch (InterruptedException e) { e.printStackTrace(); } catch (ExecutionException e) { e.printStackTrace(); } } else if (mTitle.equals("ISBN")) { if (!mMessage.startsWith("978")) { SpannableString mSpan = new SpannableString(mMessage); mSpan.setSpan(new UnderlineSpan(), 0, mMessage.length(), 0); mTextViewContent.setText(mSpan); mTextViewContent.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { createURLIntent(makeURLSearch(mMessage)); } }); } else { mTextViewContent.setText(mMessage); } } else if (mMessage.startsWith("www") || mMessage.startsWith("http://") || mMessage.startsWith("https://")) { SpannableString mSpan = new SpannableString(mMessage); mSpan.setSpan(new UnderlineSpan(), 0, mMessage.length(), 0); mTextViewContent.setText(mSpan); mTextViewContent.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { createURLIntent(mMessage); } }); } else { mTextViewContent.setText(mMessage); } if (mKey) { SimpleDateFormat mDateFormat = new SimpleDateFormat("dd/MM/yyyy-HH:mm"); String mDate = mDateFormat.format(new Date()); Scan mScan = new Scan(mTitle, mMessage, mDate); mDB.addOne(mScan); } mTextViewFormat.setText(mTitle); AlertDialog.Builder mAlertBuilder = new AlertDialog.Builder(getActivity(), Utils.setThemeDialog()); mAlertBuilder.setTitle(getString(R.string.info)).setView(mView).setPositiveButton(getString(R.string.okay), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { if (mListener != null) { mListener.onDialogPositiveClick(ResultDialogFragment.this); } } }); return mAlertBuilder.create(); }
From source file:com.nttec.everychan.ui.FavoritesFragment.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); activity = (MainActivity) getActivity(); resources = MainApplication.getInstance().resources; settings = MainApplication.getInstance().settings; inflater = LayoutInflater.from(activity); setHasOptionsMenu(true);//from www . j a va2 s.c om }
From source file:net.olejon.mdapp.NotificationsFromSlvAdapter.java
@Override public NotificationViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) { View view = LayoutInflater.from(viewGroup.getContext()) .inflate(R.layout.activity_notifications_from_slv_card, viewGroup, false); return new NotificationViewHolder(view); }
From source file:com.knurld.dropboxdemo.KnurldActivity.java
public void showInstructions(View view) { Activity parent = (Activity) context; View spinnerView = LayoutInflater.from(parent).inflate(R.layout.instructions_popup, null); TextView textView = (TextView) spinnerView.findViewById(R.id.phraseText); textView.setText("Press record to begin recording enrollment"); PopupWindow popupWindow = new PopupWindow(spinnerView, 500, 500); popupWindow.setFocusable(true);/* w ww .java 2 s . co m*/ popupWindow.showAtLocation(view, Gravity.CENTER, 0, 0); final PopupWindow finalPopupWindow = popupWindow; new android.os.Handler().postDelayed(new Runnable() { public void run() { finalPopupWindow.dismiss(); } }, 3000); }
From source file:com.amanmehara.programming.android.adapters.LanguageAdapter.java
@Override public LanguageAdapter.ViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) { View view = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.language_list, viewGroup, false); return new ViewHolder(view); }
From source file:com.liquid.wallpapers.free.core.favourites.FavouriteListAdapter.java
@Override public View getView(int position, View convertView, ViewGroup parent) { Favourite favourite = this.favourites.get(position); if (convertView == null) { convertView = LayoutInflater.from(this.context).inflate(R.layout.favourite, null); }/*from w w w .j a v a2 s. c o m*/ TextView textView = (TextView) convertView.findViewById(R.id.favouriteTextBox); textView.setText(favourite.getWallpaper().getTitle()); ImageView imageView = (ImageView) convertView.findViewById(R.id.favouriteImageView); try { imageView.setImageBitmap(this.wallpaperManager.getThumbImage(favourite.getWallpaper())); } catch (ClientProtocolException ex) { AlertDialogFactory.showErrorMessage(this.context, R.string.errorText, R.string.downloadException); } catch (IOException ex) { AlertDialogFactory.showErrorMessage(this.context, R.string.errorText, R.string.downloadException); } return convertView; }