Skip to content

Commit 4360c1b

Browse files
author
Yevhen Babiichuk (DustDFG)
committed
Use context.getString() shorthand instead of context.getResources().getString()
1 parent 8e32e7a commit 4360c1b

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
@@ -194,9 +194,9 @@ public static String localizeStreamCount(@NonNull final Context context,
194194
case (int) ListExtractor.ITEM_COUNT_UNKNOWN:
195195
return "";
196196
case (int) ListExtractor.ITEM_COUNT_INFINITE:
197-
return context.getResources().getString(R.string.infinite_videos);
197+
return context.getString(R.string.infinite_videos);
198198
case (int) ListExtractor.ITEM_COUNT_MORE_THAN_100:
199-
return context.getResources().getString(R.string.more_than_100_videos);
199+
return context.getString(R.string.more_than_100_videos);
200200
default:
201201
return getQuantity(context, R.plurals.videos, R.string.no_videos, streamCount,
202202
localizeNumber(streamCount));
@@ -209,9 +209,9 @@ public static String localizeStreamCountMini(@NonNull final Context context,
209209
case (int) ListExtractor.ITEM_COUNT_UNKNOWN:
210210
return "";
211211
case (int) ListExtractor.ITEM_COUNT_INFINITE:
212-
return context.getResources().getString(R.string.infinite_videos_mini);
212+
return context.getString(R.string.infinite_videos_mini);
213213
case (int) ListExtractor.ITEM_COUNT_MORE_THAN_100:
214-
return context.getResources().getString(R.string.more_than_100_videos_mini);
214+
return context.getString(R.string.more_than_100_videos_mini);
215215
default:
216216
return String.valueOf(streamCount);
217217
}

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)