Search in sources :

Example 11 with ColorDrawable

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);
        }
    }
}
Also used : ColorDrawable(android.graphics.drawable.ColorDrawable) AppPagerAdapter(io.virtualapp.home.adapters.AppPagerAdapter)

Example 12 with ColorDrawable

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

Example 13 with ColorDrawable

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

Example 14 with ColorDrawable

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);
}
Also used : Rect(android.graphics.Rect) Canvas(android.graphics.Canvas) ArrayList(java.util.ArrayList) PopupWindow(android.widget.PopupWindow) Bitmap(android.graphics.Bitmap) ColorDrawable(android.graphics.drawable.ColorDrawable) Resources(android.content.res.Resources) ImageView(android.widget.ImageView) LinearLayout(android.widget.LinearLayout)

Example 15 with ColorDrawable

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;
    }
}
Also used : ColorDrawable(android.graphics.drawable.ColorDrawable) TypedArray(android.content.res.TypedArray) Handler(android.os.Handler) SimpleDateFormat(java.text.SimpleDateFormat) RejectedExecutionException(java.util.concurrent.RejectedExecutionException) TwitterException(twitter4j.TwitterException) IOException(java.io.IOException)

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