Example usage for android.graphics Color GRAY

List of usage examples for android.graphics Color GRAY

Introduction

In this page you can find the example usage for android.graphics Color GRAY.

Prototype

int GRAY

To view the source code for android.graphics Color GRAY.

Click Source Link

Usage

From source file:com.cwx.daytodayaccount.fragment.SlidingTabsColorsFragment.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // BEGIN_INCLUDE (populate_tabs)
    /**//  w w w. jav  a 2 s. c  om
     * Populate our tab list with tabs. Each item contains a title, indicator color and divider
     * color, which are used by {@link SlidingTabLayout}.
     */
    mTabs.add(new SamplePagerItem(getString(R.string.tab_account), // Title
            Color.rgb(0, 188, 212), // Indicator color
            Color.GRAY // Divider color
    ));

    mTabs.add(new SamplePagerItem(getString(R.string.tab_notifications), // Title
            Color.MAGENTA, // Indicator color
            Color.GRAY // Divider color
    ));

    mTabs.add(new SamplePagerItem(getString(R.string.tab_diarys), // Title
            Color.rgb(255, 179, 0), // Indicator color
            Color.GRAY // Divider color
    ));

    mTabs.add(new SamplePagerItem(getString(R.string.tab_photos), // Title
            Color.rgb(102, 187, 106), // Indicator color
            Color.GRAY // Divider color
    ));

    mTabs.add(new SamplePagerItem(getString(R.string.tab_guanyin), // Title
            Color.YELLOW, // Indicator color
            Color.GRAY // Divider color
    ));

    mTabs.add(new SamplePagerItem(getString(R.string.tab_settings), // Title
            Color.BLUE, // Indicator color
            Color.GRAY // Divider color
    ));
    // END_INCLUDE (populate_tabs)
}

From source file:net.mm2d.dmsexplorer.CdsDetailFragment.java

private void setupFloatingActionButton(View rootView, final CdsObject object) {
    FloatingActionButton fab = (FloatingActionButton) rootView.findViewById(R.id.fab);
    if (fab == null) {
        fab = (FloatingActionButton) getActivity().findViewById(R.id.fab);
    }/*w  w  w  .j a  va2s. co  m*/
    if (fab == null) {
        return;
    }
    fab.setVisibility(hasResource(object) ? View.VISIBLE : View.GONE);
    final boolean protectedResource = hasProtectedResource(object);
    final int color = protectedResource ? Color.GRAY : ContextCompat.getColor(getContext(), R.color.accent);
    fab.setBackgroundTintList(ColorStateList.valueOf(color));
    fab.setOnClickListener(view -> {
        if (protectedResource) {
            Snackbar.make(view, R.string.toast_not_support_drm, Snackbar.LENGTH_LONG).show();
        } else {
            final SelectResourceDialog dialog = SelectResourceDialog.newInstance(object);
            dialog.show(getActivity().getFragmentManager(), "");
        }
    });
}

From source file:com.oddsoft.buddhavoice2.view.MainActivity.java

