You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tasks/app/src/main/java/org/tasks/themes/WidgetTheme.java

92 lines
2.1 KiB
Java

package org.tasks.themes;
import android.os.Parcel;
import android.os.Parcelable;
import org.tasks.R;
import org.tasks.dialogs.ColorPalettePicker.Pickable;
public class WidgetTheme implements Pickable {
static final int[] BACKGROUNDS =
new int[] {R.color.grey_50, R.color.widget_background_black, R.color.md_background_dark};
public static final Parcelable.Creator<WidgetTheme> CREATOR =
new Parcelable.Creator<WidgetTheme>() {
@Override
public WidgetTheme createFromParcel(Parcel source) {
return new WidgetTheme(source);
}
@Override
public WidgetTheme[] newArray(int size) {
return new WidgetTheme[size];
}
};
private final String name;
private final int index;
private final int backgroundColor;
private final int textColorPrimary;
private final int textColorSecondary;
public WidgetTheme(
String name, int index, int backgroundColor, int textColorPrimary, int textColorSecondary) {
this.name = name;
this.index = index;
this.backgroundColor = backgroundColor;
this.textColorPrimary = textColorPrimary;
this.textColorSecondary = textColorSecondary;
}
private WidgetTheme(Parcel source) {
name = source.readString();
index = source.readInt();
backgroundColor = source.readInt();
textColorPrimary = source.readInt();
textColorSecondary = source.readInt();
}
public int getBackgroundColor() {
return backgroundColor;
}
public int getTextColorPrimary() {
return textColorPrimary;
}
public int getTextColorSecondary() {
return textColorSecondary;
}
public String getName() {
return name;
}
@Override
public int getPickerColor() {
return backgroundColor;
}
@Override
public boolean isFree() {
return index < 2;
}
@Override
public int getIndex() {
return index;
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(name);
dest.writeInt(index);
dest.writeInt(backgroundColor);
dest.writeInt(textColorPrimary);
dest.writeInt(textColorSecondary);
}
}