Search in sources :

Example 91 with ColorDrawable

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);
}
Also used : ColorDrawable(android.graphics.drawable.ColorDrawable) Button(android.widget.Button) FrameLayout(android.widget.FrameLayout) LinearLayout(android.widget.LinearLayout) MotionEvent(android.view.MotionEvent)

Example 92 with ColorDrawable

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();
        }
    }
}
Also used : Bitmap(android.graphics.Bitmap) ColorDrawable(android.graphics.drawable.ColorDrawable) LayerDrawable(android.graphics.drawable.LayerDrawable) ColorDrawable(android.graphics.drawable.ColorDrawable) Drawable(android.graphics.drawable.Drawable) BitmapDrawable(android.graphics.drawable.BitmapDrawable) LayerDrawable(android.graphics.drawable.LayerDrawable) BitmapDrawable(android.graphics.drawable.BitmapDrawable)

Example 93 with ColorDrawable

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;
}
Also used : Window(android.view.Window) ListView(android.widget.ListView) ColorDrawable(android.graphics.drawable.ColorDrawable) ScrollView(android.widget.ScrollView) Dialog(android.app.Dialog) LayoutInflater(android.view.LayoutInflater) RecyclerView(android.support.v7.widget.RecyclerView) QKTextView(com.moez.QKSMS.ui.view.QKTextView) View(android.view.View) AdapterView(android.widget.AdapterView) RecyclerView(android.support.v7.widget.RecyclerView) ScrollView(android.widget.ScrollView) ListView(android.widget.ListView)

Example 94 with ColorDrawable

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() {
        }
    });
}
Also used : SwipeBackLayout(me.imid.swipebacklayout.lib.SwipeBackLayout) ColorDrawable(android.graphics.drawable.ColorDrawable)

Example 95 with ColorDrawable

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));
    }
}
Also used : ColorDrawable(android.graphics.drawable.ColorDrawable) Point(android.graphics.Point) Point(android.graphics.Point) WindowManager(android.view.WindowManager) Display(android.view.Display)

Aggregations

ColorDrawable (android.graphics.drawable.ColorDrawable)530 View (android.view.View)113 Drawable (android.graphics.drawable.Drawable)103 BitmapDrawable (android.graphics.drawable.BitmapDrawable)69 ImageView (android.widget.ImageView)62 TextView (android.widget.TextView)55 Bitmap (android.graphics.Bitmap)52 AdapterView (android.widget.AdapterView)32 LinearLayout (android.widget.LinearLayout)32 Test (org.junit.Test)31 Canvas (android.graphics.Canvas)30 ListView (android.widget.ListView)27 FrameLayout (android.widget.FrameLayout)23 ViewGroup (android.view.ViewGroup)22 Handler (android.os.Handler)20 Paint (android.graphics.Paint)19 StateListDrawable (android.graphics.drawable.StateListDrawable)19 TransitionDrawable (android.graphics.drawable.TransitionDrawable)19 WindowManager (android.view.WindowManager)17 Intent (android.content.Intent)16