Java Code Examples for android.support.v7.appcompat.R

The following are top voted examples for showing how to use android.support.v7.appcompat.R. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: boohee_v5.6   File: NotificationCompatImplBase.java   View source code 8 votes vote down vote up
private static <T extends Action> RemoteViews generateBigContentView(Context context, CharSequence contentTitle, CharSequence contentText, CharSequence contentInfo, int number, Bitmap largeIcon, CharSequence subText, boolean useChronometer, long when, List<T> actions, boolean showCancelButton, PendingIntent cancelButtonIntent) {
    int actionCount = Math.min(actions.size(), 5);
    RemoteViews big = applyStandardTemplate(context, contentTitle, contentText, contentInfo, number, largeIcon, subText, useChronometer, when, getBigLayoutResource(actionCount), false);
    big.removeAllViews(R.id.media_actions);
    if (actionCount > 0) {
        for (int i = 0; i < actionCount; i++) {
            big.addView(R.id.media_actions, generateMediaActionButton(context, (Action) actions.get(i)));
        }
    }
    if (showCancelButton) {
        big.setViewVisibility(R.id.cancel_action, 0);
        big.setInt(R.id.cancel_action, "setAlpha", context.getResources().getInteger(R.integer.cancel_button_image_alpha));
        big.setOnClickPendingIntent(R.id.cancel_action, cancelButtonIntent);
    } else {
        big.setViewVisibility(R.id.cancel_action, 8);
    }
    return big;
}
 
Example 2
Project: boohee_v5.6   File: SwitchCompat.java   View source code 6 votes vote down vote up
public void setSwitchTextAppearance(Context context, int resid) {
    TypedArray appearance = context.obtainStyledAttributes(resid, R.styleable.TextAppearance);
    ColorStateList colors = appearance.getColorStateList(R.styleable.TextAppearance_android_textColor);
    if (colors != null) {
        this.mTextColors = colors;
    } else {
        this.mTextColors = getTextColors();
    }
    int ts = appearance.getDimensionPixelSize(R.styleable.TextAppearance_android_textSize, 0);
    if (!(ts == 0 || ((float) ts) == this.mTextPaint.getTextSize())) {
        this.mTextPaint.setTextSize((float) ts);
        requestLayout();
    }
    setSwitchTypefaceByIndex(appearance.getInt(R.styleable.TextAppearance_android_typeface, -1), appearance.getInt(R.styleable.TextAppearance_android_textStyle, -1));
    if (appearance.getBoolean(R.styleable.TextAppearance_textAllCaps, false)) {
        this.mSwitchTransformationMethod = new AllCapsTransformationMethod(getContext());
    } else {
        this.mSwitchTransformationMethod = null;
    }
    appearance.recycle();
}
 
Example 3
Project: youkes_browser   File: DrawerArrowDrawable.java   View source code 6 votes vote down vote up
/**
 * @param context
 *            used to get the configuration for the drawable from
 */
public DrawerArrowDrawable(Context context) {
	final TypedArray typedArray = context.getTheme().obtainStyledAttributes(null,
			R.styleable.DrawerArrowToggle, R.attr.drawerArrowStyle,
			R.style.Base_Widget_AppCompat_DrawerArrowToggle);
	mPaint.setAntiAlias(true);
	mPaint.setColor(typedArray.getColor(R.styleable.DrawerArrowToggle_color, 0));
	mSize = typedArray.getDimensionPixelSize(R.styleable.DrawerArrowToggle_drawableSize, 0);
	mBarSize =0;// typedArray.getDimension(R.styleable.DrawerArrowToggle_barSize, 0);
	mTopBottomArrowSize = //typedArray.getDimension(R.styleable.DrawerArrowToggle_topBottomBarArrowSize, 0);
	mBarThickness = typedArray.getDimension(R.styleable.DrawerArrowToggle_thickness, 0);
	mBarGap = typedArray.getDimension(R.styleable.DrawerArrowToggle_gapBetweenBars, 0);
	mSpin = typedArray.getBoolean(R.styleable.DrawerArrowToggle_spinBars, true);
	mMiddleArrowSize =0;// typedArray.getDimension(R.styleable.DrawerArrowToggle_middleBarArrowSize, 0);
	typedArray.recycle();
	mPaint.setStyle(Paint.Style.STROKE);
	mPaint.setStrokeJoin(Paint.Join.ROUND);
	mPaint.setStrokeCap(Paint.Cap.SQUARE);
	mPaint.setStrokeWidth(mBarThickness);
}
 
Example 4
Project: boohee_v5.6   File: ShareActionProvider.java   View source code 6 votes vote down vote up
public void onPrepareSubMenu(SubMenu subMenu) {
    int i;
    subMenu.clear();
    ActivityChooserModel dataModel = ActivityChooserModel.get(this.mContext, this.mShareHistoryFileName);
    PackageManager packageManager = this.mContext.getPackageManager();
    int expandedActivityCount = dataModel.getActivityCount();
    int collapsedActivityCount = Math.min(expandedActivityCount, this.mMaxShownActivityCount);
    for (i = 0; i < collapsedActivityCount; i++) {
        ResolveInfo activity = dataModel.getActivity(i);
        subMenu.add(0, i, i, activity.loadLabel(packageManager)).setIcon(activity.loadIcon(packageManager)).setOnMenuItemClickListener(this.mOnMenuItemClickListener);
    }
    if (collapsedActivityCount < expandedActivityCount) {
        SubMenu expandedSubMenu = subMenu.addSubMenu(0, collapsedActivityCount, collapsedActivityCount, this.mContext.getString(R.string.abc_activity_chooser_view_see_all));
        for (i = 0; i < expandedActivityCount; i++) {
            activity = dataModel.getActivity(i);
            expandedSubMenu.add(0, i, i, activity.loadLabel(packageManager)).setIcon(activity.loadIcon(packageManager)).setOnMenuItemClickListener(this.mOnMenuItemClickListener);
        }
    }
}
 
