Skip to content

Commit 006e225

Browse files
committed
optimize string imports
1 parent c9bcd30 commit 006e225

File tree

4 files changed

+57
-114
lines changed

4 files changed

+57
-114
lines changed
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package org.ebookdroid.common.settings.definitions;
22

3-
import static org.sufficientlysecure.viewer.R.string.*;
3+
import org.sufficientlysecure.viewer.R;
44

55
import org.ebookdroid.common.settings.books.BookBackupType;
66

@@ -12,16 +12,16 @@ public interface BackupPreferences {
1212

1313
/* =============== Backup settings =============== */
1414

15-
BooleanPreferenceDefinition BACKUP_ON_EXIT = new BooleanPreferenceDefinition(pref_backuponexit_id,
16-
pref_backuponexit_defvalue);
15+
BooleanPreferenceDefinition BACKUP_ON_EXIT = new BooleanPreferenceDefinition(R.string.pref_backuponexit_id,
16+
R.string.pref_backuponexit_defvalue);
1717

18-
BooleanPreferenceDefinition BACKUP_ON_BOOK_CLOSE = new BooleanPreferenceDefinition(pref_backuponbookclose_id,
19-
pref_backuponbookclose_defvalue);
18+
BooleanPreferenceDefinition BACKUP_ON_BOOK_CLOSE = new BooleanPreferenceDefinition(R.string.pref_backuponbookclose_id,
19+
R.string.pref_backuponbookclose_defvalue);
2020

2121
IntegerPreferenceDefinition MAX_NUMBER_OF_AUTO_BACKUPS = new IntegerPreferenceDefinition(
22-
pref_maxnumberofautobackups_id, pref_maxnumberofautobackups_defvalue, pref_maxnumberofautobackups_minvalue,
23-
pref_maxnumberofautobackups_maxvalue);
22+
R.string.pref_maxnumberofautobackups_id, R.string.pref_maxnumberofautobackups_defvalue, R.string.pref_maxnumberofautobackups_minvalue,
23+
R.string.pref_maxnumberofautobackups_maxvalue);
2424

2525
EnumPreferenceDefinition<BookBackupType> BOOK_BACKUP_TYPE = new EnumPreferenceDefinition<BookBackupType>(
26-
BookBackupType.class, pref_bookbackuptype_id, pref_bookbackuptype_defvalue);
26+
BookBackupType.class, R.string.pref_bookbackuptype_id, R.string.pref_bookbackuptype_defvalue);
2727
}
Lines changed: 26 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,6 @@
11
package org.ebookdroid.common.settings.definitions;
22

