Example usage for android.graphics Color rgb

List of usage examples for android.graphics Color rgb

Introduction

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

Prototype

@ColorInt
public static int rgb(float red, float green, float blue) 

Source Link

Document

Return a color-int from red, green, blue float components in the range \([0..1]\).

Usage

From source file:com.keylesspalace.tusky.view.ProgressImageView.java

public void setProgress(int progress) {
    this.progress = progress;
    if (progress != -1) {
        setColorFilter(Color.rgb(123, 123, 123), PorterDuff.Mode.MULTIPLY);
    } else {//from  w  w w  .  ja  v a2s  . c  o m
        clearColorFilter();
    }
    invalidate();
}

From source file:com.bangqu.eshow.activity.ESActivity.java

/**
 * ??.//from w w  w .j a  va2  s.  co  m
 *
 * @param savedInstanceState the saved instance state
 * @see android.support.v4.app.FragmentActivity#onCreate(android.os.Bundle)
 */
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    mInflater = LayoutInflater.from(this);

    //?
    mAbTitleBar = new ESTitleBar(this);

    //
    ab_base = new RelativeLayout(this);
    ab_base.setBackgroundColor(Color.rgb(255, 255, 255));

    //
    contentLayout = new RelativeLayout(this);
    contentLayout.setPadding(0, 0, 0, 0);

    //?
    mAbBottomBar = new ESBottomBar(this);

    //View
    ab_base.addView(mAbTitleBar,
            new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));

    mAbTitleBar.setVisibility(View.GONE);

    RelativeLayout.LayoutParams layoutParamsBottomBar = new RelativeLayout.LayoutParams(
            ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    layoutParamsBottomBar.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE);
    ab_base.addView(mAbBottomBar, layoutParamsBottomBar);

    RelativeLayout.LayoutParams layoutParamsContent = new RelativeLayout.LayoutParams(
            ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    layoutParamsContent.addRule(RelativeLayout.BELOW, mAbTitleBar.getId());
    layoutParamsContent.addRule(RelativeLayout.ABOVE, mAbBottomBar.getId());
    ab_base.addView(contentLayout, layoutParamsContent);

    //Application?
    abApplication = getApplication();

    //ContentView
    setContentView(ab_base,
            new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));

    ESActivityManager.getInstance().addActivity(this);
}

From source file:cn.org.eshow.framwork.activity.AbActivity.java

/**
 * ??./* ww  w.java2 s . c  om*/
 *
 * @param savedInstanceState the saved instance state
 * @see android.support.v4.app.FragmentActivity#onCreate(android.os.Bundle)
 */
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    mInflater = LayoutInflater.from(this);

    //?
    mAbTitleBar = new AbTitleBar(this);

    //
    ab_base = new RelativeLayout(this);
    ab_base.setBackgroundColor(Color.rgb(255, 255, 255));

    //
    contentLayout = new RelativeLayout(this);
    contentLayout.setPadding(0, 0, 0, 0);

    //?
    mAbBottomBar = new AbBottomBar(this);

    //View
    ab_base.addView(mAbTitleBar,
            new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));

    mAbTitleBar.setVisibility(View.GONE);

    RelativeLayout.LayoutParams layoutParamsBottomBar = new RelativeLayout.LayoutParams(
            ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    layoutParamsBottomBar.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE);
    ab_base.addView(mAbBottomBar, layoutParamsBottomBar);

    RelativeLayout.LayoutParams layoutParamsContent = new RelativeLayout.LayoutParams(
            ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    layoutParamsContent.addRule(RelativeLayout.BELOW, mAbTitleBar.getId());
    layoutParamsContent.addRule(RelativeLayout.ABOVE, mAbBottomBar.getId());
    ab_base.addView(contentLayout, layoutParamsContent);

    //Application?
    abApplication = getApplication();

    //ContentView
    setContentView(ab_base,
            new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));

    AbActivityManager.getInstance().addActivity(this);
}

