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.tony.selene.sliding.AbSlidingSmoothTabView.java

/**
 * Instantiates a new ab sliding smooth tab view.
 *
 * @param context/*  w  ww. ja  v a  2  s .c  om*/
 *            the context
 * @param attrs
 *            the attrs
 */
public AbSlidingSmoothTabView(Context context, AttributeSet attrs) {
    super(context, attrs);
    this.context = context;

    layoutParamsFW = new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT);
    layoutParamsFF = new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
    layoutParamsWW = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);

    this.setOrientation(LinearLayout.VERTICAL);
    this.setBackgroundColor(Color.rgb(255, 255, 255));

    mTabScrollView = new AbHorizontalScrollView(context);
    mTabScrollView.setHorizontalScrollBarEnabled(false);
    mTabLayout = new LinearLayout(context);
    mTabLayout.setOrientation(LinearLayout.HORIZONTAL);
    mTabLayout.setGravity(Gravity.CENTER);
    // mTabLayout
    mTabScrollView.addView(mTabLayout, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
            ViewGroup.LayoutParams.FILL_PARENT));

    // Tab?
    tabItemList = new ArrayList<TextView>();
    tabItemTextList = new ArrayList<String>();

    this.addView(mTabScrollView, layoutParamsFW);

    // ?
    mTabImg = new ImageView(context);
    this.addView(mTabImg, new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, tabSlidingHeight));

    // View?
    mViewPager = new ViewPager(context);
    // ViewPager,setId()id
    mViewPager.setId(1985);
    pagerItemList = new ArrayList<Fragment>();

    this.addView(mViewPager, layoutParamsFF);

    // ?FragmentActivity
    if (!(this.context instanceof FragmentActivity)) {
        AbLogUtil.e(AbSlidingSmoothTabView.class,
                "AbSlidingSmoothTabView?context,FragmentActivity");
    }

    FragmentManager mFragmentManager = ((FragmentActivity) this.context).getFragmentManager();
    mFragmentPagerAdapter = new AbFragmentPagerAdapter(mFragmentManager, pagerItemList);
    mViewPager.setAdapter(mFragmentPagerAdapter);
    mViewPager.setOnPageChangeListener(new MyOnPageChangeListener());
    mViewPager.setOffscreenPageLimit(3);

    mTabScrollView.setSmoothScrollingEnabled(true);

    mTabScrollView.setOnScrollListener(new AbOnScrollListener() {

        @Override
        public void onScrollToRight() {
            AbLogUtil.d(AbSlidingSmoothTabView.class, "onScrollToRight");
        }

        @Override
        public void onScrollToLeft() {
            AbLogUtil.d(AbSlidingSmoothTabView.class, "onScrollToLeft");
        }

        @Override
        public void onScrollStoped() {
            AbLogUtil.d(AbSlidingSmoothTabView.class, "onScrollStoped");
        }

        @Override
        public void onScroll(int arg1) {
            scrollX = arg1;
            View view = mTabLayout.getChildAt(mSelectedTabIndex);
            int toX = view.getLeft() - scrollX;

            AbLogUtil.d(AbSlidingSmoothTabView.class, "X" + startX + "to" + toX);
            imageSlide(mTabImg, startX, toX, 0, 0);
            startX = toX;
        }
    });
}

From source file:com.nicolacimmino.expensestracker.tracker.data_sync.GcmIntentService.java

private void showExpensesUpdatedNotification() {
    mNotificationManager = (NotificationManager) this.getSystemService(Context.NOTIFICATION_SERVICE);

    PendingIntent contentIntent = PendingIntent.getActivity(this, 0,
            new Intent(this, ExpensesListActivity.class), 0);

    NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this)
            .setSmallIcon(R.drawable.ic_notification)
            .setContentTitle(getResources().getString(R.string.app_name))
            .setStyle(new NotificationCompat.BigTextStyle()
                    .bigText(getResources().getString(R.string.notification_data_changed)))
            .setContentText(getResources().getString(R.string.notification_data_changed)).setAutoCancel(true)
            .setSound(RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION))
            .setLights(Color.rgb(219, 70, 0), 700, 1000).setOnlyAlertOnce(true);

    mBuilder.setContentIntent(contentIntent);
    mNotificationManager.notify(EXPENSES_UPDATED_NOTIFICATION_ID, mBuilder.build());
}

From source file:it.redturtle.mobile.apparpav.MeteogramAdapter.java

/**
 * SINGLE TITLE ROW//from  w  w w. j  av  a2 s. co m
 * @param att
 * @param linear
 * @return
 */
