From b4f9e77a766ff5651179bf092ccb02c3e0111311 Mon Sep 17 00:00:00 2001 From: seven332 Date: Tue, 1 Mar 2016 17:12:35 +0800 Subject: [PATCH] Improve settings --- app/src/main/AndroidManifest.xml | 7 +- .../java/com/hippo/ehviewer/Settings.java | 2 +- .../hippo/ehviewer/ui/DirPickerActivity.java | 106 ++++++++++ .../hippo/ehviewer/ui/SettingsActivity.java | 7 +- .../hippo/ehviewer/ui/ToolbarActivity.java | 66 ++++++ .../ehviewer/ui/fragment/AboutFragment.java | 31 +++ .../ui/fragment/DownloadFragment.java | 178 +++++++++++++++++ .../java/com/hippo/widget/DirExplorer.java | 189 ++++++++++++++++++ .../res/drawable/v_download_primary_x24.xml | 29 +++ .../main/res/drawable/v_info_primary_x24.xml | 29 +++ app/src/main/res/layout-v21/scene_toolbar.xml | 38 ++++ .../main/res/layout/activity_dir_picker.xml | 51 +++++ app/src/main/res/layout/activity_toolbar.xml | 20 ++ app/src/main/res/layout/item_dir_explorer.xml | 24 +++ app/src/main/res/layout/scene_toolbar.xml | 2 +- app/src/main/res/values/strings.xml | 14 ++ app/src/main/res/xml/about_settings.xml | 26 +++ app/src/main/res/xml/download_settings.xml | 25 +++ app/src/main/res/xml/settings_headers.xml | 10 + 19 files changed, 849 insertions(+), 5 deletions(-) create mode 100644 app/src/main/java/com/hippo/ehviewer/ui/DirPickerActivity.java create mode 100644 app/src/main/java/com/hippo/ehviewer/ui/ToolbarActivity.java create mode 100644 app/src/main/java/com/hippo/ehviewer/ui/fragment/AboutFragment.java create mode 100644 app/src/main/java/com/hippo/ehviewer/ui/fragment/DownloadFragment.java create mode 100644 app/src/main/java/com/hippo/widget/DirExplorer.java create mode 100644 app/src/main/res/drawable/v_download_primary_x24.xml create mode 100644 app/src/main/res/drawable/v_info_primary_x24.xml create mode 100644 app/src/main/res/layout-v21/scene_toolbar.xml create mode 100644 app/src/main/res/layout/activity_dir_picker.xml create mode 100644 app/src/main/res/layout/activity_toolbar.xml create mode 100644 app/src/main/res/layout/item_dir_explorer.xml create mode 100644 app/src/main/res/xml/about_settings.xml create mode 100644 app/src/main/res/xml/download_settings.xml diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 74a81e724..6a8297792 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -67,11 +67,16 @@ android:configChanges="screenSize|uiMode" android:theme="@style/AppTheme"/> + + - diff --git a/app/src/main/java/com/hippo/ehviewer/Settings.java b/app/src/main/java/com/hippo/ehviewer/Settings.java index 5a931a164..a94369a23 100644 --- a/app/src/main/java/com/hippo/ehviewer/Settings.java +++ b/app/src/main/java/com/hippo/ehviewer/Settings.java @@ -259,7 +259,7 @@ public class Settings { return dir != null ? dir : UniFile.fromFile(AppConfig.getDefaultDownloadDir()); } - public static void putImageSaveLocation(@NonNull UniFile location) { + public static void putDownloadLocation(@NonNull UniFile location) { Uri uri = location.getUri(); putString(KEY_DOWNLOAD_SAVE_SCHEME, uri.getScheme()); putString(KEY_DOWNLOAD_SAVE_AUTHORITY, uri.getEncodedAuthority()); diff --git a/app/src/main/java/com/hippo/ehviewer/ui/DirPickerActivity.java b/app/src/main/java/com/hippo/ehviewer/ui/DirPickerActivity.java new file mode 100644 index 000000000..35307955c --- /dev/null +++ b/app/src/main/java/com/hippo/ehviewer/ui/DirPickerActivity.java @@ -0,0 +1,106 @@ +/* + * Copyright 2016 Hippo Seven + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.hippo.ehviewer.ui; + +import android.annotation.TargetApi; +import android.content.Intent; +import android.net.Uri; +import android.os.Build; +import android.os.Bundle; +import android.support.annotation.NonNull; +import android.view.MenuItem; +import android.view.View; +import android.widget.TextView; +import android.widget.Toast; + +import com.hippo.ehviewer.R; +import com.hippo.rippleold.RippleSalon; +import com.hippo.widget.DirExplorer; + +import java.io.File; + +public class DirPickerActivity extends ToolbarActivity + implements View.OnClickListener, DirExplorer.OnChangeDirListener { + + public static final String KEY_FILE_URI = "file_uri"; + + private TextView mPath; + private DirExplorer mDirExplorer; + private View mOk; + + @TargetApi(Build.VERSION_CODES.JELLY_BEAN) + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + setContentView(R.layout.activity_dir_picker); + setNavigationIcon(R.drawable.v_arrow_left_dark_x24); + + mPath = (TextView) findViewById(R.id.path); + mDirExplorer = (DirExplorer) findViewById(R.id.dir_explorer); + mOk = findViewById(R.id.ok); + + File file = null; + Intent intent = getIntent(); + if (intent != null) { + Uri fileUri = intent.getParcelableExtra(KEY_FILE_URI); + if (fileUri != null) { + file = new File(fileUri.getPath()); + } + } + + mDirExplorer.setCurrentFile(file); + mDirExplorer.setOnChangeDirListener(this); + + RippleSalon.addRipple(mOk, false); + + mOk.setOnClickListener(this); + + mPath.setText(mDirExplorer.getCurrentFile().getPath()); + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + switch (item.getItemId()) { + case android.R.id.home: + finish(); + return true; + default: + return super.onOptionsItemSelected(item); + } + } + + @Override + public void onClick(@NonNull View v) { + if (mOk == v) { + File file = mDirExplorer.getCurrentFile(); + if (!file.canWrite()) { + Toast.makeText(this, R.string.directory_not_writable, Toast.LENGTH_SHORT).show(); + } else { + Intent intent = new Intent(); + intent.setData(Uri.fromFile(file)); + setResult(RESULT_OK, intent); + finish(); + } + } + } + + @Override + public void onChangeDir(File dir) { + mPath.setText(dir.getPath()); + } +} diff --git a/app/src/main/java/com/hippo/ehviewer/ui/SettingsActivity.java b/app/src/main/java/com/hippo/ehviewer/ui/SettingsActivity.java index ec9123586..cb74764ec 100644 --- a/app/src/main/java/com/hippo/ehviewer/ui/SettingsActivity.java +++ b/app/src/main/java/com/hippo/ehviewer/ui/SettingsActivity.java @@ -34,6 +34,8 @@ import android.widget.ListAdapter; import com.hippo.app.AppCompatPreferenceActivity; import com.hippo.ehviewer.R; +import com.hippo.ehviewer.ui.fragment.AboutFragment; +import com.hippo.ehviewer.ui.fragment.DownloadFragment; import com.hippo.ehviewer.ui.fragment.EhFragment; import com.hippo.ehviewer.ui.fragment.ReadFragment; import com.hippo.util.DrawableManager; @@ -48,11 +50,13 @@ public final class SettingsActivity extends AppCompatPreferenceActivity { private static final String[] ENTRY_FRAGMENTS = { EhFragment.class.getName(), ReadFragment.class.getName(), + DownloadFragment.class.getName(), + AboutFragment.class.getName(), }; private class FakeLayoutInflater extends LayoutInflater { - private LayoutInflater mInflater; + private final LayoutInflater mInflater; protected FakeLayoutInflater(LayoutInflater inflater) { super(null); @@ -142,7 +146,6 @@ public final class SettingsActivity extends AppCompatPreferenceActivity { replaceHeaderLayoutResId(); } - @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { diff --git a/app/src/main/java/com/hippo/ehviewer/ui/ToolbarActivity.java b/app/src/main/java/com/hippo/ehviewer/ui/ToolbarActivity.java new file mode 100644 index 000000000..b34e545dc --- /dev/null +++ b/app/src/main/java/com/hippo/ehviewer/ui/ToolbarActivity.java @@ -0,0 +1,66 @@ +/* + * Copyright 2016 Hippo Seven + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.hippo.ehviewer.ui; + +import android.graphics.drawable.Drawable; +import android.support.annotation.DrawableRes; +import android.support.annotation.LayoutRes; +import android.support.annotation.Nullable; +import android.support.v7.app.AppCompatActivity; +import android.support.v7.widget.Toolbar; +import android.view.View; +import android.view.ViewGroup; + +import com.hippo.ehviewer.R; + +public class ToolbarActivity extends AppCompatActivity{ + + @Override + public void setContentView(@LayoutRes int layoutResID) { + super.setContentView(R.layout.activity_toolbar); + getLayoutInflater().inflate(layoutResID, (ViewGroup) findViewById(R.id.content_panel), true); + setSupportActionBar((Toolbar) findViewById(R.id.toolbar)); + } + + @Override + public void setContentView(View view) { + super.setContentView(R.layout.activity_toolbar); + ((ViewGroup) findViewById(R.id.content_panel)).addView(view); + setSupportActionBar((Toolbar) findViewById(R.id.toolbar)); + } + + @Override + public void setContentView(View view, ViewGroup.LayoutParams params) { + super.setContentView(R.layout.activity_toolbar); + ((ViewGroup) findViewById(R.id.content_panel)).addView(view, params); + setSupportActionBar((Toolbar) findViewById(R.id.toolbar)); + } + + public void setNavigationIcon(@DrawableRes int resId) { + View toolbar = findViewById(R.id.toolbar); + if (toolbar != null) { + ((Toolbar) toolbar).setNavigationIcon(resId); + } + } + + public void setNavigationIcon(@Nullable Drawable icon) { + View toolbar = findViewById(R.id.toolbar); + if (toolbar != null) { + ((Toolbar) toolbar).setNavigationIcon(icon); + } + } +} diff --git a/app/src/main/java/com/hippo/ehviewer/ui/fragment/AboutFragment.java b/app/src/main/java/com/hippo/ehviewer/ui/fragment/AboutFragment.java new file mode 100644 index 000000000..da48e6d5a --- /dev/null +++ b/app/src/main/java/com/hippo/ehviewer/ui/fragment/AboutFragment.java @@ -0,0 +1,31 @@ +/* + * Copyright 2016 Hippo Seven + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.hippo.ehviewer.ui.fragment; + +import android.os.Bundle; +import android.preference.PreferenceFragment; + +import com.hippo.ehviewer.R; + +public class AboutFragment extends PreferenceFragment { + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + addPreferencesFromResource(R.xml.about_settings); + } +} diff --git a/app/src/main/java/com/hippo/ehviewer/ui/fragment/DownloadFragment.java b/app/src/main/java/com/hippo/ehviewer/ui/fragment/DownloadFragment.java new file mode 100644 index 000000000..2bf71f699 --- /dev/null +++ b/app/src/main/java/com/hippo/ehviewer/ui/fragment/DownloadFragment.java @@ -0,0 +1,178 @@ +/* + * Copyright 2016 Hippo Seven + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.hippo.ehviewer.ui.fragment; + +import android.annotation.TargetApi; +import android.app.Activity; +import android.content.ActivityNotFoundException; +import android.content.DialogInterface; +import android.content.Intent; +import android.net.Uri; +import android.os.Build; +import android.os.Bundle; +import android.preference.Preference; +import android.preference.PreferenceFragment; +import android.support.annotation.Nullable; +import android.support.v7.app.AlertDialog; +import android.widget.Toast; + +import com.hippo.ehviewer.R; +import com.hippo.ehviewer.Settings; +import com.hippo.ehviewer.ui.DirPickerActivity; +import com.hippo.unifile.UniFile; + +public class DownloadFragment extends PreferenceFragment implements Preference.OnPreferenceClickListener { + + public static final int REQUEST_CODE_PICK_IMAGE_DIR = 0; + public static final int REQUEST_CODE_PICK_IMAGE_DIR_L = 1; + + public static final String KEY_DOWNLOAD_LOCATION = "download_location"; + + private @Nullable Preference mDownloadLocation; + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + addPreferencesFromResource(R.xml.download_settings); + + mDownloadLocation = findPreference(KEY_DOWNLOAD_LOCATION); + + onUpdateDownloadLocation(); + + if (mDownloadLocation != null) { + mDownloadLocation.setOnPreferenceClickListener(this); + } + } + + public void onUpdateDownloadLocation() { + UniFile file = Settings.getDownloadLocation(); + if (mDownloadLocation != null) { + if (file != null) { + mDownloadLocation.setSummary(file.getUri().toString()); + } else { + mDownloadLocation.setSummary(R.string.settings_download_invalid_download_location); + } + } + } + + @Override + public boolean onPreferenceClick(Preference preference) { + String key = preference.getKey(); + if (KEY_DOWNLOAD_LOCATION.equals(key)) { + + int sdk = Build.VERSION.SDK_INT; + if (sdk < Build.VERSION_CODES.KITKAT) { + openDirPicker(); + } else if (sdk < Build.VERSION_CODES.LOLLIPOP) { + showDirPickerDialogKK(); + } else { + showDirPickerDialogL(); + } + return true; + } + return false; + } + + private void showDirPickerDialogKK() { + new AlertDialog.Builder(getActivity()).setMessage(R.string.settings_download_pick_dir_kk) + .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + openDirPicker(); + } + }).show(); + } + + private void showDirPickerDialogL() { + DialogInterface.OnClickListener listener = new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + switch (which) { + case DialogInterface.BUTTON_POSITIVE: + openDirPicker(); + break; + case DialogInterface.BUTTON_NEUTRAL: + openDirPickerL(); + break; + } + } + }; + + new AlertDialog.Builder(getActivity()).setMessage(R.string.settings_download_pick_dir_l) + .setPositiveButton(android.R.string.ok, listener) + .setNeutralButton(R.string.settings_download_document, listener) + .show(); + } + + private void openDirPicker() { + UniFile uniFile = Settings.getDownloadLocation(); + Intent intent = new Intent(getActivity(), DirPickerActivity.class); + if (uniFile != null) { + intent.putExtra(DirPickerActivity.KEY_FILE_URI, uniFile.getUri()); + } + startActivityForResult(intent, REQUEST_CODE_PICK_IMAGE_DIR); + } + + @TargetApi(Build.VERSION_CODES.LOLLIPOP) + private void openDirPickerL() { + Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT_TREE); + try { + startActivityForResult(intent, REQUEST_CODE_PICK_IMAGE_DIR_L); + } catch (ActivityNotFoundException e) { + Toast.makeText(getActivity(), R.string.error_cant_find_activity, Toast.LENGTH_SHORT).show(); + } + } + + @Override + @TargetApi(Build.VERSION_CODES.KITKAT) + public void onActivityResult(int requestCode, int resultCode, Intent data) { + switch (requestCode) { + case REQUEST_CODE_PICK_IMAGE_DIR: { + if (resultCode == Activity.RESULT_OK) { + UniFile uniFile = UniFile.fromUri(getActivity(), data.getData()); + if (uniFile != null) { + Settings.putDownloadLocation(uniFile); + onUpdateDownloadLocation(); + } else { + Toast.makeText(getActivity(), R.string.settings_download_cant_get_download_location, + Toast.LENGTH_SHORT).show(); + } + } + break; + } + case REQUEST_CODE_PICK_IMAGE_DIR_L: { + if (resultCode == Activity.RESULT_OK) { + Uri treeUri = data.getData(); + getActivity().getContentResolver().takePersistableUriPermission( + treeUri, Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION); + UniFile uniFile = UniFile.fromTreeUri(getActivity(), treeUri); + if (uniFile != null) { + Settings.putDownloadLocation(uniFile); + onUpdateDownloadLocation(); + } else { + Toast.makeText(getActivity(), R.string.settings_download_cant_get_download_location, + Toast.LENGTH_SHORT).show(); + } + } + break; + } + default: { + super.onActivityResult(requestCode, resultCode, data); + } + } + } +} diff --git a/app/src/main/java/com/hippo/widget/DirExplorer.java b/app/src/main/java/com/hippo/widget/DirExplorer.java new file mode 100644 index 000000000..921ddf08b --- /dev/null +++ b/app/src/main/java/com/hippo/widget/DirExplorer.java @@ -0,0 +1,189 @@ +/* + * Copyright 2015 Hippo Seven + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.hippo.widget; + +import android.content.Context; +import android.os.Environment; +import android.support.v7.widget.LinearLayoutManager; +import android.util.AttributeSet; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.TextView; + +import com.hippo.easyrecyclerview.EasyRecyclerView; +import com.hippo.easyrecyclerview.LinearDividerItemDecoration; +import com.hippo.ehviewer.R; +import com.hippo.rippleold.RippleSalon; +import com.hippo.yorozuya.LayoutUtils; +import com.hippo.yorozuya.ResourcesUtils; + +import java.io.File; +import java.io.FileFilter; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; + +public class DirExplorer extends EasyRecyclerView implements EasyRecyclerView.OnItemClickListener { + + private static final DirFilter DIR_FILTER = new DirFilter(); + private static final FileSort FILE_SORT = new FileSort(); + + private static final File PARENT_DIR = null; + private static final String PARENT_DIR_NAME = ".."; + + private File mCurrentFile; + private final List mFiles = new ArrayList<>(); + + private DirAdapter mAdapter; + + private OnChangeDirListener mOnChangeDirListener; + + public DirExplorer(Context context) { + super(context); + init(context); + } + + public DirExplorer(Context context, AttributeSet attrs) { + super(context, attrs); + init(context); + } + + public DirExplorer(Context context, AttributeSet attrs, int defStyle) { + super(context, attrs, defStyle); + init(context); + } + + private void init(Context context) { + mAdapter = new DirAdapter(); + setAdapter(mAdapter); + setLayoutManager(new LinearLayoutManager(context)); + LinearDividerItemDecoration decoration = new LinearDividerItemDecoration( + LinearDividerItemDecoration.VERTICAL, getResources().getColor(R.color.divider), + LayoutUtils.dp2pix(context, 1)); + decoration.setShowLastDivider(true); + addItemDecoration(decoration); + setSelector(RippleSalon.generateRippleDrawable(ResourcesUtils.getAttrBoolean(context, R.attr.dark))); + setOnItemClickListener(this); + + mCurrentFile = Environment.getExternalStorageDirectory(); + if (!Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState()) + || mCurrentFile == null) { + mCurrentFile = new File("/"); + } + updateFileList(); + } + + public void setOnChangeDirListener(OnChangeDirListener listener) { + mOnChangeDirListener = listener; + } + + public void updateFileList() { + File[] files = mCurrentFile.listFiles(DIR_FILTER); + + mFiles.clear(); + if (mCurrentFile.getParent() != null) { + mFiles.add(PARENT_DIR); + } + if (files != null) { + Collections.addAll(mFiles, files); + } + // sort + Collections.sort(mFiles, FILE_SORT); + } + + public File getCurrentFile() { + return mCurrentFile; + } + + public void setCurrentFile(File file) { + if (file != null && file.isDirectory()) { + mCurrentFile = file; + updateFileList(); + mAdapter.notifyDataSetChanged(); + + if (mOnChangeDirListener != null) { + mOnChangeDirListener.onChangeDir(mCurrentFile); + } + } + } + + @Override + public boolean onItemClick(EasyRecyclerView parent, View view, int position, long id) { + File file = mFiles.get(position); + if (file == PARENT_DIR) { + file = mCurrentFile.getParentFile(); + } + setCurrentFile(file); + return true; + } + + private class DirHolder extends ViewHolder { + + public TextView textView; + + public DirHolder(View itemView) { + super(itemView); + textView = (TextView) itemView; + } + } + + private class DirAdapter extends Adapter { + + @Override + public DirHolder onCreateViewHolder(ViewGroup parent, int viewType) { + return new DirHolder( LayoutInflater.from(getContext()).inflate(R.layout.item_dir_explorer, parent, false)); + } + + @Override + public void onBindViewHolder(DirHolder holder, int position) { + File file = mFiles.get(position); + holder.textView.setText(file == PARENT_DIR ? PARENT_DIR_NAME : file.getName()); + } + + @Override + public int getItemCount() { + return mFiles.size(); + } + } + + static class DirFilter implements FileFilter { + @Override + public boolean accept(File pathname) { + return pathname.isDirectory(); + } + } + + static class FileSort implements Comparator { + @Override + public int compare(File lhs, File rhs) { + if (lhs == null) { + return Integer.MIN_VALUE; + } else if (rhs == null) { + return Integer.MAX_VALUE; + } else { + return lhs.getName().compareToIgnoreCase(rhs.getName()); + } + } + } + + public interface OnChangeDirListener { + + void onChangeDir(File dir); + } +} diff --git a/app/src/main/res/drawable/v_download_primary_x24.xml b/app/src/main/res/drawable/v_download_primary_x24.xml new file mode 100644 index 000000000..5d37e9fda --- /dev/null +++ b/app/src/main/res/drawable/v_download_primary_x24.xml @@ -0,0 +1,29 @@ + + + + + + + + diff --git a/app/src/main/res/drawable/v_info_primary_x24.xml b/app/src/main/res/drawable/v_info_primary_x24.xml new file mode 100644 index 000000000..1b8122ab1 --- /dev/null +++ b/app/src/main/res/drawable/v_info_primary_x24.xml @@ -0,0 +1,29 @@ + + + + + + + + diff --git a/app/src/main/res/layout-v21/scene_toolbar.xml b/app/src/main/res/layout-v21/scene_toolbar.xml new file mode 100644 index 000000000..6423b2fe3 --- /dev/null +++ b/app/src/main/res/layout-v21/scene_toolbar.xml @@ -0,0 +1,38 @@ + + + + + + + + + + diff --git a/app/src/main/res/layout/activity_dir_picker.xml b/app/src/main/res/layout/activity_dir_picker.xml new file mode 100644 index 000000000..1809549d9 --- /dev/null +++ b/app/src/main/res/layout/activity_dir_picker.xml @@ -0,0 +1,51 @@ + + + + + + + + + + + + diff --git a/app/src/main/res/layout/activity_toolbar.xml b/app/src/main/res/layout/activity_toolbar.xml new file mode 100644 index 000000000..e1500e16b --- /dev/null +++ b/app/src/main/res/layout/activity_toolbar.xml @@ -0,0 +1,20 @@ + + + + + + diff --git a/app/src/main/res/layout/item_dir_explorer.xml b/app/src/main/res/layout/item_dir_explorer.xml new file mode 100644 index 000000000..5acc2591b --- /dev/null +++ b/app/src/main/res/layout/item_dir_explorer.xml @@ -0,0 +1,24 @@ + + + + diff --git a/app/src/main/res/layout/scene_toolbar.xml b/app/src/main/res/layout/scene_toolbar.xml index d560708b2..feaf24301 100644 --- a/app/src/main/res/layout/scene_toolbar.xml +++ b/app/src/main/res/layout/scene_toolbar.xml @@ -36,7 +36,7 @@ diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index d355907b3..48962d60a 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -288,6 +288,20 @@ Show battery Use volume key to turn pages + Download + Download location + Invalid download location + Can\'t get download location + You can\'t write any kind of data on your external SD card in Android 4.4+ unless you have hacked it + Android 5.0+ provides new API to write on external SD card. Click the \"DOCUMENT\" button if you want to set download location to SD card + Document + + About + + + Dir picker + The directory is not writable + Something wrong happened diff --git a/app/src/main/res/xml/about_settings.xml b/app/src/main/res/xml/about_settings.xml new file mode 100644 index 000000000..87b4e1ab6 --- /dev/null +++ b/app/src/main/res/xml/about_settings.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + diff --git a/app/src/main/res/xml/download_settings.xml b/app/src/main/res/xml/download_settings.xml new file mode 100644 index 000000000..9c5b3ba79 --- /dev/null +++ b/app/src/main/res/xml/download_settings.xml @@ -0,0 +1,25 @@ + + + + + + + + diff --git a/app/src/main/res/xml/settings_headers.xml b/app/src/main/res/xml/settings_headers.xml index a46c87d02..1d13cb4d7 100644 --- a/app/src/main/res/xml/settings_headers.xml +++ b/app/src/main/res/xml/settings_headers.xml @@ -28,4 +28,14 @@ android:title="@string/settings_read_title" android:icon="@drawable/v_book_open_primary_x24"/> +
+ +
+