3-
import static org.sufficientlysecure.viewer.R.string.pref_align_by_width;
4-
import static org.sufficientlysecure.viewer.R.string.pref_animation_type_none;
5-
import static org.sufficientlysecure.viewer.R.string.pref_autolevels_defvalue;
6-
import static org.sufficientlysecure.viewer.R.string.pref_book_align_id;
7-
import static org.sufficientlysecure.viewer.R.string.pref_book_animation_type_id;
8-
import static org.sufficientlysecure.viewer.R.string.pref_book_autolevels_id;
9-
import static org.sufficientlysecure.viewer.R.string.pref_book_contrast_id;
10-
import static org.sufficientlysecure.viewer.R.string.pref_book_gamma_id;
11-
import static org.sufficientlysecure.viewer.R.string.pref_book_croppages_id;
12-
import static org.sufficientlysecure.viewer.R.string.pref_book_exposure_id;
13-
import static org.sufficientlysecure.viewer.R.string.pref_book_firstpageoffset_defvalue;
14-
import static org.sufficientlysecure.viewer.R.string.pref_book_firstpageoffset_id;
15-
import static org.sufficientlysecure.viewer.R.string.pref_book_firstpageoffset_maxvalue;
16-
import static org.sufficientlysecure.viewer.R.string.pref_book_firstpageoffset_minvalue;
17-
import static org.sufficientlysecure.viewer.R.string.pref_book_id;
18-
import static org.sufficientlysecure.viewer.R.string.pref_book_nightmode_id;
19-
import static org.sufficientlysecure.viewer.R.string.pref_book_posimages_in_nightmode_id;
20-
import static org.sufficientlysecure.viewer.R.string.pref_book_rotation_id;
21-
import static org.sufficientlysecure.viewer.R.string.pref_book_rtl_id;
22-
import static org.sufficientlysecure.viewer.R.string.pref_book_splitpages_id;
23-
import static org.sufficientlysecure.viewer.R.string.pref_book_splitpages_rtl_id;
24-
import static org.sufficientlysecure.viewer.R.string.pref_book_viewmode_id;
25-
import static org.sufficientlysecure.viewer.R.string.pref_contrast_defvalue;
26-
import static org.sufficientlysecure.viewer.R.string.pref_contrast_maxvalue;
27-
import static org.sufficientlysecure.viewer.R.string.pref_contrast_minvalue;
28-
import static org.sufficientlysecure.viewer.R.string.pref_gamma_defvalue;
29-
import static org.sufficientlysecure.viewer.R.string.pref_gamma_maxvalue;
30-
import static org.sufficientlysecure.viewer.R.string.pref_gamma_minvalue;
31-
import static org.sufficientlysecure.viewer.R.string.pref_croppages_defvalue;
32-
import static org.sufficientlysecure.viewer.R.string.pref_exposure_defvalue;
33-
import static org.sufficientlysecure.viewer.R.string.pref_exposure_maxvalue;
34-
import static org.sufficientlysecure.viewer.R.string.pref_exposure_minvalue;
35-
import static org.sufficientlysecure.viewer.R.string.pref_nightmode_defvalue;
36-
import static org.sufficientlysecure.viewer.R.string.pref_posimages_in_nightmode_defvalue;
37-
import static org.sufficientlysecure.viewer.R.string.pref_rotation_unspecified;
38-
import static org.sufficientlysecure.viewer.R.string.pref_rtl_defvalue;
39-
import static org.sufficientlysecure.viewer.R.string.pref_splitpages_defvalue;
40-
import static org.sufficientlysecure.viewer.R.string.pref_splitpages_rtl_defvalue;
41-
import static org.sufficientlysecure.viewer.R.string.pref_tint_color_defvalue;
42-
import static org.sufficientlysecure.viewer.R.string.pref_book_tint_color_id;
43-
import static org.sufficientlysecure.viewer.R.string.pref_tint_defvalue;
44-
import static org.sufficientlysecure.viewer.R.string.pref_book_tint_id;
45-
import static org.sufficientlysecure.viewer.R.string.pref_viewmode_vertical_scroll;
3+
import org.sufficientlysecure.viewer.R;
464

