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.justplay1.shoppist.shared.widget.ColorCheckedTextView.java

private void setColor(@ColorInt int color) {
    StateListDrawable states = new StateListDrawable();

    Drawable drawable = ContextCompat.getDrawable(getContext(), R.drawable.btn_radio_to_on_000);
    Drawable checked = ContextCompat.getDrawable(getContext(), R.drawable.btn_radio_to_on_015);

    if (isEnabled()) {
        states.setColorFilter(DrawableUtils.getColorFilter(color));
    } else {// w w w  . ja  v a2  s.co m
        states.setColorFilter(DrawableUtils.getColorFilter(Color.GRAY));
    }

    states.addState(new int[] { android.R.attr.stateNotNeeded }, drawable);
    states.addState(new int[] { android.R.attr.state_checked }, checked);
    states.addState(new int[] { android.R.attr.state_enabled }, drawable);
    states.addState(new int[] { -android.R.attr.state_enabled, android.R.attr.state_checked }, checked);
    states.addState(new int[] { -android.R.attr.state_enabled }, drawable);

    setCheckMarkDrawable(states);
}

From source file:com.example.android.materialme.SportsAdapter.java

/**
 * Constructor that passes in the sports data and the context
 * @param sportsData ArrayList containing the sports data
 * @param context Context of the application
 *///from w ww .  ja v a 2  s  . c  o  m
SportsAdapter(Context context, ArrayList<Sport> sportsData) {
    this.mSportsData = sportsData;
    this.mContext = context;

    //Prepare gray placeholder
    mGradientDrawable = new GradientDrawable();
    mGradientDrawable.setColor(Color.GRAY);

    //Make the placeholder same size as the images
    Drawable drawable = ContextCompat.getDrawable(mContext, R.drawable.img_badminton);
    if (drawable != null) {
        mGradientDrawable.setSize(drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight());
    }
}

From source file:com.example.android.materialme.DetailActivity.java

/**
 * Initializes the activity, filling in the data from the Intent.
 * @param savedInstanceState Contains information about the saved state of the activity
 *//*w  ww.  ja va2 s  .  c o  m*/
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_detail);

    //Initialize the views
    TextView sportsTitle = (TextView) findViewById(R.id.titleDetail);
    ImageView sportsImage = (ImageView) findViewById(R.id.sportsImageDetail);

    //Get the drawable
    Drawable drawable = ContextCompat.getDrawable(this, getIntent().getIntExtra(Sport.IMAGE_KEY, 0));

    //Create a placeholder gray scrim while the image loads
    GradientDrawable gradientDrawable = new GradientDrawable();
    gradientDrawable.setColor(Color.GRAY);

    //Make it the same size as the image
    if (drawable != null) {
        gradientDrawable.setSize(drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight());
    }

    //Set the text from the Intent extra
    sportsTitle.setText(getIntent().getStringExtra(Sport.TITLE_KEY));

    //Load the image using the glide library and the Intent extra
    Glide.with(this).load(getIntent().getIntExtra(Sport.IMAGE_KEY, 0)).placeholder(gradientDrawable)
            .into(sportsImage);
}

From source file:com.justplay1.shoppist.features.settings.widget.ColorCheckBoxPreference.java

@Override
protected void onBindView(View view) {
    super.onBindView(view);

    CheckBox checkboxView = (CheckBox) view.findViewById(R.id.checkbox);
    StateListDrawable states = new StateListDrawable();

    Drawable drawable = ContextCompat.getDrawable(getContext(), R.drawable.btn_check_to_on_000);
    Drawable checked = ContextCompat.getDrawable(getContext(), R.drawable.btn_check_to_on_015);

    if (isEnabled()) {
        states.setColorFilter(DrawableUtils.getColorFilter(color));
    } else {//from  www.java2  s. c o  m
        states.setColorFilter(DrawableUtils.getColorFilter(Color.GRAY));
    }

    states.addState(new int[] { android.R.attr.stateNotNeeded }, drawable);
    states.addState(new int[] { android.R.attr.state_checked }, checked);
    states.addState(new int[] { android.R.attr.state_enabled }, drawable);
    states.addState(new int[] { -android.R.attr.state_enabled, android.R.attr.state_checked }, checked);
    states.addState(new int[] { -android.R.attr.state_enabled }, drawable);

    checkboxView.setButtonDrawable(states);
}

