本文整理汇总了Java中com.r0adkll.postoffice.model.Design类的典型用法代码示例。如果您正苦于以下问题:Java Design类的具体用法?Java Design怎么用?Java Design使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Design类属于com.r0adkll.postoffice.model包,在下文中一共展示了Design类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import com.r0adkll.postoffice.model.Design; //导入依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
Stamp stamp = new Stamp.Builder(this)
.setDesign(Design.MATERIAL_LIGHT)
.setThemeColorResource(R.color.blue_500)
.setShowKeyboardOnLaunch(true)
.setCanceledOnTouchOutside(true)
.setCancelable(true)
.setIcon(R.drawable.ic_launcher)
.build();
PostOffice.lick(stamp);
}
示例2: onCreate
import com.r0adkll.postoffice.model.Design; //导入依赖的package包/类
@Override
public void onCreate() {
if(BuildConfig.DEBUG){
Timber.plant(new Timber.DebugTree());
Timber.plant(new CrashlyticsTree(this));
}else{
Timber.plant(new CrashlyticsTree(this));
}
// Initialize PostOffice
PostOffice.lick(new Stamp.Builder(this)
.setCancelable(true)
.setCanceledOnTouchOutside(true)
.setDesign(Design.MATERIAL_LIGHT)
.setThemeColorResource(R.color.accent)
.build());
// Intialize Ollie
Ollie.with(this)
.setName(DB_NAME)
.setVersion(DB_VERSION)
.setLogLevel(BuildConfig.DEBUG ? Ollie.LogLevel.FULL : Ollie.LogLevel.NONE)
.init();
// Build and Inject Dagger Object Graph
buildObjectGraphAndInject();
}
示例3: onActionItemClicked
import com.r0adkll.postoffice.model.Design; //导入依赖的package包/类
@Override
public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
switch (item.getItemId()){
case R.id.action_delete:
// Get the list of selected items
SparseArray<Video> checked = getSelectedItems();
// Remove all from array of list, then delete the item
for(int i=0; i<checked.size(); i++){
mVideos.remove(checked.valueAt(i));
}
mAdapter.notifyDataSetChanged();
// Delete them
mPresenter.deleteVideos(checked);
mode.finish();
return true;
case R.id.action_info:
SparseArray<Video> items = getSelectedItems();
if(items.size() == 1){
Video vid = items.valueAt(0);
// Show dialog with information about the video
// Get Metadata on video
File videoFile = new File(vid.file);
PostOffice.newMail(HomeActivity.this)
.setDesign(Design.MATERIAL_LIGHT)
.setTitle(videoFile.getName())
.setMessage(Tools.getFormattedVideoMetadata(vid.file))
.show(getFragmentManager());
}
mode.finish();
return true;
}
return false;
}
示例4: applyDesign
import com.r0adkll.postoffice.model.Design; //导入依赖的package包/类
/**
* Apply a design to the style
* @param design the design, i.e. Holo, Material, Light, Dark
*/
@Override
public void applyDesign(Design design, int themeColor) {
Context ctx = mInputField.getContext();
int smallPadId = design.isMaterial() ? R.dimen.default_margin : R.dimen.default_margin_small;
int largePadId = design.isMaterial() ? R.dimen.material_edittext_spacing : R.dimen.default_margin_small;
int padLR = ctx.getResources().getDimensionPixelSize(largePadId);
int padTB = ctx.getResources().getDimensionPixelSize(smallPadId);
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
params.setMargins(padLR, padTB, padLR, padTB);
mInputField.setLayoutParams(params);
if(design.isLight())
mInputField.setTextColor(mInputField.getResources().getColor(R.color.background_material_dark));
else
mInputField.setTextColor(mInputField.getResources().getColor(R.color.background_material_light));
Drawable drawable;
if(design.isMaterial()) {
drawable = mInputField.getResources().getDrawable(R.drawable.edittext_mtrl_alpha);
}else{
drawable = mInputField.getBackground();
}
drawable.setColorFilter(themeColor, PorterDuff.Mode.SRC_ATOP);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN)
mInputField.setBackground(drawable);
else
mInputField.setBackgroundDrawable(drawable);
}
示例5: applyDesign
import com.r0adkll.postoffice.model.Design; //导入依赖的package包/类
@Override
public void applyDesign(Design design, int themeColor) {
if(!design.isMaterial()){
mContainer.removeView(mSeperator);
}else{
if(design.isLight()){
mSeperator.setBackgroundResource(R.color.grey_400);
}else{
mSeperator.setBackgroundResource(R.color.grey_800);
}
}
}
示例6: newSimpleListMail
import com.r0adkll.postoffice.model.Design; //导入依赖的package包/类
/**
* Create a new Simple List Dialog
*
* @param ctx the application context
* @param title the dialog title
* @param design the dialog design
* @param contents the list of CharSequence for the contents
* @param listener the acceptance listener that gets called when the user selects an item
* @return the new Delivery
*/
public static Delivery newSimpleListMail(@NotNull Context ctx, CharSequence title, Design design, CharSequence[] contents, ListStyle.OnItemAcceptedListener<CharSequence> listener){
ArrayAdapter<CharSequence> adapterHolo = new ArrayAdapter<>(ctx, android.R.layout.simple_list_item_1, contents);
ArrayAdapter<CharSequence> adapterMtrl = new ArrayAdapter<>(ctx, design.isLight() ? R.layout.simple_listitem_mtrl_light : R.layout.simple_listitem_mtrl_dark, contents);
return newMail(ctx)
.setTitle(title)
.setDesign(design)
.setStyle(new ListStyle.Builder(ctx)
.setDividerHeight(design.isMaterial() ? 0 : 2)
.setOnItemAcceptedListener(listener)
.build(design.isMaterial() ? adapterMtrl : adapterHolo))
.build();
}
示例7: applyDesign
import com.r0adkll.postoffice.model.Design; //导入依赖的package包/类
/**
* Apply the design of a delivery to this style
*
* @param design the design, i.e. Holo, Material, Light, Dark
* @param themeColor the theme color
*/
@Override
public void applyDesign(Design design, int themeColor) {
if(mProgressStyle == HORIZONTAL) {
LayerDrawable drawable = (LayerDrawable) mLayout.getResources().getDrawable(R.drawable.progress_material_horizontal);
Drawable bg = drawable.getDrawable(0);
int color = design.isLight() ? R.color.grey_700 : R.color.grey_500;
bg.setColorFilter(mLayout.getResources().getColor(color), PorterDuff.Mode.SRC_ATOP);
Drawable secProg = drawable.getDrawable(1);
secProg.setColorFilter(lighten(themeColor), PorterDuff.Mode.SRC_ATOP);
Drawable prg = drawable.getDrawable(2);
prg.setColorFilter(themeColor, PorterDuff.Mode.SRC_ATOP);
mProgress.setProgressDrawable(drawable);
// Style the indeterminate drawable color
Drawable animDrawable = mProgress.getIndeterminateDrawable();
animDrawable.setColorFilter(themeColor, PorterDuff.Mode.SRC_ATOP);
}
if(design.isLight()){
mProgressText.setTextColor(mLayout.getResources().getColor(R.color.tertiary_text_material_light));
mProgressMax.setTextColor(mLayout.getResources().getColor(R.color.tertiary_text_material_light));
}else{
mProgressText.setTextColor(mLayout.getResources().getColor(R.color.tertiary_text_material_dark));
mProgressMax.setTextColor(mLayout.getResources().getColor(R.color.tertiary_text_material_dark));
}
if(design.isMaterial()){
FontLoader.applyTypeface(mProgressText, Types.ROBOTO_MEDIUM);
FontLoader.applyTypeface(mProgressMax, Types.ROBOTO_MEDIUM);
}
// Style the progress message if available
TextView progressMessage = (TextView) mLayout.findViewById(R.id.progress_mesage);
if(progressMessage != null){
if(design.isMaterial()){
LinearLayout progressContainer = (LinearLayout) mLayout.findViewById(R.id.progress_container);
progressContainer.removeView(progressMessage);
LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) progressMessage.getLayoutParams();
CharSequence text = progressMessage.getText();
if(design.isLight()){
progressMessage = new TextView(mCtx, null, R.style.Widget_PostOffice_Material_Light_Dialog_Message);
}else{
progressMessage = new TextView(mCtx, null, R.style.Widget_PostOffice_Material_Dark_Dialog_Message);
}
// Re Update
progressMessage.setText(text);
// Set the roboto font
FontLoader.applyTypeface(progressMessage, Types.ROBOTO_REGULAR);
// Add it back to the layout
progressContainer.addView(progressMessage, params);
}
}
}
示例8: applyDesign
import com.r0adkll.postoffice.model.Design; //导入依赖的package包/类
/**
* Apply the design of the delivery to this style
*
* @param design the design, i.e. Holo, Material, Light, Dark
*/
public void applyDesign(Design design, int themeColor);