private void initDrawer() {
    navigation.setNavigationItemSelectedListener(new NavigationView.OnNavigationItemSelectedListener() {
        @Override/*w  ww . j  a  v  a 2 s .  c  om*/
        public boolean onNavigationItemSelected(MenuItem menuItem) {

            //Checking if the item is in checked state or not, if not make it in checked state
            if (menuItem.isChecked())
                menuItem.setChecked(false);
            else
                menuItem.setChecked(true);

            //Closing drawer on item click
            drawerLayout.closeDrawers();

            switch (menuItem.getItemId()) {
            case R.id.navSetting:
                startActivity(new Intent(MainActivity.this, Prefs.class));
                break;
            case R.id.navAbout:
                new LibsBuilder()
                        //provide a style (optional) (LIGHT, DARK, LIGHT_DARK_TOOLBAR)
                        .withActivityStyle(Libs.ActivityStyle.LIGHT_DARK_TOOLBAR).withAboutIconShown(true)
                        .withAboutVersionShown(true).withAboutAppName(getString(R.string.app_name))
                        .withActivityTitle(getString(R.string.about_title))
                        .withAboutDescription(getString(R.string.license))
                        //start the activity
                        .start(MainActivity.this);
                break;

            }
            return false;
        }
    });

    //change navigation drawer item icons
    navigation.getMenu().findItem(R.id.navSetting).setIcon(
            new IconicsDrawable(this).icon(GoogleMaterial.Icon.gmd_settings).color(Color.GRAY).sizeDp(24));

    navigation.getMenu().findItem(R.id.navAbout)
            .setIcon(new IconicsDrawable(this).icon(GoogleMaterial.Icon.gmd_info).color(Color.GRAY).sizeDp(24));

    actionBarDrawerToggle = new ActionBarDrawerToggle(this, drawerLayout, toolbar, R.string.app_name,
            R.string.app_name) {

        @Override
        public void onDrawerClosed(View drawerView) {
            // Code here will be triggered once the drawer closes as we dont want anything to happen so we leave this blank
            super.onDrawerClosed(drawerView);
        }

        @Override
        public void onDrawerOpened(View drawerView) {
            // Code here will be triggered once the drawer open as we dont want anything to happen so we leave this blank

            super.onDrawerOpened(drawerView);
        }
    };

    //Setting the actionbarToggle to drawer layout
    drawerLayout.setDrawerListener(actionBarDrawerToggle);

    //calling sync state is necessay or else your hamburger icon wont show up
    actionBarDrawerToggle.syncState();
}

From source file:com.adithyaupadhya.uimodule.roundcornerprogressbar.BaseRoundCornerProgressBar.java

private void previewLayout(Context context) {
    setGravity(Gravity.CENTER);//w  w w . ja  va  2s.c  o m
    TextView tv = new TextView(context);
    ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT);
    tv.setLayoutParams(params);
    tv.setGravity(Gravity.CENTER);
    tv.setText(getClass().getSimpleName());
    tv.setTextColor(Color.WHITE);
    tv.setBackgroundColor(Color.GRAY);
    addView(tv);
}

From source file:com.markupartist.sthlmtraveling.ChangeRouteTimeActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.change_route_time);

    registerScreen("Change route time");

    restoreState(savedInstanceState);//  ww  w.  ja  v a2 s .  c o m

    Bundle extras = getIntent().getExtras();
    mJourneyQuery = extras.getParcelable(RoutesActivity.EXTRA_JOURNEY_QUERY);

    mTime = mJourneyQuery.time;

    mDateButton = (Button) findViewById(R.id.change_route_date);
    mDateButton.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            showDialog(DIALOG_DATE);
        }
    });

    mTimeButton = (Button) findViewById(R.id.change_route_time);
    mTimeButton.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            showDialog(DIALOG_TIME);
        }
    });

    ImageButton refreshTimeButton = (ImageButton) findViewById(R.id.btn_set_to_now);
    ViewHelper.tintIcon(refreshTimeButton.getDrawable(), Color.GRAY);
    refreshTimeButton.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            if (mJourneyQuery.time != null) {
                mJourneyQuery.time.setTime(System.currentTimeMillis());
                updateTimeViews();
            }
        }
    });

    // Don't fill via if it has been restored.
    if (!mViaPoint.looksValid() && mJourneyQuery.hasVia()) {
        mViaPoint = mJourneyQuery.via;
        //            new Site();
        //            mViaPoint.setId(mJourneyQuery.via.id);
        //            mViaPoint.setName(mJourneyQuery.via.name);
        //            mViaPoint.setLocation(mJourneyQuery.via.latitude, mJourneyQuery.via.longitude);
    }

    mViaPointAutoComplete = createAutoCompleteTextView(R.id.via, mViaPoint, true);
    mViaPointAutoComplete.setText(mViaPoint.getName());

    int selectedPosition = mJourneyQuery.isTimeDeparture ? 0 : 1;
    mWhenSpinner = (Spinner) findViewById(R.id.departure_arrival_choice);
    ArrayAdapter<CharSequence> whenChoiceAdapter = ArrayAdapter.createFromResource(this, R.array.when_choice,
            android.R.layout.simple_spinner_item);
    whenChoiceAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    mWhenSpinner.setAdapter(whenChoiceAdapter);
    mWhenSpinner.setSelection(selectedPosition);

    // Inflate a "Done/Discard" custom action bar view.
    LayoutInflater inflater = (LayoutInflater) getSupportActionBar().getThemedContext()
            .getSystemService(LAYOUT_INFLATER_SERVICE);
    final View customActionBarView = inflater.inflate(R.layout.actionbar_custom_view_done_discard, null);
    customActionBarView.findViewById(R.id.actionbar_done).setOnClickListener(this);
    customActionBarView.findViewById(R.id.actionbar_discard).setOnClickListener(this);

    // Show the custom action bar view and hide the normal Home icon and title.
    final ActionBar actionBar = getSupportActionBar();
    actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM,
            ActionBar.DISPLAY_SHOW_CUSTOM | ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_SHOW_TITLE);
    actionBar.setCustomView(customActionBarView, new ActionBar.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT));

    updateViews();
}

