List of usage examples for android.graphics Color parseColor
@ColorInt public static int parseColor(@Size(min = 1) String colorString)
From source file:com.amaze.filemanager.activities.TextReader.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.search);/* w w w. j a v a 2s . com*/ ma = (EditText) findViewById(R.id.fname); p = (ProgressBar) findViewById(R.id.pbar); ma.setVisibility(View.GONE); String skin = PreferenceManager.getDefaultSharedPreferences(this).getString("skin_color", "#5677fc"); getActionBar().setBackgroundDrawable(new ColorDrawable(Color.parseColor(skin))); if (Build.VERSION.SDK_INT >= 19) { SystemBarTintManager tintManager = new SystemBarTintManager(this); tintManager.setStatusBarTintEnabled(true); tintManager.setStatusBarTintColor(Color.parseColor(skin)); FrameLayout a = (FrameLayout) ma.getParent(); FrameLayout.MarginLayoutParams p = (ViewGroup.MarginLayoutParams) a.getLayoutParams(); SystemBarTintManager.SystemBarConfig config = tintManager.getConfig(); p.setMargins(0, config.getPixelInsetTop(true), 0, 0); } path = this.getIntent().getStringExtra("path"); if (path != null) { Toast.makeText(this, "" + path, Toast.LENGTH_SHORT).show(); new LoadText().execute(path); } else { Toast.makeText(this, utils.getString(this, R.string.cant_read_file), Toast.LENGTH_LONG).show(); finish(); } getActionBar().setTitle(new File(path).getName()); getActionBar().setSubtitle(path); }
From source file:edu.umich.eecs.lab11.summon.MainActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); super.init(); wv = ((WebView) appView.getEngine().getView()); wv.addJavascriptInterface(new JavaScriptInterface(getPackageManager()), "gateway"); wv.getSettings().setJavaScriptEnabled(true); wv.getSettings().setSupportMultipleWindows(false); wv.getSettings().setNeedInitialFocus(false); wv.getSettings().setSupportZoom(false); wv.getSettings().setAllowFileAccess(true); wv.getSettings().setAppCacheEnabled(true); wv.getSettings().setCacheMode(WebSettings.LOAD_DEFAULT); wv.getSettings().setAppCachePath(wv.getContext().getCacheDir().getAbsolutePath()); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) setTaskDescription(new TaskDescription(null, null, Color.parseColor("#FFC107"))); loadUrl(launchUrl);/* w w w. j a v a 2s .c o m*/ try { InputStream is = getAssets().open("www/summon.android.js"); byte[] buffer = new byte[is.available()]; is.read(buffer); is.close(); js = "javascript:(function(){ " + "s=document.createElement('script');" + "s.innerHTML = atob('" + Base64.encodeToString(buffer, Base64.NO_WRAP) + "'); " + "document.querySelector('head').appendChild(s); " + "})()"; } catch (Exception e) { e.printStackTrace(); } }
From source file:com.filemanager.free.adapters.DrawerAdapter.java
public DrawerAdapter(Context context, ArrayList<Item> values, MainActivity m, SharedPreferences Sp) { super(context, R.layout.drawerrow, values); this.context = context; this.values = values; for (int i = 0; i < values.size(); i++) { myChecked.put(i, false);// w ww. j a v a2s. c o m } icons = new IconUtils(Sp, m); this.m = m; fabskin = Color.parseColor(m.fabskin); color = colors.get(m.fabskin); if (color == null) { color = colors.get("#e91e63"); } inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); }
From source file:com.filemanager.free.fragments.DbViewerFragment.java
@Override public void onActivityCreated(@Nullable Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); if (dbViewer.theme1 == 1) { relativeLayout.setBackgroundColor(getResources().getColor(R.color.holo_dark_background)); webView.setBackgroundColor(getResources().getColor(R.color.holo_dark_background)); } else {//from w w w. j a v a 2s . c om relativeLayout.setBackgroundColor(Color.parseColor("#ffffff")); webView.setBackgroundColor(Color.parseColor("#ffffff")); } }
From source file:com.may.ple.parking.gateway.activity.GateInActivity.java
@Override public boolean onLongClick(View v) { if (v.getId() == R.id.show) { if (licenseNo == null || licenseNo.trim().length() == 0) return false; show.setBackgroundResource(R.drawable.text_show_sent); show.setTextColor(Color.parseColor("#000000")); if (isCheckOut) { Intent returnIntent = new Intent(); returnIntent.putExtra("result", licenseNo); setResult(RESULT_OK, returnIntent); finish();/*from w w w . j a va 2 s . c om*/ return true; } VehicleSaveCriteriaReq req = new VehicleSaveCriteriaReq(); req.licenseNo = licenseNo; req.deviceId = ApplicationScope.getInstance().deviceId; req.gateName = gateName; service.send(1, req, VehicleSaveCriteriaResp.class, "/restAct/vehicle/saveVehicleParking", HttpMethod.POST); spinner.show(); } else { licenseNo = ""; show.setText(licenseNo); } return true; }
From source file:com.tencent.wetest.activity.DataDetailActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_data_detail); toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar);// w w w .j a v a 2 s .c o m toolbar.setNavigationOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { onBackPressed(); } }); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION); SystemBarTintManager tintManager = new SystemBarTintManager(this); tintManager.setStatusBarTintColor(Color.parseColor("#3367d6")); tintManager.setStatusBarTintEnabled(true); } tvDataDetail = (TextView) findViewById(R.id.dataDetail); Intent intent = this.getIntent(); if (intent != null && intent.hasExtra("filename")) { mLogName = intent.getStringExtra("filename"); } String fileDir = Environment.getExternalStorageDirectory().getAbsolutePath() + "/wetest"; mLogFile = new File(fileDir + "/" + mLogName); tvFilePathName = (TextView) findViewById(R.id.filePathName); tvFilePathName.setText(mLogFile.getAbsolutePath()); new Thread(new Runnable() { @Override public void run() { try { dataContent = ReportUtil.readFileContent(mLogFile); } catch (Exception e) { Logger.error("readFileContent error :" + e.toString()); e.printStackTrace(); } Message msg = mHandler.obtainMessage(); mHandler.sendMessage(msg); } }).start(); }
From source file:com.cryart.sabbathschool.view.SSAboutActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); SsAboutActivityBinding binding = DataBindingUtil.setContentView(this, R.layout.ss_about_activity); setSupportActionBar(binding.ssAppBar.ssToolbar); ActionBar ssToolbar = getSupportActionBar(); if (ssToolbar != null) { ssToolbar.setDisplayShowCustomEnabled(true); ssToolbar.setDisplayShowTitleEnabled(false); ssToolbar.setDisplayHomeAsUpEnabled(true); }//from ww w. j ava 2s .c om binding.ssAppBar.toolbarTitle.setText(getString(R.string.ss_about)); binding.setViewModel(new SSAboutViewModel(this)); int primaryColor = Color.parseColor(SSColorTheme.getInstance().getColorPrimary()); DrawableCompat.setTint(binding.ssLogo.getDrawable(), primaryColor); binding.ssAppTitle.setTextColor(primaryColor); binding.ssAppBar.ssToolbar.setBackgroundColor(primaryColor); this.ssFirebaseAnalytics = FirebaseAnalytics.getInstance(this); this.ssFirebaseAuth = FirebaseAuth.getInstance(); SSEvent.track(SSConstants.SS_EVENT_ABOUT_OPEN); updateWindowColorScheme(); }
From source file:com.ayoview.sample.textview.badge.ViewsFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View layout = inflater.inflate(R.layout.badge_fragment_views, null); View backgroundDefaultView = layout.findViewById(R.id.backgroundDefault); backgroundDefaultBadge = new BadgeView(getActivity()); backgroundDefaultBadge.setBadgeCount(42); backgroundDefaultBadge.setTargetView(backgroundDefaultView); View backgroundDrawableView = layout.findViewById(R.id.backgroundDrawable); backgroundDrawableBadge = new BadgeView(getActivity()); backgroundDrawableBadge.setBadgeCount(88); backgroundDrawableBadge.setBackgroundResource(R.drawable.badge_blue); backgroundDrawableBadge.setTargetView(backgroundDrawableView); View backgroundShapeView = layout.findViewById(R.id.backgroundShape); backgroundShapeBadge = new BadgeView(getActivity()); backgroundShapeBadge.setBadgeCount(47); backgroundShapeBadge.setBackground(12, Color.parseColor("#9b2eef")); backgroundShapeBadge.setTargetView(backgroundShapeView); View counterView = layout.findViewById(R.id.counter); counterView.setOnClickListener(this); counterBadge = new BadgeView(getActivity()); counterBadge.setBadgeCount(-2);//w w w . j a v a 2s . c o m counterBadge.setTargetView(counterView); View gravityView = layout.findViewById(R.id.gravity); gravityView.setOnClickListener(this); gravityBadge = new BadgeView(getActivity()); gravityBadge.setBadgeGravity(Gravity.LEFT | Gravity.BOTTOM); gravityBadge.setBadgeCount(4); gravityBadge.setTargetView(gravityView); View textStyleView = layout.findViewById(R.id.textStyle); textStyleView.setOnClickListener(this); textStyleBadge = new BadgeView(getActivity()); textStyleBadge.setBadgeCount(18); textStyleBadge.setTargetView(textStyleView); textStyleBadge.setTypeface(Typeface.create(Typeface.SANS_SERIF, Typeface.ITALIC)); textStyleBadge.setShadowLayer(2, -1, -1, Color.GREEN); View visibilityView = layout.findViewById(R.id.visibility); visibilityView.setOnClickListener(this); visibilityBadgeView = new BadgeView(getActivity()); visibilityBadgeView.setBadgeCount(1); visibilityBadgeView.setTargetView(visibilityView); return layout; }
From source file:com.github.hobbe.android.openkarotz.karotz.OpenKarotzState.java
/** * Initialize a new status from a JSON input. * * @param json the JSON string// w w w. j av a2s. co m */ public OpenKarotzState(String json) { // Answer: // {"version":"200","ears_disabled":"0","sleep":"0","sleep_time":"0","led_color":"0000FF","led_pulse":"1","tts_cache_size":"4","usb_free_space":"-1","karotz_free_space":"148.4M","eth_mac":"00:00:00:00:00:00","wlan_mac":"01:23:45:67:89:AB","nb_tags":"4","nb_moods":"305","nb_sounds":"14","nb_stories":"0","karotz_percent_used_space":"37","usb_percent_used_space":""} if (json != null) { try { JSONObject jo = new JSONObject(json); version = jo.getString(KEY_VERSION); status = ("1".equals(jo.getString(KEY_SLEEP)) ? KarotzStatus.SLEEPING : KarotzStatus.AWAKE); ledColor = Color.parseColor("#" + jo.getString(KEY_LED_COLOR)); pulsing = ("1".equals(jo.getString(KEY_LED_PULSE))); earMode = ("1".equals(jo.getString(KEY_EARS_DISABLED)) ? EarMode.DISABLED : EarMode.ENABLED); } catch (JSONException e) { e.printStackTrace(); Log.e(LOG_TAG, "Cannot parse status answer: " + json); status = KarotzStatus.UNKNOWN; } } else { status = KarotzStatus.UNKNOWN; } }
From source file:org.zywx.wbpalmstar.plugin.uexiconlist.utils.IconListUtils.java
public static void setUIConfig(String jsonStr, float scale) { if (!TextUtils.isEmpty(jsonStr)) { try {/*from w w w . j ava2 s . c o m*/ JSONObject json = new JSONObject(jsonStr); int x = (int) (Float.parseFloat(json.optString(JK_UI_X))); UIConfig.setX(x); UIConfig.setScaleX((int) (x * scale)); int y = (int) (Float.parseFloat(json.optString(JK_UI_Y))); UIConfig.setY(y); UIConfig.setScaleY((int) (y * scale)); int width = (int) (Float.parseFloat(json.optString(JK_UI_W))); UIConfig.setWidth(width); UIConfig.setScaleWidth((int) (width * scale)); int hight = (int) (Float.parseFloat(json.optString(JK_UI_H))); UIConfig.setHight(hight); UIConfig.setScaleHight((int) (hight * scale)); UIConfig.setLine(((int) Float.parseFloat(json.optString(JK_UI_LINE)))); UIConfig.setRow(((int) Float.parseFloat(json.optString(JK_UI_ROW)))); UIConfig.setBackgroundColor( Color.parseColor(json.optString(JK_BACKGROUND_COLOR, DEF_BACKGROUND_COLOR))); UIConfig.setTileTextColor( Color.parseColor(json.optString(JK_TITLE_TEXT_COLOR, DEF_TITLE_TEXT_COLOR))); boolean isShowIconFrame = json.optBoolean(JK_IS_SHOW_ICON_FRAME, false); UIConfig.setIsShowIconFrame(isShowIconFrame); if (isShowIconFrame) { UIConfig.setIconFrameColor( Color.parseColor(json.optString(JK_ICON_FRAME_COLOR, DEF_ICON_FRAME_COLOR))); } LogUtils.logDebug(true, "UIconfig:" + jsonStr); } catch (JSONException e) { e.printStackTrace(); } } }