public LinearLayout getSingleTitleRow(Map<String, String> att, LinearLayout linear) {
    LinearLayout container_layout = new LinearLayout(context);
    container_layout.setMinimumHeight(30);
    container_layout
            .setBackgroundDrawable(context.getResources().getDrawable(R.drawable.view_shape_meteo_blue));
    container_layout.setVerticalGravity(Gravity.CENTER);

    LinearLayout.LayoutParams value_params = new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT,
            LayoutParams.WRAP_CONTENT, 0.5f);
    TextView tx = new TextView(context);
    tx.setTextColor(Color.rgb(66, 66, 66));
    container_layout.addView(tx, value_params);

    LinearLayout.LayoutParams ltext1 = new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT,
            LayoutParams.WRAP_CONTENT, 0.5f);
    TextView t1 = new TextView(context);
    t1.setText(att.get("value"));
    t1.setTextSize(11);
    t1.setGravity(Gravity.CENTER_HORIZONTAL);
    t1.setPadding(2, 0, 0, 2);
    t1.setTextColor(Color.rgb(255, 255, 255));
    container_layout.addView(t1, ltext1);

    linear.addView(container_layout);
    return linear;
}

From source file:com.abitbol.ophir.iplay.MidiOptions.java

public MidiOptions(MidiFile midifile) {
    showPiano = true;//from ww  w.  j  ava  2s . co  m
    int num_tracks = midifile.getTracks().size();
    tracks = new boolean[num_tracks];
    mute = new boolean[num_tracks];
    for (int i = 0; i < tracks.length; i++) {
        tracks[i] = true;
        mute[i] = false;
        if (midifile.getTracks().get(i).getInstrumentName().equals("Percussion")) {
            tracks[i] = false;
        }
    }
    useDefaultInstruments = true;
    instruments = new int[num_tracks];
    for (int i = 0; i < instruments.length; i++) {
        instruments[i] = midifile.getTracks().get(i).getInstrument();
    }
    scrollVert = false;
    largeNoteSize = true;
    if (tracks.length != 2) {
        twoStaffs = true;
    } else {
        twoStaffs = false;
    }
    showNoteLetters = NoteNameNone;
    showMeasures = false;
    showLyrics = true;
    shifttime = 0;
    transpose = 0;
    time = null;
    defaultTime = midifile.getTime();
    key = -1;
    combineInterval = 40;
    shade1Color = Color.rgb(210, 205, 220);
    shade2Color = Color.rgb(150, 200, 220);

    tempo = midifile.getTime().getTempo();
    pauseTime = 0;
    lastMeasure = midifile.EndTime() / midifile.getTime().getMeasure();
    playMeasuresInLoop = false;
    playMeasuresInLoopStart = 0;
    playMeasuresInLoopEnd = lastMeasure;
}

From source file:com.midisheetmusic.MidiOptions.java

public MidiOptions(MidiFile midifile) {
    showPiano = false;/* w w  w . j a v a  2s  .  com*/
    int num_tracks = midifile.getTracks().size();
    tracks = new boolean[num_tracks];
    mute = new boolean[num_tracks];
    for (int i = 0; i < tracks.length; i++) {
        tracks[i] = true;
        mute[i] = false;
        if (midifile.getTracks().get(i).getInstrumentName().equals("Percussion")) {
            tracks[i] = false;
            mute[i] = true;
        }
    }
    useDefaultInstruments = true;
    instruments = new int[num_tracks];
    for (int i = 0; i < instruments.length; i++) {
        instruments[i] = midifile.getTracks().get(i).getInstrument();
    }
    scrollVert = true;
    largeNoteSize = true;
    if (tracks.length != 2) {
        twoStaffs = true;
    } else {
        twoStaffs = false;
    }
    showNoteLetters = NoteNameNone;
    showMeasures = false;
    showLyrics = true;
    shifttime = 0;
    transpose = 0;
    time = null;
    defaultTime = midifile.getTime();
    key = -1;
    combineInterval = 40;
    shade1Color = Color.rgb(210, 205, 220);
    shade2Color = Color.rgb(150, 200, 220);

    tempo = midifile.getTime().getTempo();
    pauseTime = 0;
    lastMeasure = midifile.EndTime() / midifile.getTime().getMeasure();
    playMeasuresInLoop = false;
    playMeasuresInLoopStart = 0;
    playMeasuresInLoopEnd = lastMeasure;
}

From source file:org.climprpiano.midisheetmusic.MidiOptions.java

