Search in sources :

Example 16 with ColorDrawable

use of android.graphics.drawable.ColorDrawable in project android_frameworks_base by ParanoidAndroid.

the class ColoredRectsActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getWindow().setBackgroundDrawable(new ColorDrawable(0xff000000));
    FrameLayout frame = new FrameLayout(this);
    final RectsView gpuView = new RectsView(this, 0, Color.GREEN);
    frame.addView(gpuView);
    final RectsView swView = new RectsView(this, 400, Color.RED);
    swView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
    frame.addView(swView);
    final RectsView hwBothView = new RectsView(this, 850, Color.GREEN);
    // Don't actually need to render to a hw layer, but it's a good sanity-check that
    // we're rendering to/from layers correctly
    hwBothView.setLayerType(View.LAYER_TYPE_HARDWARE, null);
    frame.addView(hwBothView);
    final RectsView swBothView = new RectsView(this, 854, Color.RED);
    swBothView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
    frame.addView(swBothView);
    setContentView(frame);
}
Also used : ColorDrawable(android.graphics.drawable.ColorDrawable) FrameLayout(android.widget.FrameLayout)

Example 17 with ColorDrawable

use of android.graphics.drawable.ColorDrawable in project mounts2sd by SpazeDog.

the class ActivityAppSettings method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    mPreferences = Preferences.getInstance((Context) this);
    setTheme(mPreferences.theme());
    super.onCreate(savedInstanceState);
    LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    ExtendedLayout layoutOuter = (ExtendedLayout) inflater.inflate(R.layout.activity_app_settings, null);
    if (mPreferences.applicationSettings.use_tablet_settings() || getResources().getString(R.string.config_screen_type).equals("xlarge")) {
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        getWindow().setBackgroundDrawable(new ColorDrawable(0));
        layoutOuter.setOnMeasure(this);
        setContentView(layoutOuter, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT));
    } else {
        ViewGroup layout = (ViewGroup) ((ViewGroup) layoutOuter.getChildAt(0)).getChildAt(0);
        ((ViewGroup) layoutOuter.getChildAt(0)).removeView(layout);
        setContentView(layout, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT));
    }
    mCheckboxTheme = (LinearLayout) findViewById(R.id.settings_style_item_theme);
    mCheckboxTheme.setOnTouchListener(new ViewEventHandler(this));
    mCheckboxLayout = (LinearLayout) findViewById(R.id.settings_style_item_layout);
    mCheckboxLayout.setOnTouchListener(new ViewEventHandler(this));
    mCheckboxDialog = (LinearLayout) findViewById(R.id.settings_style_item_dialog);
    if (getResources().getString(R.string.config_screen_type).equals("normal")) {
        mCheckboxDialog.setOnTouchListener(new ViewEventHandler(this));
    } else {
        Utils.removeView(mCheckboxDialog, false);
    }
    mCheckboxBusybox = (LinearLayout) findViewById(R.id.settings_general_item_busybox);
    if (mPreferences.deviceSetup.environment_multiple_binaries() && mPreferences.isUserOwner()) {
        mCheckboxBusybox.setOnTouchListener(new ViewEventHandler(this));
    } else {
        mCheckboxBusybox.setEnabled(false);
    }
    mTextScriptButton = (TextView) findViewById(R.id.settings_script_item_button);
    if (mPreferences.isUserOwner()) {
        mTextScriptButton.setOnTouchListener(new ViewEventHandler(this));
    } else {
        mTextScriptButton.setEnabled(false);
    }
    mViewSqlite = (LinearLayout) findViewById(R.id.settings_general_item_sqlite);
    if (mPreferences.isUserOwner()) {
        mViewSqlite.setOnTouchListener(new ViewEventHandler(this));
    } else {
        mViewSqlite.setEnabled(false);
    }
    mTextScriptInstalled = (TextView) findViewById(R.id.settings_script_item_installed);
    mTextScriptBundled = (TextView) findViewById(R.id.settings_script_item_bundled);
    handleViewContent();
}
Also used : Context(android.content.Context) ColorDrawable(android.graphics.drawable.ColorDrawable) ViewEventHandler(com.spazedog.mounts2sd.tools.ViewEventHandler) ViewGroup(android.view.ViewGroup) LayoutInflater(android.view.LayoutInflater) ExtendedLayout(com.spazedog.mounts2sd.tools.ExtendedLayout) LinearLayout(android.widget.LinearLayout)

Example 18 with ColorDrawable

use of android.graphics.drawable.ColorDrawable in project 9GAG by Mixiaoxiao.

the class MxxBrowserActivity method initPadding.