Example 5
Project: boohee_v5.6   File: MenuDialogHelper.java   View source code 6 votes vote down vote up
public void show(IBinder windowToken) {
    MenuBuilder menu = this.mMenu;
    Builder builder = new Builder(menu.getContext());
    this.mPresenter = new ListMenuPresenter(builder.getContext(), R.layout.abc_list_menu_item_layout);
    this.mPresenter.setCallback(this);
    this.mMenu.addMenuPresenter(this.mPresenter);
    builder.setAdapter(this.mPresenter.getAdapter(), this);
    View headerView = menu.getHeaderView();
    if (headerView != null) {
        builder.setCustomTitle(headerView);
    } else {
        builder.setIcon(menu.getHeaderIcon()).setTitle(menu.getHeaderTitle());
    }
    builder.setOnKeyListener(this);
    this.mDialog = builder.create();
    this.mDialog.setOnDismissListener(this);
    LayoutParams lp = this.mDialog.getWindow().getAttributes();
    lp.type = CloseFrame.REFUSE;
    if (windowToken != null) {
        lp.token = windowToken;
    }
    lp.flags |= 131072;
    this.mDialog.show();
}
 
Example 6
Project: boohee_v5.6   File: DrawerArrowDrawable.java   View source code 6 votes vote down vote up
public DrawerArrowDrawable(Context context) {
    this.mPaint.setStyle(Style.STROKE);
    this.mPaint.setStrokeJoin(Join.MITER);
    this.mPaint.setStrokeCap(Cap.BUTT);
    this.mPaint.setAntiAlias(true);
    TypedArray a = context.getTheme().obtainStyledAttributes(null, R.styleable.DrawerArrowToggle, R.attr.drawerArrowStyle, R.style.Base_Widget_AppCompat_DrawerArrowToggle);
    setColor(a.getColor(R.styleable.DrawerArrowToggle_color, 0));
    setBarThickness(a.getDimension(R.styleable.DrawerArrowToggle_thickness, 0.0f));
    setSpinEnabled(a.getBoolean(R.styleable.DrawerArrowToggle_spinBars, true));
    setGapSize((float) Math.round(a.getDimension(R.styleable.DrawerArrowToggle_gapBetweenBars, 0.0f)));
    this.mSize = a.getDimensionPixelSize(R.styleable.DrawerArrowToggle_drawableSize, 0);
    this.mBarLength = (float) Math.round(a.getDimension(R.styleable.DrawerArrowToggle_barLength, 0.0f));
    this.mArrowHeadLength = (float) Math.round(a.getDimension(R.styleable.DrawerArrowToggle_arrowHeadLength, 0.0f));
    this.mArrowShaftLength = a.getDimension(R.styleable.DrawerArrowToggle_arrowShaftLength, 0.0f);
    a.recycle();
}
 
Example 7
Project: boohee_v5.6   File: AppCompatDelegateImplV7.java   View source code 6 votes vote down vote up
private void applyFixedSizeWindow() {
    ContentFrameLayout cfl = (ContentFrameLayout) this.mSubDecor.findViewById(16908290);
    View windowDecor = this.mWindow.getDecorView();
    cfl.setDecorPadding(windowDecor.getPaddingLeft(), windowDecor.getPaddingTop(), windowDecor.getPaddingRight(), windowDecor.getPaddingBottom());
    TypedArray a = this.mContext.obtainStyledAttributes(R.styleable.AppCompatTheme);
    a.getValue(R.styleable.AppCompatTheme_windowMinWidthMajor, cfl.getMinWidthMajor());
    a.getValue(R.styleable.AppCompatTheme_windowMinWidthMinor, cfl.getMinWidthMinor());
    if (a.hasValue(R.styleable.AppCompatTheme_windowFixedWidthMajor)) {
        a.getValue(R.styleable.AppCompatTheme_windowFixedWidthMajor, cfl.getFixedWidthMajor());
    }
    if (a.hasValue(R.styleable.AppCompatTheme_windowFixedWidthMinor)) {
        a.getValue(R.styleable.AppCompatTheme_windowFixedWidthMinor, cfl.getFixedWidthMinor());
    }
    if (a.hasValue(R.styleable.AppCompatTheme_windowFixedHeightMajor)) {
        a.getValue(R.styleable.AppCompatTheme_windowFixedHeightMajor, cfl.getFixedHeightMajor());
    }
    if (a.hasValue(R.styleable.AppCompatTheme_windowFixedHeightMinor)) {
        a.getValue(R.styleable.AppCompatTheme_windowFixedHeightMinor, cfl.getFixedHeightMinor());
    }
    a.recycle();
    cfl.requestLayout();
}
 
Example 8
Project: boohee_v5.6   File: AppCompatDelegateImplV7.java   View source code 6 votes vote down vote up
private boolean initializePanelMenu(PanelFeatureState st) {
    Context context = this.mContext;
    if ((st.featureId == 0 || st.featureId == 108) && this.mDecorContentParent != null) {
        TypedValue outValue = new TypedValue();
        Theme baseTheme = context.getTheme();
        baseTheme.resolveAttribute(R.attr.actionBarTheme, outValue, true);
        Theme widgetTheme = null;
        if (outValue.resourceId != 0) {
            widgetTheme = context.getResources().newTheme();
            widgetTheme.setTo(baseTheme);
            widgetTheme.applyStyle(outValue.resourceId, true);
            widgetTheme.resolveAttribute(R.attr.actionBarWidgetTheme, outValue, true);
        } else {
            baseTheme.resolveAttribute(R.attr.actionBarWidgetTheme, outValue, true);
        }
        if (outValue.resourceId != 0) {
            if (widgetTheme == null) {
                widgetTheme = context.getResources().newTheme();
                widgetTheme.setTo(baseTheme);
            }
            widgetTheme.applyStyle(outValue.resourceId, true);
        }
        if (widgetTheme != null) {
            Context context2 = new ContextThemeWrapper(context, 0);
            context2.getTheme().setTo(widgetTheme);
            context = context2;
        }
    }
    MenuBuilder menu = new MenuBuilder(context);
    menu.setCallback(this);
    st.setMenu(menu);
    return true;
}
 
