mirror of https://github.com/tasks/tasks
parent
5e5af08c44
commit
866a5bb2e6
@ -1,64 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2012 Todoroo Inc
|
||||
*
|
||||
* See the file "LICENSE" for the full license governing this code.
|
||||
*/
|
||||
package com.todoroo.astrid.activity;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.preference.Preference;
|
||||
import android.preference.PreferenceActivity;
|
||||
import android.preference.PreferenceScreen;
|
||||
|
||||
import com.todoroo.astrid.api.AstridApiConstants;
|
||||
import com.todoroo.astrid.core.DefaultsPreferences;
|
||||
import com.todoroo.astrid.core.OldTaskPreferences;
|
||||
import com.todoroo.astrid.gtasks.GtasksPreferences;
|
||||
import com.todoroo.astrid.reminders.ReminderPreferences;
|
||||
import com.todoroo.astrid.service.StartupService;
|
||||
|
||||
import org.tasks.R;
|
||||
import org.tasks.injection.InjectingPreferenceActivity;
|
||||
import org.tasks.preferences.MiscellaneousPreferences;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
/**
|
||||
* Displays the preference screen for users to edit their preferences
|
||||
*
|
||||
* @author Tim Su <tim@todoroo.com>
|
||||
*
|
||||
*/
|
||||
public class EditPreferences extends InjectingPreferenceActivity {
|
||||
|
||||
// --- instance variables
|
||||
|
||||
@Inject StartupService startupService;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
startupService.onStartupApplication(this);
|
||||
|
||||
addPreferencesFromResource(R.xml.preferences);
|
||||
|
||||
PreferenceScreen screen= getPreferenceScreen();
|
||||
addPreferencesFromResource(R.xml.preferences_appearance);
|
||||
screen.addPreference(getPreference(ReminderPreferences.class, R.string.notifications));
|
||||
screen.addPreference(getPreference(DefaultsPreferences.class, R.string.task_defaults));
|
||||
screen.addPreference(getPreference(GtasksPreferences.class, R.string.synchronization));
|
||||
addPreferencesFromResource(R.xml.preferences_backup);
|
||||
screen.addPreference(getPreference(OldTaskPreferences.class, R.string.EPr_manage_header));
|
||||
screen.addPreference(getPreference(MiscellaneousPreferences.class, R.string.miscellaneous));
|
||||
}
|
||||
|
||||
private Preference getPreference(final Class<? extends PreferenceActivity> klass, final int label) {
|
||||
return new Preference(this) {{
|
||||
setTitle(getResources().getString(label));
|
||||
setIntent(new Intent(EditPreferences.this, klass) {{
|
||||
setAction(AstridApiConstants.ACTION_SETTINGS);
|
||||
}});
|
||||
}};
|
||||
}
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package org.tasks.preferences;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
import org.tasks.R;
|
||||
import org.tasks.injection.InjectingPreferenceActivity;
|
||||
|
||||
public class BasicPreferences extends InjectingPreferenceActivity {
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
String action = getIntent().getAction();
|
||||
if (action == null) {
|
||||
addPreferencesFromResource(R.xml.preferences);
|
||||
} else if (action.equals(getString(R.string.EPr_appearance_header))) {
|
||||
toolbar.setTitle(getString(R.string.EPr_appearance_header));
|
||||
addPreferencesFromResource(R.xml.preferences_appearance);
|
||||
} else if (action.equals(getString(R.string.backup_BPr_header))) {
|
||||
toolbar.setTitle(getString(R.string.backup_BPr_header));
|
||||
addPreferencesFromResource(R.xml.preferences_backup);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?attr/asContentBackground"
|
||||
android:orientation="vertical">
|
||||
|
||||
<include layout="@layout/toolbar" />
|
||||
|
||||
</LinearLayout>
|
@ -1,11 +1,48 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
** Copyright (c) 2012 Todoroo Inc
|
||||
**
|
||||
** See the file "LICENSE" for the full license governing this code.
|
||||
-->
|
||||
<PreferenceScreen
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:title="@string/EPr_title">
|
||||
|
||||
</PreferenceScreen>
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<Preference android:title="@string/EPr_appearance_header">
|
||||
<intent
|
||||
android:action="@string/EPr_appearance_header"
|
||||
android:targetClass="org.tasks.preferences.BasicPreferences"
|
||||
android:targetPackage="org.tasks" />
|
||||
</Preference>
|
||||
|
||||
<Preference android:title="@string/notifications">
|
||||
<intent
|
||||
android:targetClass="com.todoroo.astrid.reminders.ReminderPreferences"
|
||||
android:targetPackage="org.tasks" />
|
||||
</Preference>
|
||||
|
||||
<Preference android:title="@string/task_defaults">
|
||||
<intent
|
||||
android:targetClass="com.todoroo.astrid.core.DefaultsPreferences"
|
||||
android:targetPackage="org.tasks" />
|
||||
</Preference>
|
||||
|
||||
<Preference android:title="@string/synchronization">
|
||||
<intent
|
||||
android:targetClass="com.todoroo.astrid.gtasks.GtasksPreferences"
|
||||
android:targetPackage="org.tasks" />
|
||||
</Preference>
|
||||
|
||||
<Preference android:title="@string/backup_BPr_header">
|
||||
<intent
|
||||
android:action="@string/backup_BPr_header"
|
||||
android:targetClass="org.tasks.preferences.BasicPreferences"
|
||||
android:targetPackage="org.tasks" />
|
||||
</Preference>
|
||||
|
||||
<Preference android:title="@string/EPr_manage_header">
|
||||
<intent
|
||||
android:targetClass="com.todoroo.astrid.core.OldTaskPreferences"
|
||||
android:targetPackage="org.tasks" />
|
||||
</Preference>
|
||||
|
||||
<Preference android:title="@string/miscellaneous">
|
||||
<intent
|
||||
android:targetClass="org.tasks.preferences.MiscellaneousPreferences"
|
||||
android:targetPackage="org.tasks" />
|
||||
</Preference>
|
||||
|
||||
</PreferenceScreen>
|
Loading…
Reference in New Issue