From source file:com.crisFiApps.ubuntufourclocks.activities.Donations.java

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

    setContentView(R.layout.donations);//from  ww w. j a v a 2 s. co m

    FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
    DonationsFragment donationsFragment;
    if (BuildConfig.DONATIONS_GOOGLE) {
        donationsFragment = DonationsFragment.newInstance(BuildConfig.DEBUG, true, GOOGLE_PUBKEY,
                GOOGLE_CATALOG, getResources().getStringArray(R.array.donation_google_catalog_values), false,
                null, null, null, false, null, null, false, null);
    }
    ft.replace(R.id.donations_activity_container, donationsFragment, "donationsFragment");
    ft.commit();
    //En versiones superiores a Honeycomb se colorea actionbar con color Ubuntu
    if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) {
        ActionBar actionBar = getActionBar();
        if (actionBar != null) {
            actionBar.setBackgroundDrawable(new ColorDrawable(Color.rgb(135, 54, 79)));
        }
    }
}

From source file:com.code.android.vibevault.FeaturedShowsScreen.java

@Override
public void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    setContentView(R.layout.featured_shows_screen);

    getMoreShowsButton = new Button(this);
    getMoreShowsButton.setText("More Featured Shows");
    getMoreShowsButton.setTextColor(Color.rgb(18, 125, 212));
    getMoreShowsButton.setTypeface(Typeface.DEFAULT, Typeface.BOLD);
    getMoreShowsButton.setPadding(0, 6, 0, 6);

    getMoreShowsButton.setOnClickListener(new OnClickListener() {
        @Override//from  ww w  .  j  a v  a2 s  . com
        public void onClick(View v) {
            if (VibeVault.moreFeaturedShows.size() != 0) {
                fetchSelectedShows(VibeVault.moreFeaturedShows.get(0));
            } else {
                Toast.makeText(getBaseContext(), "More featured shows weekly...", Toast.LENGTH_SHORT).show();
            }
        }
    });

    this.featuredShowsList = (ListView) this.findViewById(R.id.SelectedShowsListView);
    featuredShowsList.addFooterView(getMoreShowsButton);
    if (VibeVault.featuredShows.size() == 0) {
        getMoreShowsButton.setVisibility(View.GONE);
    } else {
        getMoreShowsButton.setVisibility(View.VISIBLE);
    }
    featuredShowsList.setOnItemClickListener(new OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> a, View v, int position, long id) {
            ArchiveShowObj show = (ArchiveShowObj) featuredShowsList.getItemAtPosition(position);
            Intent i = new Intent(FeaturedShowsScreen.this, ShowDetailsScreen.class);
            i.putExtra("Show", show);
            startActivity(i);
        }
    });
    featuredShowsList.setOnCreateContextMenuListener(new OnCreateContextMenuListener() {
        @Override
        public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
            menu.add(Menu.NONE, VibeVault.EMAIL_LINK, Menu.NONE, "Email Link to Show");
            menu.add(Menu.NONE, VibeVault.ADD_TO_FAVORITE_LIST, Menu.NONE, "Bookmark Show");
        }
    });

    Object retained = getLastNonConfigurationInstance();
    if (retained instanceof GetSelectedShowsListTask) {

        workerTask = (GetSelectedShowsListTask) retained;
        workerTask.setActivity(this);
    } else {
        workerTask = new GetSelectedShowsListTask(this);
        if (VibeVault.featuredShows.size() == 0) {
            this.fetchSelectedShows("http://andrewpearson.org/vibevault/shows/vvshows1");
        }
        this.refreshSelectedShowsList();
    }
}

