List of usage examples for android.view LayoutInflater from
public static LayoutInflater from(Context context)
From source file:net.dahanne.android.google.client.GoogleProfileListAdapter.java
public GoogleProfileListAdapter(Context context, LegacyGoogleProfile googleProfile) { if (googleProfile == null) { throw new IllegalArgumentException("googleProfile cannot be null"); }/*from www . jav a 2s.c o m*/ this.googleProfile = googleProfile; this.layoutInflater = LayoutInflater.from(context); }
From source file:android.support.test.testapp.SimplePagerAdapter.java
@Override public Object instantiateItem(ViewGroup container, int position) { LayoutInflater inflater = LayoutInflater.from(container.getContext()); View view = inflater.inflate(R.layout.pager_view, null); ((TextView) view.findViewById(R.id.pager_content)).setText("Position #" + position); view.setBackgroundColor(COLORS[position]); container.addView(view);//ww w. j av a 2 s . c o m return view; }
From source file:com.df.kia.carsChecked.BasicInfoLayout.java
private void init(Context context, JSONObject procedures, String seriesId, String modelId) { rootView = (ViewGroup) LayoutInflater.from(context).inflate(R.layout.car_report_basic_layout, this); MyScrollView scrollView = (MyScrollView) findViewById(R.id.root); scrollView.setListener(new MyScrollView.ScrollViewListener() { @Override//from w ww . j av a 2 s .c o m public void onScrollChanged(MyScrollView scrollView, int x, int y, int oldx, int oldy) { if (scrollView.getScrollY() > 5) { showShadow(true); } else { showShadow(false); } } }); // ?????? scrollView.setDescendantFocusability(ViewGroup.FOCUS_BEFORE_DESCENDANTS); scrollView.setFocusable(true); scrollView.setFocusableInTouchMode(true); scrollView.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { v.requestFocusFromTouch(); return false; } }); try { fillInData(procedures, seriesId, modelId); } catch (JSONException e) { e.printStackTrace(); } }
From source file:com.df.app.carsChecked.BasicInfoLayout.java
private void init(Context context, JSONObject procedures, String seriesId, String modelId) { rootView = (ViewGroup) LayoutInflater.from(context).inflate(R.layout.car_report_basic_layout, this); MyScrollView scrollView = (MyScrollView) findViewById(R.id.root); scrollView.setListener(new MyScrollView.ScrollViewListener() { @Override//from w w w. j av a2 s .c o m public void onScrollChanged(MyScrollView scrollView, int x, int y, int oldx, int oldy) { if (scrollView.getScrollY() > 5) { showShadow(true); } else { showShadow(false); } } }); // ?????? scrollView.setDescendantFocusability(ViewGroup.FOCUS_BEFORE_DESCENDANTS); scrollView.setFocusable(true); scrollView.setFocusableInTouchMode(true); scrollView.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { v.requestFocusFromTouch(); return false; } }); try { fillInData(procedures, seriesId, modelId); } catch (JSONException e) { e.printStackTrace(); } }
From source file:br.com.bioscada.apps.biotracks.SectionResourceCursorAdapter.java
public SectionResourceCursorAdapter(Context context, int layout, Cursor cursor, int flags) { super(context, layout, cursor, flags); this.layoutInflater = LayoutInflater.from(context); }
From source file:cn.apputest.ctria.section2.Dialog_DriverLicenseCard.java
public void alert_DriverLicenseCardDialog(Context context, EditText carnum) { // TODO Auto-generated method stub contextAlawys = context;// w ww.j a v a 2s . c o m preferencesuser = context.getSharedPreferences(Login.FILE_USER, Context.MODE_PRIVATE); String DBName = preferencesuser.getString(Login.KEY_NAME, "1"); helper = new DBHelper(context, DBName + "_DB"); mgr = new DBManager(helper); final Dialog dialog = new Dialog(context, R.style.add_dialog); View vv = LayoutInflater.from(context) .inflate(R.layout.section2activity_lucha2_alert_driverlicensecard_dialog, null); dialog.setCanceledOnTouchOutside(true); dialog.setContentView(vv); // dialog.getWindow().setLayout(480, 524); // dialog.getWindow().setLayout(720, 1050); Resources r = context.getResources(); int x = (int) r.getDimension(R.dimen.x320); int y = (int) r.getDimension(R.dimen.y350); dialog.getWindow().setLayout(x, y); dialog.getWindow().setGravity(Gravity.BOTTOM); Information = (TextView) vv.findViewById(R.id.DriverLicensecard); Information.setClickable(false); Information.setLongClickable(false); Information.setMovementMethod(ScrollingMovementMethod.getInstance()); getDriverLicense(carnum); ImageButton backButton = (ImageButton) vv.findViewById(R.id.backImageButton); backButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub dialog.dismiss(); } }); dialog.show(); }
From source file:appbox.ideastracker.ItemAdapter.java
@Override public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { View layoutView = LayoutInflater.from(parent.getContext()).inflate(mLayoutId, parent, false); //create Recycler here MyRecyclerView recyclerView = (MyRecyclerView) layoutView.findViewById(R.id.horizontal_recycler_view); recyclerView.reboot(); //in case it's recycled // Create the right adapter for the recycler view HorizontalAdapter horizontalAdapter; horizontalAdapter = new HorizontalAdapter(recyclerView.getContext(), "", mTabNumber); // Set up the manager and adapter of the recycler view LinearLayoutManager horizontalLayoutManager = new LinearLayoutManager(mContext, LinearLayoutManager.HORIZONTAL, false); horizontalLayoutManager.scrollToPositionWithOffset(1, 0); recyclerView.setTag(0);/*w w w. ja va2 s . c om*/ recyclerView.setLayoutManager(horizontalLayoutManager); recyclerView.setAdapter(horizontalAdapter); recyclerView.setUp(); return new ViewHolder(layoutView, recyclerView); }
From source file:com.xixicm.de.presentation.view.adapter.SentenceDetailPageAdapter.java
public SentenceDetailPageAdapter(Context context, List<? extends Sentence> sentences, SentencesAdapter.FavoriteClickListener favoriteClickListener) { mContext = context;/*from ww w . ja v a 2 s . c o m*/ mInflater = LayoutInflater.from(mContext); mFavoriteClickListener = favoriteClickListener; mSentences = sentences; if (sentences == null) { mSentences = Collections.emptyList(); } }
From source file:org.npr.android.news.NewsListAdapter.java
public NewsListAdapter(Context context) { super(context, R.layout.news_item); inflater = LayoutInflater.from(getContext()); if (headlineTypeface == null) { headlineTypeface = TypefaceCache.getTypeface("fonts/Georgia.ttf", context); }// w w w . j a v a 2 s .c o m }
From source file:android.support.design.testutils.TestUtilsActions.java
/** * Replaces an existing {@link TabLayout} with a new one inflated from the specified * layout resource./*from ww w . ja va 2 s .co m*/ */ public static ViewAction replaceTabLayout(final @LayoutRes int tabLayoutResId) { return new ViewAction() { @Override public Matcher<View> getConstraints() { return isDisplayingAtLeast(90); } @Override public String getDescription() { return "Replace TabLayout"; } @Override public void perform(UiController uiController, View view) { uiController.loopMainThreadUntilIdle(); final ViewGroup viewGroup = (ViewGroup) view; final int childCount = viewGroup.getChildCount(); // Iterate over children and find TabLayout for (int i = 0; i < childCount; i++) { View child = viewGroup.getChildAt(i); if (child instanceof TabLayout) { // Remove the existing TabLayout viewGroup.removeView(child); // Create a new one final LayoutInflater layoutInflater = LayoutInflater.from(view.getContext()); final TabLayout newTabLayout = (TabLayout) layoutInflater.inflate(tabLayoutResId, viewGroup, false); // Make sure we're adding the new TabLayout at the same index viewGroup.addView(newTabLayout, i); break; } } uiController.loopMainThreadUntilIdle(); } }; }