List of usage examples for android.content Context LAYOUT_INFLATER_SERVICE
String LAYOUT_INFLATER_SERVICE
To view the source code for android.content Context LAYOUT_INFLATER_SERVICE.
Click Source Link
From source file:io.intue.kamu.BestNearbyFragment.java
@Override public View newCollectionItemView(Context context, int groupId, ViewGroup parent) { final LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); int layoutId; layoutId = (groupId == HERO_GROUP_ID) ? R.layout.list_item_session_hero : R.layout.list_item_session_summarized; return inflater.inflate(layoutId, parent, false); }
From source file:com.cw.litenote.config.Config.java
void selectStyleDialog(View view) { mContext = getActivity();//from ww w . j a v a 2 s . co m AlertDialog.Builder builder = new AlertDialog.Builder(mContext); builder.setTitle(R.string.config_set_style_title).setPositiveButton(R.string.btn_OK, listener_ok) .setNegativeButton(R.string.btn_Cancel, null); // inflate select style layout mInflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); view = mInflater.inflate(R.layout.select_style, null); RadioGroup RG_view = (RadioGroup) view.findViewById(R.id.radioGroup1); setButtonColor((RadioButton) RG_view.findViewById(R.id.radio0), 0); setButtonColor((RadioButton) RG_view.findViewById(R.id.radio1), 1); setButtonColor((RadioButton) RG_view.findViewById(R.id.radio2), 2); setButtonColor((RadioButton) RG_view.findViewById(R.id.radio3), 3); setButtonColor((RadioButton) RG_view.findViewById(R.id.radio4), 4); setButtonColor((RadioButton) RG_view.findViewById(R.id.radio5), 5); setButtonColor((RadioButton) RG_view.findViewById(R.id.radio6), 6); setButtonColor((RadioButton) RG_view.findViewById(R.id.radio7), 7); setButtonColor((RadioButton) RG_view.findViewById(R.id.radio8), 8); setButtonColor((RadioButton) RG_view.findViewById(R.id.radio9), 9); builder.setView(view); RadioGroup radioGroup = (RadioGroup) RG_view.findViewById(R.id.radioGroup1); radioGroup.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(RadioGroup RG, int id) { mStyle = RG.indexOfChild(RG.findViewById(id)); } }); dialog = builder.create(); dialog.show(); }
From source file:com.chalmers.feedlr.activity.FeedActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main_view_flipper); // get helpers from android system res = getResources();//from w w w .j a va2s . co m lbm = LocalBroadcastManager.getInstance(this); inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); // add intent filter to be used by broadcast reciever intentFilter = new IntentFilter(); intentFilter.addAction(TWITTER_USERS_UPDATED); intentFilter.addAction(TWITTER_USERS_PROBLEM_UPDATING); intentFilter.addAction(FACEBOOK_TIMELINE_UPDATED); intentFilter.addAction(FACEBOOK_USERS_UPDATED); intentFilter.addAction(FACEBOOK_USERS_PROBLEM_UPDATING); intentFilter.addAction(FACEBOOK_USER_NEWS_UPDATED); intentFilter.addAction(FEED_PROBLEM_UPDATING); // instanciate database helper db = new DatabaseHelper(this); // load typefaces from assets Typeface robotoMedium = Typeface.createFromAsset(getAssets(), "fonts/Roboto-Medium.ttf"); // find views inflated from xml mainViewFlipper = (ViewFlipper) findViewById(R.id.main_view_flipper); feedViewSwiper = (ViewPager) findViewById(R.id.feed_view_pager); settingsViewFlipper = (ViewAnimator) findViewById(R.id.settings_view_flipper); facebookAuthButton = (Button) findViewById(R.id.button_facebook); twitterAuthButton = (Button) findViewById(R.id.button_twitter); Button cfb = (Button) findViewById(R.id.button_create_feed); Button s = (Button) findViewById(R.id.button_settings); settingsViewFlipper.getBackground().setDither(true); feedTitleTextView = (TextView) findViewById(R.id.feed_action_bar_title); // Set typefaces manually since Android can't handle custom typefaces in // xml in any way whatsoever. Shame on them. twitterAuthButton.setTypeface(robotoMedium); facebookAuthButton.setTypeface(robotoMedium); feedTitleTextView = (TextView) findViewById(R.id.feed_action_bar_title); cfb.setTypeface(robotoMedium); s.setTypeface(robotoMedium); feedTitleTextView.setTypeface(robotoMedium); // set adapters feedAdapter = new PageAdapter(getSupportFragmentManager(), db, this); feedViewSwiper.setAdapter(feedAdapter); // lets 3 feedsviews to each side of the current one be retained in an // idle state. feedViewSwiper.setOffscreenPageLimit(3); CirclePageIndicator circleIndicator = (CirclePageIndicator) findViewById(R.id.indicator); circleIndicator.setViewPager(feedViewSwiper); circleIndicator.setOnPageChangeListener(new ViewPager.OnPageChangeListener() { @Override public void onPageSelected(int feedIndex) { String feedTitle = feedAdapter.getFeedTitle(feedIndex); feedTitleTextView.setText(feedTitle); } @Override public void onPageScrolled(int arg0, float arg1, int arg2) { // TODO Auto-generated method stub' } @Override public void onPageScrollStateChanged(int arg0) { // TODO Auto-generated method stub } }); // instanciate client and service helpers clientHandler = new ClientHandler(this); feedService = new DataServiceHelper(this); feedService.startService(); // load animations from res/anim slideOutLeft = AnimationUtils.loadAnimation(this, R.anim.slide_out_left); slideOutRight = AnimationUtils.loadAnimation(this, R.anim.slide_out_right); slideInLeft = AnimationUtils.loadAnimation(this, R.anim.slide_in_left); slideInRight = AnimationUtils.loadAnimation(this, R.anim.slide_in_right); // Display name correct if (feedAdapter.getCount() > 0) { String feedTitle = feedAdapter.getFeedTitle(0); feedTitleTextView.setText(feedTitle); } // misc settingsViewFlipper.setInAnimation(slideInRight); settingsViewFlipper.setOutAnimation(slideOutLeft); updateOverlay(); }
From source file:com.microsoft.rightsmanagement.ui.widget.UserPolicyViewerFragment.java
/** * Draws and appends rights views.//ww w .jav a2 s.c o m */ private void drawRights() { LayoutInflater inflater = (LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE); List<RightAccessCheckModel> effectiveViewableRights = mUserPolicyDataProvider.getUserPolicyModel() .getEffectiveViewableRights(); for (RightAccessCheckModel obj : effectiveViewableRights) { View rightView = inflater.inflate(R.layout.user_policy_viewer_rights_item, null); TextView rightNameTxtView = (TextView) rightView.findViewById(R.id.right_text_view); ImageView imageView = (ImageView) rightView.findViewById(R.id.rights_item_image_view); if (rightNameTxtView != null) { rightNameTxtView.setText(obj.getRightName()); // set the correct icon in case right is supported or not if (obj.getHasAccess()) { rightNameTxtView.setTextColor(getResources().getColor(R.color.light_gray)); imageView.setImageDrawable(getResources().getDrawable(R.drawable.v)); } else { rightNameTxtView.setTextColor(getResources().getColor(R.color.light_black)); imageView.setImageDrawable(getResources().getDrawable(R.drawable.x)); } } // add the view to the container panel mRightLayout.addView(rightView); } }
From source file:com.meetingninja.csse.meetings.EditMeetingActivity.java
/** * Set up the {@link android.app.ActionBar}. */// w ww. j a v a 2 s . com private void setupActionBar() { LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); // Make an Ok/Cancel ActionBar View actionBarButtons = inflater.inflate(R.layout.actionbar_ok_cancel, new LinearLayout(this), false); View cancelActionView = actionBarButtons.findViewById(R.id.action_cancel); cancelActionView.setOnClickListener(mActionBarListener); View doneActionView = actionBarButtons.findViewById(R.id.action_done); doneActionView.setOnClickListener(mActionBarListener); getActionBar().setHomeButtonEnabled(false); getActionBar().setDisplayShowHomeEnabled(false); getActionBar().setDisplayHomeAsUpEnabled(false); getActionBar().setDisplayShowTitleEnabled(false); getActionBar().setDisplayShowCustomEnabled(true); getActionBar().setCustomView(actionBarButtons); // end Ok-Cancel ActionBar }
From source file:com.appeaser.sublimepickerlibrary.timepicker.SublimeTimePicker.java
private void initializeLayout() { mContext = getContext();//from www. j a v a 2 s .c om setCurrentLocale(Locale.getDefault()); // process style attributes final TypedArray a = mContext.obtainStyledAttributes(R.styleable.SublimeTimePicker); final LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); final Resources res = mContext.getResources(); mSelectHours = res.getString(R.string.select_hours); mSelectMinutes = res.getString(R.string.select_minutes); DateFormatSymbols dfs = DateFormatSymbols.getInstance(mCurrentLocale); String[] amPmStrings = dfs.getAmPmStrings();/*{"AM", "PM"}*/ if (amPmStrings.length == 2 && !TextUtils.isEmpty(amPmStrings[0]) && !TextUtils.isEmpty(amPmStrings[1])) { mAmText = amPmStrings[0].length() > 2 ? amPmStrings[0].substring(0, 2) : amPmStrings[0]; mPmText = amPmStrings[1].length() > 2 ? amPmStrings[1].substring(0, 2) : amPmStrings[1]; } else { // Defaults mAmText = "AM"; mPmText = "PM"; } final int layoutResourceId = R.layout.time_picker_layout; final View mainView = inflater.inflate(layoutResourceId, this); mHeaderView = mainView.findViewById(R.id.time_header); // Set up hour/minute labels. mHourView = (TextView) mainView.findViewById(R.id.hours); mHourView.setOnClickListener(mClickListener); ViewCompat.setAccessibilityDelegate(mHourView, new ClickActionDelegate(mContext, R.string.select_hours)); mSeparatorView = (TextView) mainView.findViewById(R.id.separator); mMinuteView = (TextView) mainView.findViewById(R.id.minutes); mMinuteView.setOnClickListener(mClickListener); ViewCompat.setAccessibilityDelegate(mMinuteView, new ClickActionDelegate(mContext, R.string.select_minutes)); // Now that we have text appearances out of the way, make sure the hour // and minute views are correctly sized. mHourView.setMinWidth(computeStableWidth(mHourView, 24)); mMinuteView.setMinWidth(computeStableWidth(mMinuteView, 60)); // Set up AM/PM labels. mAmPmLayout = mainView.findViewById(R.id.ampm_layout); mAmLabel = (CheckedTextView) mAmPmLayout.findViewById(R.id.am_label); mAmLabel.setText(obtainVerbatim(amPmStrings[0])); mAmLabel.setOnClickListener(mClickListener); mPmLabel = (CheckedTextView) mAmPmLayout.findViewById(R.id.pm_label); mPmLabel.setText(obtainVerbatim(amPmStrings[1])); mPmLabel.setOnClickListener(mClickListener); ColorStateList headerTextColor = a.getColorStateList(R.styleable.SublimeTimePicker_spHeaderTextColor); if (headerTextColor != null) { mHourView.setTextColor(headerTextColor); mSeparatorView.setTextColor(headerTextColor); mMinuteView.setTextColor(headerTextColor); mAmLabel.setTextColor(headerTextColor); mPmLabel.setTextColor(headerTextColor); } // Set up header background, if available. if (SUtils.isApi_22_OrHigher()) { if (a.hasValueOrEmpty(R.styleable.SublimeTimePicker_spHeaderBackground)) { SUtils.setViewBackground(mHeaderView, a.getDrawable(R.styleable.SublimeTimePicker_spHeaderBackground)); } } else { if (a.hasValue(R.styleable.SublimeTimePicker_spHeaderBackground)) { SUtils.setViewBackground(mHeaderView, a.getDrawable(R.styleable.SublimeTimePicker_spHeaderBackground)); } } a.recycle(); mRadialTimePickerView = (RadialTimePickerView) mainView.findViewById(R.id.radial_picker); setupListeners(); mAllowAutoAdvance = true; // Set up for keyboard mode. mDoublePlaceholderText = res.getString(R.string.time_placeholder); mDeletedKeyFormat = res.getString(R.string.deleted_key); mPlaceholderText = mDoublePlaceholderText.charAt(0); mAmKeyCode = mPmKeyCode = -1; generateLegalTimesTree(); // Initialize with current time final Calendar calendar = Calendar.getInstance(mCurrentLocale); final int currentHour = calendar.get(Calendar.HOUR_OF_DAY); final int currentMinute = calendar.get(Calendar.MINUTE); initialize(currentHour, currentMinute, false /* 12h */, HOUR_INDEX); }
From source file:com.atomjack.vcfp.VideoControllerView.java
/** * Create the view that holds the widgets that control playback. * Derived classes can override this to create their own. * @return The controller view./* w ww . j a va 2s .com*/ * @hide This doesn't work as advertised */ protected View makeControllerView() { LayoutInflater inflate = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); mRoot = inflate.inflate(R.layout.media_controller, null); initControllerView(mRoot); return mRoot; }
From source file:com.meetingninja.csse.tasks.EditTaskActivity.java
private void setupActionBar() { LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); // Make an Ok/Cancel ActionBar View actionBarButtons = inflater.inflate(R.layout.actionbar_ok_cancel, new LinearLayout(this), false); View cancelActionView = actionBarButtons.findViewById(R.id.action_cancel); cancelActionView.setOnClickListener(tActionBarListener); View doneActionView = actionBarButtons.findViewById(R.id.action_done); doneActionView.setOnClickListener(tActionBarListener); getActionBar().setHomeButtonEnabled(false); getActionBar().setDisplayShowHomeEnabled(false); getActionBar().setDisplayHomeAsUpEnabled(false); getActionBar().setDisplayShowTitleEnabled(false); getActionBar().setDisplayShowCustomEnabled(true); getActionBar().setCustomView(actionBarButtons); // end Ok-Cancel ActionBar }
From source file:com.investallign.controls.SlidingTabLayout.java
/** * Create a default view to be used for tabs. This is called if a custom tab view is not set via * {@link #setCustomTabView(int, int)}./* w w w.ja v a2s. c o m*/ */ @TargetApi(Build.VERSION_CODES.JELLY_BEAN) protected TextView createDefaultTabView(Context context) { // FuturaTextView textView = new FuturaTextView(context); LayoutInflater inflater = null; if (inflater == null) inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); TextView textView = (TextView) inflater.inflate(R.layout.sliding_textview, null); textView.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)); int padding = (int) (TAB_VIEW_PADDING_DIPS * getResources().getDisplayMetrics().density); textView.setPadding(padding, padding, padding, padding); return textView; }
From source file:gov.sfmta.sfpark.AnnotationsOverlay.java
@Override protected boolean onTap(final int index) { Log.v(TAG, "onTap"); if (isPinch) { return false; }//w w w. j a v a2 s. c om aa = MainScreenActivity.annotations.get(index); if (aa == null) { return false; } try { aa.subtitle = aa.availabilityDescriptionShowingPrice(MainScreenActivity.showPrice); } catch (JSONException e) { e.printStackTrace(); } GeoPoint geoPoint = aa.mid; LayoutInflater vi = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); popupView = vi.inflate(R.layout.dialog, null); TextView title = (TextView) popupView.findViewById(R.id.detailTitle); TextView subtitle = (TextView) popupView.findViewById(R.id.detailSubtitle); title.setTextColor(0xFFffffff); subtitle.setTextColor(0xFFcccccc); // set bubble title title.setText(aa.title != null ? aa.title : mContext.getString(R.string.unknown)); // Bubble Flurry! Map<String, String> details = new HashMap<String, String>(); details.put("Details for", aa.title); FlurryAgent.logEvent("Show_Details", details); // set bubble subtitle if (aa.subtitle == null) { subtitle.setText(R.string.full); aa.subtitle = mContext.getString(R.string.full); } else { if (aa.onStreet) { subtitle.setText(aa.subtitle); } else { if (aa.subtitle.startsWith("Estimated 0 of") || aa.subtitle.startsWith("Estimated -") || aa.subtitle.startsWith("-")) { subtitle.setText(R.string.full); aa.subtitle = mContext.getString(R.string.full); } else { subtitle.setText(aa.subtitle); } } } LayoutParams mapDialogParams = new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT, geoPoint, 0, -20, LayoutParams.CENTER); MainScreenActivity.mapView.addView(popupView, mapDialogParams); popupView.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Log.v(TAG, "Details tapped"); // Bubble Flurry! Map<String, String> moreDetails = new HashMap<String, String>(); moreDetails.put("Details for", aa.title); FlurryAgent.logEvent("Show_More_Details", moreDetails); DetailViewActivity.present(mContext, aa); return; } }); //PreDraw creates infinite loop situations ViewTreeObserver vto = popupView.getViewTreeObserver(); vto.addOnGlobalLayoutListener(new OnGlobalLayoutListener() { @Override public void onGlobalLayout() { Log.v(TAG, "onGlobalLayout"); if ((aa == null) || (MainScreenActivity.mapView == null) || (MainScreenActivity.mc == null) || (popupView == null)) { return; } // compromise until figure out horiz Point // offset(dx, 0) projection toPixels fromPixels // dip - pixels - lon getMeasuredWidth etc if ((popupView.getLeft() < MainScreenActivity.mapView.getLeft()) || (popupView.getRight() > MainScreenActivity.mapView.getRight())) { // assumes aa is set! MainScreenActivity.mc.animateTo(aa.mid); } // Separated for clarity - something missing re // -20 at top and view height at bottom... if ((popupView.getTop() < MainScreenActivity.mapView.getTop()) || (popupView.getBottom() > MainScreenActivity.mapView.getBottom())) { // assumes aa is set! MainScreenActivity.mc.animateTo(aa.mid); } // make sure only called one time! popupView.getViewTreeObserver().removeGlobalOnLayoutListener(this); } }); return true; }