From source file:justforcommunity.radiocom.fragments.LiveBroadcast.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Calendar dateSearch = Calendar.getInstance();
    dateSearch.add(Calendar.DAY_OF_MONTH, -4);
    mTabs = new ArrayList<>();

    // Add pages from previous days
    for (int i = 1; i < 4; i++) {
        dateSearch.add(Calendar.DAY_OF_MONTH, 1);
        mTabs.add(new DayPage(formatDate(dateSearch, DateUtils.FORMAT_DAY_WEEK), Color.RED, Color.GRAY,
                formatDate(dateSearch, DateUtils.FORMAT_DATE_GET)));
    }//from  w w  w.j  a  v  a2  s  .  c  om

    // Add page of actual day
    dateSearch.add(Calendar.DAY_OF_MONTH, 1);
    mTabs.add(new DayPage(getString(R.string.tab_today), Color.BLUE, Color.GRAY,
            formatDate(dateSearch, DateUtils.FORMAT_DATE_GET)));

    // Add pages from next days
    for (int i = 1; i < 4; i++) {
        dateSearch.add(Calendar.DAY_OF_MONTH, 1);
        mTabs.add(new DayPage(formatDate(dateSearch, DateUtils.FORMAT_DAY_WEEK), Color.GREEN, Color.GRAY,
                formatDate(dateSearch, DateUtils.FORMAT_DATE_GET)));
    }
}

From source file:org.blanco.tests.viewpager.PlainColorFragment.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    this.color = (getArguments() != null) ? getArguments().getInt(PLAIN_COLOR_FRAG_ARG_COLOR) : Color.GRAY;
}

From source file:edu.ucsb.cs.cs185.inspirante.searchbyranking.SearchByRankingFragment.java

