List of usage examples for android.content.res Resources getColor
@ColorInt @Deprecated public int getColor(@ColorRes int id) throws NotFoundException
From source file:com.codetroopers.betterpickers.radialtimepicker.AmPmCirclesView.java
public void initialize(Context context, int amOrPm) { if (mIsInitialized) { Log.e(TAG, "AmPmCirclesView may only be initialized once."); return;/* www . ja v a2 s . c o m*/ } Resources res = context.getResources(); mUnselectedColor = res.getColor(R.color.bpWhite); mSelectedColor = res.getColor(R.color.bpBlue); mAmPmTextColor = res.getColor(R.color.ampm_text_color); String typefaceFamily = res.getString(R.string.sans_serif); Typeface tf = Typeface.create(typefaceFamily, Typeface.NORMAL); mPaint.setTypeface(tf); mPaint.setAntiAlias(true); mPaint.setTextAlign(Align.CENTER); mCircleRadiusMultiplier = Float.parseFloat(res.getString(R.string.circle_radius_multiplier)); mAmPmCircleRadiusMultiplier = Float.parseFloat(res.getString(R.string.ampm_circle_radius_multiplier)); String[] amPmTexts = new DateFormatSymbols().getAmPmStrings(); mAmText = amPmTexts[0]; mPmText = amPmTexts[1]; setAmOrPm(amOrPm); mAmOrPmPressed = -1; mIsInitialized = true; }
From source file:com.polatic.pantaudki.home.OutcomeFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final View v = inflater.inflate(R.layout.home_fragment_outcome, container, false); final Resources resources = getResources(); ArrayList<Bar> aBars = new ArrayList<Bar>(); Bar bar = new Bar(); bar.setColor(resources.getColor(R.color.green_light)); bar.setSelectedColor(resources.getColor(R.color.transparent_orange)); bar.setName("Sisa Anggaran Sebelumnya"); bar.setValue(7015);//from w w w . ja va 2s . c o m bar.setValueString("7,015 Milyar"); aBars.add(bar); bar = new Bar(); bar.setColor(resources.getColor(R.color.purple)); bar.setName("Penerimaan Pinjaman Daerah"); bar.setValue(269); bar.setValueString("269 Milyar"); aBars.add(bar); BarGraph barGraph = (BarGraph) v.findViewById(R.id.first_bargraph); barGraph.setBars(aBars); barGraph.setOnBarClickedListener(new OnBarClickedListener() { @Override public void onClick(int index) { Toast.makeText(getActivity(), "Bar " + index + " clicked", Toast.LENGTH_SHORT).show(); } }); aBars = new ArrayList<Bar>(); bar = new Bar(); bar.setColor(resources.getColor(R.color.main_blue_light)); bar.setSelectedColor(resources.getColor(R.color.transparent_orange)); bar.setName("Penyertaan Modal"); bar.setValue(7108); bar.setValueString("7,108 Milyar"); aBars.add(bar); bar = new Bar(); bar.setColor(resources.getColor(R.color.red_light)); bar.setName("Pembayaran Pokok Utang"); bar.setValue(9); bar.setValueString("9 Milyar"); aBars.add(bar); barGraph = (BarGraph) v.findViewById(R.id.second_bargraph); barGraph.setBars(aBars); return v; }
From source file:com.muvingapp.muving.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); /* [ANALYTICS:SCREEN] * TRIGGER: View the My Schedule screen. * LABEL: 'My Schedule'//from w ww .j av a 2s . c o m * [/ANALYTICS] */ Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar1); setSupportActionBar(toolbar); mViewPager = (ViewPager) findViewById(R.id.pager); //mScrollViewWide = (ScrollView) findViewById(R.id.main_content_wide); //mWideMode = findViewById(R.id.my_schedule_first_day) != null; //int i; // for (i = 0; i < Config.CONFERENCE_DAYS.length; i++) { // mScheduleAdapters[i] = new MyScheduleAdapter(this, getLUtils()); //} mViewPagerAdapter = new OurViewPagerAdapter(getSupportFragmentManager()); mViewPager.setAdapter(mViewPagerAdapter); mSlidingTabLayout = (SlidingTabLayout) findViewById(R.id.sliding_tabs); mSlidingTabLayout.setCustomTabView(R.layout.tab_indicator, android.R.id.text1); mSlidingTabLayout.setContentDescription(1, "cercanos"); mSlidingTabLayout.setContentDescription(2, "recientes"); Resources res = getResources(); mSlidingTabLayout.setSelectedIndicatorColors(res.getColor(R.color.tab_selected_strip)); mSlidingTabLayout.setDistributeEvenly(true); mSlidingTabLayout.setViewPager(mViewPager); // mButterBar = findViewById(R.id.butter_bar); if (mSlidingTabLayout != null) { mSlidingTabLayout.setOnPageChangeListener(new ViewPager.OnPageChangeListener() { @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { } @Override public void onPageSelected(int position) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { if (position == 0) { mSlidingTabLayout.announceForAccessibility("cercanos"); } else { mSlidingTabLayout.announceForAccessibility("recientes"); } } } @Override public void onPageScrollStateChanged(int state) { enableDisableSwipeRefresh(state == ViewPager.SCROLL_STATE_IDLE); } }); } //overridePendingTransition(0, 0); //addDataObservers(); }
From source file:chrisrenke.drawerarrowdrawable.DrawerArrowSample.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.home_view);/*from w ww . j a v a 2 s . c om*/ final DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); final ImageView imageView = (ImageView) findViewById(R.id.drawer_indicator); final Resources resources = getResources(); drawerArrowDrawable = new DrawerArrowDrawable(resources); drawerArrowDrawable.setStrokeColor(resources.getColor(R.color.green)); imageView.setImageDrawable(drawerArrowDrawable); drawer.setDrawerListener(new DrawerLayout.SimpleDrawerListener() { @Override public void onDrawerSlide(View drawerView, float slideOffset) { offset = slideOffset; // Sometimes slideOffset ends up so close to but not quite 1 or 0. if (slideOffset >= .995) { flipped = true; drawerArrowDrawable.setFlip(flipped); } else if (slideOffset <= .005) { flipped = false; drawerArrowDrawable.setFlip(flipped); } drawerArrowDrawable.setParameter(offset); } }); imageView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (drawer.isDrawerVisible(START)) { drawer.closeDrawer(START); } else { drawer.openDrawer(START); } } }); final TextView styleButton = (TextView) findViewById(R.id.indicator_style); styleButton.setOnClickListener(new View.OnClickListener() { boolean rounded = false; @Override public void onClick(View v) { styleButton.setText(rounded // ? resources.getString(R.string.rounded) // : resources.getString(R.string.squared)); rounded = !rounded; drawerArrowDrawable = new DrawerArrowDrawable(resources, rounded); drawerArrowDrawable.setParameter(offset); drawerArrowDrawable.setFlip(flipped); drawerArrowDrawable.setStrokeColor(resources.getColor(R.color.light_gray)); imageView.setImageDrawable(drawerArrowDrawable); } }); }
From source file:com.mobimvp.cliques.ui.ShotsActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (isFinishing()) { return;/*from ww w .j ava 2 s. c o m*/ } setContentView(R.layout.activity_shots); mViewPager = (ViewPager) findViewById(R.id.viewpager); mViewPagerAdapter = new ViewPagerAdapter(getSupportFragmentManager()); mViewPager.setAdapter(mViewPagerAdapter); mViewPager.setOffscreenPageLimit(mTitle.length); mSlidingTabLayout = (SlidingTabLayout) findViewById(R.id.sliding_tabs); mSlidingTabLayout.setCustomTabView(R.layout.tab_indicator, android.R.id.text1); Resources res = getResources(); mSlidingTabLayout.setSelectedIndicatorColors(res.getColor(R.color.tab_selected_strip)); mSlidingTabLayout.setDistributeEvenly(true); mSlidingTabLayout.setViewPager(mViewPager); if (mSlidingTabLayout != null) { mSlidingTabLayout.setOnPageChangeListener(new ViewPager.OnPageChangeListener() { @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { } @Override public void onPageSelected(int position) { } @Override public void onPageScrollStateChanged(int state) { enableDisableSwipeRefresh(state == ViewPager.SCROLL_STATE_IDLE); } }); } ListView listView = (ListView) findViewById(R.id.listview); if (listView != null) { enableActionBarAutoHide(listView); enableDisableSwipeRefresh(true); } }
From source file:com.example.drawerarrowdrawable.DrawerArrowSample.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.home_view);/* w ww. j a v a2 s.c om*/ final DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); final ImageView imageView = (ImageView) findViewById(R.id.drawer_indicator); final Resources resources = getResources(); drawerArrowDrawable = new DrawerArrowDrawable(resources); drawerArrowDrawable.setStrokeColor(resources.getColor(R.color.light_gray)); imageView.setImageDrawable(drawerArrowDrawable); drawer.setDrawerListener(new DrawerLayout.SimpleDrawerListener() { @Override public void onDrawerSlide(View drawerView, float slideOffset) { offset = slideOffset; // Sometimes slideOffset ends up so close to but not quite 1 or 0. if (slideOffset >= .995) { flipped = true; drawerArrowDrawable.setFlip(flipped); } else if (slideOffset <= .005) { flipped = false; drawerArrowDrawable.setFlip(flipped); } drawerArrowDrawable.setParameter(offset); } }); imageView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (drawer.isDrawerVisible(START)) { drawer.closeDrawer(START); } else { drawer.openDrawer(START); } } }); final TextView styleButton = (TextView) findViewById(R.id.indicator_style); styleButton.setOnClickListener(new View.OnClickListener() { boolean rounded = false; @Override public void onClick(View v) { styleButton.setText(rounded // ? resources.getString(R.string.rounded) // : resources.getString(R.string.squared)); rounded = !rounded; drawerArrowDrawable = new DrawerArrowDrawable(resources, rounded); drawerArrowDrawable.setParameter(offset); drawerArrowDrawable.setFlip(flipped); drawerArrowDrawable.setStrokeColor(resources.getColor(R.color.light_gray)); imageView.setImageDrawable(drawerArrowDrawable); } }); }
From source file:com.vinidsl.googleioextended.ui.adapter.DiaryAdapter.java
@Override public void onBindViewHolder(ViewHolderDiary holder, int position) { DiaryItem diaryItem = diaryItemList.get(position); final Talk talk1 = diaryItem.getTalk1(); final Talk talk2 = diaryItem.getTalk2(); Resources resources = fragment.getActivity().getResources(); if (talk2 != null) { holder.textViewLocation1.setTextColor(resources.getColor(R.color.red)); holder.textViewLocation2.setTextColor(resources.getColor(R.color.red)); } else {/*from ww w . j a va 2 s.co m*/ holder.textViewLocation1.setTextColor(resources.getColor(R.color.secondary_text)); holder.textViewLocation2.setTextColor(resources.getColor(R.color.secondary_text)); } holder.textViewDate.setText(talk1.getDate()); holder.textViewTitle1.setText(talk1.getTitle()); holder.textViewLocation1.setText(talk1.getRoom()); holder.linearLayout1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { IntentHelper.startDetailIntent(fragment, talk1.getId()); } }); if (talk2 != null) { holder.linearLayout2.setVisibility(View.VISIBLE); holder.textViewTitle2.setText(talk2.getTitle()); holder.textViewLocation2.setText(talk2.getRoom()); holder.linearLayout2.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { IntentHelper.startDetailIntent(fragment, talk2.getId()); } }); } else { holder.linearLayout2.setVisibility(View.GONE); } if (position == getItemCount()) { holder.divider.setVisibility(View.INVISIBLE); } else { holder.divider.setVisibility(View.VISIBLE); } }
From source file:cn.flyrise.android3.test.graphic.DrawerArrowSample.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.home_view);/* w w w . java2s . c o m*/ final DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); final ImageView imageView = (ImageView) findViewById(R.id.drawer_indicator); final Resources resources = getResources(); drawerArrowDrawable = new DrawerArrowDrawable(resources); drawerArrowDrawable.setStrokeColor(resources.getColor(R.color.light_gray)); imageView.setImageDrawable(drawerArrowDrawable); drawer.setDrawerListener(new DrawerLayout.SimpleDrawerListener() { @Override public void onDrawerSlide(View drawerView, float slideOffset) { Log.e("Test", "slideOffset==" + slideOffset); offset = slideOffset; // Sometimes slideOffset ends up so close to but not quite 1 or 0. if (slideOffset >= .995) { flipped = true; drawerArrowDrawable.setFlip(flipped); } else if (slideOffset <= .005) { flipped = false; drawerArrowDrawable.setFlip(flipped); } drawerArrowDrawable.setParameter(offset); } }); imageView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (drawer.isDrawerVisible(START)) { drawer.closeDrawer(START); } else { drawer.openDrawer(START); } } }); final TextView styleButton = (TextView) findViewById(R.id.indicator_style); styleButton.setOnClickListener(new View.OnClickListener() { boolean rounded = false; @Override public void onClick(View v) { styleButton.setText(rounded // ? resources.getString(R.string.rounded) // : resources.getString(R.string.squared)); rounded = !rounded; drawerArrowDrawable = new DrawerArrowDrawable(resources, rounded); drawerArrowDrawable.setParameter(offset); drawerArrowDrawable.setFlip(flipped); drawerArrowDrawable.setStrokeColor(resources.getColor(R.color.light_gray)); imageView.setImageDrawable(drawerArrowDrawable); } }); }
From source file:com.echo.holographlibrarysample.LineFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final View v = inflater.inflate(R.layout.fragment_linegraph, container, false); final Resources resources = getResources(); Line l = new Line(); l.setUsingDips(true);/* w ww . j a v a 2 s. c o m*/ LinePoint p = new LinePoint(); p.setX(0); p.setY(5); p.setColor(resources.getColor(R.color.red)); p.setSelectedColor(resources.getColor(R.color.transparent_blue)); l.addPoint(p); p = new LinePoint(); p.setX(8); p.setY(8); p.setColor(resources.getColor(R.color.blue)); l.addPoint(p); p = new LinePoint(); p.setX(10); p.setY(4); l.addPoint(p); p.setColor(resources.getColor(R.color.green)); l.setColor(resources.getColor(R.color.orange)); LineGraph li = (LineGraph) v.findViewById(R.id.linegraph); li.setUsingDips(true); li.addLine(l); li.setRangeY(0, 10); li.setLineToFill(0); li.setOnPointClickedListener(new OnPointClickedListener() { @Override public void onClick(int lineIndex, int pointIndex) { Toast.makeText(getActivity(), "Line " + lineIndex + " / Point " + pointIndex + " clicked", Toast.LENGTH_SHORT).show(); } }); return v; }
From source file:com.grottworkshop.gwsdrawerdrawableapp.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.home_view);/*from w w w . j a v a 2s . co m*/ final DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); final ImageView imageView = (ImageView) findViewById(R.id.drawer_indicator); final Resources resources = getResources(); drawerArrowDrawable = new DrawerArrowDrawable(resources); drawerArrowDrawable.setStrokeColor(resources.getColor(R.color.light_gray)); imageView.setImageDrawable(drawerArrowDrawable); drawer.setDrawerListener(new DrawerLayout.SimpleDrawerListener() { @Override public void onDrawerSlide(View drawerView, float slideOffset) { offset = slideOffset; // Sometimes slideOffset ends up so close to but not quite 1 or 0. if (slideOffset >= .995) { flipped = true; drawerArrowDrawable.setFlip(flipped); } else if (slideOffset <= .005) { flipped = false; drawerArrowDrawable.setFlip(flipped); } drawerArrowDrawable.setParameter(offset); } }); imageView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (drawer.isDrawerVisible(GravityCompat.START)) { drawer.closeDrawer(GravityCompat.START); } else { drawer.openDrawer(GravityCompat.START); } } }); final TextView styleButton = (TextView) findViewById(R.id.indicator_style); styleButton.setOnClickListener(new View.OnClickListener() { boolean rounded = false; @Override public void onClick(View v) { styleButton.setText(rounded // ? resources.getString(R.string.rounded) // : resources.getString(R.string.squared)); rounded = !rounded; drawerArrowDrawable = new DrawerArrowDrawable(resources, rounded); drawerArrowDrawable.setParameter(offset); drawerArrowDrawable.setFlip(flipped); drawerArrowDrawable.setStrokeColor(resources.getColor(R.color.light_gray)); imageView.setImageDrawable(drawerArrowDrawable); } }); }