Back to project page OpenHSK.
The source code is released under:
This work is licensed under a Creative Commons Attribution 3.0 Unported License. Original author of word lists: http://lingomi.com/ Original author of definitions: http://cc-cedict.org Original autho...
If you think the Android project OpenHSK listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
/* * Created by Daniel Nadeau/*ww w . j a va 2 s . c o m*/ * daniel.nadeau01@gmail.com * danielnadeau.blogspot.com * * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ package edu.openhsk.views; import android.graphics.Color; import android.graphics.Path; import android.graphics.Region; public class Bar { private final Path mPath = new Path(); private final Region mRegion = new Region(); private int mColor = 0xFF33B5E5; private int mLabelColor = -1; private int mSelectedColor = -1; private int mValueColor = Color.WHITE; private String mName = null; private float mValue; private String mValueString = null; public Bar() { } public Bar(int mColor, String mName, float mValue) { this.mColor = mColor; this.mName = mName; this.mValue = mValue; } public Bar(int mColor, String mName, float mValue, String mValueString) { this.mColor = mColor; this.mName = mName; this.mValue = mValue; this.mValueString = mValueString; } public int getColor() { return mColor; } public void setColor(int color) { mColor = color; } public int getLabelColor() { return mLabelColor == -1 ? mColor : mLabelColor; } public void setLabelColor(int labelColor) { mLabelColor = labelColor; } public int getSelectedColor() { if (-1 == mSelectedColor) mSelectedColor = darkenColor(mColor); return mSelectedColor; } public void setSelectedColor(int selectedColor) { mSelectedColor = selectedColor; } public int getValueColor() { return mValueColor; } public void setValueColor(int valueColor) { mValueColor = valueColor; } public String getName() { return (null == mName) ? "" : mName; } public void setName(String name) { mName = name; } public float getValue() { return mValue; } public void setValue(float value) { mValue = value; } public String getValueString() { if (mValueString != null) { return mValueString; } else { return String.valueOf(mValue); } } public void setValueString(final String valueString) { mValueString = valueString; } public Path getPath() { return mPath; } public Region getRegion() { return mRegion; } private static int darkenColor(int color) { float[] hsv = new float[3]; Color.colorToHSV(color, hsv); hsv[2] *= 0.8f; return Color.HSVToColor(hsv); } }