Skip to content
This repository has been archived by the owner on Aug 26, 2019. It is now read-only.

Commit

Permalink
Add check download location
Browse files Browse the repository at this point in the history
  • Loading branch information
seven332 committed Mar 21, 2016
1 parent ed8073e commit 2c69b67
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 0 deletions.
15 changes: 15 additions & 0 deletions app/src/main/java/com/hippo/ehviewer/ui/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import android.support.design.widget.NavigationView;
import android.support.design.widget.Snackbar;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.AlertDialog;
import android.text.TextUtils;
import android.util.Log;
import android.view.Gravity;
Expand Down Expand Up @@ -66,6 +67,7 @@
import com.hippo.scene.Announcer;
import com.hippo.scene.SceneFragment;
import com.hippo.scene.StageActivity;
import com.hippo.unifile.UniFile;
import com.hippo.util.PermissionRequester;
import com.hippo.widget.LoadImageView;
import com.hippo.yorozuya.ViewUtils;
Expand Down Expand Up @@ -308,11 +310,24 @@ protected void onCreate2(@Nullable Bundle savedInstanceState) {
if (savedInstanceState == null) {
onInit();
CommonOperations.checkUpdate(this, false);
checkDownloadLocation();
} else {
onRestore(savedInstanceState);
}
}

private void checkDownloadLocation() {
UniFile uniFile = Settings.getDownloadLocation();
if (null != uniFile && uniFile.ensureDir()) {
return;
}
new AlertDialog.Builder(this)
.setTitle(R.string.waring)
.setMessage(R.string.invalid_download_location)
.setPositiveButton(R.string.get_it, null)
.show();
}

private void onInit() {
// Check permission
PermissionRequester.request(this, Manifest.permission.WRITE_EXTERNAL_STORAGE,
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values-zh-rCN/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@
<string name="i_will_check_it">好的</string>
<string name="i_dont_think_so">我没输错</string>

<string name="invalid_download_location">似乎下载路径不可用。请到重新设置下载路径。</string>

<string name="error_bad_status_code">错误的状态码:%d</string>
<string name="error_timeout">超时</string>
<string name="error_unknown_host">未知主机</string>
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values-zh-rHK/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@
<string name="i_will_check_it">好的</string>
<string name="i_dont_think_so">我沒輸錯</string>

<string name="invalid_download_location">似乎下載路徑不可用。請到重新設置下載路徑。</string>

<string name="error_bad_status_code">錯誤的狀態碼:%d</string>
<string name="error_timeout">超時</string>
<string name="error_unknown_host">未知主機</string>
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values-zh-rTW/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@
<string name="i_will_check_it">好的</string>
<string name="i_dont_think_so">我沒輸錯</string>

<string name="invalid_download_location">似乎下載路徑不可用。請到重新設定下載路徑。</string>

<string name="error_bad_status_code">錯誤的狀態碼:%d</string>
<string name="error_timeout">超時</string>
<string name="error_unknown_host">未知主機</string>
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@
<string name="i_will_check_it">I will check it</string>
<string name="i_dont_think_so">I don\'t think so</string>

<string name="invalid_download_location">It seems download location is not available. Please set it in Settings.</string>

<string name="error_status_code_400" translatable="false">Bad Request</string>
<string name="error_status_code_401" translatable="false">Unauthorized</string>
<string name="error_status_code_402" translatable="false">Payment Required</string>
Expand Down

0 comments on commit 2c69b67

Please sign in to comment.