Example 9
Project: boohee_v5.6   File: AppCompatViewInflater.java   View source code 6 votes vote down vote up
private static Context themifyContext(Context context, AttributeSet attrs, boolean useAndroidTheme, boolean useAppTheme) {
    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.View, 0, 0);
    int themeId = 0;
    if (useAndroidTheme) {
        themeId = a.getResourceId(R.styleable.View_android_theme, 0);
    }
    if (useAppTheme && themeId == 0) {
        themeId = a.getResourceId(R.styleable.View_theme, 0);
        if (themeId != 0) {
            Log.i(LOG_TAG, "app:theme is now deprecated. Please move to using android:theme instead.");
        }
    }
    a.recycle();
    if (themeId == 0) {
        return context;
    }
    if ((context instanceof ContextThemeWrapper) && ((ContextThemeWrapper) context).getThemeResId() == themeId) {
        return context;
    }
    return new ContextThemeWrapper(context, themeId);
}
 
Example 10
Project: boohee_v5.6   File: AlertController.java   View source code 6 votes vote down vote up
private void setupContent(ViewGroup contentPanel) {
    this.mScrollView = (NestedScrollView) this.mWindow.findViewById(R.id.scrollView);
    this.mScrollView.setFocusable(false);
    this.mScrollView.setNestedScrollingEnabled(false);
    this.mMessageView = (TextView) contentPanel.findViewById(16908299);
    if (this.mMessageView != null) {
        if (this.mMessage != null) {
            this.mMessageView.setText(this.mMessage);
            return;
        }
        this.mMessageView.setVisibility(8);
        this.mScrollView.removeView(this.mMessageView);
        if (this.mListView != null) {
            ViewGroup scrollParent = (ViewGroup) this.mScrollView.getParent();
            int childIndex = scrollParent.indexOfChild(this.mScrollView);
            scrollParent.removeViewAt(childIndex);
            scrollParent.addView(this.mListView, childIndex, new LayoutParams(-1, -1));
            return;
        }
        contentPanel.setVisibility(8);
    }
}
 
Example 11
Project: boohee_v5.6   File: AppCompatImageHelper.java   View source code 6 votes vote down vote up
public void loadFromAttributes(AttributeSet attrs, int defStyleAttr) {
    TintTypedArray a = TintTypedArray.obtainStyledAttributes(this.mView.getContext(), attrs, R.styleable.AppCompatImageView, defStyleAttr, 0);
    try {
        Drawable d = a.getDrawableIfKnown(R.styleable.AppCompatImageView_android_src);
        if (d != null) {
            this.mView.setImageDrawable(d);
        }
        int id = a.getResourceId(R.styleable.AppCompatImageView_srcCompat, -1);
        if (id != -1) {
            d = this.mDrawableManager.getDrawable(this.mView.getContext(), id);
            if (d != null) {
                this.mView.setImageDrawable(d);
            }
        }
        Drawable drawable = this.mView.getDrawable();
        if (drawable != null) {
            DrawableUtils.fixDrawable(drawable);
        }
        a.recycle();
    } catch (Throwable th) {
        a.recycle();
    }
}
 
Example 12
Project: boohee_v5.6   File: ActionBarContainer.java   View source code 6 votes vote down vote up
public ActionBarContainer(Context context, AttributeSet attrs) {
    boolean z = true;
    super(context, attrs);
    setBackgroundDrawable(VERSION.SDK_INT >= 21 ? new ActionBarBackgroundDrawableV21(this) : new ActionBarBackgroundDrawable(this));
    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.ActionBar);
    this.mBackground = a.getDrawable(R.styleable.ActionBar_background);
    this.mStackedBackground = a.getDrawable(R.styleable.ActionBar_backgroundStacked);
    this.mHeight = a.getDimensionPixelSize(R.styleable.ActionBar_height, -1);
    if (getId() == R.id.split_action_bar) {
        this.mIsSplit = true;
        this.mSplitBackground = a.getDrawable(R.styleable.ActionBar_backgroundSplit);
    }
    a.recycle();
    if (this.mIsSplit) {
        if (this.mSplitBackground != null) {
            z = false;
        }
    } else if (!(this.mBackground == null && this.mStackedBackground == null)) {
        z = false;
    }
    setWillNotDraw(z);
}
 
Example 13
Project: boohee_v5.6   File: AppCompatBackgroundHelper.java   View source code 6 votes vote down vote up
void loadFromAttributes(AttributeSet attrs, int defStyleAttr) {
    TypedArray a = this.mView.getContext().obtainStyledAttributes(attrs, R.styleable.ViewBackgroundHelper, defStyleAttr, 0);
    try {
        if (a.hasValue(R.styleable.ViewBackgroundHelper_android_background)) {
            ColorStateList tint = this.mDrawableManager.getTintList(this.mView.getContext(), a.getResourceId(R.styleable.ViewBackgroundHelper_android_background, -1));
            if (tint != null) {
                setInternalBackgroundTint(tint);
            }
        }
        if (a.hasValue(R.styleable.ViewBackgroundHelper_backgroundTint)) {
            ViewCompat.setBackgroundTintList(this.mView, a.getColorStateList(R.styleable.ViewBackgroundHelper_backgroundTint));
        }
        if (a.hasValue(R.styleable.ViewBackgroundHelper_backgroundTintMode)) {
            ViewCompat.setBackgroundTintMode(this.mView, DrawableUtils.parseTintMode(a.getInt(R.styleable.ViewBackgroundHelper_backgroundTintMode, -1), null));
        }
        a.recycle();
    } catch (Throwable th) {
        a.recycle();
    }
}
 