public MidiOptions(MidiFile midifile) {
    showPiano = true;/* w  ww. j  a v  a  2s .co m*/
    int num_tracks = midifile.getTracks().size();
    tracks = new boolean[num_tracks];
    mute = new boolean[num_tracks];
    for (int i = 0; i < tracks.length; i++) {
        tracks[i] = true;
        mute[i] = false;
        if (midifile.getTracks().get(i).getInstrumentName().equals("Percussion")) {
            tracks[i] = false;
            mute[i] = true;
        }
    }
    useDefaultInstruments = true;
    instruments = new int[num_tracks];
    for (int i = 0; i < instruments.length; i++) {
        instruments[i] = midifile.getTracks().get(i).getInstrument();
    }
    scrollVert = true;
    largeNoteSize = true;
    if (tracks.length != 2) {
        twoStaffs = true;
    } else {
        twoStaffs = false;
    }
    showNoteLetters = NoteNameNone;
    showMeasures = false;
    showLyrics = true;
    shifttime = 0;
    transpose = 0;
    time = null;
    defaultTime = midifile.getTime();
    key = -1;
    combineInterval = 40;
    shade1Color = Color.rgb(210, 205, 220);
    shade2Color = Color.rgb(150, 200, 220);

    tempo = midifile.getTime().getTempo();
    pauseTime = 0;
    lastMeasure = midifile.EndTime() / midifile.getTime().getMeasure();
    playMeasuresInLoop = false;
    playMeasuresInLoopStart = 0;
    playMeasuresInLoopEnd = lastMeasure;
}

From source file:cn.org.eshow.framwork.view.sliding.AbBottomTabView.java

/**
 * Instantiates a new ab bottom tab view.
 *
 * @param context the context/*from  www.ja v a  2 s  .  c  o  m*/
 * @param attrs the attrs
 */
public AbBottomTabView(Context context, AttributeSet attrs) {
    super(context, attrs);
    this.context = context;

    this.setOrientation(LinearLayout.VERTICAL);
    this.setBackgroundColor(Color.rgb(255, 255, 255));

    mTabLayout = new LinearLayout(context);
    mTabLayout.setOrientation(LinearLayout.HORIZONTAL);
    mTabLayout.setGravity(Gravity.CENTER);

    //View?
    mViewPager = new AbViewPager(context);
    //ViewPager,setId()id
    mViewPager.setId(1985);
    pagerItemList = new ArrayList<Fragment>();
    this.addView(mViewPager, new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, 0, 1));

    //?
    mTabImg = new ImageView(context);
    mTabImg.setBackgroundColor(tabSlidingColor);
    this.addView(mTabImg, new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, tabSlidingHeight));

    this.addView(mTabLayout,
            new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));

    //Tab?
    tabItemList = new ArrayList<AbTabItemView>();
    tabItemTextList = new ArrayList<String>();
    tabItemDrawableList = new ArrayList<Drawable>();
    //?FragmentActivity
    if (!(this.context instanceof FragmentActivity)) {
        AbLogUtil.e(AbBottomTabView.class,
                "AbSlidingTabView?context,FragmentActivity");
    }

    DisplayMetrics mDisplayMetrics = AbAppUtil.getDisplayMetrics(context);
    mWidth = mDisplayMetrics.widthPixels;

    FragmentManager mFragmentManager = ((FragmentActivity) this.context).getFragmentManager();
    mFragmentPagerAdapter = new AbFragmentPagerAdapter(mFragmentManager, pagerItemList);
    mViewPager.setAdapter(mFragmentPagerAdapter);
    mViewPager.setOnPageChangeListener(new MyOnPageChangeListener());
    mViewPager.setOffscreenPageLimit(3);

}

From source file:com.bangqu.eshow.view.sliding.ESBottomTabView.java

/**
 * Instantiates a new ab bottom tab view.
 *
 * @param context the context//from w w  w . j  av a  2  s  . c  o m
 * @param attrs the attrs
 */
public ESBottomTabView(Context context, AttributeSet attrs) {
    super(context, attrs);
    this.context = context;

    this.setOrientation(LinearLayout.VERTICAL);
    this.setBackgroundColor(Color.rgb(255, 255, 255));

    mTabLayout = new LinearLayout(context);
    mTabLayout.setOrientation(LinearLayout.HORIZONTAL);
    mTabLayout.setGravity(Gravity.CENTER);

    //View?
    mViewPager = new ESViewPager(context);
    //ViewPager,setId()id
    mViewPager.setId(1985);
    pagerItemList = new ArrayList<Fragment>();
    this.addView(mViewPager, new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, 0, 1));

    //?
    mTabImg = new ImageView(context);
    mTabImg.setBackgroundColor(tabSlidingColor);
    this.addView(mTabImg, new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, tabSlidingHeight));

    this.addView(mTabLayout,
            new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));

    //Tab?
    tabItemList = new ArrayList<ESTabItemView>();
    tabItemTextList = new ArrayList<String>();
    tabItemDrawableList = new ArrayList<Drawable>();
    //?FragmentActivity
    if (!(this.context instanceof FragmentActivity)) {
        ESLogUtil.e(ESBottomTabView.class,
                "AbSlidingTabView?context,FragmentActivity");
    }

    DisplayMetrics mDisplayMetrics = ESAppUtil.getDisplayMetrics(context);
    mWidth = mDisplayMetrics.widthPixels;

    FragmentManager mFragmentManager = ((FragmentActivity) this.context).getFragmentManager();
    mFragmentPagerAdapter = new ESFragmentPagerAdapter(mFragmentManager, pagerItemList);
    mViewPager.setAdapter(mFragmentPagerAdapter);
    mViewPager.setOnPageChangeListener(new MyOnPageChangeListener());
    mViewPager.setOffscreenPageLimit(3);

}

