use of android.graphics.drawable.ColorDrawable in project nmid-headline by miao1007.
the class PlatformListPage method initPageView.
private void initPageView() {
flPage = new FrameLayout(getContext());
flPage.setOnClickListener(this);
flPage.setBackgroundDrawable(new ColorDrawable(0x55000000));
// container of the platform gridview
llPage = new LinearLayout(getContext()) {
public boolean onTouchEvent(MotionEvent event) {
return true;
}
};
llPage.setOrientation(LinearLayout.VERTICAL);
llPage.setBackgroundDrawable(new ColorDrawable(0xffffffff));
FrameLayout.LayoutParams lpLl = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.WRAP_CONTENT);
lpLl.gravity = Gravity.BOTTOM;
llPage.setLayoutParams(lpLl);
flPage.addView(llPage);
// gridview
grid = new PlatformGridView(getContext());
grid.setEditPageBackground(getBackgroundView());
LinearLayout.LayoutParams lpWg = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
grid.setLayoutParams(lpWg);
llPage.addView(grid);
// cancel button
btnCancel = new Button(getContext());
btnCancel.setTextColor(0xff3a65ff);
btnCancel.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 20);
int resId = getStringRes(getContext(), "cancel");
if (resId > 0) {
btnCancel.setText(resId);
}
btnCancel.setPadding(0, 0, 0, com.mob.tools.utils.R.dipToPx(getContext(), 5));
resId = getBitmapRes(getContext(), "classic_platform_corners_bg");
if (resId > 0) {
btnCancel.setBackgroundResource(resId);
} else {
btnCancel.setBackgroundDrawable(new ColorDrawable(0xffffffff));
}
LinearLayout.LayoutParams lpBtn = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, com.mob.tools.utils.R.dipToPx(getContext(), 45));
int dp_10 = com.mob.tools.utils.R.dipToPx(getContext(), 10);
lpBtn.setMargins(dp_10, dp_10, dp_10, dp_10);
btnCancel.setLayoutParams(lpBtn);
llPage.addView(btnCancel);
}
use of android.graphics.drawable.ColorDrawable in project nmid-headline by miao1007.
the class EditPage method genBackground.
private void genBackground() {
background = new ColorDrawable(DIM_COLOR);
if (backgroundView != null) {
try {
Bitmap bgBm = captureView(backgroundView, backgroundView.getWidth(), backgroundView.getHeight());
bgBm = blur(bgBm, 20, 8);
BitmapDrawable blurBm = new BitmapDrawable(activity.getResources(), bgBm);
background = new LayerDrawable(new Drawable[] { blurBm, background });
} catch (Throwable e) {
e.printStackTrace();
}
}
}
use of android.graphics.drawable.ColorDrawable in project qksms by moezbhatti.
the class QKDialog method onCreateDialog.
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
Dialog dialog = new Dialog(mContext);
Window window = dialog.getWindow();
window.requestFeature(Window.FEATURE_NO_TITLE);
window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
LayoutInflater inflater = getActivity().getLayoutInflater();
View view = inflater.inflate(R.layout.dialog_material, null);
if (mTitleEnabled || mMessageEnabled) {
mContentPanel = (LinearLayout) view.findViewById(R.id.contentPanel);
mContentPanel.setVisibility(View.VISIBLE);
}
if (mTitleEnabled) {
mTitleView = (QKTextView) view.findViewById(R.id.alertTitle);
mTitleView.setVisibility(View.VISIBLE);
mTitleView.setText(mTitleText);
Log.d(TAG, "title enabled");
}
if (mMessageEnabled) {
mMessageView = (QKTextView) view.findViewById(R.id.message);
mMessageView.setVisibility(View.VISIBLE);
mMessageView.setText(mMessageText);
}
if (mCustomViewEnabled) {
mCustomPanel = (LinearLayout) view.findViewById(R.id.customPanel);
mCustomPanel.setVisibility(View.VISIBLE);
if (mCustomView instanceof ListView || mCustomView instanceof RecyclerView) {
mCustomPanel.addView(mCustomView);
} else {
ScrollView scrollView = new ScrollView(mContext);
scrollView.addView(mCustomView);
mCustomPanel.addView(scrollView);
}
}
if (mPositiveButtonEnabled || mNegativeButtonEnabled) {
mButtonBar = (LinearLayout) view.findViewById(R.id.buttonPanel);
mButtonBar.setVisibility(View.VISIBLE);
mButtonBar.setOrientation(mButtonBarOrientation);
}
if (mPositiveButtonEnabled) {
mPositiveButtonView = (QKTextView) view.findViewById(R.id.buttonPositive);
mPositiveButtonView.setVisibility(View.VISIBLE);
mPositiveButtonView.setText(mPositiveButtonText);
mPositiveButtonView.setOnClickListener(mPositiveButtonClickListener);
LiveViewManager.registerView(QKPreference.THEME, mPositiveButtonView, key -> {
mPositiveButtonView.setTextColor(ThemeManager.getColor());
});
}
if (mNeutralButtonEnabled) {
mNeutralButtonView = (QKTextView) view.findViewById(R.id.buttonNeutral);
mNeutralButtonView.setVisibility(View.VISIBLE);
mNeutralButtonView.setText(mNeutralButtonText);
mNeutralButtonView.setOnClickListener(mNeutralButtonClickListener);
}
if (mNegativeButtonEnabled) {
mNegativeButtonView = (QKTextView) view.findViewById(R.id.buttonNegative);
mNegativeButtonView.setVisibility(View.VISIBLE);
mNegativeButtonView.setText(mNegativeButtonText);
mNegativeButtonView.setOnClickListener(mNegativeButtonClickListener);
}
dialog.setContentView(view);
return dialog;
}
use of android.graphics.drawable.ColorDrawable in project SwipeBackLayout by ikew0ng.
the class SwipeBackActivityHelper method onActivityCreate.
@SuppressWarnings("deprecation")
public void onActivityCreate() {
mActivity.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
mActivity.getWindow().getDecorView().setBackgroundDrawable(null);
mSwipeBackLayout = (SwipeBackLayout) LayoutInflater.from(mActivity).inflate(me.imid.swipebacklayout.lib.R.layout.swipeback_layout, null);
mSwipeBackLayout.addSwipeListener(new SwipeBackLayout.SwipeListener() {
@Override
public void onScrollStateChange(int state, float scrollPercent) {
}
@Override
public void onEdgeTouch(int edgeFlag) {
Utils.convertActivityToTranslucent(mActivity);
}
@Override
public void onScrollOverThreshold() {
}
});
}
use of android.graphics.drawable.ColorDrawable in project Talon-for-Twitter by klinker24.
the class Compose method setUpWindow.
public void setUpWindow() {
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND, WindowManager.LayoutParams.FLAG_DIM_BEHIND);
// Params for the window.
// You can easily set the alpha and the dim behind the window from here
WindowManager.LayoutParams params = getWindow().getAttributes();
// lower than one makes it more transparent
params.alpha = 1.0f;
// set it higher if you want to dim behind the window
params.dimAmount = .6f;
getWindow().setAttributes(params);
getWindow().setBackgroundDrawable(new ColorDrawable(getResources().getColor(android.R.color.transparent)));
// Gets the display size so that you can set the window to a percent of that
Display display = getWindowManager().getDefaultDisplay();
Point size = new Point();
display.getSize(size);
int width = size.x;
int height = size.y;
// You could also easily used an integer value from the shared preferences to set the percent
if (height > width) {
getWindow().setLayout((int) (width * .9), (int) (height * .9));
} else {
getWindow().setLayout((int) (width * .7), (int) (height * .8));
}
}
Aggregations