Example 14
Project: boohee_v5.6   File: DialogTitle.java   View source code 6 votes vote down vote up
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
    super.onMeasure(widthMeasureSpec, heightMeasureSpec);
    Layout layout = getLayout();
    if (layout != null) {
        int lineCount = layout.getLineCount();
        if (lineCount > 0 && layout.getEllipsisCount(lineCount - 1) > 0) {
            setSingleLine(false);
            setMaxLines(2);
            TypedArray a = getContext().obtainStyledAttributes(null, R.styleable.TextAppearance, 16842817, 16973892);
            int textSize = a.getDimensionPixelSize(R.styleable.TextAppearance_android_textSize, 0);
            if (textSize != 0) {
                setTextSize(0, (float) textSize);
            }
            a.recycle();
            super.onMeasure(widthMeasureSpec, heightMeasureSpec);
        }
    }
}
 
Example 15
Project: boohee_v5.6   File: ActionBarContextView.java   View source code 6 votes vote down vote up
public void initForMode(final ActionMode mode) {
    if (this.mClose == null) {
        this.mClose = LayoutInflater.from(getContext()).inflate(this.mCloseItemLayout, this, false);
        addView(this.mClose);
    } else if (this.mClose.getParent() == null) {
        addView(this.mClose);
    }
    this.mClose.findViewById(R.id.action_mode_close_button).setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
            mode.finish();
        }
    });
    MenuBuilder menu = (MenuBuilder) mode.getMenu();
    if (this.mActionMenuPresenter != null) {
        this.mActionMenuPresenter.dismissPopupMenus();
    }
    this.mActionMenuPresenter = new ActionMenuPresenter(getContext());
    this.mActionMenuPresenter.setReserveOverflow(true);
    LayoutParams layoutParams = new LayoutParams(-2, -1);
    menu.addMenuPresenter(this.mActionMenuPresenter, this.mPopupContext);
    this.mMenuView = (ActionMenuView) this.mActionMenuPresenter.getMenuView(this);
    this.mMenuView.setBackgroundDrawable(null);
    addView(this.mMenuView, layoutParams);
}
 
Example 16
Project: boohee_v5.6   File: AppCompatDrawableManager.java   View source code 6 votes vote down vote up
private ColorStateList createButtonColorStateList(Context context, int baseColorAttr) {
    states = new int[4][];
    colors = new int[4];
    int baseColor = ThemeUtils.getThemeAttrColor(context, baseColorAttr);
    int colorControlHighlight = ThemeUtils.getThemeAttrColor(context, R.attr.colorControlHighlight);
    states[0] = ThemeUtils.DISABLED_STATE_SET;
    colors[0] = ThemeUtils.getDisabledThemeAttrColor(context, R.attr.colorButtonNormal);
    int i = 0 + 1;
    states[i] = ThemeUtils.PRESSED_STATE_SET;
    colors[i] = ColorUtils.compositeColors(colorControlHighlight, baseColor);
    i++;
    states[i] = ThemeUtils.FOCUSED_STATE_SET;
    colors[i] = ColorUtils.compositeColors(colorControlHighlight, baseColor);
    i++;
    states[i] = ThemeUtils.EMPTY_STATE_SET;
    colors[i] = baseColor;
    i++;
    return new ColorStateList(states, colors);
}
 
Example 17
Project: boohee_v5.6   File: Toolbar.java   View source code 6 votes vote down vote up
private void ensureCollapseButtonView() {
    if (this.mCollapseButtonView == null) {
        this.mCollapseButtonView = new ImageButton(getContext(), null, R.attr.toolbarNavigationButtonStyle);
        this.mCollapseButtonView.setImageDrawable(this.mCollapseIcon);
        this.mCollapseButtonView.setContentDescription(this.mCollapseDescription);
        LayoutParams lp = generateDefaultLayoutParams();
        lp.gravity = GravityCompat.START | (this.mButtonGravity & 112);
        lp.mViewType = 2;
        this.mCollapseButtonView.setLayoutParams(lp);
        this.mCollapseButtonView.setOnClickListener(new OnClickListener() {
            public void onClick(View v) {
                Toolbar.this.collapseActionView();
            }
        });
    }
}
 
Example 18
Project: boohee_v5.6   File: SearchView.java   View source code 6 votes vote down vote up
private void adjustDropDownSizeAndPosition() {
    if (this.mDropDownAnchor.getWidth() > 1) {
        int offset;
        Resources res = getContext().getResources();
        int anchorPadding = this.mSearchPlate.getPaddingLeft();
        Rect dropDownPadding = new Rect();
        boolean isLayoutRtl = ViewUtils.isLayoutRtl(this);
        int iconOffset = this.mIconifiedByDefault ? res.getDimensionPixelSize(R.dimen.abc_dropdownitem_icon_width) + res.getDimensionPixelSize(R.dimen.abc_dropdownitem_text_padding_left) : 0;
        this.mSearchSrcTextView.getDropDownBackground().getPadding(dropDownPadding);
        if (isLayoutRtl) {
            offset = -dropDownPadding.left;
        } else {
            offset = anchorPadding - (dropDownPadding.left + iconOffset);
        }
        this.mSearchSrcTextView.setDropDownHorizontalOffset(offset);
        this.mSearchSrcTextView.setDropDownWidth((((this.mDropDownAnchor.getWidth() + dropDownPadding.left) + dropDownPadding.right) + iconOffset) - anchorPadding);
    }
}
 