From source file:com.intl.aaa.survey.StylingBarGraph.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_main, container, false);

    GraphView graph = (GraphView) rootView.findViewById(R.id.graph);
    int x1 = 0;/*from   w w w .j a  v a 2s .com*/
    int y1 = 1;

    int x2 = 1;
    int y2 = 5;

    int x3 = 2;
    int y3 = 2;

    int x4 = 3;
    int y4 = 2;

    int x5 = 4;
    int y5 = 6;
    graph.setBackgroundColor(Color.WHITE); //add
    BarGraphSeries<DataPoint> series = new BarGraphSeries<DataPoint>(new DataPoint[] {
            /*                new DataPoint(0, -1),
                            new DataPoint(1, 5),
                            new DataPoint(2, 3),
                            new DataPoint(3, 2),
                            new DataPoint(4, 6)*/
            new DataPoint(0, y1), new DataPoint(1, y2), new DataPoint(2, y3), new DataPoint(3, y4),
            new DataPoint(4, y5) });
    graph.addSeries(series);

    // styling
    series.setValueDependentColor(new ValueDependentColor<DataPoint>() {
        @Override
        public int get(DataPoint data) {
            return Color.rgb((int) data.getX() * 255 / 6, (int) Math.abs(data.getY() * 255 / 6), 100);
        }
    });

    series.setSpacing(80);

    // draw values on top
    series.setDrawValuesOnTop(true);
    series.setValuesOnTopColor(Color.RED);
    //series.setValuesOnTopSize(50);

    // legend
    series.setTitle("foo");
    graph.getLegendRenderer().setVisible(true);
    graph.getLegendRenderer().setAlign(LegendRenderer.LegendAlign.TOP);
    //        graph.getViewport().setYAxisBoundsManual(true);
    //        graph.getViewport().setMinY(20);    //add
    //        graph.getViewport().setMaxY(8);     //add
    return rootView;
}

From source file:org.nuxeo.android.layout.WidgetDefinition.java

public NuxeoWidget build(LayoutContext context, Document doc, ViewGroup parent, LayoutMode mode) {
    this.mode = mode;

    View view = null;// w w w.j a v a2s.c o  m
    LayoutParams labelLayoutParams = new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT,
            LayoutParams.WRAP_CONTENT, 1f);
    LayoutParams widgetLayoutParams = new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT,
            LayoutParams.WRAP_CONTENT, 1f);

    if (LayoutMode.VIEW == mode) {
        labelLayoutParams = new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT,
                0.6f);
        widgetLayoutParams = new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT,
                0.4f);
    }

    AndroidWidgetWrapper wrapper = AndroidWidgetMapper.getInstance().getWidgetWrapper(this);

    if (wrapper != null) {
        view = wrapper.buildView(context, mode, doc, attributeNames, this);
        view.setLayoutParams(widgetLayoutParams);
        view.setPadding(1, 1, 1, 1);
        if (LayoutMode.VIEW == mode) {
            view.setBackgroundColor(Color.rgb(240, 240, 250));
        }
    }

    if (view != null) {
        if (label != null) {
            TextView labelW = new TextView(context.getActivity());
            labelW.setText(label + " :");
            labelW.setTextColor(Color.rgb(80, 80, 80));
            labelW.setLayoutParams(labelLayoutParams);
            parent.addView(labelW);
            if (LayoutMode.VIEW != mode) {
                labelW.setBackgroundColor(Color.rgb(160, 160, 170));
                labelW.setTextColor(Color.rgb(20, 20, 40));
                labelW.setPadding(5, 5, 5, 5);
            }

        }
        parent.addView(view);
        return new NuxeoWidget(this, view, wrapper);
    }

    return null;
}

From source file:com.spoiledmilk.cykelsuperstier.navigation.SMRouteNavigationActivity.java

