本文整理匯總了Java中com.mikepenz.iconics.IconicsDrawable類的典型用法代碼示例。如果您正苦於以下問題:Java IconicsDrawable類的具體用法?Java IconicsDrawable怎麽用?Java IconicsDrawable使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
IconicsDrawable類屬於com.mikepenz.iconics包,在下文中一共展示了IconicsDrawable類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: buildAuthor
import com.mikepenz.iconics.IconicsDrawable; //導入依賴的package包/類
private void buildAuthor(Context context, MaterialAboutCard.Builder authorCardBuilder) {
authorCardBuilder.title(getString(R.string.about_author))
.addItem(new MaterialAboutActionItem.Builder()
.text(getString(R.string.about_authorname))
.subText(getString(R.string.about_country))
.icon(new IconicsDrawable(context)
.icon(GoogleMaterial.Icon.gmd_person)
.color(Color.GRAY)
.sizeDp(18))
.build())
.addItem(ConvenienceBuilder.createEmailItem(context, new IconicsDrawable(context)
.icon(GoogleMaterial.Icon.gmd_email)
.color(Color.GRAY)
.sizeDp(18), getString(R.string.about_sendemail), true, getString(R.string.about_emailaddress), ""))
.addItem(new MaterialAboutActionItem.Builder()
.text(getString(R.string.about_github))
.subText(getString(R.string.about_githubusername))
.icon(new IconicsDrawable(context)
.icon(CommunityMaterial.Icon.cmd_github_circle)
.color(Color.GRAY)
.sizeDp(18))
.setOnClickAction(ConvenienceBuilder.createWebsiteOnClickAction(context, Uri.parse("https://github.com/Jiikuy/") ))
.build());
}
示例2: buildContribute
import com.mikepenz.iconics.IconicsDrawable; //導入依賴的package包/類
private void buildContribute(Context context, MaterialAboutCard.Builder contributeCardBuilder) {
contributeCardBuilder.title(getString(R.string.about_contribute))
.addItem(new MaterialAboutActionItem.Builder()
.text(getString(R.string.about_reportissue))
.subText(getString(R.string.about_reportissuehere))
.icon(new IconicsDrawable(context)
.icon(GoogleMaterial.Icon.gmd_bug_report)
.color(Color.GRAY)
.sizeDp(18))
.setOnClickAction(ConvenienceBuilder.createWebsiteOnClickAction(context, Uri.parse("https://github.com/Jiikuy/VelocityCalculator/issues")))
.build())
.addItem(new MaterialAboutActionItem.Builder()
.text(getString(R.string.about_translate))
.subText(getString(R.string.about_translatehere))
.icon(new IconicsDrawable(context)
.icon(GoogleMaterial.Icon.gmd_translate)
.color(Color.GRAY)
.sizeDp(18))
.setOnClickAction(ConvenienceBuilder.createWebsiteOnClickAction(context, Uri.parse("https://www.poeditor.com/join/project/EIvRjgfGRO")))
.build());
}
示例3: onCreate
import com.mikepenz.iconics.IconicsDrawable; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_status);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
if (toolbar != null) {
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setHomeAsUpIndicator(
new IconicsDrawable(this)
.icon(GoogleMaterial.Icon.gmd_close)
.color(Color.WHITE)
.sizeDp(24)
);
getSupportActionBar().setElevation(0);
getSupportActionBar().setTitle("Status");
}
}
示例4: init
import com.mikepenz.iconics.IconicsDrawable; //導入依賴的package包/類
protected void init() {
Glide.with(this)
.load(imagePath)
.asBitmap()
.into(new SimpleTarget<Bitmap>(1024, 1024) {
@Override
public void onResourceReady(Bitmap bitmap, GlideAnimation anim) {
cropView.setImageBitmap(bitmap);
}
});
Drawable fabIcon = new IconicsDrawable(this)
.icon(MaterialDesignIconic.Icon.gmi_crop)
.color(Color.WHITE)
.sizeDp(50);
fabView.setImageDrawable(fabIcon);
}
示例5: initUI
import com.mikepenz.iconics.IconicsDrawable; //導入依賴的package包/類
public void initUI() {
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
info = (TextView) findViewById(R.id.progress_status_text);
progressBar = (ProgressBar) findViewById(R.id.progressbar);
errorView = (ImageView) findViewById(R.id.error_view);
viewLog = (Button) findViewById(R.id.progress_watch_log);
viewLog.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
while (SimpleFunctions.debugMessages.size() > 0) {
debugLog += SimpleFunctions.debugMessages.remove() + "\n";
}
new AlertDialog.Builder(ProgressActivity.this)
.setMessage(debugLog)
.setTitle("Debug Log")
.setPositiveButton(android.R.string.ok, null)
.show();
}
});
errorView.setImageDrawable(new IconicsDrawable(this, GoogleMaterial.Icon.gmd_warning).color(
SimpleFunctions.colorFromTheme(this, android.R.attr.textColorSecondary)).sizeDp(100));
}
示例6: onCreateOptionsMenu
import com.mikepenz.iconics.IconicsDrawable; //導入依賴的package包/類
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
final Activity activity = getActivity();
int iconColor = SimpleFunctions.colorFromTheme(activity, R.attr.menuIconColor);
if (echoarea.equals("_favorites")) {
MenuItem favItem = menu.findItem(R.id.action_favorites_remove_all);
favItem.setVisible(true);
favItem.setIcon(new IconicsDrawable(activity,
GoogleMaterial.Icon.gmd_clear_all).actionBar()
.color(iconColor));
}
if (echoarea.equals("_unread") || echoarea.equals("_search_results")) {
MenuItem action_unread_only = menu.findItem(R.id.action_display_unread_only);
action_unread_only.setVisible(false);
}
if (countMessages <= 1) menu.findItem(R.id.action_search).setVisible(false);
super.onCreateOptionsMenu(menu, inflater);
}
示例7: onCreateView
import com.mikepenz.iconics.IconicsDrawable; //導入依賴的package包/類
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_what_to_manage, container, false);
unbinder = ButterKnife.bind(this, view);
activity = getActivity();
secondaryText = SimpleFunctions.colorFromTheme(activity, android.R.attr.textColorSecondary);
final int iconSize = 40;
final GoogleMaterial.Icon icons[] = {Icon.gmd_message, Icon.gmd_folder_shared, Icon.gmd_cached};
ButterKnife.apply(buttons, new ButterKnife.Action<Button>() {
@Override
public void apply(@NonNull Button btn, int index) {
btn.setCompoundDrawablesWithIntrinsicBounds(null, new IconicsDrawable(activity, icons[index])
.sizeDp(iconSize).color(secondaryText), null, null);
btn.setCompoundDrawablePadding(iconSize);
}
});
return view;
}
示例8: initialize
import com.mikepenz.iconics.IconicsDrawable; //導入依賴的package包/類
private void initialize(Context context, AttributeSet attrs, int defStyleAttr) {
if (isInEditMode()) {
return;
}
final TypedArray a = context.obtainStyledAttributes(attrs, com.mikepenz.iconics.core.R.styleable.IconicsImageView, defStyleAttr, 0);
mColor = a.getColor(com.mikepenz.iconics.core.R.styleable.IconicsImageView_iiv_color, 0);
mSize = a.getDimensionPixelSize(com.mikepenz.iconics.core.R.styleable.IconicsImageView_iiv_size, -1);
mPadding = a.getDimensionPixelSize(com.mikepenz.iconics.core.R.styleable.IconicsImageView_iiv_padding, -1);
mContourColor = a.getColor(com.mikepenz.iconics.core.R.styleable.IconicsImageView_iiv_contour_color, 0);
mContourWidth = a.getDimensionPixelSize(com.mikepenz.iconics.core.R.styleable.IconicsImageView_iiv_contour_width, -1);
mBackgroundColor = a.getColor(com.mikepenz.iconics.core.R.styleable.IconicsImageView_iiv_background_color, 0);
mCornerRadius = a.getDimensionPixelSize(com.mikepenz.iconics.core.R.styleable.IconicsImageView_iiv_corner_radius, -1);
if (a.hasValue(com.mikepenz.iconics.core.R.styleable.IconicsImageView_iiv_icon)) {
String icon = a.getString(com.mikepenz.iconics.core.R.styleable.IconicsImageView_iiv_icon);
setAttributes(new IconicsDrawable(getContext(), icon));
}
a.recycle();
}
示例9: onCreateOptionsMenu
import com.mikepenz.iconics.IconicsDrawable; //導入依賴的package包/類
@Override
public boolean onCreateOptionsMenu(Menu menu) {
if (menu == null) {
return false;
}
mMenu = menu;
if (mComponent != null && !hasInitMenu) {
hasInitMenu = true;
getMenuInflater().inflate(R.menu.menu_icon_dialog, menu);
mShowOriginMenuItem = menu.findItem(R.id.action_show_origin_icon);
mShowOriginMenuItem.setCheckable(false);
findViewById(mShowOriginMenuItem.getItemId()).setAlpha(0);
mShowOriginMenuItem.setIcon(new IconicsDrawable(mContext, gmd_compare)
.sizeDp(24).paddingDp(2)
.color(ResourceUtil
.getAttrColor(mContext, android.R.attr.textColorSecondary))
);
}
return super.onCreateOptionsMenu(menu);
}
示例10: applyTo
import com.mikepenz.iconics.IconicsDrawable; //導入依賴的package包/類
/**
* sets an existing image to the imageView
*
* @param imageView
* @param tag used to identify imageViews and define different placeholders
* @return true if an image was set
*/
@Override
public boolean applyTo(ImageView imageView, String tag) {
if (getUri() != null) {
boolean consumed = DrawerImageLoader.getInstance().setImage(imageView, getUri(), tag);
if (!consumed) {
imageView.setImageURI(getUri());
}
} else if (getIcon() != null) {
imageView.setImageDrawable(getIcon());
} else if (getBitmap() != null) {
imageView.setImageBitmap(getBitmap());
} else if (getIconRes() != -1) {
imageView.setImageResource(getIconRes());
} else if (mIIcon != null) {
imageView.setImageDrawable(new IconicsDrawable(imageView.getContext(), mIIcon).actionBar());
} else {
imageView.setImageBitmap(null);
return false;
}
return true;
}
示例11: decideIcon
import com.mikepenz.iconics.IconicsDrawable; //導入依賴的package包/類
/**
* this only handles Drawables
*
* @param ctx
* @param iconColor
* @param tint
* @return
*/
public Drawable decideIcon(Context ctx, int iconColor, boolean tint, int paddingDp) {
Drawable icon = getIcon();
if (mIIcon != null) {
icon = new IconicsDrawable(ctx, mIIcon).color(iconColor).sizeDp(24).paddingDp(paddingDp);
} else if (getIconRes() != -1) {
icon = UIUtils.getCompatDrawable(ctx, getIconRes());
} else if (getUri() != null) {
try {
InputStream inputStream = ctx.getContentResolver().openInputStream(getUri());
icon = Drawable.createFromStream(inputStream, getUri().toString());
} catch (FileNotFoundException e) {
//no need to handle this
}
}
//if we got an icon AND we have auto tinting enabled AND it is no IIcon, tint it ;)
if (icon != null && tint && mIIcon == null) {
icon = icon.mutate();
icon.setColorFilter(iconColor, PorterDuff.Mode.SRC_IN);
}
return icon;
}
示例12: toggleSelectionList
import com.mikepenz.iconics.IconicsDrawable; //導入依賴的package包/類
/**
* helper method to toggle the collection
*
* @param ctx
*/
protected void toggleSelectionList(Context ctx) {
if (mDrawer != null) {
//if we already show the list. reset everything instead
if (mDrawer.switchedDrawerContent()) {
resetDrawerContent(ctx);
mSelectionListShown = false;
} else {
//build and set the drawer selection list
buildDrawerSelectionList();
// update the arrow image within the drawer
mAccountSwitcherArrow.setImageDrawable(new IconicsDrawable(ctx, MaterialDrawerFont.Icon.mdf_arrow_drop_up).sizeRes(R.dimen.material_drawer_account_header_dropdown).paddingRes(R.dimen.material_drawer_account_header_dropdown_padding).color(ColorHolder.color(mTextColor, ctx, R.attr.material_drawer_header_selection_text, R.color.material_drawer_header_selection_text)));
mSelectionListShown = true;
}
}
}
示例13: get
import com.mikepenz.iconics.IconicsDrawable; //導入依賴的package包/類
public static Drawable get(Context context, String name, int color, Size size){
Drawable icon=null;
if(name.startsWith("faw")){
icon = new IconicsDrawable(context)
.icon(FontAwesome.Icon.valueOf(name))
.color(color)
.sizeDp(size.value)
.paddingDp(16);
} else if(name.startsWith("gmd")){
icon = new IconicsDrawable(context)
.icon(GoogleMaterial.Icon.valueOf(name))
.color(color)
.sizeDp(size.value)
.paddingDp(16);
}
return icon;
}
示例14: onCreate
import com.mikepenz.iconics.IconicsDrawable; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_network_list);
final ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setHomeAsUpIndicator(new IconicsDrawable(this, GoogleMaterial.Icon.gmd_arrow_back).color(Color.WHITE).sizeDp(IconicsDrawable.ANDROID_ACTIONBAR_ICON_SIZE_DP).paddingDp(IconicsDrawable.ANDROID_ACTIONBAR_ICON_SIZE_PADDING_DP));
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setTitle(R.string.title_activity_network);
}
ListView List = (ListView)findViewById(R.id.network_list);
listWifiNetworks(List);
}
示例15: onCreate
import com.mikepenz.iconics.IconicsDrawable; //導入依賴的package包/類
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.preference);
ButterKnife.bind(this);
setSupportActionBar(toolbar);
if (getSupportActionBar() != null) {
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
toolbar.setNavigationIcon(new IconicsDrawable(this)
.icon(CommunityMaterial.Icon.cmd_keyboard_backspace)
.color(Color.WHITE)
.actionBar());
toolbar.setTitleTextColor(Color.WHITE);
FragmentManager manager = getFragmentManager();
FragmentTransaction transaction = manager.beginTransaction();
PreferenceFrag myPreference = new PreferenceFrag(); //宣告剛剛做好的PreferenceFragment
transaction.replace(R.id.content_wrapper, myPreference); //將content內容取代為myPreference
transaction.commit(); //送出交易
}