/** * Parse attributes during inflation from a view hierarchy into the * arguments we handle. */ @Override public void onInflate(Activity activity, AttributeSet attrs, Bundle savedInstanceState) { super.onInflate(activity, attrs, savedInstanceState); Log.v(TAG,"onInflate called"); TypedArray a = activity.obtainStyledAttributes(attrs,R.styleable.MyFragment); CharSequence myString = a.getText(R.styleable.MyFragment_my_string); if(myString != null) { Log.v(TAG, "My String Received : " + myString.toString()); } int myInteger = a.getInt(R.styleable.AdFragment_my_integer, -1); if(myInteger != -1) { Log.v(TAG,"My Integer Received :" + myInteger); } a.recycle(); }
@Override public void onInflate(Activity activity, AttributeSet attrs, Bundle savedInstanceState) { super.onInflate(activity, attrs, savedInstanceState); TypedArray a = activity.obtainStyledAttributes(attrs, R.styleable.picker_friend_picker_fragment); setMultiSelect(a.getBoolean(R.styleable.picker_friend_picker_fragment_multi_select, multiSelect)); a.recycle(); }
@Override public void onInflate(Activity activity, AttributeSet attrs, Bundle savedInstanceState) { super.onInflate(activity, attrs, savedInstanceState); TypedArray a = activity.obtainStyledAttributes(attrs, R.styleable.picker_fragment); setShowPictures(a.getBoolean(R.styleable.picker_fragment_show_pictures, showPictures)); String extraFieldsString = a.getString(R.styleable.picker_fragment_extra_fields); if (extraFieldsString != null) { String[] strings = extraFieldsString.split(","); setExtraFields(Arrays.asList(strings)); } showTitleBar = a.getBoolean(R.styleable.picker_fragment_show_title_bar, showTitleBar); titleText = a.getString(R.styleable.picker_fragment_title_text); doneButtonText = a.getString(R.styleable.picker_fragment_done_button_text); titleBarBackground = a.getDrawable(R.styleable.picker_fragment_title_bar_background); doneButtonBackground = a.getDrawable(R.styleable.picker_fragment_done_button_background); a.recycle(); }
@Override public void onInflate(Activity activity, AttributeSet attrs, Bundle savedInstanceState) { super.onInflate(activity, attrs, savedInstanceState); TypedArray a = activity.obtainStyledAttributes(attrs, R.styleable.picker_place_picker_fragment); setRadiusInMeters(a.getInt(R.styleable.picker_place_picker_fragment_radius_in_meters, radiusInMeters)); setResultsLimit(a.getInt(R.styleable.picker_place_picker_fragment_results_limit, resultsLimit)); if (a.hasValue(R.styleable.picker_place_picker_fragment_results_limit)) { setSearchText(a.getString(R.styleable.picker_place_picker_fragment_search_text)); } showSearchBox = a.getBoolean(R.styleable.picker_place_picker_fragment_show_search_box, showSearchBox); a.recycle(); }
public WebURLEmotionSpan(Context context, Bitmap b, String url, int type, int verticalAlignment) { super(context, b, verticalAlignment); int[] attrs = new int[] { org.aisen.android.R.attr.colorPrimary }; Activity activity = BaseActivity.getRunningActivity(); if (activity != null) { TypedArray ta = activity.obtainStyledAttributes(attrs); mColor = ta.getColor(0, Color.BLUE); } else { mColor = Color.BLUE; } mType = type; mURL = url; mBackgroundPaint = new Paint(); mBackgroundPaint.setColor(Color.parseColor("#33969696")); if (mType == VideoService.TYPE_VIDEO_SINA || mType == VideoService.TYPE_VIDEO_WEIPAI) { mReplaceText = "秒拍视频"; } else if (mType == VideoService.TYPE_VIDEO_MEIPAI) { mReplaceText = "美拍视频"; } else if (mType == VideoService.TYPE_PHOTO) { mReplaceText = "查看图片"; } else { mReplaceText = "网页链接"; } }
final TypedArray a = host.obtainStyledAttributes(R.styleable.DribbbleFeed); final int loadingColorArrayId = a.getResourceId(R.styleable.DribbbleFeed_shotLoadingPlaceholderColors, 0);
public static int getDisplayHeight(Activity activity) { int height = 0; if (activity != null && activity.getWindowManager() != null && activity.getWindowManager().getDefaultDisplay() != null) { Point point=new Point(); activity.getWindowManager().getDefaultDisplay().getSize(point); height=point.y; } Log.e(TAG, "isSupportSmartBar:" + isSupportSmartBar); if (isSupportSmartBar) { int smartBarHeight = getSmartBarHeight(activity); Log.e(TAG, "smartBarHeight:" + smartBarHeight); height -= smartBarHeight; } if (activity != null && activity.getActionBar() != null) { int actionbar= activity.getActionBar().getHeight(); if(actionbar==0){ TypedArray actionbarSizeTypedArray=activity.obtainStyledAttributes(new int[]{android.R.attr.actionBarSize}); actionbar= (int) actionbarSizeTypedArray.getDimension(0,0); } Log.d(TAG, "actionbar:" + actionbar); height -= actionbar; } int status = getStatusBarHeight(activity); Log.d(TAG, "status:" + status); height -= status; Log.d(TAG,"height:"+height); return height; }
TypedArray a = activity.obtainStyledAttributes(attrs); try { mStatusBarAvailable = a.getBoolean(0, false);
TypedArray a = activity.obtainStyledAttributes(attrs); try { mStatusBarAvailable = a.getBoolean(0, false);
TypedArray a = activity.obtainStyledAttributes(attrs); try { mStatusBarAvailable = a.getBoolean(0, false);
TypedArray a = activity.obtainStyledAttributes(attrs); try { mStatusBarAvailable = a.getBoolean(0, false);
TypedArray a = activity.obtainStyledAttributes(attrs); try { mStatusBarAvailable = a.getBoolean(0, false);
TypedArray a = activity.obtainStyledAttributes(attrs); try { mStatusBarAvailable = a.getBoolean(0, false);
public static void fixActivity(Activity activity) { Context baseContext = activity.getBaseContext(); try { TypedArray typedArray = activity.obtainStyledAttributes((R_Hide.styleable.Window.get())); if (typedArray != null) { boolean showWallpaper = typedArray.getBoolean(R_Hide.styleable.Window_windowShowWallpaper.get(),
@NonNull @Override public TypedArray obtainStyledAttributes(@StyleRes int resId, @StyleableRes int[] attrs) { return mActivity.obtainStyledAttributes(resId, attrs); }
/** * @param set * @param attrs * @return * @see android.content.Context#obtainStyledAttributes(android.util.AttributeSet, * int[]) */ public final TypedArray obtainStyledAttributes(AttributeSet set, int[] attrs) { return mActivity.obtainStyledAttributes(set, attrs); }
/** * @param attrs * @return * @see android.content.Context#obtainStyledAttributes(int[]) */ public final TypedArray obtainStyledAttributes(int[] attrs) { return mActivity.obtainStyledAttributes(attrs); }
public static int getColor(Activity activity, int attr) { int[] attrs = new int[]{ attr }; TypedArray ta = activity.obtainStyledAttributes(attrs); int color = ta.getColor(0, 430); ta.recycle(); return color; }
public static int getDimensionPixelSize(Activity activity, int attr, int defaultValue) { int[] attrs = new int[]{ attr }; TypedArray ta = activity.obtainStyledAttributes(attrs); int value = ta.getDimensionPixelSize(0, defaultValue); ta.recycle(); return value; }
@Override public void onInflate(Activity activity, AttributeSet attrs, Bundle savedInstanceState) { super.onInflate(activity, attrs, savedInstanceState); TypedArray a = activity.obtainStyledAttributes(attrs, R.styleable.com_facebook_place_picker_fragment); setRadiusInMeters(a.getInt(R.styleable.com_facebook_place_picker_fragment_radius_in_meters, radiusInMeters)); setResultsLimit(a.getInt(R.styleable.com_facebook_place_picker_fragment_results_limit, resultsLimit)); if (a.hasValue(R.styleable.com_facebook_place_picker_fragment_results_limit)) { setSearchText(a.getString(R.styleable.com_facebook_place_picker_fragment_search_text)); } showSearchBox = a.getBoolean(R.styleable.com_facebook_place_picker_fragment_show_search_box, showSearchBox); a.recycle(); }