添加 popular 提示
This commit is contained in:
1 parent
6ebc172783
commit
ee5cc24a4d
7 files changed
+132
-2
No files matched your search
@@ -0,0 +1,41 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2014 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.
|
||||
-->
|
||||
<merge xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/list"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginBottom="24dp"
|
||||
android:layout_marginLeft="12dp"
|
||||
android:layout_marginRight="12dp"
|
||||
android:layout_marginTop="24dp"
|
||||
android:textSize="18sp"
|
||||
android:text="@string/popular_warning_message" >
|
||||
</TextView>
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/set_default"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="12.0dp"
|
||||
android:layout_marginTop="8.0dp"
|
||||
android:layout_marginBottom="8.0dp"
|
||||
android:checked="false"
|
||||
android:text="@string/never_show" />
|
||||
|
||||
</merge>
|
||||
@@ -165,6 +165,9 @@
|
||||
<string name="failed_to_delete">删除失败</string>
|
||||
<string name="set_default_favorite">设为默认收藏夹</string>
|
||||
|
||||
<!-- Popular -->
|
||||
<string name="popular_warning_message">该页面中的内容基于数据统计,您尚未开启数据统计。若开启数据统计,您的行为将对该页面产生影响。是否现在开启数据统计?</string>
|
||||
|
||||
<!-- Settings -->
|
||||
<string name="display_settings_title">显示</string>
|
||||
<string name="theme_display_settings_title">主题</string>
|
||||
@@ -327,6 +330,7 @@
|
||||
<string name="rating0">感觉快要窒息了</string>
|
||||
|
||||
<!-- Util -->
|
||||
<string name="never_show">不再显示</string>
|
||||
<string name="retry">重试</string>
|
||||
<string name="local">本地</string>
|
||||
<string name="tag">标签</string>
|
||||
|
||||
@@ -166,6 +166,9 @@
|
||||
<string name="failed_to_delete">Failed to delete</string>
|
||||
<string name="set_default_favorite">Set it as default favorite</string>
|
||||
|
||||
<!-- Popular -->
|
||||
<string name="popular_warning_message">该页面中的内容基于数据统计,您尚未开启数据统计。若开启了数据统计,您的行为将对该页面产生影响。是否现在开启数据统计?</string>
|
||||
|
||||
<!-- Settings -->
|
||||
<string name="display_settings_title">Display</string>
|
||||
<string name="theme_display_settings_title">Theme</string>
|
||||
@@ -334,6 +337,7 @@
|
||||
<string name="rating0">DISASTER</string>
|
||||
|
||||
<!-- Util -->
|
||||
<string name="never_show">Never show me this dialog</string>
|
||||
<string name="retry">Retry</string>
|
||||
<string name="local">Local</string>
|
||||
<string name="tag">Tag</string>
|
||||
|
||||
@@ -1689,7 +1689,7 @@ public class EhClient {
|
||||
public static int getType(String type) {
|
||||
int i;
|
||||
for (i = 0; i < CATEGORY_STRINGS.length - 1; i++) {
|
||||
if (CATEGORY_STRINGS[i].equals(type))
|
||||
if (CATEGORY_STRINGS[i].equalsIgnoreCase(type))
|
||||
break;
|
||||
}
|
||||
return CATEGORY_VALUES[i];
|
||||
|
||||
@@ -58,6 +58,7 @@ import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu;
|
||||
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceActivity;
|
||||
import android.app.ActionBar;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.SearchManager;
|
||||
@@ -914,6 +915,38 @@ public class MangaListActivity extends AbstractGalleryActivity
|
||||
}
|
||||
}
|
||||
|
||||
private void showPopularWarningDialog() {
|
||||
DialogBuilder db = new DialogBuilder(MangaListActivity.this).
|
||||
setCancelable(false).
|
||||
setView(R.layout.popular_warning, false);
|
||||
db.setTitle(R.string.about_analyics_title);
|
||||
ViewGroup vg = db.getCustomLayout();
|
||||
final CheckBox cb = (CheckBox)vg.findViewById(R.id.set_default);
|
||||
db.setPositiveButton(android.R.string.ok, new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
((AlertButton)v).dialog.dismiss();
|
||||
if (cb.isChecked())
|
||||
Config.setPopularWarning(false);
|
||||
|
||||
Intent intent = new Intent(MangaListActivity.this,
|
||||
SettingsActivity.class);
|
||||
intent.putExtra(PreferenceActivity.EXTRA_SHOW_FRAGMENT, SettingsActivity.AboutFragment.class.getName());
|
||||
intent.putExtra(PreferenceActivity.EXTRA_NO_HEADERS, true);
|
||||
startActivity(intent);
|
||||
}
|
||||
});
|
||||
db.setNegativeButton(android.R.string.cancel, new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
((AlertButton)v).dialog.dismiss();
|
||||
if (cb.isChecked())
|
||||
Config.setPopularWarning(false);
|
||||
}
|
||||
});
|
||||
db.create().show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
@@ -1070,6 +1103,10 @@ public class MangaListActivity extends AbstractGalleryActivity
|
||||
refresh(true);
|
||||
|
||||
showContent();
|
||||
|
||||
// Show dialog
|
||||
if (!Config.getAllowAnalyics() && Config.getPopularWarning())
|
||||
showPopularWarningDialog();
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
@@ -71,6 +71,12 @@ public class SettingsActivity extends AbstractPreferenceActivity {
|
||||
@SuppressWarnings("unused")
|
||||
private static String TAG = "Settings";
|
||||
|
||||
public static final String KEY_FRAGMENT = "FRAGMENT";
|
||||
public static final int DEFAULT = -0x1;
|
||||
public static final int DISPLAY = 0x0;
|
||||
public static final int DATA = 0x1;
|
||||
public static final int ABOUT = 0x2;
|
||||
|
||||
private SystemBarConfig mSystemBarConfig;
|
||||
private List<TranslucentPreferenceFragment> mFragments;
|
||||
private ListView mListView;
|
||||
@@ -136,6 +142,17 @@ public class SettingsActivity extends AbstractPreferenceActivity {
|
||||
originPaddingBottom = mListView.getPaddingBottom();
|
||||
|
||||
adjustPadding();
|
||||
|
||||
/*
|
||||
switch (savedInstanceState.getInt(KEY_FRAGMENT, DEFAULT)) {
|
||||
case DISPLAY:
|
||||
this.star.startPreferenceFragment(fragment, true);
|
||||
break;
|
||||
case DATA:
|
||||
break;
|
||||
case ABOUT:
|
||||
break;
|
||||
}*/
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -497,7 +514,8 @@ public class SettingsActivity extends AbstractPreferenceActivity {
|
||||
}
|
||||
|
||||
public static class AboutFragment extends TranslucentPreferenceFragment
|
||||
implements Preference.OnPreferenceClickListener{
|
||||
implements Preference.OnPreferenceClickListener,
|
||||
Preference.OnPreferenceChangeListener {
|
||||
|
||||
private static final String KEY_AUTHOR = "author";
|
||||
private static final String KEY_CHANGELOG = "changelog";
|
||||
@@ -505,6 +523,7 @@ public class SettingsActivity extends AbstractPreferenceActivity {
|
||||
private static final String KEY_WEBSITE = "website";
|
||||
private static final String KEY_SOURCE = "source";
|
||||
private static final String KEY_CHECK_UPDATE = "check_for_update";
|
||||
private static final String KEY_ALLOW_ANALYICS = "allow_analyics";
|
||||
private static final String KEY_ABOUT_ANALYICS = "about_analyics";
|
||||
|
||||
private Preference mAuthor;
|
||||
@@ -513,6 +532,7 @@ public class SettingsActivity extends AbstractPreferenceActivity {
|
||||
private Preference mWebsite;
|
||||
private Preference mSource;
|
||||
private Preference mCheckUpdate;
|
||||
private CheckBoxPreference mAllowAnalyics;
|
||||
private Preference mAboutAnalyics;
|
||||
|
||||
@Override
|
||||
@@ -532,6 +552,8 @@ public class SettingsActivity extends AbstractPreferenceActivity {
|
||||
mSource.setOnPreferenceClickListener(this);
|
||||
mCheckUpdate = (Preference)findPreference(KEY_CHECK_UPDATE);
|
||||
mCheckUpdate.setOnPreferenceClickListener(this);
|
||||
mAllowAnalyics = (CheckBoxPreference)findPreference(KEY_ALLOW_ANALYICS);
|
||||
mAllowAnalyics.setOnPreferenceChangeListener(this);
|
||||
mAboutAnalyics = (Preference)findPreference(KEY_ABOUT_ANALYICS);
|
||||
mAboutAnalyics.setOnPreferenceClickListener(this);
|
||||
}
|
||||
@@ -629,5 +651,15 @@ public class SettingsActivity extends AbstractPreferenceActivity {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||
final String key = preference.getKey();
|
||||
if (KEY_ALLOW_ANALYICS.equals(key)) {
|
||||
if (!(Boolean)newValue)
|
||||
Config.setPopularWarning(true);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -66,6 +66,8 @@ public class Config {
|
||||
private static final boolean DEFAULT_SET_ANALYTICS = false;
|
||||
private static final String KEY_ALLOW_ANALYTICS = "allow_analyics";
|
||||
private static final boolean DEFAULT_ALLOW_ANALYTICS = false;
|
||||
private static final String KEY_POPULAR_WARNING = "popular_warning";
|
||||
private static final boolean DEFAULT_POPULAR_WARNING = true;
|
||||
|
||||
private static boolean mInit = false;
|
||||
|
||||
@@ -309,5 +311,15 @@ public class Config {
|
||||
|
||||
public static void setAllowAnalyics(boolean setAnalyics) {
|
||||
mConfigPre.edit().putBoolean(KEY_ALLOW_ANALYTICS, setAnalyics).apply();
|
||||
if (!setAnalyics)
|
||||
setPopularWarning(true);
|
||||
}
|
||||
|
||||
public static boolean getPopularWarning() {
|
||||
return mConfigPre.getBoolean(KEY_POPULAR_WARNING, DEFAULT_POPULAR_WARNING);
|
||||
}
|
||||
|
||||
public static void setPopularWarning(boolean popularWarning) {
|
||||
mConfigPre.edit().putBoolean(KEY_POPULAR_WARNING, popularWarning).apply();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user