Example 19
Project: mtoolbox   File: Main.java   View source code 5 votes vote down vote up
@Override
public boolean onMenuItemClick(MenuItem menuItem)
{
	switch (menuItem.getItemId())
	{
		case R.id.b:
			Intent shareIntent = new Intent();
			shareIntent.setAction(Intent.ACTION_SEND);
			shareIntent.putExtra(Intent.EXTRA_TEXT, "M工具箱一个非常厉害的工具箱里面有,QQ红包挂 QQ圈圈99+ 什么的厉害功能应有尽有,来下载试试吧\nhttp://www.coolapk.com/apk/com.mtoolbox");
			shareIntent.setType("text/plain");  //设置分享列表的标题,并且每次都显示分享列表
			startActivity(Intent.createChooser(shareIntent, $("?#、、、•?&:..:?#、、:……")));
			break;
		}
	return true;
}
 
Example 20
Project: mtoolbox   File: Main.java   View source code 5 votes vote down vote up
@Override
   public void onBackPressed() {
       DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
       if (drawer.isDrawerOpen(GravityCompat.START)) {
           drawer.closeDrawer(GravityCompat.START);
       } else {
           super.onBackPressed();
       }

}
 
Example 21
Project: mtoolbox   File: Main.java   View source code 5 votes vote down vote up
private void initInstances() {
fabBtn = (FloatingActionButton) findViewById(R.id.fab);
fabBtn.setOnClickListener(new View.OnClickListener() {
		@Override
		public void onClick(View v) {
			final EditText et = new EditText(Main.this);
			AlertDialog.Builder kj=new AlertDialog.Builder(Main.this)
				.setTitle($("?#、$¥%?¥、……、%?•:•、、?•、%.$"))
				.setMessage($("?#、•、#?#.?:¥~."))
				.setView(et)
				.setNegativeButton($("?#、$¥•?•:•、、"), null)
				.setPositiveButton(
				$("?#、$¥%?#:、、~"),
				new DialogInterface.OnClickListener() {

					@Override
					public void onClick(DialogInterface p1, int p2)
					{
						String in = et.getText().toString();
						al = new StringBuilder(); 
						sendmessage(in);
                              shuaxin();
			
				}	
			
			});kj.show();	}		

	});}
 
Example 22
Project: boohee_v5.6   File: SupportMenuInflater.java   View source code 5 votes vote down vote up
public void readItem(AttributeSet attrs) {
    TypedArray a = SupportMenuInflater.this.mContext.obtainStyledAttributes(attrs, R.styleable.MenuItem);
    this.itemId = a.getResourceId(R.styleable.MenuItem_android_id, 0);
    this.itemCategoryOrder = (SupportMenu.CATEGORY_MASK & a.getInt(R.styleable.MenuItem_android_menuCategory, this.groupCategory)) | (65535 & a.getInt(R.styleable.MenuItem_android_orderInCategory, this.groupOrder));
    this.itemTitle = a.getText(R.styleable.MenuItem_android_title);
    this.itemTitleCondensed = a.getText(R.styleable.MenuItem_android_titleCondensed);
    this.itemIconResId = a.getResourceId(R.styleable.MenuItem_android_icon, 0);
    this.itemAlphabeticShortcut = getShortcut(a.getString(R.styleable.MenuItem_android_alphabeticShortcut));
    this.itemNumericShortcut = getShortcut(a.getString(R.styleable.MenuItem_android_numericShortcut));
    if (a.hasValue(R.styleable.MenuItem_android_checkable)) {
        int i;
        if (a.getBoolean(R.styleable.MenuItem_android_checkable, false)) {
            i = 1;
        } else {
            i = 0;
        }
        this.itemCheckable = i;
    } else {
        this.itemCheckable = this.groupCheckable;
    }
    this.itemChecked = a.getBoolean(R.styleable.MenuItem_android_checked, false);
    this.itemVisible = a.getBoolean(R.styleable.MenuItem_android_visible, this.groupVisible);
    this.itemEnabled = a.getBoolean(R.styleable.MenuItem_android_enabled, this.groupEnabled);
    this.itemShowAsAction = a.getInt(R.styleable.MenuItem_showAsAction, -1);
    this.itemListenerMethodName = a.getString(R.styleable.MenuItem_android_onClick);
    this.itemActionViewLayout = a.getResourceId(R.styleable.MenuItem_actionLayout, 0);
    this.itemActionViewClassName = a.getString(R.styleable.MenuItem_actionViewClass);
    this.itemActionProviderClassName = a.getString(R.styleable.MenuItem_actionProviderClass);
    boolean hasActionProvider = this.itemActionProviderClassName != null;
    if (hasActionProvider && this.itemActionViewLayout == 0 && this.itemActionViewClassName == null) {
        this.itemActionProvider = (ActionProvider) newInstance(this.itemActionProviderClassName, SupportMenuInflater.ACTION_PROVIDER_CONSTRUCTOR_SIGNATURE, SupportMenuInflater.this.mActionProviderConstructorArguments);
    } else {
        if (hasActionProvider) {
            Log.w(SupportMenuInflater.LOG_TAG, "Ignoring attribute 'actionProviderClass'. Action view already specified.");
        }
        this.itemActionProvider = null;
    }
    a.recycle();
    this.itemAdded = false;
}
 
Example 23
Project: boohee_v5.6   File: ContextThemeWrapper.java   View source code 5 votes vote down vote up
public Theme getTheme() {
    if (this.mTheme != null) {
        return this.mTheme;
    }
    if (this.mThemeResource == 0) {
        this.mThemeResource = R.style.Theme_AppCompat_Light;
    }
    initializeTheme();
    return this.mTheme;
}
 