475
import org.ebookdroid.common.settings.types.DocumentViewMode;
486
import org.ebookdroid.common.settings.types.PageAlign;
@@ -58,50 +16,50 @@ public interface BookPreferences {
5816

5917
/* =============== Book rendering settings =============== */
6018

61-
StringPreferenceDefinition BOOK = new StringPreferenceDefinition(pref_book_id, 0);
19+
StringPreferenceDefinition BOOK = new StringPreferenceDefinition(R.string.pref_book_id, 0);
6220

63-
IntegerPreferenceDefinition BOOK_FIRST_PAGE_OFFSET = new IntegerPreferenceDefinition(pref_book_firstpageoffset_id,
64-
pref_book_firstpageoffset_defvalue, pref_book_firstpageoffset_minvalue, pref_book_firstpageoffset_maxvalue);
21+
IntegerPreferenceDefinition BOOK_FIRST_PAGE_OFFSET = new IntegerPreferenceDefinition(R.string.pref_book_firstpageoffset_id,
22+
R.string.pref_book_firstpageoffset_defvalue, R.string.pref_book_firstpageoffset_minvalue, R.string.pref_book_firstpageoffset_maxvalue);
6523

66-
BooleanPreferenceDefinition BOOK_NIGHT_MODE = new BooleanPreferenceDefinition(pref_book_nightmode_id, pref_nightmode_defvalue);
24+
BooleanPreferenceDefinition BOOK_NIGHT_MODE = new BooleanPreferenceDefinition(R.string.pref_book_nightmode_id, R.string.pref_nightmode_defvalue);
6725

68-
BooleanPreferenceDefinition BOOK_NIGHT_MODE_POS_IMAGES = new BooleanPreferenceDefinition(pref_book_posimages_in_nightmode_id, pref_posimages_in_nightmode_defvalue);
26+
BooleanPreferenceDefinition BOOK_NIGHT_MODE_POS_IMAGES = new BooleanPreferenceDefinition(R.string.pref_book_posimages_in_nightmode_id, R.string.pref_posimages_in_nightmode_defvalue);
6927

70-
BooleanPreferenceDefinition BOOK_TINT = new BooleanPreferenceDefinition(pref_book_tint_id, pref_tint_defvalue);
28+
BooleanPreferenceDefinition BOOK_TINT = new BooleanPreferenceDefinition(R.string.pref_book_tint_id, R.string.pref_tint_defvalue);
7129

72-
IntegerPreferenceDefinition BOOK_TINT_COLOR = new IntegerPreferenceDefinition(pref_book_tint_color_id, pref_tint_color_defvalue);
30+
IntegerPreferenceDefinition BOOK_TINT_COLOR = new IntegerPreferenceDefinition(R.string.pref_book_tint_color_id, R.string.pref_tint_color_defvalue);
7331

74-
IntegerPreferenceDefinition BOOK_CONTRAST = new IntegerPreferenceDefinition(pref_book_contrast_id,
75-
pref_contrast_defvalue, pref_contrast_minvalue, pref_contrast_maxvalue);
32+
IntegerPreferenceDefinition BOOK_CONTRAST = new IntegerPreferenceDefinition(R.string.pref_book_contrast_id,
33+
R.string.pref_contrast_defvalue, R.string.pref_contrast_minvalue, R.string.pref_contrast_maxvalue);
7634

77-
IntegerPreferenceDefinition BOOK_GAMMA = new IntegerPreferenceDefinition(pref_book_gamma_id,
78-
pref_gamma_defvalue, pref_gamma_minvalue, pref_gamma_maxvalue);
35+
IntegerPreferenceDefinition BOOK_GAMMA = new IntegerPreferenceDefinition(R.string.pref_book_gamma_id,
36+
R.string.pref_gamma_defvalue, R.string.pref_gamma_minvalue, R.string.pref_gamma_maxvalue);
7937

80-
IntegerPreferenceDefinition BOOK_EXPOSURE = new IntegerPreferenceDefinition(pref_book_exposure_id,
81-
pref_exposure_defvalue, pref_exposure_minvalue, pref_exposure_maxvalue);
38+
IntegerPreferenceDefinition BOOK_EXPOSURE = new IntegerPreferenceDefinition(R.string.pref_book_exposure_id,
39+
R.string.pref_exposure_defvalue, R.string.pref_exposure_minvalue, R.string.pref_exposure_maxvalue);
8240

83-
BooleanPreferenceDefinition BOOK_AUTO_LEVELS = new BooleanPreferenceDefinition(pref_book_autolevels_id, pref_autolevels_defvalue);
41+
BooleanPreferenceDefinition BOOK_AUTO_LEVELS = new BooleanPreferenceDefinition(R.string.pref_book_autolevels_id, R.string.pref_autolevels_defvalue);
8442

85-
BooleanPreferenceDefinition BOOK_SPLIT_PAGES = new BooleanPreferenceDefinition(pref_book_splitpages_id,
86-
pref_splitpages_defvalue);
43+
BooleanPreferenceDefinition BOOK_SPLIT_PAGES = new BooleanPreferenceDefinition(R.string.pref_book_splitpages_id,
44+
R.string.pref_splitpages_defvalue);
8745

88-
BooleanPreferenceDefinition BOOK_SPLIT_RTL = new BooleanPreferenceDefinition(pref_book_splitpages_rtl_id,
89-
pref_splitpages_rtl_defvalue);
46+
BooleanPreferenceDefinition BOOK_SPLIT_RTL = new BooleanPreferenceDefinition(R.string.pref_book_splitpages_rtl_id,
47+
R.string.pref_splitpages_rtl_defvalue);
9048

91-
BooleanPreferenceDefinition BOOK_CROP_PAGES = new BooleanPreferenceDefinition(pref_book_croppages_id,
92-
pref_croppages_defvalue);
49+
BooleanPreferenceDefinition BOOK_CROP_PAGES = new BooleanPreferenceDefinition(R.string.pref_book_croppages_id,
50+
R.string.pref_croppages_defvalue);
9351

9452
EnumPreferenceDefinition<RotationType> BOOK_ROTATION = new EnumPreferenceDefinition<RotationType>(
95-
RotationType.class, pref_book_rotation_id, pref_rotation_unspecified);
53+
RotationType.class, R.string.pref_book_rotation_id, R.string.pref_rotation_unspecified);
9654

