Reorganize strings. Close reader activity when page list throws an exception and notify it.
This commit is contained in:
parent
75236559ca
commit
e177edfee6
9 changed files with 74 additions and 72 deletions
|
@ -15,7 +15,6 @@
|
|||
android:theme="@style/AppTheme" >
|
||||
<activity
|
||||
android:name=".ui.main.MainActivity"
|
||||
android:label="@string/label_main"
|
||||
android:launchMode="singleTop"
|
||||
android:theme="@style/AppTheme.NoActionBar" >
|
||||
<intent-filter>
|
||||
|
@ -26,21 +25,18 @@
|
|||
</activity>
|
||||
<activity
|
||||
android:name=".ui.manga.MangaActivity"
|
||||
android:label="@string/title_activity_manga_detail"
|
||||
android:parentActivityName=".ui.main.MainActivity" >
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".ui.reader.ReaderActivity"
|
||||
android:label="@string/title_activity_viewer"
|
||||
android:parentActivityName=".ui.manga.MangaActivity"
|
||||
android:theme="@style/AppTheme" >
|
||||
android:parentActivityName=".ui.manga.MangaActivity" >
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".ui.manga.MangaActivity" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".ui.setting.SettingsActivity"
|
||||
android:label="@string/title_activity_settings"
|
||||
android:label="@string/label_settings"
|
||||
android:parentActivityName=".ui.main.MainActivity" >
|
||||
</activity>
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ public class SourceFragment extends BaseRxFragment<SourcePresenter> {
|
|||
View view = inflater.inflate(R.layout.fragment_source, container, false);
|
||||
ButterKnife.bind(this, view);
|
||||
|
||||
setToolbarTitle(R.string.catalogues_title);
|
||||
setToolbarTitle(R.string.label_catalogues);
|
||||
|
||||
createAdapter();
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ public class DownloadFragment extends BaseRxFragment<DownloadPresenter> {
|
|||
View view = inflater.inflate(R.layout.fragment_download_queue, container, false);
|
||||
ButterKnife.bind(this, view);
|
||||
|
||||
setToolbarTitle(R.string.download_title);
|
||||
setToolbarTitle(R.string.label_download_queue);
|
||||
|
||||
downloadListLayout = new LinearLayoutManager(getActivity());
|
||||
downloadList.setLayoutManager(downloadListLayout);
|
||||
|
|
|
@ -48,7 +48,7 @@ public class LibraryFragment extends BaseRxFragment<LibraryPresenter> {
|
|||
Bundle savedInstanceState) {
|
||||
// Inflate the layout for this fragment
|
||||
View view = inflater.inflate(R.layout.fragment_library, container, false);
|
||||
setToolbarTitle(getString(R.string.library_title));
|
||||
setToolbarTitle(getString(R.string.label_library));
|
||||
ButterKnife.bind(this, view);
|
||||
|
||||
createAdapter();
|
||||
|
|
|
@ -30,6 +30,8 @@ public class MainActivity extends BaseActivity {
|
|||
|
||||
private Drawer drawer;
|
||||
|
||||
private final static String SELECTED_ITEM = "selected_item";
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
@ -45,19 +47,19 @@ public class MainActivity extends BaseActivity {
|
|||
.withActionBarDrawerToggleAnimated(true)
|
||||
.addDrawerItems(
|
||||
new PrimaryDrawerItem()
|
||||
.withName(R.string.library_title)
|
||||
.withName(R.string.label_library)
|
||||
.withIdentifier(R.id.nav_drawer_library),
|
||||
// new PrimaryDrawerItem()
|
||||
// .withName(R.string.recent_updates_title)
|
||||
// .withIdentifier(R.id.nav_drawer_recent_updates),
|
||||
new PrimaryDrawerItem()
|
||||
.withName(R.string.catalogues_title)
|
||||
.withName(R.string.label_catalogues)
|
||||
.withIdentifier(R.id.nav_drawer_catalogues),
|
||||
new PrimaryDrawerItem()
|
||||
.withName(R.string.download_title)
|
||||
.withName(R.string.label_download_queue)
|
||||
.withIdentifier(R.id.nav_drawer_downloads),
|
||||
new PrimaryDrawerItem()
|
||||
.withName(R.string.settings_title)
|
||||
.withName(R.string.label_settings)
|
||||
.withIdentifier(R.id.nav_drawer_settings)
|
||||
.withSelectable(false)
|
||||
)
|
||||
|
@ -90,6 +92,14 @@ public class MainActivity extends BaseActivity {
|
|||
|
||||
if (savedInstanceState == null)
|
||||
drawer.setSelection(R.id.nav_drawer_library);
|
||||
else
|
||||
drawer.setSelection(savedInstanceState.getInt(SELECTED_ITEM), false);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onSaveInstanceState(Bundle outState) {
|
||||
outState.putInt(SELECTED_ITEM, drawer.getCurrentSelection());
|
||||
super.onSaveInstanceState(outState);
|
||||
}
|
||||
|
||||
public void setFragment(Fragment fragment) {
|
||||
|
|
|
@ -26,6 +26,7 @@ import eu.kanade.mangafeed.ui.reader.viewer.horizontal.LeftToRightReader;
|
|||
import eu.kanade.mangafeed.ui.reader.viewer.horizontal.RightToLeftReader;
|
||||
import eu.kanade.mangafeed.ui.reader.viewer.vertical.VerticalReader;
|
||||
import eu.kanade.mangafeed.ui.reader.viewer.webtoon.WebtoonReader;
|
||||
import eu.kanade.mangafeed.util.ToastUtil;
|
||||
import nucleus.factory.RequiresPresenter;
|
||||
|
||||
@RequiresPresenter(ReaderPresenter.class)
|
||||
|
@ -72,6 +73,11 @@ public class ReaderActivity extends BaseRxActivity<ReaderPresenter> {
|
|||
viewer.updatePageNumber();
|
||||
}
|
||||
|
||||
public void onPageListError() {
|
||||
finish();
|
||||
ToastUtil.showShort(this, R.string.page_list_error);
|
||||
}
|
||||
|
||||
public void onPageChanged(int currentPageIndex, int totalPages) {
|
||||
String page = (currentPageIndex + 1) + "/" + totalPages;
|
||||
pageNumber.setText(page);
|
||||
|
|
|
@ -70,7 +70,9 @@ public class ReaderPresenter extends BasePresenter<ReaderActivity> {
|
|||
if (currentPage != 0)
|
||||
view.setSelectedPage(currentPage);
|
||||
},
|
||||
(view, error) -> Timber.e("An error occurred while downloading page list"));
|
||||
(view, error) -> {
|
||||
view.onPageListError();
|
||||
});
|
||||
|
||||
restartableReplay(GET_PAGE_IMAGES,
|
||||
this::getPageImagesObservable,
|
||||
|
@ -133,9 +135,11 @@ public class ReaderPresenter extends BasePresenter<ReaderActivity> {
|
|||
}
|
||||
|
||||
private void onChapterChange() {
|
||||
if (!isDownloaded)
|
||||
source.savePageList(chapter.url, pageList);
|
||||
saveChapterProgress();
|
||||
if (pageList != null) {
|
||||
if (!isDownloaded)
|
||||
source.savePageList(chapter.url, pageList);
|
||||
saveChapterProgress();
|
||||
}
|
||||
}
|
||||
|
||||
private Observable<List<Page>> getPageListObservable() {
|
||||
|
|
|
@ -28,7 +28,7 @@ public class SettingsMainFragment extends PreferenceFragment {
|
|||
public void onResume() {
|
||||
super.onResume();
|
||||
((BaseActivity)getActivity())
|
||||
.setToolbarTitle(getString(R.string.settings_title));
|
||||
.setToolbarTitle(getString(R.string.label_settings));
|
||||
}
|
||||
|
||||
private void registerSubpreference(int preferenceResource, PreferenceFragment fragment) {
|
||||
|
|
|
@ -1,69 +1,44 @@
|
|||
<resources>
|
||||
<string name="app_name">Mangafeed</string>
|
||||
|
||||
<!-- Activity labels -->
|
||||
<string name="label_main">Mangafeed</string>
|
||||
<!-- Activities and fragments labels (toolbar title) -->
|
||||
<string name="label_settings">Settings</string>
|
||||
<string name="label_download_queue">Download queue</string>
|
||||
<string name="label_library">My library</string>
|
||||
<string name="label_recent_updates">Recent updates</string>
|
||||
<string name="label_catalogues">Catalogues</string>
|
||||
|
||||
<!-- Main Activity -->
|
||||
|
||||
<string name="action_github">View on GitHub</string>
|
||||
|
||||
<string name="text_no_data">No data to display</string>
|
||||
|
||||
<!-- Dialogs -->
|
||||
|
||||
<string name="dialog_action_ok">OK</string>
|
||||
<string name="dialog_action_delete">Delete</string>
|
||||
<string name="dialog_action_cancel">Cancel</string>
|
||||
|
||||
<string name="dialog_error_title">Oops</string>
|
||||
<string name="dialog_general_error_Message">There was an error making the request</string>
|
||||
<string name="dialog_error_no_connection">Sorry, you need a connection to do that!</string>
|
||||
|
||||
<!-- Arrays -->
|
||||
|
||||
<string name="library_title">My library</string>
|
||||
<string name="recent_updates_title">Recent updates</string>
|
||||
<string name="catalogues_title">Catalogues</string>
|
||||
<string name="settings_title">Settings</string>
|
||||
<string name="title_activity_manga_detail">MangaDetailActivity</string>
|
||||
|
||||
<string name="hello_world">Hello world!</string>
|
||||
<!-- Actions -->
|
||||
<string name="action_settings">Settings</string>
|
||||
<string name="action_search">Search</string>
|
||||
<string name="action_refresh">Refresh</string>
|
||||
<string name="library_search_hint">Title or author…</string>
|
||||
<string name="action_select_all">Select all</string>
|
||||
<string name="action_mark_as_read">Mark as read</string>
|
||||
<string name="action_mark_as_unread">Mark as unread</string>
|
||||
<string name="action_download">Download</string>
|
||||
<string name="action_delete">Delete</string>
|
||||
<string name="library_selection_title">Selected</string>
|
||||
<string name="title_activity_catalogue_list">CatalogueList</string>
|
||||
<string name="title_activity_manga_catalogue">MangaCatalogue</string>
|
||||
<string name="author">Author</string>
|
||||
<string name="chapters">Chapters</string>
|
||||
<string name="genres">Genres</string>
|
||||
<string name="artist">Artist</string>
|
||||
<string name="status">Status</string>
|
||||
<string name="description">Description</string>
|
||||
<string name="manga_detail_tab">Info</string>
|
||||
<string name="manga_chapters_tab">Chapters</string>
|
||||
<string name="title_activity_viewer">ViewerActivity</string>
|
||||
<string name="action_favorite">Add to favorites</string>
|
||||
<string name="action_remove_favorite">Remove from favorites</string>
|
||||
|
||||
<!-- Preferences -->
|
||||
|
||||
<string name="title_activity_settings">Settings</string>
|
||||
<!-- Subsections -->
|
||||
<string name="pref_category_reader">Reader</string>
|
||||
<string name="pref_category_accounts">Accounts</string>
|
||||
<string name="pref_category_downloads">Downloads</string>
|
||||
|
||||
<!-- Reader section -->
|
||||
<string name="pref_fullscreen_mode">Read in fullscreen</string>
|
||||
|
||||
<string name="pref_viewer_type">Default viewer</string>
|
||||
<string name="left_to_right_viewer">Left to right</string>
|
||||
<string name="right_to_left_viewer">Right to left</string>
|
||||
<string name="vertical_viewer">Vertical</string>
|
||||
<string name="webtoon_viewer">Webtoon (experimental)</string>
|
||||
|
||||
<!-- Downloads section -->
|
||||
<string name="pref_download_directory">Downloads directory</string>
|
||||
<string name="pref_download_threads">Download threads</string>
|
||||
|
||||
<!-- Login dialog -->
|
||||
<string name="accounts_login_title">Login for %1$s</string>
|
||||
<string name="username">Username</string>
|
||||
<string name="password">Password</string>
|
||||
|
@ -75,25 +50,36 @@
|
|||
<string name="loading">Loading…</string>
|
||||
<string name="unknown_error">Unknown error</string>
|
||||
|
||||
<!-- Library fragment -->
|
||||
<string name="library_search_hint">Title or author…</string>
|
||||
<string name="library_selection_title">Selected</string>
|
||||
|
||||
<string name="action_favorite">Add to favorites</string>
|
||||
<string name="action_remove_favorite">Remove from favorites</string>
|
||||
<!-- Catalogue fragment -->
|
||||
<string name="source_requires_login">This source requires login</string>
|
||||
|
||||
<!-- Manga info fragment -->
|
||||
<string name="manga_detail_tab">Info</string>
|
||||
<string name="author">Author</string>
|
||||
<string name="chapters">Chapters</string>
|
||||
<string name="genres">Genres</string>
|
||||
<string name="artist">Artist</string>
|
||||
<string name="status">Status</string>
|
||||
<string name="description">Description</string>
|
||||
|
||||
<!-- Manga chapters fragment -->
|
||||
<string name="manga_chapters_tab">Chapters</string>
|
||||
<string name="selected_chapters_title">Selected chapters: %1$d</string>
|
||||
|
||||
<!-- Reader activity -->
|
||||
<string name="downloading">Downloading…</string>
|
||||
<string name="download_progress">Downloaded %1$d%%</string>
|
||||
<string name="chapter_progress">Page: %1$d</string>
|
||||
<string name="source_requires_login">This source requires login</string>
|
||||
|
||||
<string name="action_select_all">Select all</string>
|
||||
<string name="action_mark_as_read">Mark as read</string>
|
||||
<string name="action_mark_as_unread">Mark as unread</string>
|
||||
<string name="action_download">Download</string>
|
||||
<string name="selected_chapters_title">Selected chapters: %1$d</string>
|
||||
<string name="page_list_error">Error fetching page list. Is network available?</string>
|
||||
|
||||
<!-- Library update service notifications -->
|
||||
<string name="notification_progress">Update progress: %1$d/%2$d</string>
|
||||
<string name="notification_completed">Update completed</string>
|
||||
<string name="notification_no_new_chapters">No new chapters found</string>
|
||||
<string name="notification_new_chapters">Found new chapters for:</string>
|
||||
<string name="pref_download_threads">Download threads</string>
|
||||
<string name="download_title">Download queue</string>
|
||||
|
||||
</resources>
|
||||
|
|
Reference in a new issue