Example 24
Project: boohee_v5.6   File: ActionBarPolicy.java   View source code 5 votes vote down vote up
public int getTabContainerHeight() {
    TypedArray a = this.mContext.obtainStyledAttributes(null, R.styleable.ActionBar, R.attr.actionBarStyle, 0);
    int height = a.getLayoutDimension(R.styleable.ActionBar_height, 0);
    Resources r = this.mContext.getResources();
    if (!hasEmbeddedTabs()) {
        height = Math.min(height, r.getDimensionPixelSize(R.dimen.abc_action_bar_stacked_max_height));
    }
    a.recycle();
    return height;
}
 
Example 25
Project: boohee_v5.6   File: MenuBuilder.java   View source code 5 votes vote down vote up
private void setShortcutsVisibleInner(boolean shortcutsVisible) {
    boolean z = true;
    if (!(shortcutsVisible && this.mResources.getConfiguration().keyboard != 1 && this.mResources.getBoolean(R.bool.abc_config_showMenuShortcutsWhenKeyboardPresent))) {
        z = false;
    }
    this.mShortcutsVisible = z;
}
 
Example 26
Project: boohee_v5.6   File: ListMenuItemView.java   View source code 5 votes vote down vote up
public ListMenuItemView(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs);
    this.mContext = context;
    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.MenuView, defStyle, 0);
    this.mBackground = a.getDrawable(R.styleable.MenuView_android_itemBackground);
    this.mTextAppearance = a.getResourceId(R.styleable.MenuView_android_itemTextAppearance, -1);
    this.mPreserveIconSpacing = a.getBoolean(R.styleable.MenuView_preserveIconSpacing, false);
    this.mTextAppearanceContext = context;
    a.recycle();
}
 
Example 27
Project: boohee_v5.6   File: ActionMenuPresenter.java   View source code 5 votes vote down vote up
public OverflowMenuButton(Context context) {
    super(context, null, R.attr.actionOverflowButtonStyle);
    setClickable(true);
    setFocusable(true);
    setVisibility(0);
    setEnabled(true);
    setOnTouchListener(new ForwardingListener(this, ActionMenuPresenter.this) {
        public ListPopupWindow getPopup() {
            if (ActionMenuPresenter.this.mOverflowPopup == null) {
                return null;
            }
            return ActionMenuPresenter.this.mOverflowPopup.getPopup();
        }

        public boolean onForwardingStarted() {
            ActionMenuPresenter.this.showOverflowMenu();
            return true;
        }

        public boolean onForwardingStopped() {
            if (ActionMenuPresenter.this.mPostedOpenRunnable != null) {
                return false;
            }
            ActionMenuPresenter.this.hideOverflowMenu();
            return true;
        }
    });
}
 
Example 28
Project: boohee_v5.6   File: ActionMenuItemView.java   View source code 5 votes vote down vote up
public ActionMenuItemView(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    Resources res = context.getResources();
    this.mAllowTextWithIcon = res.getBoolean(R.bool.abc_config_allowActionMenuItemTextWithIcon);
    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.ActionMenuItemView, defStyle, 0);
    this.mMinWidth = a.getDimensionPixelSize(R.styleable.ActionMenuItemView_android_minWidth, 0);
    a.recycle();
    this.mMaxIconSize = (int) ((32.0f * res.getDisplayMetrics().density) + 0.5f);
    setOnClickListener(this);
    setOnLongClickListener(this);
    this.mSavedPaddingLeft = -1;
}
 
Example 29
Project: boohee_v5.6   File: AppCompatPopupWindow.java   View source code 5 votes vote down vote up
public AppCompatPopupWindow(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);
    TintTypedArray a = TintTypedArray.obtainStyledAttributes(context, attrs, R.styleable.PopupWindow, defStyleAttr, 0);
    if (a.hasValue(R.styleable.PopupWindow_overlapAnchor)) {
        setSupportOverlapAnchor(a.getBoolean(R.styleable.PopupWindow_overlapAnchor, false));
    }
    setBackgroundDrawable(a.getDrawable(R.styleable.PopupWindow_android_popupBackground));
    a.recycle();
    if (VERSION.SDK_INT < 14) {
        wrapOnScrollChangedListener(this);
    }
}
 
Example 30
Project: Android-skin-support   File: SkinCompatDrawableManager.java   View source code 5 votes vote down vote up
private void checkVectorDrawableSetup(@NonNull Context context) {
    if (mHasCheckedVectorDrawableSetup) {
        // We've already checked so return now...
        return;
    }
    // Here we will check that a known Vector drawable resource inside AppCompat can be
    // correctly decoded
    mHasCheckedVectorDrawableSetup = true;
    final Drawable d = getDrawable(context, R.drawable.abc_vector_test);
    if (d == null || !isVectorDrawable(d)) {
        mHasCheckedVectorDrawableSetup = false;
        throw new IllegalStateException("This app has been built with an incorrect "
                + "configuration. Please configure your build for VectorDrawableCompat.");
    }
}
 
Example 31
Project: boohee_v5.6   File: AlertController.java   View source code 5 votes vote down vote up
public AlertController(Context context, AppCompatDialog di, Window window) {
    this.mContext = context;
    this.mDialog = di;
    this.mWindow = window;
    this.mHandler = new ButtonHandler(di);
    TypedArray a = context.obtainStyledAttributes(null, R.styleable.AlertDialog, R.attr.alertDialogStyle, 0);
    this.mAlertDialogLayout = a.getResourceId(R.styleable.AlertDialog_android_layout, 0);
    this.mButtonPanelSideLayout = a.getResourceId(R.styleable.AlertDialog_buttonPanelSideLayout, 0);
    this.mListLayout = a.getResourceId(R.styleable.AlertDialog_listLayout, 0);
    this.mMultiChoiceItemLayout = a.getResourceId(R.styleable.AlertDialog_multiChoiceItemLayout, 0);
    this.mSingleChoiceItemLayout = a.getResourceId(R.styleable.AlertDialog_singleChoiceItemLayout, 0);
    this.mListItemLayout = a.getResourceId(R.styleable.AlertDialog_listItemLayout, 0);
    a.recycle();
}
 
