List of usage examples for android.graphics Color GRAY
int GRAY
To view the source code for android.graphics Color GRAY.
Click Source Link
From source file:com.xcyo.live.view.SlideSwitch.java
@Override protected void onDraw(Canvas canvas) { if (shape == SHAPE_RECT) { paint.setColor(Color.GRAY); canvas.drawRect(backRect, paint); paint.setColor(color_theme);/*from w w w. j a v a2 s.c o m*/ paint.setAlpha(alpha); canvas.drawRect(backRect, paint); frontRect.set(frontRect_left, RIM_SIZE, frontRect_left + getMeasuredWidth() / 2 - RIM_SIZE, getMeasuredHeight() - RIM_SIZE); paint.setColor(Color.WHITE); canvas.drawRect(frontRect, paint); } else { // draw circle int radius; radius = backRect.height() / 2; paint.setColor(Color.GRAY); backCircleRect.set(backRect); canvas.drawRoundRect(backCircleRect, radius, radius, paint); paint.setColor(color_theme); paint.setAlpha(alpha); canvas.drawRoundRect(backCircleRect, radius, radius, paint); frontRect.set(frontRect_left, RIM_SIZE, frontRect_left + backRect.height() - 2 * RIM_SIZE, backRect.height() - RIM_SIZE); frontCircleRect.set(frontRect); paint.setColor(Color.WHITE); canvas.drawRoundRect(frontCircleRect, radius, radius, paint); } }
From source file:com.example.administrator.iclub21.view.SlideSwitch.java
@Override protected void onDraw(Canvas canvas) { if (shape == SHAPE_RECT) { paint.setColor(Color.GRAY); canvas.drawRect(backRect, paint); paint.setColor(color_theme);/*from w ww. j av a 2s . c o m*/ paint.setAlpha(alpha); canvas.drawRect(backRect, paint); frontRect.set(frontRect_left, RIM_SIZE, frontRect_left + getMeasuredWidth() / 2 - RIM_SIZE, getMeasuredHeight() - RIM_SIZE); paint.setColor(Color.WHITE); canvas.drawRect(frontRect, paint); } else { // draw circle int radius; radius = backRect.height() / 2 - RIM_SIZE; paint.setColor(Color.GRAY); backCircleRect.set(backRect); canvas.drawRoundRect(backCircleRect, radius, radius, paint); paint.setColor(color_theme); paint.setAlpha(alpha); canvas.drawRoundRect(backCircleRect, radius, radius, paint); frontRect.set(frontRect_left, RIM_SIZE, frontRect_left + backRect.height() - 2 * RIM_SIZE, backRect.height() - RIM_SIZE); frontCircleRect.set(frontRect); paint.setColor(Color.WHITE); canvas.drawRoundRect(frontCircleRect, radius, radius, paint); } }
From source file:io.demiseq.jetreader.activities.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ButterKnife.bind(this); db = new JumpDatabaseHelper(MainActivity.this); initToolbar();//from w w w . j ava 2 s . c om setupDrawerLayout(); progressBar.getIndeterminateDrawable().setColorFilter(Color.GRAY, PorterDuff.Mode.SRC_ATOP); categories = db.getAllCategories(); prefs = PreferenceManager.getDefaultSharedPreferences(this); searchBox.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) { toggleSearch(true); int position = temp.indexOf(adapter.getItem(i)); Intent intent = new Intent(MainActivity.this, DetailActivity.class); intent.putExtra("manga", temp.get(position)); startActivity(intent); } }); searchBox.setOnClearListener(new CustomAutoCompleteTextView.OnClearListener() { @Override public void onClear() { toggleSearch(true); } }); boolean isOpenFromNotification = getIntent().getBooleanExtra("favorite", false); if (savedInstanceState == null && !isOpenFromNotification) { GetHotMangas(); new getAllMangas().execute(); } else if (isOpenFromNotification) { GetSubscription(); new getAllMangas().execute(); NavigationView view = (NavigationView) findViewById(R.id.navigation_view); Menu menu = view.getMenu(); for (int i = 0; i < menu.size(); i++) { MenuItem item = menu.getItem(i); if (item.getItemId() == R.id.drawer_feeds) { savedMenuId = item.getItemId(); item.setChecked(true); } } } else { setTitle(savedInstanceState.getString("title")); mangas = savedInstanceState.getParcelableArrayList("list"); if (mangas != null) temp = new ArrayList<>(mangas); adapter = new SearchAdapter(getApplicationContext(), R.layout.search_dropdown_item, mangas); searchBox.setAdapter(adapter); NavigationView view = (NavigationView) findViewById(R.id.navigation_view); Menu menu = view.getMenu(); for (int i = 0; i < menu.size(); i++) { MenuItem item = menu.getItem(i); if (item.getItemId() == savedInstanceState.getInt("menu")) { savedMenuId = savedInstanceState.getInt("menu"); item.setChecked(true); } } } }
From source file:net.HeZi.Android.HeInputLibrary.HeInput_Activation_Fragment.java
private void updateUI() { boolean bActivated = false; boolean bDefaultKeyboard = false; boolean bDialectSelected = false; activeHeInputBtn.setEnabled(true);/*from w w w . j a va 2 s. co m*/ selectDefaultMethodBtn.setEnabled(false); selectDefaultMethodBtn.setTextColor(Color.GRAY); selectChineseDialectBtn.setEnabled(false); selectChineseDialectBtn.setTextColor(Color.GRAY); //Check Activited //http://stackoverflow.com/questions/4210086/how-can-i-get-a-list-of-all-the-input-methods-and-their-names-that-are-install InputMethodManager imeManager = (InputMethodManager) getActivity().getApplicationContext() .getSystemService(Context.INPUT_METHOD_SERVICE); List<InputMethodInfo> InputMethods = imeManager.getEnabledInputMethodList(); for (InputMethodInfo item : InputMethods) { if (item.getPackageName().toLowerCase().equals(hostApplicationName.toLowerCase())) { bActivated = true; inputId = item.getId(); Log.d("Input Id: ", "InputId: " + inputId); setting_instruction.setText(getString(R.string.instruction_2_steps)); activeHeInputBtn.setEnabled(false); activeHeInputBtn.setTextColor(Color.GRAY); activeHeInputBtn.setText(getString(R.string.heInput_activated)); selectDefaultMethodBtn.setEnabled(true); selectDefaultMethodBtn.setTextColor(Color.RED); selectChineseDialectBtn.setEnabled(false); selectChineseDialectBtn.setTextColor(Color.GRAY); break; } } // Check default keyboard if (bActivated) { String defaultName = Settings.Secure.getString(getActivity().getContentResolver(), Settings.Secure.DEFAULT_INPUT_METHOD); if (defaultName.toLowerCase().contains(hostApplicationName.toLowerCase())) { bDefaultKeyboard = true; } } if (bActivated && bDefaultKeyboard) { setting_instruction.setText(getString(R.string.instruction_setting_done)); selectDefaultMethodBtn.setEnabled(false); selectDefaultMethodBtn.setTextColor(Color.GRAY); selectDefaultMethodBtn.setText(getString(R.string.heInput_is_default)); selectChineseDialectBtn.setEnabled(true); selectChineseDialectBtn.setTextColor(Color.RED); editText.setVisibility(View.VISIBLE); editText.requestFocus(); } }
From source file:net.droidsolutions.droidcharts.core.plot.Marker.java
/** * Constructs a new marker.//from w ww . jav a 2s .co m * * @param paint * the paint (<code>null</code> not permitted). */ protected Marker(int paint) { this(paint, 0.5f, Color.GRAY, 0.5f, 200); }
From source file:color.kidpaint.com.kidpaintcolor.dialog.TextToolDialog.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { LayoutInflater inflater = getActivity().getLayoutInflater(); AlertDialog.Builder builder = new CustomAlertDialogBuilder(mContext); builder.setTitle(R.string.text_tool_dialog_title); final View view = inflater.inflate(R.layout.dialog_text_tool, null); mTextEditText = (EditText) view.findViewById(R.id.text_tool_dialog_input_text); mTextEditText.addTextChangedListener(new TextWatcher() { @Override//from w w w. ja va2s . c o m public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { } @Override public void afterTextChanged(Editable s) { String text = mTextEditText.getText().toString(); mOnTextToolDialogChangedListener.setText(text); mText = text; } }); mFontSpinner = (Spinner) view.findViewById(R.id.text_tool_dialog_spinner_font); ArrayAdapter<CharSequence> fontAdapter = ArrayAdapter.createFromResource(mContext, R.array.text_tool_font_array, android.R.layout.simple_spinner_item); fontAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); mFontSpinner.setAdapter(fontAdapter); mFontSpinner.setBackgroundColor(Color.GRAY); mFontSpinner.setOnItemSelectedListener(new Spinner.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { String font = parent.getItemAtPosition(position).toString(); mOnTextToolDialogChangedListener.setFont(font); mFontIndex = position; if (mFontSpinnerInitialized) hideKeyboard(); else mFontSpinnerInitialized = true; } @Override public void onNothingSelected(AdapterView<?> parent) { } }); mUnderlinedToggleButton = (ToggleButton) view.findViewById(R.id.text_tool_dialog_toggle_underlined); mUnderlinedToggleButton.setTextOn(Html .fromHtml("<u>" + getResources().getString(R.string.text_tool_dialog_underline_shortcut) + "</u>")); mUnderlinedToggleButton.setOnClickListener(new ToggleButton.OnClickListener() { @Override public void onClick(View v) { boolean underlined = mUnderlinedToggleButton.isChecked(); mOnTextToolDialogChangedListener.setUnderlined(underlined); mUnderlined = underlined; hideKeyboard(); } }); mItalicToggleButton = (ToggleButton) view.findViewById(R.id.text_tool_dialog_toggle_italic); mItalicToggleButton.setTextOn(Html .fromHtml("<i>" + getResources().getString(R.string.text_tool_dialog_italic_shortcut) + "</i>")); mItalicToggleButton.setOnClickListener(new ToggleButton.OnClickListener() { @Override public void onClick(View v) { boolean italic = mItalicToggleButton.isChecked(); mOnTextToolDialogChangedListener.setItalic(italic); mItalic = italic; hideKeyboard(); } }); mBoldToggleButton = (ToggleButton) view.findViewById(R.id.text_tool_dialog_toggle_bold); mBoldToggleButton.setTextOn( Html.fromHtml("<b>" + getResources().getString(R.string.text_tool_dialog_bold_shortcut) + "</b>")); mBoldToggleButton.setOnClickListener(new ToggleButton.OnClickListener() { @Override public void onClick(View v) { boolean bold = mBoldToggleButton.isChecked(); mOnTextToolDialogChangedListener.setBold(bold); mBold = bold; hideKeyboard(); } }); mTextSizeSpinner = (Spinner) view.findViewById(R.id.text_tool_dialog_spinner_text_size); ArrayAdapter<CharSequence> textSizeAdapter = ArrayAdapter.createFromResource(mContext, R.array.text_tool_size_array, android.R.layout.simple_spinner_item); textSizeAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); mTextSizeSpinner.setAdapter(textSizeAdapter); mTextSizeSpinner.setBackgroundColor(Color.GRAY); mTextSizeSpinner.setOnItemSelectedListener(new Spinner.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { int size = Integer.parseInt(parent.getItemAtPosition(position).toString()); mOnTextToolDialogChangedListener.setTextSize(size); mTextSizeIndex = position; if (mTextSizeSpinnerInitialized) hideKeyboard(); else mTextSizeSpinnerInitialized = true; } @Override public void onNothingSelected(AdapterView<?> parent) { } }); builder.setView(view); builder.setNeutralButton(R.string.done, this); Dialog textDialog = builder.create(); WindowManager.LayoutParams window_params = textDialog.getWindow().getAttributes(); textDialog.getWindow().setDimAmount(0.0f); textDialog.getWindow().setAttributes(window_params); return textDialog; }
From source file:com.jigarmjoshi.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (SimpleDatabaseUtil.isFirstApplicationStart(this)) { Log.i(MainActivity.class.getSimpleName(), "creating database for the first time"); SQLiteSimple databaseSimple = new SQLiteSimple(this, DATABASE_VERSION); databaseSimple.create(Report.class, LastLocation.class); } else if (SimpleDatabaseUtil.isFirstStartOnAppVersion(this, DATABASE_VERSION)) { Log.i(MainActivity.class.getSimpleName(), "creating database for the first time for this version " + DATABASE_VERSION); SQLiteSimple databaseSimple = new SQLiteSimple(this, DATABASE_VERSION); databaseSimple.create(Report.class, LastLocation.class); }/*from w ww . j ava 2 s . c om*/ // initialize services EntryDao.getInstance(this); LastLocationDao.getInstance(this); // scheduler mgr = (AlarmManager) getSystemService(ALARM_SERVICE); Intent i = new Intent(this, LocationPoller.class); com.jigarmjoshi.service.LocationManager locationManager = com.jigarmjoshi.service.LocationManager .getInstance(getApplicationContext()); List<String> providers = locationManager.getAllProviders(); boolean fusedSupported = false; for (String provider : providers) { if (com.jigarmjoshi.service.LocationManager.FUSED_PROVIDER.equals(provider)) { fusedSupported = true; break; } } i.putExtra(LocationPoller.EXTRA_INTENT, new Intent(this, com.jigarmjoshi.reciever.LocationReceiver.class)); i.putExtra(LocationPoller.EXTRA_PROVIDER, (fusedSupported ? LocationManager.FUSED_PROVIDER : LocationManager.GPS_PROVIDER)); pi = PendingIntent.getBroadcast(this, 0, i, 0); mgr.setRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP, 0, Long.parseLong(ConfigService.get(ConfigService.GPS_TASK_INTERVAL, "40000")), pi); // upload task Timer timer = new Timer(); TimerTask timerTask = new UploaderTask(this); timer.schedule(timerTask, 0, Long.parseLong(ConfigService.get(ConfigService.UPLOAD_TASK_INTERVAL, "40000"))); selectedTextView = new TextView(this); selectedTextView.setTextColor(Color.BLACK); selectedTextView.setGravity(Gravity.CENTER); selectedTextView.setPaintFlags(Paint.FAKE_BOLD_TEXT_FLAG); unSelectedTextView = new TextView(this); unSelectedTextView.setTextColor(Color.GRAY); unSelectedTextView.setGravity(Gravity.CENTER); unSelectedTextView.setPaintFlags(Paint.FAKE_BOLD_TEXT_FLAG); // create if first time getWindow().requestFeature(Window.FEATURE_ACTION_BAR_OVERLAY); actionBar = getActionBar(); actionBar.setBackgroundDrawable(new ColorDrawable(Color.parseColor("#40808080"))); actionBar.setStackedBackgroundDrawable(new ColorDrawable(Color.parseColor("#40808080"))); setContentView(R.layout.activity_main); // Initilization viewPager = (ViewPager) findViewById(R.id.pager); mAdapter = new TabsPagerAdapter(getSupportFragmentManager()); viewPager.setAdapter(mAdapter); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); // Adding Tabs boolean first = false; for (String tab_name : tabs) { Tab tab = actionBar.newTab().setText(tab_name).setTabListener(this); if (first) { first = false; selectedTextView.setText(tab.getText().toString().toUpperCase(Locale.getDefault())); tab.setCustomView(selectedTextView); } else { unSelectedTextView.setText(tab.getText().toString().toUpperCase(Locale.getDefault())); tab.setCustomView(unSelectedTextView); } actionBar.addTab(tab); } /** * on swiping the viewpager make respective tab selected * */ viewPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() { @Override public void onPageSelected(int position) { // on changing the page // make respected tab selected actionBar.setSelectedNavigationItem(position); } @Override public void onPageScrolled(int arg0, float arg1, int arg2) { } @Override public void onPageScrollStateChanged(int arg0) { } }); Toast.makeText(this, getString(R.string.wait_gps), Toast.LENGTH_LONG).show(); }
From source file:org.smart.library.widget.SlideSwitch.java
public SlideSwitch(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); listener = null;/* www .j a v a 2 s.com*/ paint = new Paint(); paint.setAntiAlias(true); TypedArray a = context.obtainStyledAttributes(attrs, ATTRS); int dstWidth = a.getDimensionPixelSize(0, 0); int dstHeight = a.getDimensionPixelSize(1, 0); a.recycle(); a = context.obtainStyledAttributes(attrs, R.styleable.slideswitch); /** bitmap */ int onThemeImage = a.getResourceId(R.styleable.slideswitch_onThemeImage, 0); if (onThemeImage != 0) { bitmap_on_theme = Bitmap.createScaledBitmap(BitmapFactory.decodeResource(getResources(), onThemeImage), dstWidth, dstHeight, false); } int offThemeImage = a.getResourceId(R.styleable.slideswitch_offThemeImage, 0); if (offThemeImage != 0) { bitmap_off_theme = Bitmap.createScaledBitmap( BitmapFactory.decodeResource(getResources(), offThemeImage), dstWidth, dstHeight, false); } int onCircleImage = a.getResourceId(R.styleable.slideswitch_onCircleImage, 0); if (onCircleImage != 0) { circle_on_bitmap = Bitmap.createScaledBitmap( BitmapFactory.decodeResource(getResources(), onCircleImage), dstWidth, dstHeight, false); } int offCircleImage = a.getResourceId(R.styleable.slideswitch_offCircleImage, 0); if (offCircleImage != 0) { circle_off_bitmap = Bitmap.createScaledBitmap( BitmapFactory.decodeResource(getResources(), offCircleImage), dstWidth, dstHeight, false); } color_on_theme = a.getColor(R.styleable.slideswitch_onThemeColor, DEFAULT_COLOR_THEME); color_off_theme = a.getColor(R.styleable.slideswitch_offThemeColor, Color.GRAY); circle_on_color = a.getColor(R.styleable.slideswitch_onCircleColor, Color.WHITE); circle_off_color = a.getColor(R.styleable.slideswitch_offCircleColor, Color.parseColor("#BBB9B7")); slideable = a.getBoolean(R.styleable.slideswitch_slideable, slideable); isOpen = a.getBoolean(R.styleable.slideswitch_isOpen, false); shape = a.getInt(R.styleable.slideswitch_shape, SHAPE_CIRCLE); a.recycle(); }
From source file:org.wikipedia.page.shareafact.SnippetImage.java
private static int drawDescription(@NonNull Canvas canvas, @Nullable String description, int top, boolean isArticleRTL) { final int marginBottom = 5; final int maxHeight = 23; final int maxLines = 2; final float maxFontSize = 15.0f; final float minFontSize = 10.0f; if (TextUtils.isEmpty(description)) { return top - marginBottom; }/* w w w. j av a 2 s.c o m*/ TextPaint textPaint = new TextPaint(); textPaint.setAntiAlias(true); textPaint.setColor(Color.WHITE); textPaint.setTextSize(maxFontSize); textPaint.setStyle(Paint.Style.FILL); textPaint.setShadowLayer(1.0f, 0.0f, 0.0f, Color.GRAY); StaticLayout textLayout = optimizeTextSize( new TextLayoutParams(description, textPaint, DESCRIPTION_WIDTH, SPACING_MULTIPLIER), maxHeight, maxLines, maxFontSize, minFontSize); int left = HORIZONTAL_PADDING; if (isArticleRTL) { left = WIDTH - HORIZONTAL_PADDING - textLayout.getWidth(); } top = top - marginBottom - textLayout.getHeight(); canvas.save(); canvas.translate(left, top); textLayout.draw(canvas); canvas.restore(); return top; }
From source file:ca.appvelopers.mcgillmobile.ui.MapActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_map); ButterKnife.bind(this); App.component(this).inject(this); analytics.sendScreen("Map"); //Set up the initial information places = new ArrayList<>(); shownPlaces = new ArrayList<>(); searchString = ""; type = new PlaceType(false); FormGenerator fg = FormGenerator.bind(this, container); // Icon coloring int red = ContextCompat.getColor(this, R.color.red); Utils.setTint(directions, 0, red);/* w w w .j a va 2 s . c o m*/ Utils.setTint(favorite, 0, red); //Set up the place filter fg.text(type.getString(this, languagePref.get())).leftIcon(R.drawable.ic_location) .rightIcon(R.drawable.ic_chevron_right, Color.GRAY).onClick(new TextViewFormItem.OnClickListener() { @Override public void onClick(final TextViewFormItem item) { DialogUtils.list(MapActivity.this, R.string.map_filter, new PlaceTypeListAdapter(MapActivity.this, type) { @Override public void onPlaceTypeSelected(PlaceType type) { MapActivity.this.type = type; //Update the text item.view().setText( type.getString(MapActivity.this, languagePreference.get())); //Update the filtered places filterByCategory(); } }); } }).build(); FragmentManager manager = getSupportFragmentManager(); //Get the MapFragment SupportMapFragment fragment = (SupportMapFragment) manager.findFragmentById(R.id.map); //If it's null, initialize it and put it in its view if (fragment == null) { fragment = SupportMapFragment.newInstance(); manager.beginTransaction().replace(R.id.map, fragment).addToBackStack(null).commit(); } fragment.getMapAsync(this); }