From source file:opensourceproject.kanjisteps.Practice_slides.java

public int quizByLevelOnyomi() {
    enableButtons();/*from  w w w.java  2  s.  co  m*/
    KanjiToStudyAdapter dbAdapter = new KanjiToStudyAdapter(this);
    Cursor cursor = dbAdapter.getItemsByLevelRandom(level_marker, 0);
    TextView txt = (TextView) findViewById(R.id.textToDisplay);
    TextView txtDblTap = (TextView) findViewById(R.id.textDoubleTap);
    txtDblTap.setOnClickListener(this);
    txtDblTap.setOnTouchListener(gestureListener);
    txtDblTap.setVisibility(View.INVISIBLE);

    String temp = "";
    if (cursor.moveToNext()) {
        int indexOfKanji = cursor.getColumnIndex(dbAdapter.myKanjiDb.COLUMN_KANJI);
        temp = cursor.getString(indexOfKanji);

        txt.setText(temp);
        txt.setTextSize(50);
        txt.setTextColor(Color.GRAY);
        txt.setTag("2"); //2 means japanese READING
        populateButtonChoicesOnyomi(cursor, dbAdapter);
        return 0;
    } else {
        /*
        txt.setTextSize(20);
        txt.setTextColor(Color.GRAY);
        txt.setText("You don't have any items to review yet! Check back later.");
        resetButtons();
        */
        return 1;
    }
}

From source file:com.abcvoipsip.ui.prefs.CodecsFragment.java

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    prefsWrapper = new PreferencesWrapper(getActivity());
    initDatas();/*from  w w  w . j  a  v  a2 s. c  om*/
    setHasOptionsMenu(true);

    // Adapter
    mAdapter = new SimpleAdapter(getActivity(), codecsList, R.layout.codecs_list_item,
            new String[] { CODEC_NAME, CODEC_PRIORITY }, new int[] { R.id.line1, R.id.entiere_line });

    mAdapter.setViewBinder(new ViewBinder() {
        @Override
        public boolean setViewValue(View view, Object data, String textRepresentation) {
            if (view.getId() == R.id.entiere_line) {
                Log.d(THIS_FILE, "Entiere line is binded ");
                TextView tv = (TextView) view.findViewById(R.id.line1);
                ImageView grabber = (ImageView) view.findViewById(R.id.icon);
                if ((Short) data == 0) {
                    tv.setTextColor(Color.GRAY);
                    grabber.setImageResource(R.drawable.ic_mp_disabled);
                } else {
                    tv.setTextColor(Color.WHITE);
                    grabber.setImageResource(R.drawable.ic_mp_move);
                }
                return true;
            }
            return false;
        }

    });

    setListAdapter(mAdapter);
    registerForContextMenu(getListView());
}