Example 32
Project: Android-skin-support   File: SkinCompatDrawableManager.java   View source code 5 votes vote down vote up
private ColorStateList createButtonColorStateList(@NonNull final Context context,
                                                  @ColorInt final int baseColor) {
    final int[][] states = new int[4][];
    final int[] colors = new int[4];
    int i = 0;

    final int colorControlHighlight = getThemeAttrColor(context, R.attr.colorControlHighlight);
    final int disabledColor = getDisabledThemeAttrColor(context, R.attr.colorButtonNormal);

    // Disabled state
    states[i] = SkinCompatThemeUtils.DISABLED_STATE_SET;
    colors[i] = disabledColor;
    i++;

    states[i] = SkinCompatThemeUtils.PRESSED_STATE_SET;
    colors[i] = compositeColors(colorControlHighlight, baseColor);
    i++;

    states[i] = SkinCompatThemeUtils.FOCUSED_STATE_SET;
    colors[i] = compositeColors(colorControlHighlight, baseColor);
    i++;

    // Default enabled state
    states[i] = SkinCompatThemeUtils.EMPTY_STATE_SET;
    colors[i] = baseColor;
    i++;

    return new ColorStateList(states, colors);
}
 
Example 33
Project: boohee_v5.6   File: AlertController.java   View source code 5 votes vote down vote up
private void setupTitle(ViewGroup topPanel) {
    boolean hasTextTitle = false;
    if (this.mCustomTitleView != null) {
        topPanel.addView(this.mCustomTitleView, 0, new LayoutParams(-1, -2));
        this.mWindow.findViewById(R.id.title_template).setVisibility(8);
        return;
    }
    this.mIconView = (ImageView) this.mWindow.findViewById(16908294);
    if (!TextUtils.isEmpty(this.mTitle)) {
        hasTextTitle = true;
    }
    if (hasTextTitle) {
        this.mTitleView = (TextView) this.mWindow.findViewById(R.id.alertTitle);
        this.mTitleView.setText(this.mTitle);
        if (this.mIconId != 0) {
            this.mIconView.setImageResource(this.mIconId);
            return;
        } else if (this.mIcon != null) {
            this.mIconView.setImageDrawable(this.mIcon);
            return;
        } else {
            this.mTitleView.setPadding(this.mIconView.getPaddingLeft(), this.mIconView.getPaddingTop(), this.mIconView.getPaddingRight(), this.mIconView.getPaddingBottom());
            this.mIconView.setVisibility(8);
            return;
        }
    }
    this.mWindow.findViewById(R.id.title_template).setVisibility(8);
    this.mIconView.setVisibility(8);
    topPanel.setVisibility(8);
}
 
Example 34
Project: boohee_v5.6   File: NotificationCompatImplBase.java   View source code 5 votes vote down vote up
private static <T extends Action> RemoteViews generateContentView(Context context, CharSequence contentTitle, CharSequence contentText, CharSequence contentInfo, int number, Bitmap largeIcon, CharSequence subText, boolean useChronometer, long when, List<T> actions, int[] actionsToShowInCompact, boolean showCancelButton, PendingIntent cancelButtonIntent) {
    int N;
    RemoteViews view = applyStandardTemplate(context, contentTitle, contentText, contentInfo, number, largeIcon, subText, useChronometer, when, R.layout.notification_template_media, true);
    int numActions = actions.size();
    if (actionsToShowInCompact == null) {
        N = 0;
    } else {
        N = Math.min(actionsToShowInCompact.length, 3);
    }
    view.removeAllViews(R.id.media_actions);
    if (N > 0) {
        for (int i = 0; i < N; i++) {
            if (i >= numActions) {
                throw new IllegalArgumentException(String.format("setShowActionsInCompactView: action %d out of bounds (max %d)", new Object[]{Integer.valueOf(i), Integer.valueOf(numActions - 1)}));
            }
            Context context2 = context;
            RemoteViews button = generateMediaActionButton(context2, (Action) actions.get(actionsToShowInCompact[i]));
            view.addView(R.id.media_actions, button);
        }
    }
    if (showCancelButton) {
        view.setViewVisibility(R.id.end_padder, 8);
        view.setViewVisibility(R.id.cancel_action, 0);
        view.setOnClickPendingIntent(R.id.cancel_action, cancelButtonIntent);
        view.setInt(R.id.cancel_action, "setAlpha", context.getResources().getInteger(R.integer.cancel_button_image_alpha));
    } else {
        view.setViewVisibility(R.id.end_padder, 0);
        view.setViewVisibility(R.id.cancel_action, 8);
    }
    return view;
}
 
Example 35
Project: boohee_v5.6   File: NotificationCompatImplBase.java   View source code 5 votes vote down vote up
private static RemoteViews generateMediaActionButton(Context context, Action action) {
    boolean tombstone = action.getActionIntent() == null;
    RemoteViews button = new RemoteViews(context.getPackageName(), R.layout.notification_media_action);
    button.setImageViewResource(R.id.action0, action.getIcon());
    if (!tombstone) {
        button.setOnClickPendingIntent(R.id.action0, action.getActionIntent());
    }
    if (VERSION.SDK_INT >= 15) {
        button.setContentDescription(R.id.action0, action.getTitle());
    }
    return button;
}
 
