Example usage for android.graphics Color parseColor

List of usage examples for android.graphics Color parseColor

Introduction

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

Prototype

@ColorInt
public static int parseColor(@Size(min = 1) String colorString) 

Source Link

Document

Parse the color string, and return the corresponding color-int.

Usage

From source file:com.avolatile.randomdaily.IntroductionActivitySlideFragment3.java

@Override
public int getDefaultBackgroundColor() {
    return Color.parseColor("#00ABFF");
}

From source file:com.google.blockly.model.FieldColor.java

@Override
public boolean setFromString(String text) {
    try {/*w  w  w  .  ja  v  a2  s  .com*/
        setColor(Color.parseColor(text));
    } catch (IllegalArgumentException e) {
        return false;
    }
    return true;
}

From source file:com.cryart.sabbathschool.viewmodel.SSQuarterlyItemViewModel.java

@BindingAdapter({ "backgroundColor" })
public static void setBackgroundColor(View view, String color) {
    view.setBackgroundColor(Color.parseColor(color));
}

From source file:com.burntout.burntout.AddCarActivity.java

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

    ActionBar bar = getActionBar();/* w w  w  . j a  v a  2s  .co m*/
    bar.setBackgroundDrawable(new ColorDrawable(Color.parseColor("#1E5791")));
    bar.setTitle("Burnt Out");
    bar.setSubtitle("Add Vehicle");
    bar.setDisplayHomeAsUpEnabled(true);

    //adapter = new AutopickerArrayAdapter(this, R.layout.add_car_activity, autopickerValues);

    makeModelEntry = (EditText) findViewById(R.id.make_model);
    plateNumberEntry = (EditText) findViewById(R.id.plate_number);
    pageMarkers = (PageMarkers) findViewById(R.id.pageMarkersAdd);
    pageMarkers.setTotalPages(4);
    pageMarkers.makeView(0);

    Context context = this;

    SharedPreferences sharedPref = context.getSharedPreferences(getString(R.string.pref), Context.MODE_PRIVATE);

    email = sharedPref.getString("email", null);

    vehicleTypeHSV = (VehicleTypeHSV) findViewById(R.id.addVehicleTypeHSV);
    vehicleTypeHSV.setComm(this);
    vehicleTypeHSV.initItems(this);
    vehicleTypeHSV.setFeatureItems();
    vehicleTypeHSV.addManagers(this);

    statePicker = (StatePicker) findViewById(R.id.statepicker_view2);

    submitBtn = (Button) findViewById(R.id.submit_button_addcar);

    addListenerOnSubmit();

}

From source file:com.example.administrator.animex.ScreenSlidePageFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // Inflate the layout containing a title and body text.
    int color = Color.parseColor(mColorArray[mPageNumber]);
    ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.fragment_screen_slide_page, container, false);

    rootView.setBackgroundColor(color);/*from   ww  w . ja va  2s  .  c om*/
    // Set the title view to show the page number.
    ((TextView) rootView.findViewById(R.id.text1)).setText("" + mPageNumber);

    return rootView;
}

From source file:com.cryart.sabbathschool.viewmodel.SSQuarterlyItemViewModel.java

@BindingAdapter({ "fbDefaultColor" })
public static void setFbDefaultColor(FancyButton view, String color) {
    view.setBackgroundColor(Color.parseColor(color));
}

From source file:com.flowzr.activity.AbstractEditorActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    // Setup ActionBar      
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    //@see: http://stackoverflow.com/questions/16539251/get-rid-of-blue-line, 
    //only way found to remove on various devices 2.3x, 3.0, ...
    getSupportActionBar().setBackgroundDrawable(new ColorDrawable(Color.parseColor("#000000")));

    LayoutInflater layoutInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    NodeInflater nodeInflater = new NodeInflater(layoutInflater);

    x = new ActivityLayout(nodeInflater, this);
    db = new DatabaseAdapter(this);
    db.open();/*from   w w w .ja  va 2 s.  c  om*/
    em = db.em();
}

From source file:com.example.ishita.administrativeapp.WatchmanActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.nav_drawer);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);//from ww  w  .  j ava  2 s .c om
    toolbar.setTitleTextColor(Color.WHITE);
    personalData = new PersonalData(this);
    loadToast = new LoadToast(this);
    loadToast.setTranslationY(150);
    loadToast.setBackgroundColor(Color.WHITE).setProgressColor(Color.parseColor("#FF4081"))
            .setTextColor(Color.BLACK);
    Bundle bundle = getIntent().getExtras();
    GET_URL = (String) bundle.get("GET_URL");
    list = (ListView) findViewById(R.id.list);
    mSwipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.swipe);
    adapter = new WatchmanAdapter(this, items, loadToast, GET_URL);
    list.setAdapter(adapter);
    DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
    ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, drawer, toolbar,
            R.string.navigation_drawer_open, R.string.navigation_drawer_close);
    drawer.setDrawerListener(toggle);
    toggle.syncState();
    NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
    navigationView.setNavigationItemSelectedListener(this);
    mSwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
        @Override
        public void onRefresh() {

            refresh();

        }
    });
    mSwipeRefreshLayout.setColorSchemeResources(R.color.colorPrimary, R.color.colorAccent, R.color.colorAccent,
            R.color.colorAccent);
    mSwipeRefreshLayout.setRefreshing(true);
    fetchData();
    mSwipeRefreshLayout.setRefreshing(false);
}

