android.view.LayoutInflater#from ( )源码实例Demo

下面列出了android.view.LayoutInflater#from ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: Gojuon   文件: ResultDialogHelper.java
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();
}
 
源代码2 项目: Android-nRF-Toolbox   文件: AppAdapter.java
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));
}
 
@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);
    }
}
 
源代码4 项目: ForPDA   文件: DefaultForumHolder.java
@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;
}
 
源代码5 项目: NewsMe   文件: MRContentAdapter.java
public MRContentAdapter(Context context) {
    super();
    mInflater = LayoutInflater.from(context);
    // mData = new ArrayList<MRContent>();
    mSelectColor = Color.parseColor("#0662ad");
    mData = DLNAController.getInstance(context).mData;
}
 
源代码6 项目: codeexamples-android   文件: StreamActivity.java
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());
}
 
源代码7 项目: arcusandroid   文件: FavoritesListAdapter.java
@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));
    }
}
 
@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);
}
 
源代码9 项目: SweetTips   文件: SweetSnackbar.java
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);
}
 
源代码10 项目: o2oa   文件: GroupGridViewAdapter.java
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();

}
 
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;
}
 
源代码12 项目: CSCI4669-Fall15-Android   文件: MainActivity.java
@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;
}
 
源代码13 项目: reacteu-app   文件: SearchBookContentsActivity.java
@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);
 }
 
源代码14 项目: adamant-android   文件: FallbackMessageFactory.java
@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);
}
 
源代码15 项目: text_converter   文件: ResultListAdapter.java
public ResultListAdapter(Context context, int layout, ArrayList<Result> arr) {
    super(context, layout, arr);
    mLayout = layout;
    mResults = arr;
    mInflater = LayoutInflater.from(context);
}
 
public SectionAdapter(Context c, ArrayList<String> groupList, ArrayList<ArrayList<String>> childList) {
	super();
	this.inflater = LayoutInflater.from(c);
	this.groupList = groupList;
	this.childList = childList;
}
 
源代码17 项目: RhythmSticks   文件: BindableAdapter.java
public BindableAdapter(Context context) {
  this.context = context;
  this.inflater = LayoutInflater.from(context);
}
 
源代码18 项目: YiBo   文件: TweetProgressListAdapter.java
private void initComponents(Context context) {
	this.inflater = LayoutInflater.from(context);
	this.rotateAnimation = AnimationUtils.loadAnimation(context, R.anim.rotate_progress);
}
 
源代码19 项目: SwipeRecyclerView   文件: AdapterWrapper.java
AdapterWrapper(Context context, RecyclerView.Adapter adapter) {
    this.mInflater = LayoutInflater.from(context);
    this.mAdapter = adapter;
}
 
源代码20 项目: GPT   文件: ListApkFragment.java
/**
 * 构造方法
 *
 * @param context Context
 */
public ApplistAdapter(Context context) {
    this.mInflater = LayoutInflater.from(context);
}