List of usage examples for android.graphics Color parseColor
@ColorInt public static int parseColor(@Size(min = 1) String colorString)
From source file:com.filemanager.free.activities.DbViewer.java
@Override public void onCreate(Bundle savedInstanceState) { this.checkStorage = false; super.onCreate(savedInstanceState); if (theme1 == 1) { setTheme(R.style.appCompatDark); getWindow().getDecorView()// w w w .j av a 2s .c o m .setBackgroundColor(ContextCompat.getColor(getBaseContext(), R.color.holo_dark_background)); } setContentView(R.layout.activity_db_viewer); toolbar = (android.support.v7.widget.Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); skin = PreferenceUtils.getPrimaryColorString(Sp); if (Build.VERSION.SDK_INT >= 21) { ActivityManager.TaskDescription taskDescription = new ActivityManager.TaskDescription("File Manager", ((BitmapDrawable) ContextCompat.getDrawable(this, R.mipmap.ic_launcher)).getBitmap(), Color.parseColor(skin)); ((Activity) this).setTaskDescription(taskDescription); } skinStatusBar = PreferenceUtils.getStatusColor(skin); assert (getSupportActionBar()) != null; getSupportActionBar().setBackgroundDrawable(new ColorDrawable(Color.parseColor(skin))); getSupportActionBar().setDisplayHomeAsUpEnabled(true); if (Build.VERSION.SDK_INT == 20 || Build.VERSION.SDK_INT == 19) { SystemBarTintManager tintManager = new SystemBarTintManager(this); tintManager.setStatusBarTintEnabled(true); tintManager.setStatusBarTintColor(Color.parseColor(skin)); FrameLayout.MarginLayoutParams p = (ViewGroup.MarginLayoutParams) findViewById(R.id.parentdb) .getLayoutParams(); SystemBarTintManager.SystemBarConfig config = tintManager.getConfig(); p.setMargins(0, config.getStatusBarHeight(), 0, 0); } else if (Build.VERSION.SDK_INT >= 21) { boolean colourednavigation = Sp.getBoolean("colorednavigation", true); Window window = getWindow(); window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); window.setStatusBarColor((PreferenceUtils.getStatusColor(skin))); if (colourednavigation) window.setNavigationBarColor((PreferenceUtils.getStatusColor(skin))); } String path = getIntent().getStringExtra("path"); pathFile = new File(path); listView = (ListView) findViewById(R.id.listView); load(pathFile); listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction(); DbViewerFragment fragment = new DbViewerFragment(); Bundle bundle = new Bundle(); bundle.putString("table", arrayList.get(position)); fragment.setArguments(bundle); fragmentTransaction.add(R.id.content_frame, fragment); fragmentTransaction.addToBackStack(null); fragmentTransaction.commit(); } }); }
From source file:com.ekasoft.promoexito.MyActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(com.ekasoft.promoexito.R.layout.activity_my); Settings.set(this, "promo_order", "false"); if (!Settings.isKey(this, "install")) { Calendar cal = Calendar.getInstance(); Intent intent = new Intent(this, ServiceWithWebView.class); PendingIntent pintent = PendingIntent.getService(this, 0, intent, 0); AlarmManager alarm = (AlarmManager) getSystemService(Context.ALARM_SERVICE); alarm.setRepeating(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis(), 24 * 60 * 60 * 1000, pintent); Intent intent2 = new Intent(MyActivity.this, InstallPromoActivity.class); startActivity(intent2);// w ww . j a va 2s . com finish(); } ActionBar ab = getSupportActionBar(); ab.setBackgroundDrawable(new ColorDrawable(Color.parseColor("#ffe800"))); ab.setIcon(com.ekasoft.promoexito.R.drawable.bar); ab.setLogo(com.ekasoft.promoexito.R.drawable.bar); ab.setDisplayUseLogoEnabled(true); ab.setHomeAsUpIndicator(com.ekasoft.promoexito.R.drawable.bar); ab.setDisplayHomeAsUpEnabled(true); ab.setTitle(""); ActiveAndroid.initialize(this); mAdView = (AdView) findViewById(com.ekasoft.promoexito.R.id.ad_view); AdRequest adRequest = new AdRequest.Builder().addTestDevice(AdRequest.DEVICE_ID_EMULATOR) //.addTestDevice("4CBD3F38AF88E4EFA5FC4FB8B02D8D73") .build(); mAdView.loadAd(adRequest); listPromo = new FragmentListPromo(); listCategories = new CategorysFragment(); getSupportFragmentManager().beginTransaction() .add(com.ekasoft.promoexito.R.id.fragment_container, listPromo).commit(); }
From source file:com.flowzr.activity.EntityListActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); Intent intent = getIntent();/*from www . ja va2s .c o m*/ if (intent.hasExtra(ReportsListFragment.EXTRA_REPORT_TYPE) || intent.hasExtra(REQUEST_REPORTS) || intent.hasExtra(REQUEST_PLANNER)) { setContentView(R.layout.main_reports); } else { setContentView(R.layout.main_entities); } //@see: http://stackoverflow.com/questions/16539251/get-rid-of-blue-line, //only way found to remove on various devices 2.3x, 3.0, ... getSupportActionBar().setBackgroundDrawable(new ColorDrawable(Color.parseColor("#121212"))); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setHomeButtonEnabled(true); ActionBar actionBar = getSupportActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); //setupDrawer(); FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); if (intent.hasExtra(ReportsListFragment.EXTRA_REPORT_TYPE)) { intent.putExtra(AbstractTotalListFragment.EXTRA_LAYOUT, R.layout.report); Fragment f = new ReportFragment(); f.setArguments(intent.getExtras()); transaction.replace(R.id.fragment_container, f); } else if (intent.hasExtra(MainActivity.REQUEST_SPLIT_BLOTTER)) { Fragment f = new BudgetBlotterFragment(); f.setArguments(intent.getExtras()); intent.putExtra(AbstractTotalListFragment.EXTRA_LAYOUT, R.layout.blotter); transaction.replace(R.id.fragment_container, f); } else if (intent.hasExtra(REQUEST_BUDGET_BLOTTER)) { Fragment f = new BudgetBlotterFragment(); f.setArguments(intent.getExtras()); intent.putExtra(AbstractTotalListFragment.EXTRA_LAYOUT, R.layout.blotter); transaction.replace(R.id.fragment_container, f); } else if (intent.hasExtra(REQUEST_REPORTS)) { intent.putExtra(AbstractTotalListFragment.EXTRA_LAYOUT, R.layout.reports_list); transaction.replace(R.id.fragment_container, new ReportsListFragment()); } else if (intent.hasExtra(REQUEST_EXCHANGE_RATES)) { intent.putExtra(AbstractTotalListFragment.EXTRA_LAYOUT, R.layout.reports_list); transaction.replace(R.id.fragment_container, new ExchangeRatesListFragment()); } else if (intent.hasExtra(REQUEST_CATEGORY_SELECTOR)) { intent.putExtra(AbstractTotalListFragment.EXTRA_LAYOUT, R.layout.category_selector); transaction.replace(R.id.fragment_container, new CategorySelectorFragment()); } else if (intent.hasExtra(REQUEST_SCHEDULED)) { intent.putExtra(AbstractTotalListFragment.EXTRA_LAYOUT, R.layout.scheduled_transactions); transaction.replace(R.id.fragment_container, new ScheduledListActivity()); } else if (intent.hasExtra(REQUEST_PLANNER)) { intent.putExtra(AbstractTotalListFragment.EXTRA_LAYOUT, R.layout.planner); if (findViewById(R.id.fragment_land_container) != null) { transaction.replace(R.id.fragment_land_container, new PlannerActivity()); } else { transaction.replace(R.id.fragment_container, new PlannerActivity()); } } else if (intent.hasExtra(REQUEST_MASS_OP)) { intent.putExtra(AbstractTotalListFragment.EXTRA_LAYOUT, R.layout.blotter_mass_op); transaction.replace(R.id.fragment_container, new MassOpActivity()); } else if (intent.hasExtra(REQUEST_TEMPLATES)) { intent.putExtra(AbstractTotalListFragment.EXTRA_LAYOUT, R.layout.templates); transaction.replace(R.id.fragment_container, new TemplatesListFragment()); } else if (intent.hasExtra(REQUEST_NEW_TRANSACTION_FROM_TEMPLATE)) { intent.putExtra(AbstractTotalListFragment.EXTRA_LAYOUT, R.layout.templates); transaction.replace(R.id.fragment_container, new SelectTemplateActivity()); } else if (intent.hasExtra(REQUEST_BLOTTER_TOTALS)) { Fragment f = new BlotterTotalsDetailsFragment(); f.setArguments(intent.getExtras()); transaction.replace(R.id.fragment_container, f); } else if (intent.hasExtra(REQUEST_ACCOUNT_TOTALS)) { Fragment f = new AccountListTotalsDetailsActivity(); f.setArguments(intent.getExtras()); transaction.replace(R.id.fragment_container, f); } else if (intent.hasExtra(REQUEST_BUDGET_TOTALS)) { Fragment f = new BudgetListTotalsDetailsActivity(); f.setArguments(intent.getExtras()); transaction.replace(R.id.fragment_container, f); } else { transaction.replace(R.id.fragment_container, new EntityListFragment()); } transaction.commit(); }
From source file:com.example.grayapps.contextaware.BarGraphFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View layout = inflater.inflate(R.layout.bargraph, container, false); // Init first chart mUpdateOne = true;// w ww.ja v a 2 s.c o m mChartOne = (BarChartView) layout.findViewById(R.id.barchart1); CardView barCard = (CardView) layout.findViewById(R.id.cardContent); barCard.setCardBackgroundColor(Color.parseColor(getResources().getString(R.color.colorNeutralBar))); showChart(0, mChartOne); //showChart(1, mChartTwo, mPlayTwo); //showChart(2, mChartThree, mPlayThree); return layout; }
From source file:com.audionote.widget.SlideSwitch.java
public SlideSwitch(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); listener = null;/*from w w w . j a va 2 s . com*/ paint = new Paint(); paint.setAntiAlias(true); TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.slideswitch); color_theme = a.getColor(R.styleable.slideswitch_themeColor, DEFAULT_COLOR_THEME); color_back_theme = a.getColor(R.styleable.slideswitch_backColor, Color.WHITE); isOpen = true; shape = SHAPE_CIRCLE; a.recycle(); borderWidth = ScreenUtils.getDipValue(context, 1); border_color = Color.parseColor("#ffcccccc"); }
From source file:com.flowzr.activity.RecurActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Setup ActionBar getSupportActionBar().setDisplayHomeAsUpEnabled(true); //@see: http://stackoverflow.com/questions/16539251/get-rid-of-blue-line, //only way found to remove on various devices 2.3x, 3.0, ... getSupportActionBar().setBackgroundDrawable(new ColorDrawable(Color.parseColor("#000000"))); setContentView(R.layout.recur);//from w ww. j ava2 s . c o m df = DateUtils.getLongDateFormat(this); stopsOnDate.add(Calendar.YEAR, 1); sInterval = (Spinner) findViewById(R.id.intervalSpinner); sPeriod = (Spinner) findViewById(R.id.recurSpinner); layoutInterval = (LinearLayout) findViewById(R.id.layoutInterval); layoutRecur = (LinearLayout) findViewById(R.id.recurInterval); bStartDate = (Button) findViewById(R.id.bStartDate); bStartDate.setOnClickListener(new OnClickListener() { @Override public void onClick(final View v) { final Calendar c = startDate; DatePickerDialog d = new DatePickerDialog(RecurActivity.this, new DatePickerDialog.OnDateSetListener() { @Override public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) { c.set(Calendar.YEAR, year); c.set(Calendar.MONTH, monthOfYear); c.set(Calendar.DAY_OF_MONTH, dayOfMonth); DateUtils.startOfDay(c); editStartDate(c.getTimeInMillis()); } }, c.get(Calendar.YEAR), c.get(Calendar.MONTH), c.get(Calendar.DAY_OF_MONTH)); d.show(); } }); addSpinnerItems(sInterval, new RecurInterval[] { RecurInterval.NO_RECUR, RecurInterval.WEEKLY, RecurInterval.MONTHLY }); addSpinnerItems(sPeriod, periods); LayoutInflater inflater = getLayoutInflater(); //addLayouts(inflater, layoutInterval, intervals); addLayouts(inflater, layoutRecur, periods); Recur recur = RecurUtils.createDefaultRecur(); Intent intent = getIntent(); if (intent != null) { String extra = intent.getStringExtra(EXTRA_RECUR); if (extra != null) { recur = RecurUtils.createFromExtraString(extra); } } editRecur(recur); sInterval.setOnItemSelectedListener(new OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { RecurInterval interval = getRecurInterval(sInterval.getSelectedItem()); selectInterval(interval); } @Override public void onNothingSelected(AdapterView<?> arg0) { } }); sPeriod.setOnItemSelectedListener(new OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { RecurPeriod period = periods[position]; selectPeriod(period); } @Override public void onNothingSelected(AdapterView<?> arg0) { } }); }
From source file:com.fast.access.kam.widget.colorpicker.dashclockpicker.ColorPreference.java
private void initAttrs(AttributeSet attrs, int defStyle) { TypedArray a = getContext().getTheme().obtainStyledAttributes(attrs, R.styleable.ColorPreference, defStyle, defStyle);/*from w ww. j a v a2 s .c o m*/ try { mItemLayoutId = a.getResourceId(R.styleable.ColorPreference_itemLayout, mItemLayoutId); mNumColumns = a.getInteger(R.styleable.ColorPreference_numColumns, mNumColumns); int choicesResId = a.getResourceId(R.styleable.ColorPreference_choices, R.array.default_color_choice_values); if (choicesResId > 0) { String[] choices = a.getResources().getStringArray(choicesResId); mColorChoices = new int[choices.length]; for (int i = 0; i < choices.length; i++) { mColorChoices[i] = Color.parseColor(choices[i]); } } } finally { a.recycle(); } setWidgetLayoutResource(mItemLayoutId); }
From source file:com.filemanager.free.utils.MainActivityHelper.java
public void showFailedOperationDialog(ArrayList<BaseFile> failedOps, boolean move, Context contextc) { MaterialDialog.Builder mat = new MaterialDialog.Builder(contextc); mat.title("Operation Unsuccessful"); if (mainActivity.theme1 == 1) mat.theme(Theme.DARK);/*w w w. j a v a2s.co m*/ mat.positiveColor(Color.parseColor(mainActivity.fabskin)); mat.positiveText(R.string.cancel); String content = "Following files were not " + (move ? "moved" : "copied") + " successfully"; int k = 1; for (BaseFile s : failedOps) { content = content + "\n" + (k) + ". " + s.getName(); k++; } mat.content(content); mat.build().show(); }
From source file:com.github.michaelins.lightstatusbar.LightStatusBar.java
/** * Executes the request and returns PluginResult. * * @param action/*w w w. j a v a 2 s .c o m*/ * The action to execute. * @param args * JSONArry of arguments for the plugin. * @param callbackContext * The callback id used when calling back into JavaScript. * @return True if the action was valid, false otherwise. */ @Override public boolean execute(final String action, final CordovaArgs args, final CallbackContext callbackContext) throws JSONException { LOG.v(TAG, "Executing action: " + action); final Activity activity = this.cordova.getActivity(); final Window window = activity.getWindow(); if ("isSupported".equals(action)) { this.cordova.getActivity().runOnUiThread(new Runnable() { @Override public void run() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M || SystemBarTintManager.IsMiuiV6Plus()) { callbackContext.success("true"); } else { callbackContext.success("false"); } } }); return true; } if ("setStatusBarColor".equals(action)) { this.cordova.getActivity().runOnUiThread(new Runnable() { @Override public void run() { try { webView.getView().setFitsSystemWindows(true); if (SystemBarTintManager.IsMiuiV6Plus()) { // MIUI6+ light status bar if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { setTranslucentStatus(window, true); } SystemBarTintManager tintManager = new SystemBarTintManager(activity); tintManager.setStatusBarTintEnabled(true); tintManager.setStatusBarTintColor(Color.parseColor(args.getString(0))); tintManager.setStatusBarDarkMode(true, activity); } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { // 6.0+ light status bar window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); int uiOptions = window.getDecorView().getSystemUiVisibility() | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR; window.getDecorView().setSystemUiVisibility(uiOptions); setStatusBarBackgroundColor(args.getString(0)); } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { setStatusBarBackgroundColor(args.getString(0)); } } catch (JSONException ignore) { LOG.e(TAG, "Invalid hexString argument, use f.i. '#777777'"); } } }); return true; } if ("enable".equals(action)) { this.cordova.getActivity().runOnUiThread(new Runnable() { @Override public void run() { } }); return true; } if ("disable".equals(action)) { this.cordova.getActivity().runOnUiThread(new Runnable() { @Override public void run() { } }); return true; } return false; }
From source file:com.filemanager.free.adapters.Recycleradapter.java
public Recycleradapter(Main m, ArrayList<Layoutelements> items, Context context) { this.main = m; this.items = items; this.context = context; for (int i = 0; i < items.size(); i++) { myChecked.put(i, false);/*from w w w . jav a2s .c om*/ myanim.put(i, false); } colorMatrixColorFilter = main.colorMatrixColorFilter; mInflater = (LayoutInflater) context.getSystemService(Activity.LAYOUT_INFLATER_SERVICE); c1 = Color.parseColor("#757575"); c2 = Color.parseColor("#f06292"); c3 = Color.parseColor("#9575cd"); c4 = Color.parseColor("#da4336"); c5 = Color.parseColor("#00bfa5"); c6 = Color.parseColor("#e06055"); c7 = Color.parseColor("#f9a825"); c8 = Color.parseColor("#a4c439"); c9 = Color.parseColor("#9e9e9e"); column = main.columns; rowHeight = main.dpToPx(100); grey_color = Color.parseColor("#ff666666"); anim = /*main.IS_LIST?R.anim.fade_in_top:*/R.anim.fade_in_top; }