@Override
public void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    textPath = (TextView) findViewById(R.id.textPath);
    textService = (TextView) findViewById(R.id.textService);
    textStrain = (TextView) findViewById(R.id.textStrain);
    textMetro = (TextView) findViewById(R.id.textMetro);
    textLocalTrain = (TextView) findViewById(R.id.textLocalTrain);

    if (getIntent() != null && getIntent().getExtras() != null
            && getIntent().getExtras().containsKey("overlays")) {
        ((SMRouteNavigationMapFragment) getMapFragment()).overlaysShown = getIntent().getIntExtra("overlays",
                0);/* w ww  . j  a  va 2 s.  c om*/
        int overlaysShown = getIntent().getIntExtra("overlays", 0);
        if ((overlaysShown & 1) > 0) {
            isPathSelected = true;
            findViewById(R.id.pathContainer).setBackgroundColor(Color.rgb(236, 104, 0));
            ((ImageView) findViewById(R.id.imgCheckbox1)).setImageResource(R.drawable.check_in_orange);
            ((ImageView) findViewById(R.id.imgPath)).setImageResource(R.drawable.bike_icon_white);
            textPath.setTextColor(Color.WHITE);
        }
        if ((overlaysShown & 2) > 0) {
            isServiceSelected = true;
            findViewById(R.id.serviceContainer).setBackgroundColor(Color.rgb(236, 104, 0));
            ((ImageView) findViewById(R.id.imgCheckbox2)).setImageResource(R.drawable.check_in_orange);
            ((ImageView) findViewById(R.id.imgService)).setImageResource(R.drawable.service_pump_icon_white);
            textService.setTextColor(Color.WHITE);
        }
        if ((overlaysShown & 4) > 0) {
            isStrainSelected = true;
            findViewById(R.id.strainContainer).setBackgroundColor(Color.rgb(236, 104, 0));
            ((ImageView) findViewById(R.id.imgCheckbox3)).setImageResource(R.drawable.check_in_orange);
            ((ImageView) findViewById(R.id.imgStrain)).setImageResource(R.drawable.s_togs_icon_white);
            textStrain.setTextColor(Color.WHITE);
        }
        if ((overlaysShown & 8) > 0) {
            isMetroSelected = true;
            findViewById(R.id.metroContainer).setBackgroundColor(Color.rgb(236, 104, 0));
            ((ImageView) findViewById(R.id.imgCheckbox4)).setImageResource(R.drawable.check_in_orange);
            ((ImageView) findViewById(R.id.imgMetro)).setImageResource(R.drawable.metro_icon_white);
            textMetro.setTextColor(Color.WHITE);
        }
        if ((overlaysShown & 16) > 0) {
            isLocalTrainSelected = true;
            findViewById(R.id.localTrainContainer).setBackgroundColor(Color.rgb(236, 104, 0));
            ((ImageView) findViewById(R.id.imgCheckbox5)).setImageResource(R.drawable.check_in_orange);
            ((ImageView) findViewById(R.id.imgLocalTrain)).setImageResource(R.drawable.local_train_icon_white);
            textLocalTrain.setTextColor(Color.WHITE);
        }
    }

}

From source file:com.zhejunzhu.ucviewpager.weight.StreamTabIndicator.java

public StreamTabIndicator(Context context) {
    this(context, null);

    //        mSelectColor = context.getResources().getColor(R.color.text_tab_select);
    //        mUnSelectColor = context.getResources().getColor(R.color.text_tab_gray);
    mSelectColor = Color.rgb(11, 188, 188);
    mUnSelectColor = Color.rgb(188, 188, 188);
}

From source file:foam.jellyfish.StarwispCanvas.java

@Override
public void onDraw(Canvas canvas) {
    float sx = getWidth() / 320.0f;
    float sy = getHeight() / 200.0f;

    Paint myPaint = new Paint();
    myPaint.setStrokeWidth(0);//from w w  w.  j a va2s  .  c  o  m
    myPaint.setColor(Color.rgb(127, 127, 127));
    canvas.drawRect(0, 0, getWidth(), getHeight(), myPaint);

    try {
        for (int i = 0; i < m_Drawlist.length(); i++) {
            JSONArray prim = m_Drawlist.getJSONArray(i);
            if (prim.getString(0).equals("line")) {
                DrawLine(canvas, prim, sx, sy);
            }
            if (prim.getString(0).equals("text")) {
                DrawText(canvas, prim, sx, sy);
            }
        }
    } catch (JSONException e) {
        Log.e("starwisp", "Error parsing data " + e.toString());
    }
}