Example usage for android.graphics.drawable ColorDrawable ColorDrawable

List of usage examples for android.graphics.drawable ColorDrawable ColorDrawable

Introduction

In this page you can find the example usage for android.graphics.drawable ColorDrawable ColorDrawable.

Prototype

public ColorDrawable(@ColorInt int color) 

Source Link

Document

Creates a new ColorDrawable with the specified color.

Usage

From source file:au.com.roadhouse.licensehelper.library.VerticalDividerItemDecorator.java

public VerticalDividerItemDecorator(Context context, @DimenRes int dividerHeight, @ColorRes int dividerColor) {
    mDividerHeight = context.getResources().getDimensionPixelOffset(dividerHeight);
    mDividerColor = ResourcesCompat.getColor(context.getResources(), dividerColor, context.getTheme());
    mDividerColorDrawable = new ColorDrawable(mDividerColor);
}

From source file:com.aloknath.splitmytrip.Activities.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    toolbar = (Toolbar) findViewById(R.id.include);
    setSupportActionBar(toolbar);//from   w w  w.  j  av  a  2  s . com
    getSupportActionBar().setTitle("Split My Trip");
    getSupportActionBar().setBackgroundDrawable(new ColorDrawable(Color.parseColor("#8C000000")));

    android.support.v4.app.FragmentTransaction fragmentTransaction = getSupportFragmentManager()
            .beginTransaction();
    Fragment_New_Trip fragment_new_trip = new Fragment_New_Trip();
    fragmentTransaction.replace(R.id.fragmentNewTrip, fragment_new_trip.newInstance("New Trip"));
    Fragment_Existing_Trip fragment_existing_trip = new Fragment_Existing_Trip();
    fragmentTransaction.replace(R.id.fragmentExistingTrip, fragment_existing_trip.newInstance("Existing Trip"));
    Fragment_Billing fragment_billing = new Fragment_Billing();
    fragmentTransaction.replace(R.id.fragmentBilling, fragment_billing.newInstance("Send Amount"));
    Fragment_Google_Maps fragment_google_maps = new Fragment_Google_Maps();
    fragmentTransaction.replace(R.id.fragmentgoogleMaps, fragment_google_maps.newInstance("Google Maps"));
    fragmentTransaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
    fragmentTransaction.commit();

}

From source file:com.example.android.supportv4.view.CheckableFrameLayout.java

@Override
public void setChecked(boolean checked) {
    mChecked = checked;//  w w  w . ja  va 2 s. c om
    ViewCompat.setBackground(this, checked ? new ColorDrawable(0xff0000a0) : null);
}

From source file:geert.stef.sm.beheerautokm.HistoryActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_history);
    getSupportActionBar().setBackgroundDrawable(new ColorDrawable(getResources().getColor(R.color.darkblue)));

    Bundle b = getIntent().getExtras();//from w w  w .  jav  a 2 s . co  m
    manager = b.getParcelable("parcel");

    selectedCar = b.getParcelable("car");
    getSupportActionBar().setTitle(selectedCar.getCar());
    this.getRitten();

    ArrayList<Rit> rittenSelectedCar = new ArrayList<>();
    for (Rit r : manager.getRitten()) {
        if (r.getCar().equals(selectedCar.getLicensePlate())) {
            rittenSelectedCar.add(r);
        }
    }
    listView = (ListView) findViewById(R.id.lvRit);
    ritAdapter = new RitListAdapter(this.getApplicationContext(), rittenSelectedCar);
    listView.setAdapter(ritAdapter);
}

From source file:com.andrewpham.android.khanacademy_learnanything.controllers.VideoActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    mYoutubeId = getIntent().getStringExtra(TopicFragment.EXTRA_ID);

    super.onCreate(savedInstanceState);
    mActionBar = getActionBar();/*from w  w  w . j  a va  2 s .  c  om*/
    mActionBar.setBackgroundDrawable(new ColorDrawable(getResources().getColor(R.color.actionbar_background)));
    mActionBar.setTitle(getIntent().getStringExtra(TopicFragment.EXTRA_TITLE));
    if (NavUtils.getParentActivityName(this) != null) {
        mActionBar.setDisplayHomeAsUpEnabled(true);
    }
    setContentView(R.layout.activity_video);
    mPlayerView = (YouTubePlayerView) findViewById(R.id.player);

    mPlayerView.initialize(DeveloperKey.DEVELOPER_KEY, this);
}

From source file:click.kobaken.rxirohaandroid_sample.view.fragment.SplashFragment.java

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    Dialog dialog = getDialog();//w  ww  . j a v a2  s .c  om
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    dialog.setContentView(R.layout.fragment_splash);
    dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
    dialog.getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
}