From source file:com.example.ishita.administrativeapp.AttendantActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.nav_drawer);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);//from   ww  w  .j  ava 2s .  com
    toolbar.setTitleTextColor(Color.WHITE);

    loadToast = new LoadToast(this);
    loadToast.setTranslationY(150);
    loadToast.setBackgroundColor(Color.WHITE).setProgressColor(Color.parseColor("#FF4081"))
            .setTextColor(Color.BLACK);
    loadToast = new LoadToast(this);
    mSwipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.swipe);
    mSwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
        @Override
        public void onRefresh() {

            refresh();

        }
    });
    list = (ListView) findViewById(R.id.list);
    adapter = new AttendentAdapter(getApplicationContext(), items, loadToast);
    list.setAdapter(adapter);
    personalData = new PersonalData(this);
    DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
    ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, drawer, toolbar,
            R.string.navigation_drawer_open, R.string.navigation_drawer_close);
    drawer.setDrawerListener(toggle);
    toggle.syncState();
    NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
    navigationView.setNavigationItemSelectedListener(this);
    fetchData();
}

From source file:by.android.dailystatus.SettingsActivity.java

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

    setContentView(R.layout.settings);/*w w w .jav a2 s . c o m*/

    getSupportActionBar().setBackgroundDrawable(new ColorDrawable(Color.parseColor("#ffffffff")));
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    if (!OSUtil.IsNetworkAvailable(getApplicationContext())) {
        AlertMessageBox.Show(SettingsActivity.this, "Internet connection",
                "A valid internet connection can't be established", AlertMessageBox.AlertMessageBoxIcon.Info);
        return;
    }

    radioGroup = (RadioGroup) findViewById(R.id.rad_group);
    int index = PreferenceUtils.getCurrentRadioNotification(getApplicationContext());
    int id = R.id.radbtn_do_not_notify;
    switch (index) {
    case 0:
        id = R.id.radbtn_six_hours;
        break;
    case 2:
        id = R.id.radbtn_three_hours;
        break;

    default:
        break;
    }
    radioGroup.check(id);
    radioGroup.setOnCheckedChangeListener(new OnCheckedChangeListener() {
        public void onCheckedChanged(RadioGroup group, int checkedId) {
            View radioButton = radioGroup.findViewById(checkedId);
            int idx = radioGroup.indexOfChild(radioButton);
            PreferenceUtils.setCurrentRadioNotification(getApplicationContext(), idx);
            switch (idx) {
            case 0:
            case 2:
                AlarmActivity.CancelAlarm(getApplicationContext());
                AlarmActivity.setRepeatingAlarm(getApplicationContext(), idx);
                break;
            case 4:
                AlarmActivity.CancelAlarm(getApplicationContext());
                break;
            default:
                break;
            }
        }
    });

    PackageInfo pInfo;
    String vers = "";
    try {
        pInfo = getPackageManager().getPackageInfo(getPackageName(), 0);
        vers = pInfo.versionName;
    } catch (NameNotFoundException e) {
        e.printStackTrace();
    }

    faceUserName = (TextView) findViewById(R.id.txt_face_user_name);
    facebookDescription = (TextView) findViewById(R.id.txt_facebook_descroption);

    findViewById(R.id.lay_rate).setOnClickListener(this);
    findViewById(R.id.lay_connect_with_developer).setOnClickListener(this);
    findViewById(R.id.lay_facebook).setOnClickListener(this);
    findViewById(R.id.lay_version).setOnClickListener(this);
    findViewById(R.id.lay_license).setOnClickListener(this);

    Session.openActiveSession(this, false, new Session.StatusCallback() {

        // callback when session changes state
        @Override
        public void call(Session session, SessionState state, Exception exception) {
            if (session.isOpened()) {
                Request.newMeRequest(session, new Request.GraphUserCallback() {

                    @Override
                    public void onCompleted(GraphUser user, Response response) {

                        if (user != null) {
                            faceUserName.setText(user.getFirstName() + " " + user.getLastName());
                            facebookDescription.setText("?  ");
                            faceLogin = true;
                        }
                    }
                }).executeAsync();
            }

        }
    });
}