Merge pull request #285 from dlew/dlew/constants-correctness

Corrected constants w/ proper Java conventions
This commit is contained in:
Phillip Thelen 2015-12-16 15:08:26 +01:00
commit 45ef16b82f
9 changed files with 36 additions and 36 deletions

View file

@ -23,7 +23,7 @@ import java.util.Set;
public class HabiticaPurchaseVerifier extends BasePurchaseVerifier {
private Set<String> purchasedOrderList = new HashSet<>();
static String PURCHASED_PRODUCTS_KEY = "PURCHASED_PRODUCTS";
private static final String PURCHASED_PRODUCTS_KEY = "PURCHASED_PRODUCTS";
private SharedPreferences preferences;
public HabiticaPurchaseVerifier(Context context) {

View file

@ -42,9 +42,9 @@ import de.greenrobot.event.EventBus;
* Created by Negue on 20.08.2015.
*/
public class ChatRecyclerViewAdapter extends RecyclerView.Adapter<ChatRecyclerViewAdapter.ChatRecyclerViewHolder> {
static final int TYPE_DANIEL = 0;
static final int TYPE_NEW_MESSAGE = 1;
static final int TYPE_MESSAGE = 2;
private static final int TYPE_DANIEL = 0;
private static final int TYPE_NEW_MESSAGE = 1;
private static final int TYPE_MESSAGE = 2;
private List<ChatMessage> messages;
private Context viewContext;

View file

@ -71,8 +71,8 @@ public class HabitItemRecyclerViewAdapter<THabitItem extends Task>
Context context;
public int dailyResetOffset;
static final int TYPE_HEADER = 0;
static final int TYPE_CELL = 1;
private static final int TYPE_HEADER = 0;
private static final int TYPE_CELL = 1;
private RecyclerView.Adapter<ViewHolder> parentAdapter;
private TagsHelper tagsHelper;
private IAdditionalEntries additionalEntries;

View file

@ -30,7 +30,7 @@ public class SkillTasksRecyclerViewAdapter extends RecyclerView.Adapter<SkillTas
private ObservableArrayList<Task> observableContent;
SkillTasksActivity activity;
static final int TYPE_CELL = 1;
private static final int TYPE_CELL = 1;
private RecyclerView.Adapter<ViewHolder> parentAdapter;
public SkillTasksRecyclerViewAdapter(String taskType, SkillTasksActivity activity) {

View file

@ -30,7 +30,7 @@ import io.fabric.sdk.android.Fabric;
*/
public class GemsPurchaseFragment extends BaseFragment {
static final int GEMS_TO_ADD = 21;
private static final int GEMS_TO_ADD = 21;
private BillingRequests billingRequests;

View file

@ -71,8 +71,8 @@ import retrofit.client.Response;
public class TasksFragment extends BaseFragment implements OnCheckedChangeListener {
static final int TASK_CREATED_RESULT = 1;
static final int TASK_UPDATED_RESULT = 2;
private static final int TASK_CREATED_RESULT = 1;
private static final int TASK_UPDATED_RESULT = 2;
public ViewPager viewPager;
Drawer filterDrawer;

View file

@ -22,10 +22,10 @@ import java.util.concurrent.atomic.AtomicInteger;
public class UserPicture {
static Integer width = 140;
static Integer height = 147;
static Integer compactWidth = 103;
static Integer compactHeight = 90;
private static final int WIDTH = 140;
private static final int HEIGHT = 147;
private static final int COMPACT_WIDTH = 103;
private static final int COMPACT_HEIGHT = 90;
private HabitRPGUser user;
private ImageView imageView;
@ -63,7 +63,7 @@ public class UserPicture {
BitmapFactory.Options o = new BitmapFactory.Options();
o.inScaled = false;
Bitmap res = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
Bitmap res = Bitmap.createBitmap(WIDTH, HEIGHT, Bitmap.Config.ARGB_8888);
Canvas myCanvas = new Canvas(res);
Integer layerNumber = 0;
for (Object layer : this.layers) {
@ -74,7 +74,7 @@ public class UserPicture {
layerNumber++;
}
if (!this.hasPetMount) {
res = Bitmap.createBitmap(res, 25, 18, compactWidth, compactHeight);
res = Bitmap.createBitmap(res, 25, 18, COMPACT_WIDTH, COMPACT_HEIGHT);
}
BitmapUtils.saveToFile(currentCacheFileName, res);
if (this.imageView != null) {

View file

@ -11,20 +11,20 @@ import java.util.HashMap;
*/
public class ChatMessage {
static HashMap<Integer, Integer> contributorColorDict;
private static final HashMap<Integer, Integer> CONTRIBUTOR_COLOR_DICT;
static {
contributorColorDict = new HashMap<>();
contributorColorDict.put(0, R.color.contributor_0);
contributorColorDict.put(1, R.color.contributor_1);
contributorColorDict.put(2, R.color.contributor_2);
contributorColorDict.put(3, R.color.contributor_3);
contributorColorDict.put(4, R.color.contributor_4);
contributorColorDict.put(5, R.color.contributor_5);
contributorColorDict.put(6, R.color.contributor_6);
contributorColorDict.put(7, R.color.contributor_7);
contributorColorDict.put(8, R.color.contributor_mod);
contributorColorDict.put(9, R.color.contributor_staff);
CONTRIBUTOR_COLOR_DICT = new HashMap<>();
CONTRIBUTOR_COLOR_DICT.put(0, R.color.contributor_0);
CONTRIBUTOR_COLOR_DICT.put(1, R.color.contributor_1);
CONTRIBUTOR_COLOR_DICT.put(2, R.color.contributor_2);
CONTRIBUTOR_COLOR_DICT.put(3, R.color.contributor_3);
CONTRIBUTOR_COLOR_DICT.put(4, R.color.contributor_4);
CONTRIBUTOR_COLOR_DICT.put(5, R.color.contributor_5);
CONTRIBUTOR_COLOR_DICT.put(6, R.color.contributor_6);
CONTRIBUTOR_COLOR_DICT.put(7, R.color.contributor_7);
CONTRIBUTOR_COLOR_DICT.put(8, R.color.contributor_mod);
CONTRIBUTOR_COLOR_DICT.put(9, R.color.contributor_staff);
}
@ -51,8 +51,8 @@ public class ChatMessage {
if (contributor != null) {
if (contributorColorDict.containsKey(contributor.level)) {
rColor = contributorColorDict.get(contributor.level);
if (CONTRIBUTOR_COLOR_DICT.containsKey(contributor.level)) {
rColor = CONTRIBUTOR_COLOR_DICT.get(contributor.level);
}
}

View file

@ -27,12 +27,12 @@ import java.util.concurrent.TimeUnit;
@ModelContainer
@Table(databaseName = HabitDatabase.NAME)
public class Task extends BaseModel {
public static String TYPE_HABIT = "habit";
public static String TYPE_TODO = "todo";
public static String TYPE_DAILY = "daily";
public static String TYPE_REWARD = "reward";
public static String FREQUENCY_WEEKLY = "weekly";
public static String FREQUENCY_DAILY = "daily";
public static final String TYPE_HABIT = "habit";
public static final String TYPE_TODO = "todo";
public static final String TYPE_DAILY = "daily";
public static final String TYPE_REWARD = "reward";
public static final String FREQUENCY_WEEKLY = "weekly";
public static final String FREQUENCY_DAILY = "daily";
@Column