List of usage examples for android.content.res Resources getSystem
public static Resources getSystem()
From source file:com.duy.pascal.ui.view.console.ConsoleView.java
public float getTextSize(int unit, float size) { Context c = getContext();/* w ww . java 2 s. com*/ Resources r; if (c == null) r = Resources.getSystem(); else r = c.getResources(); return TypedValue.applyDimension(unit, size, r.getDisplayMetrics()); }
From source file:jahirfiquitiva.iconshowcase.tasks.LoadAppsToRequest.java
public Drawable getAppDefaultActivityIcon() { return getAppIcon(Resources.getSystem(), android.R.mipmap.sym_def_app_icon); }
From source file:com.landenlabs.all_devtool.ConsoleFragment.java
private void buildGrid(RelativeLayout systemLayout, Map<String, List<TextView>> listView, String[] names, int[] widthsDp, int belowId) { // listView.clear(); int numCol = widthsDp.length; int dashHeight = 2; int widthDp = pxToDp(Resources.getSystem().getDisplayMetrics().widthPixels); int[] actualWidthsDp = new int[widthsDp.length]; int padLeftDp = 10; List<TextView> colViews = new ArrayList<TextView>(); colViews.add(addTextView(systemLayout, belowId, 0, widthsDp[0], dashHeight, padLeftDp)); actualWidthsDp[0] = widthsDp[0];//from www. j a v a2 s . c o m widthDp -= widthsDp[0] + padLeftDp; for (int col = 1; col != numCol; col++) { int colWidthDp = (widthsDp[col] < widthDp) ? widthsDp[col] : widthDp; colViews.add(addTextView(systemLayout, belowId, -colViews.get(col - 1).getId(), colWidthDp, dashHeight, padLeftDp)); actualWidthsDp[col] = colWidthDp; widthDp -= colWidthDp + padLeftDp; } listView.put(DASH, colViews); for (int col = 0; col != numCol; col++) { colViews.get(col).setBackgroundColor(-1); } for (int row = 0; row != names.length; row++) { String name = names[row]; List<TextView> nextRowView = addViews(systemLayout, listView, name, numCol, colViews); colViews = nextRowView; for (int col = 0; col != numCol; col++) { colViews.get(col).setMaxWidth(dpToPx(actualWidthsDp[col])); } } }
From source file:org.getlantern.firetweet.activity.support.SignInActivity.java
@Override protected void onCreate(final Bundle savedInstanceState) { supportRequestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); super.onCreate(savedInstanceState); mPreferences = getSharedPreferences(SHARED_PREFERENCES_NAME, MODE_PRIVATE); mResolver = getContentResolver();//from w ww .java 2 s . c om mApplication = FiretweetApplication.getInstance(this); setContentView(R.layout.activity_sign_in); setSupportProgressBarIndeterminateVisibility(false); final long[] account_ids = getActivatedAccountIds(this); final ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setDisplayHomeAsUpEnabled(account_ids.length > 0); } if (savedInstanceState != null) { mAPIUrlFormat = savedInstanceState.getString(Accounts.API_URL_FORMAT); mAuthType = savedInstanceState.getInt(Accounts.AUTH_TYPE); mSameOAuthSigningUrl = savedInstanceState.getBoolean(Accounts.SAME_OAUTH_SIGNING_URL); mConsumerKey = trim(savedInstanceState.getString(Accounts.CONSUMER_KEY)); mConsumerSecret = trim(savedInstanceState.getString(Accounts.CONSUMER_SECRET)); mUsername = savedInstanceState.getString(Accounts.SCREEN_NAME); mPassword = savedInstanceState.getString(Accounts.PASSWORD); mAPIChangeTimestamp = savedInstanceState.getLong(EXTRA_API_LAST_CHANGE); } Typeface font = Typeface.createFromAsset(getAssets(), "fonts/ProximaNova-Semibold.ttf"); mSigninSignupContainer.setOrientation( mAuthType == Accounts.AUTH_TYPE_TWIP_O_MODE ? LinearLayout.VERTICAL : LinearLayout.HORIZONTAL); final Resources resources = getResources(); final ColorStateList color = ColorStateList.valueOf(resources.getColor(R.color.material_light_blue)); mSignInButton.setTextColor(Color.parseColor("#38c6f3")); mSignInButton.setBackgroundColor(Color.parseColor("#E7E7E7")); mSignInButton.setBackgroundResource(R.drawable.sign_in_btn); mSignInButton.setTypeface(font); mSignUpButton.setTypeface(font); poweredByButton.setTypeface(font); autoTweetCheckBox = (CheckBox) findViewById(R.id.autotweet_checkbox); autoTweetText = (TextView) findViewById(R.id.should_send_autotweet); // don't display the auto tweet text on subsequent runs if (mPreferences.contains(APP_RAN_BEFORE)) { autoTweetCheckBox.setVisibility(View.GONE); autoTweetText.setVisibility(View.GONE); } else { // the checkbox color attribute isn't a simple attribute // we have to grab the default checkbox and apply a color filter int id = Resources.getSystem().getIdentifier("btn_check_holo_light", "drawable", "android"); Drawable drawable = ResourcesCompat.getDrawable(getResources(), id, null); if (drawable != null) { drawable.setColorFilter(Color.parseColor("white"), PorterDuff.Mode.SRC_ATOP); autoTweetCheckBox.setButtonDrawable(drawable); } autoTweetText.setTypeface(font); autoTweetText.setTextColor(Color.parseColor("white")); } setSignInButton(); }
From source file:com.jams.music.player.MainActivity.MainActivity.java
/** * Inflates the generic MainActivity ActionBar layout. * * @param inflater The ActionBar's menu inflater. * @param menu The ActionBar menu to work with. */// w w w. ja v a 2 s. co m private void showMainActivityActionItems(MenuInflater inflater, Menu menu) { //Inflate the menu. getMenu().clear(); inflater = getMenuInflater(); inflater.inflate(R.menu.main_activity, menu); //Set the ActionBar background getSupportActionBar().setBackgroundDrawable(UIElementsHelper.getGeneralActionBarBackground(mContext)); getSupportActionBar().setDisplayShowTitleEnabled(true); getSupportActionBar().setDisplayUseLogoEnabled(false); getSupportActionBar().setHomeButtonEnabled(true); //Set the ActionBar text color. int actionBarTitleId = Resources.getSystem().getIdentifier("action_bar_title", "id", "android"); if (actionBarTitleId > 0) { TextView title = (TextView) findViewById(actionBarTitleId); if (title != null) { title.setTextColor(0x00FFFFFF); } } }
From source file:com.android.leanlauncher.IconCache.java
private Drawable getFullResDefaultActivityIcon() { return getFullResDefaultIcon(Resources.getSystem(), android.R.mipmap.sym_def_app_icon); }
From source file:com.woodblockwithoutco.quickcontroldock.ui.factory.ServiceViewFactory.java
public View getDetectorView() { View view = LayoutInflater.from(mContext).inflate(R.layout.detector_layout, null, false); if (SwipeDetectorPrefsFragment.isActive) { view.findViewById(R.id.swipe_detector) .setBackgroundColor(Resources.getSystem().getColor(android.R.color.holo_blue_bright)); } else {/*from w ww .jav a2 s . c om*/ boolean isDebugColor = GeneralResolver.isSwipeDetectorDebugVisible(mContext); int colorId = isDebugColor ? R.color.detector_debug_color : R.color.detector_color; view.findViewById(R.id.swipe_detector).setBackgroundColor(mContext.getResources().getColor(colorId)); } return view; }
From source file:com.zulip.android.util.CustomHtmlToSpannedConverter.java
private static void endFont(SpannableStringBuilder text) { int len = text.length(); Object obj = getLast(text, Font.class); int where = text.getSpanStart(obj); text.removeSpan(obj);/*from ww w .jav a2 s. c o m*/ if (where != len) { Font f = (Font) obj; if (!TextUtils.isEmpty(f.mColor)) { if (f.mColor.startsWith("@")) { Resources res = Resources.getSystem(); String name = f.mColor.substring(1); int colorRes = res.getIdentifier(name, "color", "android"); if (colorRes != 0) { ColorStateList colors = res.getColorStateList(colorRes); text.setSpan(new TextAppearanceSpan(null, 0, 0, colors, null), where, len, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); } } else { int c = getHtmlColor(f.mColor); if (c != -1) { text.setSpan(new ForegroundColorSpan(c | 0xFF000000), where, len, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); } } } if (f.mFace != null) { text.setSpan(new TypefaceSpan(f.mFace), where, len, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); } } }
From source file:com.aniruddhc.acemusic.player.MainActivity.MainActivity.java
/** * Inflates the generic MainActivity ActionBar layout. * * @param inflater The ActionBar's menu inflater. * @param menu The ActionBar menu to work with. *//* w ww .j a v a2 s. c o m*/ private void showMainActivityActionItems(MenuInflater inflater, Menu menu) { //Inflate the menu. getMenu().clear(); inflater = getMenuInflater(); inflater.inflate(R.menu.main_activity, menu); //Set the ActionBar background getActionBar().setBackgroundDrawable(UIElementsHelper.getGeneralActionBarBackground(mContext)); getActionBar().setDisplayShowTitleEnabled(true); getActionBar().setDisplayUseLogoEnabled(false); getActionBar().setHomeButtonEnabled(true); //Set the ActionBar text color. int actionBarTitleId = Resources.getSystem().getIdentifier("action_bar_title", "id", "android"); if (actionBarTitleId > 0) { TextView title = (TextView) findViewById(actionBarTitleId); if (title != null) { title.setTextColor(0xFFFFFFFF); } } }
From source file:org.totschnig.myexpenses.dialog.HelpDialogFragment.java
private int resolveSystem(String resIdString, String defType) { return resolve(Resources.getSystem(), resIdString, defType, "android"); }