Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
Fixed check upgrade bugs and adjusted UI in settings
Browse files Browse the repository at this point in the history
  • Loading branch information
sh1r0 committed Oct 23, 2016
1 parent 0e04f76 commit 8cd8106
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 25 deletions.
2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ dependencies {
compile 'com.github.dmytrodanylyk.android-process-button:library:1.0.4'
compile 'org.jsoup:jsoup:1.9.2'
compile 'com.nononsenseapps:filepicker:2.5.2'
compile 'com.github.medyo:android-about-page:1.0.7'
compile 'com.github.medyo:android-about-page:1.1.1'
}

def ksFile = rootProject.file('local.properties')
Expand Down
9 changes: 2 additions & 7 deletions app/src/main/java/com/sh1r0/noveldroid/SettingsFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import android.support.v7.preference.Preference;
import android.support.v7.preference.Preference.OnPreferenceClickListener;
import android.support.v7.preference.PreferenceFragmentCompat;
import android.support.v7.view.ContextThemeWrapper;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.LayoutInflater;
Expand Down Expand Up @@ -50,8 +49,6 @@
import java.net.URL;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class SettingsFragment extends PreferenceFragmentCompat implements
SharedPreferences.OnSharedPreferenceChangeListener {
Expand All @@ -70,7 +67,6 @@ public class SettingsFragment extends PreferenceFragmentCompat implements
private Preference about;
private SharedPreferences prefs;
private String versionName;
private String aboutMessage;

private DownloadManager manager;
private BroadcastReceiver receiver;
Expand All @@ -89,7 +85,6 @@ public void onCreate(Bundle paramBundle) {
} catch (NameNotFoundException e) {
e.printStackTrace();
}
aboutMessage = getString(R.string.version_tag) + versionName + "\n" + getString(R.string.author_tag) + getString(R.string.author_name);

encoding = findPreference(KEY_ENCODING);
namingRule = findPreference(KEY_NAMING_RULE);
Expand All @@ -100,7 +95,7 @@ public boolean onPreferenceClick(Preference preference) {
final View dialog_view = factory.inflate(R.layout.naming_rule_dialog,null);
final EditText editText;
final TextView previewTextView;
previewTextView = (TextView) dialog_view.findViewById(R.id.tv_preivew_string);
previewTextView = (TextView) dialog_view.findViewById(R.id.tv_preview_string);
editText = (EditText) dialog_view.findViewById(R.id.et_naming_rule);
editText.addTextChangedListener(new TextWatcher() {
@Override
Expand Down Expand Up @@ -359,7 +354,7 @@ protected void onPostExecute(final Pair<String, URL> versionPair) {
AlertDialog.Builder dialog = new AlertDialog.Builder(getActivity());
dialog.setCancelable(false);

if (NovelUtils.versionCompare(currentVersion, versionPair.first) == 0) {
if (NovelUtils.versionCompare(currentVersion, versionPair.first) >= 0) {
dialog.setMessage(R.string.current_is_latest);
dialog.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
@Override
Expand Down
44 changes: 30 additions & 14 deletions app/src/main/res/layout/naming_rule_dialog.xml
Original file line number Diff line number Diff line change
@@ -1,25 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="16dp"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:paddingTop="16dp">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/name_rule"
android:id="@+id/tv_naming_rule"
android:layout_gravity="center_horizontal" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/tv_preivew_string"
android:textSize="30sp"
android:layout_gravity="center_horizontal" />
android:id="@+id/tv_preview_string"
android:textSize="20sp"
android:layout_gravity="center_horizontal"
android:textColor="@color/primary_text"
android:textStyle="normal|italic"
android:paddingTop="10sp"
android:paddingBottom="10sp"
android:textAllCaps="false"
/>

<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/et_naming_rule" />
android:id="@+id/et_naming_rule"
/>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/name_rule"
android:id="@+id/tv_naming_rule"
android:layout_gravity="center_horizontal"
android:textColor="@color/secondary_text"
android:lineSpacingExtra="8sp"
android:paddingTop="10sp"
/>

</LinearLayout>
</LinearLayout>
2 changes: 1 addition & 1 deletion app/src/main/res/values-zh-rTW/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
<string name="encoding">編碼</string>
<string name="encoding_dialog_title">選擇編碼</string>
<string name="filename_rule_dialog_title">命名規則</string>
<string name="name_rule">/n=書名, /a=作者, /t=年-月-日, /y=年, /m=月, /d=日</string>
<string name="name_rule">/n=書名/a=作者/t=年-月-日,\n/y=年/m=月/d=日</string>
<string name="download_folder">下載資料夾</string>
<string name="new_folder">新資料夾</string>
<string name="new_folder_name">新資料夾名稱</string>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
<string name="encoding_dialog_title">Select Encoding</string>
<string name="filename_rule">Filename Rule</string>
<string name="filename_rule_dialog_title">Select Naming Rule</string>
<string name="name_rule">/n=bookname, /a=author /t=yyyy-MM-dd, /y=year, /m=month and /d=day</string>
<string name="name_rule">/n=bookname, /a=author /t=yyyy-MM-dd,\n/y=year, /m=month and /d=day</string>
<string name="download_folder">Download Folder</string>
<string name="new_folder">New Folder</string>
<string name="new_folder_name">New Folder Name</string>
Expand Down

0 comments on commit 8cd8106

Please sign in to comment.