From 9863086d639045af2b819d4e4ba810dcbfca6985 Mon Sep 17 00:00:00 2001 From: onlymash Date: Sat, 24 Mar 2018 19:41:16 +0800 Subject: [PATCH 1/6] use SAF eport data in Kikat or later --- .../main/java/com/hippo/ehviewer/EhDB.java | 39 +++++++++++++++ .../ui/fragment/AdvancedFragment.java | 50 ++++++++++++++++--- 2 files changed, 82 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/com/hippo/ehviewer/EhDB.java b/app/src/main/java/com/hippo/ehviewer/EhDB.java index f9ea510d2..02d04672d 100644 --- a/app/src/main/java/com/hippo/ehviewer/EhDB.java +++ b/app/src/main/java/com/hippo/ehviewer/EhDB.java @@ -16,10 +16,14 @@ package com.hippo.ehviewer; +import android.content.ContentResolver; import android.content.Context; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; +import android.net.Uri; +import android.os.Build; +import android.provider.DocumentsContract; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.util.Log; @@ -51,6 +55,7 @@ import java.io.File; import java.io.FileInputStream; +import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; @@ -650,6 +655,40 @@ public static synchronized boolean exportDB(Context context, File file) { return false; } + public static synchronized boolean exportDB(Context context, Uri uri) { + File dbFile = context.getDatabasePath("eh.db"); + if (null == dbFile || !dbFile.isFile()) { + return false; + } + if (null == uri) { + return false; + } + InputStream is = null; + OutputStream os = null; + ContentResolver resolver = context.getContentResolver(); + try { + is = new FileInputStream(dbFile); + os = resolver.openOutputStream(uri); + IOUtils.copy(is, os); + return true; + } catch (IOException e) { + e.printStackTrace(); + } finally { + IOUtils.closeQuietly(is); + IOUtils.closeQuietly(os); + } + // Delete failed file + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { + try { + DocumentsContract.deleteDocument(resolver, uri); + } catch (FileNotFoundException e) { + e.printStackTrace(); + } + } + + return false; + } + /** * @param file The db file * @return error string, null for no error diff --git a/app/src/main/java/com/hippo/ehviewer/ui/fragment/AdvancedFragment.java b/app/src/main/java/com/hippo/ehviewer/ui/fragment/AdvancedFragment.java index 655e398b5..ebe4b5d7e 100644 --- a/app/src/main/java/com/hippo/ehviewer/ui/fragment/AdvancedFragment.java +++ b/app/src/main/java/com/hippo/ehviewer/ui/fragment/AdvancedFragment.java @@ -20,7 +20,10 @@ import android.app.AlertDialog; import android.content.Context; import android.content.DialogInterface; +import android.content.Intent; import android.content.res.Resources; +import android.net.Uri; +import android.os.Build; import android.os.Bundle; import android.preference.Preference; import android.preference.PreferenceFragment; @@ -45,6 +48,8 @@ public class AdvancedFragment extends PreferenceFragment private static final String KEY_EXPORT_DATA = "export_data"; private static final String KEY_IMPORT_DATA = "import_data"; + private static final int WRITE_REQUEST_CODE = 43; + @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -91,13 +96,20 @@ public boolean onPreferenceClick(Preference preference) { ((EhApplication) getActivity().getApplication()).clearMemoryCache(); Runtime.getRuntime().gc(); } else if (KEY_EXPORT_DATA.equals(key)) { - File dir = AppConfig.getExternalDataDir(); - if (dir != null) { - File file = new File(dir, ReadableTime.getFilenamableTime(System.currentTimeMillis()) + ".db"); - if (EhDB.exportDB(getActivity(), file)) { - Toast.makeText(getActivity(), - getString(R.string.settings_advanced_export_data_to, file.getPath()), Toast.LENGTH_SHORT).show(); - return true; + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT){ + String filename = ReadableTime.getFilenamableTime(System.currentTimeMillis()) + ".db"; + exportData("*/*", filename); + return true; + + }else { + File dir = AppConfig.getExternalDataDir(); + if (dir != null) { + File file = new File(dir, ReadableTime.getFilenamableTime(System.currentTimeMillis()) + ".db"); + if (EhDB.exportDB(getActivity(), file)) { + Toast.makeText(getActivity(), + getString(R.string.settings_advanced_export_data_to, file.getPath()), Toast.LENGTH_SHORT).show(); + return true; + } } } Toast.makeText(getActivity(),R.string.settings_advanced_export_data_failed, Toast.LENGTH_SHORT).show(); @@ -110,6 +122,30 @@ public boolean onPreferenceClick(Preference preference) { return false; } + private void exportData(String mimeType, String fileName){ + Intent intent = new Intent(Intent.ACTION_CREATE_DOCUMENT); + intent.addCategory(Intent.CATEGORY_OPENABLE); + intent.setType(mimeType); + intent.putExtra(Intent.EXTRA_TITLE, fileName); + startActivityForResult(intent, WRITE_REQUEST_CODE); + + } + + @Override + public void onActivityResult(int requestCode, int resultCode, Intent resultData) { + + if (requestCode == WRITE_REQUEST_CODE && resultCode == Activity.RESULT_OK) { + Uri uri = null; + if (resultData != null) { + uri = resultData.getData(); + if (EhDB.exportDB(getActivity(), uri)) { + Toast.makeText(getActivity(), + getString(R.string.settings_advanced_export_data_to, uri.toString()), Toast.LENGTH_SHORT).show(); + } + } + } + } + private static void importData(final Context context) { final File dir = AppConfig.getExternalDataDir(); if (null == dir) { From 30ff1fff5753af35af55b61260170170dfaa3ccf Mon Sep 17 00:00:00 2001 From: onlymash Date: Sat, 24 Mar 2018 20:55:47 +0800 Subject: [PATCH 2/6] use SAF import data in Kikat or later --- .../main/java/com/hippo/ehviewer/EhDB.java | 100 ++++++++++++++++++ .../ui/fragment/AdvancedFragment.java | 64 +++++++---- 2 files changed, 143 insertions(+), 21 deletions(-) diff --git a/app/src/main/java/com/hippo/ehviewer/EhDB.java b/app/src/main/java/com/hippo/ehviewer/EhDB.java index 02d04672d..34949466b 100644 --- a/app/src/main/java/com/hippo/ehviewer/EhDB.java +++ b/app/src/main/java/com/hippo/ehviewer/EhDB.java @@ -770,4 +770,104 @@ public static synchronized String importDB(Context context, File file) { return context.getString(R.string.cant_read_the_file); } } + + /** + * @param uri The db uri + * @return error string, null for no error + */ + public static synchronized String importDB(Context context, Uri uri) { + try { + File file = new File(context.getCacheDir().getPath()+"/import.db"); + + InputStream is = null; + OutputStream os = null; + ContentResolver resolver = context.getContentResolver(); + try { + is = resolver.openInputStream(uri); + os = new FileOutputStream(file); + IOUtils.copy(is, os); + } catch (IOException e) { + e.printStackTrace(); + } finally { + IOUtils.closeQuietly(is); + IOUtils.closeQuietly(os); + } + + SQLiteDatabase db = SQLiteDatabase.openDatabase( + file.getPath(), null, SQLiteDatabase.NO_LOCALIZED_COLLATORS); + int newVersion = DaoMaster.SCHEMA_VERSION; + int oldVersion = db.getVersion(); + if (oldVersion < newVersion) { + upgradeDB(db, oldVersion); + db.setVersion(newVersion); + } else if (oldVersion > newVersion) { + return context.getString(R.string.cant_read_the_file); + } + + DaoMaster daoMaster = new DaoMaster(db); + DaoSession session = daoMaster.newSession(); + + // Downloads + DownloadManager manager = EhApplication.getDownloadManager(context); + List downloadInfoList = session.getDownloadsDao().queryBuilder().list(); + manager.addDownload(downloadInfoList); + + // Download label + List downloadLabelList = session.getDownloadLabelDao().queryBuilder().list(); + manager.addDownloadLabel(downloadLabelList); + + // Download dirname + List downloadDirnameList = session.getDownloadDirnameDao().queryBuilder().list(); + for (DownloadDirname dirname: downloadDirnameList) { + putDownloadDirname(dirname.getGid(), dirname.getDirname()); + } + + // History + List historyInfoList = session.getHistoryDao().queryBuilder().list(); + putHistoryInfo(historyInfoList); + + // QuickSearch + List quickSearchList = session.getQuickSearchDao().queryBuilder().list(); + List currentQuickSearchList = sDaoSession.getQuickSearchDao().queryBuilder().list(); + for (QuickSearch quickSearch: quickSearchList) { + String name = quickSearch.name; + for (QuickSearch q: currentQuickSearchList) { + if (ObjectUtils.equal(q.name, name)) { + // The same name + name = null; + break; + } + } + if (null == name) { + continue; + } + insertQuickSearch(quickSearch); + } + + // LocalFavorites + List localFavoriteInfoList = session.getLocalFavoritesDao().queryBuilder().list(); + for (LocalFavoriteInfo info: localFavoriteInfoList) { + putLocalFavorites(info); + } + + // Bookmarks + // TODO + + // Filter + List filterList = session.getFilterDao().queryBuilder().list(); + List currentFilterList = sDaoSession.getFilterDao().queryBuilder().list(); + for (Filter filter: filterList) { + if (!currentFilterList.contains(filter)) { + addFilter(filter); + } + } + + file.delete(); + + return null; + } catch (Exception e) { + // Ignore + return context.getString(R.string.cant_read_the_file); + } + } } diff --git a/app/src/main/java/com/hippo/ehviewer/ui/fragment/AdvancedFragment.java b/app/src/main/java/com/hippo/ehviewer/ui/fragment/AdvancedFragment.java index ebe4b5d7e..3da3ee434 100644 --- a/app/src/main/java/com/hippo/ehviewer/ui/fragment/AdvancedFragment.java +++ b/app/src/main/java/com/hippo/ehviewer/ui/fragment/AdvancedFragment.java @@ -48,6 +48,7 @@ public class AdvancedFragment extends PreferenceFragment private static final String KEY_EXPORT_DATA = "export_data"; private static final String KEY_IMPORT_DATA = "import_data"; + private static final int READ_REQUEST_CODE = 42; private static final int WRITE_REQUEST_CODE = 43; @Override @@ -144,31 +145,52 @@ public void onActivityResult(int requestCode, int resultCode, Intent resultData) } } } - } - private static void importData(final Context context) { - final File dir = AppConfig.getExternalDataDir(); - if (null == dir) { - Toast.makeText(context, R.string.cant_get_data_dir, Toast.LENGTH_SHORT).show(); - return; - } - final String[] files = dir.list(); - if (null == files || files.length <= 0) { - Toast.makeText(context, R.string.cant_find_any_data, Toast.LENGTH_SHORT).show(); - return; - } - Arrays.sort(files); - new AlertDialog.Builder(context).setItems(files, new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - File file = new File(dir, files[which]); - String error = EhDB.importDB(context, file); + if (requestCode == READ_REQUEST_CODE && resultCode == Activity.RESULT_OK) { + Uri uri = null; + if (resultData != null) { + uri = resultData.getData(); + String error = EhDB.importDB(getActivity(), uri); if (null == error) { - error = context.getString(R.string.settings_advanced_import_data_successfully); + error = getString(R.string.settings_advanced_import_data_successfully); } - Toast.makeText(context, error, Toast.LENGTH_SHORT).show(); + Toast.makeText(getActivity(), error, Toast.LENGTH_SHORT).show(); + } + } + } + + private void importData(final Context context) { + + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT){ + Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT); + intent.addCategory(Intent.CATEGORY_OPENABLE); + intent.setType("*/*"); + startActivityForResult(intent, READ_REQUEST_CODE); + + }else { + final File dir = AppConfig.getExternalDataDir(); + if (null == dir) { + Toast.makeText(context, R.string.cant_get_data_dir, Toast.LENGTH_SHORT).show(); + return; } - }).show(); + final String[] files = dir.list(); + if (null == files || files.length <= 0) { + Toast.makeText(context, R.string.cant_find_any_data, Toast.LENGTH_SHORT).show(); + return; + } + Arrays.sort(files); + new AlertDialog.Builder(context).setItems(files, new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + File file = new File(dir, files[which]); + String error = EhDB.importDB(context, file); + if (null == error) { + error = context.getString(R.string.settings_advanced_import_data_successfully); + } + Toast.makeText(context, error, Toast.LENGTH_SHORT).show(); + } + }).show(); + } } @Override From 2ff5c3b3019dffd92c2340c51f8782c875be966a Mon Sep 17 00:00:00 2001 From: onlymash Date: Tue, 27 Mar 2018 01:55:10 +0800 Subject: [PATCH 3/6] add dialog to export data --- app/build.gradle | 2 +- .../ui/fragment/AdvancedFragment.java | 58 ++++++++++++++----- app/src/main/res/values-zh-rCN/strings.xml | 5 +- app/src/main/res/values/strings.xml | 5 +- 4 files changed, 52 insertions(+), 18 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 439bd630e..a1575e7fb 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -79,7 +79,7 @@ dependencies { implementation 'com.github.seven332:ripple:0.1.2' implementation 'com.github.seven332:streampipe:0.1.0' implementation 'com.github.seven332:tuxiang:0.1.2' - implementation 'com.github.seven332:unifile:b59c14e47b' + implementation 'com.github.seven332:unifile:0.2.0' implementation 'com.github.seven332:yorozuya:0.1.2' implementation 'com.github.seven332:yorozuya-thread:0.1.1' implementation 'com.github.seven332:yorozuya-collect:0.1.4' diff --git a/app/src/main/java/com/hippo/ehviewer/ui/fragment/AdvancedFragment.java b/app/src/main/java/com/hippo/ehviewer/ui/fragment/AdvancedFragment.java index 3da3ee434..6d3a985a4 100644 --- a/app/src/main/java/com/hippo/ehviewer/ui/fragment/AdvancedFragment.java +++ b/app/src/main/java/com/hippo/ehviewer/ui/fragment/AdvancedFragment.java @@ -98,20 +98,11 @@ public boolean onPreferenceClick(Preference preference) { Runtime.getRuntime().gc(); } else if (KEY_EXPORT_DATA.equals(key)) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT){ - String filename = ReadableTime.getFilenamableTime(System.currentTimeMillis()) + ".db"; - exportData("*/*", filename); + showExportDialog(); return true; - }else { - File dir = AppConfig.getExternalDataDir(); - if (dir != null) { - File file = new File(dir, ReadableTime.getFilenamableTime(System.currentTimeMillis()) + ".db"); - if (EhDB.exportDB(getActivity(), file)) { - Toast.makeText(getActivity(), - getString(R.string.settings_advanced_export_data_to, file.getPath()), Toast.LENGTH_SHORT).show(); - return true; - } - } + } else if (defaultExportData()){ + return true; } Toast.makeText(getActivity(),R.string.settings_advanced_export_data_failed, Toast.LENGTH_SHORT).show(); return true; @@ -123,11 +114,48 @@ public boolean onPreferenceClick(Preference preference) { return false; } - private void exportData(String mimeType, String fileName){ + private void showExportDialog(){ + AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); + builder.setTitle(getString(R.string.settings_advanced_export_data_to_location)); + final CharSequence[] items = new CharSequence[]{ + getString(R.string.settings_advanced_export_data_device_storage), + getString(R.string.settings_advanced_export_data_document_storage) + }; + builder.setItems(items, new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialogInterface, int i) { + switch (i){ + case 0: + defaultExportData(); + break; + case 1: + customExportData(); + break; + } + } + }); + builder.show(); + } + + private boolean defaultExportData(){ + File dir = AppConfig.getExternalDataDir(); + if (dir != null) { + File file = new File(dir, ReadableTime.getFilenamableTime(System.currentTimeMillis()) + ".db"); + if (EhDB.exportDB(getActivity(), file)) { + Toast.makeText(getActivity(), + getString(R.string.settings_advanced_export_data_to, file.getPath()), Toast.LENGTH_SHORT).show(); + return true; + } + } + return false; + } + + private void customExportData(){ + String filename = ReadableTime.getFilenamableTime(System.currentTimeMillis()) + ".db"; Intent intent = new Intent(Intent.ACTION_CREATE_DOCUMENT); intent.addCategory(Intent.CATEGORY_OPENABLE); - intent.setType(mimeType); - intent.putExtra(Intent.EXTRA_TITLE, fileName); + intent.setType("*/*"); + intent.putExtra(Intent.EXTRA_TITLE, filename); startActivityForResult(intent, WRITE_REQUEST_CODE); } diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index 3831f32a3..e34f5a41f 100755 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -373,7 +373,7 @@ @string/refresh @string/share 保存 - 保存到... + 保存到… 添加书签 菜单 分享图片 @@ -506,6 +506,9 @@ 保存数据至外置存储器,例如下载列表,快速搜索列表 已导出数据至 %s 导出数据失败 + 设备存储器 + 文件存储 + 导出数据到… 导入数据 从置存储器导入数据 导入数据成功 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index ce83a732d..09bc0e787 100755 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -417,7 +417,7 @@ @string/refresh @string/share Save - Save to... + Save to… Add a bookmark Menu Share image @@ -549,6 +549,9 @@ Save data to external storage, such as download list, quick search list Exported data to %s Export data failed + Device Storage + Document Storage + Export data to… Import data Load data which saved before Import data successfully From cadbf45b0461770669e2bd27d1e99aa650f275fc Mon Sep 17 00:00:00 2001 From: onlymash Date: Thu, 29 Mar 2018 18:36:15 +0800 Subject: [PATCH 4/6] fix conflict --- .../ui/fragment/AdvancedFragment.java | 97 ++++++++++++------- 1 file changed, 62 insertions(+), 35 deletions(-) diff --git a/app/src/main/java/com/hippo/ehviewer/ui/fragment/AdvancedFragment.java b/app/src/main/java/com/hippo/ehviewer/ui/fragment/AdvancedFragment.java index 6d3a985a4..ed966574c 100644 --- a/app/src/main/java/com/hippo/ehviewer/ui/fragment/AdvancedFragment.java +++ b/app/src/main/java/com/hippo/ehviewer/ui/fragment/AdvancedFragment.java @@ -107,7 +107,12 @@ public boolean onPreferenceClick(Preference preference) { Toast.makeText(getActivity(),R.string.settings_advanced_export_data_failed, Toast.LENGTH_SHORT).show(); return true; } else if (KEY_IMPORT_DATA.equals(key)) { - importData(getActivity()); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT){ + showImportDialog(); + } else { + defaulfImportData(); + } + getActivity().setResult(Activity.RESULT_OK); return true; } @@ -160,6 +165,62 @@ private void customExportData(){ } + private void showImportDialog(){ + AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); + builder.setTitle(getString(R.string.settings_advanced_import_data)); + final CharSequence[] items = new CharSequence[]{ + getString(R.string.settings_advanced_export_data_device_storage), + getString(R.string.settings_advanced_export_data_document_storage) + }; + builder.setItems(items, new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialogInterface, int i) { + switch (i){ + case 0: + defaulfImportData(); + break; + case 1: + customImportData(); + break; + } + } + }); + builder.show(); + } + + private void defaulfImportData(){ + Context context = getActivity(); + final File dir = AppConfig.getExternalDataDir(); + if (null == dir) { + Toast.makeText(context, R.string.cant_get_data_dir, Toast.LENGTH_SHORT).show(); + return; + } + final String[] files = dir.list(); + if (null == files || files.length <= 0) { + Toast.makeText(context, R.string.cant_find_any_data, Toast.LENGTH_SHORT).show(); + return; + } + Arrays.sort(files); + new AlertDialog.Builder(context).setItems(files, new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + File file = new File(dir, files[which]); + String error = EhDB.importDB(context, file); + if (null == error) { + error = context.getString(R.string.settings_advanced_import_data_successfully); + } + Toast.makeText(context, error, Toast.LENGTH_SHORT).show(); + } + }).show(); + } + + private void customImportData(){ + Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT); + intent.addCategory(Intent.CATEGORY_OPENABLE); + intent.setType("*/*"); + startActivityForResult(intent, READ_REQUEST_CODE); + } + @Override public void onActivityResult(int requestCode, int resultCode, Intent resultData) { @@ -187,40 +248,6 @@ public void onActivityResult(int requestCode, int resultCode, Intent resultData) } } - private void importData(final Context context) { - - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT){ - Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT); - intent.addCategory(Intent.CATEGORY_OPENABLE); - intent.setType("*/*"); - startActivityForResult(intent, READ_REQUEST_CODE); - - }else { - final File dir = AppConfig.getExternalDataDir(); - if (null == dir) { - Toast.makeText(context, R.string.cant_get_data_dir, Toast.LENGTH_SHORT).show(); - return; - } - final String[] files = dir.list(); - if (null == files || files.length <= 0) { - Toast.makeText(context, R.string.cant_find_any_data, Toast.LENGTH_SHORT).show(); - return; - } - Arrays.sort(files); - new AlertDialog.Builder(context).setItems(files, new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - File file = new File(dir, files[which]); - String error = EhDB.importDB(context, file); - if (null == error) { - error = context.getString(R.string.settings_advanced_import_data_successfully); - } - Toast.makeText(context, error, Toast.LENGTH_SHORT).show(); - } - }).show(); - } - } - @Override public boolean onPreferenceChange(Preference preference, Object newValue) { String key = preference.getKey(); From 3e539fb6e755a12de07de71ebd1ebac3cb923304 Mon Sep 17 00:00:00 2001 From: onlymash Date: Thu, 29 Mar 2018 18:40:35 +0800 Subject: [PATCH 5/6] restore unifile --- app/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index a1575e7fb..439bd630e 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -79,7 +79,7 @@ dependencies { implementation 'com.github.seven332:ripple:0.1.2' implementation 'com.github.seven332:streampipe:0.1.0' implementation 'com.github.seven332:tuxiang:0.1.2' - implementation 'com.github.seven332:unifile:0.2.0' + implementation 'com.github.seven332:unifile:b59c14e47b' implementation 'com.github.seven332:yorozuya:0.1.2' implementation 'com.github.seven332:yorozuya-thread:0.1.1' implementation 'com.github.seven332:yorozuya-collect:0.1.4' From 9361ba5dc3f229b1edc6a2df9349d97075971942 Mon Sep 17 00:00:00 2001 From: onlymash Date: Thu, 29 Mar 2018 18:54:36 +0800 Subject: [PATCH 6/6] update string --- .../hippo/ehviewer/ui/fragment/AdvancedFragment.java | 12 ++++++------ app/src/main/res/values-zh-rCN/strings.xml | 7 ++++--- app/src/main/res/values/strings.xml | 7 ++++--- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/app/src/main/java/com/hippo/ehviewer/ui/fragment/AdvancedFragment.java b/app/src/main/java/com/hippo/ehviewer/ui/fragment/AdvancedFragment.java index ed966574c..b32527789 100644 --- a/app/src/main/java/com/hippo/ehviewer/ui/fragment/AdvancedFragment.java +++ b/app/src/main/java/com/hippo/ehviewer/ui/fragment/AdvancedFragment.java @@ -121,10 +121,10 @@ public boolean onPreferenceClick(Preference preference) { private void showExportDialog(){ AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); - builder.setTitle(getString(R.string.settings_advanced_export_data_to_location)); + builder.setTitle(getString(R.string.settings_advanced_export_data_location)); final CharSequence[] items = new CharSequence[]{ - getString(R.string.settings_advanced_export_data_device_storage), - getString(R.string.settings_advanced_export_data_document_storage) + getString(R.string.settings_advanced_data_device_storage), + getString(R.string.settings_advanced_data_document_storage) }; builder.setItems(items, new DialogInterface.OnClickListener() { @Override @@ -167,10 +167,10 @@ private void customExportData(){ private void showImportDialog(){ AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); - builder.setTitle(getString(R.string.settings_advanced_import_data)); + builder.setTitle(getString(R.string.settings_advanced_import_data_location)); final CharSequence[] items = new CharSequence[]{ - getString(R.string.settings_advanced_export_data_device_storage), - getString(R.string.settings_advanced_export_data_document_storage) + getString(R.string.settings_advanced_data_device_storage), + getString(R.string.settings_advanced_data_document_storage) }; builder.setItems(items, new DialogInterface.OnClickListener() { @Override diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index e34f5a41f..bf4ce7ca8 100755 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -506,12 +506,13 @@ 保存数据至外置存储器,例如下载列表,快速搜索列表 已导出数据至 %s 导出数据失败 - 设备存储器 - 文件存储 - 导出数据到… + 导出数据到… 导入数据 从置存储器导入数据 导入数据成功 + 导入数据位置 + 设备存储器 + 文件存储 关于 作者 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 09bc0e787..f503bf3c9 100755 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -549,12 +549,13 @@ Save data to external storage, such as download list, quick search list Exported data to %s Export data failed - Device Storage - Document Storage - Export data to… + Export data to… Import data Load data which saved before Import data successfully + Import data from… + Device Storage + Document Storage About Author