Skip to content

Commit c2f526d

Browse files
Yevhen Babiichuk (DustDFG)TobiGr
authored andcommitted
Use context.getString() shorthand instead of context.getResources().getString()
Cherry-picked from #12949 / 4360c1b
1 parent c3c353f commit c2f526d

3 files changed

Lines changed: 8 additions & 8 deletions

File tree

app/src/main/java/org/schabi/newpipe/player/helper/PlayerHelper.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,11 +141,11 @@ public static String resizeTypeOf(@NonNull final Context context,
141141
@ResizeMode final int resizeMode) {
142142
switch (resizeMode) {
143143
case AspectRatioFrameLayout.RESIZE_MODE_FIT:
144-
return context.getResources().getString(R.string.resize_fit);
144+
return context.getString(R.string.resize_fit);
145145
case AspectRatioFrameLayout.RESIZE_MODE_FILL:
146-
return context.getResources().getString(R.string.resize_fill);
146+
return context.getString(R.string.resize_fill);
147147
case AspectRatioFrameLayout.RESIZE_MODE_ZOOM:
148-
return context.getResources().getString(R.string.resize_zoom);
148+
return context.getString(R.string.resize_zoom);
149149
case AspectRatioFrameLayout.RESIZE_MODE_FIXED_HEIGHT:
150150
case AspectRatioFrameLayout.RESIZE_MODE_FIXED_WIDTH:
151151
default:

app/src/main/java/org/schabi/newpipe/util/Localization.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,9 @@ public static String localizeStreamCount(@NonNull final Context context,
153153
case (int) ListExtractor.ITEM_COUNT_UNKNOWN:
154154
return "";
155155
case (int) ListExtractor.ITEM_COUNT_INFINITE:
156-
return context.getResources().getString(R.string.infinite_videos);
156+
return context.getString(R.string.infinite_videos);
157157
case (int) ListExtractor.ITEM_COUNT_MORE_THAN_100:
158-
return context.getResources().getString(R.string.more_than_100_videos);
158+
return context.getString(R.string.more_than_100_videos);
159159
default:
160160
return getQuantity(context, R.plurals.videos, R.string.no_videos, streamCount,
161161
localizeNumber(streamCount));
@@ -168,9 +168,9 @@ public static String localizeStreamCountMini(@NonNull final Context context,
168168
case (int) ListExtractor.ITEM_COUNT_UNKNOWN:
169169
return "";
170170
case (int) ListExtractor.ITEM_COUNT_INFINITE:
171-
return context.getResources().getString(R.string.infinite_videos_mini);
171+
return context.getString(R.string.infinite_videos_mini);
172172
case (int) ListExtractor.ITEM_COUNT_MORE_THAN_100:
173-
return context.getResources().getString(R.string.more_than_100_videos_mini);
173+
return context.getString(R.string.more_than_100_videos_mini);
174174
default:
175175
return String.valueOf(streamCount);
176176
}

app/src/main/java/org/schabi/newpipe/util/ThemeHelper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ public static int getAndroidDimenPx(@NonNull final Context context, final String
263263

264264
private static String getSelectedThemeKey(final Context context) {
265265
final String themeKey = context.getString(R.string.theme_key);
266-
final String defaultTheme = context.getResources().getString(R.string.default_theme_value);
266+
final String defaultTheme = context.getString(R.string.default_theme_value);
267267
return PreferenceManager.getDefaultSharedPreferences(context)
268268
.getString(themeKey, defaultTheme);
269269
}

0 commit comments

Comments
 (0)