Java Code Examples for android.view.LayoutInflater#from()
The following examples show how to use
android.view.LayoutInflater#from() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DefaultForumHolder.java From ForPDA with GNU General Public License v3.0 | 6 votes |
@Override public View createNodeView(TreeNode node, ForumItemTree value) { final LayoutInflater inflater = LayoutInflater.from(context); final View view = inflater.inflate(R.layout.forum_item_default, null, false); title = (TextView) view.findViewById(R.id.forum_item_title); icon = (ImageView) view.findViewById(R.id.forum_item_icon); currentValue = value; title.setText(value.getTitle()); icon.setImageDrawable(App.getVecDrawable(context, value.getForums() == null ? R.drawable.ic_forum_go_to_topics : (node.isExpanded() ? R.drawable.ic_expand_less_black_24dp : R.drawable.ic_expand_more_black_24dp))); if (value.getForums() == null) { int bg = App.getDrawableResAttr(context, R.attr.count_background); icon.setBackgroundResource(bg); } else { icon.setBackground(null); } return view; }
Example 2
Source File: AddEnterpriseHDMKeychainActivity.java From bither-android with Apache License 2.0 | 6 votes |
@Override public void onClick(View v) { llInit.setVisibility(View.GONE); llCollect.setVisibility(View.VISIBLE); llAdd.setVisibility(View.GONE); ibtnAddPub.setVisibility(View.VISIBLE); btnCollectFinish.setEnabled(false); pubs.clear(); llPubs.removeAllViews(); LayoutInflater inflater = LayoutInflater.from(AddEnterpriseHDMKeychainActivity.this); for (int i = 0; i < pubCount(); i++) { inflater.inflate(R.layout.list_item_enterprise_hdm_collector, llPubs, true); } }
Example 3
Source File: AppAdapter.java From Android-nRF-Toolbox with BSD 3-Clause "New" or "Revised" License | 6 votes |
public AppAdapter(@NonNull final Context context) { this.context = context; this.inflater = LayoutInflater.from(context); // get nRF installed app plugins from package manager final PackageManager pm = packageManager = context.getPackageManager(); final Intent intent = new Intent(Intent.ACTION_MAIN); intent.addCategory(CATEGORY); final List<ResolveInfo> appList = applications = pm.queryIntentActivities(intent, 0); // TODO remove the following loop after some time, when there will be no more MCP 1.1 at the market. for (final ResolveInfo info : appList) { if (NRF_CONNECT_PACKAGE.equals(info.activityInfo.packageName)) { appList.remove(info); break; } } Collections.sort(appList, new ResolveInfo.DisplayNameComparator(pm)); }
Example 4
Source File: ResultDialogHelper.java From Gojuon with MIT License | 6 votes |
private void init() { AlertDialog.Builder builder = new AlertDialog.Builder(mContext); LayoutInflater inflater = LayoutInflater.from(mContext); View view = inflater.inflate(R.layout.fragment_result, null); builder.setCancelable(false) .setView(view) .setNegativeButton(android.R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { if (mRunnable != null) mRunnable.run(); } }); mResultDialog = builder.create(); }
Example 5
Source File: MRContentAdapter.java From NewsMe with Apache License 2.0 | 5 votes |
public MRContentAdapter(Context context) { super(); mInflater = LayoutInflater.from(context); // mData = new ArrayList<MRContent>(); mSelectColor = Color.parseColor("#0662ad"); mData = DLNAController.getInstance(context).mData; }
Example 6
Source File: MainActivity.java From CSCI4669-Fall15-Android with Apache License 2.0 | 5 votes |
@Override public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { Context context = parent.getContext(); LayoutInflater inflater = LayoutInflater.from(context); // Inflate the custom layout View contactView = inflater.inflate(R.layout.list_item, parent, false); contactView.setOnClickListener(itemClickListener); contactView.setOnLongClickListener(itemLongClickListener); // Return a new holder instance ViewHolder viewHolder = new ViewHolder(contactView); return viewHolder; }
Example 7
Source File: DaysOfWeekPreferenceAdapterX.java From PhoneProfilesPlus with Apache License 2.0 | 5 votes |
DaysOfWeekPreferenceAdapterX(Context context, List<DayOfWeek> daysOfWeekList) { this.daysOfWeekList = daysOfWeekList; // Cache the LayoutInflate to avoid asking for a new one each time. inflater = LayoutInflater.from(context); //this.context = context; }
Example 8
Source File: GroupGridViewAdapter.java From o2oa with GNU Affero General Public License v3.0 | 5 votes |
public GroupGridViewAdapter(GroupGridViewActivity context, List<UserInfo> memberInfoList, boolean isCreator, int size) { this.mContext = context; mInflater = LayoutInflater.from(context); this.mMemberList = memberInfoList; this.mIsCreator = isCreator; this.mAvatarSize = size; mCurrentNum = mMemberList.size(); }
Example 9
Source File: SweetSnackbar.java From SweetTips with Apache License 2.0 | 5 votes |
private SweetSnackbar(ViewGroup parent) { mTargetParent = parent; mContext = parent.getContext(); ThemeUtils.checkAppCompatTheme(mContext); LayoutInflater inflater = LayoutInflater.from(mContext); mView = (SnackbarLayout) inflater.inflate(com.jet.sweettips.R.layout.sweet_layout_snackbar, mTargetParent, false); mAccessibilityManager = (AccessibilityManager) mContext.getSystemService(Context.ACCESSIBILITY_SERVICE); }
Example 10
Source File: MultipleParallaxExpandableListView.java From UltimateAndroid with Apache License 2.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.parallax_scroll_expand_list_multiple_parallax); ParallaxExpandableListView listView = (ParallaxExpandableListView) findViewById(R.id.list_view); CustomExpandableListAdapter adapter = new CustomExpandableListAdapter(LayoutInflater.from(this)); listView.setAdapter(adapter); }
Example 11
Source File: FavoritesListAdapter.java From arcusandroid with Apache License 2.0 | 5 votes |
@NonNull @Override public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup viewGroup, int viewType) { LayoutInflater inflater = LayoutInflater.from(viewGroup.getContext()); switch (viewType){ case TYPE_FAVORITE: return new FavoritesViewHolder(inflater.inflate(R.layout.cell_dashboard_favorites, viewGroup, false)); default: return new AddToFavoritesViewHolder(inflater.inflate(R.layout.add_to_favorites_view, viewGroup, false)); } }
Example 12
Source File: StreamActivity.java From codeexamples-android with Eclipse Public License 1.0 | 5 votes |
public StreamAdapter(Context context) { super(context, 0); final float density = context.getResources().getDisplayMetrics().density; mCornerRadius = (int) (CORNER_RADIUS * density + 0.5f); mMargin = (int) (MARGIN * density + 0.5f); mInflater = LayoutInflater.from(getContext()); }
Example 13
Source File: SectionDynamicListExample.java From dynamiclistview with MIT License | 4 votes |
public SectionAdapter(Context c, ArrayList<String> groupList, ArrayList<ArrayList<String>> childList) { super(); this.inflater = LayoutInflater.from(c); this.groupList = groupList; this.childList = childList; }
Example 14
Source File: BindableAdapter.java From RhythmSticks with Apache License 2.0 | 4 votes |
public BindableAdapter(Context context) { this.context = context; this.inflater = LayoutInflater.from(context); }
Example 15
Source File: ResultListAdapter.java From text_converter with GNU General Public License v3.0 | 4 votes |
public ResultListAdapter(Context context, int layout, ArrayList<Result> arr) { super(context, layout, arr); mLayout = layout; mResults = arr; mInflater = LayoutInflater.from(context); }
Example 16
Source File: TweetProgressListAdapter.java From YiBo with Apache License 2.0 | 4 votes |
private void initComponents(Context context) { this.inflater = LayoutInflater.from(context); this.rotateAnimation = AnimationUtils.loadAnimation(context, R.anim.rotate_progress); }
Example 17
Source File: FallbackMessageFactory.java From adamant-android with GNU General Public License v3.0 | 4 votes |
@Override public AbstractMessageListContentViewHolder getViewHolder(ViewGroup parent) { LayoutInflater inflater = LayoutInflater.from(parent.getContext()); View v = inflater.inflate(R.layout.list_item_general_message, parent, false); return new FallbackMessageViewHolder(parent.getContext(), v, adamantAddressProcessor, avatar); }
Example 18
Source File: AdapterWrapper.java From SwipeRecyclerView with Apache License 2.0 | 4 votes |
AdapterWrapper(Context context, RecyclerView.Adapter adapter) { this.mInflater = LayoutInflater.from(context); this.mAdapter = adapter; }
Example 19
Source File: SearchBookContentsActivity.java From reacteu-app with MIT License | 4 votes |
@Override public void onCreate(Bundle icicle) { super.onCreate(icicle); fakeR = new FakeR(this); // Make sure that expired cookies are removed on launch. CookieSyncManager.createInstance(this); CookieManager.getInstance().removeExpiredCookie(); Intent intent = getIntent(); if (intent == null || !intent.getAction().equals(Intents.SearchBookContents.ACTION)) { finish(); return; } isbn = intent.getStringExtra(Intents.SearchBookContents.ISBN); if (LocaleManager.isBookSearchUrl(isbn)) { setTitle(getString(fakeR.getId("string", "sbc_name"))); } else { setTitle(getString(fakeR.getId("string", "sbc_name")) + ": ISBN " + isbn); } setContentView(fakeR.getId("layout", "search_book_contents")); queryTextView = (EditText) findViewById(fakeR.getId("id", "query_text_view")); String initialQuery = intent.getStringExtra(Intents.SearchBookContents.QUERY); if (initialQuery != null && initialQuery.length() > 0) { // Populate the search box but don't trigger the search queryTextView.setText(initialQuery); } queryTextView.setOnKeyListener(keyListener); queryButton = (Button) findViewById(fakeR.getId("id", "query_button")); queryButton.setOnClickListener(buttonListener); resultListView = (ListView) findViewById(fakeR.getId("id", "result_list_view")); LayoutInflater factory = LayoutInflater.from(this); headerView = (TextView) factory.inflate(fakeR.getId("layout", "search_book_contents_header"), resultListView, false); resultListView.addHeaderView(headerView); }
Example 20
Source File: ListApkFragment.java From GPT with Apache License 2.0 | 2 votes |
/** * 构造方法 * * @param context Context */ public ApplistAdapter(Context context) { this.mInflater = LayoutInflater.from(context); }