@Override
public View onCreateView(final LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    View rootView = inflater.inflate(R.layout.fragment_search_by_ranking, container, false);

    final SearchView searchView = (SearchView) rootView.findViewById(R.id.search_by_ranking_search_view);
    int id = searchView.getContext().getResources().getIdentifier("android:id/search_src_text", null, null);
    EditText searchEditText = (EditText) searchView.findViewById(id);
    searchEditText.setTextColor(Color.GRAY);
    searchEditText.setHintTextColor(Color.GRAY);
    searchView.setOnQueryTextListener(searchViewListener);
    searchView.setMaxWidth(Integer.MAX_VALUE);
    searchView.setOnClickListener(new View.OnClickListener() {

        @Override/*from   w  w w .j  av a  2s.c  o  m*/
        public void onClick(View view) {
            searchView.setFocusable(true);
            searchView.setIconified(false);
            searchView.requestFocusFromTouch();
        }
    });

    mInspireRecyclerView = (RecyclerView) rootView.findViewById(R.id.search_rv);
    mInspireRecyclerView.setHasFixedSize(true);
    mInspireRecyclerView.setNestedScrollingEnabled(false);

    frequentTags = ItemCards.getInstance(getContext()).getFrequentTags();

    mInspireAdapter = new RankByTagAdapter(getContext(), this, frequentTags);
    mInspireAdapter.setHasStableIds(true);

    mLayoutManager = new LinearLayoutManager(getContext());
    mLayoutManager.setItemPrefetchEnabled(true);

    mInspireRecyclerView.setLayoutManager(mLayoutManager);

    mInspireAdapter.setOnItemClickListener(new RankByTagAdapter.OnRecyclerViewItemClickListener() {
        @Override
        public void onItemClick(View view, int position) {
            TextView tv = (TextView) view;
            Intent intent = new Intent(getActivity(), TagAndImagesActivity.class);
            intent.putExtra("TAG", tv.getText());
            startActivity(intent);
        }
    });

    ItemCards itemCards = ItemCards.getInstance(getContext());
    itemCards.setAdapter(mInspireAdapter);

    mInspireRecyclerView.setAdapter(mInspireAdapter);
    mInspireAdapter.notifyDataSetChanged();

    // Set Tag recycler view
    mTagRecyclerView = (RecyclerView) rootView.findViewById(R.id.search_tags_rv);
    mTagRecyclerView.setHasFixedSize(true);
    mTagRecyclerView.setNestedScrollingEnabled(false);
    mTagsAdapter = new TagsAdapter(getContext(), frequentTags);
    mTagsAdapter.setHasStableIds(true);
    RecyclerView.LayoutManager tagsLayoutManager = new LinearLayoutManager(getContext(),
            LinearLayoutManager.HORIZONTAL, false);
    tagsLayoutManager.setItemPrefetchEnabled(true);

    mTagRecyclerView.setLayoutManager(tagsLayoutManager);

    mTagsAdapter.setOnItemClickListener(new TagsAdapter.OnRecyclerViewItemClickListener() {
        @Override
        public void onItemClick(View view, int position) {
            String tag = mTagsAdapter.getTag(position);
            searchViewListener.onQueryTextChange(tag);
            //searchView.setFocus
            searchView.setQuery(tag, true);
            searchView.setIconified(false);
            searchView.clearFocus();
            mLayoutManager.scrollToPosition(0);

        }
    });

    mTagRecyclerView.setAdapter(mTagsAdapter);
    mTagsAdapter.notifyDataSetChanged();

    return rootView;
}

From source file:gr.ellak.ma.emergencyroad.SlidingTabsColorsFragment.java

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

    mTabs.add(new SamplePagerItem("Login", // Title
            Color.parseColor("#99CCFF"), Color.GRAY // Divider color
    ));//from   w  w w .  ja v a 2 s.c  o  m

    mTabs.add(new SamplePagerItem("Register", // Title
            Color.parseColor("#E07471"), Color.GRAY // Divider color
    ));
    // END_INCLUDE (populate_tabs)
}

From source file:ca.appvelopers.mcgillmobile.ui.walkthrough.WalkthroughActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_walkthrough);
    ButterKnife.bind(this);
    analytics.sendScreen("Walkthrough");

    //Load the adapter
    boolean firstOpen = getIntent().getBooleanExtra(Constants.FIRST_OPEN, false);
    adapter = new WalkthroughAdapter(this, firstOpen);
    viewPager.setAdapter(adapter);//from   w w w. j  a  v a  2  s . co m

    //Indicator
    indicator.setViewPager(viewPager);
    indicator.setStrokeColor(Color.WHITE);
    indicator.setPageColor(Color.GRAY);
    indicator.setFillColor(ContextCompat.getColor(this, R.color.red));
    indicator.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {

        @Override
        public void onPageScrolled(int i, float v, int i2) {
        }

        @Override
        public void onPageSelected(int position) {
            WalkthroughActivity.this.position = position;
            //Hide the back button on the first page
            back.setVisibility((position == 0) ? View.INVISIBLE : View.VISIBLE);
            //Set the right text on the next button if we are on the last page
            next.setText((position == adapter.getCount() - 1) ? R.string.start : R.string.next);
        }

        @Override
        public void onPageScrollStateChanged(int i) {
        }
    });
}

From source file:org.voidsink.anewjkuapp.utils.UIUtils.java

public static int getChipGradeColor(Assessment assessment) {
    if (assessment != null) {
        return assessment.getGrade().getColor();
    }// w w  w.  ja  v a  2  s  .  co  m
    return Color.GRAY;
}