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