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:edu.ucsb.cs.cs190i.papertown.town.newtown.SelectImageGridAdapter.java

@Override
public View getView(int position, View convertView, ViewGroup parent) {
    // TODO Auto-generated method stub
    View grid;//  www . j a  v  a  2 s .  c o m
    LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

    if (convertView == null) {
        if (position != imageUris.size()) {
            grid = inflater.inflate(R.layout.grid_single_newtown_selectimage, null);
            imageView = (ImageView) grid.findViewById(R.id.grid_image);

            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
                if (mContext.checkSelfPermission(
                        Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {

                    // Should we show an explanation?
                    if (ActivityCompat.shouldShowRequestPermissionRationale((SelectImageActivity) mContext,
                            Manifest.permission.READ_EXTERNAL_STORAGE)) {
                        // Explain to the user why we need to read the contacts
                        Log.i("my", "permission.READ_EXTERNAL_STORAGE");

                    }

                    ActivityCompat.requestPermissions((SelectImageActivity) mContext,
                            new String[] { Manifest.permission.READ_EXTERNAL_STORAGE },
                            MY_PERMISSIONS_REQUEST_READ_EXTERNAL_STORAGE);

                    // MY_PERMISSIONS_REQUEST_READ_CONTACTS is an
                    // app-defined int constant

                    //                        return;
                } else {
                    Log.i("my", "permission.READ_EXTERNAL_STORAGE3");
                    //normal request goes here
                    //imageView.setImageURI(ImageUris[position]);
                    Picasso.with(mContext).load(imageUris.get(position)).fit().into(imageView);
                }
            }

        } else {
            grid = inflater.inflate(R.layout.grid_single_newtown_selectimage, null);
            ImageView imageView = (ImageView) grid.findViewById(R.id.grid_image);
            imageView.setBackgroundColor(Color.GRAY);
            imageView.setImageResource(R.drawable.ic_add_white_24dp);
        }
    } else {
        grid = (View) convertView;
    }

    return grid;
}

From source file:uk.co.tekkies.readings.fragment.PassageFragment.java

@Override
public View onCreateView(android.view.LayoutInflater inflater, android.view.ViewGroup container,
        Bundle savedInstanceState) {//from  ww w  .  j a  v a 2s.  co  m
    View mainView = inflater.inflate(R.layout.passage_fragment, container, false);
    textViewContent = (TextView) (mainView.findViewById(R.id.textViewContent));
    defaultTextSize = textViewContent.getTextSize();
    if (PreferenceManager.getDefaultSharedPreferences(getActivity())
            .getBoolean(getString(R.string.pref_key_night_mode), false)) {
        textViewContent.setTextColor(Color.GRAY);
    }
    Prefs prefs = new Prefs(getActivity());
    //Legacy MP3 plugin installed but MP3 product not yet defined
    //OR MP3 product defined
    if ((ReadingsApplication.getMp3Installed() && prefs.isMp3ProductUndefined())
            || prefs.loadMp3Product().length() > 0) {
        setupMediaControls(mainView);
    }
    mainView.findViewById(R.id.textViewStudyTop).setOnClickListener(this);
    mainView.findViewById(R.id.textViewStudyBottom).setOnClickListener(this);
    if (Features.DAILYREADINGS_ORG_COMMENTS) {
        TextView textViewDiscuss = (TextView) mainView.findViewById(R.id.textViewDiscussTop);
        textViewDiscuss.setOnClickListener(this);
        textViewDiscuss.setVisibility(View.VISIBLE);
        textViewDiscuss = (TextView) mainView.findViewById(R.id.textViewDiscussBottom);
        textViewDiscuss.setOnClickListener(this);
        textViewDiscuss.setVisibility(View.VISIBLE);
    }
    loadTextSize();
    registerGestureDetector(mainView);
    return mainView;
}

From source file:com.example.ajklen.lostandfound.SlidingTabsColorsFragment.java

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

    // BEGIN_INCLUDE (populate_tabs)
    /**/*  www  .  ja va 2 s.co 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(getString(R.string.tab_lost), // Title
            Color.BLUE, // Indicator color
            Color.GRAY // Divider color
    ));

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

From source file:com.asksven.betterbatterystats.PackageInfoTabsFragment.java

/**
 * This is called after the {@link #onCreateView(LayoutInflater, ViewGroup, Bundle)} has finished.
 * Here we can pick out the {@link View}s we need to configure from the content view.
 *
 * We set the {@link ViewPager}'s adapter to be an instance of {@link SamplePagerAdapter}. The
 * {@link SlidingTabLayout} is then given the {@link ViewPager} so that it can populate itself.
 *
 * @param view View created in {@link #onCreateView(LayoutInflater, ViewGroup, Bundle)}
 *///from  ww  w .j a v  a2s  . co m
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    // BEGIN_INCLUDE (setup_viewpager)
    // Get the ViewPager and set it's PagerAdapter so that it can display items
    mViewPager = (ViewPager) view.findViewById(R.id.viewpager);

    mViewPager.setAdapter(new SamplePagerAdapter(this.getActivity(), getFragmentManager()));
    // END_INCLUDE (setup_viewpager)

    // BEGIN_INCLUDE (setup_slidingtablayout)
    // Give the SlidingTabLayout the ViewPager, this must be done AFTER the ViewPager has had
    // it's PagerAdapter set.
    mSlidingTabLayout = (SlidingTabLayout) view.findViewById(R.id.sliding_tabs);
    mSlidingTabLayout.setViewPager(mViewPager);

    mSlidingTabLayout.setCustomTabColorizer(new SlidingTabLayout.TabColorizer() {

        @Override
        public int getIndicatorColor(int position) {
            return getResources().getColor(R.color.color_accent);
        }

        @Override
        public int getDividerColor(int position) {
            return Color.GRAY;
        }

    });
    // END_INCLUDE (setup_slidingtablayout)
}