Example 36
Project: boohee_v5.6   File: NotificationCompatImplBase.java   View source code 5 votes vote down vote up
private static RemoteViews applyStandardTemplate(Context context, CharSequence contentTitle, CharSequence contentText, CharSequence contentInfo, int number, Bitmap largeIcon, CharSequence subText, boolean useChronometer, long when, int resId, boolean fitIn1U) {
    RemoteViews contentView = new RemoteViews(context.getPackageName(), resId);
    boolean showLine3 = false;
    boolean showLine2 = false;
    if (largeIcon == null || VERSION.SDK_INT < 16) {
        contentView.setViewVisibility(R.id.icon, 8);
    } else {
        contentView.setViewVisibility(R.id.icon, 0);
        contentView.setImageViewBitmap(R.id.icon, largeIcon);
    }
    if (contentTitle != null) {
        contentView.setTextViewText(R.id.title, contentTitle);
    }
    if (contentText != null) {
        contentView.setTextViewText(R.id.text, contentText);
        showLine3 = true;
    }
    if (contentInfo != null) {
        contentView.setTextViewText(R.id.info, contentInfo);
        contentView.setViewVisibility(R.id.info, 0);
        showLine3 = true;
    } else if (number > 0) {
        if (number > context.getResources().getInteger(R.integer.status_bar_notification_info_maxnum)) {
            contentView.setTextViewText(R.id.info, context.getResources().getString(R.string.status_bar_notification_info_overflow));
        } else {
            contentView.setTextViewText(R.id.info, NumberFormat.getIntegerInstance().format((long) number));
        }
        contentView.setViewVisibility(R.id.info, 0);
        showLine3 = true;
    } else {
        contentView.setViewVisibility(R.id.info, 8);
    }
    if (subText != null && VERSION.SDK_INT >= 16) {
        contentView.setTextViewText(R.id.text, subText);
        if (contentText != null) {
            contentView.setTextViewText(R.id.text2, contentText);
            contentView.setViewVisibility(R.id.text2, 0);
            showLine2 = true;
        } else {
            contentView.setViewVisibility(R.id.text2, 8);
        }
    }
    if (showLine2 && VERSION.SDK_INT >= 16) {
        if (fitIn1U) {
            contentView.setTextViewTextSize(R.id.text, 0, (float) context.getResources().getDimensionPixelSize(R.dimen.notification_subtext_size));
        }
        contentView.setViewPadding(R.id.line1, 0, 0, 0, 0);
    }
    if (when != 0) {
        if (useChronometer) {
            contentView.setViewVisibility(R.id.chronometer, 0);
            contentView.setLong(R.id.chronometer, "setBase", (SystemClock.elapsedRealtime() - System.currentTimeMillis()) + when);
            contentView.setBoolean(R.id.chronometer, "setStarted", true);
        } else {
            contentView.setViewVisibility(R.id.time, 0);
            contentView.setLong(R.id.time, "setTime", when);
        }
    }
    contentView.setViewVisibility(R.id.line3, showLine3 ? 0 : 8);
    return contentView;
}
 
Example 37
Project: boohee_v5.6   File: WindowDecorActionBar.java   View source code 5 votes vote down vote up
private void init(View decor) {
    this.mOverlayLayout = (ActionBarOverlayLayout) decor.findViewById(R.id.decor_content_parent);
    if (this.mOverlayLayout != null) {
        this.mOverlayLayout.setActionBarVisibilityCallback(this);
    }
    this.mDecorToolbar = getDecorToolbar(decor.findViewById(R.id.action_bar));
    this.mContextView = (ActionBarContextView) decor.findViewById(R.id.action_context_bar);
    this.mContainerView = (ActionBarContainer) decor.findViewById(R.id.action_bar_container);
    if (this.mDecorToolbar == null || this.mContextView == null || this.mContainerView == null) {
        throw new IllegalStateException(getClass().getSimpleName() + " can only be used " + "with a compatible window decor layout");
    }
    boolean homeAsUp;
    boolean z;
    this.mContext = this.mDecorToolbar.getContext();
    if ((this.mDecorToolbar.getDisplayOptions() & 4) != 0) {
        homeAsUp = true;
    } else {
        homeAsUp = false;
    }
    if (homeAsUp) {
        this.mDisplayHomeAsUpSet = true;
    }
    ActionBarPolicy abp = ActionBarPolicy.get(this.mContext);
    if (abp.enableHomeButtonByDefault() || homeAsUp) {
        z = true;
    } else {
        z = false;
    }
    setHomeButtonEnabled(z);
    setHasEmbeddedTabs(abp.hasEmbeddedTabs());
    TypedArray a = this.mContext.obtainStyledAttributes(null, R.styleable.ActionBar, R.attr.actionBarStyle, 0);
    if (a.getBoolean(R.styleable.ActionBar_hideOnContentScroll, false)) {
        setHideOnContentScrollEnabled(true);
    }
    int elevation = a.getDimensionPixelSize(R.styleable.ActionBar_elevation, 0);
    if (elevation != 0) {
        setElevation((float) elevation);
    }
    a.recycle();
}
 
Example 38
Project: boohee_v5.6   File: ActionBar.java   View source code 5 votes vote down vote up
public LayoutParams(@NonNull Context c, AttributeSet attrs) {
    super(c, attrs);
    this.gravity = 0;
    TypedArray a = c.obtainStyledAttributes(attrs, R.styleable.ActionBarLayout);
    this.gravity = a.getInt(R.styleable.ActionBarLayout_android_layout_gravity, 0);
    a.recycle();
}
 
Example 39
Project: boohee_v5.6   File: AppCompatDialog.java   View source code 5 votes vote down vote up
private static int getThemeResId(Context context, int themeId) {
    if (themeId != 0) {
        return themeId;
    }
    TypedValue outValue = new TypedValue();
    context.getTheme().resolveAttribute(R.attr.dialogTheme, outValue, true);
    return outValue.resourceId;
}
 
Example 40
Project: boohee_v5.6   File: ActionMenuPresenter.java   View source code 5 votes vote down vote up
public void onConfigurationChanged(Configuration newConfig) {
    if (!this.mMaxItemsSet) {
        this.mMaxItems = this.mContext.getResources().getInteger(R.integer.abc_max_action_buttons);
    }
    if (this.mMenu != null) {
        this.mMenu.onItemsChanged(true);
    }
}