|
28 | 28 | import android.support.v4.app.Fragment; |
29 | 29 | import android.support.v4.app.ListFragment; |
30 | 30 | import android.support.v4.app.LoaderManager; |
| 31 | +import android.support.v4.content.ContextCompat; |
31 | 32 | import android.support.v4.content.Loader; |
32 | 33 | import android.support.v4.widget.SimpleCursorAdapter; |
33 | 34 | import android.support.v7.app.ActionBar; |
@@ -151,7 +152,8 @@ public boolean onActionItemClicked(ActionMode mode, MenuItem item) { |
151 | 152 |
|
152 | 153 | private void setDefaultStatusBarColor() { |
153 | 154 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { |
154 | | - getActivity().getWindow().setStatusBarColor(getResources().getColor(R.color.theme_primary_dark)); |
| 155 | + getActivity().getWindow().setStatusBarColor( |
| 156 | + ContextCompat.getColor(getContext(), R.color.theme_primary_dark)); |
155 | 157 | } |
156 | 158 | } |
157 | 159 |
|
@@ -211,7 +213,8 @@ public void onActivityCreated(Bundle savedInstanceState) { |
211 | 213 |
|
212 | 214 | setHasOptionsMenu(true); |
213 | 215 | getListView().setChoiceMode(ListView.CHOICE_MODE_MULTIPLE); |
214 | | - ((TextView)getListView().getEmptyView()).setTextColor(getResources().getColor(R.color.theme_accent)); |
| 216 | + ((TextView)getListView().getEmptyView()) |
| 217 | + .setTextColor(ContextCompat.getColor(getContext(), R.color.theme_accent)); |
215 | 218 | if (mActionType == ScheduledAction.ActionType.TRANSACTION){ |
216 | 219 | ((TextView)getListView().getEmptyView()).setText(R.string.label_no_recurring_transactions); |
217 | 220 | } else if (mActionType == ScheduledAction.ActionType.BACKUP){ |
@@ -363,7 +366,8 @@ private void startActionMode(){ |
363 | 366 | mActionMode = ((AppCompatActivity) getActivity()) |
364 | 367 | .startSupportActionMode(mActionModeCallbacks); |
365 | 368 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP){ |
366 | | - getActivity().getWindow().setStatusBarColor(getResources().getColor(android.R.color.darker_gray)); |
| 369 | + getActivity().getWindow().setStatusBarColor( |
| 370 | + ContextCompat.getColor(getContext(), android.R.color.darker_gray)); |
367 | 371 | } |
368 | 372 | } |
369 | 373 |
|
@@ -426,11 +430,12 @@ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { |
426 | 430 |
|
427 | 431 | ListView listView = (ListView) parent; |
428 | 432 | if (mInEditMode && listView.isItemChecked(position)){ |
429 | | - view.setBackgroundColor(getResources().getColor(R.color.abs__holo_blue_light)); |
430 | | - secondaryText.setTextColor(getResources().getColor(android.R.color.white)); |
| 433 | + view.setBackgroundColor(ContextCompat.getColor(getContext(), R.color.abs__holo_blue_light)); |
| 434 | + secondaryText.setTextColor(ContextCompat.getColor(getContext(), android.R.color.white)); |
431 | 435 | } else { |
432 | | - view.setBackgroundColor(getResources().getColor(android.R.color.transparent)); |
433 | | - secondaryText.setTextColor(getResources().getColor(android.R.color.secondary_text_light_nodisable)); |
| 436 | + view.setBackgroundColor(ContextCompat.getColor(getContext(), android.R.color.transparent)); |
| 437 | + secondaryText.setTextColor(ContextCompat.getColor(getContext(), |
| 438 | + android.R.color.secondary_text_light_nodisable)); |
434 | 439 | checkbox.setChecked(false); |
435 | 440 | } |
436 | 441 |
|
@@ -477,7 +482,8 @@ public void bindView(View view, Context context, Cursor cursor) { |
477 | 482 | ScheduledAction scheduledAction = scheduledActionDbAdapter.getRecord(scheduledActionUID); |
478 | 483 | long endTime = scheduledAction.getEndTime(); |
479 | 484 | if (endTime > 0 && endTime < System.currentTimeMillis()){ |
480 | | - ((TextView)view.findViewById(R.id.primary_text)).setTextColor(getResources().getColor(android.R.color.darker_gray)); |
| 485 | + ((TextView)view.findViewById(R.id.primary_text)).setTextColor( |
| 486 | + ContextCompat.getColor(getContext(), android.R.color.darker_gray)); |
481 | 487 | descriptionTextView.setText(getString(R.string.label_scheduled_action_ended, |
482 | 488 | DateFormat.getInstance().format(new Date(scheduledAction.getLastRunTime())))); |
483 | 489 | } else { |
@@ -525,11 +531,12 @@ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { |
525 | 531 |
|
526 | 532 | ListView listView = (ListView) parent; |
527 | 533 | if (mInEditMode && listView.isItemChecked(position)){ |
528 | | - view.setBackgroundColor(getResources().getColor(R.color.abs__holo_blue_light)); |
529 | | - secondaryText.setTextColor(getResources().getColor(android.R.color.white)); |
| 534 | + view.setBackgroundColor(ContextCompat.getColor(getContext(), R.color.abs__holo_blue_light)); |
| 535 | + secondaryText.setTextColor(ContextCompat.getColor(getContext(), android.R.color.white)); |
530 | 536 | } else { |
531 | | - view.setBackgroundColor(getResources().getColor(android.R.color.transparent)); |
532 | | - secondaryText.setTextColor(getResources().getColor(android.R.color.secondary_text_light_nodisable)); |
| 537 | + view.setBackgroundColor(ContextCompat.getColor(getContext(), android.R.color.transparent)); |
| 538 | + secondaryText.setTextColor( |
| 539 | + ContextCompat.getColor(getContext(), android.R.color.secondary_text_light_nodisable)); |
533 | 540 | checkbox.setChecked(false); |
534 | 541 | } |
535 | 542 |
|
@@ -576,7 +583,8 @@ public void bindView(View view, Context context, Cursor cursor) { |
576 | 583 | descriptionTextView.setText(scheduledAction.getRepeatString()); |
577 | 584 | long endTime = scheduledAction.getEndTime(); |
578 | 585 | if (endTime > 0 && endTime < System.currentTimeMillis()){ |
579 | | - ((TextView)view.findViewById(R.id.primary_text)).setTextColor(getResources().getColor(android.R.color.darker_gray)); |
| 586 | + ((TextView)view.findViewById(R.id.primary_text)) |
| 587 | + .setTextColor(ContextCompat.getColor(getContext(), android.R.color.darker_gray)); |
580 | 588 | descriptionTextView.setText(getString(R.string.label_scheduled_action_ended, |
581 | 589 | DateFormat.getInstance().format(new Date(scheduledAction.getLastRunTime())))); |
582 | 590 | } else { |
|
0 commit comments