Search in sources :

Example 26 with ColorDrawable

use of android.graphics.drawable.ColorDrawable in project remusic by aa112901.

the class TintManager method getDrawable.

@Nullable
public Drawable getDrawable(@DrawableRes int resId) {
    final Context context = mContextRef.get();
    if (context == null)
        return null;
    if (resId == 0)
        return null;
    if (mSkipDrawableIdTags != null) {
        final String cachedTagName = mSkipDrawableIdTags.get(resId);
        if (SKIP_DRAWABLE_TAG.equals(cachedTagName)) {
            printLog("[Match Skip DrawableTag] Skip the drawable which is matched with the skip tag.");
            return null;
        }
    } else {
        // Create an id cache as we'll need one later
        mSkipDrawableIdTags = new SparseArray<>();
    }
    // Try the cache first (if it exists)
    Drawable drawable = getCacheDrawable(context, resId);
    if (drawable == null) {
        drawable = DrawableUtils.createDrawable(context, resId);
        if (drawable != null && !(drawable instanceof ColorDrawable)) {
            if (addCachedDrawable(resId, drawable)) {
                printLog("[loadDrawable] Saved drawable to cache: " + context.getResources().getResourceName(resId));
            }
        }
    }
    if (drawable == null) {
        mSkipDrawableIdTags.append(resId, SKIP_DRAWABLE_TAG);
    }
    return drawable;
}
Also used : Context(android.content.Context) ColorDrawable(android.graphics.drawable.ColorDrawable) ColorDrawable(android.graphics.drawable.ColorDrawable) Drawable(android.graphics.drawable.Drawable) FilterableStateListDrawable(com.bilibili.magicasakura.drawables.FilterableStateListDrawable) Nullable(android.support.annotation.Nullable)

Example 27 with ColorDrawable

use of android.graphics.drawable.ColorDrawable in project actor-platform by actorapp.

the class PickCountryFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.fragment_country_select, null);
    v.setBackgroundColor(ActorSDK.sharedActor().style.getMainBackgroundColor());
    countriesListView = (ListView) v.findViewById(R.id.lv_countries);
    countriesListView.setDivider(new ColorDrawable(ActorSDK.sharedActor().style.getDividerColor()));
    countriesListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            if (adapter != null) {
                final Country country = adapter.getItem(position);
                getActivity().setResult(Activity.RESULT_OK, new Intent().putExtra("country_id", country.fullNameRes).putExtra("country_code", country.phoneCode).putExtra("country_shortname", country.shortName));
                getActivity().finish();
            }
        }
    });
    adapter = new CountryAdapter(Countries.getInstance().getCountries());
    countriesListView.setAdapter(adapter);
    return v;
}
Also used : ColorDrawable(android.graphics.drawable.ColorDrawable) Country(im.actor.sdk.util.country.Country) AdapterView(android.widget.AdapterView) Intent(android.content.Intent) TextView(android.widget.TextView) View(android.view.View) AdapterView(android.widget.AdapterView) ListView(android.widget.ListView)

Example 28 with ColorDrawable

use of android.graphics.drawable.ColorDrawable in project actor-platform by actorapp.

the class BaseFragmentActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    // Configure ActionBar
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setElevation(0);
        actionBar.setDisplayShowHomeEnabled(false);
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setDisplayShowTitleEnabled(true);
        actionBar.setDisplayShowCustomEnabled(false);
        if (STYLE.getToolBarColor() != 0) {
            actionBar.setBackgroundDrawable(new ColorDrawable(STYLE.getToolBarColor()));
        }
    }
    // Setting basic content
    FrameLayout rootLayout = new FrameLayout(this);
    rootLayout.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
    rootLayout.setBackgroundColor(STYLE.getMainBackgroundColor());
    rootLayout.setId(R.id.content_frame);
    setContentView(rootLayout);
    // Setting Background Color
    getWindow().setBackgroundDrawable(new ColorDrawable(STYLE.getMainBackgroundColor()));
}
Also used : ColorDrawable(android.graphics.drawable.ColorDrawable) ViewGroup(android.view.ViewGroup) FrameLayout(android.widget.FrameLayout) ActionBar(android.support.v7.app.ActionBar)

Example 29 with ColorDrawable

use of android.graphics.drawable.ColorDrawable in project actor-platform by actorapp.

the class CallActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    //        Thread.setDefaultUncaughtExceptionHandler(
    //                new UnhandledExceptionHandler(this));
    ////
    //        AndroidWebRTCRuntimeProvider.postToHandler(new Runnable() {
    //            @Override
    //            public void run() {
    //                Thread.setDefaultUncaughtExceptionHandler(
    //                        new UnhandledExceptionHandler(CallActivity.this));
    //
    //            }
    //        });
    getSupportActionBar().setTitle("Call");
    getSupportActionBar().hide();
    getSupportActionBar().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
    if (savedInstanceState == null) {
        callId = getIntent().getLongExtra("callId", -1);
        Fragment callFragment = ActorSDK.sharedActor().getDelegate().fragmentForCall(callId);
        if (callFragment == null) {
            callFragment = CallFragment.create(callId);
        }
        showFragment(callFragment, false);
    }
}
Also used : ColorDrawable(android.graphics.drawable.ColorDrawable) Fragment(android.support.v4.app.Fragment)

Example 30 with ColorDrawable

use of android.graphics.drawable.ColorDrawable in project actor-platform by actorapp.

the class GroupInfoFragment method updateBar.

public void updateBar(int offset) {
    int baseColor = getResources().getColor(R.color.primary);
    ActorStyle style = ActorSDK.sharedActor().style;
    if (style.getToolBarColor() != 0) {
        baseColor = style.getToolBarColor();
    }
    if (offset > Screen.dp(248 - 56)) {
        ((BaseActivity) getActivity()).getSupportActionBar().setBackgroundDrawable(new ColorDrawable(baseColor));
    } else {
        float alpha = offset / (float) Screen.dp(248 - 56);
        int color = Color.argb((int) (255 * alpha), Color.red(baseColor), Color.green(baseColor), Color.blue(baseColor));
        ((BaseActivity) getActivity()).getSupportActionBar().setBackgroundDrawable(new ColorDrawable(color));
    }
}
Also used : ColorDrawable(android.graphics.drawable.ColorDrawable) ActorStyle(im.actor.sdk.ActorStyle)

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