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);
}
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();
}
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));
}
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);
}
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() {
}
});
}
Aggregations