From source file:geert.stef.sm.beheerautokm.AddRitActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_add_rit);
    getSupportActionBar().setBackgroundDrawable(new ColorDrawable(getResources().getColor(R.color.darkblue)));

    Bundle b = getIntent().getExtras();//from   w w w . j  a  va2 s  .  co  m
    manager = b.getParcelable("parcel");
    selectedCar = b.getParcelable("car");

    txtKMStand = (TextView) findViewById(R.id.txtKMStandValue);
    txtKMTank = (TextView) findViewById(R.id.txtKMTankValue);
    txtKMNog = (TextView) findViewById(R.id.txtKMToDriveValue);
    txtKMBegin = (EditText) findViewById(R.id.txtDistanceBegin);
    txtKMEind = (EditText) findViewById(R.id.txtDistanceEnd);
    txtKMTotaal = (EditText) findViewById(R.id.txtDistance);
    spinner = (Spinner) findViewById(R.id.spinner_cars);

    carSpinner = new String[manager.getCars().size()];

    for (int i = 0; i < manager.getCars().size(); i++) {
        carSpinner[i] = manager.getCars().get(i).getCar();
    }

    myAdapter = new SpinAdapter(this, R.layout.spinner_row, manager.getCars());
    spinner.setAdapter(myAdapter);
    //spinner.setSelection(myAdapter.getPosition(selectedCar), true);
    spinner.setSelection(((SpinAdapter) spinner.getAdapter()).getPosition(selectedCar));
    spinner.setOnItemSelectedListener(this);

    //spinner.setSelection(myAdapter.getPosition(selectedCar), true);
    //spinner.setSelection(manager.getCars().get(3));
    //spinner.setSelection(0, true);
}

From source file:com.brodev.socialapp.view.ImageActivity.java

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

    ColorDrawable color = new ColorDrawable(Color.BLACK);
    color.setAlpha(128);/*from w w  w .  ja v a  2  s .  co m*/
    getSupportActionBar().setBackgroundDrawable(color);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    setContentView(R.layout.market_place_image_view);

    File cacheDir = new File(this.getCacheDir(), "imgcachedir");
    if (!cacheDir.exists())
        cacheDir.mkdir();

    Bundle bundle = getIntent().getExtras();

    String image = bundle.getString("image");
    String title = bundle.getString("title");
    getSupportActionBar().setTitle(title);

    ImageView imageView = (ImageView) findViewById(R.id.audiochatImg);

    networkUntil.drawImageUrl(imageView, image, R.drawable.loading);

    this.getWindow().setBackgroundDrawableResource(android.R.color.black);
}

From source file:Main.java

@SuppressLint("NewApi")
private static Drawable getSelectedDrawable(ColorDrawable mDrawable) {
    return new ColorDrawable(deepColor(mDrawable.getColor()));
}

From source file:ca.farrelltonsolar.classic.MonthPager.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View theView = inflater.inflate(R.layout.day_logs_chart_pager, container, false);
    VerticalViewPager verticalViewPager = (VerticalViewPager) theView.findViewById(R.id.verticalviewpager);

    verticalViewPager.setAdapter(getAdapter());
    verticalViewPager.setPageMargin(getResources().getDimensionPixelSize(R.dimen.pagemargin));
    verticalViewPager/*from w w  w.j  a va 2 s .com*/
            .setPageMarginDrawable(new ColorDrawable(getResources().getColor(android.R.color.holo_green_dark)));

    verticalViewPager.setPageTransformer(true, new ViewPager.PageTransformer() {
        @Override
        public void transformPage(View view, float position) {
            int pageWidth = view.getWidth();
            int pageHeight = view.getHeight();

            if (position < -1) { // [-Infinity,-1)
                // This page is way off-screen to the left.
                view.setAlpha(0);

            } else if (position <= 1) { // [-1,1]
                // Modify the default slide transition to shrink the page as well
                float scaleFactor = Math.max(MIN_SCALE, 1 - Math.abs(position));
                float vertMargin = pageHeight * (1 - scaleFactor) / 2;
                float horzMargin = pageWidth * (1 - scaleFactor) / 2;
                if (position < 0) {
                    view.setTranslationY(vertMargin - horzMargin / 2);
                } else {
                    view.setTranslationY(-vertMargin + horzMargin / 2);
                }

                // Scale the page down (between MIN_SCALE and 1)
                view.setScaleX(scaleFactor);
                view.setScaleY(scaleFactor);

                // Fade the page relative to its size.
                view.setAlpha(MIN_ALPHA + (scaleFactor - MIN_SCALE) / (1 - MIN_SCALE) * (1 - MIN_ALPHA));

            } else { // (1,+Infinity]
                // This page is way off-screen to the right.
                view.setAlpha(0);
            }
        }
    });
    return theView;
}