use of android.graphics.drawable.ColorDrawable in project VirtualApp by asLody.
the class ListAppActivity method onCreate.
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setBackgroundDrawable(new ColorDrawable(getResources().getColor(R.color.colorPrimaryDark)));
setContentView(R.layout.activity_clone_app);
mToolBar = (Toolbar) findViewById(R.id.clone_app_tool_bar);
mTabLayout = (TabLayout) mToolBar.findViewById(R.id.clone_app_tab_layout);
mViewPager = (ViewPager) findViewById(R.id.clone_app_view_pager);
setupToolBar();
mViewPager.setAdapter(new AppPagerAdapter(getSupportFragmentManager()));
mTabLayout.setupWithViewPager(mViewPager);
// Request permission to access external storage
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(this, new String[] { Manifest.permission.READ_EXTERNAL_STORAGE }, 0);
}
}
}
use of android.graphics.drawable.ColorDrawable in project VirtualApp by asLody.
the class MaterialRippleLayout method setRippleBackground.
public void setRippleBackground(int color) {
rippleBackground = new ColorDrawable(color);
rippleBackground.setBounds(bounds);
invalidate();
}
use of android.graphics.drawable.ColorDrawable in project material-ripple by balysv.
the class MaterialRippleLayout method setRippleBackground.
public void setRippleBackground(int color) {
rippleBackground = new ColorDrawable(color);
rippleBackground.setBounds(bounds);
invalidate();
}
use of android.graphics.drawable.ColorDrawable in project ADWLauncher2 by boombuler.
the class Launcher method showPreviews.
private void showPreviews(final View anchor, int start, int end) {
final Resources resources = getResources();
final Workspace workspace = mWorkspace;
CellLayout cell = ((CellLayout) workspace.getChildAt(start));
float max = workspace.getChildCount();
final Rect r = new Rect();
resources.getDrawable(R.drawable.preview_background).getPadding(r);
int extraW = (int) ((r.left + r.right) * max);
int extraH = r.top + r.bottom;
int aW = cell.getWidth() - extraW;
float w = aW / max;
int width = cell.getWidth();
int height = cell.getHeight();
int x = cell.getLeftPadding();
int y = cell.getTopPadding();
width -= (x + cell.getRightPadding());
height -= (y + cell.getBottomPadding());
float scale = w / width;
int count = end - start;
final float sWidth = width * scale;
float sHeight = height * scale;
LinearLayout preview = new LinearLayout(this);
PreviewTouchHandler handler = new PreviewTouchHandler(anchor);
ArrayList<Bitmap> bitmaps = new ArrayList<Bitmap>(count);
for (int i = start; i < end; i++) {
ImageView image = new ImageView(this);
cell = (CellLayout) workspace.getChildAt(i);
final Bitmap bitmap = Bitmap.createBitmap((int) sWidth, (int) sHeight, Bitmap.Config.ARGB_8888);
final Canvas c = new Canvas(bitmap);
c.scale(scale, scale);
c.translate(-cell.getLeftPadding(), -cell.getTopPadding());
cell.dispatchDraw(c);
image.setBackgroundDrawable(resources.getDrawable(R.drawable.preview_background));
image.setImageBitmap(bitmap);
image.setTag(i);
image.setOnClickListener(handler);
image.setOnFocusChangeListener(handler);
image.setFocusable(true);
if (i == mWorkspace.getCurrentScreen())
image.requestFocus();
preview.addView(image, LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
bitmaps.add(bitmap);
}
final PopupWindow p = new PopupWindow(this);
p.setContentView(preview);
p.setWidth((int) (sWidth * count + extraW));
p.setHeight((int) (sHeight + extraH));
p.setAnimationStyle(R.style.AnimationPreview);
p.setOutsideTouchable(true);
p.setFocusable(true);
p.setBackgroundDrawable(new ColorDrawable(0));
p.showAsDropDown(anchor, 0, 0);
p.setOnDismissListener(new PopupWindow.OnDismissListener() {
public void onDismiss() {
dismissPreview(anchor);
}
});
anchor.setTag(p);
anchor.setTag(R.id.workspace, preview);
anchor.setTag(R.id.icon, bitmaps);
}
use of android.graphics.drawable.ColorDrawable in project Talon-for-Twitter by klinker24.
the class TimeLineCursorAdapter method init.
protected void init() {
settings = AppSettings.getInstance(context);
sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context);
TypedArray a = context.getTheme().obtainStyledAttributes(new int[] { R.attr.cancelButton });
cancelButton = a.getResourceId(0, 0);
a.recycle();
talonLayout = settings.layout;
if (settings.addonTheme) {
try {
res = context.getPackageManager().getResourcesForApplication(settings.addonThemePackage);
addonLayout = res.getLayout(res.getIdentifier("tweet", "layout", settings.addonThemePackage));
} catch (Exception e) {
e.printStackTrace();
}
}
switch(talonLayout) {
case AppSettings.LAYOUT_TALON:
layout = R.layout.tweet;
break;
case AppSettings.LAYOUT_HANGOUT:
layout = R.layout.tweet_hangout;
break;
case AppSettings.LAYOUT_FULL_SCREEN:
layout = R.layout.tweet_full_screen;
break;
}
TypedArray b;
if (settings.roundContactImages) {
b = context.getTheme().obtainStyledAttributes(new int[] { R.attr.circleBorder });
} else {
b = context.getTheme().obtainStyledAttributes(new int[] { R.attr.squareBorder });
}
border = b.getResourceId(0, 0);
b.recycle();
mCache = getCache();
dateFormatter = android.text.format.DateFormat.getDateFormat(context);
timeFormatter = android.text.format.DateFormat.getTimeFormat(context);
if (settings.militaryTime) {
timeFormatter = new SimpleDateFormat("kk:mm");
}
transparent = new ColorDrawable(android.R.color.transparent);
mHandlers = new Handler[10];
for (int i = 0; i < 10; i++) {
mHandlers[i] = new Handler();
}
for (String s : cursor.getColumnNames()) {
if (s.equals(HomeSQLiteHelper.COLUMN_CONVERSATION)) {
hasConvo = true;
}
}
TWEET_COL = cursor.getColumnIndex(HomeSQLiteHelper.COLUMN_TWEET_ID);
PRO_PIC_COL = cursor.getColumnIndex(HomeSQLiteHelper.COLUMN_PRO_PIC);
TEXT_COL = cursor.getColumnIndex(HomeSQLiteHelper.COLUMN_TEXT);
NAME_COL = cursor.getColumnIndex(HomeSQLiteHelper.COLUMN_NAME);
SCREEN_NAME_COL = cursor.getColumnIndex(HomeSQLiteHelper.COLUMN_SCREEN_NAME);
PIC_COL = cursor.getColumnIndex(HomeSQLiteHelper.COLUMN_PIC_URL);
TIME_COL = cursor.getColumnIndex(HomeSQLiteHelper.COLUMN_TIME);
URL_COL = cursor.getColumnIndex(HomeSQLiteHelper.COLUMN_URL);
USER_COL = cursor.getColumnIndex(HomeSQLiteHelper.COLUMN_USERS);
HASHTAG_COL = cursor.getColumnIndex(HomeSQLiteHelper.COLUMN_HASHTAGS);
GIF_COL = cursor.getColumnIndex(HomeSQLiteHelper.COLUMN_ANIMATED_GIF);
RETWEETER_COL = cursor.getColumnIndex(HomeSQLiteHelper.COLUMN_RETWEETER);
if (hasConvo) {
CONVO_COL = cursor.getColumnIndex(HomeSQLiteHelper.COLUMN_CONVERSATION);
} else {
CONVO_COL = -1;
}
}
Aggregations