9755
EnumPreferenceDefinition<DocumentViewMode> BOOK_VIEW_MODE = new EnumPreferenceDefinition<DocumentViewMode>(
98-
DocumentViewMode.class, pref_book_viewmode_id, pref_viewmode_vertical_scroll);
56+
DocumentViewMode.class, R.string.pref_book_viewmode_id, R.string.pref_viewmode_vertical_scroll);
9957

10058
EnumPreferenceDefinition<PageAlign> BOOK_PAGE_ALIGN = new EnumPreferenceDefinition<PageAlign>(PageAlign.class,
101-
pref_book_align_id, pref_align_by_width);
59+
R.string.pref_book_align_id, R.string.pref_align_by_width);
10260

10361
EnumPreferenceDefinition<PageAnimationType> BOOK_ANIMATION_TYPE = new EnumPreferenceDefinition<PageAnimationType>(
104-
PageAnimationType.class, pref_book_animation_type_id, pref_animation_type_none);
62+
PageAnimationType.class, R.string.pref_book_animation_type_id, R.string.pref_animation_type_none);
10563

106-
BooleanPreferenceDefinition BOOK_RTL= new BooleanPreferenceDefinition(pref_book_rtl_id, pref_rtl_defvalue);
64+
BooleanPreferenceDefinition BOOK_RTL= new BooleanPreferenceDefinition(R.string.pref_book_rtl_id, R.string.pref_rtl_defvalue);
10765
}
Lines changed: 16 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,6 @@
11
package org.ebookdroid.common.settings.definitions;
22

3-
import static org.sufficientlysecure.viewer.R.string.pref_autoscanremovable_defvalue;
4-
import static org.sufficientlysecure.viewer.R.string.pref_autoscanremovable_id;
5-
import static org.sufficientlysecure.viewer.R.string.pref_brautoscandir_defvalue;
6-
import static org.sufficientlysecure.viewer.R.string.pref_brautoscandir_id;
7-
import static org.sufficientlysecure.viewer.R.string.pref_brfiletypes;
8-
import static org.sufficientlysecure.viewer.R.string.pref_brsearchbookquery_id;
9-
import static org.sufficientlysecure.viewer.R.string.pref_cachelocation_defvalue;
10-
import static org.sufficientlysecure.viewer.R.string.pref_cachelocation_id;
11-
import static org.sufficientlysecure.viewer.R.string.pref_shownotifications_defvalue;
12-
import static org.sufficientlysecure.viewer.R.string.pref_shownotifications_id;
13-
import static org.sufficientlysecure.viewer.R.string.pref_showremovable_defvalue;
14-
import static org.sufficientlysecure.viewer.R.string.pref_showremovable_id;
15-
import static org.sufficientlysecure.viewer.R.string.pref_showscanning_defvalue;
16-
import static org.sufficientlysecure.viewer.R.string.pref_showscanning_id;
17-
import static org.sufficientlysecure.viewer.R.string.pref_usebookcase_defvalue;
18-
import static org.sufficientlysecure.viewer.R.string.pref_usebookcase_id;
3+
import org.sufficientlysecure.viewer.R;
194

205
import org.ebookdroid.common.settings.base.FileTypeFilterPreferenceDefinition;
216
import org.ebookdroid.common.settings.types.CacheLocation;
@@ -29,29 +14,29 @@ public interface LibPreferences {
2914

3015
/* =============== Browser settings =============== */
3116

32-
BooleanPreferenceDefinition USE_BOOK_CASE = new BooleanPreferenceDefinition(pref_usebookcase_id,
33-
pref_usebookcase_defvalue);
17+
BooleanPreferenceDefinition USE_BOOK_CASE = new BooleanPreferenceDefinition(R.string.pref_usebookcase_id,
18+
R.string.pref_usebookcase_defvalue);
3419

35-
FileListPreferenceDefinition AUTO_SCAN_DIRS = new FileListPreferenceDefinition(pref_brautoscandir_id,
36-
pref_brautoscandir_defvalue);
20+
FileListPreferenceDefinition AUTO_SCAN_DIRS = new FileListPreferenceDefinition(R.string.pref_brautoscandir_id,
21+
R.string.pref_brautoscandir_defvalue);
3722

38-
StringPreferenceDefinition SEARCH_BOOK_QUERY = new StringPreferenceDefinition(pref_brsearchbookquery_id, 0);
23+
StringPreferenceDefinition SEARCH_BOOK_QUERY = new StringPreferenceDefinition(R.string.pref_brsearchbookquery_id, 0);
3924

40-
FileTypeFilterPreferenceDefinition FILE_TYPE_FILTER = new FileTypeFilterPreferenceDefinition(pref_brfiletypes);
25+
FileTypeFilterPreferenceDefinition FILE_TYPE_FILTER = new FileTypeFilterPreferenceDefinition(R.string.pref_brfiletypes);
4126

4227
EnumPreferenceDefinition<CacheLocation> CACHE_LOCATION = new EnumPreferenceDefinition<CacheLocation>(
43-
CacheLocation.class, pref_cachelocation_id, pref_cachelocation_defvalue);
28+
CacheLocation.class, R.string.pref_cachelocation_id, R.string.pref_cachelocation_defvalue);
4429