From source file:com.midisheetmusicmemo.MidiOptions.java

public MidiOptions(MidiFile midifile) {
    showPiano = true;/*  www . j av  a2  s .  co  m*/
    int num_tracks = midifile.getTracks().size();
    tracks = new boolean[num_tracks];
    mute = new boolean[num_tracks];
    for (int i = 0; i < tracks.length; i++) {
        tracks[i] = true;
        mute[i] = false;
        if (midifile.getTracks().get(i).getInstrumentName().equals("Percussion")) {
            tracks[i] = false;
            mute[i] = true;
        }
    }
    useDefaultInstruments = true;
    instruments = new int[num_tracks];
    for (int i = 0; i < instruments.length; i++) {
        instruments[i] = midifile.getTracks().get(i).getInstrument();
    }
    scrollVert = false;
    largeNoteSize = true;
    if (tracks.length != 2) {
        twoStaffs = true;
    } else {
        twoStaffs = false;
    }
    showNoteLetters = NoteNameNone;
    showMeasures = false;
    showLyrics = true;
    shifttime = 0;
    transpose = 0;
    time = null;
    defaultTime = midifile.getTime();
    key = -1;
    combineInterval = 40;
    shade1Color = Color.rgb(210, 205, 220);
    shade2Color = Color.rgb(150, 200, 220);

    tempo = midifile.getTime().getTempo();
    pauseTime = 0;
    lastMeasure = midifile.EndTime() / midifile.getTime().getMeasure();
    playMeasuresInLoop = false;
    playMeasuresInLoopStart = 0;
    playMeasuresInLoopEnd = lastMeasure;
}

From source file:com.notriddle.budget.EnvelopesActivity.java

private void setupDrawer() {
    mNavDrawer = (ListView) findViewById(R.id.left_drawer);
    mNavAdapter = new NavAdapter(this);
    mNavDrawer.setAdapter(mNavAdapter);//from   w  ww. j  a  va 2s. c om
    mNavDrawer.setOnItemClickListener(this);
    mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
    mNavToggle = new ActionBarDrawerToggle(this, mDrawerLayout, R.drawable.ic_drawer,
            R.string.drawerOpen_button, R.string.drawerClose_button) {
        @Override
        public void onDrawerClosed(View v) {
            super.onDrawerClosed(v);
            ActionBar ab = getActionBar();
            ab.setTitle(getTitle());
            invalidateOptionsMenu();
            if (mCustomActionBarView != null) {
                ab.setCustomView(mCustomActionBarView);
                ab.setDisplayShowTitleEnabled(false);
                ab.setDisplayShowCustomEnabled(true);
            }
        }

        @Override
        public void onDrawerSlide(View v, float off) {
            super.onDrawerSlide(v, off);
            int allIn = mColor;
            int allOut = 0xFFEEEEEE;
            int result = Color.rgb((int) (Color.red(allIn) * (1 - off) + Color.red(allOut) * off),
                    (int) (Color.green(allIn) * (1 - off) + Color.green(allOut) * off),
                    (int) (Color.blue(allIn) * (1 - off) + Color.blue(allOut) * off));
            mActionBarColor.setColor(result);
        }

        @Override
        public void onDrawerOpened(View v) {
            super.onDrawerOpened(v);
            ActionBar ab = getActionBar();
            ab.setTitle(getString(R.string.app_name));
            invalidateOptionsMenu();
            if (mCustomActionBarView != null) {
                ab.setDisplayShowTitleEnabled(true);
                ab.setDisplayShowCustomEnabled(false);
                ab.setCustomView(null);
            }
        }
    };
    mDrawerLayout.setDrawerListener(mNavToggle);
    getActionBar().setHomeButtonEnabled(true);
    getActionBar().setDisplayHomeAsUpEnabled(true);
}