Here are the examples of the java api class android.view.LayoutInflater taken from open source projects.
1. NightOwl#owlBeforeCreate()
Project: NightOwl
File: NightOwl.java
File: NightOwl.java
public static void owlBeforeCreate(Activity activity) { Window window = activity.getWindow(); LayoutInflater layoutInflater = window.getLayoutInflater(); // replace the inflater in window LayoutInflater injectLayoutInflater1 = Factory4InjectedInflater.newInstance(layoutInflater, activity); injectLayoutInflater(injectLayoutInflater1, activity.getWindow(), activity.getWindow().getClass(), WINDOW_INFLATER); // replace the inflater in current ContextThemeWrapper LayoutInflater injectLayoutInflater2 = injectLayoutInflater1.cloneInContext(activity); injectLayoutInflater(injectLayoutInflater2, activity, ContextThemeWrapper.class, THEME_INFLATER); // insert owlViewContext into root view. View v = activity.getWindow().getDecorView(); OwlViewContext owlObservable = new OwlViewContext(); insertViewContext(v, owlObservable); }
2. LeftNavBar#initialize()
Project: android-demos
File: LeftNavBar.java
File: LeftNavBar.java
private void initialize(Window window, Context context) { View decor = window.getDecorView(); ViewGroup group = (ViewGroup) window.getDecorView(); LayoutInflater inflater = (LayoutInflater) decor.getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); inflater.inflate(R.layout.lib_title_container, group, true); inflater.inflate(R.layout.lib_left_nav, group, true); mContext = decor.getContext(); mIsOverlay = window.hasFeature(Window.FEATURE_ACTION_BAR_OVERLAY); mTitleBar = (TitleBarView) decor.findViewById(R.id.title_container); mLeftNav = (LeftNavView) decor.findViewById(R.id.left_nav); mContent = group.getChildAt(0); if (mTitleBar == null || mLeftNav == null) { throw new IllegalStateException(getClass().getSimpleName() + ": incompatible window decor!"); } setDisplayOptions(DEFAULT_DISPLAY_OPTIONS); showOptionsMenu(true); }
3. TimelineItem#init()
Project: media-for-mobile
File: TimelineItem.java
File: TimelineItem.java
private void init(AttributeSet attrs, int defStyle) { LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); inflater.inflate(R.layout.timeline_item, this, true); mVideoView = (VideoView) findViewById(R.id.thumbinail); mSegmentSelector = (RangeSelector) findViewById(R.id.segment); mSegmentSelector.setEventsListener(this); mOpenButton = ((ImageButton) findViewById(R.id.open)); mOpenButton.setOnClickListener(this); mDeleteButton = ((ImageButton) findViewById(R.id.delete)); mDeleteButton.setOnClickListener(this); mTitleText = (TextView) findViewById(R.id.title); mDurationText = (TextView) findViewById(R.id.length); mMediaInfo = new MediaFileInfo(new AndroidMediaObjectFactory(mContext)); mEnableSegmentPicker = true; setMediaUri(null); }
4. MaterialTip#init()
Project: material-tip
File: MaterialTip.java
File: MaterialTip.java
private void init() { context = getContext(); LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); inflater.inflate(R.layout.tip_layout, this, true); tip = findViewById(R.id.tip); positive = (Button) findViewById(R.id.tip_positive); negative = (Button) findViewById(R.id.tip_negative); title = (TextView) findViewById(R.id.tip_title); text = (TextView) findViewById(R.id.tip_text); icon = (ImageView) findViewById(R.id.tip_icon); tip.setOnTouchListener(this); positive.setOnClickListener(this); negative.setOnClickListener(this); waitHeight(); }
5. CategoryTable#init()
Project: EhViewer
File: CategoryTable.java
File: CategoryTable.java
public void init() { LayoutInflater inflater = LayoutInflater.from(getContext()); inflater.inflate(R.layout.widget_category_table, this); ViewGroup row0 = (ViewGroup) getChildAt(0); mDoujinshi = (CheckTextView) row0.getChildAt(0); mManga = (CheckTextView) row0.getChildAt(1); ViewGroup row1 = (ViewGroup) getChildAt(1); mArtistCG = (CheckTextView) row1.getChildAt(0); mGameCG = (CheckTextView) row1.getChildAt(1); ViewGroup row2 = (ViewGroup) getChildAt(2); mWestern = (CheckTextView) row2.getChildAt(0); mNonH = (CheckTextView) row2.getChildAt(1); ViewGroup row3 = (ViewGroup) getChildAt(3); mImageSets = (CheckTextView) row3.getChildAt(0); mCosplay = (CheckTextView) row3.getChildAt(1); ViewGroup row4 = (ViewGroup) getChildAt(4); mAsianPorn = (CheckTextView) row4.getChildAt(0); mMisc = (CheckTextView) row4.getChildAt(1); }
6. AdvanceSearchTable#init()
Project: EhViewer
File: AdvanceSearchTable.java
File: AdvanceSearchTable.java
public void init(Context context) { LayoutInflater inflater = LayoutInflater.from(getContext()); inflater.inflate(R.layout.widget_advance_search_table, this); ViewGroup row0 = (ViewGroup) getChildAt(0); mSname = (CheckBox) row0.getChildAt(0); mStags = (CheckBox) row0.getChildAt(1); ViewGroup row1 = (ViewGroup) getChildAt(1); mSdesc = (CheckBox) row1.getChildAt(0); mStorr = (CheckBox) row1.getChildAt(1); ViewGroup row2 = (ViewGroup) getChildAt(2); mSto = (CheckBox) row2.getChildAt(0); mSdt1 = (CheckBox) row2.getChildAt(1); ViewGroup row3 = (ViewGroup) getChildAt(3); mSdt2 = (CheckBox) row3.getChildAt(0); mSh = (CheckBox) row3.getChildAt(1); ViewGroup row4 = (ViewGroup) getChildAt(4); mSr = (CheckBox) row4.getChildAt(0); mMinRating = (Spinner) row4.getChildAt(1); }
7. ComicView#initializeWithResources()
Project: droid-comic-viewer
File: ComicView.java
File: ComicView.java
protected void initializeWithResources(Context context) { LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); inflater.inflate(R.layout.comic_view, this); animationFadeIn = R.anim.fade_in; animationFadeOut = R.anim.fade_out; animationKeep = R.anim.keep; animationPushDownIn = R.anim.push_down_in; animationPushDownOut = R.anim.push_down_out; animationPushLeftIn = R.anim.push_left_in; animationPushLeftOut = R.anim.push_left_out; animationPushRightIn = R.anim.push_right_in; animationPushRightOut = R.anim.push_right_out; animationPushUpIn = R.anim.push_up_in; animationPushUpOut = R.anim.push_up_out; messageButton = (Button) findViewById(R.id.message_button); mSwitcher = (ImageSwitcher) findViewById(R.id.switcher); mVideoView = (VideoView) findViewById(R.id.video_view); stringScreenProgressMessage = R.string.dialog_page_progress_text; stringScreenProgressTitle = R.string.dialog_page_progress_title; stringUnavailableText = R.string.dialog_unavailable_text; stringUnavailableTitle = R.string.dialog_unavailable_title; }
8. BaseActivity#onCreate()
Project: u2020-mvp
File: BaseActivity.java
File: BaseActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { Bundle params = getIntent().getExtras(); if (params != null) { onExtractParams(params); } if (savedInstanceState != null && savedInstanceState.containsKey(BF_UNIQUE_KEY)) { uniqueKey = savedInstanceState.getString(BF_UNIQUE_KEY); } else { uniqueKey = UUID.randomUUID().toString(); } super.onCreate(savedInstanceState); U2020App app = U2020App.get(this); onCreateComponent(app.component()); if (viewContainer == null) { throw new IllegalStateException("No injection happened. Add component.inject(this) in onCreateComponent() implementation."); } Registry.add(this, viewId(), presenter()); final LayoutInflater layoutInflater = getLayoutInflater(); ViewGroup container = viewContainer.forActivity(this); layoutInflater.inflate(layoutId(), container); }
9. VideoControlView#initSubviews()
Project: twitter-kit-android
File: VideoControlView.java
File: VideoControlView.java
void initSubviews() { final LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); inflater.inflate(R.layout.tw__video_control, this); stateControl = (ImageButton) findViewById(R.id.tw__state_control); currentTime = (TextView) findViewById(R.id.tw__current_time); duration = (TextView) findViewById(R.id.tw__duration); seekBar = (SeekBar) findViewById(R.id.tw__progress); seekBar.setMax((int) PROGRESS_BAR_TICKS); seekBar.setOnSeekBarChangeListener(createProgressChangeListener()); stateControl.setOnClickListener(createStateControlClickListener()); setDuration(0); setCurrentTime(0); setProgress(0, 0, 0); }
10. DimmingOverlayView#init()
Project: talkback
File: DimmingOverlayView.java
File: DimmingOverlayView.java
private void init() { setOrientation(VERTICAL); setGravity(Gravity.CENTER); setBackgroundColor(Color.BLACK); LayoutInflater inflater = LayoutInflater.from(getContext()); inflater.inflate(R.layout.dimming_overlay_exit_instruction, this, true); mContent = findViewById(R.id.content); mTimerView = (TextView) findViewById(R.id.timer); mProgress = (ProgressBar) findViewById(R.id.progress); }
11. PushRecipientsPanel#initialize()
Project: Silence
File: PushRecipientsPanel.java
File: PushRecipientsPanel.java
private void initialize() { LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); inflater.inflate(R.layout.push_recipients_panel, this, true); View imageButton = findViewById(R.id.contacts_button); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) ((MarginLayoutParams) imageButton.getLayoutParams()).topMargin = 0; panel = findViewById(R.id.recipients_panel); initRecipientsEditor(); }
12. TextureAdapter#newView()
Project: ShaderEditor
File: TextureAdapter.java
File: TextureAdapter.java
@Override public View newView(Context context, Cursor cursor, ViewGroup parent) { LayoutInflater inflater = LayoutInflater.from(parent.getContext()); return inflater.inflate(R.layout.row_texture, parent, false); }
13. ShaderAdapter#newView()
Project: ShaderEditor
File: ShaderAdapter.java
File: ShaderAdapter.java
@Override public View newView(Context context, Cursor cursor, ViewGroup parent) { LayoutInflater inflater = LayoutInflater.from(parent.getContext()); return inflater.inflate(R.layout.row_shader, parent, false); }
14. EmoticonLayout#init()
Project: ChatKeyboard
File: EmoticonLayout.java
File: EmoticonLayout.java
private void init(Context context) { LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); inflater.inflate(R.layout.keyboard_bottom_emoticons, this); ivIndicator = (IndicatorView) findViewById(R.id.emoticon_indicator_view); epvContent = (EmoticonsPageView) findViewById(R.id.emoticon_page_view); etvToolBar = (EmoticonsToolBarView) findViewById(R.id.emoticon_page_toolbar); epvContent.setOnIndicatorListener(this); epvContent.setIViewListener(new IView() { @Override public void onItemClick(EmoticonBean bean) { mListener.onEmoticonItemClicked(bean); } @Override public void onPageChangeTo(int position) { etvToolBar.setToolBtnSelect(position); } }); etvToolBar.setOnToolBarItemClickListener(new EmoticonsToolBarView.OnToolBarItemClickListener() { @Override public void onToolBarItemClick(int position) { epvContent.setPageSelect(position); } }); }
15. BookEditLoaned#loaned()
Project: Book-Catalogue
File: BookEditLoaned.java
File: BookEditLoaned.java
/** * Display the existing loan page. It is slightly different to the loan to page * * @param user The user the book was loaned to */ private void loaned(String user) { ScrollView sv = (ScrollView) getView().findViewById(R.id.root); sv.removeAllViews(); LayoutInflater inf = getActivity().getLayoutInflater(); inf.inflate(R.layout.edit_book_loaned, sv); TextView mWhoText = (TextView) sv.findViewById(R.id.who); mWhoText.setText(user); Button mConfirmButton = (Button) sv.findViewById(R.id.confirm); mConfirmButton.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { removeLoan(); loanTo(); } }); }
16. BookEditLoaned#loanTo()
Project: Book-Catalogue
File: BookEditLoaned.java
File: BookEditLoaned.java
/** * Display the loan to page. It is slightly different to the existing loan page */ private void loanTo() { ScrollView sv = (ScrollView) getView().findViewById(R.id.root); sv.removeAllViews(); LayoutInflater inf = getActivity().getLayoutInflater(); inf.inflate(R.layout.edit_book_loan, sv); AutoCompleteTextView mUserText = (AutoCompleteTextView) sv.findViewById(R.id.loan_to_who); try { ArrayAdapter<String> series_adapter = new ArrayAdapter<String>(getActivity(), android.R.layout.simple_dropdown_item_1line, getFriends()); mUserText.setAdapter(series_adapter); } catch (Exception e) { Logger.logError(e); } Button mConfirmButton = (Button) sv.findViewById(R.id.confirm); mConfirmButton.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { String friend = saveLoan(); loaned(friend); } }); }
17. OtpView#init()
Project: android-otpview-pinview
File: OtpView.java
File: OtpView.java
private void init(AttributeSet attrs) { TypedArray styles = getContext().obtainStyledAttributes(attrs, R.styleable.OtpView); LayoutInflater mInflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); mInflater.inflate(R.layout.otpview_layout, this); mOtpOneField = (EditText) findViewById(R.id.otp_one_edit_text); mOtpTwoField = (EditText) findViewById(R.id.otp_two_edit_text); mOtpThreeField = (EditText) findViewById(R.id.otp_three_edit_text); mOtpFourField = (EditText) findViewById(R.id.otp_four_edit_text); styleEditTexts(styles); styles.recycle(); }
18. LoadingCardView#buildLoadingCardView()
Project: Vineyard
File: LoadingCardView.java
File: LoadingCardView.java
private void buildLoadingCardView(int styleResId) { setFocusable(false); setFocusableInTouchMode(false); setCardType(CARD_TYPE_MAIN_ONLY); setBackgroundResource(R.color.primary_light); LayoutInflater inflater = LayoutInflater.from(getContext()); inflater.inflate(R.layout.view_loading_card, this); TypedArray cardAttrs = getContext().obtainStyledAttributes(styleResId, android.support.v17.leanback.R.styleable.lbImageCardView); mProgressBar = (ProgressBar) findViewById(R.id.progress_indicator); cardAttrs.recycle(); }
19. ArcMenu#init()
Project: UltimateAndroid
File: ArcMenu.java
File: ArcMenu.java
private void init(Context context) { LayoutInflater li = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); li.inflate(R.layout.arc_menu_arc_menu, this); mArcLayout = (ArcLayout) findViewById(R.id.item_layout); final ViewGroup controlLayout = (ViewGroup) findViewById(R.id.control_layout); controlLayout.setClickable(true); controlLayout.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { if (event.getAction() == MotionEvent.ACTION_DOWN) { mHintView.startAnimation(createHintSwitchAnimation(mArcLayout.isExpanded())); mArcLayout.switchState(true); } return false; } }); mHintView = (ImageView) findViewById(R.id.control_hint); }
20. ArcMenu#init()
Project: UltimateAndroid
File: ArcMenu.java
File: ArcMenu.java
private void init(Context context) { LayoutInflater li = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); li.inflate(R.layout.arc_menu_arc_menu, this); mArcLayout = (ArcLayout) findViewById(R.id.item_layout); final ViewGroup controlLayout = (ViewGroup) findViewById(R.id.control_layout); controlLayout.setClickable(true); controlLayout.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { if (event.getAction() == MotionEvent.ACTION_DOWN) { mHintView.startAnimation(createHintSwitchAnimation(mArcLayout.isExpanded())); mArcLayout.switchState(true); } return false; } }); mHintView = (ImageView) findViewById(R.id.control_hint); }
21. Patio#addThumbnail()
Project: UltimateAndroid
File: Patio.java
File: Patio.java
public void addThumbnail(String thumbnailPath) { LayoutInflater inflater = LayoutInflater.from(mContext); ImageView imageView = (ImageView) inflater.inflate(THUMBNAIL_LAYOUT_RES_ID, mThumbnailsContainer, false); int resizeDimension = mThumbnailWidth > mThumbnailHeight ? Float.valueOf(mThumbnailWidth).intValue() : Float.valueOf(mThumbnailHeight).intValue(); Picasso.with(mContext).load(new File(thumbnailPath)).resize(resizeDimension, resizeDimension).centerCrop().into(imageView); ViewGroup.LayoutParams layoutParams = imageView.getLayoutParams(); layoutParams.width = Float.valueOf(mThumbnailWidth).intValue(); layoutParams.height = Float.valueOf(mThumbnailHeight).intValue(); mThumbnailsContainer.addView(imageView, 0, layoutParams); imageView.setOnClickListener(this); mPatioThumbnails.add(new PatioThumbnail(thumbnailPath, imageView)); updateThumbnailsMessage(); }
22. DownloadDialogShower#showDownloadDialog()
Project: UltimateAndroid
File: DownloadDialogShower.java
File: DownloadDialogShower.java
private void showDownloadDialog() { builder = new AlertDialog.Builder(mContext); final LayoutInflater inflater = LayoutInflater.from(mContext); View v = inflater.inflate(R.layout.progress_update, null); mProgress = (ProgressBar) v.findViewById(R.id.progress); updatePercentTextView = (TextView) v.findViewById(R.id.updatePercentTextView); updateCurrentTextView = (TextView) v.findViewById(R.id.updateCurrentTextView); updateCurrentTextView.setText(prepareDownloadingTextViewString); updateTotalTextView = (TextView) v.findViewById(R.id.updateTotalTextView); // builder.setCustomTitle(inflater.inflate(R.layout.progress_update_title, null)); builder.setTitle(downloadTitle); builder.setView(v); builder.setNegativeButton(downloadCancel, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); interceptFlag = true; } }); progressDialog = builder.create(); progressDialog.show(); }
23. AboutActivity#initLicenses()
Project: UltimateAndroid
File: AboutActivity.java
File: AboutActivity.java
private void initLicenses() { LayoutInflater inflater = LayoutInflater.from(this); LinearLayout content = (LinearLayout) findViewById(R.id.licenses); String[] softwareList = getResources().getStringArray(R.array.software_list); String[] licenseList = getResources().getStringArray(R.array.license_list); content.addView(createItemsText(softwareList)); for (int i = 0; i < softwareList.length; i++) { content.addView(createDivider(inflater)); content.addView(createHeader(softwareList[i])); content.addView(createHtmlText(licenseList[i])); } }
24. ListViewFilterActivity#setListAdaptor()
Project: UltimateAndroid
File: ListViewFilterActivity.java
File: ListViewFilterActivity.java
private void setListAdaptor() { // create instance of PinnedHeaderAdapter and set adapter to list view mAdaptor = new PinnedHeaderAdapter(this, mListItems, mListSectionPos); mListView.setAdapter(mAdaptor); LayoutInflater inflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE); // set header view View pinnedHeaderView = inflater.inflate(R.layout.list_filter_section_row_view, mListView, false); mListView.setPinnedHeaderView(pinnedHeaderView); // set index bar view IndexBarView indexBarView = (IndexBarView) inflater.inflate(R.layout.list_filter_index_bar_view, mListView, false); indexBarView.setData(mListView, mListItems, mListSectionPos); mListView.setIndexBarView(indexBarView); // set preview text view View previewTextView = inflater.inflate(R.layout.list_filter_preview_view, mListView, false); mListView.setPreviewView(previewTextView); // for configure pinned header view on scroll change mListView.setOnScrollListener(mAdaptor); }
25. TelescopeViewContainer#showTelescopeDialog()
Project: u2020-mvp
File: TelescopeViewContainer.java
File: TelescopeViewContainer.java
public void showTelescopeDialog(final Activity activity) { LayoutInflater inflater = LayoutInflater.from(activity); TelescopeLayout content = (TelescopeLayout) inflater.inflate(R.layout.telescope_tutorial_dialog, null); final AlertDialog dialog = new AlertDialog.Builder(activity).setView(content).setCancelable(false).create(); content.setLens(new Lens() { @Override public void onCapture(File file) { dialog.dismiss(); Context toastContext = new ContextThemeWrapper(activity, android.R.style.Theme_DeviceDefault_Dialog); LayoutInflater toastInflater = LayoutInflater.from(toastContext); Toast toast = Toast.makeText(toastContext, "", Toast.LENGTH_SHORT); View toastView = toastInflater.inflate(R.layout.telescope_tutorial_toast, null); toast.setView(toastView); toast.setGravity(Gravity.CENTER, 0, 0); toast.show(); } }); dialog.show(); }
26. TelescopeViewContainer#showTelescopeDialog()
Project: u2020
File: TelescopeViewContainer.java
File: TelescopeViewContainer.java
public void showTelescopeDialog(final Activity activity) { LayoutInflater inflater = LayoutInflater.from(activity); TelescopeLayout content = (TelescopeLayout) inflater.inflate(R.layout.telescope_tutorial_dialog, null); final AlertDialog dialog = new AlertDialog.Builder(activity).setView(content).setCancelable(false).create(); content.setLens(new Lens() { @Override public void onCapture(File file) { dialog.dismiss(); Context toastContext = new ContextThemeWrapper(activity, android.R.style.Theme_DeviceDefault_Dialog); LayoutInflater toastInflater = LayoutInflater.from(toastContext); Toast toast = Toast.makeText(toastContext, "", Toast.LENGTH_SHORT); View toastView = toastInflater.inflate(R.layout.telescope_tutorial_toast, null); toast.setView(toastView); toast.setGravity(Gravity.CENTER, 0, 0); toast.show(); } }); dialog.show(); }
27. MainActivity#initList()
Project: translation-cards
File: MainActivity.java
File: MainActivity.java
private void initList() { ListView list = (ListView) findViewById(R.id.list); LayoutInflater layoutInflater = getLayoutInflater(); list.addHeaderView(layoutInflater.inflate(R.layout.main_list_header, list, false)); list.addFooterView(layoutInflater.inflate(R.layout.main_list_footer, list, false)); listAdapter = new CardListAdapter(this, R.layout.list_item, R.id.card_text, new ArrayList<String>(), list); list.setAdapter(listAdapter); ImageButton addTranslationButton = (ImageButton) findViewById(R.id.add_button); addTranslationButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { showAddTranslationDialog(); } }); }
28. ColorPickerDialog#setUp()
Project: transdroid
File: ColorPickerDialog.java
File: ColorPickerDialog.java
private void setUp(int color) { LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); View layout = inflater.inflate(R.layout.dialog_color_picker, null); setContentView(layout); setTitle(R.string.dialog_color_picker); mColorPicker = (ColorPickerView) layout.findViewById(R.id.color_picker_view); mOldColor = (ColorPickerPanelView) layout.findViewById(R.id.old_color_panel); mNewColor = (ColorPickerPanelView) layout.findViewById(R.id.new_color_panel); ((LinearLayout) mOldColor.getParent()).setPadding(Math.round(mColorPicker.getDrawingOffset()), 0, Math.round(mColorPicker.getDrawingOffset()), 0); mOldColor.setOnClickListener(this); mNewColor.setOnClickListener(this); mColorPicker.setOnColorChangedListener(this); mOldColor.setColor(color); mColorPicker.setColor(color, true); }
29. UiHandler#init()
Project: tracklytics
File: UiHandler.java
File: UiHandler.java
private void init() { ViewGroup rootView = (ViewGroup) context.getWindow().getDecorView().findViewById(android.R.id.content); LayoutInflater inflater = LayoutInflater.from(context); View mainContainer = inflater.inflate(R.layout.tracklytics_debugger_layout, rootView, true); container = mainContainer.findViewById(R.id.tracklytics_debugger_container); container.setVisibility(View.GONE); mainContainer.findViewById(R.id.tracklytics_debugger_close).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { container.setVisibility(View.GONE); beeImageView.setVisibility(View.VISIBLE); } }); mainContainer.findViewById(R.id.tracklytics_debugger_done_all).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { adapter.clearAll(); } }); ListView listView = (ListView) container.findViewById(R.id.tracklytics_debugger_list); adapter = new DebugEventAdapter(EventQueue.pollUndispatched()); listView.setAdapter(adapter); EventQueue.subscribe(adapter); }
30. DialogParameterInfo#buildView()
Project: Tower
File: DialogParameterInfo.java
File: DialogParameterInfo.java
private static View buildView(ParamsAdapterItem item, Context context) { final LayoutInflater inflater = LayoutInflater.from(context); final View view = inflater.inflate(R.layout.fragment_parameters_info, null); final Parameter parameter = item.getParameter(); setTextView(view, R.id.displayNameView, parameter.getDisplayName()); setTextView(view, R.id.nameView, parameter.getName()); setTextView(view, R.id.descView, parameter.getDescription()); setTextLayout(view, R.id.unitsLayout, R.id.unitsView, parameter.getUnits()); setTextLayout(view, R.id.rangeLayout, R.id.rangeView, formatRange(parameter.getRange())); setTextLayout(view, R.id.valuesLayout, R.id.valuesView, parameter.getValues()); return view; }
31. DialogMaterialFragment#onCreateDialog()
Project: Tower
File: DialogMaterialFragment.java
File: DialogMaterialFragment.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { LayoutInflater layoutInflater = getActivity().getLayoutInflater(); ChangeLogRecyclerView chgList = (ChangeLogRecyclerView) layoutInflater.inflate(R.layout.demo_changelog_fragment_dialogmaterial, null); return new AlertDialog.Builder(getActivity(), R.style.AppCompatAlertDialogStyle).setTitle("Changelog").setView(chgList).setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { dialog.dismiss(); } }).create(); }
32. SmoothieSupportActivityModuleTest#testGet()
Project: toothpick
File: SmoothieSupportActivityModuleTest.java
File: SmoothieSupportActivityModuleTest.java
@Test public void testGet() throws Exception { //GIVEN FragmentActivity activity = Robolectric.buildActivity(FragmentActivity.class).create().get(); Application application = RuntimeEnvironment.application; Scope appScope = Toothpick.openScope(application); appScope.installModules(new SmoothieApplicationModule(application)); Scope activityScope = Toothpick.openScopes(application, activity); activityScope.installModules(new SmoothieSupportActivityModule(activity)); //WHEN Activity injectedActivity = activityScope.getInstance(Activity.class); FragmentManager fragmentManager = activityScope.getInstance(FragmentManager.class); LoaderManager loaderManager = activityScope.getInstance(LoaderManager.class); LayoutInflater layoutInflater = activityScope.getInstance(LayoutInflater.class); //THEN assertThat(injectedActivity, instanceOf(FragmentActivity.class)); assertThat((FragmentActivity) injectedActivity, sameInstance(activity)); assertThat(fragmentManager, notNullValue()); assertThat(loaderManager, notNullValue()); assertThat(layoutInflater, notNullValue()); }
33. SmoothieActivityModuleTest#testGet()
Project: toothpick
File: SmoothieActivityModuleTest.java
File: SmoothieActivityModuleTest.java
@Test public void testGet() throws Exception { //GIVEN Activity activity = Robolectric.buildActivity(Activity.class).create().get(); Application application = RuntimeEnvironment.application; Scope appScope = Toothpick.openScope(application); appScope.installModules(new SmoothieApplicationModule(application)); Scope activityScope = Toothpick.openScopes(application, activity); activityScope.installModules(new SmoothieActivityModule(activity)); //WHEN Activity injectedActivity = activityScope.getInstance(Activity.class); FragmentManager fragmentManager = activityScope.getInstance(FragmentManager.class); LoaderManager loaderManager = activityScope.getInstance(LoaderManager.class); LayoutInflater layoutInflater = activityScope.getInstance(LayoutInflater.class); //THEN assertThat(injectedActivity, is(activity)); assertThat(fragmentManager, notNullValue()); assertThat(loaderManager, notNullValue()); assertThat(layoutInflater, notNullValue()); }
34. MainActivity#buildCounterDrawable()
Project: TLint
File: MainActivity.java
File: MainActivity.java
private Drawable buildCounterDrawable(int count, int backgroundImageId) { LayoutInflater inflater = LayoutInflater.from(this); View view = inflater.inflate(R.layout.notification_count_layout, null); view.setBackgroundResource(backgroundImageId); TextView tvCount = (TextView) view.findViewById(R.id.tvCount); if (count == 0) { tvCount.setVisibility(View.GONE); } else { tvCount.setVisibility(View.VISIBLE); tvCount.setText(String.valueOf(count)); } view.measure(View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED), View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED)); view.layout(0, 0, view.getMeasuredWidth(), view.getMeasuredHeight()); view.setDrawingCacheEnabled(true); view.setDrawingCacheQuality(View.DRAWING_CACHE_QUALITY_HIGH); Bitmap bitmap = Bitmap.createBitmap(view.getDrawingCache()); view.setDrawingCacheEnabled(false); return new BitmapDrawable(getResources(), bitmap); }
35. TimePickerDialog#initView()
Project: TimePickerDialog
File: TimePickerDialog.java
File: TimePickerDialog.java
View initView() { LayoutInflater inflater = LayoutInflater.from(getContext()); View view = inflater.inflate(R.layout.timepicker_layout, null); TextView cancel = (TextView) view.findViewById(R.id.tv_cancel); cancel.setOnClickListener(this); TextView sure = (TextView) view.findViewById(R.id.tv_sure); sure.setOnClickListener(this); TextView title = (TextView) view.findViewById(R.id.tv_title); View toolbar = view.findViewById(R.id.toolbar); title.setText(mPickerConfig.mTitleString); cancel.setText(mPickerConfig.mCancelString); sure.setText(mPickerConfig.mSureString); toolbar.setBackgroundColor(mPickerConfig.mThemeColor); mTimeWheel = new TimeWheel(view, mPickerConfig); return view; }
36. MainActivity#showInternalFilesDir()
Project: ThinDownloadManager
File: MainActivity.java
File: MainActivity.java
private void showInternalFilesDir() { File internalFile = new File(getExternalFilesDir("").getPath()); File files[] = internalFile.listFiles(); String contentText = ""; if (files.length == 0) { contentText = "No Files Found"; } for (File file : files) { contentText += file.getName() + " " + file.length() + " \n\n "; } AlertDialog.Builder builder = new AlertDialog.Builder(this); AlertDialog internalCacheDialog = builder.create(); LayoutInflater inflater = internalCacheDialog.getLayoutInflater(); View dialogLayout = inflater.inflate(R.layout.layout_files, null); TextView content = (TextView) dialogLayout.findViewById(R.id.filesList); content.setText(contentText); builder.setView(dialogLayout); builder.show(); }
37. MainActivity#showLoadingDialog()
Project: syncthing-android
File: MainActivity.java
File: MainActivity.java
/** * Shows the loading dialog with the correct text ("creating keys" or "loading"). */ private void showLoadingDialog() { if (mLoadingDialog != null) return; LayoutInflater inflater = getLayoutInflater(); @SuppressLint("InflateParams") View dialogLayout = inflater.inflate(R.layout.dialog_loading, null); TextView loadingText = (TextView) dialogLayout.findViewById(R.id.loading_text); loadingText.setText((isFirstStart()) ? R.string.web_gui_creating_key : R.string.api_loading); mLoadingDialog = new AlertDialog.Builder(MainActivity.this).setCancelable(false).setView(dialogLayout).show(); }
38. PagerAdapter#getView()
Project: SparkleMotion
File: PagerAdapter.java
File: PagerAdapter.java
@Override protected View getView(int position, ViewGroup container) { LayoutInflater inflater = LayoutInflater.from(container.getContext()); switch(position) { case 0: return inflater.inflate(R.layout.sunrise_page, container, false); case 1: return inflater.inflate(R.layout.sunset_page, container, false); default: return null; } }
39. AddTwitterKeywordFragment#showDialog()
Project: SMSSync
File: AddTwitterKeywordFragment.java
File: AddTwitterKeywordFragment.java
private void showDialog() { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); LayoutInflater inflater = getActivity().getLayoutInflater(); View view = inflater.inflate(R.layout.dialog_add_keyword, null); EditText keywordEditText = ButterKnife.findById(view, R.id.add_keyword_text); builder.setView(view).setPositiveButton(R.string.add, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { if (Utility.isEmpty(mKeywords)) { mKeywords = new ArrayList<String>(); mKeywords.add(keywordEditText.getText().toString()); } else { mKeywords.add(keywordEditText.getText().toString()); } mPrefsFactory.twitterKeywords().set(TextUtils.join(",", mKeywords)); } }).setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel(); } }); builder.create().show(); }
40. DemoTabWithNotificationMarkActivity#createTabView()
Project: SmartTabLayout
File: DemoTabWithNotificationMarkActivity.java
File: DemoTabWithNotificationMarkActivity.java
@Override public View createTabView(ViewGroup container, int position, PagerAdapter adapter) { LayoutInflater inflater = LayoutInflater.from(container.getContext()); Resources res = container.getContext().getResources(); View tab = inflater.inflate(R.layout.custom_tab_icon_and_notification_mark, container, false); View mark = tab.findViewById(R.id.custom_tab_notification_mark); mark.setVisibility(View.GONE); ImageView icon = (ImageView) tab.findViewById(R.id.custom_tab_icon); switch(position) { case 0: icon.setImageDrawable(res.getDrawable(R.drawable.ic_home_white_24dp)); break; case 1: icon.setImageDrawable(res.getDrawable(R.drawable.ic_search_white_24dp)); break; case 2: icon.setImageDrawable(res.getDrawable(R.drawable.ic_person_white_24dp)); break; default: throw new IllegalStateException("Invalid position: " + position); } return tab; }
41. WhatsNewDialog#show()
Project: sls
File: WhatsNewDialog.java
File: WhatsNewDialog.java
public void show() { final LayoutInflater factory = LayoutInflater.from(mCtx); View dialogView = factory.inflate(R.layout.whats_new, null); innerUpdate(dialogView); AlertDialog.Builder adBuilder = new AlertDialog.Builder(mCtx).setTitle(R.string.whats_new).setIcon(android.R.drawable.ic_dialog_info).setView(dialogView).setNegativeButton(R.string.close, null); adBuilder.show(); }
42. AboutDialog#show()
Project: sls
File: AboutDialog.java
File: AboutDialog.java
public void show() { final LayoutInflater factory = LayoutInflater.from(mCtx); View dialogView = factory.inflate(R.layout.about, null); innerUpdate(dialogView); AlertDialog.Builder adBuilder = new AlertDialog.Builder(mCtx).setTitle(R.string.about).setIcon(android.R.drawable.ic_dialog_info).setView(dialogView).setNegativeButton(R.string.close, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { } }); adBuilder.show(); }
43. PluginSimplePlayer#initLoadInfoPage()
Project: SimplifyReader
File: PluginSimplePlayer.java
File: PluginSimplePlayer.java
/** * ??????? */ private void initLoadInfoPage() { if (null == mActivity) return; LayoutInflater mLayoutInflater = LayoutInflater.from(mActivity); if (null == mLayoutInflater) return; loadingInfoLayout = (RelativeLayout) mLayoutInflater.inflate(R.layout.yp_detail_loading_info_page, null); if (null == loadingInfoLayout) return; infoSeekBar = (SeekBar) loadingInfoLayout.findViewById(R.id.loading_info_seekbar); }
44. LedBlinkPatternListPreference#showDialog()
Project: Silence
File: LedBlinkPatternListPreference.java
File: LedBlinkPatternListPreference.java
private void showDialog() { LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View view = inflater.inflate(R.layout.led_pattern_dialog, null); this.seekBarOn = (SeekBar) view.findViewById(R.id.SeekBarOn); this.seekBarOff = (SeekBar) view.findViewById(R.id.SeekBarOff); this.seekBarOnLabel = (TextView) view.findViewById(R.id.SeekBarOnMsLabel); this.seekBarOffLabel = (TextView) view.findViewById(R.id.SeekBarOffMsLabel); this.seekBarOn.setOnSeekBarChangeListener(this); this.seekBarOff.setOnSeekBarChangeListener(this); initializeSeekBarValues(); initializeDialog(view); dialogInProgress = true; }
45. BuildMenu#createButton()
Project: settlers-remake
File: BuildMenu.java
File: BuildMenu.java
private void createButton(TableRow currentRow, EBuildingType type) { LayoutInflater layoutInflater = LayoutInflater.from(currentRow.getContext()); View buttonRoot = layoutInflater.inflate(R.layout.buildingbutton, currentRow, false); TextView count = (TextView) buttonRoot.findViewById(R.id.buildingbutton_count); buildingCounts.put(type, count); count.setText(" \n "); ImageButton button = (ImageButton) buttonRoot.findViewById(R.id.buildingbutton_button); button.setOnClickListener(generateActionListener(new ShowConstructionMarksAction(type), true)); OriginalImageProvider.get(type).setAsButton(button); currentRow.addView(buttonRoot); }
46. GridSubtitleVolleyResponseListenerTest#testVideoHasNoSubtitles()
Project: serenity-android
File: GridSubtitleVolleyResponseListenerTest.java
File: GridSubtitleVolleyResponseListenerTest.java
@Test public void testVideoHasNoSubtitles() throws Exception { MoviePosterInfo video = new MoviePosterInfo(); String data = IOUtils.toString(getClass().getResourceAsStream("/resources/library/metadata/523/nosubtitles.xml")); MediaContainer mediaContainer = serializer.read(MediaContainer.class, data, false); LayoutInflater layoutInflator = movieBrowserActivity.getLayoutInflater(); View view = layoutInflator.inflate(R.layout.poster_indicator_view, null); GridSubtitleVolleyResponseListener gridSubtitleResponseListener = new GridSubtitleVolleyResponseListener(video, movieBrowserActivity, view); gridSubtitleResponseListener.onResponse(mediaContainer); assertThat(video.getAvailableSubtitles()).isNullOrEmpty(); }
47. GridSubtitleVolleyResponseListenerTest#testVideoHasSubtitles()
Project: serenity-android
File: GridSubtitleVolleyResponseListenerTest.java
File: GridSubtitleVolleyResponseListenerTest.java
@Test public void testVideoHasSubtitles() throws Exception { MoviePosterInfo video = new MoviePosterInfo(); String data = IOUtils.toString(getClass().getResourceAsStream("/resources/library/metadata/526/patriotSubtitle.xml")); MediaContainer mediaContainer = serializer.read(MediaContainer.class, data, false); LayoutInflater layoutInflator = movieBrowserActivity.getLayoutInflater(); View view = layoutInflator.inflate(R.layout.poster_indicator_view, null); GridSubtitleVolleyResponseListener gridSubtitleResponseListener = new GridSubtitleVolleyResponseListener(video, movieBrowserActivity, view); gridSubtitleResponseListener.onResponse(mediaContainer); assertThat(video.getAvailableSubtitles()).isNotEmpty(); }
48. TracksAdapter#getView()
Project: serenity-android
File: TracksAdapter.java
File: TracksAdapter.java
@Override public View getView(int position, View convertView, ViewGroup parent) { LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View rowView = inflater.inflate(R.layout.track_listview_layout, parent, false); rowView.setBackgroundResource(R.drawable.album_list_view_selector); TextView textView = (TextView) rowView.findViewById(R.id.trackTitle); TextView durationView = (TextView) rowView.findViewById(R.id.trackDuration); ImageView imageView = (ImageView) rowView.findViewById(R.id.trackPlayed); imageView.setImageResource(R.drawable.unwatched_small); textView.setText(getItem(position).getTitle()); durationView.setText(DateUtils.formatElapsedTime(getItem(position).getDuration() / 1000)); return rowView; }
49. HomeScreenActivity#displayPopupWindow()
Project: selendroid
File: HomeScreenActivity.java
File: HomeScreenActivity.java
public void displayPopupWindow(View view) { LayoutInflater layoutInflater = (LayoutInflater) getBaseContext().getSystemService(LAYOUT_INFLATER_SERVICE); View popupView = layoutInflater.inflate(io.selendroid.testapp.R.layout.popup_window, null); final PopupWindow popupWindow = new PopupWindow(popupView, LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); Button btnDismiss = (Button) popupView.findViewById(io.selendroid.testapp.R.id.popup_dismiss_button); btnDismiss.setOnClickListener(new Button.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub popupWindow.dismiss(); } }); Button btnOpenPopup = (Button) findViewById(io.selendroid.testapp.R.id.showPopupWindowButton); popupWindow.showAsDropDown(btnOpenPopup, -50, -300); }
50. SearchableSpinner#createDialog()
Project: SearchableSpinner
File: SearchableSpinner.java
File: SearchableSpinner.java
private AlertDialog createDialog(Context context) { AlertDialog.Builder builder = new AlertDialog.Builder(context); LayoutInflater inflater = LayoutInflater.from(context); View view = inflater.inflate(R.layout.dialog_dropdown, null); EditText filter = (EditText) view.findViewById(R.id.filter); filter.setHint("?? search"); filter.addTextChangedListener(this); mRecycler = (RecyclerDropdown) view.findViewById(R.id.list); mRecycler.setOnClickListener(this); mRecycler.setDropdownList(mList); mRecycler.scrollToPosition(mList.length / 2); builder.setView(view); return builder.create(); }
51. SearchBarTest#testChinese()
Project: screenshot-tests-for-android
File: SearchBarTest.java
File: SearchBarTest.java
public void testChinese() throws Throwable { LayoutInflater inflater = LayoutInflater.from(getInstrumentation().getTargetContext()); View view = inflater.inflate(R.layout.search_bar, null, false); TextView tv = (TextView) view.findViewById(R.id.search_box); TextView btn = (TextView) view.findViewById(R.id.button); tv.setHint("????"); btn.setText("?"); ViewHelpers.setupView(view).setExactWidthDp(300).layout(); Screenshot.snap(view).record(); }
52. SearchBarTest#testLongText()
Project: screenshot-tests-for-android
File: SearchBarTest.java
File: SearchBarTest.java
public void testLongText() throws Throwable { LayoutInflater inflater = LayoutInflater.from(getInstrumentation().getTargetContext()); View view = inflater.inflate(R.layout.search_bar, null, false); TextView tv = (TextView) view.findViewById(R.id.search_box); tv.setText("This is a really long text and should overflow"); ViewHelpers.setupView(view).setExactWidthDp(300).layout(); Screenshot.snap(view).record(); }
53. ChangelogDialog#onCreateDialog()
Project: scdl
File: ChangelogDialog.java
File: ChangelogDialog.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { final Activity activity = getActivity(); if (activity == null) { Ln.w("Cannot create dialog, activity is null."); return super.onCreateDialog(savedInstanceState); } final LayoutInflater layoutInflater = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE); final ChangeLogListView changelogView = (ChangeLogListView) layoutInflater.inflate(R.layout.changelog_view, null); return new AlertDialog.Builder(activity).setTitle(R.string.changelog_full_title).setView(changelogView).setPositiveButton(R.string.changelog_ok_button, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }).create(); }
54. TelescopeAppContainer#showTelescopeDialog()
Project: sbt-android
File: TelescopeAppContainer.java
File: TelescopeAppContainer.java
public void showTelescopeDialog(final Activity activity) { LayoutInflater inflater = LayoutInflater.from(activity); TelescopeLayout content = (TelescopeLayout) inflater.inflate(R.layout.telescope_tutorial_dialog, null); final AlertDialog dialog = new AlertDialog.Builder(activity).setView(content).setCancelable(false).create(); content.setLens(new Lens() { @Override public void onCapture(File file) { dialog.dismiss(); Context toastContext = new ContextThemeWrapper(activity, android.R.style.Theme_DeviceDefault_Dialog); LayoutInflater toastInflater = LayoutInflater.from(toastContext); Toast toast = Toast.makeText(toastContext, "", Toast.LENGTH_SHORT); View toastView = toastInflater.inflate(R.layout.telescope_tutorial_toast, null); toast.setView(toastView); toast.setGravity(Gravity.CENTER, 0, 0); toast.show(); } }); dialog.show(); }
55. MainLayout#whatsNew()
Project: runnerup
File: MainLayout.java
File: MainLayout.java
public void whatsNew() { AlertDialog.Builder builder = new AlertDialog.Builder(this); LayoutInflater inflater = (LayoutInflater) getSystemService(Service.LAYOUT_INFLATER_SERVICE); View view = inflater.inflate(R.layout.whatsnew, null); WebView wv = (WebView) view.findViewById(R.id.web_view1); builder.setTitle(getString(R.string.Whats_new)); builder.setView(view); builder.setPositiveButton(getString(R.string.Rate_RunnerUp), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { onRateClick.onClick(null); } }); builder.setNegativeButton(getString(R.string.Dismiss), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); builder.show(); wv.loadUrl("file:///android_asset/changes.html"); }
56. LicenseAgreementDialogFragment#onCreateDialog()
Project: rucksack
File: LicenseAgreementDialogFragment.java
File: LicenseAgreementDialogFragment.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); // Get the layout inflater LayoutInflater inflater = getActivity().getLayoutInflater(); // Inflate and set the layout for the dialog // Pass null as the parent view because its going in the dialog layout View v = inflater.inflate(R.layout.dialog_license, null); ButterKnife.bind(this, v); Injector.INSTANCE.getApplicationComponent().inject(this); builder.setView(v); // licenseDescription.setLinksClickable(true); licenseDescription.setMovementMethod(LinkMovementMethod.getInstance()); agreeButton.setOnClickListener( clickedView -> { prefs.setAgreedToLicense(true); dismiss(); }); return builder.create(); }
57. AboutDialogFragment#onCreateDialog()
Project: rucksack
File: AboutDialogFragment.java
File: AboutDialogFragment.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); // Get the layout inflater LayoutInflater inflater = getActivity().getLayoutInflater(); // Inflate and set the layout for the dialog // Pass null as the parent view because its going in the dialog layout View v = inflater.inflate(R.layout.dialog_about, null); ButterKnife.bind(this, v); TextView versionView = (TextView) v.findViewById(R.id.rucksackVersion); String textualVersion = getString(R.string.app_version, BuildConfig.VERSION_NAME); versionView.setText(textualVersion); builder.setView(v); return builder.create(); }
58. Corner#createAndAttachView()
Project: Roundr
File: Corner.java
File: Corner.java
@Override public void createAndAttachView(int corner, FrameLayout frame) { // Set the image based on window corner LayoutInflater inflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE); ImageView v = (ImageView) inflater.inflate(R.layout.corner, frame, true).findViewById(R.id.iv); // Top left by default v.setImageDrawable(getResources().getDrawable(R.drawable.topleft)); switch(corner) { case 1: v.setImageDrawable(getResources().getDrawable(R.drawable.topright)); break; case 2: v.setImageDrawable(getResources().getDrawable(R.drawable.bottomleft)); break; case 3: v.setImageDrawable(getResources().getDrawable(R.drawable.bottomright)); break; } }
59. DeviceInfoAdapter#getView()
Project: RoMote
File: DeviceInfoAdapter.java
File: DeviceInfoAdapter.java
@Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder holder = null; LayoutInflater mInflater = (LayoutInflater) mContext.getSystemService(Activity.LAYOUT_INFLATER_SERVICE); if (convertView == null) { convertView = mInflater.inflate(android.R.layout.simple_list_item_2, null); holder = new ViewHolder(); holder.mText1 = (TextView) convertView.findViewById(android.R.id.text1); holder.mText2 = (TextView) convertView.findViewById(android.R.id.text2); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } Entry entry = (Entry) getItem(position); holder.mText1.setText(entry.getKey() + ":"); holder.mText2.setText(entry.getValue()); return convertView; }
60. RobotoCalendarView#onCreateView()
Project: RobotoCalendarView
File: RobotoCalendarView.java
File: RobotoCalendarView.java
public View onCreateView() { LayoutInflater inflate = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); view = inflate.inflate(R.layout.roboto_calendar_picker_layout, this, true); findViewsById(view); initializeEventListeners(); initializeComponentBehavior(); CalligraphyConfig.initDefault(new CalligraphyConfig.Builder().setDefaultFontPath("fonts/Roboto-Regular.ttf").setFontAttrId(R.attr.fontPath).build()); return view; }
61. MainActivity#showImage()
Project: RestVolley
File: MainActivity.java
File: MainActivity.java
public ImageView showImage(Bitmap bitmap) { LayoutInflater layoutInflater = LayoutInflater.from(this); View dialogView = layoutInflater.inflate(R.layout.dialog_image_layout, null); ImageView imageView = (ImageView) dialogView.findViewById(R.id.dialog_image); if (bitmap != null) { imageView.setImageBitmap(bitmap); } new AlertDialog.Builder(this).setView(dialogView).setNegativeButton("??", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }).setPositiveButton("??", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }).create().show(); return imageView; }
62. AddSubscriptionDialogFragment#onCreateDialog()
Project: reader
File: AddSubscriptionDialogFragment.java
File: AddSubscriptionDialogFragment.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { super.onCreateDialog(savedInstanceState); // Use the Builder class for convenient dialog construction AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); // Inflate the dialog view LayoutInflater inflater = getActivity().getLayoutInflater(); final View view = inflater.inflate(R.layout.add_subscription_dialog_fragment, null); // Create the dialog without button click listeners builder.setTitle(R.string.add_subscription).setView(view).setPositiveButton(R.string.add, null).setNegativeButton(R.string.cancel, null); // Create the AlertDialog object and return it return builder.create(); }
63. BaseLogginedUserActivity#initActionBarWithTimer()
Project: quickblox-android-sdk
File: BaseLogginedUserActivity.java
File: BaseLogginedUserActivity.java
public void initActionBarWithTimer() { mActionBar = getActionBar(); mActionBar.setDisplayShowHomeEnabled(false); mActionBar.setDisplayShowTitleEnabled(false); LayoutInflater mInflater = LayoutInflater.from(this); View mCustomView = mInflater.inflate(R.layout.actionbar_with_timer, null); timerABWithTimer = (Chronometer) mCustomView.findViewById(R.id.timerABWithTimer); TextView loginAsABWithTimer = (TextView) mCustomView.findViewById(R.id.loginAsABWithTimer); loginAsABWithTimer.setText(R.string.logged_in_as); TextView userNameAB = (TextView) mCustomView.findViewById(R.id.userNameABWithTimer); QBUser user = DataHolder.getLoggedUser(); if (user != null) { userNameAB.setText(user.getFullName()); } mActionBar.setCustomView(mCustomView); mActionBar.setDisplayShowCustomEnabled(true); }
64. QrCodeFinderView#init()
Project: QrCodeScanner
File: QrCodeFinderView.java
File: QrCodeFinderView.java
private void init(Context context) { if (isInEditMode()) { return; } // ?????????????onDraw?? setWillNotDraw(false); LayoutInflater inflater = LayoutInflater.from(context); RelativeLayout relativeLayout = (RelativeLayout) inflater.inflate(R.layout.layout_qr_code_scanner, this); FrameLayout frameLayout = (FrameLayout) relativeLayout.findViewById(R.id.qr_code_fl_scanner); mFrameRect = new Rect(); RelativeLayout.LayoutParams layoutParams = (LayoutParams) frameLayout.getLayoutParams(); mFrameRect.left = (ScreenUtils.getScreenWidth(context) - layoutParams.width) / 2; mFrameRect.top = layoutParams.topMargin; mFrameRect.right = mFrameRect.left + layoutParams.width; mFrameRect.bottom = mFrameRect.top + layoutParams.height; }
65. MessageListAdapter#onCreateViewHolder()
Project: qksms
File: MessageListAdapter.java
File: MessageListAdapter.java
@Override public MessageListViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { LayoutInflater inflater = LayoutInflater.from(mContext); int resource; boolean sent; if (viewType == INCOMING_ITEM) { resource = R.layout.list_item_message_in; sent = false; } else { resource = R.layout.list_item_message_out; sent = true; } View view = inflater.inflate(resource, parent, false); return setupViewHolder(view, sent); }
66. ConversationListAdapter#onCreateViewHolder()
Project: qksms
File: ConversationListAdapter.java
File: ConversationListAdapter.java
@Override public ConversationListViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { LayoutInflater inflater = LayoutInflater.from(mContext); View view = inflater.inflate(R.layout.list_item_conversation, null); ConversationListViewHolder holder = new ConversationListViewHolder(mContext, view); holder.mutedView.setImageResource(R.drawable.ic_notifications_muted); holder.unreadView.setImageResource(R.drawable.ic_unread_indicator); holder.errorIndicator.setImageResource(R.drawable.ic_error); LiveViewManager.registerView(QKPreference.THEME, this, key -> { holder.mutedView.setColorFilter(ThemeManager.getColor()); holder.unreadView.setColorFilter(ThemeManager.getColor()); holder.errorIndicator.setColorFilter(ThemeManager.getColor()); }); return holder; }
67. ArticleAboutFragment#onDataSetChanged()
Project: Qiitanium
File: ArticleAboutFragment.java
File: ArticleAboutFragment.java
@Override public void onDataSetChanged(RxReadOnlyList.Event event) { LayoutInflater inflater = LayoutInflater.from(getContext()); for (int i = 0, size = tagList.size(); i < size; i++) { TagListItemView itemView = Objects.cast(inflater.inflate(R.layout.list_item_tag, listView, false)); itemView.bindTo(tagList.get(i)); listView.addHeaderView(itemView); } View commentHeader = inflater.inflate(R.layout.list_item_comment_header, listView, false); TypefaceHelper.typeface(commentHeader); listView.addHeaderView(commentHeader, null, false); }
68. PullToRefreshLayout#initView()
Project: PullToRefresh
File: PullToRefreshLayout.java
File: PullToRefreshLayout.java
private void initView(Context context, AttributeSet attrs, int defStyle) { updateHandler = new UpdateHandler(this); timer = new MyTimer(updateHandler); reverseUpAnimation = (RotateAnimation) AnimationUtils.loadAnimation(context, R.anim.reverse_up_anim); reverseDownAnimation = (RotateAnimation) AnimationUtils.loadAnimation(context, R.anim.reverse_down_anim); refreshingAnimation = (RotateAnimation) AnimationUtils.loadAnimation(context, R.anim.rotating_anim); // ???????? LinearInterpolator lir = new LinearInterpolator(); reverseUpAnimation.setInterpolator(lir); refreshingAnimation.setInterpolator(lir); // ????????? LayoutInflater inflater = LayoutInflater.from(context); defaultRefreshView = inflater.inflate(R.layout.refresh_head, this, false); refreshView = defaultRefreshView; defaultLoadmoreView = inflater.inflate(R.layout.load_more, this, false); loadmoreView = defaultLoadmoreView; addView(defaultRefreshView); addView(defaultLoadmoreView); }
69. MyScheduleActivity#setTabLayoutContentDescriptions()
Project: iosched
File: MyScheduleActivity.java
File: MyScheduleActivity.java
private void setTabLayoutContentDescriptions() { LayoutInflater inflater = getLayoutInflater(); int gap = mDayZeroAdapter == null ? 0 : 1; for (int i = 0, count = mTabLayout.getTabCount(); i < count; i++) { TabLayout.Tab tab = mTabLayout.getTabAt(i); TextView view = (TextView) inflater.inflate(R.layout.tab_my_schedule, mTabLayout, false); view.setId(baseTabViewId + i); view.setText(tab.getText()); if (i == 0) { view.setContentDescription(getString(R.string.talkback_selected, getString(R.string.a11y_button, tab.getText()))); } else { view.setContentDescription(getString(R.string.a11y_button, tab.getText())); } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { view.announceForAccessibility(getString(R.string.my_schedule_tab_desc_a11y, getDayName(i - gap))); } tab.setCustomView(view); } }
70. AnnouncementFragment#showAnnouncementDetail()
Project: incubator-taverna-mobile
File: AnnouncementFragment.java
File: AnnouncementFragment.java
@Override public void showAnnouncementDetail(DetailAnnouncement detailAnnouncement) { mAnnouncementDetail = detailAnnouncement; AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(getContext()); LayoutInflater inflater = getActivity().getLayoutInflater(); View dialogView = inflater.inflate(R.layout.detail_annoucement_dialog_layout, null); dialogBuilder.setView(dialogView); TextView title = ButterKnife.findById(dialogView, R.id.tvDialogTitle); TextView date = ButterKnife.findById(dialogView, R.id.tvDialogDate); TextView author = ButterKnife.findById(dialogView, R.id.tvDialogAuthor); WebView text = ButterKnife.findById(dialogView, R.id.wvDialogText); Button buttonOk = ButterKnife.findById(dialogView, R.id.bDialogOK); buttonOk.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { alertDialog.dismiss(); } }); text.loadDataWithBaseURL("", mAnnouncementDetail.getText(), "text/html", "utf-8", ""); date.setText(mAnnouncementDetail.getDate()); title.setText(mAnnouncementDetail.getTitle()); author.setText(mAnnouncementDetail.getAuthor().getContent()); alertDialog = dialogBuilder.create(); alertDialog.show(); }
71. FullScreenImageGalleryAdapter#instantiateItem()
Project: ImageGallery
File: FullScreenImageGalleryAdapter.java
File: FullScreenImageGalleryAdapter.java
// endregion @Override public Object instantiateItem(ViewGroup container, int position) { LayoutInflater inflater = (LayoutInflater) container.getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); View view = inflater.inflate(R.layout.fullscreen_image, null); ImageView imageView = (ImageView) view.findViewById(R.id.iv); final LinearLayout linearLayout = (LinearLayout) view.findViewById(R.id.ll); String image = images.get(position); Context context = imageView.getContext(); int width = ImageGalleryUtils.getScreenWidth(context); fullScreenImageLoader.loadFullScreenImage(imageView, image, width, linearLayout); container.addView(view, 0); return view; }
72. HollyViewPagerAnimator#fillHeader()
Project: HollyViewPager
File: HollyViewPagerAnimator.java
File: HollyViewPagerAnimator.java
protected void fillHeader(PagerAdapter adapter) { hvp.headerLayout.removeAllViews(); LayoutInflater layoutInflater = LayoutInflater.from(hvp.getContext()); for (int i = 0; i < adapter.getCount(); ++i) { View view = layoutInflater.inflate(R.layout.hvp_header_card, hvp.headerLayout, false); hvp.headerLayout.addView(view); HeaderHolder headerHolder = new HeaderHolder(view); hvp.headerHolders.add(headerHolder); headerHolder.setTitle(adapter.getPageTitle(i)); headerHolder.setHeightPercent(hvp.configurator.getHeightPercentForPage(i)); headerHolder.setEnabled(i == 0); final int position = i; view.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { onHeaderClick(position); } }); } }
73. DialogBuilder#createSkeleton()
Project: HeadsUp
File: DialogBuilder.java
File: DialogBuilder.java
private View createSkeleton() { LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); LinearLayout rootLayout = (LinearLayout) inflater.inflate(R.layout.dialog_main_skeleton, new FrameLayout(mContext), false); TextView titleView = (TextView) rootLayout.findViewById(R.id.title); if (Device.hasLollipopApi()) { // The dividers are quite ugly with material design. rootLayout.setShowDividers(LinearLayout.SHOW_DIVIDER_NONE); } if (mTitleText == null && mIcon == null) { rootLayout.removeView(titleView); } else { if (mTitleText != null) titleView.setText(mTitleText); if (mIcon != null) titleView.setCompoundDrawablesWithIntrinsicBounds(mIcon, null, null, null); } return rootLayout; }
74. TasksFragment#refresh()
Project: habitrpg-android
File: TasksFragment.java
File: TasksFragment.java
public void refresh() { /* Attach a rotating ImageView to the refresh item as an ActionView */ LayoutInflater inflater = (LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE); ImageView iv = (ImageView) inflater.inflate(R.layout.refresh_actionview, null); Animation rotation = AnimationUtils.loadAnimation(getActivity(), R.anim.clockwise_rotate); rotation.setRepeatCount(Animation.INFINITE); iv.startAnimation(rotation); refreshItem.setActionView(iv); if (apiHelper != null) { apiHelper.retrieveUser(true).compose(apiHelper.configureApiCallObserver()).subscribe(new HabitRPGUserCallback(activity), throwable -> stopAnimatingRefreshItem()); } }
75. GuildsOverviewFragment#setGuildsOnListView()
Project: habitrpg-android
File: GuildsOverviewFragment.java
File: GuildsOverviewFragment.java
private void setGuildsOnListView() { if (this.guildsListView == null) { return; } this.guildIDs = new ArrayList<>(); this.guildsListView.removeAllViewsInLayout(); LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); for (Group guild : this.guilds) { TextView entry = (TextView) inflater.inflate(R.layout.plain_list_item, this.guildsListView, false); entry.setText(guild.name); entry.setOnClickListener(this); this.guildsListView.addView(entry); this.guildIDs.add(guild.id); } }
76. QuickActionBar#populateQuickActions()
Project: GreenDroid
File: QuickActionBar.java
File: QuickActionBar.java
@Override protected void populateQuickActions(List<QuickAction> quickActions) { mQuickActions = quickActions; final LayoutInflater inflater = LayoutInflater.from(getContext()); for (QuickAction action : quickActions) { TextView view = (TextView) inflater.inflate(R.layout.gd_quick_action_bar_item, mQuickActionItems, false); view.setText(action.mTitle); view.setCompoundDrawablesWithIntrinsicBounds(null, action.mDrawable, null, null); view.setOnClickListener(mClickHandlerInternal); mQuickActionItems.addView(view); action.mView = new WeakReference<View>(view); } }
77. ExpandableListAdapter#getGroupView()
Project: gpslogger
File: ExpandableListAdapter.java
File: ExpandableListAdapter.java
@Override public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) { String headerTitle = (String) getGroup(groupPosition); LayoutInflater infalInflater = (LayoutInflater) this._context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); convertView = infalInflater.inflate(R.layout.activity_faq_list_group, null); TextView lblListHeader = (TextView) convertView.findViewById(R.id.lblListHeader); lblListHeader.setTypeface(null, Typeface.BOLD); lblListHeader.setText(headerTitle); return convertView; }
78. ExpandableListAdapter#getChildView()
Project: gpslogger
File: ExpandableListAdapter.java
File: ExpandableListAdapter.java
@Override public View getChildView(int groupPosition, final int childPosition, boolean isLastChild, View convertView, ViewGroup parent) { final String childText = (String) getChild(groupPosition, childPosition); LayoutInflater infalInflater = (LayoutInflater) this._context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); convertView = infalInflater.inflate(R.layout.activity_faq_list_item, null); // sample code snippet to set the text content on the ExpandableTextView final ExpandableTextView expTv1 = (ExpandableTextView) convertView.findViewById(R.id.expand_text_view); expTv1.setText(Html.fromHtml(childText)); TextView tv = (TextView) expTv1.findViewById(R.id.expandable_text); tv.setMovementMethod(LinkMovementMethod.getInstance()); return convertView; }
79. VideoSurfaceLayer#createView()
Project: google-media-framework-android
File: VideoSurfaceLayer.java
File: VideoSurfaceLayer.java
@Override public FrameLayout createView(LayerManager layerManager) { this.layerManager = layerManager; LayoutInflater inflater = layerManager.getActivity().getLayoutInflater(); view = (FrameLayout) inflater.inflate(R.layout.video_surface_layer, null); layerManager.getExoplayerWrapper().addListener(playbackListener); surfaceView = (VideoSurfaceView) view.findViewById(R.id.surface_view); if (surfaceView != null) { SurfaceHolder holder = surfaceView.getHolder(); holder.addCallback(surfaceHolderCallback); } return view; }
80. CustomListView#hideActionBar()
Project: GmailLikePullToRefresh
File: CustomListView.java
File: CustomListView.java
private void hideActionBar() { LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View overlay = inflater.inflate(R.layout.overlay_actionbar, null); android.app.ActionBar.LayoutParams layout = new android.app.ActionBar.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); TextView swipeToRefreshText = (TextView) overlay.findViewById(R.id.swipeToRefreshText_gmaillikepulltorefresh); Animation translate = AnimationUtils.loadAnimation(context.getApplicationContext(), R.anim.slide_in_from_top); translate.setDuration(100); translate.setFillAfter(true); swipeToRefreshText.setAnimation(translate); component.actionBarView.setCustomView(overlay, layout); component.actionBarView.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM); }
81. SampleForGmailLikePullToRefresh#onCreate()
Project: GmailLikePullToRefresh
File: SampleForGmailLikePullToRefresh.java
File: SampleForGmailLikePullToRefresh.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); actionBar = getActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setTitle("WOW"); view = new CustomView(getApplicationContext(), actionBar); setContentView(view); view.setRefreshListner(SampleForGmailLikePullToRefresh.this); view.setActionBar(SampleForGmailLikePullToRefresh.this); mListView = view.getListView(); list = new ArrayList<Integer>(); adapter = new DummyAdapter(SampleForGmailLikePullToRefresh.this, 0, list); LayoutInflater layoutInflater = (LayoutInflater) SampleForGmailLikePullToRefresh.this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View loadingView = layoutInflater.inflate(R.layout.view_listview_loading, null); RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT); params.setMargins(0, 5, 0, 0); loadingView.setLayoutParams(params); mListView.setEmptyView(null); }
82. CustomListView#hideActionBar()
Project: GmailLikePullToRefresh
File: CustomListView.java
File: CustomListView.java
private void hideActionBar() { LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View overlay = inflater.inflate(R.layout.overlay_actionbar, null); android.app.ActionBar.LayoutParams layout = new android.app.ActionBar.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); TextView swipeToRefreshText = (TextView) overlay.findViewById(R.id.swipeToRefreshText_gmaillikepulltorefresh); Animation translate = AnimationUtils.loadAnimation(context.getApplicationContext(), R.anim.slide_in_from_top); translate.setDuration(100); translate.setFillAfter(true); swipeToRefreshText.setAnimation(translate); component.actionBarView.setCustomView(overlay, layout); component.actionBarView.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM); }
83. CustomListView#hideActionBar()
Project: GmailLikePullToRefresh
File: CustomListView.java
File: CustomListView.java
private void hideActionBar() { LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View overlay = inflater.inflate(R.layout.overlay_actionbar, null); android.app.ActionBar.LayoutParams layout = new android.app.ActionBar.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); TextView swipeToRefreshText = (TextView) overlay.findViewById(R.id.swipeToRefreshText_gmaillikepulltorefresh); Animation translate = AnimationUtils.loadAnimation(context.getApplicationContext(), R.anim.slide_in_from_top); translate.setDuration(100); translate.setFillAfter(true); swipeToRefreshText.setAnimation(translate); component.actionBarView.setCustomView(overlay, layout); component.actionBarView.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM); }
84. UserFragment#fillOrganizations()
Project: gh4a
File: UserFragment.java
File: UserFragment.java
public void fillOrganizations(List<User> organizations) { ViewGroup llOrgs = (ViewGroup) mContentView.findViewById(R.id.ll_orgs); LinearLayout llOrg = (LinearLayout) mContentView.findViewById(R.id.ll_org); int count = organizations != null ? organizations.size() : 0; LayoutInflater inflater = getLayoutInflater(null); llOrg.removeAllViews(); llOrgs.setVisibility(count > 0 ? View.VISIBLE : View.GONE); for (int i = 0; i < count; i++) { User org = organizations.get(i); View rowView = inflater.inflate(R.layout.selectable_label_with_avatar, llOrg, false); rowView.setOnClickListener(this); rowView.setTag(org); ImageView avatar = (ImageView) rowView.findViewById(R.id.iv_gravatar); AvatarHandler.assignAvatar(avatar, org); TextView nameView = (TextView) rowView.findViewById(R.id.tv_title); nameView.setText(org.getLogin()); llOrg.addView(rowView); } }
85. PagedDataBaseFragment#onViewCreated()
Project: gh4a
File: PagedDataBaseFragment.java
File: PagedDataBaseFragment.java
@Override public void onViewCreated(View view, Bundle savedInstanceState) { mAdapter = onCreateAdapter(); super.onViewCreated(view, savedInstanceState); RecyclerView recyclerView = getRecyclerView(); LayoutInflater inflater = getLayoutInflater(savedInstanceState); View loadingContainer = inflater.inflate(R.layout.list_loading_view, recyclerView, false); mLoadingView = loadingContainer.findViewById(R.id.loading); mLoadingView.setVisibility(View.GONE); mAdapter.setFooterView(loadingContainer, this); mAdapter.setOnItemClickListener(this); if (!mAdapter.isCardStyle()) { recyclerView.setBackgroundResource(UiUtils.resolveDrawable(getActivity(), R.attr.listBackground)); } recyclerView.setAdapter(mAdapter); updateEmptyState(); }
86. BookmarkAdapter#newView()
Project: gh4a
File: BookmarkAdapter.java
File: BookmarkAdapter.java
@Override public View newView(Context context, Cursor cursor, ViewGroup parent) { LayoutInflater inflater = LayoutInflater.from(context); View view = inflater.inflate(R.layout.row_bookmark, parent, false); ViewHolder holder = new ViewHolder(); holder.icon = (ImageView) view.findViewById(R.id.iv_icon); holder.title = (TextView) view.findViewById(R.id.tv_title); holder.extra = (TextView) view.findViewById(R.id.tv_extra); view.setTag(holder); return view; }
87. PullRequestActivity#onCreate()
Project: gh4a
File: PullRequestActivity.java
File: PullRequestActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); LayoutInflater inflater = getLayoutInflater(); mHeader = (ViewGroup) inflater.inflate(R.layout.issue_header, null); mHeader.setClickable(false); mHeader.setVisibility(View.GONE); addHeaderView(mHeader, true); ActionBar actionBar = getSupportActionBar(); actionBar.setTitle(getResources().getString(R.string.pull_request_title) + " #" + mPullRequestNumber); actionBar.setSubtitle(mRepoOwner + "/" + mRepoName); actionBar.setDisplayHomeAsUpEnabled(true); setContentShown(false); getSupportLoaderManager().initLoader(0, null, mPullRequestCallback); getSupportLoaderManager().initLoader(1, null, mIssueCallback); getSupportLoaderManager().initLoader(2, null, mCollaboratorCallback); }
88. Github4AndroidActivity#open2FADialog()
Project: gh4a
File: Github4AndroidActivity.java
File: Github4AndroidActivity.java
private void open2FADialog(final String username, final String password) { LayoutInflater inflater = LayoutInflater.from(Github4AndroidActivity.this); View authDialog = inflater.inflate(R.layout.twofactor_auth_dialog, null); final EditText authCode = (EditText) authDialog.findViewById(R.id.auth_code); new AlertDialog.Builder(this).setCancelable(false).setTitle(R.string.two_factor_auth).setView(authDialog).setPositiveButton(R.string.verify, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { LoginTask task = new LoginTask(username, password, authCode.getText().toString()); task.schedule(); } }).setNegativeButton(R.string.cancel, null).show(); }
89. TransfersFragment#getHeader()
Project: frostwire-android
File: TransfersFragment.java
File: TransfersFragment.java
@Override public View getHeader(Activity activity) { LayoutInflater inflater = LayoutInflater.from(activity); View header = inflater.inflate(R.layout.view_transfers_header, null); TextView text = (TextView) header.findViewById(R.id.view_transfers_header_text_title); text.setText(R.string.transfers); ImageButton buttonMenu = (ImageButton) header.findViewById(R.id.view_transfers_header_button_menu); buttonMenu.setOnClickListener(buttonMenuListener); ImageButton buttonAddTransfer = (ImageButton) header.findViewById(R.id.view_transfers_header_button_add_transfer); buttonAddTransfer.setOnClickListener(buttonAddTransferListener); return header; }
90. AppMsg#makeText()
Project: frostwire-android
File: AppMsg.java
File: AppMsg.java
/** * Make a {@link AppMsg} that just contains a text view. * * @param context * The context to use. Usually your * {@link android.app.Activity} object. * @param text * The text to show. Can be formatted text. */ public static AppMsg makeText(Context context, CharSequence text, Style style) { AppMsg result = new AppMsg(context); LayoutInflater inflate = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View v = inflate.inflate(R.layout.app_msg, null); v.setBackgroundResource(style.background); TextView tv = (TextView) v.findViewById(android.R.id.message); tv.setText(text); result.mView = v; result.mDuration = style.duration; return result; }
91. CustomMovieToImageAdapter#getView()
Project: friendly-giggle
File: CustomMovieToImageAdapter.java
File: CustomMovieToImageAdapter.java
@Override public View getView(int position, View convertView, ViewGroup parent) { //Log.i(LOG_TAG, "Will load: " + getItem(position)); ImageView posterView = (ImageView) convertView; LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); if (convertView == null) { posterView = (ImageView) inflater.inflate(imageLayoutResource, null); } String posterPath = getItem(position).getPosterPath(); //Log.i(LOG_TAG, "Building poster url on: " + posterPath); posterAdder(context, posterPath, posterView); return posterView; }
92. SimpleFragment#onViewCreated()
Project: FlowLayout
File: SimpleFragment.java
File: SimpleFragment.java
@Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { final LayoutInflater mInflater = LayoutInflater.from(getActivity()); mFlowLayout = (TagFlowLayout) view.findViewById(R.id.id_flowlayout); mFlowLayout.setAdapter(new TagAdapter<String>(mVals) { @Override public View getView(FlowLayout parent, int position, String s) { TextView tv = (TextView) mInflater.inflate(R.layout.tv, mFlowLayout, false); tv.setText(s); return tv; } }); }
93. LimitSelectedFragment#onViewCreated()
Project: FlowLayout
File: LimitSelectedFragment.java
File: LimitSelectedFragment.java
@Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { final LayoutInflater mInflater = LayoutInflater.from(getActivity()); mFlowLayout = (TagFlowLayout) view.findViewById(R.id.id_flowlayout); mFlowLayout.setMaxSelectCount(3); mFlowLayout.setAdapter(new TagAdapter<String>(mVals) { @Override public View getView(FlowLayout parent, int position, String s) { TextView tv = (TextView) mInflater.inflate(R.layout.tv, mFlowLayout, false); tv.setText(s); return tv; } }); }
94. MonthViewPagerAdapter#instantiateItem()
Project: FlexibleCalendar
File: MonthViewPagerAdapter.java
File: MonthViewPagerAdapter.java
@Override public Object instantiateItem(ViewGroup container, int position) { LayoutInflater inflater = LayoutInflater.from(context); LinearLayout layout = new LinearLayout(context); layout.setOrientation(LinearLayout.VERTICAL); layout.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)); FlexibleCalendarGridAdapter adapter = dateAdapters.get(position); adapter.setOnDateClickListener(onDateCellItemClickListener); adapter.setMonthEventFetcher(monthEventFetcher); adapter.setCellViewDrawer(cellViewDrawer); GridView view = (GridView) inflater.inflate(R.layout.month_grid_layout, null); view.setTag(GRID_TAG_PREFIX + position); view.setAdapter(adapter); view.setVerticalSpacing(gridViewVerticalSpacing); view.setHorizontalSpacing(gridViewHorizontalSpacing); layout.addView(view); container.addView(layout); return layout; }
95. SingleCompressDialog#onCreateDialog()
Project: filemanager
File: SingleCompressDialog.java
File: SingleCompressDialog.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { LayoutInflater inflater = LayoutInflater.from(getActivity()); LinearLayout view = (LinearLayout) inflater.inflate(R.layout.dialog_text_input, null); final EditText v = (EditText) view.findViewById(R.id.foldername); v.setHint(R.string.compressed_file_name); v.setOnEditorActionListener(new TextView.OnEditorActionListener() { public boolean onEditorAction(TextView text, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_GO) compress(v.getText().toString()); dismiss(); return true; } }); return new AlertDialog.Builder(getActivity()).setTitle(R.string.menu_compress).setView(view).setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { compress(v.getText().toString()); } }).setNegativeButton(android.R.string.cancel, null).create(); }
96. MultiCompressDialog#onCreateDialog()
Project: filemanager
File: MultiCompressDialog.java
File: MultiCompressDialog.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { LayoutInflater inflater = LayoutInflater.from(getActivity()); LinearLayout view = (LinearLayout) inflater.inflate(R.layout.dialog_text_input, null); final EditText v = (EditText) view.findViewById(R.id.foldername); v.setHint(R.string.compressed_file_name); v.setOnEditorActionListener(new TextView.OnEditorActionListener() { public boolean onEditorAction(TextView text, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_GO) compress(v.getText().toString()); dismiss(); return true; } }); return new AlertDialog.Builder(getActivity()).setTitle(R.string.menu_compress).setView(view).setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { compress(v.getText().toString()); } }).setNegativeButton(android.R.string.cancel, null).create(); }
97. AppMsg#makeText()
Project: fanfouapp-opensource
File: AppMsg.java
File: AppMsg.java
/** * Make a {@link AppMsg} that just contains a text view. * * @param context * The context to use. Usually your {@link android.app.Activity} * object. * @param text * The text to show. Can be formatted text. * @param duration * How long to display the message. Either {@link #LENGTH_SHORT} * or {@link #LENGTH_LONG} * */ public static AppMsg makeText(final Activity context, final CharSequence text, final Style style) { final AppMsg result = new AppMsg(context); final LayoutInflater inflate = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); final View v = inflate.inflate(R.layout.app_msg, null); v.setBackgroundResource(style.background); final TextView tv = (TextView) v.findViewById(android.R.id.message); tv.setText(text); result.mView = v; result.mDuration = style.duration; return result; }
98. HomePage#setListViews()
Project: fanfouapp-opensource
File: HomePage.java
File: HomePage.java
/** * ???????????ListView */ private void setListViews() { final LayoutInflater inflater = LayoutInflater.from(this); for (int i = 0; i < this.views.length; i++) { this.views[i] = (PullToRefreshListView) inflater.inflate(R.layout.ptr_list, null); this.views[i].setOnRefreshListener(this); this.listViews[i] = this.views[i].getRefreshableView(); this.listViews[i].setOnItemClickListener(this); if (i != 2) { this.listViews[i].setOnItemLongClickListener(this); } if (i == 3) { this.views[i].setMode(Mode.PULL_FROM_START); } } }
99. ExpandableSelector#initializeButton()
Project: ExpandableSelector
File: ExpandableSelector.java
File: ExpandableSelector.java
private View initializeButton(int expandableItemPosition) { ExpandableItem expandableItem = expandableItems.get(expandableItemPosition); View button = null; Context context = getContext(); LayoutInflater layoutInflater = LayoutInflater.from(context); if (expandableItem.hasTitle()) { button = layoutInflater.inflate(R.layout.expandable_item_button, this, false); } else { button = layoutInflater.inflate(R.layout.expandable_item_image_button, this, false); } int visibility = expandableItemPosition == 0 ? View.VISIBLE : View.INVISIBLE; button.setVisibility(visibility); return button; }
100. ToastUtils#toast()
Project: ExhibitionCenter
File: ToastUtils.java
File: ToastUtils.java
/** * ???? */ public static void toast(String msg) { int length = Toast.LENGTH_SHORT; if (msg.length() > 20) { length = Toast.LENGTH_LONG; } Context context = AppApplication.getAppContext(); LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); //????? View view = inflater.inflate(R.layout.toast_custom, null); //??????? TextView text = (TextView) view.findViewById(R.id.toast_message); text.setText(msg); mHandler.removeCallbacks(r); if (mToast == null) { //??mToast==null????????????????? mToast = new Toast(context); mToast.setDuration(length); mToast.setGravity(Gravity.BOTTOM, 0, 150); mToast.setView(view); } int times = msg.length() * 50; //????toast mHandler.postDelayed(r, times < 1500 ? 1500 : times); mToast.show(); }