45-
BooleanPreferenceDefinition AUTO_SCAN_REMOVABLE_MEDIA = new BooleanPreferenceDefinition(pref_autoscanremovable_id,
46-
pref_autoscanremovable_defvalue);
30+
BooleanPreferenceDefinition AUTO_SCAN_REMOVABLE_MEDIA = new BooleanPreferenceDefinition(R.string.pref_autoscanremovable_id,
31+
R.string.pref_autoscanremovable_defvalue);
4732

48-
BooleanPreferenceDefinition SHOW_REMOVABLE_MEDIA = new BooleanPreferenceDefinition(pref_showremovable_id,
49-
pref_showremovable_defvalue);
33+
BooleanPreferenceDefinition SHOW_REMOVABLE_MEDIA = new BooleanPreferenceDefinition(R.string.pref_showremovable_id,
34+
R.string.pref_showremovable_defvalue);
5035

51-
BooleanPreferenceDefinition SHOW_SCANNING_MEDIA = new BooleanPreferenceDefinition(pref_showscanning_id,
52-
pref_showscanning_defvalue);
36+
BooleanPreferenceDefinition SHOW_SCANNING_MEDIA = new BooleanPreferenceDefinition(R.string.pref_showscanning_id,
37+
R.string.pref_showscanning_defvalue);
5338

54-
BooleanPreferenceDefinition SHOW_NOTIFICATIONS = new BooleanPreferenceDefinition(pref_shownotifications_id,
55-
pref_shownotifications_defvalue);
39+
BooleanPreferenceDefinition SHOW_NOTIFICATIONS = new BooleanPreferenceDefinition(R.string.pref_shownotifications_id,
40+
R.string.pref_shownotifications_defvalue);
5641

5742
}

document-viewer/src/main/java/org/ebookdroid/common/settings/types/ToastPosition.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package org.ebookdroid.common.settings.types;
22

33
import static android.view.Gravity.*;
4-
import static org.sufficientlysecure.viewer.R.string.*;
4+
import org.sufficientlysecure.viewer.R;
55

66
import org.ebookdroid.EBookDroidApp;
77

@@ -12,27 +12,27 @@ public enum ToastPosition implements ResourceConstant {
1212
/**
1313
*
1414
*/
15-
Invisible(pref_toastposition_invisible, 0),
15+
Invisible(R.string.pref_toastposition_invisible, 0),
1616
/**
1717
*
1818
*/
19-
LeftTop(pref_toastposition_lefttop, LEFT | TOP),
19+
LeftTop(R.string.pref_toastposition_lefttop, LEFT | TOP),
2020
/**
2121
*
2222
*/
23-
RightTop(pref_toastposition_righttop, RIGHT | TOP),
23+
RightTop(R.string.pref_toastposition_righttop, RIGHT | TOP),
2424
/**
2525
*
2626
*/
27-
LeftBottom(pref_toastposition_leftbottom, LEFT | BOTTOM),
27+
LeftBottom(R.string.pref_toastposition_leftbottom, LEFT | BOTTOM),
2828
/**
2929
*
3030
*/
31-
Bottom(pref_toastposition_bottom, CENTER | BOTTOM),
31+
Bottom(R.string.pref_toastposition_bottom, CENTER | BOTTOM),
3232
/**
3333
*
3434
*/
35-
RightBottom(pref_toastposition_righbottom, RIGHT | BOTTOM);
35+
RightBottom(R.string.pref_toastposition_righbottom, RIGHT | BOTTOM);
3636

3737
public final int position;
3838
private final String resValue;

0 commit comments

Comments
 (0)