From source file:com.lpii.evma.view.organizer.SlidingTabsColorsFragment.java

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

    // BEGIN_INCLUDE (populate_tabs)
    /**//from w  w  w .  ja v a2s  .  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(getString(R.string.organizer_overview), // Title
            Color.BLUE, // Indicator color
            Color.GRAY // Divider color
    ));

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

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

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

}

From source file:org.phillyopen.mytracks.cyclephilly.tab.SlidingTabsColorsFragment.java

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

    // BEGIN_INCLUDE (populate_tabs)
    /**/*from  ww  w .  j a  va2  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(getString(R.string.tab_map), // Title
            Color.BLUE, // Indicator color
            Color.GRAY // Divider color
    ));

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

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

From source file:com.nextgis.maplibui.formcontrol.DateTime.java

@Override
public void init(JSONObject element, List<Field> fields, Bundle savedState, Cursor featureCursor,
        SharedPreferences preferences) throws JSONException {
    JSONObject attributes = element.getJSONObject(JSON_ATTRIBUTES_KEY);
    mFieldName = attributes.getString(JSON_FIELD_NAME_KEY);
    mIsShowLast = ControlHelper.isSaveLastValue(attributes);

    if (!ControlHelper.isEnabled(fields, mFieldName)) {
        setEnabled(false);/*from   w w w  .  j av a 2  s  .c o m*/
        getBackground().setColorFilter(Color.GRAY, PorterDuff.Mode.SRC_ATOP);
    }

    if (attributes.has(JSON_DATE_TYPE_KEY)) {
        mPickerType = attributes.getInt(JSON_DATE_TYPE_KEY);
    }

    switch (mPickerType) {

    case 0:
        mDateFormat = (SimpleDateFormat) DateFormat.getDateInstance();
        mPickerType = GeoConstants.FTDate;
        break;

    case 1:
        mDateFormat = (SimpleDateFormat) DateFormat.getTimeInstance();
        mPickerType = GeoConstants.FTTime;
        break;

    default:
        mPickerType = FTDateTime;
    case 2:
        mDateFormat = (SimpleDateFormat) DateFormat.getDateTimeInstance();
        mPickerType = GeoConstants.FTDateTime;
        break;
    }

    long timestamp = System.currentTimeMillis();
    if (ControlHelper.hasKey(savedState, mFieldName)) {
        timestamp = savedState.getLong(ControlHelper.getSavedStateKey(mFieldName));
    } else if (null != featureCursor) { // feature exists
        int column = featureCursor.getColumnIndex(mFieldName);
        if (column >= 0) {
            timestamp = featureCursor.getLong(column);
        }
    } else { // new feature
        if (attributes.has(JSON_TEXT_KEY) && !TextUtils.isEmpty(attributes.getString(JSON_TEXT_KEY).trim())) {
            String defaultValue = attributes.getString(JSON_TEXT_KEY);
            timestamp = parseDateTime(defaultValue, mPickerType);
        }

        if (mIsShowLast) {
            timestamp = preferences.getLong(mFieldName, timestamp);
        }
    }

    mCalendar.setTimeInMillis(timestamp);
    setText(mDateFormat.format(mCalendar.getTime()));
    setSingleLine(true);
    setFocusable(false);
    setOnClickListener(getDateUpdateWatcher(mPickerType));

    String pattern = mDateFormat.toLocalizedPattern();
    setHint(pattern);
}

From source file:com.example.android.slidingtabscolors.SlidingTabsColorsFragment.java

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

    // BEGIN_INCLUDE (populate_tabs)
    /**/*  w w w  .  j a  va2  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_stream), // Title
            Color.BLUE, // Indicator color
            Color.GRAY // Divider color
    ));

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

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

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

From source file:com.cmtv.tv.widget.pagerindicator.TabPageIndicator.java

public TabPageIndicator(Context context, AttributeSet attrs) {
    super(context, attrs);
    setHorizontalScrollBarEnabled(false);

    //custom/*from  w ww .j  a va 2 s .co m*/
    mContext = context;
    this.mTextFocusColor = context.getResources().getColor(R.color.tab_view_indicator_focus_color);
    this.mFocusedShader = new LinearGradient(0.0f, 0.0f, 0.0f, 50.0f, mTextFocusColor, mTextFocusColor,
            Shader.TileMode.CLAMP);
    this.mNormalShader = new LinearGradient(0.0f, 0.0f, 0.0f, 40.0f, Color.WHITE, Color.GRAY,
            Shader.TileMode.CLAMP);

    mTabLayout = new IcsLinearLayout(context, R.attr.vpiTabPageIndicatorStyle);
    addView(mTabLayout, new ViewGroup.LayoutParams(WRAP_CONTENT, MATCH_PARENT));
}

From source file:com.infoprima.android.advtabcolor.SlidingTabsColorsFragment.java

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

    // BEGIN_INCLUDE (populate_tabs)
    /**/*from   w  w  w .  j a  va  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_stream), // Title
            Color.BLUE, // Indicator color
            Color.GRAY // Divider color
    ));

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

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

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

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