Add option to show countdowntimer on pins (default off)

Also, checkboxes shouldn't show status, but description.
captchafix
Florens Douwes 11 years ago
parent 49ac791e05
commit 8d6dfc3bd3
  1. 4
      Clover/app/src/main/java/org/floens/chan/core/ChanPreferences.java
  2. 2
      Clover/app/src/main/java/org/floens/chan/ui/adapter/PinnedAdapter.java
  3. 8
      Clover/app/src/main/res/values/strings.xml
  4. 20
      Clover/app/src/main/res/xml/preference_watch.xml

@ -67,6 +67,10 @@ public class ChanPreferences {
} }
} }
public static boolean getWatchCountdownVisibleEnabled() {
return p().getBoolean("preference_watch_countdown", false);
}
public static boolean getWatchBackgroundEnabled() { public static boolean getWatchBackgroundEnabled() {
return p().getBoolean("preference_watch_background_enabled", false); return p().getBoolean("preference_watch_background_enabled", false);
} }

@ -134,7 +134,7 @@ public class PinnedAdapter extends BaseAdapter {
countContainer.setVisibility(View.VISIBLE); countContainer.setVisibility(View.VISIBLE);
TextView timeView = (TextView) convertView.findViewById(R.id.pin_time); TextView timeView = (TextView) convertView.findViewById(R.id.pin_time);
if (pin.watching && pin.getPinWatcher() != null) { if (pin.watching && pin.getPinWatcher() != null && ChanPreferences.getWatchCountdownVisibleEnabled()) {
timeContainer.setVisibility(View.VISIBLE); timeContainer.setVisibility(View.VISIBLE);
long timeRaw = pin.getPinWatcher().getTimeUntilNextLoad(); long timeRaw = pin.getPinWatcher().getTimeUntilNextLoad();
long time = 0; long time = 0;

@ -178,10 +178,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<string name="watch_summary_enabled">Watching pinned threads</string> <string name="watch_summary_enabled">Watching pinned threads</string>
<string name="watch_info_text">To watch pins for new posts, turn the thread watcher on.</string> <string name="watch_info_text">To watch pins for new posts, turn the thread watcher on.</string>
<string name="watch_countdown">Show countdown</string>
<string name="watch_countdown_description">Show a countdown left of the new post counter</string>
<string name="watch_enable_background">Enable in the background</string> <string name="watch_enable_background">Enable in the background</string>
<string name="watch_enable_background_on">Watching pins when Clover is in the background</string> <string name="watch_enable_background_description">Watch pins when Clover is in the background</string>
<string name="watch_enable_background_off">Not watching when Clover is in the background</string> <string name="watch_background_timeout_description">Time between loads in background</string>
<string name="watch_background_timeout_description">Time between reloads in background</string>
<string-array name="watch_background_timeouts"> <string-array name="watch_background_timeouts">
<item>1 minute</item> <item>1 minute</item>
<item>2 minutes</item> <item>2 minutes</item>

@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?><!--
<!--
Clover - 4chan browser https://github.com/Floens/Clover/ Clover - 4chan browser https://github.com/Floens/Clover/
Copyright (C) 2014 Floens Copyright (C) 2014 Floens
@ -19,19 +18,24 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"> <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<CheckBoxPreference <CheckBoxPreference
android:defaultValue="off"
android:key="preference_watch_countdown"
android:summary="@string/watch_countdown_description"
android:title="@string/watch_countdown" />
<CheckBoxPreference
android:defaultValue="off"
android:key="preference_watch_background_enabled" android:key="preference_watch_background_enabled"
android:summaryOff="@string/watch_enable_background_off" android:summary="@string/watch_enable_background_description"
android:summaryOn="@string/watch_enable_background_on" android:title="@string/watch_enable_background" />
android:title="@string/watch_enable_background"
android:defaultValue="off"/>
<ListPreference <ListPreference
android:dependency="preference_watch_background_enabled"
android:defaultValue="60" android:defaultValue="60"
android:dependency="preference_watch_background_enabled"
android:dialogTitle="@string/watch_background_timeout_description" android:dialogTitle="@string/watch_background_timeout_description"
android:entries="@array/watch_background_timeouts" android:entries="@array/watch_background_timeouts"
android:entryValues="@array/watch_background_timeouts_int" android:entryValues="@array/watch_background_timeouts_int"
android:key="preference_watch_background_timeout" android:key="preference_watch_background_timeout"
android:title="@string/watch_background_timeout_description"/> android:title="@string/watch_background_timeout_description" />
</PreferenceScreen> </PreferenceScreen>
Loading…
Cancel
Save