Add Help & About section to settings

pull/253/head
Alex Baker 10 years ago
parent ea3baf027b
commit d0f97a1354

@ -344,8 +344,7 @@
<activity
android:name="com.todoroo.astrid.gtasks.GtasksPreferences"
android:label="@string/synchronization"
android:theme="@style/Tasks"
android:screenOrientation="portrait"/>
android:theme="@style/Tasks" />
<activity
android:name=".activities.ClearGtaskDataActivity"

@ -35,7 +35,7 @@ public class BeastModePreferences extends InjectingListActivity {
private ArrayList<String> items;
public static final String BEAST_MODE_ORDER_PREF = "beast_mode_order"; //$NON-NLS-1$
public static final String BEAST_MODE_ORDER_PREF = "beast_mode_order_v2"; //$NON-NLS-1$
public static final String BEAST_MODE_PREF_ITEM_SEPARATOR = ";"; //$NON-NLS-1$

@ -1,12 +1,18 @@
package org.tasks.preferences;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import org.tasks.R;
import org.tasks.injection.InjectingPreferenceActivity;
import javax.inject.Inject;
public class BasicPreferences extends InjectingPreferenceActivity {
@Inject DeviceInfo deviceInfo;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@ -14,6 +20,14 @@ public class BasicPreferences extends InjectingPreferenceActivity {
String action = getIntent().getAction();
if (action == null) {
addPreferencesFromResource(R.xml.preferences);
findPreference(getString(R.string.contact_developer)).setIntent(
new Intent(Intent.ACTION_SENDTO, Uri.fromParts("mailto", "Alex Baker<baker.alex+tasks@gmail.com>", null)) {{
putExtra(Intent.EXTRA_SUBJECT, "Tasks Feedback");
putExtra(Intent.EXTRA_TEXT, deviceInfo.getDebugInfo());
}});
if (!deviceInfo.isPlayStoreAvailable()) {
getPreferenceScreen().removePreference(findPreference(getString(R.string.rate_tasks)));
}
} else if (action.equals(getString(R.string.EPr_appearance_header))) {
toolbar.setTitle(getString(R.string.EPr_appearance_header));
addPreferencesFromResource(R.xml.preferences_appearance);

@ -0,0 +1,87 @@
package org.tasks.preferences;
import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.os.Build;
import com.google.api.client.repackaged.com.google.common.base.Joiner;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.tasks.BuildConfig;
import org.tasks.injection.ForApplication;
import java.util.List;
import javax.inject.Inject;
import javax.inject.Singleton;
import static java.util.Arrays.asList;
@Singleton
public class DeviceInfo {
private static final Logger log = LoggerFactory.getLogger(DeviceInfo.class);
private Context context;
private Boolean isPlayStoreAvailable;
private String debugInfo;
@Inject
public DeviceInfo(@ForApplication Context context) {
this.context = context;
}
public boolean isPlayStoreAvailable() {
if (isPlayStoreAvailable == null) {
isPlayStoreAvailable = checkForPlayStore();
}
return isPlayStoreAvailable;
}
public String getDebugInfo() {
if (debugInfo == null) {
debugInfo = buildDebugString();
}
return debugInfo;
}
private String buildDebugString() {
try {
return Joiner.on("\n").join(asList(
"",
"",
"----------",
"Tasks: " + BuildConfig.VERSION_NAME + " (build " + BuildConfig.VERSION_CODE + ")",
"Android: " + Build.VERSION.RELEASE,
"Model: " + Build.MANUFACTURER + " " + Build.MODEL,
"Product: " + Build.PRODUCT + " (" + Build.DEVICE + ")",
"Kernel: " + System.getProperty("os.version") + " (" + Build.VERSION.INCREMENTAL + ")",
"----------",
"",
""
));
} catch(Exception e) {
log.error(e.getMessage(), e);
}
return "";
}
private boolean checkForPlayStore() {
try {
PackageManager packageManager = context.getPackageManager();
List<PackageInfo> packages = packageManager.getInstalledPackages(PackageManager.GET_UNINSTALLED_PACKAGES);
for (PackageInfo packageInfo : packages) {
if ("com.google.market".equals(packageInfo.packageName) || "com.android.vending".equals(packageInfo.packageName)) {
return true;
}
}
} catch(Exception e) {
log.error(e.getMessage(), e);
}
return false;
}
}

@ -62,10 +62,6 @@ public class Preferences {
return getBoolean(WidgetConfigActivity.PREF_DARK_THEME + widgetId, legacySetting);
}
public SharedPreferences getPrefs() {
return prefs;
}
public void clear() {
prefs
.edit()

@ -57,7 +57,6 @@
<string name="p_calendar_reminders">p_calendar_reminder</string>
<!-- filters to show -->
<string name="p_show_my_tasks_filter">p_show_my_tasks_f</string>
<string name="p_show_today_filter">p_show_today_f</string>
<string name="p_show_recently_modified_filter">p_show_recently_modified_f</string>
<string name="p_show_not_in_list_filter">p_show_no_list_f</string>

@ -82,6 +82,12 @@
<string name="enabled">Enabled</string>
<string name="font_size">Font size</string>
<string name="customize_edit_screen">Customize edit screen</string>
<string name="source_code">Source code</string>
<string name="translations">Translations</string>
<string name="report_an_issue">Report an issue</string>
<string name="help_and_feedback">Help &amp; Feedback</string>
<string name="contact_developer">Contact developer</string>
<string name="rate_tasks">Rate Tasks</string>
<string-array name="sync_SPr_interval_entries">
<!-- sync_SPr_interval_entries: Synchronization Intervals -->

@ -45,4 +45,38 @@
android:targetPackage="org.tasks" />
</Preference>
<PreferenceCategory android:title="@string/help_and_feedback">
<Preference android:title="@string/source_code">
<intent
android:action="android.intent.action.VIEW"
android:data="https://github.com/abaker/tasks" />
</Preference>
<Preference android:title="@string/translations">
<intent
android:action="android.intent.action.VIEW"
android:data="https://github.com/abaker/tasks/wiki/Translations" />
</Preference>
<Preference android:title="@string/report_an_issue">
<intent
android:action="android.intent.action.VIEW"
android:data="https://github.com/abaker/tasks/issues" />
</Preference>
<Preference
android:title="@string/rate_tasks"
android:key="@string/rate_tasks">
<intent
android:action="android.intent.action.VIEW"
android:data="market://details?id=org.tasks" />
</Preference>
<Preference
android:key="@string/contact_developer"
android:title="@string/contact_developer"/>
</PreferenceCategory>
</PreferenceScreen>

@ -46,11 +46,6 @@
</PreferenceCategory>
<PreferenceCategory android:title="@string/EPr_filters_to_show_title">
<com.todoroo.astrid.ui.MultilineCheckboxPreference
android:defaultValue="true"
android:enabled="false"
android:key="@string/p_show_my_tasks_filter"
android:title="@string/BFE_Active" />
<com.todoroo.astrid.ui.MultilineCheckboxPreference
android:defaultValue="true"
android:key="@string/p_show_today_filter"

Loading…
Cancel
Save