From source file:com.presisco.example.slidingtabsicons.slidingtabsicons.SlidingTabsIconsFragment.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // BEGIN_INCLUDE (populate_tabs)
    /**//from  w ww. ja  v  a 2 s .c  o m
     * Populate our tab list with tabs. Each item contains a title, indicator color and divider
     * color, which are used by {@link SlidingTabLayout}.
     */
    mTabs.add(new SamplePagerItem("Title1", Color.BLUE, Color.GRAY, R.drawable.tabs_title_icon1,
            R.drawable.tabs_title_selected1));

    mTabs.add(new SamplePagerItem("Title2", Color.CYAN, Color.BLACK, R.drawable.tabs_title_icon2,
            R.drawable.tabs_title_selected2));

    mTabs.add(new SamplePagerItem("Title3", Color.GREEN, Color.MAGENTA, R.drawable.tabs_title_icon3,
            R.drawable.tabs_title_selected3));
    //        mTabs.add(new SamplePagerItem(
    //                getString(R.string.tab_stream), // Title
    //                Color.BLUE, // Indicator color
    //                Color.GRAY // Divider color
    //        ));
    // END_INCLUDE (populate_tabs)
}

From source file:org.wikipedia.page.shareafact.SnippetImage.java

@NonNull
private static Layout drawTextSnippet(@NonNull Canvas canvas, @NonNull CharSequence textSnippet) {
    final int top = TOP_PADDING;
    final int maxHeight = 225;
    final int maxLines = 5;
    final float maxFontSize = 195.0f;
    final float minFontSize = 32.0f;

    TextPaint textPaint = new TextPaint();
    textPaint.setAntiAlias(true);/*w  ww.j  ava2  s .c om*/
    textPaint.setColor(Color.WHITE);
    textPaint.setTextSize(maxFontSize);
    textPaint.setStyle(Paint.Style.FILL);
    textPaint.setTypeface(Typeface.DEFAULT_BOLD);
    textPaint.setShadowLayer(1.0f, 1.0f, 1.0f, Color.GRAY);

    StaticLayout textLayout = optimizeTextSize(
            new TextLayoutParams(textSnippet, textPaint, TEXT_WIDTH, SPACING_MULTIPLIER), maxHeight, maxLines,
            maxFontSize, minFontSize);

    canvas.save();
    int horizontalCenterOffset = top + (maxHeight - textLayout.getHeight()) / QUARTER;
    canvas.translate(HORIZONTAL_PADDING, horizontalCenterOffset);
    textLayout.draw(canvas);
    canvas.restore();

    return textLayout;
}

From source file:samsungsami.io.example.samiremotecontrol.DeviceActivity.java

/**
 * Fill the device status and info table
 *///  w  w w .j ava 2s .  c o  m
void fillTable() {

    TableRow row;
    TextView t1, t2, t3;
    for (int current = 0; current < fields.size(); current++) {
        row = new TableRow(this);
        t1 = new TextView(this);
        t1.setTextColor(Color.GRAY);
        t2 = new TextView(this);
        t2.setTextColor(Color.BLACK);
        t3 = new TextView(this);
        t3.setTextColor(Color.BLACK);

        t1.setText(fields.get(current));
        t2.setText(values.get(current));
        t3.setText(units.get(current));

        t1.setTextSize(15);
        t2.setTextSize(15);
        t3.setTextSize(15);

        row.addView(t1);

        if (fields.get(current).equals("state")) {
            Switch toggle = new Switch(this);
            toggle.setChecked(values.get(current).toLowerCase().equals("on"));
            toggle.setEnabled(false);
            row.addView(toggle);
        } else
            row.addView(t2);

        row.addView(t3);
        propertiesTableLayout.addView(row, new TableLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
                ViewGroup.LayoutParams.MATCH_PARENT));

        // Adjust the view
        propertiesTableLayout.setColumnStretchable(0, true);
        propertiesTableLayout.setColumnStretchable(1, true);
        propertiesTableLayout.setColumnStretchable(2, true);
    }
}