List of usage examples for android.graphics Color parseColor
@ColorInt public static int parseColor(@Size(min = 1) String colorString)
From source file:com.cryart.sabbathschool.misc.SSReminderService.java
@Override public boolean onStartJob(JobParameters job) { Context context = getBaseContext(); SSReminder.scheduleAlarms(context);//w w w . j a va 2 s .co m try { String channelId = "ss_notification_channel"; String channelName = getString(R.string.app_name); NotificationManager _SSNotificationManager = (NotificationManager) context .getSystemService(Context.NOTIFICATION_SERVICE); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { int importance = NotificationManager.IMPORTANCE_HIGH; NotificationChannel mChannel = new NotificationChannel(channelId, channelName, importance); _SSNotificationManager.createNotificationChannel(mChannel); } Intent _SSContentIntent = new Intent(context, SSSplashActivity.class); Intent _SSShareIntent = new Intent(); _SSContentIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); _SSShareIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); _SSShareIntent.setAction(Intent.ACTION_SEND); _SSShareIntent.putExtra(Intent.EXTRA_TEXT, ""); _SSShareIntent.setType("*/*"); PendingIntent _SSPendingContentIntent = PendingIntent.getActivity(context, 0, _SSContentIntent, PendingIntent.FLAG_CANCEL_CURRENT); PendingIntent _SSPendingShareIntent = PendingIntent.getActivity(context, 0, Intent.createChooser(_SSShareIntent, context.getString(R.string.ss_share)), PendingIntent.FLAG_UPDATE_CURRENT); NotificationCompat.Builder _SSNotificationBuilder = new NotificationCompat.Builder(context, "ss_notification_channel").setSmallIcon(R.mipmap.ic_stat_notification) .setContentTitle(context.getString(R.string.ss_app_name)) .setColor(Color.parseColor(SSColorTheme.getInstance().getColorPrimary())) .addAction(0, context.getString(R.string.ss_menu_read_now), _SSPendingContentIntent) .addAction(0, context.getString(R.string.ss_share), _SSPendingShareIntent) .setAutoCancel(true).setVibrate(new long[] { 1000, 1000 }) .setContentIntent(_SSPendingContentIntent) .setContentText(context.getString(R.string.ss_settings_reminder_text)); _SSNotificationManager.notify(1, _SSNotificationBuilder.build()); } catch (Exception e) { Crashlytics.log(e.getMessage()); } return false; // Answers the question: "Is there still work going on?" }
From source file:com.breadwallet.tools.adapter.TransactionListAdapter.java
public TransactionListAdapter(Activity a, TransactionListItem[] d) { activity = a;/* ww w.j a v a 2 s . c o m*/ data = new ArrayList<>(); if (d != null) Collections.addAll(data, d); inflater = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE); unconfirmedColor = ContextCompat.getColor(a, R.color.white); sentColor = Color.parseColor("#FF5454"); receivedColor = Color.parseColor("#00BF00"); buyBitcoinEnabled = APIClient.getInstance(a) .isFeatureEnabled(APIClient.FeatureFlags.BUY_BITCOIN.toString()); buyBitcoinEnabled = BRConstants.PLATFORM_ON; //todo delete }
From source file:com.njlabs.amrita.aid.aums.AumsActivity.java
@Override public void init(Bundle savedInstanceState) { setupLayout(R.layout.activity_aums, Color.parseColor("#e91e63")); rollNoEditText = (EditText) findViewById(R.id.roll_no); passwordEditText = (EditText) findViewById(R.id.pwd); List<String> campusDataSet = new LinkedList<>(Arrays.asList("Ettimadai", "Amritapuri", "Bangalore", "Mysore", "AIMS", "Business schools", "ASAS Kochi")); spinner = (MaterialSpinner) findViewById(R.id.spinner); spinner.setItems(campusDataSet);/* w w w.ja va2 s . c o m*/ AlertDialog.Builder builder = new AlertDialog.Builder(baseContext); builder.setMessage("Amrita University does not provide an API for accessing AUMS data. " + "So, if any changes are made to the AUMS Website, please be patient while I try to catch up.") .setCancelable(true).setIcon(R.drawable.ic_action_info_small) .setPositiveButton("Got it !", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.dismiss(); hideSoftKeyboard(); } }); AlertDialog alert = builder.create(); alert.requestWindowFeature(Window.FEATURE_NO_TITLE); alert.show(); dialog = new ProgressDialog(baseContext); dialog.setIndeterminate(true); dialog.setCancelable(false); dialog.setInverseBackgroundForced(false); dialog.setCanceledOnTouchOutside(false); dialog.setMessage("Authenticating your credentials ... "); aumsPreferences = getSharedPreferences("aums_prefs", Context.MODE_PRIVATE); String rollNo = aumsPreferences.getString("RollNo", ""); String encodedPassword = aumsPreferences.getString("Password", ""); spinner.setSelectedIndex(aumsPreferences.getInt("server_ordinal", 0)); aums = new Aums(baseContext); if (!rollNo.equals("")) { ((EditText) findViewById(R.id.roll_no)).setText(rollNo); aums.studentRollNo = rollNo; hideSoftKeyboard(); } if (!encodedPassword.equals("")) { ((EditText) findViewById(R.id.pwd)).setText(Security.decrypt(encodedPassword, MainApplication.key)); hideSoftKeyboard(); } }
From source file:com.example.yeshwanthemani.billpayementapp.HomeActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_home); Button button = (Button) findViewById(R.id.button); scanResults = (TextView) findViewById(R.id.scan_results); if (savedInstanceState != null) { imageUri = Uri.parse(savedInstanceState.getString(SAVED_INSTANCE_URI)); scanResults.setText(savedInstanceState.getString(SAVED_INSTANCE_RESULT)); }/*from w w w. j av a 2s . c o m*/ button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { ActivityCompat.requestPermissions(HomeActivity.this, new String[] { Manifest.permission.WRITE_EXTERNAL_STORAGE }, REQUEST_WRITE_PERMISSION); } }); detector = new BarcodeDetector.Builder(getApplicationContext()) .setBarcodeFormats(Barcode.DATA_MATRIX | Barcode.QR_CODE).build(); if (!detector.isOperational()) { scanResults.setText("Could not set up the detector!"); return; } Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close); drawer.setDrawerListener(toggle); toggle.syncState(); android.support.v7.app.ActionBar bar = getSupportActionBar(); if (bar != null) { bar.setBackgroundDrawable(new ColorDrawable(Color.parseColor("#FF6600"))); bar.setTitle("BillPay"); } NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); navigationView.setNavigationItemSelectedListener(this); }
From source file:com.brodev.socialapp.view.ShareActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { // setTheme(SampleList.THEME); //Used for theme switching in samples super.onCreate(savedInstanceState); setContentView(R.layout.fragment_tabs_pager); mTabHost = (TabHost) findViewById(android.R.id.tabhost); mTabHost.setup();/*from w w w .j a v a 2 s . c om*/ mViewPager = (ViewPager) findViewById(R.id.pager); mViewPager.setOffscreenPageLimit(3); mTabsAdapter = new TabsAdapter(this, mTabHost, mViewPager); user = (User) getApplication().getApplicationContext(); colorView = new ColorView(getApplicationContext()); colorCode = colorView.getColorCode(getApplicationContext(), user); Bundle extras = getIntent().getExtras(); getSupportActionBar().setDisplayHomeAsUpEnabled(true); if (extras != null) { Boolean ihasPost = extras.getBoolean("can_share_item_on_feed"); if (ihasPost) { mTabsAdapter.addTab(mTabHost.newTabSpec("Post").setIndicator("Post"), PostFragment.class, extras); } } mTabsAdapter.addTab(mTabHost.newTabSpec("Message").setIndicator("Message"), ComposeFragment.class, extras); mTabsAdapter.addTab(mTabHost.newTabSpec("email").setIndicator("Email"), EmailFragment.class, extras); if (savedInstanceState != null) { mTabHost.setCurrentTabByTag(savedInstanceState.getString("tab")); } //set color for tabhost for (int i = 0; i < mTabHost.getTabWidget().getChildCount(); i++) { mTabHost.getTabWidget().getChildAt(i).setBackgroundColor(Color.parseColor("#272727")); tv = (TextView) mTabHost.getTabWidget().getChildAt(i).findViewById(android.R.id.title); tv.setTextColor(Color.parseColor("#ffffffff")); } mTabHost.getTabWidget().setCurrentTab(0); mTabHost.getTabWidget().getChildAt(0).setBackgroundColor(Color.parseColor(colorCode)); }
From source file:com.amaze.filemanager.activities.DbViewer.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Sp = PreferenceManager.getDefaultSharedPreferences(this); theme = Integer.parseInt(Sp.getString("theme", "0")); theme1 = theme == 2 ? PreferenceUtils.hourOfDay() : theme; if (theme1 == 1) { setTheme(R.style.appCompatDark); getWindow().getDecorView().setBackgroundColor(getResources().getColor(R.color.holo_dark_background)); }//from www .j a va 2 s .co m 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("Amaze", ((BitmapDrawable) ContextCompat.getDrawable(this, R.mipmap.ic_launcher)).getBitmap(), Color.parseColor(skin)); ((Activity) this).setTaskDescription(taskDescription); } skinStatusBar = PreferenceUtils.getStatusColor(skin); getSupportActionBar().setBackgroundDrawable(new ColorDrawable(Color.parseColor(skin))); getSupportActionBar().setDisplayHomeAsUpEnabled(true); rootMode = PreferenceManager.getDefaultSharedPreferences(this).getBoolean("rootmode", false); int sdk = Build.VERSION.SDK_INT; if (sdk == 20 || sdk == 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))); } 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.example.android.miwok.activity.ColorsActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.word_list);//from w w w . ja v a 2s .c o m mAudioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE); // Create a list of words final ArrayList<Word> words = new ArrayList<Word>(); words.add(new Word("red", "weei", R.drawable.color_red, R.raw.color_red)); words.add(new Word("mustard yellow", "chiwii", R.drawable.color_mustard_yellow, R.raw.color_mustard_yellow)); words.add(new Word("dusty yellow", "opiis", R.drawable.color_dusty_yellow, R.raw.color_dusty_yellow)); words.add(new Word("green", "chokokki", R.drawable.color_green, R.raw.color_green)); words.add(new Word("brown", "akaakki", R.drawable.color_brown, R.raw.color_brown)); words.add(new Word("gray", "opoppi", R.drawable.color_gray, R.raw.color_gray)); words.add(new Word("black", "kululli", R.drawable.color_black, R.raw.color_black)); words.add(new Word("white", "kelelli", R.drawable.color_white, R.raw.color_white)); // Create an {@link WordAdapter}, whose data source is a list of {@link Word}s. The // adapter knows how to create list items for each item in the list. WordAdapter adapter = new WordAdapter(this, words); // Find the {@link ListView} object in the view hierarchy of the {@link Activity}. // There should be a {@link ListView} with the view ID called list, which is declared in the // word_list.xml layout file. ListView listView = (ListView) findViewById(R.id.list); listView.setBackgroundColor(Color.parseColor("#8800A0")); //listView.setBackgroundColor(R.color.category_colors); // Make the {@link ListView} use the {@link WordAdapter} we created above, so that the // {@link ListView} will display list items for each {@link Word} in the list. listView.setAdapter(adapter); //plays the audio for number one when any item in the list is clicked click listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { //release current resources being used for media player if it currently exists //because we are about to play a different sound file. releaseMediaPlayer(); //get the word located in the list that is at same position as the item clicked in the list Word currentWord = words.get(position); // Request audio focus for playback int result = mAudioManager.requestAudioFocus(mAudioFocusChangeListener, // Use the music stream. AudioManager.STREAM_MUSIC, // Request temporary focus. AudioManager.AUDIOFOCUS_GAIN_TRANSIENT); if (result == AudioManager.AUDIOFOCUS_REQUEST_GRANTED) { //create the medial player with the audio file that is stored in the list for that word. mMediaPlayer = MediaPlayer.create(getApplicationContext(), currentWord.getmMiwokAudio()); //play the file mMediaPlayer.start(); //listener to stop and release the media player and resources being used // once the sounds has finished playing mMediaPlayer.setOnCompletionListener(mCompletionListener); } } }); }
From source file:com.njlabs.amrita.aid.gpms.ui.GpmsActivity.java
@Override public void init(Bundle savedInstanceState) { setupLayout(R.layout.activity_gpms_login, Color.parseColor("#009688")); rollNoEditText = (EditText) findViewById(R.id.roll_no); passwordEditText = (EditText) findViewById(R.id.pwd); AlertDialog.Builder builder = new AlertDialog.Builder(baseContext); builder.setMessage("Amrita University does not provide an API for accessing GPMS data. " + "So, if any changes are made to the GPMS Website, please be patient while I try to catch up.") .setCancelable(true).setIcon(R.drawable.ic_action_info_small) .setPositiveButton("Got it !", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel();//from www.j ava2 s . co m hideSoftKeyboard(); showConnectToAmritaAlert(); } }); AlertDialog alert = builder.create(); alert.requestWindowFeature(Window.FEATURE_NO_TITLE); alert.show(); dialog = new ProgressDialog(baseContext); dialog.setIndeterminate(true); dialog.setCancelable(false); dialog.setInverseBackgroundForced(false); dialog.setCanceledOnTouchOutside(false); dialog.setMessage("Authenticating your credentials ... "); preferences = getSharedPreferences("gpms_prefs", Context.MODE_PRIVATE); String rollNo = preferences.getString("roll_no", ""); String encodedPassword = preferences.getString("password", ""); if (!rollNo.equals("")) { rollNoEditText.setText(rollNo); studentRollNo = rollNo; hideSoftKeyboard(); } else { SharedPreferences aumsPrefs = getSharedPreferences("aums_prefs", Context.MODE_PRIVATE); String aumsRollNo = aumsPrefs.getString("RollNo", ""); if (!aumsRollNo.equals("")) { rollNoEditText.setText(aumsRollNo); studentRollNo = aumsRollNo; hideSoftKeyboard(); } } if (!encodedPassword.equals("")) { passwordEditText.setText(Security.decrypt(encodedPassword, MainApplication.key)); hideSoftKeyboard(); } }
From source file:com.example.android.miwok.activity.PhrasesActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.word_list);/*from w w w. j a va 2 s .co m*/ mAudioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE); // Create a list of words final ArrayList<Word> words = new ArrayList<Word>(); words.add(new Word("Where are you going?", "minto wuksus", R.raw.phrase_where_are_you_going)); words.add(new Word("What is your name?", "tinn oyaase'n", R.raw.phrase_what_is_your_name)); words.add(new Word("My name is...", "oyaaset...", R.raw.phrase_my_name_is)); words.add(new Word("How are you feeling?", "michkss?", R.raw.phrase_how_are_you_feeling)); words.add(new Word("Im feeling good.", "kuchi achit", R.raw.phrase_im_feeling_good)); words.add(new Word("Are you coming?", "ns'aa?", R.raw.phrase_are_you_coming)); words.add(new Word("Yes, Im coming.", "h nm", R.raw.phrase_yes_im_coming)); words.add(new Word("Im coming.", "nm", R.raw.phrase_im_coming)); words.add(new Word("Lets go.", "yoowutis", R.raw.phrase_lets_go)); words.add(new Word("Come here.", "nni'nem", R.raw.phrase_come_here)); // Create an {@link WordAdapter}, whose data source is a list of {@link Word}s. The // adapter knows how to create list items for each item in the list. WordAdapter adapter = new WordAdapter(this, words); // Find the {@link ListView} object in the view hierarchy of the {@link Activity}. // There should be a {@link ListView} with the view ID called list, which is declared in the // word_list.xml layout file. ListView listView = (ListView) findViewById(R.id.list); listView.setBackgroundColor(Color.parseColor("#16AFCA")); //listView.setBackgroundColor(R.color.category_phrases); // Make the {@link ListView} use the {@link WordAdapter} we created above, so that the // {@link ListView} will display list items for each {@link Word} in the list. listView.setAdapter(adapter); //plays the audio for number one when any item in the list is clicked click listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { //release current resources being used for media player if it currently exists //because we are about to play a different sound file. releaseMediaPlayer(); //get the word located in the list that is at same position as the item clicked in the list Word currentWord = words.get(position); /// Request audio focus for playback int result = mAudioManager.requestAudioFocus(mAudioFocusChangeListener, // Use the music stream. AudioManager.STREAM_MUSIC, // Request temporary focus. AudioManager.AUDIOFOCUS_GAIN_TRANSIENT); if (result == AudioManager.AUDIOFOCUS_REQUEST_GRANTED) { //create the medial player with the audio file that is stored in the list for that word. mMediaPlayer = MediaPlayer.create(getApplicationContext(), currentWord.getmMiwokAudio()); //play the file mMediaPlayer.start(); //listener to stop and release the media player and resources being used // once the sounds has finished playing mMediaPlayer.setOnCompletionListener(mCompletionListener); } } }); }
From source file:com.anjuke.library.uicomponent.photo.EndlessCircleIndicator.java
public EndlessCircleIndicator(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); if (isInEditMode()) return;/*from w w w . j a v a2s . c om*/ //Load defaults from resources final Resources res = getResources(); //Retrieve styles attributes TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.EndlessCircleIndicator, defStyle, 0); mCentered = a.getBoolean(R.styleable.EndlessCircleIndicator_centered, true); mOrientation = a.getInt(R.styleable.EndlessCircleIndicator_android_orientation, 0); mPaintPageFill.setStyle(Style.FILL); mPaintPageFill .setColor(a.getColor(R.styleable.EndlessCircleIndicator_pageColor, Color.parseColor("#00000000"))); mPaintStroke.setStyle(Style.STROKE); mPaintStroke.setColor( a.getColor(R.styleable.EndlessCircleIndicator_strokeColor, Color.parseColor("#FFDDDDDD"))); mPaintStroke.setStrokeWidth(a.getDimension(R.styleable.EndlessCircleIndicator_strokeWidth, UIUtils.dipToPx(res.getDisplayMetrics(), 1))); mPaintFill.setStyle(Style.FILL); mPaintFill .setColor(a.getColor(R.styleable.EndlessCircleIndicator_fillColor, Color.parseColor("#FFFFFFFF"))); mRadius = a.getDimension(R.styleable.EndlessCircleIndicator_radius, UIUtils.dipToPx(res.getDisplayMetrics(), 3)); mSnap = a.getBoolean(R.styleable.EndlessCircleIndicator_snap, false); Drawable background = a.getDrawable(R.styleable.EndlessCircleIndicator_android_background); if (background != null) { setBackgroundDrawable(background); } a.recycle(); final ViewConfiguration configuration = ViewConfiguration.get(context); mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration); }