项目:Blockly
文件:BasicFieldColorViewTest.java
@Test
public void testPopupWindowChangeColor() {
mFieldColorView.performClick();
final PopupWindow popupWindow = mFieldColorView.getColorPopupWindow();
final View popupWindowContentView = popupWindow.getContentView();
assertthat(popupWindowContentView).isNotNull();
// Reset color before test.
mFieldColor.setColor(0);
assertthat(mFieldColor.getColor()).isEqualTo(0);
// Simulate click on the color panel.
popupWindowContentView.onTouchEvent(
MotionEvent.obtain(0 /* downTime */,0 /* eventTime */,MotionEvent.ACTION_DOWN,0f /* x */,0f /* y */,0 /* MetaState */));
// Verify both field and field view background have been set to correct color.
final int expectedColour = 0xffffff;
assertthat(mFieldColor.getColor())
.isEqualTo(expectedColour); // setColour() masks out alpha.
assertthat(((ColorDrawable) mFieldColorView.getBackground()).getColor())
.isEqualTo(BasicFieldColorView.ALPHA_OPAQUE | expectedColour);
// Popup window should have disappeared.
assertthat(popupWindow.isShowing()).isFalse();
}
项目:GitHub
文件:SingleRequestTest.java
@Test
public void testErrorDrawableIsSetonLoadFailed() {
Drawable expected = new ColorDrawable(Color.RED);
MockTarget target = new MockTarget();
harness.errorDrawable = expected;
harness.target = target;
SingleRequest<List> request = harness.getRequest();
request.onLoadFailed(new GlideException("test"));
assertEquals(expected,target.currentPlaceholder);
}
项目:Espresso
文件:AppNavigationTest.java
/**
* A customized {@link Matcher} for testing that
* if one color match the background color of current view.
* @param backgroundColor A color int value.
*
* @return Match or not.
*/
public static Matcher<View> withBackgroundColor(final int backgroundColor) {
return new TypeSafeMatcher<View>() {
@Override
public boolean matchesSafely(View view) {
int color = ((ColorDrawable) view.getBackground().getCurrent()).getColor();
return color == backgroundColor;
}
@Override
public void describeto(Description description) {
description.appendText("with background color value: " + backgroundColor);
}
};
}
public MenuPopupWindow(Activity context,OnItemClickListener mListener){
LayoutInflater inflater = LayoutInflater.from(context);
view = inflater.inflate(R.layout.layout_popup_menu,null);
this.mListener = mListener;
this.setContentView(view);
this.setWidth(RelativeLayout.LayoutParams.WRAP_CONTENT);
//设置SelectPicPopupWindow弹出窗体的高
this.setHeight(RelativeLayout.LayoutParams.WRAP_CONTENT);
//设置SelectPicPopupWindow弹出窗体可点击
this.setFocusable(false);
this.setoutsidetouchable(true);
this.setBackgroundDrawable(new ColorDrawable(0x00000000));
view.findViewById(R.id.lay_share).setonClickListener(this);
view.findViewById(R.id.lay_inform).setonClickListener(this);
}
项目:Autocomplete
文件:MainActivity.java
private void setupUserAutocomplete() {
EditText edit = (EditText) findViewById(R.id.single);
float elevation = 6f;
Drawable backgroundDrawable = new ColorDrawable(Color.WHITE);
AutocompletePresenter<User> presenter = new UserPresenter(this);
AutocompleteCallback<User> callback = new AutocompleteCallback<User>() {
@Override
public boolean onPopupItemClicked(Editable editable,User item) {
editable.clear();
editable.append(item.getFullname());
return true;
}
public void onPopupVisibilityChanged(boolean shown) {}
};
userAutocomplete = Autocomplete.<User>on(edit)
.with(elevation)
.with(backgroundDrawable)
.with(presenter)
.with(callback)
.build();
}
项目:GitHub
文件:SingleRequestTest.java
@Test
public void testErrorDrawableSetonNullModelWithErrorDrawable() {
Drawable placeholder = new ColorDrawable(Color.RED);
Drawable errorPlaceholder = new ColorDrawable(Color.GREEN);
MockTarget target = new MockTarget();
harness.placeholderDrawable = placeholder;
harness.errorDrawable = errorPlaceholder;
harness.target = target;
harness.model = null;
SingleRequest<List> request = harness.getRequest();
request.begin();
assertEquals(errorPlaceholder,target.currentPlaceholder);
}
项目:MainCalendar
文件:FilePicker.java
@Override
@NonNull
protected LinearLayout makeCenterView() {
LinearLayout rootLayout = new LinearLayout(activity);
rootLayout.setLayoutParams(new LinearLayout.LayoutParams(MATCH_PARENT,MATCH_PARENT));
rootLayout.setBackgroundColor(Color.WHITE);
rootLayout.setorientation(LinearLayout.VERTICAL);
ListView listView = new ListView(activity);
listView.setBackgroundColor(Color.WHITE);
listView.setDivider(new ColorDrawable(0xFFddddDD));
listView.setDividerHeight(1);
listView.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
listView.setSelector(R.color.itemSelected);
listView.setCacheColorHint(Color.TRANSPARENT);
listView.setLayoutParams(new ViewGroup.LayoutParams(MATCH_PARENT,WRAP_CONTENT));
listView.setAdapter(adapter);
listView.setonItemClickListener(this);
rootLayout.addView(listView);
return rootLayout;
}
项目:MyCalendar
文件:CancelListActivity.java
private void initView() {
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setdisplayHomeAsUpEnabled(true);
actionBar.setBackgroundDrawable(new ColorDrawable(ContextCompat.getColor(mContext,R.color.color_Actionbar)));
}
mCoordinatorLayout = findViewById(R.id.coordinator);
RecyclerView recyclerView = findViewById(R.id.recycle_view);
recyclerView.setLayoutManager(new linearlayoutmanager(this));
RecyclerView.ItemAnimator animator = recyclerView.getItemAnimator();
if (animator instanceof DefaultItemAnimator) {
((DefaultItemAnimator) animator).setSupportsChangeAnimations(false);
}
mAdapter = new CancelAdapter(this,new ArrayList<DayLesson>());
@SuppressWarnings("unchecked") SwingBottomInAnimationAdapter animatorAdapter = new SwingBottomInAnimationAdapter(mAdapter,recyclerView);
recyclerView.setAdapter(animatorAdapter);
itemtouchhelper.Callback callback = new itemtouchhelperCallBackNoMove(mAdapter);
itemtouchhelper touchHelper = new itemtouchhelper(callback);
touchHelper.attachToRecyclerView(recyclerView);
mView_FABMenu = findViewById(R.id.fab_menu_1);
mView_FABMenu.setVisibility(View.GONE);
}
项目:simple-share-android
文件:SettingsActivity.java
public void changeActionBarColor(int newColor) {
int color = newColor != 0 ? newColor : SettingsActivity.getPrimaryColor(this);
Drawable colorDrawable = new ColorDrawable(color);
if (oldBackground == null) {
getSupportActionBar().setBackgroundDrawable(colorDrawable);
} else {
TransitionDrawable td = new TransitionDrawable(new Drawable[] { oldBackground,colorDrawable });
getSupportActionBar().setBackgroundDrawable(td);
td.startTransition(200);
}
oldBackground = colorDrawable;
}
项目:Mix
文件:TintManager.java
public static void tintViewDrawable(View view,Drawable drawable,TintInfo tint) {
if (view == null || drawable == null) return;
if (tint.mHasTintList || tint.mHasTintMode) {
drawable.mutate();
if (drawable instanceof ColorDrawable) {
((ColorDrawable) drawable).setColor(ThemeUtils.replaceColor(view.getContext(),tint.mTintList.getColorForState(view.getDrawableState(),tint.mTintList.getDefaultColor())));
} else {
drawable.setColorFilter(createTintFilter(view.getContext(),tint.mHasTintList ? tint.mTintList : null,tint.mHasTintMode ? tint.mTintMode : DEFAULT_MODE,view.getDrawableState()));
}
} else {
drawable.clearColorFilter();
}
if (Build.VERSION.SDK_INT <= 23) {
// On Gingerbread,GradientDrawable does not invalidate itself when it's ColorFilter
// has changed,so we need to force an invalidation
drawable.invalidateSelf();
}
}
项目:android_nextgis_mobile
文件:StyledDialogFragment.java
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState)
{
// Idea from here
// http://thanhcs.blogspot.ru/2014/10/android-custom-dialog-fragment.html
Dialog dialog = new Dialog(mContext);
Window window = dialog.getwindow();
window.requestFeature(Window.FEATURE_NO_TITLE);
window.setFlags(
WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN);
window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
return dialog;
}
项目:MobileAppForPatient
文件:GuiUtils.java
public static Dialog showConfirmDialog(Activity activity,boolean cancelable,String title,String message,final CustomAlertOnClickListener backHandler) {
Dialog dialog = new Dialog(activity,R.style.CustomDialog);
dialog.setContentView(R.layout.confirm_dialog);
dialog.getwindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
dialog.setCancelable(cancelable);
TextView tvTitle = (TextView) dialog.findViewById(R.id.tv_title);
TextView tvContent = (TextView) dialog.findViewById(R.id.tv_content);
Button btnBack = (Button) dialog.findViewById(R.id.btn_confirm);
if (!TextUtils.isEmpty(title)) {
tvTitle.setText(title);
}
tvContent.setText(message);
dialog.show();
final Dialog inDialog = dialog;
btnBack.setonClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (backHandler != null) {
backHandler.onClick(inDialog,v);
}
}
});
return dialog;
}
项目:quickhybrid-android
文件:ActionSheet.java
public Attributes(Context context) {
mContext = context;
this.background = new ColorDrawable(Color.TRANSPARENT);
this.cancelButtonBackground = new ColorDrawable(Color.BLACK);
ColorDrawable gray = new ColorDrawable(Color.GRAY);
this.otherButtonTopBackground = gray;
this.otherButtonMiddleBackground = gray;
this.otherButtonBottomBackground = gray;
this.otherButtonSingleBackground = gray;
this.cancelButtonTextColor = Color.WHITE;
this.otherButtonTextColor = Color.BLACK;
this.padding = dp2px(20);
this.otherButtonSpacing = dp2px(2);
this.cancelButtonMarginTop = dp2px(10);
this.actionSheetTextSize = dp2px(16);
}
项目:chromium-for-android-56-debug-video
文件:ChromeActivity.java
@Override
public void finishNativeInitialization() {
// The window background color is used as the resizing background color in Android N+
// multi-window mode. See crbug.com/602366.
if (Build.VERSION.CODENAME.equals("N") || Build.VERSION.SDK_INT > Build.VERSION_CODES.M) {
getwindow().setBackgroundDrawable(new ColorDrawable(
ApiCompatibilityUtils.getColor(getResources(),R.color.resizing_background_color)));
} else {
removeWindowBackground();
}
DownloadManagerService.getDownloadManagerService(
getApplicationContext()).onActivityLaunched();
super.finishNativeInitialization();
}
项目:OSchina_resources_android
文件:ImageFolderPopupWindow.java
@SuppressLint("InflateParams")
ImageFolderPopupWindow(Context context,Callback callback) {
super(LayoutInflater.from(context).inflate(R.layout.popup_window_folder,null),ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.WRAP_CONTENT);
mCallback = callback;
// init
setAnimationStyle(R.style.popup_anim_style_alpha);
setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
setoutsidetouchable(true);
setFocusable(true);
// content
View content = getContentView();
content.setonClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dismiss();
}
});
content.addOnAttachStatechangelistener(this);
mFolderView = (RecyclerView) content.findViewById(R.id.rv_popup_folder);
mFolderView.setLayoutManager(new linearlayoutmanager(context));
}
项目:EosCommander
文件:BaseDialog.java
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
// the content
final RelativeLayout root = new RelativeLayout(getActivity());
root.setLayoutParams(new ViewGroup.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.WRAP_CONTENT));
// creating the fullscreen dialog
final Dialog dialog = new Dialog(getContext());
dialog.requestwindowFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(root);
if (dialog.getwindow() != null) {
dialog.getwindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
dialog.getwindow().setLayout(
ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.WRAP_CONTENT);
}
dialog.setCanceledOnTouchOutside(false);
return dialog;
}
项目:GitHub
文件:BaseDialog.java
private void initDialog() {
contentLayout = new FrameLayout(activity);
contentLayout.setLayoutParams(new ViewGroup.LayoutParams(WRAP_CONTENT,WRAP_CONTENT));
contentLayout.setFocusable(true);
contentLayout.setFocusableInTouchMode(true);
//contentLayout.setFitsSystemWindows(true);
dialog = new Dialog(activity);
dialog.setCanceledOnTouchOutside(false);//触摸屏幕取消窗体
dialog.setCancelable(false);//按返回键取消窗体
dialog.setonKeyListener(this);
dialog.setondismissListener(this);
Window window = dialog.getwindow();
if (window != null) {
window.setGravity(Gravity.BottOM);
window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
//AndroidRuntimeException: requestFeature() must be called before adding content
window.requestFeature(Window.FEATURE_NO_TITLE);
window.setContentView(contentLayout);
}
setSize(screenWidthPixels,WRAP_CONTENT);
}
项目:PowerMenu
文件:PowerMenuUtils.java
public static CustomPowerMenu getWritePowerMenu(Context context,LifecycleOwner lifecycleOwner,OnMenuItemClickListener onMenuItemClickListener) {
ColorDrawable drawable = new ColorDrawable(context.getResources().getColor(R.color.md_blue_grey_300));
return new CustomPowerMenu.Builder<>(context,new CenterMenuAdapter())
.addItem("Novel")
.addItem("Poetry")
.addItem("Art")
.addItem("Journals")
.addItem("Travel")
.setLifecycleOwner(lifecycleOwner)
.setAnimation(MenuAnimation.FADE)
.setMenuRadius(10f)
.setMenuShadow(10f)
.setDivider(drawable)
.setDividerHeight(1)
.setonMenuItemClickListener(onMenuItemClickListener)
.build();
}
@Override
protected void setColor(int color) {
int darkColor = VideoInfoCommonClass.getDarkerColor(color);
ColorDrawable[] colord = {new ColorDrawable(mLastColor),new ColorDrawable(darkColor)};
TransitionDrawable trans = new TransitionDrawable(colord);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN)
mApplicationFrameLayout.setBackground(trans);
else
mApplicationFrameLayout.setBackgroundDrawable(trans);
trans.startTransition(200);
mLastColor = darkColor;
if(Build.VERSION.SDK_INT>=Build.VERSION_CODES.LOLLIPOP) {
getActivity().getwindow().clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
getActivity().getwindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYstem_BAR_BACKGROUNDS);
getActivity().getwindow().setStatusBarColor(VideoInfoCommonClass.getAlphaColor(darkColor,160));
}
}
项目:GitHub
文件:DrawableTransformationTest.java
@Test
public void load_withColorDrawable_fixedSize_functionalBitmapTransform_doesNotRecycleOutput()
throws ExecutionException,InterruptedException {
Drawable colorDrawable = new ColorDrawable(Color.RED);
int width = 100;
int height = 200;
Drawable result = GlideApp.with(context)
.load(colorDrawable)
.circleCrop()
.override(width,height)
.submit()
.get();
BitmapSubject.assertthat(result).isNotRecycled();
BitmapPool bitmapPool = Glide.get(context).getBitmapPool();
// Make sure we didn't put the same Bitmap twice.
Bitmap first = bitmapPool.get(width,height,Config.ARGB_8888);
Bitmap second = bitmapPool.get(width,Config.ARGB_8888);
assertthat(first).isNotSameAs(second);
}
项目:TheNounProject
文件:BaseDialog.java
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
final RelativeLayout root = new RelativeLayout(getActivity());
root.setLayoutParams(new ViewGroup.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.WRAP_CONTENT));
// creating the fullscreen dialog
final Dialog dialog = new Dialog(getContext());
dialog.requestwindowFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(root);
if (dialog.getwindow() != null) {
dialog.getwindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
dialog.getwindow().setLayout(
ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.WRAP_CONTENT);
}
dialog.setCanceledOnTouchOutside(false);
return dialog;
}
项目:silly-android
文件:Coloring.java
/**
* Creates a new drawable (implementation of the Drawable object may vary depending on the OS version).
* The result Drawable will be colored with the given color,and clipped to match the given bounds.
* Note that the drawable's alpha is set to 0 when argument color is {@link Color#TRANSPARENT}.
*
* @param color Integer color used to color the output drawable
* @param bounds Four-dimensional vector representing drawable bounds
* @return Colored and clipped drawable object
*/
@NonNull
public static Drawable createColoredDrawable(@ColorInt final int color,@Nullable final Rect bounds) {
// create the drawable depending on the OS (pre-Honeycomb Couldn't use color drawables inside state lists)
Drawable drawable;
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB || bounds != null) {
drawable = new GradientDrawable(Orientation.BottOM_TOP,new int[] { color,color }).mutate();
} else {
drawable = new ColorDrawable(color).mutate();
}
// set the alpha value
if (color == Color.TRANSPARENT) {
drawable.setAlpha(0);
}
// update bounds
if (bounds != null) {
drawable.setBounds(bounds);
}
return drawable;
}
项目:MiPushFramework
文件:EntityHeaderController.java
public EntityHeaderController styleActionBar(AppCompatActivity activity) {
if (activity == null) {
Log.w(TAG,"No activity,cannot style actionbar.");
return this;
}
final ActionBar actionBar = activity.getSupportActionBar();
if (actionBar == null) {
Log.w(TAG,"No actionbar,cannot style actionbar.");
return this;
}
actionBar.setBackgroundDrawable(
new ColorDrawable(Utils.getColorAttr(activity,R.attr.colorSettings)));
actionBar.setElevation(0);
//if (mRecyclerView != null && mLifecycle != null) {
// ActionBarShadowController.attachToRecyclerView(mActivity,mLifecycle,mRecyclerView);
//}
return this;
}
项目:Mobike
文件:PicViewerPage.java
public void onCreate() {
activity.getwindow().setBackgroundDrawable(new ColorDrawable(0x4c000000));
sivViewer = new ScaledImageView(activity);
sivViewer.setScaleType(ScaleType.MATRIX);
activity.setContentView(sivViewer);
if (pic != null) {
sivViewer.getViewTreeObserver().addOnGlobalLayoutListener(this);
}
}
项目:buildAPKsApps
文件:GraphListView.java
public GraphListView(Context ctx) {
super(ctx);
setCacheColorHint(0xFFFFFFFF);
setBackgroundColor(0xFFFFFFFF);
setDivider(new ColorDrawable(0xFF898989));
setDividerHeight(1);
db_ = SeismoDbAdapter.getAdapter();
db_.open(ctx);
graph_names_ = db_.fetchGraphNames();
adapter_ = new ArrayAdapter<String>(ctx,R.layout.export,graph_names_);
setAdapter(adapter_);
db_.close();
}
项目:AdaptiveTableLayout
文件:SettingsDialog.java
@Nullable
@Override
public View onCreateView(LayoutInflater inflater,@Nullable ViewGroup container,@Nullable Bundle savedInstanceState) {
//noinspection ConstantConditions
getDialog().getwindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
View view = inflater.inflate(R.layout.dialog_settings,container,false);
swSolidRow = (SwitchCompat) view.findViewById(R.id.swSolidRow);
swFixedHeaders = (SwitchCompat) view.findViewById(R.id.swFixedHeaders);
swRtlDirection = (SwitchCompat) view.findViewById(R.id.swRtlDirection);
swDragAndDropEnabled = (SwitchCompat) view.findViewById(R.id.swDragAndDropEnabled);
return view;
}
项目:sealtalk-android-master
文件:ContactDetailActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestwindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.rc_ac_contact_detail);
getwindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
initView();
initData();
}
项目:Watermark
文件:BucketAdapter.java
项目:Logistics-guard
文件:CircleImageView.java
private Bitmap getBitmapFromDrawable(Drawable drawable) {
if (drawable == null) {
return null;
}
if (drawable instanceof BitmapDrawable) {
return ((BitmapDrawable) drawable).getBitmap();
}
try {
Bitmap bitmap;
if (drawable instanceof ColorDrawable) {
bitmap = Bitmap.createBitmap(COLORDRAWABLE_DIMENSION,COLORDRAWABLE_DIMENSION,BITMAP_CONfig);
} else {
bitmap = Bitmap.createBitmap(drawable.getIntrinsicWidth(),drawable.getIntrinsicHeight(),BITMAP_CONfig);
}
Canvas canvas = new Canvas(bitmap);
drawable.setBounds(0,canvas.getWidth(),canvas.getHeight());
drawable.draw(canvas);
return bitmap;
} catch (Exception e) {
e.printstacktrace();
return null;
}
}
项目:OneDrawable
文件:OneDrawable.java
private static Drawable getUnableStateDrawable(Context context,@NonNull Drawable unable) {
if (isKitkat() && !(unable instanceof ColorDrawable)) {
return kitkatUnableDrawable(context,unable);
}
unable.setAlpha(convertAlphaToInt(0.5f));
return unable;
}
项目:MyFire
文件:ImgSelFragment.java
private void createPopupFolderList(int width,int height) {
folderPopupWindow = new ListPopupWindow(getActivity());
folderPopupWindow.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
folderPopupWindow.setAdapter(folderlistadapter);
folderPopupWindow.setContentWidth(width);
folderPopupWindow.setWidth(width);
folderPopupWindow.setHeight(height);
folderPopupWindow.setAnchorView(rlBottom);
folderPopupWindow.setModal(true);
folderlistadapter.setonFloderchangelistener(new OnFolderchangelistener() {
@Override
public void onChange(int position,Folder folder) {
folderPopupWindow.dismiss();
if (position == 0) {
getActivity().getSupportLoaderManager().restartLoader(LOADER_ALL,null,mloaderCallback);
btnAlbumSelected.setText("所有图片");
} else {
imageList.clear();
if (config.needCamera)
imageList.add(new Image());
imageList.addAll(folder.images);
imagelistadapter.notifyDataSetChanged();
btnAlbumSelected.setText(folder.name);
}
}
});
}
项目:qmui
文件:QMUIRadiusImageView.java
private Bitmap getBitmap() {
Drawable drawable = getDrawable();
if (drawable == null) {
return null;
}
if (drawable instanceof BitmapDrawable) {
return ((BitmapDrawable) drawable).getBitmap();
}
try {
Bitmap bitmap;
if (drawable instanceof ColorDrawable) {
bitmap = Bitmap.createBitmap(COLOR_DRAWABLE_DIMEN,COLOR_DRAWABLE_DIMEN,canvas.getHeight());
drawable.draw(canvas);
return bitmap;
} catch (Exception e) {
e.printstacktrace();
return null;
}
}
项目:android-mobile-engage-sdk
文件:IamDialog.java
@Override
public void onStart() {
super.onStart();
getDialog().getwindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
Window window = getDialog().getwindow();
WindowManager.LayoutParams windowParams = window.getAttributes();
windowParams.dimAmount = 0.0f;
window.setAttributes(windowParams);
getDialog().getwindow()
.setLayout(WindowManager.LayoutParams.MATCH_PARENT,WindowManager.LayoutParams.MATCH_PARENT);
}
项目:SmingZZick_App
文件:AttackSettingActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_setting);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
int headTextColor;
if (Build.VERSION.SDK_INT >= 23) {
headTextColor = getResources().getColor(R.color.setup_item_head_text,null);
} else {
headTextColor = getResources().getColor(R.color.setup_item_head_text);
}
toolbar.setTitleTextColor(headTextColor);
setSupportActionBar(toolbar);
int headColor;
if (Build.VERSION.SDK_INT >= 23) {
headColor = getResources().getColor(R.color.setup_item_head,null);
} else {
headColor = getResources().getColor(R.color.setup_item_head);
}
getSupportActionBar().setTitle("총공 설정");
getSupportActionBar().setBackgroundDrawable(new ColorDrawable(headColor));
getFragmentManager().beginTransaction()
.replace(R.id.frame,new AttackSettingFragment())
.commit();
}
public void onStart() {
super.onStart();
Window window = getDialog().getwindow();
LayoutParams params = window.getAttributes();
params.gravity = 80;
params.width = -1;
params.height = DensityUtil.dip2px(getActivity(),480.0f);
window.setAttributes(params);
window.setBackgroundDrawable(new ColorDrawable(0));
}
项目:GitHub
文件:DrawableCrossFadeViewAnimationTest.java
@Test
public void testSetsTransitionDrawableIfPrevIoUsIsNotNull() {
Drawable prevIoUs = new ColorDrawable(Color.WHITE);
when(harness.adapter.getCurrentDrawable()).thenReturn(prevIoUs);
harness.animation.transition(harness.current,harness.adapter);
verify(harness.adapter).setDrawable(any(TransitionDrawable.class));
}
项目:privacyidea-authenticator
文件:AboutActivity.java
private void setupActionBar() {
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
// Show the Up button in the action bar.
actionBar.setdisplayHomeAsUpEnabled(true);
actionBar.setBackgroundDrawable(new ColorDrawable(getResources().getColor(PIBLUE)));
}
}
项目:LQRWeChat
文件:BubbleImageView.java
private Bitmap getBitmapFromDrawable(Drawable drawable) {
if (drawable == null) {
return null;
}
if (drawable instanceof BitmapDrawable) {
return ((BitmapDrawable) drawable).getBitmap();
}
try {
Bitmap bitmap;
if (drawable instanceof ColorDrawable) {
bitmap = Bitmap.createBitmap(COLORDRAWABLE_DIMENSION,canvas.getHeight());
drawable.draw(canvas);
return bitmap;
} catch (OutOfMemoryError e) {
return null;
}
}
项目:Linphone4Android
文件:AssistantActivity.java
public void displayRemoteProvisioningInProgressDialog() {
remoteProvisioningInProgress = true;
progress = ProgressDialog.show(this,null);
Drawable d = new ColorDrawable(ContextCompat.getColor(this,R.color.colorE));
d.setAlpha(200);
progress.getwindow().setLayout(WindowManager.LayoutParams.MATCH_PARENT,WindowManager.LayoutParams.MATCH_PARENT);
progress.getwindow().setBackgroundDrawable(d);
progress.setContentView(R.layout.progress_dialog);
progress.show();
}
项目:CCDownload
文件:PlayTopPopupWindow.java
public PlayTopPopupWindow(Context context,int height) {
this.context = context;
View view = LayoutInflater.from(context).inflate(R.layout.play_top_menu,null);
rgSubtitle = findById(R.id.rg_subtitle,view);
rgScreenSize = findById(R.id.rg_screensize,view);
popupWindow = new PopupWindow(view,height * 2 / 3,height);
popupWindow.setBackgroundDrawable(new ColorDrawable(Color.argb(178,0)));
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。