Skip to content

Commit

Permalink
gradle: Enable nonFinalResIds flag
Browse files Browse the repository at this point in the history
Signed-off-by: Aayush Gupta <[email protected]>
  • Loading branch information
theimpulson authored and jspricke committed Sep 4, 2024
1 parent 0bb2124 commit 6a17fb0
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 44 deletions.
49 changes: 21 additions & 28 deletions app/src/main/java/com/android/calendar/AllInOneActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -932,34 +932,27 @@ public boolean onOptionsItemSelected(MenuItem item) {
@Override
public boolean onNavigationItemSelected(MenuItem item) {
final int itemId = item.getItemId();
switch (itemId) {
case R.id.day_menu_item:
if (mCurrentView != ViewType.DAY) {
mController.sendEvent(this, EventType.GO_TO, null, null, -1, ViewType.DAY);
}
break;
case R.id.week_menu_item:
if (mCurrentView != ViewType.WEEK) {
mController.sendEvent(this, EventType.GO_TO, null, null, -1, ViewType.WEEK);
}
break;
case R.id.month_menu_item:
if (mCurrentView != ViewType.MONTH) {
mController.sendEvent(this, EventType.GO_TO, null, null, -1, ViewType.MONTH);
}
break;
case R.id.agenda_menu_item:
if (mCurrentView != ViewType.AGENDA) {
mController.sendEvent(this, EventType.GO_TO, null, null, -1, ViewType.AGENDA);
}
break;
case R.id.action_settings:
mController.sendEvent(this, EventType.LAUNCH_SETTINGS, null, null, 0, 0);
break;
case R.id.action_about:
Intent intent = new Intent(this, AboutActivity.class);
startActivity(intent);
break;
if (itemId == R.id.day_menu_item) {
if (mCurrentView != ViewType.DAY) {
mController.sendEvent(this, EventType.GO_TO, null, null, -1, ViewType.DAY);
}
} else if (itemId == R.id.week_menu_item) {
if (mCurrentView != ViewType.WEEK) {
mController.sendEvent(this, EventType.GO_TO, null, null, -1, ViewType.WEEK);
}
} else if (itemId == R.id.month_menu_item) {
if (mCurrentView != ViewType.MONTH) {
mController.sendEvent(this, EventType.GO_TO, null, null, -1, ViewType.MONTH);
}
} else if (itemId == R.id.agenda_menu_item) {
if (mCurrentView != ViewType.AGENDA) {
mController.sendEvent(this, EventType.GO_TO, null, null, -1, ViewType.AGENDA);
}
} else if (itemId == R.id.action_settings) {
mController.sendEvent(this, EventType.LAUNCH_SETTINGS, null, null, 0, 0);
} else if (itemId == R.id.action_about) {
Intent intent = new Intent(this, AboutActivity.class);
startActivity(intent);
}
mDrawerLayout.closeDrawers();
return true;
Expand Down
28 changes: 13 additions & 15 deletions app/src/main/java/com/android/calendar/DynamicTheme.java
Original file line number Diff line number Diff line change
Expand Up @@ -233,22 +233,20 @@ public static int getColorId(String name) {
}

public static String getColorName(int id) {
switch (id) {
case R.color.colorPrimary :
return TEAL;
case R.color.colorBluePrimary:
return BLUE;
case R.color.colorOrangePrimary:
return ORANGE;
case R.color.colorGreenPrimary:
return GREEN;
case R.color.colorRedPrimary:
return RED;
case R.color.colorPurplePrimary:
return PURPLE;
default:
throw new UnsupportedOperationException("Unknown color id : " + id);
if (id == R.color.colorPrimary) {
return TEAL;
} else if (id == R.color.colorBluePrimary) {
return BLUE;
} else if (id == R.color.colorOrangePrimary) {
return ORANGE;
} else if (id == R.color.colorGreenPrimary) {
return GREEN;
} else if (id == R.color.colorRedPrimary) {
return RED;
} else if (id == R.color.colorPurplePrimary) {
return PURPLE;
}
throw new UnsupportedOperationException("Unknown color id : " + id);
}

public static int getColor(Context context, String id) {
Expand Down
1 change: 0 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,3 @@ android.useAndroidX=true
android.enableJetifier=true
# Kotlin code style for this project: "official" or "obsolete":
kotlin.code.style=official
android.nonFinalResIds=false

0 comments on commit 6a17fb0

Please sign in to comment.