private void initPadding() {
    SystemBarTintManager tintManager = new SystemBarTintManager(this);
    SystemBarTintManager.SystemBarConfig config = tintManager.getConfig();
    View rootView = findViewById(R.id.mxx_common_activity_browser_webview_rootlayout);
    rootView.setPadding(0, config.getPixelInsetTop(true), config.getPixelInsetRight(), config.getPixelInsetBottom());
    tintManager.setStatusBarTintEnabled(true);
    tintManager.setStatusBarTintDrawable(new ColorDrawable(getResources().getColor(R.color.mxx_item_theme_color_alpha)));
    tintManager.setNavigationBarTintEnabled(true);
    tintManager.setNavigationBarTintDrawable(new ColorDrawable(0xff393d43));
}
Also used : ColorDrawable(android.graphics.drawable.ColorDrawable) SystemBarTintManager(com.mixiaoxiao.android.util.SystemBarTintManager) View(android.view.View) WebView(android.webkit.WebView)

Example 19 with ColorDrawable

use of android.graphics.drawable.ColorDrawable in project Xposed-Tinted-Status-Bar by MohammadAG.

the class Utils method getMainColorFromActionBarDrawable.

public static int getMainColorFromActionBarDrawable(Drawable drawable) throws IllegalArgumentException {
    /* This should fix the bug where a huge part of the ActionBar background is drawn white. */
    Drawable copyDrawable;
    Drawable.ConstantState constantState = drawable.getConstantState();
    if (constantState != null)
        copyDrawable = drawable.getConstantState().newDrawable();
    else
        copyDrawable = drawable;
    if (copyDrawable instanceof ColorDrawable) {
        return ((ColorDrawable) drawable).getColor();
    }
    Bitmap bitmap = drawableToBitmap(copyDrawable);
    int pixel = bitmap.getPixel(0, 40);
    int red = Color.red(pixel);
    int blue = Color.blue(pixel);
    int green = Color.green(pixel);
    int alpha = Color.alpha(pixel);
    copyDrawable = null;
    return Color.argb(alpha, red, green, blue);
}
Also used : Bitmap(android.graphics.Bitmap) ColorDrawable(android.graphics.drawable.ColorDrawable) ColorDrawable(android.graphics.drawable.ColorDrawable) BitmapDrawable(android.graphics.drawable.BitmapDrawable) Drawable(android.graphics.drawable.Drawable) SuppressLint(android.annotation.SuppressLint)

Example 20 with ColorDrawable

use of android.graphics.drawable.ColorDrawable in project 9GAG by Mixiaoxiao.

the class SwipeBackActivityHelper method onActivityCreate.

@SuppressWarnings("deprecation")
public void onActivityCreate() {
    mActivity.getWindow().setBackgroundDrawable(new ColorDrawable(0));
    mActivity.getWindow().getDecorView().setBackgroundDrawable(null);
    mSwipeBackLayout = (SwipeBackLayout) LayoutInflater.from(mActivity).inflate(R.layout.swipeback_layout, null);
    mSwipeBackLayout.addSwipeListener(new SwipeBackLayout.SwipeListener() {

        @Override
        public void onScrollStateChange(int state, float scrollPercent) {
            if (state == SwipeBackLayout.STATE_IDLE && scrollPercent == 0) {
                convertActivityFromTranslucent();
            }
        }

        @Override
        public void onEdgeTouch(int edgeFlag) {
            convertActivityToTranslucent();
        }

        @Override
        public void onScrollOverThreshold() {
        }
    });
}
Also used : ColorDrawable(android.graphics.drawable.ColorDrawable)

Aggregations

ColorDrawable (android.graphics.drawable.ColorDrawable)519 View (android.view.View)112 Drawable (android.graphics.drawable.Drawable)102 BitmapDrawable (android.graphics.drawable.BitmapDrawable)67 ImageView (android.widget.ImageView)62 TextView (android.widget.TextView)55 Bitmap (android.graphics.Bitmap)51 AdapterView (android.widget.AdapterView)32 LinearLayout (android.widget.LinearLayout)32 Test (org.junit.Test)31 Canvas (android.graphics.Canvas)29 ListView (android.widget.ListView)27 FrameLayout (android.widget.FrameLayout)23 ViewGroup (android.view.ViewGroup)22 Handler (android.os.Handler)20 TransitionDrawable (android.graphics.drawable.TransitionDrawable)19 Paint (android.graphics.Paint)18 StateListDrawable (android.graphics.drawable.StateListDrawable)17 WindowManager (android.view.WindowManager)17 Point (android.graphics.Point)16