Remove Astrid.com synchronization

pull/14/head
Alex Baker 11 years ago
parent e060d36256
commit dc6803facc

@ -1,11 +1,11 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Astrid" type="AndroidRunConfigurationType" factoryName="Android Application">
<configuration default="false" name="Astrid Emulator" type="AndroidRunConfigurationType" factoryName="Android Application">
<module name="astrid" />
<option name="ACTIVITY_CLASS" value="" />
<option name="MODE" value="default_activity" />
<option name="DEPLOY" value="true" />
<option name="TARGET_SELECTION_MODE" value="SHOW_DIALOG" />
<option name="PREFERRED_AVD" value="" />
<option name="TARGET_SELECTION_MODE" value="EMULATOR" />
<option name="PREFERRED_AVD" value="N4" />
<option name="USE_COMMAND_LINE" value="true" />
<option name="COMMAND_LINE" value="" />
<option name="WIPE_USER_DATA" value="false" />

@ -4,4 +4,4 @@
<string name="hello">Hello World, Main!</string>
<string name="app_name">AAC Encoder</string>
</resources>
</resources>

@ -244,7 +244,7 @@ msgstr ""
#. Sync label subtitle
msgctxt "SyP_summary"
msgid "Astrid.com, Google Tasks, saved data, local backup"
msgid "Google Tasks, saved data, local backup"
msgstr ""
#. Error msg when io exception

@ -245,7 +245,7 @@ msgstr ""
#. Sync label subtitle
msgctxt "SyP_summary"
msgid "Astrid.com, Google Tasks, saved data, local backup"
msgid "Google Tasks, saved data, local backup"
msgstr ""
#. Error msg when io exception

@ -248,7 +248,7 @@ msgstr ""
#. Sync label subtitle
msgctxt "SyP_summary"
msgid "Astrid.com, Google Tasks, saved data, local backup"
msgid "Google Tasks, saved data, local backup"
msgstr ""
#. Error msg when io exception

@ -248,7 +248,7 @@ msgstr ""
#. Sync label subtitle
msgctxt "SyP_summary"
msgid "Astrid.com, Google Tasks, saved data, local backup"
msgid "Google Tasks, saved data, local backup"
msgstr ""
#. Error msg when io exception

@ -248,8 +248,8 @@ msgstr "Synchronizace"
#. Sync label subtitle
msgctxt "SyP_summary"
msgid "Astrid.com, Google Tasks, saved data, local backup"
msgstr "Astrid.com, Google Tasks, uložená data, lokální záloha"
msgid "Google Tasks, saved data, local backup"
msgstr "Google Tasks, uložená data, lokální záloha"
#. Error msg when io exception
msgctxt "SyP_ioerror"

@ -245,7 +245,7 @@ msgstr "Synkronisering"
#. Sync label subtitle
msgctxt "SyP_summary"
msgid "Astrid.com, Google Tasks, saved data, local backup"
msgid "Google Tasks, saved data, local backup"
msgstr ""
#. Error msg when io exception

@ -248,8 +248,8 @@ msgstr "Synchronisation"
#. Sync label subtitle
msgctxt "SyP_summary"
msgid "Astrid.com, Google Tasks, saved data, local backup"
msgstr "Astrid.com, Google Tasks, gespeicherte Daten, lokale Backups"
msgid "Google Tasks, saved data, local backup"
msgstr "Google Tasks, gespeicherte Daten, lokale Backups"
#. Error msg when io exception
msgctxt "SyP_ioerror"

@ -245,7 +245,7 @@ msgstr "Συγχρονισμός"
#. Sync label subtitle
msgctxt "SyP_summary"
msgid "Astrid.com, Google Tasks, saved data, local backup"
msgid "Google Tasks, saved data, local backup"
msgstr ""
#. Error msg when io exception

@ -244,7 +244,7 @@ msgstr ""
#. Sync label subtitle
msgctxt "SyP_summary"
msgid "Astrid.com, Google Tasks, saved data, local backup"
msgid "Google Tasks, saved data, local backup"
msgstr ""
#. Error msg when io exception

@ -245,7 +245,7 @@ msgstr "Sinkronigo"
#. Sync label subtitle
msgctxt "SyP_summary"
msgid "Astrid.com, Google Tasks, saved data, local backup"
msgid "Google Tasks, saved data, local backup"
msgstr ""
#. Error msg when io exception

@ -248,9 +248,9 @@ msgstr "Sincronización y copia de seguridad"
#. Sync label subtitle
msgctxt "SyP_summary"
msgid "Astrid.com, Google Tasks, saved data, local backup"
msgid "Google Tasks, saved data, local backup"
msgstr ""
"Astrid.com, Google Tasks, información guardada, copia de seguridad local"
"Google Tasks, información guardada, copia de seguridad local"
#. Error msg when io exception
msgctxt "SyP_ioerror"

@ -245,7 +245,7 @@ msgstr ""
#. Sync label subtitle
msgctxt "SyP_summary"
msgid "Astrid.com, Google Tasks, saved data, local backup"
msgid "Google Tasks, saved data, local backup"
msgstr ""
#. Error msg when io exception

@ -248,7 +248,7 @@ msgstr ""
#. Sync label subtitle
msgctxt "SyP_summary"
msgid "Astrid.com, Google Tasks, saved data, local backup"
msgid "Google Tasks, saved data, local backup"
msgstr ""
#. Error msg when io exception

@ -245,7 +245,7 @@ msgstr ""
#. Sync label subtitle
msgctxt "SyP_summary"
msgid "Astrid.com, Google Tasks, saved data, local backup"
msgid "Google Tasks, saved data, local backup"
msgstr ""
#. Error msg when io exception

@ -245,7 +245,7 @@ msgstr ""
#. Sync label subtitle
msgctxt "SyP_summary"
msgid "Astrid.com, Google Tasks, saved data, local backup"
msgid "Google Tasks, saved data, local backup"
msgstr ""
#. Error msg when io exception

@ -248,8 +248,8 @@ msgstr "Synchronisation"
#. Sync label subtitle
msgctxt "SyP_summary"
msgid "Astrid.com, Google Tasks, saved data, local backup"
msgstr "Astrid.com, Tâches Google, données enregistrées, sauvegarde locale"
msgid "Google Tasks, saved data, local backup"
msgstr "Tâches Google, données enregistrées, sauvegarde locale"
#. Error msg when io exception
msgctxt "SyP_ioerror"

@ -244,7 +244,7 @@ msgstr ""
#. Sync label subtitle
msgctxt "SyP_summary"
msgid "Astrid.com, Google Tasks, saved data, local backup"
msgid "Google Tasks, saved data, local backup"
msgstr ""
#. Error msg when io exception

@ -245,7 +245,7 @@ msgstr ""
#. Sync label subtitle
msgctxt "SyP_summary"
msgid "Astrid.com, Google Tasks, saved data, local backup"
msgid "Google Tasks, saved data, local backup"
msgstr ""
#. Error msg when io exception

@ -248,7 +248,7 @@ msgstr ""
#. Sync label subtitle
msgctxt "SyP_summary"
msgid "Astrid.com, Google Tasks, saved data, local backup"
msgid "Google Tasks, saved data, local backup"
msgstr ""
#. Error msg when io exception

@ -245,7 +245,7 @@ msgstr ""
#. Sync label subtitle
msgctxt "SyP_summary"
msgid "Astrid.com, Google Tasks, saved data, local backup"
msgid "Google Tasks, saved data, local backup"
msgstr ""
#. Error msg when io exception

@ -245,7 +245,7 @@ msgstr ""
#. Sync label subtitle
msgctxt "SyP_summary"
msgid "Astrid.com, Google Tasks, saved data, local backup"
msgid "Google Tasks, saved data, local backup"
msgstr ""
#. Error msg when io exception

@ -245,7 +245,7 @@ msgstr ""
#. Sync label subtitle
msgctxt "SyP_summary"
msgid "Astrid.com, Google Tasks, saved data, local backup"
msgid "Google Tasks, saved data, local backup"
msgstr ""
#. Error msg when io exception

@ -248,7 +248,7 @@ msgstr ""
#. Sync label subtitle
msgctxt "SyP_summary"
msgid "Astrid.com, Google Tasks, saved data, local backup"
msgid "Google Tasks, saved data, local backup"
msgstr ""
#. Error msg when io exception

@ -245,7 +245,7 @@ msgstr "同期"
#. Sync label subtitle
msgctxt "SyP_summary"
msgid "Astrid.com, Google Tasks, saved data, local backup"
msgid "Google Tasks, saved data, local backup"
msgstr ""
#. Error msg when io exception

@ -245,7 +245,7 @@ msgstr ""
#. Sync label subtitle
msgctxt "SyP_summary"
msgid "Astrid.com, Google Tasks, saved data, local backup"
msgid "Google Tasks, saved data, local backup"
msgstr ""
#. Error msg when io exception

@ -248,8 +248,8 @@ msgstr "동기화 & 백업"
#. Sync label subtitle
msgctxt "SyP_summary"
msgid "Astrid.com, Google Tasks, saved data, local backup"
msgstr "Astrid.com, 구글 일정, 저장한 자료, 로컬 백업"
msgid "Google Tasks, saved data, local backup"
msgstr "구글 일정, 저장한 자료, 로컬 백업"
#. Error msg when io exception
msgctxt "SyP_ioerror"

@ -245,7 +245,7 @@ msgstr "Sinchronizacija"
#. Sync label subtitle
msgctxt "SyP_summary"
msgid "Astrid.com, Google Tasks, saved data, local backup"
msgid "Google Tasks, saved data, local backup"
msgstr ""
#. Error msg when io exception

@ -245,7 +245,7 @@ msgstr ""
#. Sync label subtitle
msgctxt "SyP_summary"
msgid "Astrid.com, Google Tasks, saved data, local backup"
msgid "Google Tasks, saved data, local backup"
msgstr ""
#. Error msg when io exception

@ -248,7 +248,7 @@ msgstr ""
#. Sync label subtitle
msgctxt "SyP_summary"
msgid "Astrid.com, Google Tasks, saved data, local backup"
msgid "Google Tasks, saved data, local backup"
msgstr ""
#. Error msg when io exception

@ -248,7 +248,7 @@ msgstr "Synchronisatie"
#. Sync label subtitle
msgctxt "SyP_summary"
msgid "Astrid.com, Google Tasks, saved data, local backup"
msgid "Google Tasks, saved data, local backup"
msgstr ""
#. Error msg when io exception

@ -248,7 +248,7 @@ msgstr "Synchronizacja"
#. Sync label subtitle
msgctxt "SyP_summary"
msgid "Astrid.com, Google Tasks, saved data, local backup"
msgid "Google Tasks, saved data, local backup"
msgstr ""
#. Error msg when io exception

@ -245,7 +245,7 @@ msgstr "Sincronização"
#. Sync label subtitle
msgctxt "SyP_summary"
msgid "Astrid.com, Google Tasks, saved data, local backup"
msgid "Google Tasks, saved data, local backup"
msgstr ""
#. Error msg when io exception

@ -248,7 +248,7 @@ msgstr "Sincronização"
#. Sync label subtitle
msgctxt "SyP_summary"
msgid "Astrid.com, Google Tasks, saved data, local backup"
msgid "Google Tasks, saved data, local backup"
msgstr ""
#. Error msg when io exception

@ -245,7 +245,7 @@ msgstr ""
#. Sync label subtitle
msgctxt "SyP_summary"
msgid "Astrid.com, Google Tasks, saved data, local backup"
msgid "Google Tasks, saved data, local backup"
msgstr ""
#. Error msg when io exception

@ -248,9 +248,9 @@ msgstr "Синхронизация"
#. Sync label subtitle
msgctxt "SyP_summary"
msgid "Astrid.com, Google Tasks, saved data, local backup"
msgid "Google Tasks, saved data, local backup"
msgstr ""
"Astrid.com, Задачи Google, сохраненные данные, локальная резервная копия"
"Задачи Google, сохраненные данные, локальная резервная копия"
#. Error msg when io exception
msgctxt "SyP_ioerror"

@ -244,7 +244,7 @@ msgstr ""
#. Sync label subtitle
msgctxt "SyP_summary"
msgid "Astrid.com, Google Tasks, saved data, local backup"
msgid "Google Tasks, saved data, local backup"
msgstr ""
#. Error msg when io exception

@ -247,7 +247,7 @@ msgstr "Usklajevanje"
#. Sync label subtitle
msgctxt "SyP_summary"
msgid "Astrid.com, Google Tasks, saved data, local backup"
msgid "Google Tasks, saved data, local backup"
msgstr ""
#. Error msg when io exception

@ -248,7 +248,7 @@ msgstr "Synkronisering"
#. Sync label subtitle
msgctxt "SyP_summary"
msgid "Astrid.com, Google Tasks, saved data, local backup"
msgid "Google Tasks, saved data, local backup"
msgstr ""
#. Error msg when io exception

@ -245,7 +245,7 @@ msgstr ""
#. Sync label subtitle
msgctxt "SyP_summary"
msgid "Astrid.com, Google Tasks, saved data, local backup"
msgid "Google Tasks, saved data, local backup"
msgstr ""
#. Error msg when io exception

@ -245,7 +245,7 @@ msgstr ""
#. Sync label subtitle
msgctxt "SyP_summary"
msgid "Astrid.com, Google Tasks, saved data, local backup"
msgid "Google Tasks, saved data, local backup"
msgstr ""
#. Error msg when io exception

@ -248,7 +248,7 @@ msgstr ""
#. Sync label subtitle
msgctxt "SyP_summary"
msgid "Astrid.com, Google Tasks, saved data, local backup"
msgid "Google Tasks, saved data, local backup"
msgstr ""
#. Error msg when io exception

@ -248,8 +248,8 @@ msgstr "Синхронізація"
#. Sync label subtitle
msgctxt "SyP_summary"
msgid "Astrid.com, Google Tasks, saved data, local backup"
msgstr "Astrid.com, Google Tasks, збережні дані, локальна резервна копія"
msgid "Google Tasks, saved data, local backup"
msgstr "Google Tasks, збережні дані, локальна резервна копія"
#. Error msg when io exception
msgctxt "SyP_ioerror"

@ -245,7 +245,7 @@ msgstr ""
#. Sync label subtitle
msgctxt "SyP_summary"
msgid "Astrid.com, Google Tasks, saved data, local backup"
msgid "Google Tasks, saved data, local backup"
msgstr ""
#. Error msg when io exception

@ -248,8 +248,8 @@ msgstr "同步和备份"
#. Sync label subtitle
msgctxt "SyP_summary"
msgid "Astrid.com, Google Tasks, saved data, local backup"
msgstr "Astrid.com谷歌任务,已存数据,本地备份"
msgid "Google Tasks, saved data, local backup"
msgstr "谷歌任务,已存数据,本地备份"
#. Error msg when io exception
msgctxt "SyP_ioerror"

@ -248,8 +248,8 @@ msgstr "同步和備份"
#. Sync label subtitle
msgctxt "SyP_summary"
msgid "Astrid.com, Google Tasks, saved data, local backup"
msgstr "Astrid.com谷歌任務,已存數據,本地備份"
msgid "Google Tasks, saved data, local backup"
msgstr "谷歌任務,已存數據,本地備份"
#. Error msg when io exception
msgctxt "SyP_ioerror"
@ -443,4 +443,4 @@ msgstr "每3天"
msgctxt "sync_SPr_interval_entries:9"
msgid "every week"
msgstr "每週"
msgstr "每週"

@ -72,7 +72,7 @@
<string name="SyP_progress">Probíhá synchronizace Vašich úkolů...</string>
<string name="SyP_progress_toast">Sychronizuji...</string>
<string name="SyP_label">Synchronizace</string>
<string name="SyP_summary">Astrid.com, Google Tasks, uložená data, lokální záloha</string>
<string name="SyP_summary">Google Tasks, uložená data, lokální záloha</string>
<string name="SyP_ioerror">Chyba připojení! Zkontrolujte vaše internetové připojení.</string>
<string name="sync_SPr_group_status">Stav</string>
<string name="sync_SPr_status_subtitle">Stav: %s</string>

@ -155,7 +155,7 @@
<string name="Sync_now_label">Jetzt synchronisieren</string>
<!-- Sync label subtitle -->
<string name="SyP_summary">Astrid.com, Google Tasks, gespeicherte Daten, lokale Backups</string>
<string name="SyP_summary">Google Tasks, gespeicherte Daten, lokale Backups</string>
<!-- Error msg when io exception -->
<string name="SyP_ioerror">Verbindungsfehler! Überprüfen Sie Ihre Internetverbindung.</string>

@ -155,7 +155,7 @@
<string name="Sync_now_label">Sincronizar ahora</string>
<!-- Sync label subtitle -->
<string name="SyP_summary">Astrid.com, Google Tasks, información guardada, copia de seguridad local</string>
<string name="SyP_summary">Google Tasks, información guardada, copia de seguridad local</string>
<!-- Error msg when io exception -->
<string name="SyP_ioerror">¡Error de conexión! Verifique su conexión a internet.</string>

@ -155,7 +155,7 @@
<string name="Sync_now_label">Sync now</string>
<!-- Sync label subtitle -->
<string name="SyP_summary">Astrid.com, Tâches Google, données enregistrées, sauvegarde locale</string>
<string name="SyP_summary">Tâches Google, données enregistrées, sauvegarde locale</string>
<!-- Error msg when io exception -->
<string name="SyP_ioerror">Erreur de connexion ! Veuillez vérifier votre connexion Internet.</string>

@ -155,7 +155,7 @@
<string name="Sync_now_label">Sync now</string>
<!-- Sync label subtitle -->
<string name="SyP_summary">Astrid.com, Attività Google, dati salvati, backup locale </string>
<string name="SyP_summary">Attività Google, dati salvati, backup locale </string>
<!-- Error msg when io exception -->
<string name="SyP_ioerror">Errore di Connessione! Controlla la tua connessione Internet.</string>

@ -155,7 +155,7 @@
<string name="Sync_now_label">Sync now</string>
<!-- Sync label subtitle -->
<string name="SyP_summary">Astrid.com, Google Tasks, saved data, local backup</string>
<string name="SyP_summary">Google Tasks, saved data, local backup</string>
<!-- Error msg when io exception -->
<string name="SyP_ioerror">接続エラー!インターネットに接続できるか確認してください。</string>

@ -155,7 +155,7 @@
<string name="Sync_now_label">지금 동기화하기</string>
<!-- Sync label subtitle -->
<string name="SyP_summary">Astrid.com, 구글 일정, 저장한 자료, 로컬 백업</string>
<string name="SyP_summary">구글 일정, 저장한 자료, 로컬 백업</string>
<!-- Error msg when io exception -->
<string name="SyP_ioerror">연결 오류! 인터넷 연결을 확인하세요.</string>

@ -155,7 +155,7 @@
<string name="Sync_now_label">Nu synchroniseren</string>
<!-- Sync label subtitle -->
<string name="SyP_summary">Astrid.com, Google Taken, opgeslagen data, lokale back-up</string>
<string name="SyP_summary">Google Taken, opgeslagen data, lokale back-up</string>
<!-- Error msg when io exception -->
<string name="SyP_ioerror">Verbindingsfout! Controleer de internetverbinding</string>

@ -155,7 +155,7 @@
<string name="Sync_now_label">Zsynchronizuj</string>
<!-- Sync label subtitle -->
<string name="SyP_summary">Astrid.com, Zadania Google, zapisane dane, lokalna kopia zapasowa</string>
<string name="SyP_summary">Zadania Google, zapisane dane, lokalna kopia zapasowa</string>
<!-- Error msg when io exception -->
<string name="SyP_ioerror">Błąd połączenia! Sprawdź swoje połączenie z Internetem!</string>

@ -155,7 +155,7 @@
<string name="Sync_now_label">Sync now</string>
<!-- Sync label subtitle -->
<string name="SyP_summary">Astrid.com, Google Tasks, dados salvos, backup local</string>
<string name="SyP_summary">Google Tasks, dados salvos, backup local</string>
<!-- Error msg when io exception -->
<string name="SyP_ioerror">Erro na Conexão! Verifique sua conexão com a internet.</string>

@ -155,7 +155,7 @@
<string name="Sync_now_label">Синхронизировать</string>
<!-- Sync label subtitle -->
<string name="SyP_summary">Astrid.com, Задачи Google, сохраненные данные, локальная резервная копия</string>
<string name="SyP_summary">Задачи Google, сохраненные данные, локальная резервная копия</string>
<!-- Error msg when io exception -->
<string name="SyP_ioerror">Ошибка соединения! Проверьте подключение к интернету.</string>

@ -155,7 +155,7 @@
<string name="Sync_now_label">Sync now</string>
<!-- Sync label subtitle -->
<string name="SyP_summary">Astrid.com, Google Aktiviteter, sparad data, lokal backup</string>
<string name="SyP_summary">Google Aktiviteter, sparad data, lokal backup</string>
<!-- Error msg when io exception -->
<string name="SyP_ioerror">Tillkopplingsfel! Kontrollera din tillkoppling till internet.</string>

@ -155,7 +155,7 @@
<string name="Sync_now_label">Sync now</string>
<!-- Sync label subtitle -->
<string name="SyP_summary">Astrid.com, Google Tasks, saved data, local backup</string>
<string name="SyP_summary">Google Tasks, saved data, local backup</string>
<!-- Error msg when io exception -->
<string name="SyP_ioerror">Bağlantı Hatası! Internet bağlantınızı denetleyin.</string>

@ -155,7 +155,7 @@
<string name="Sync_now_label">Sync now</string>
<!-- Sync label subtitle -->
<string name="SyP_summary">Astrid.com谷歌任务,已存数据,本地备份</string>
<string name="SyP_summary">谷歌任务,已存数据,本地备份</string>
<!-- Error msg when io exception -->
<string name="SyP_ioerror">连接错误!请检查您的因特网连接。</string>

@ -155,7 +155,7 @@
<string name="Sync_now_label">Sync now</string>
<!-- Sync label subtitle -->
<string name="SyP_summary">Astrid.com谷歌任務,已存數據,本地備份</string>
<string name="SyP_summary">谷歌任務,已存數據,本地備份</string>
<!-- Error msg when io exception -->
<string name="SyP_ioerror">連結錯誤! 檢查您的網際網路連線.</string>

@ -155,7 +155,7 @@
<string name="Sync_now_label">Sync now</string>
<!-- Sync label subtitle -->
<string name="SyP_summary">Astrid.com, Google Tasks, saved data, local backup</string>
<string name="SyP_summary">Google Tasks, saved data, local backup</string>
<!-- Error msg when io exception -->
<string name="SyP_ioerror">Connection Error! Check your Internet connection.</string>

@ -358,30 +358,10 @@
</receiver>
<!-- actfm -->
<activity android:name="com.todoroo.astrid.actfm.ActFmLoginActivity"
android:configChanges="keyboardHidden"/>
<activity android:name="com.facebook.LoginActivity" />
<activity android:name="com.todoroo.astrid.actfm.ActFmPreferences"
android:theme="@android:style/Theme"
android:label="@string/actfm_APr_header">
<meta-data android:name="category"
android:resource="@string/SyP_label" />
<meta-data android:name="syncAction"
android:value="true" />
<intent-filter>
<action android:name="com.todoroo.astrid.SETTINGS" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity android:name="com.todoroo.astrid.actfm.ActFmGoogleAuthActivity"
<activity android:name="com.facebook.LoginActivity" />
<activity android:name="com.todoroo.astrid.actfm.ActFmGoogleAuthActivity"
android:theme="@style/Theme" android:configChanges="orientation|keyboardHidden"/>
<service android:name="com.todoroo.astrid.actfm.ActFmBackgroundService">
<intent-filter>
<action android:name="com.todoroo.astrid.actfm.SYNC" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</service>
<activity android:name="com.todoroo.astrid.actfm.TagViewWrapperActivity"
<activity android:name="com.todoroo.astrid.actfm.TagViewWrapperActivity"
android:windowSoftInputMode="stateHidden|adjustResize"
android:theme="@style/Theme">
<intent-filter>

@ -350,7 +350,7 @@ msgid ""
"Astrid.com lets you access your tasks online, share, and delegate with "
"others."
msgstr ""
"Astrid.com, görevlerinize çevrimiçi ulaşmanızı, paylaşmanızı ve diğerleriyle "
"görevlerinize çevrimiçi ulaşmanızı, paylaşmanızı ve diğerleriyle "
"görev paylaşımı yapmanızı sağlar."
#. share login: Sharing Login FB Prompt

@ -29,7 +29,6 @@ import com.todoroo.astrid.actfm.TagViewFragment;
import com.todoroo.astrid.actfm.sync.ActFmPreferenceService;
import com.todoroo.astrid.actfm.sync.ActFmSyncService;
import com.todoroo.astrid.actfm.sync.ActFmSyncThread;
import com.todoroo.astrid.actfm.sync.ActFmSyncV2Provider;
import com.todoroo.astrid.actfm.sync.messages.BriefMe;
import com.todoroo.astrid.activity.ShortcutActivity;
import com.todoroo.astrid.activity.TaskListActivity;
@ -121,11 +120,7 @@ public class GCMIntentService extends GCMBaseIntentService {
protected void onMessage(Context context, Intent intent) {
if (actFmPreferenceService.isLoggedIn()) {
if(intent.hasExtra("web_update")) {
if (DateUtilities.now() - actFmPreferenceService.getLastSyncDate() > MIN_MILLIS_BETWEEN_FULL_SYNCS && !actFmPreferenceService.isOngoing()) {
new ActFmSyncV2Provider().synchronizeActiveTasks(false, refreshOnlyCallback);
} else {
handleWebUpdate(intent);
}
handleWebUpdate(intent);
} else {
handleMessage(intent);
}

@ -1,52 +0,0 @@
/**
* Copyright (c) 2012 Todoroo Inc
*
* See the file "LICENSE" for the full license governing this code.
*/
package com.todoroo.astrid.actfm;
import com.todoroo.andlib.service.Autowired;
import com.todoroo.andlib.service.DependencyInjectionService;
import com.todoroo.astrid.actfm.sync.ActFmPreferenceService;
import com.todoroo.astrid.actfm.sync.ActFmSyncV2Provider;
import com.todoroo.astrid.sync.SyncProviderUtilities;
import com.todoroo.astrid.sync.SyncV2BackgroundService;
import com.todoroo.astrid.sync.SyncV2Provider;
/**
* SynchronizationService is the service that performs Astrid's background
* synchronization with online task managers. Starting this service
* schedules a repeating alarm which handles the synchronization
*
* @author Tim Su
*
*/
public class ActFmBackgroundService extends SyncV2BackgroundService {
@Autowired ActFmPreferenceService actFmPreferenceService;
public ActFmBackgroundService() {
DependencyInjectionService.getInstance().inject(this);
}
@Override
protected SyncV2Provider getSyncProvider() {
return new ActFmSyncV2Provider();
}
@Override
protected SyncProviderUtilities getSyncUtilities() {
return actFmPreferenceService;
}
@Override
public void onCreate() {
super.onCreate();
}
@Override
public void onDestroy() {
super.onDestroy();
}
}

@ -1,970 +0,0 @@
/**
* Copyright (c) 2012 Todoroo Inc
*
* See the file "LICENSE" for the full license governing this code.
*/
package com.todoroo.astrid.actfm;
import java.io.IOException;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map.Entry;
import java.util.Random;
import java.util.Set;
import org.json.JSONObject;
import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.res.Configuration;
import android.graphics.Color;
import android.graphics.PixelFormat;
import android.os.Build;
import android.os.Bundle;
import android.text.InputType;
import android.text.SpannableString;
import android.text.Spanned;
import android.text.TextPaint;
import android.text.TextUtils;
import android.text.method.PasswordTransformationMethod;
import android.text.style.ClickableSpan;
import android.text.style.UnderlineSpan;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup.LayoutParams;
import android.view.WindowManager;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.ScrollView;
import android.widget.TextView;
import android.widget.Toast;
import com.actionbarsherlock.app.SherlockFragmentActivity;
import com.facebook.Request;
import com.facebook.Request.GraphUserCallback;
import com.facebook.Response;
import com.facebook.Session;
import com.facebook.SessionState;
import com.facebook.UiLifecycleHelper;
import com.facebook.model.GraphUser;
import com.facebook.widget.LoginButton;
import com.google.android.googlelogin.GoogleLoginServiceConstants;
import com.google.android.googlelogin.GoogleLoginServiceHelper;
import com.timsu.astrid.GCMIntentService;
import com.timsu.astrid.R;
import com.todoroo.andlib.data.TodorooCursor;
import com.todoroo.andlib.service.Autowired;
import com.todoroo.andlib.service.ContextManager;
import com.todoroo.andlib.service.DependencyInjectionService;
import com.todoroo.andlib.service.ExceptionService;
import com.todoroo.andlib.sql.Criterion;
import com.todoroo.andlib.sql.Query;
import com.todoroo.andlib.utility.AndroidUtilities;
import com.todoroo.andlib.utility.DateUtilities;
import com.todoroo.andlib.utility.DialogUtilities;
import com.todoroo.andlib.utility.Preferences;
import com.todoroo.astrid.actfm.sync.ActFmInvoker;
import com.todoroo.astrid.actfm.sync.ActFmPreferenceService;
import com.todoroo.astrid.actfm.sync.ActFmServiceException;
import com.todoroo.astrid.actfm.sync.ActFmSyncMonitor;
import com.todoroo.astrid.actfm.sync.ActFmSyncThread;
import com.todoroo.astrid.actfm.sync.messages.ConstructOutstandingTableFromMasterTable;
import com.todoroo.astrid.actfm.sync.messages.ConstructTaskOutstandingTableFromMasterTable;
import com.todoroo.astrid.actfm.sync.messages.NameMaps;
import com.todoroo.astrid.activity.Eula;
import com.todoroo.astrid.dao.Database;
import com.todoroo.astrid.dao.MetadataDao;
import com.todoroo.astrid.dao.MetadataDao.MetadataCriteria;
import com.todoroo.astrid.dao.RemoteModelDao;
import com.todoroo.astrid.dao.TagDataDao;
import com.todoroo.astrid.dao.TagMetadataDao;
import com.todoroo.astrid.dao.TagOutstandingDao;
import com.todoroo.astrid.dao.TaskAttachmentDao;
import com.todoroo.astrid.dao.TaskAttachmentOutstandingDao;
import com.todoroo.astrid.dao.TaskDao;
import com.todoroo.astrid.dao.TaskListMetadataDao;
import com.todoroo.astrid.dao.TaskListMetadataOutstandingDao;
import com.todoroo.astrid.dao.TaskOutstandingDao;
import com.todoroo.astrid.dao.UserActivityDao;
import com.todoroo.astrid.dao.UserActivityOutstandingDao;
import com.todoroo.astrid.dao.UserDao;
import com.todoroo.astrid.data.Metadata;
import com.todoroo.astrid.data.RemoteModel;
import com.todoroo.astrid.data.TagData;
import com.todoroo.astrid.data.TagOutstanding;
import com.todoroo.astrid.data.Task;
import com.todoroo.astrid.data.TaskListMetadata;
import com.todoroo.astrid.data.TaskListMetadataOutstanding;
import com.todoroo.astrid.data.UserActivity;
import com.todoroo.astrid.data.UserActivityOutstanding;
import com.todoroo.astrid.gtasks.auth.ModernAuthManager;
import com.todoroo.astrid.helper.UUIDHelper;
import com.todoroo.astrid.service.AstridDependencyInjector;
import com.todoroo.astrid.service.MarketStrategy.AmazonMarketStrategy;
import com.todoroo.astrid.service.StatisticsConstants;
import com.todoroo.astrid.service.SyncV2Service;
import com.todoroo.astrid.service.TaskService;
import com.todoroo.astrid.subtasks.AstridOrderedListUpdater;
import com.todoroo.astrid.subtasks.AstridOrderedListUpdater.Node;
import com.todoroo.astrid.subtasks.SubtasksHelper;
import com.todoroo.astrid.subtasks.SubtasksHelper.TreeRemapHelper;
import com.todoroo.astrid.tags.TaskToTagMetadata;
/**
* This activity allows users to sign in or log in to Astrid.com
*
* @author Tim Su <tim@astrid.com>
*
*/
public class ActFmLoginActivity extends SherlockFragmentActivity {
@Autowired
protected Database database;
@Autowired
protected ExceptionService exceptionService;
@Autowired
protected TaskService taskService;
@Autowired
protected ActFmPreferenceService actFmPreferenceService;
@Autowired
private TaskDao taskDao;
@Autowired
private TaskOutstandingDao taskOutstandingDao;
@Autowired
private TaskAttachmentDao taskAttachmentDao;
@Autowired
private TaskAttachmentOutstandingDao taskAttachmentOutstandingDao;
@Autowired
private TagDataDao tagDataDao;
@Autowired
private TagOutstandingDao tagOutstandingDao;
@Autowired
private UserDao userDao;
@Autowired
private UserActivityDao userActivityDao;
@Autowired
private UserActivityOutstandingDao userActivityOutstandingDao;
@Autowired
private TaskListMetadataDao taskListMetadataDao;
@Autowired
private TaskListMetadataOutstandingDao taskListMetadataOutstandingDao;
@Autowired
private MetadataDao metadataDao;
@Autowired
private TagMetadataDao tagMetadataDao;
@Autowired protected SyncV2Service syncService;
private final ActFmInvoker actFmInvoker = new ActFmInvoker();
private Random rand;
protected TextView errors;
public static final String SHOW_TOAST = "show_toast"; //$NON-NLS-1$
// --- ui initialization
private static final int REQUEST_CODE_GOOGLE_ACCOUNTS = 1;
private static final int REQUEST_CODE_GOOGLE = 2;
static {
AstridDependencyInjector.initialize();
}
protected int getContentViewResource() {
return R.layout.actfm_login_activity;
}
protected int getTitleResource() {
return R.string.actfm_ALA_title;
}
public ActFmLoginActivity() {
super();
DependencyInjectionService.getInstance().inject(this);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ContextManager.setContext(this);
setContentView(getContentViewResource());
if(getTitleResource() != 0) {
setTitle(getTitleResource());
}
if (getSupportActionBar() != null) {
getSupportActionBar().hide();
}
rand = new Random(DateUtilities.now());
uiHelper = new UiLifecycleHelper(this, callback);
uiHelper.onCreate(savedInstanceState);
initializeUI();
getWindow().setFormat(PixelFormat.RGBA_8888);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_DITHER);
recordPageView();
setResult(RESULT_CANCELED);
}
/* (non-Javadoc)
* @see android.app.Activity#onConfigurationChanged(android.content.res.Configuration)
*/
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
setContentView(getContentViewResource());
}
@Override
protected void onResume() {
super.onResume();
uiHelper.onResume();
}
@Override
protected void onPause() {
super.onPause();
uiHelper.onPause();
}
@Override
protected void onDestroy() {
super.onDestroy();
uiHelper.onDestroy();
}
@Override
protected void onStop() {
super.onStop();
}
protected void recordPageView() {
}
protected void setupTermsOfService(TextView tos) {
OnClickListener showTosListener = new OnClickListener() {
@Override
public void onClick(View v) {
Eula.showEulaBasic(ActFmLoginActivity.this);
}
};
tos.setOnClickListener(showTosListener);
String tosBase = getString(R.string.welcome_login_tos_base);
String tosLink = getString(R.string.welcome_login_tos_link);
SpannableString link = getLinkStringWithCustomInterval(tosBase, tosLink, tosBase.length() + 1, 0,
showTosListener);
tos.setText(link);
}
protected SpannableString getLinkStringWithCustomInterval(String base, String linkComponent,
int start, int endOffset, final OnClickListener listener) {
SpannableString link = new SpannableString (String.format("%s %s", //$NON-NLS-1$
base, linkComponent));
ClickableSpan linkSpan = new ClickableSpan() {
@Override
public void onClick(View widget) {
listener.onClick(widget);
}
@Override
public void updateDrawState(TextPaint ds) {
ds.setUnderlineText(true);
ds.setColor(Color.rgb(68, 68, 68));
}
};
link.setSpan(linkSpan, start, link.length() + endOffset, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
return link;
}
@SuppressWarnings("nls")
protected void initializeUI() {
errors = (TextView) findViewById(R.id.error);
LoginButton loginButton = (LoginButton) findViewById(R.id.fb_login);
if(loginButton == null) {
return;
}
loginButton.setReadPermissions(Arrays.asList("email", "offline_access"));
View googleLogin = findViewById(R.id.gg_login);
if(AmazonMarketStrategy.isKindleFire()) {
googleLogin.setVisibility(View.GONE);
}
googleLogin.setOnClickListener(googleListener);
View fbLogin = findViewById(R.id.fb_login_dummy);
fbLogin.setOnClickListener(facebookListener);
TextView signUp = (TextView) findViewById(R.id.pw_signup);
signUp.setOnClickListener(signUpListener);
TextView signIn = (TextView) findViewById(R.id.pw_login);
signIn.setOnClickListener(signInListener);
setupTermsOfService((TextView) findViewById(R.id.tos));
}
// --- event handler
protected final OnClickListener googleListener = new OnClickListener() {
@Override
public void onClick(View arg0) {
Intent intent = new Intent(ActFmLoginActivity.this,
ActFmGoogleAuthActivity.class);
startActivityForResult(intent, REQUEST_CODE_GOOGLE);
}
};
protected final OnClickListener facebookListener = new OnClickListener() {
@Override
public void onClick(View v) {
Session session = Session.getActiveSession();
if (session != null && session.isOpened()) {
facebookSuccess(session);
} else {
View fbLogin = findViewById(R.id.fb_login);
fbLogin.performClick();
}
}
};
protected final OnClickListener signUpListener = new OnClickListener() {
@Override
public void onClick(View v) {
final LinearLayout body = new LinearLayout(ActFmLoginActivity.this);
body.setOrientation(LinearLayout.VERTICAL);
body.setPadding(10, 0, 10, 0);
final EditText firstNameField = addEditField(body,
R.string.actfm_ALA_firstname_label);
firstNameField.setInputType(InputType.TYPE_CLASS_TEXT |
InputType.TYPE_TEXT_VARIATION_PERSON_NAME |
InputType.TYPE_TEXT_FLAG_CAP_WORDS);
final EditText lastNameField = addEditField(body,
R.string.actfm_ALA_lastname_label);
lastNameField.setInputType(InputType.TYPE_CLASS_TEXT |
InputType.TYPE_TEXT_VARIATION_PERSON_NAME |
InputType.TYPE_TEXT_FLAG_CAP_WORDS);
final EditText email = addEditField(body,
R.string.actfm_ALA_email_label);
email.setInputType(InputType.TYPE_CLASS_TEXT |
InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS);
getCredentials(new OnGetCredentials() {
@Override
public void getCredentials(String[] accounts) {
if (accounts != null && accounts.length > 0) {
email.setText(accounts[0]);
}
}
});
ScrollView bodyScroll = new ScrollView(ActFmLoginActivity.this);
bodyScroll.addView(body);
new AlertDialog.Builder(ActFmLoginActivity.this).setView(
bodyScroll).setIcon(R.drawable.icon_32).setTitle(
R.string.actfm_ALA_signup_title).setPositiveButton(
android.R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dlg, int which) {
String firstName = firstNameField.getText().toString();
String lastName =lastNameField.getText().toString();
AndroidUtilities.hideSoftInputForViews(ActFmLoginActivity.this, firstNameField, lastNameField, email);
authenticate(email.getText().toString(),
firstName, lastName, ActFmInvoker.PROVIDER_PASSWORD, generateRandomPassword());
}
}).setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dlg, int which) {
AndroidUtilities.hideSoftInputForViews(ActFmLoginActivity.this, firstNameField, lastNameField, email);
}
}).show();
}
};
protected final OnClickListener signInListener = new OnClickListener() {
@Override
public void onClick(View v) {
final LinearLayout body = new LinearLayout(ActFmLoginActivity.this);
body.setOrientation(LinearLayout.VERTICAL);
body.setPadding(10, 0, 10, 0);
final EditText email = addEditField(body,
R.string.actfm_ALA_email_label);
email.setInputType(InputType.TYPE_CLASS_TEXT |
InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS);
getCredentials(new OnGetCredentials() {
@Override
public void getCredentials(String[] accounts) {
if (accounts != null && accounts.length > 0) {
email.setText(accounts[0]);
}
}
});
final EditText password = addEditField(body,
R.string.actfm_ALA_password_label);
password.setInputType(InputType.TYPE_CLASS_TEXT |
InputType.TYPE_TEXT_VARIATION_PASSWORD);
password.setTransformationMethod(new PasswordTransformationMethod());
TextView forgotPassword = new TextView(ActFmLoginActivity.this);
SpannableString text = new SpannableString(getString(R.string.actfm_ALA_forgot_password));
text.setSpan(new UnderlineSpan(), 0, text.length(), 0);
forgotPassword.setText(text);
LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
DisplayMetrics metrics = getResources().getDisplayMetrics();
lp.setMargins(0, (int) (8 * metrics.density), 0, (int) (8 * metrics.density));
forgotPassword.setLayoutParams(lp);
forgotPassword.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
forgotPassword(email.getText().toString());
}
});
body.addView(forgotPassword);
ScrollView bodyScroll = new ScrollView(ActFmLoginActivity.this);
bodyScroll.addView(body);
new AlertDialog.Builder(ActFmLoginActivity.this).setView(
bodyScroll).setIcon(R.drawable.icon_32).setTitle(
R.string.actfm_ALA_login_title).setPositiveButton(
android.R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dlg, int which) {
AndroidUtilities.hideSoftInputForViews(ActFmLoginActivity.this, email, password);
authenticate(email.getText().toString(),
"", "", ActFmInvoker.PROVIDER_PASSWORD, //$NON-NLS-1$//$NON-NLS-2$
password.getText().toString());
}
}).setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dlg, int which) {
AndroidUtilities.hideSoftInputForViews(ActFmLoginActivity.this, email, password);
}
}).show();
}
};
private void forgotPassword(final String email) {
if (TextUtils.isEmpty(email)) {
DialogUtilities.okDialog(this, getString(R.string.actfm_ALA_enter_email), null);
} else {
final ProgressDialog pd = DialogUtilities.progressDialog(this, getString(R.string.DLG_please_wait));
new Thread(new Runnable() {
@Override
public void run() {
try {
actFmInvoker.invoke("user_reset_password", "email", email); //$NON-NLS-1$ //$NON-NLS-2$
DialogUtilities.okDialog(ActFmLoginActivity.this, getString(R.string.actfm_ALA_reset_sent, email), null);
} catch (IOException e) {
handleError(e);
} finally {
DialogUtilities.dismissDialog(ActFmLoginActivity.this, pd);
}
}
}).start();
}
}
private String generateRandomPassword() {
String acceptable = "abcdefghijklmnopqrstuvwxyz1234567890"; //$NON-NLS-1$
char[] chars = new char[8];
char last = 'a';
for (int i = 0; i < chars.length; i++) {
char r = acceptable.charAt(rand.nextInt(acceptable.length()));
while (!checkSimilar(last, r)) {
r = acceptable.charAt(rand.nextInt(acceptable.length()));
}
last = r;
chars[i] = r;
}
return new String(chars);
}
@SuppressWarnings("nls")
private boolean checkSimilar(char last, char check) {
String iSimilar = "ijl1!";
String oSimilar = "oO0";
String puncSimilar = ".,";
boolean match = (iSimilar.indexOf(last) > 0 && iSimilar.indexOf(check) > 0)
|| (oSimilar.indexOf(last) > 0 && oSimilar.indexOf(check) > 0)
|| (puncSimilar.indexOf(last) > 0 && puncSimilar.indexOf(check) > 0);
if (match) {
return false;
}
return true;
}
private EditText addEditField(LinearLayout body, int hint) {
TextView label = new TextView(ActFmLoginActivity.this);
label.setText(hint);
body.addView(label);
EditText field = new EditText(ActFmLoginActivity.this);
field.setHint(hint);
body.addView(field);
return field;
}
// --- facebook handler
@SuppressWarnings("nls")
private void onSessionStateChange(Session session, SessionState state, Exception exception) {
if (state.isOpened()) {
Log.e("fb-login", "State opened");
facebookSuccess(session);
} else if (state.isClosed()) {
Log.e("fb-login", "State closed");
}
}
private void facebookSuccess(Session session) {
progressDialog = DialogUtilities.progressDialog(this,
getString(R.string.DLG_please_wait));
Request request = Request.newMeRequest(session, new GraphUserCallback() {
@Override
public void onCompleted(GraphUser user, Response response) {
try {
String email = user.getInnerJSONObject().optString("email"); //$NON-NLS-1$
authenticate(email, user.getFirstName(), user.getLastName(), ActFmInvoker.PROVIDER_FACEBOOK, Session.getActiveSession().getAccessToken());
} catch (Exception e) {
handleError(e);
}
}
});
request.executeAsync();
}
private UiLifecycleHelper uiHelper;
private final Session.StatusCallback callback = new Session.StatusCallback() {
@Override
public void call(Session session, SessionState state, Exception exception) {
onSessionStateChange(session, state, exception);
}
};
private ProgressDialog progressDialog;
// --- utilities
@SuppressWarnings("nls")
public void authenticate(final String email, final String firstName, final String lastName, final String provider,
final String secret) {
if (progressDialog == null) {
progressDialog = DialogUtilities.progressDialog(this,
getString(R.string.DLG_please_wait));
}
new Thread() {
@Override
public void run() {
try {
final JSONObject result = actFmInvoker.authenticate(email, firstName, lastName,
provider, secret);
final String token = actFmInvoker.getToken();
if (result.optBoolean("new")) { // Report new user statistic
}
// Successful login, create outstanding entries
String lastId = ActFmPreferenceService.userId(); //Preferences.getLong(ActFmPreferenceService.PREF_USER_ID, 0);
if (!TextUtils.isEmpty(token) && !RemoteModel.isValidUuid(lastId)) {
constructOutstandingTables();
}
runOnUiThread(new Runnable() {
@Override
public void run() {
DialogUtilities.dismissDialog(ActFmLoginActivity.this, progressDialog);
progressDialog = null;
postAuthenticate(result, token);
}
});
} catch (IOException e) {
handleError(e);
} finally {
runOnUiThread(new Runnable() {
@Override
public void run() {
if (progressDialog != null) {
DialogUtilities.dismissDialog(ActFmLoginActivity.this, progressDialog);
}
}
});
}
}
}.start();
}
private void constructOutstandingTables() {
new ConstructTaskOutstandingTableFromMasterTable(NameMaps.TABLE_ID_TASKS, taskDao, taskOutstandingDao, metadataDao, Task.CREATION_DATE).execute();
new ConstructOutstandingTableFromMasterTable<TagData, TagOutstanding>(NameMaps.TABLE_ID_TAGS, tagDataDao, tagOutstandingDao, TagData.CREATION_DATE).execute();
new ConstructOutstandingTableFromMasterTable<UserActivity, UserActivityOutstanding>(NameMaps.TABLE_ID_USER_ACTIVITY, userActivityDao, userActivityOutstandingDao, UserActivity.CREATED_AT).execute();
new ConstructOutstandingTableFromMasterTable<TaskListMetadata, TaskListMetadataOutstanding>(NameMaps.TABLE_ID_TASK_LIST_METADATA, taskListMetadataDao, taskListMetadataOutstandingDao, null).execute();
}
@SuppressWarnings("nls")
private void postAuthenticate(final JSONObject result, final String token) {
String lastLoggedInUser = ActFmPreferenceService.userId();
if (RemoteModel.isValidUuid(lastLoggedInUser)) {
String newUserId = Long.toString(result.optLong("id"));
if (!lastLoggedInUser.equals(newUserId)) {
// In this case, we need to either make all data private or clear all data
// Prompt for choice
DialogUtilities.okCancelCustomDialog(this,
getString(R.string.actfm_logged_in_different_user_title),
getString(R.string.actfm_logged_in_different_user_body),
R.string.actfm_logged_in_different_user_clear_data,
R.string.actfm_logged_in_different_user_keep_data,
android.R.drawable.ic_dialog_alert,
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
ActFmSyncThread.clearTablePushedAtValues();
deleteDatabase(database.getName());
finishSignIn(result, token, true);
}
},
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
final ProgressDialog pd = DialogUtilities.progressDialog(ActFmLoginActivity.this, getString(R.string.actfm_logged_in_different_user_processing));
new Thread(new Runnable() {
@Override
public void run() {
rebuildAllSyncData();
runOnUiThread(new Runnable() {
@Override
public void run() {
finishSignIn(result, token, true);
}
});
pd.dismiss();
}
}).start();
}
});
} else {
finishSignIn(result, token, false);
}
} else {
finishSignIn(result, token, false);
}
}
private void rebuildAllSyncData() {
// Delete all tasks not assigned to self
taskService.deleteWhere(Criterion.or(Task.USER_ID.neq(0), Task.DELETION_DATE.gt(0)));
// Delete user table
userDao.deleteWhere(Criterion.all);
// Delete comments this user didn't make
userActivityDao.deleteWhere(Criterion.or(UserActivity.USER_UUID.neq(0), UserActivity.DELETED_AT.gt(0)));
// Delete attachments table
taskAttachmentDao.deleteWhere(Criterion.all);
// Delete deleted tags
tagDataDao.deleteWhere(TagData.DELETION_DATE.gt(0));
// Delete deleted metadata
metadataDao.deleteWhere(Metadata.DELETION_DATE.gt(0));
// Clear all outstanding tables
taskOutstandingDao.deleteWhere(Criterion.all);
tagOutstandingDao.deleteWhere(Criterion.all);
userActivityOutstandingDao.deleteWhere(Criterion.all);
taskListMetadataOutstandingDao.deleteWhere(Criterion.all);
taskAttachmentOutstandingDao.deleteWhere(Criterion.all);
// Make all tags private
tagMetadataDao.deleteWhere(Criterion.all);
// Generate new uuids for all tasks/tags/user activity/task list metadata and update links
generateNewUuids();
ActFmSyncThread.clearTablePushedAtValues();
constructOutstandingTables();
}
private void generateNewUuids() {
final HashMap<String, String> uuidTaskMap = new HashMap<String, String>();
HashMap<String, String> uuidTagMap = new HashMap<String, String>();
HashMap<String, String> uuidUserActivityMap = new HashMap<String, String>();
HashMap<String, String> uuidTaskListMetadataMap = new HashMap<String, String>();
mapUuids(taskDao, uuidTaskMap);
mapUuids(tagDataDao, uuidTagMap);
mapUuids(userActivityDao, uuidUserActivityMap);
mapUuids(taskListMetadataDao, uuidTaskListMetadataMap);
Task t = new Task();
TagData td = new TagData();
Metadata m = new Metadata();
UserActivity ua = new UserActivity();
TaskListMetadata tlm = new TaskListMetadata();
Set<Entry<String, String>> entries = uuidTaskMap.entrySet();
for (Entry<String, String> e : entries) {
t.clear();
m.clear();
ua.clear();
String oldUuid = e.getKey();
String newUuid = e.getValue();
t.setValue(Task.UUID, newUuid);
t.setValue(Task.PUSHED_AT, 0L);
t.setValue(Task.ATTACHMENTS_PUSHED_AT, 0L);
t.setValue(Task.USER_ACTIVITIES_PUSHED_AT, 0L);
t.setValue(Task.HISTORY_FETCH_DATE, 0L);
ua.setValue(UserActivity.TARGET_ID, newUuid);
m.setValue(TaskToTagMetadata.TASK_UUID, newUuid);
taskDao.update(Task.UUID.eq(oldUuid), t);
metadataDao.update(Criterion.and(MetadataCriteria.withKey(TaskToTagMetadata.KEY), TaskToTagMetadata.TASK_UUID.eq(oldUuid)), m);
userActivityDao.update(UserActivity.TARGET_ID.eq(oldUuid), ua);
}
entries = uuidTagMap.entrySet();
for (Entry<String, String> e : entries) {
td.clear();
ua.clear();
m.clear();
tlm.clear();
String oldUuid = e.getKey();
String newUuid = e.getValue();
td.setValue(TagData.UUID, newUuid);
td.setValue(TagData.USER_ID, Task.USER_ID_SELF);
td.setValue(TagData.PUSHED_AT, 0L);
td.setValue(TagData.TASKS_PUSHED_AT, 0L);
td.setValue(TagData.METADATA_PUSHED_AT, 0L);
td.setValue(TagData.USER_ACTIVITIES_PUSHED_AT, 0L);
ua.setValue(UserActivity.TARGET_ID, newUuid);
m.setValue(TaskToTagMetadata.TAG_UUID, newUuid);
tlm.setValue(TaskListMetadata.TAG_UUID, newUuid);
tagDataDao.update(TagData.UUID.eq(oldUuid), td);
userActivityDao.update(UserActivity.TARGET_ID.eq(oldUuid), ua);
metadataDao.update(Criterion.and(MetadataCriteria.withKey(TaskToTagMetadata.KEY), TaskToTagMetadata.TAG_UUID.eq(oldUuid)), m);
taskListMetadataDao.update(TaskListMetadata.TAG_UUID.eq(oldUuid), tlm);
}
entries = uuidUserActivityMap.entrySet();
for (Entry<String, String> e : entries) {
ua.clear();
String oldUuid = e.getKey();
String newUuid = e.getValue();
ua.setValue(UserActivity.UUID, newUuid);
ua.setValue(UserActivity.PUSHED_AT, 0L);
userActivityDao.update(UserActivity.UUID.eq(oldUuid), ua);
}
TodorooCursor<TaskListMetadata> tlmCursor = taskListMetadataDao.query(Query.select(TaskListMetadata.ID, TaskListMetadata.UUID, TaskListMetadata.FILTER, TaskListMetadata.TAG_UUID,
TaskListMetadata.TASK_IDS, TaskListMetadata.CHILD_TAG_IDS));
try {
for (tlmCursor.moveToFirst(); !tlmCursor.isAfterLast(); tlmCursor.moveToNext()) {
tlm.clear();
tlm.readFromCursor(tlmCursor);
String filterId = tlm.getValue(TaskListMetadata.FILTER);
String tagUuid = tlm.getValue(TaskListMetadata.TAG_UUID);
// Hack to make sure outstanding entry gets created for filter or uuid
if (!TextUtils.isEmpty(filterId)) {
tlm.setValue(TaskListMetadata.FILTER, ""); //$NON-NLS-1$
tlm.setValue(TaskListMetadata.FILTER, filterId);
} else if (!RemoteModel.isUuidEmpty(tagUuid)) {
tlm.setValue(TaskListMetadata.TAG_UUID, ""); //$NON-NLS-1$
tlm.setValue(TaskListMetadata.TAG_UUID, tagUuid);
}
tlm.setValue(TaskListMetadata.UUID, uuidTaskListMetadataMap.get(tlm.getUuid()));
tlm.setValue(TaskListMetadata.PUSHED_AT, 0L);
String taskIds = tlm.getValue(TaskListMetadata.TASK_IDS);
if (!TaskListMetadata.taskIdsIsEmpty(taskIds)) {
Node root = AstridOrderedListUpdater.buildTreeModel(taskIds, null);
SubtasksHelper.remapTree(root, uuidTaskMap, new TreeRemapHelper<String>() {
@Override
public String getKeyFromOldUuid(String uuid) {
return uuid; // Old uuids are the keys
}
});
taskIds = AstridOrderedListUpdater.serializeTree(root);
tlm.setValue(TaskListMetadata.TASK_IDS, taskIds);
}
taskListMetadataDao.saveExisting(tlm);
}
} finally {
tlmCursor.close();
}
}
private <T extends RemoteModel> void mapUuids(RemoteModelDao<T> dao, HashMap<String, String> map) {
TodorooCursor<T> items = dao.query(Query.select(RemoteModel.UUID_PROPERTY));
try {
for (items.moveToFirst(); !items.isAfterLast(); items.moveToNext()) {
map.put(items.get(RemoteModel.UUID_PROPERTY), UUIDHelper.newUUID());
}
} finally {
items.close();
}
}
@SuppressWarnings("nls")
private void finishSignIn(JSONObject result, String token, boolean restart) {
actFmPreferenceService.setToken(token);
Preferences.setString(ActFmPreferenceService.PREF_USER_ID,
Long.toString(result.optLong("id")));
Preferences.setString(ActFmPreferenceService.PREF_NAME,
result.optString("name"));
Preferences.setString(ActFmPreferenceService.PREF_FIRST_NAME,
result.optString("first_name"));
Preferences.setString(ActFmPreferenceService.PREF_LAST_NAME,
result.optString("last_name"));
Preferences.setBoolean(ActFmPreferenceService.PREF_PREMIUM,
result.optBoolean("premium"));
Preferences.setString(ActFmPreferenceService.PREF_EMAIL,
result.optString("email"));
Preferences.setString(ActFmPreferenceService.PREF_PICTURE,
result.optString("picture"));
if (!result.optBoolean("new")) {
Toast.makeText(this, R.string.actfm_ALA_user_exists_sync_alert, Toast.LENGTH_LONG).show();
}
ActFmPreferenceService.reloadThisUser();
GCMIntentService.register(this);
if (restart) {
System.exit(0);
return;
} else {
setResult(RESULT_OK);
finish();
}
ActFmSyncMonitor monitor = ActFmSyncMonitor.getInstance();
synchronized (monitor) {
monitor.notifyAll();
}
}
@SuppressWarnings("nls")
private void handleError(final Throwable e) {
DialogUtilities.dismissDialog(this, progressDialog);
exceptionService.reportError("astrid-sharing-login", e); //$NON-NLS-1$
runOnUiThread(new Runnable() {
@Override
public void run() {
String message = e.getMessage();
if (e instanceof ActFmServiceException) {
ActFmServiceException ae = (ActFmServiceException) e;
JSONObject result = ae.result;
if (result != null && result.has("code")) {
String code = result.optString("code");
if ("user_exists".equals(code)) {
message = getString(R.string.actfm_ALA_error_user_exists);
} else if ("incorrect_password".equals(code)) {
message = getString(R.string.actfm_ALA_error_wrong_password);
} else if ("user_not_found".equals(code) || "missing_param".equals(code)) {
message = getString(R.string.actfm_ALA_error_user_not_found);
}
}
}
errors.setText(message);
errors.setVisibility(View.VISIBLE);
}
});
}
// --- google account manager
@SuppressWarnings("nls")
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
uiHelper.onActivityResult(requestCode, resultCode, data);
if (resultCode == RESULT_CANCELED) {
return;
}
if (requestCode == REQUEST_CODE_GOOGLE_ACCOUNTS && data != null && credentialsListener != null) {
String accounts[] = data.getStringArrayExtra(
GoogleLoginServiceConstants.ACCOUNTS_KEY);
credentialsListener.getCredentials(accounts);
}
// else if (requestCode == LoginButton.REQUEST_CODE_FACEBOOK) {
// if (data == null)
// return;
//
// String error = data.getStringExtra("error");
// if (error == null) {
// error = data.getStringExtra("error_type");
// }
// String token = data.getStringExtra("access_token");
// if (error != null) {
// onFBAuthFail(error);
// } else if (token == null) {
// onFBAuthFail("Something went wrong! Please try again.");
// } else {
// facebook.setAccessToken(token);
// onFBAuthSucceed();
// }
// errors.setVisibility(View.GONE);
// }
else if (requestCode == REQUEST_CODE_GOOGLE) {
if (data == null) {
return;
}
String email = data.getStringExtra(ActFmGoogleAuthActivity.RESULT_EMAIL);
String token = data.getStringExtra(ActFmGoogleAuthActivity.RESULT_TOKEN);
authenticate(email, email, "", "google", token);
}
}
public interface OnGetCredentials {
public void getCredentials(String[] accounts);
}
private OnGetCredentials credentialsListener;
public void getCredentials(OnGetCredentials onGetCredentials) {
credentialsListener = onGetCredentials;
if (Integer.parseInt(Build.VERSION.SDK) >= 7) {
credentialsListener.getCredentials(ModernAuthManager.getAccounts(this));
} else {
GoogleLoginServiceHelper.getAccount(this,
REQUEST_CODE_GOOGLE_ACCOUNTS, false);
}
}
}

@ -1,213 +0,0 @@
/**
* Copyright (c) 2012 Todoroo Inc
*
* See the file "LICENSE" for the full license governing this code.
*/
package com.todoroo.astrid.actfm;
import android.content.ActivityNotFoundException;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.content.Intent;
import android.content.res.Resources;
import android.net.Uri;
import android.os.Bundle;
import android.preference.Preference;
import android.preference.Preference.OnPreferenceClickListener;
import android.preference.PreferenceCategory;
import android.preference.PreferenceScreen;
import android.text.TextUtils;
import android.widget.Toast;
import com.timsu.astrid.R;
import com.todoroo.andlib.service.Autowired;
import com.todoroo.andlib.utility.DialogUtilities;
import com.todoroo.andlib.utility.Preferences;
import com.todoroo.astrid.actfm.sync.ActFmPreferenceService;
import com.todoroo.astrid.actfm.sync.ActFmSyncV2Provider;
import com.todoroo.astrid.billing.BillingActivity;
import com.todoroo.astrid.gtasks.GtasksPreferenceService;
import com.todoroo.astrid.service.PremiumUnlockService;
import com.todoroo.astrid.service.StatisticsConstants;
import com.todoroo.astrid.sync.SyncProviderPreferences;
import com.todoroo.astrid.sync.SyncProviderUtilities;
import com.todoroo.astrid.utility.Constants;
/**
* Displays synchronization preferences and an action panel so users can
* initiate actions from the menu.
*
* @author timsu
*
*/
public class ActFmPreferences extends SyncProviderPreferences {
@Autowired ActFmPreferenceService actFmPreferenceService;
@Autowired GtasksPreferenceService gtasksPreferenceService;
@Override
public int getPreferenceResource() {
return R.xml.preferences_actfm;
}
@Override
public void startSync() {
if (!actFmPreferenceService.isLoggedIn()) {
if (gtasksPreferenceService.isLoggedIn()) {
DialogUtilities.okCancelDialog(this, getString(R.string.DLG_warning), getString(R.string.actfm_dual_sync_warning),
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
startLogin();
}
}, null);
} else {
startLogin();
}
} else {
setResult(RESULT_CODE_SYNCHRONIZE);
finish();
}
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
PreferenceScreen screen = getPreferenceScreen();
Preference inAppBilling = findPreference(getString(R.string.actfm_inapp_billing));
if (Constants.ASTRID_LITE || Preferences.getBoolean(PremiumUnlockService.PREF_KILL_SWITCH, false)) {
screen.removePreference(inAppBilling);
} else {
inAppBilling.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
handleInAppBillingClicked();
return true;
}
});
}
findPreference(getString(R.string.actfm_account_type)).setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
startSync();
return true;
}
});
}
private void startLogin() {
Intent intent = new Intent(this, ActFmLoginActivity.class);
startActivityForResult(intent, REQUEST_LOGIN);
}
@Override
public void logOut() {
new ActFmSyncV2Provider().signOut(this);
}
@Override
public SyncProviderUtilities getUtilities() {
return actFmPreferenceService;
}
@Override
protected void onResume() {
super.onResume();
Preference premiumUpgrade = findPreference(getString(R.string.actfm_inapp_billing));
if (premiumUpgrade != null &&
(!Constants.MARKET_STRATEGY.billingSupported() || !actFmPreferenceService.isLoggedIn() || ActFmPreferenceService.isPremiumUser())) {
getPreferenceScreen().removePreference(premiumUpgrade);
}
}
@Override
protected void onPause() {
super.onPause();
new ActFmBackgroundService().scheduleService();
}
@Override
public void updatePreferences(Preference preference, Object value) {
final Resources r = getResources();
boolean loggedIn = getUtilities().isLoggedIn();
PreferenceCategory status = (PreferenceCategory) findPreference(r.getString(R.string.sync_SPr_group_status));
if (loggedIn) {
String title = actFmPreferenceService.getLoggedInUserName();
String email = Preferences.getStringValue(ActFmPreferenceService.PREF_EMAIL);
if (!TextUtils.isEmpty(email)) {
if (!TextUtils.isEmpty(title)) {
title += "\n"; //$NON-NLS-1$
}
title += email;
}
status.setTitle(getString(R.string.actfm_status_title_logged_in, title));
}
else {
status.setTitle(R.string.sync_SPr_group_status);
}
if (r.getString(R.string.actfm_https_key).equals(preference.getKey())) {
if ((Boolean)value) {
preference.setSummary(R.string.actfm_https_enabled);
} else {
preference.setSummary(R.string.actfm_https_disabled);
}
} else if (r.getString(R.string.actfm_account_type).equals(preference.getKey())) {
if (ActFmPreferenceService.isPremiumUser()) {
// Premium user
preference.setSummary(R.string.actfm_account_premium);
} else if (actFmPreferenceService.isLoggedIn()) {
// Non premium user
preference.setSummary(R.string.actfm_account_basic);
} else {
// Not logged in
preference.setEnabled(true);
preference.setTitle(R.string.account_type_title_not_logged_in);
preference.setSummary(R.string.account_type_summary_not_logged_in);
}
} else if (r.getString(R.string.sync_SPr_forget_key).equals(preference.getKey())) {
preference.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference p) {
DialogUtilities.okCancelDialog(ActFmPreferences.this,
r.getString(R.string.sync_forget_confirm), new OnClickListener() {
@Override
public void onClick(DialogInterface dialog,
int which) {
logOut();
initializePreference(getPreferenceScreen());
}
}, null);
return true;
}
});
if(!loggedIn) {
getPreferenceScreen().removePreference(preference);
}
} else {
super.updatePreferences(preference, value);
}
}
private void handleInAppBillingClicked() {
if (ActFmPreferenceService.isPremiumUser()) {
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("market://details?id=" + Constants.PACKAGE)); //$NON-NLS-1$
try {
startActivity(intent);
} catch (ActivityNotFoundException e) {
Toast.makeText(this, R.string.market_unavailable, Toast.LENGTH_LONG).show();
}
} else {
Intent intent = new Intent(this, BillingActivity.class);
startActivity(intent);
}
}
}

@ -264,20 +264,7 @@ public abstract class CommentsFragment extends SherlockListFragment {
if (cursor.getCount() == 0) {
activityContainer.setVisibility(View.VISIBLE);
TextView textView = (TextView)activityContainer.findViewById(R.id.no_activity_message);
if(actFmPreferenceService.isLoggedIn()) {
textView.setText(activity.getString(R.string.ENA_no_comments));
}
else {
textView.setText(activity.getString(R.string.UpS_no_activity_log_in));
activityContainer.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
startActivityForResult(new Intent(getActivity(), ActFmLoginActivity.class),
TagSettingsActivity.REQUEST_ACTFM_LOGIN);
}
});
}
textView.setText(activity.getString(R.string.ENA_no_comments));
listView.setVisibility(View.GONE);
}
else {

@ -687,26 +687,8 @@ public class EditPeopleControlSet extends PopupControlSet {
}
if(dirty && !actFmPreferenceService.isLoggedIn()) {
DialogInterface.OnClickListener okListener = new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface d, int which) {
fragment.startActivityForResult(new Intent(activity, ActFmLoginActivity.class),
loginRequestCode);
}
};
DialogInterface.OnClickListener cancelListener = new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface d, int which) {
makePrivateTask();
task.setValue(Task.USER_ID, Task.USER_ID_SELF);
}
};
DialogUtilities.okCancelCustomDialog(activity, activity.getString(R.string.actfm_EPA_login_button),
activity.getString(R.string.actfm_EPA_login_to_share), R.string.actfm_EPA_login_button,
R.string.actfm_EPA_dont_share_button, android.R.drawable.ic_dialog_alert,
okListener, cancelListener);
makePrivateTask();
task.setValue(Task.USER_ID, Task.USER_ID_SELF);
return false;
}

@ -348,27 +348,8 @@ public class TagSettingsActivity extends SherlockFragmentActivity {
tagDataService.save(tagData);
}
DialogInterface.OnClickListener okListener = new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface d, int which) {
startActivityForResult(new Intent(TagSettingsActivity.this, ActFmLoginActivity.class),
REQUEST_ACTFM_LOGIN);
}
};
DialogInterface.OnClickListener cancelListener = new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface d, int which) {
tagMembers.removeAllViews();
tagMembers.addPerson("", "", false); //$NON-NLS-1$
}
};
DialogUtilities.okCancelCustomDialog(TagSettingsActivity.this, getString(R.string.actfm_EPA_login_button),
getString(R.string.actfm_TVA_login_to_share), R.string.actfm_EPA_login_button,
R.string.actfm_EPA_dont_share_button, android.R.drawable.ic_dialog_alert,
okListener, cancelListener);
tagMembers.removeAllViews();
tagMembers.addPerson("", "", false); //$NON-NLS-1$
return;
}

@ -1,159 +0,0 @@
/**
* Copyright (c) 2012 Todoroo Inc
*
* See the file "LICENSE" for the full license governing this code.
*/
package com.todoroo.astrid.actfm.sync;
import java.io.IOException;
import org.json.JSONObject;
import android.app.Activity;
import android.content.DialogInterface;
import com.facebook.Session;
import com.timsu.astrid.GCMIntentService;
import com.timsu.astrid.R;
import com.todoroo.andlib.service.Autowired;
import com.todoroo.andlib.service.ContextManager;
import com.todoroo.andlib.utility.DialogUtilities;
import com.todoroo.andlib.utility.Preferences;
import com.todoroo.astrid.billing.BillingConstants;
import com.todoroo.astrid.dao.Database;
import com.todoroo.astrid.dao.RemoteModelDao;
import com.todoroo.astrid.service.AstridDependencyInjector;
import com.todoroo.astrid.sync.SyncResultCallback;
import com.todoroo.astrid.sync.SyncV2Provider;
/**
* Exposes sync action
*
*/
public class ActFmSyncV2Provider extends SyncV2Provider {
@Autowired
private ActFmPreferenceService actFmPreferenceService;
@Autowired
private ActFmSyncService actFmSyncService;
@Autowired
private Database database;
static {
AstridDependencyInjector.initialize();
}
@Override
public String getName() {
return ContextManager.getString(R.string.actfm_APr_header);
}
@Override
public ActFmPreferenceService getUtilities() {
return actFmPreferenceService;
}
@Override
public void signOut(final Activity activity) {
actFmPreferenceService.setToken(null);
actFmPreferenceService.clearLastSyncDate();
ActFmPreferenceService.premiumLogout();
GCMIntentService.unregister(ContextManager.getContext());
Session activeSession = Session.getActiveSession();
if (activeSession != null) {
activeSession.closeAndClearTokenInformation();
}
DialogUtilities.okCancelCustomDialog(activity,
activity.getString(R.string.actfm_logout_clear_tasks_title),
activity.getString(R.string.actfm_logout_clear_tasks_body),
R.string.actfm_logout_clear_tasks_yes,
R.string.actfm_logout_clear_tasks_no,
android.R.drawable.ic_dialog_alert,
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Preferences.clear(ActFmPreferenceService.PREF_USER_ID); // As though no one has ever logged in
ActFmSyncThread.clearTablePushedAtValues();
activity.deleteDatabase(database.getName());
RemoteModelDao.setOutstandingEntryFlags(RemoteModelDao.OUTSTANDING_FLAG_UNINITIALIZED);
System.exit(0);
}
},
null);
}
@Override
public boolean isActive() {
return actFmPreferenceService.isLoggedIn();
}
// --- synchronize active tasks
@Override
public void synchronizeActiveTasks(final boolean manual,
final SyncResultCallback callback) {
new Thread(new Runnable() {
@Override
public void run() {
updateUserStatus();
ActFmSyncThread.getInstance().setTimeForBackgroundSync(true);
}
}).start();
}
/** fetch user status hash*/
@SuppressWarnings("nls")
public void updateUserStatus() {
if (Preferences.getStringValue(GCMIntentService.PREF_NEEDS_REGISTRATION) != null) {
actFmSyncService.setGCMRegistration(Preferences.getStringValue(GCMIntentService.PREF_NEEDS_REGISTRATION));
} else if (Preferences.getBoolean(GCMIntentService.PREF_NEEDS_RETRY, false)) {
GCMIntentService.register(ContextManager.getContext());
}
if (Preferences.getBoolean(BillingConstants.PREF_NEEDS_SERVER_UPDATE, false)) {
actFmSyncService.updateUserSubscriptionStatus(null, null, null);
}
try {
JSONObject status = actFmSyncService.invoke("user_status"); //$NON-NLS-1$
if (status.has("id")) {
Preferences.setString(ActFmPreferenceService.PREF_USER_ID, Long.toString(status.optLong("id")));
}
if (status.has("name")) {
Preferences.setString(ActFmPreferenceService.PREF_NAME, status.optString("name"));
}
if (status.has("first_name")) {
Preferences.setString(ActFmPreferenceService.PREF_FIRST_NAME, status.optString("first_name"));
}
if (status.has("last_name")) {
Preferences.setString(ActFmPreferenceService.PREF_LAST_NAME, status.optString("last_name"));
}
if (status.has("premium") && !Preferences.getBoolean(BillingConstants.PREF_NEEDS_SERVER_UPDATE, false)) {
Preferences.setBoolean(ActFmPreferenceService.PREF_PREMIUM, status.optBoolean("premium"));
}
if (status.has("email")) {
Preferences.setString(ActFmPreferenceService.PREF_EMAIL, status.optString("email"));
}
if (status.has("picture")) {
Preferences.setString(ActFmPreferenceService.PREF_PICTURE, status.optString("picture"));
}
ActFmPreferenceService.reloadThisUser();
} catch (IOException e) {
handler.handleException("actfm-sync", e, e.toString()); //$NON-NLS-1$
}
}
// --- synchronize list
@Override
public void synchronizeList(Object list, final boolean manual,
final SyncResultCallback callback) {
// Nothing to do
}
}

@ -23,7 +23,6 @@ import com.todoroo.andlib.utility.DateUtilities;
import com.todoroo.andlib.utility.DialogUtilities;
import com.todoroo.andlib.utility.Preferences;
import com.todoroo.andlib.utility.TodorooPreferenceActivity;
import com.todoroo.astrid.actfm.ActFmLoginActivity;
import com.todoroo.astrid.actfm.sync.ActFmPreferenceService;
/**
@ -77,14 +76,6 @@ public class BackupPreferences extends TodorooPreferenceActivity {
return false;
}
});
findPreference(getString(R.string.backup_BAc_cloud)).setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
initiateCloudBackup();
return false;
}
});
}
@Override
@ -152,15 +143,4 @@ public class BackupPreferences extends TodorooPreferenceActivity {
}
}
private void initiateCloudBackup() {
if (actFmPreferenceService.isLoggedIn()) {
DialogUtilities.okDialog(this, getString(R.string.DLG_information_title), 0,
getString(R.string.backup_BPr_cloud_already_logged_in), null);
} else {
Intent intent = new Intent(this, ActFmLoginActivity.class);
startActivity(intent);
}
}
}

@ -1,143 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
** Copyright (c) 2012 Todoroo Inc
**
** See the file "LICENSE" for the full license governing this code.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:paddingLeft="4dip"
android:paddingRight="4dip"
android:background="@drawable/astrid_com_gradient"
android:orientation="vertical" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:orientation="horizontal">
<ImageView
android:id="@+id/logo"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scaleType="center"
android:paddingLeft="20dip"
android:paddingRight="20dip"
android:paddingBottom="10dip"
android:src="@drawable/astrid_com_logo_new"
android:layout_weight="1" />
<LinearLayout
android:id="@+id/LinearLayout1"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:gravity="center_vertical"
android:paddingTop="5dip" >
<com.facebook.widget.LoginButton
android:id="@+id/fb_login"
android:layout_width="fill_parent"
android:layout_height="45dip"
android:layout_marginLeft="15dip"
android:layout_marginRight="15dip"
android:layout_marginBottom="15dip"
android:layout_marginTop="15dip"
android:paddingLeft="70dip"
android:textSize="14sp"
android:gravity="left|center_vertical"
android:background="@drawable/fb_login_background"
android:textColor="@android:color/white"
android:text="@string/actfm_ALA_fb_login"
android:visibility="gone"/>
<Button
android:id="@+id/fb_login_dummy"
android:layout_width="fill_parent"
android:layout_height="45dip"
android:layout_marginLeft="15dip"
android:layout_marginRight="15dip"
android:layout_marginBottom="15dip"
android:layout_marginTop="15dip"
android:paddingLeft="70dip"
android:textSize="14sp"
android:gravity="left|center_vertical"
android:background="@drawable/fb_login_background"
android:textColor="@android:color/white"
android:text="@string/actfm_ALA_fb_login" />
<Button
android:id="@+id/gg_login"
android:layout_width="fill_parent"
android:layout_height="45dip"
android:layout_marginLeft="15dip"
android:layout_marginRight="15dip"
android:paddingLeft="70dip"
android:textSize="14sp"
android:gravity="left|center_vertical"
android:background="@drawable/google_login_background"
android:textColor="@android:color/white"
android:text="@string/actfm_ALA_gg_login" />
<TextView
android:id="@+id/tos"
android:layout_width="fill_parent"
android:layout_height="35dip"
android:layout_above="@id/gg_login"
android:gravity="center"
android:paddingLeft="20dip"
android:paddingRight="20dip"
android:textSize="12.5sp"
android:visibility="invisible"
android:textColor="#ffffff" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="45dip"
android:orientation="horizontal">
<TextView
android:id="@+id/login_later"
android:text="@string/welcome_login_later"
android:layout_width="fill_parent"
android:layout_height="45dip"
android:gravity="center"
android:layout_weight="1"
android:textSize="16sp"
android:textColor="@android:color/white"
android:visibility="gone"/>
<TextView
android:id="@+id/pw_login"
android:layout_width="fill_parent"
android:layout_height="45dip"
android:layout_weight="1"
android:gravity="center"
android:textColor="@android:color/white"
android:textSize="16sp"
android:text="@string/welcome_sign_in"/>
<TextView
android:id="@+id/pw_signup"
android:layout_width="fill_parent"
android:layout_height="45dip"
android:layout_weight="1"
android:gravity="center"
android:textColor="@android:color/white"
android:textSize="16sp"
android:text="@string/welcome_login_pw"/>
</LinearLayout>
<TextView
android:id="@+id/error"
android:layout_width="fill_parent"
android:layout_height="45dip"
android:gravity="center"
android:textColor="#ff0000"
android:textSize="16sp"
android:textStyle="bold"
android:visibility="gone"/>
</LinearLayout>

@ -1,129 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
** Copyright (c) 2012 Todoroo Inc
**
** See the file "LICENSE" for the full license governing this code.
-->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:paddingLeft="4dip"
android:paddingRight="4dip"
android:background="@drawable/astrid_com_gradient"
android:orientation="vertical">
<ImageView
android:id="@+id/logo"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:paddingTop="95dip"
android:scaleType="center"
android:src="@drawable/astrid_com_logo_new" />
<TextView
android:id="@+id/error"
android:layout_width="fill_parent"
android:layout_height="45dip"
android:gravity="center"
android:textColor="#ff0000"
android:textSize="16sp"
android:textStyle="bold" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:gravity="center_horizontal">
<com.facebook.widget.LoginButton
android:id="@+id/fb_login"
android:layout_width="300dip"
android:layout_height="45dip"
android:layout_marginLeft="15dip"
android:layout_marginRight="15dip"
android:layout_marginBottom="15dip"
android:paddingLeft="70dip"
android:textSize="16sp"
android:gravity="left|center_vertical"
android:background="@drawable/fb_login_background"
android:textColor="@android:color/white"
android:text="@string/actfm_ALA_fb_login"
android:visibility="gone" />
<Button
android:id="@+id/fb_login_dummy"
android:layout_width="300dip"
android:layout_height="45dip"
android:layout_marginLeft="15dip"
android:layout_marginRight="15dip"
android:layout_marginBottom="15dip"
android:paddingLeft="70dip"
android:textSize="16sp"
android:gravity="left|center_vertical"
android:background="@drawable/fb_login_background"
android:textColor="@android:color/white"
android:text="@string/actfm_ALA_fb_login" />
<Button
android:id="@+id/gg_login"
android:layout_width="300dip"
android:layout_height="45dip"
android:layout_marginLeft="15dip"
android:layout_marginRight="15dip"
android:paddingLeft="70dip"
android:textSize="16sp"
android:gravity="left|center_vertical"
android:background="@drawable/google_login_background"
android:textColor="@android:color/white"
android:text="@string/actfm_ALA_gg_login" />
<TextView
android:id="@+id/tos"
android:layout_width="fill_parent"
android:layout_height="35dip"
android:gravity="center"
android:paddingLeft="20dip"
android:paddingRight="20dip"
android:textSize="12.5sp"
android:visibility="invisible"
android:textColor="#ffffff" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="45dip"
android:orientation="horizontal"
android:paddingLeft="40dip"
android:paddingRight="40dip">
<TextView
android:id="@+id/login_later"
android:text="@string/welcome_login_later"
android:layout_width="fill_parent"
android:layout_height="45dip"
android:gravity="center"
android:layout_weight="1"
android:textSize="16sp"
android:textColor="#a0ffffff"
android:visibility="gone"/>
<TextView
android:id="@+id/pw_login"
android:layout_width="fill_parent"
android:layout_height="45dip"
android:layout_weight="1"
android:gravity="center"
android:textColor="@android:color/white"
android:textSize="16sp"
android:text="@string/welcome_sign_in"/>
<TextView
android:id="@+id/pw_signup"
android:layout_width="fill_parent"
android:layout_height="45dip"
android:layout_weight="1"
android:gravity="center"
android:textColor="@android:color/white"
android:textSize="16sp"
android:text="@string/welcome_login_pw"/>
</LinearLayout>
</LinearLayout>

@ -226,7 +226,7 @@
<string name="actfm_ALA_title">Astrid.com \'a Hoşgeldiniz!</string>
<!-- share login: Sharing Description -->
<string name="actfm_ALA_body">Astrid.com, görevlerinize çevrimiçi ulaşmanızı, paylaşmanızı ve diğerleriyle görev paylaşımı yapmanızı sağlar.</string>
<string name="actfm_ALA_body">görevlerinize çevrimiçi ulaşmanızı, paylaşmanızı ve diğerleriyle görev paylaşımı yapmanızı sağlar.</string>
<!-- share login: Sharing Login FB Prompt -->
<string name="actfm_ALA_fb_login">Facebook ile bağlan</string>

@ -63,9 +63,6 @@
<!-- force tablets to use phone layout -->
<string name="p_force_phone_layout">force_phone_layout</string>
<!-- account status section key -->
<string name="p_account">account</string>
<!-- list view section key -->
<string name="p_list_view">p_list_view</string>

@ -8,22 +8,6 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:title="@string/EPr_title">
<PreferenceScreen android:title="@string/EPr_account_title"
android:key="@string/p_account"
android:summary="@string/actfm_account_info_summary"/>
<PreferenceScreen android:title="@string/p_help" android:summary="@string/EPr_support_summary">
<PreferenceScreen android:title="@string/p_about" android:key="@string/p_about" />
<PreferenceScreen android:title="@string/welcome_setting" android:key="@string/p_tutorial"/>
<PreferenceScreen android:title="@string/EPr_faq_title" android:key="@string/p_help"/>
</PreferenceScreen>
<PreferenceScreen android:title="@string/EPr_share_astrid"
android:key="@string/EPr_share_astrid"
android:summary="@string/EPr_share_astrid_summary"/>
<PreferenceCategory android:title="@string/EPr_title"/>
<PreferenceScreen
android:title="@string/EPr_appearance_header"
android:summary="@string/EPr_appearance_summary">

@ -33,11 +33,5 @@
android:title="@string/backup_BAc_label"
android:textSize="24sp"
android:gravity="center"/>
<com.todoroo.astrid.ui.MultilinePreference
android:key="@string/backup_BAc_cloud"
android:title="@string/backup_BAc_cloud"
android:textSize="24sp"
android:gravity="center" />
</PreferenceScreen>
</PreferenceScreen>

@ -15,21 +15,17 @@ import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.pm.ResolveInfo;
import android.content.res.Resources;
import android.net.Uri;
import android.os.Bundle;
import android.preference.CheckBoxPreference;
import android.preference.Preference;
import android.preference.Preference.OnPreferenceChangeListener;
import android.preference.Preference.OnPreferenceClickListener;
import android.preference.PreferenceCategory;
import android.preference.PreferenceGroup;
import android.preference.PreferenceManager;
import android.preference.PreferenceScreen;
import android.text.TextUtils;
import android.widget.Toast;
import com.timsu.astrid.R;
import com.todoroo.andlib.service.Autowired;
@ -40,12 +36,9 @@ import com.todoroo.andlib.utility.AndroidUtilities;
import com.todoroo.andlib.utility.DialogUtilities;
import com.todoroo.andlib.utility.Preferences;
import com.todoroo.andlib.utility.TodorooPreferenceActivity;
import com.todoroo.astrid.actfm.ActFmLoginActivity;
import com.todoroo.astrid.actfm.ActFmPreferences;
import com.todoroo.astrid.actfm.sync.ActFmPreferenceService;
import com.todoroo.astrid.api.AstridApiConstants;
import com.todoroo.astrid.dao.Database;
import com.todoroo.astrid.data.Task;
import com.todoroo.astrid.data.TaskAttachment;
import com.todoroo.astrid.files.FileExplore;
import com.todoroo.astrid.gcal.CalendarStartupReceiver;
@ -57,7 +50,6 @@ import com.todoroo.astrid.service.StartupService;
import com.todoroo.astrid.service.StatisticsConstants;
import com.todoroo.astrid.service.TaskService;
import com.todoroo.astrid.sync.SyncProviderPreferences;
import com.todoroo.astrid.ui.ContactListAdapter;
import com.todoroo.astrid.ui.TaskListFragmentPager;
import com.todoroo.astrid.utility.AstridDefaultPreferenceSpec;
import com.todoroo.astrid.utility.AstridLitePreferenceSpec;
@ -77,9 +69,7 @@ import com.todoroo.astrid.widget.TasksWidget;
*/
public class EditPreferences extends TodorooPreferenceActivity {
private static final String SUPPORT_URL = "http://astrid.helpshift.com/a/astrid/?p=android"; //$NON-NLS-1$
private static final int APPEARANCE_PREFERENCE = 4;
private static final int APPEARANCE_PREFERENCE = 0;
private static final int REQUEST_CODE_SYNC = 0;
private static final int REQUEST_CODE_FILES_DIR = 2;
@ -162,41 +152,6 @@ public class EditPreferences extends TodorooPreferenceActivity {
final Resources r = getResources();
// first-order preferences
Preference preference = screen.findPreference(getString(R.string.p_about));
preference.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference p) {
showAbout();
return true;
}
});
preference = screen.findPreference(getString(R.string.p_help));
preference.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference p) {
showSupport();
return true;
}
});
preference = screen.findPreference(getString(R.string.p_account));
preference.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference p) {
showAccountPrefs();
return true;
}
});
preference = screen.findPreference(getString(R.string.EPr_share_astrid));
preference.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference p) {
showShareActivity();
return true;
}
});
Preference beastMode = findPreference(getString(R.string.p_beastMode));
beastMode.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@ -207,7 +162,7 @@ public class EditPreferences extends TodorooPreferenceActivity {
}
});
preference = screen.findPreference(getString(R.string.p_files_dir));
Preference preference = screen.findPreference(getString(R.string.p_files_dir));
preference.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference p) {
@ -218,8 +173,6 @@ public class EditPreferences extends TodorooPreferenceActivity {
}
});
addDebugPreferences();
addPreferenceListeners();
disablePremiumPrefs();
@ -274,44 +227,12 @@ public class EditPreferences extends TodorooPreferenceActivity {
findPreference(getString(R.string.p_voiceRemindersEnabled)).setEnabled(hasPowerPack);
}
/** Show about dialog */
private void showAbout () {
String version = "unknown"; //$NON-NLS-1$
try {
version = getPackageManager().getPackageInfo(Constants.PACKAGE, 0).versionName;
} catch (NameNotFoundException e) {
// sadness
}
About.showAbout(this, version);
}
private void showSupport() {
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(SUPPORT_URL));
startActivity(intent);
}
private void showBeastMode() {
Intent intent = new Intent(this, BeastModePreferences.class);
intent.setAction(AstridApiConstants.ACTION_SETTINGS);
startActivity(intent);
}
private void showAccountPrefs() {
if (actFmPreferenceService.isLoggedIn()) {
Intent intent = new Intent(this, ActFmPreferences.class);
intent.setAction(AstridApiConstants.ACTION_SETTINGS);
startActivityForResult(intent, REQUEST_CODE_SYNC);
} else {
Intent intent = new Intent(this, ActFmLoginActivity.class);
startActivity(intent);
}
}
private void showShareActivity() {
Intent intent = new Intent(this, ShareActivity.class);
startActivity(intent);
}
private static final HashMap<Class<?>, Integer> PREFERENCE_REQUEST_CODES = new HashMap<Class<?>, Integer>();
static {
PREFERENCE_REQUEST_CODES.put(SyncProviderPreferences.class, REQUEST_CODE_SYNC);
@ -401,90 +322,11 @@ public class EditPreferences extends TodorooPreferenceActivity {
}
}
@SuppressWarnings("nls")
private void addDebugPreferences() {
if(!Constants.DEBUG) {
return;
}
PreferenceCategory group = new PreferenceCategory(this);
group.setTitle("DEBUG");
getPreferenceScreen().addPreference(group);
Preference preference = new Preference(this);
preference.setTitle("Flush detail cache");
preference.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference p) {
database.openForWriting();
Toast.makeText(EditPreferences.this, "" + taskService.clearDetails(Criterion.all),
Toast.LENGTH_LONG).show();
return false;
}
});
group.addPreference(preference);
preference = new Preference(this);
preference.setTitle("Make Lots of Tasks");
preference.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference p) {
database.openForWriting();
Task task = new Task();
for(int i = 0; i < 100; i++) {
task.clear();
task.setValue(Task.TITLE, Integer.toString(i));
taskService.save(task);
}
DialogUtilities.okDialog(EditPreferences.this, "done", null);
return false;
}
});
group.addPreference(preference);
preference = new Preference(this);
preference.setTitle("Delete all tasks");
preference.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference p) {
database.openForWriting();
taskService.deleteWhere(Criterion.all);
DialogUtilities.okDialog(EditPreferences.this, "done", null);
return false;
}
});
group.addPreference(preference);
preference = new Preference(this);
preference.setTitle("Make lots of contacts");
preference.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference p) {
ContactListAdapter.makeLotsOfContacts();
DialogUtilities.okDialog(EditPreferences.this, "done", null);
return false;
}
});
group.addPreference(preference);
}
@Override
public void updatePreferences(final Preference preference, Object value) {
final Resources r = getResources();
if (r.getString(R.string.p_account).equals(preference.getKey())) {
int title;
int summary;
if (!actFmPreferenceService.isLoggedIn()) {
title = R.string.account_type_title_not_logged_in;
summary = R.string.account_type_summary_not_logged_in;
} else {
title = R.string.actfm_account_info;
summary = R.string.actfm_account_info_summary;
}
preference.setTitle(title);
preference.setSummary(summary);
} else if (r.getString(R.string.p_taskRowStyle_v2).equals(preference.getKey())) {
if (r.getString(R.string.p_taskRowStyle_v2).equals(preference.getKey())) {
try {
Integer valueInt = Integer.parseInt((String) value);
String[] titles = getResources().getStringArray(R.array.EPr_task_row_styles);
@ -510,32 +352,34 @@ public class EditPreferences extends TodorooPreferenceActivity {
e.printStackTrace();
}
return super.onPreferenceChange(p, newValue);
};
}
;
});
} else if (r.getString(R.string.p_showNotes).equals(preference.getKey())) {
if (value != null && !(Boolean)value) {
if (value != null && !(Boolean) value) {
preference.setSummary(R.string.EPr_showNotes_desc_disabled);
} else {
preference.setSummary(R.string.EPr_showNotes_desc_enabled);
}
if((Boolean)value != Preferences.getBoolean(preference.getKey(), false)) {
if ((Boolean) value != Preferences.getBoolean(preference.getKey(), false)) {
taskService.clearDetails(Criterion.all);
Flags.set(Flags.REFRESH);
}
} else if(r.getString(R.string.p_fullTaskTitle).equals(preference.getKey())) {
} else if (r.getString(R.string.p_fullTaskTitle).equals(preference.getKey())) {
if (value != null && (Boolean) value) {
preference.setSummary(R.string.EPr_fullTask_desc_enabled);
} else {
preference.setSummary(R.string.EPr_fullTask_desc_disabled);
}
} else if (r.getString(R.string.p_theme).equals(preference.getKey())) {
if(AndroidUtilities.getSdkVersion() < 5) {
if (AndroidUtilities.getSdkVersion() < 5) {
preference.setEnabled(false);
preference.setSummary(R.string.EPr_theme_desc_unsupported);
} else {
int index = 0;
if(value instanceof String && !TextUtils.isEmpty((String)value)) {
if (value instanceof String && !TextUtils.isEmpty((String) value)) {
index = AndroidUtilities.indexOf(r.getStringArray(R.array.EPr_theme_settings), (String) value);
}
if (index < 0) {
@ -545,12 +389,12 @@ public class EditPreferences extends TodorooPreferenceActivity {
r.getStringArray(R.array.EPr_themes)[index]));
}
} else if (r.getString(R.string.p_theme_widget).equals(preference.getKey())) {
if(AndroidUtilities.getSdkVersion() < 5) {
if (AndroidUtilities.getSdkVersion() < 5) {
preference.setEnabled(false);
preference.setSummary(R.string.EPr_theme_desc_unsupported);
} else {
int index = 0;
if(value instanceof String && !TextUtils.isEmpty((String)value)) {
if (value instanceof String && !TextUtils.isEmpty((String) value)) {
index = AndroidUtilities.indexOf(r.getStringArray(R.array.EPr_theme_widget_settings), (String) value);
}
if (index < 0) {
@ -570,16 +414,16 @@ public class EditPreferences extends TodorooPreferenceActivity {
}
preference.setSummary(r.getString(R.string.p_files_dir_desc, dir));
} else if (booleanPreference(preference, value, R.string.p_field_missed_calls,
R.string.MCA_missed_calls_pref_desc_disabled, R.string.MCA_missed_calls_pref_desc_enabled)) {
R.string.MCA_missed_calls_pref_desc_disabled, R.string.MCA_missed_calls_pref_desc_enabled)) {
;
} else if (booleanPreference(preference, value, R.string.p_calendar_reminders,
R.string.CRA_calendar_reminders_pref_desc_disabled, R.string.CRA_calendar_reminders_pref_desc_enabled)) {
R.string.CRA_calendar_reminders_pref_desc_disabled, R.string.CRA_calendar_reminders_pref_desc_enabled)) {
;
} else if (booleanPreference(preference, value, R.string.p_use_contact_picker,
R.string.EPr_use_contact_picker_desc_disabled, R.string.EPr_use_contact_picker_desc_enabled)) {
R.string.EPr_use_contact_picker_desc_disabled, R.string.EPr_use_contact_picker_desc_enabled)) {
;
} else if (booleanPreference(preference, value, R.string.p_end_at_deadline,
R.string.EPr_cal_end_at_due_time, R.string.EPr_cal_start_at_due_time)) {
R.string.EPr_cal_end_at_due_time, R.string.EPr_cal_start_at_due_time)) {
;
} else if (r.getString(R.string.p_swipe_lists_enabled).equals(preference.getKey())) {
preference.setOnPreferenceChangeListener(new SetResultOnPreferenceChangeListener(RESULT_CODE_PERFORMANCE_PREF_CHANGED) {
@ -590,31 +434,29 @@ public class EditPreferences extends TodorooPreferenceActivity {
return super.onPreferenceChange(p, newValue);
}
});
}
else if (r.getString(R.string.p_force_phone_layout).equals(preference.getKey())) {
preference.setOnPreferenceChangeListener(new SetResultOnPreferenceChangeListener(RESULT_CODE_PERFORMANCE_PREF_CHANGED) {
@Override
} else if (r.getString(R.string.p_force_phone_layout).equals(preference.getKey())) {
preference.setOnPreferenceChangeListener(new SetResultOnPreferenceChangeListener(RESULT_CODE_PERFORMANCE_PREF_CHANGED) {
@Override
public boolean onPreferenceChange(Preference p, Object newValue) {
Preference swipe = findPreference(getString(R.string.p_swipe_lists_enabled));
swipe.setEnabled((Boolean) newValue);
return super.onPreferenceChange(p, newValue);
}
});
}
else if (r.getString(R.string.p_voiceInputEnabled).equals(preference.getKey())) {
if (value != null && !(Boolean)value) {
});
} else if (r.getString(R.string.p_voiceInputEnabled).equals(preference.getKey())) {
if (value != null && !(Boolean) value) {
preference.setSummary(R.string.EPr_voiceInputEnabled_desc_disabled);
} else {
preference.setSummary(R.string.EPr_voiceInputEnabled_desc_enabled);
}
onVoiceInputStatusChanged(preference, (Boolean)value);
onVoiceInputStatusChanged(preference, (Boolean) value);
} else if (r.getString(R.string.p_voiceRemindersEnabled).equals(preference.getKey())) {
if (value != null && !(Boolean)value) {
if (value != null && !(Boolean) value) {
preference.setSummary(R.string.EPr_voiceRemindersEnabled_desc_disabled);
} else {
preference.setSummary(R.string.EPr_voiceRemindersEnabled_desc_enabled);
}
onVoiceReminderStatusChanged(preference, (Boolean)value);
onVoiceReminderStatusChanged(preference, (Boolean) value);
}
}
@ -772,25 +614,4 @@ public class EditPreferences extends TodorooPreferenceActivity {
}
}
}
@Override
protected void onPause() {
super.onPause();
}
@Override
protected void onStart() {
super.onStart();
}
@Override
protected void onResume() {
super.onResume();
}
@Override
protected void onStop() {
super.onStop();
}
}

@ -64,7 +64,6 @@ import com.todoroo.andlib.sql.Join;
import com.todoroo.andlib.utility.AndroidUtilities;
import com.todoroo.andlib.utility.DateUtilities;
import com.todoroo.andlib.utility.Preferences;
import com.todoroo.astrid.actfm.ActFmLoginActivity;
import com.todoroo.astrid.actfm.CommentsActivity;
import com.todoroo.astrid.actfm.TagViewFragment;
import com.todoroo.astrid.actfm.sync.ActFmPreferenceService;
@ -96,7 +95,6 @@ import com.todoroo.astrid.reminders.ReminderDebugContextActions;
import com.todoroo.astrid.service.AddOnService;
import com.todoroo.astrid.service.AstridDependencyInjector;
import com.todoroo.astrid.service.MetadataService;
import com.todoroo.astrid.service.StatisticsConstants;
import com.todoroo.astrid.service.TagDataService;
import com.todoroo.astrid.service.TaskService;
import com.todoroo.astrid.service.ThemeService;

@ -9,7 +9,6 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import com.todoroo.astrid.actfm.sync.ActFmSyncV2Provider;
import com.todoroo.astrid.gtasks.sync.GtasksSyncV2Provider;
import com.todoroo.astrid.service.SyncResultCallbackWrapper.WidgetUpdatingCallbackWrapper;
import com.todoroo.astrid.sync.SyncResultCallback;
@ -30,8 +29,7 @@ public class SyncV2Service {
* for responding to sync requests through this new API.
*/
private static final SyncV2Provider[] providers = new SyncV2Provider[] {
GtasksSyncV2Provider.getInstance(),
new ActFmSyncV2Provider(),
GtasksSyncV2Provider.getInstance()
};
/**

@ -38,7 +38,6 @@ import com.todoroo.andlib.service.ExceptionService;
import com.todoroo.andlib.utility.DateUtilities;
import com.todoroo.andlib.utility.DialogUtilities;
import com.todoroo.andlib.utility.Preferences;
import com.todoroo.astrid.actfm.ActFmLoginActivity;
import com.todoroo.astrid.actfm.EditPeopleControlSet;
import com.todoroo.astrid.actfm.sync.ActFmPreferenceService;
import com.todoroo.astrid.activity.AstridActivity;
@ -59,7 +58,6 @@ import com.todoroo.astrid.gcal.GCalHelper;
import com.todoroo.astrid.repeats.RepeatControlSet;
import com.todoroo.astrid.service.AddOnService;
import com.todoroo.astrid.service.MetadataService;
import com.todoroo.astrid.service.StatisticsConstants;
import com.todoroo.astrid.service.TaskService;
import com.todoroo.astrid.utility.Flags;
import com.todoroo.astrid.voice.VoiceRecognizer;
@ -299,24 +297,7 @@ public class QuickAddBar extends LinearLayout {
}
boolean assignedToMe = usePeopleControl ? peopleControl.willBeAssignedToMe() : true;
if (!assignedToMe && !actFmPreferenceService.isLoggedIn()) {
DialogInterface.OnClickListener okListener = new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface d, int which) {
activity.startActivity(new Intent(activity, ActFmLoginActivity.class));
}
};
DialogInterface.OnClickListener cancelListener = new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface d, int which) {
// Reset people control
peopleControl.assignToMe();
}
};
DialogUtilities.okCancelCustomDialog(activity, activity.getString(R.string.actfm_EPA_login_button),
activity.getString(R.string.actfm_EPA_login_to_share), R.string.actfm_EPA_login_button,
R.string.actfm_EPA_dont_share_button, android.R.drawable.ic_dialog_alert,
okListener, cancelListener);
peopleControl.assignToMe();
return null;
}

@ -41,4 +41,4 @@
<string name="com_facebook_requesterror_reconnect">.ארעה שגיאה בעת החיבור עם פייסבוק, חבר בבקשה מחדש את האפליקציה עם פייסבוק</string>
<string name="com_facebook_requesterror_permissions">.חיבור האפליקציה עם פייסבוק נכשל בשל הרשאות לא מספקות, אנא הענק הרשאות לאפליקציה בכדי שהפעולה תוכל להתבצע</string>
<string name="com_facebook_dialogloginactivity_ok_button">אישור</string>
</resources>
</resources>

@ -41,4 +41,4 @@
<string name="com_facebook_requesterror_reconnect">.ארעה שגיאה בעת החיבור עם פייסבוק, חבר בבקשה מחדש את האפליקציה עם פייסבוק</string>
<string name="com_facebook_requesterror_permissions">.חיבור האפליקציה עם פייסבוק נכשל בשל הרשאות לא מספקות, אנא הענק הרשאות לאפליקציה בכדי שהפעולה תוכל להתבצע</string>
<string name="com_facebook_dialogloginactivity_ok_button">אישור</string>
</resources>
</resources>

@ -4,4 +4,4 @@
<string name="hello">Hello World!</string>
<string name="app_name">Astrid-tests-syncTest</string>
</resources>
</resources>

@ -1,183 +0,0 @@
/**
* Copyright (c) 2012 Todoroo Inc
*
* See the file "LICENSE" for the full license governing this code.
*/
package com.todoroo.astrid.sync.repeats;
import java.io.IOException;
import java.util.concurrent.Semaphore;
import org.json.JSONObject;
import com.google.ical.values.Frequency;
import com.google.ical.values.RRule;
import com.timsu.astrid.R;
import com.todoroo.andlib.data.TodorooCursor;
import com.todoroo.andlib.service.Autowired;
import com.todoroo.andlib.sql.Query;
import com.todoroo.andlib.utility.AndroidUtilities;
import com.todoroo.andlib.utility.DateUtilities;
import com.todoroo.andlib.utility.Preferences;
import com.todoroo.astrid.actfm.sync.ActFmInvoker;
import com.todoroo.astrid.actfm.sync.ActFmPreferenceService;
import com.todoroo.astrid.actfm.sync.ActFmSyncService;
import com.todoroo.astrid.actfm.sync.ActFmSyncV2Provider;
import com.todoroo.astrid.dao.TaskDao.TaskCriteria;
import com.todoroo.astrid.data.Task;
import com.todoroo.astrid.service.MetadataService;
import com.todoroo.astrid.sync.SyncResultCallbackAdapter;
public class RepeatTestsActFmSync extends AbstractSyncRepeatTests<Task> {
@Autowired MetadataService metadataService;
@Autowired ActFmSyncService actFmSyncService;
@Autowired ActFmPreferenceService actFmPreferenceService;
protected static ActFmInvoker invoker = null;
private static final String TEST_ACCOUNT = "sync_tester2@astrid.com";
private static final String TEST_PASSWORD = "wonkwonkjj";
private static boolean initialized = false;
@Override
protected void setUp() throws Exception {
super.setUp();
Preferences.setStringFromInteger(R.string.p_default_urgency_key, 0);
if (!initialized) {
initializeTestService();
}
clearTasks();
}
private void initializeTestService() throws Exception {
invoker = new ActFmInvoker();
authenticate(TEST_ACCOUNT, null, null, ActFmInvoker.PROVIDER_PASSWORD, TEST_PASSWORD);
initialized = true;
}
private void clearTasks() throws Exception {
// JSONObject result = invoker.invoke("task_list", "active", 1);
//
// JSONArray taskList = result.getJSONArray("list");
// for(int i = 0; i < taskList.length(); i++) {
// Task remote = new Task();
// ActFmSyncService.JsonHelper.taskFromJson(taskList.getJSONObject(i), remote, new ArrayList<Metadata>());
//
// remote.setValue(Task.DELETION_DATE, DateUtilities.now());
// actFmSyncService.pushTaskOnSave(remote, remote.getSetValues());
// }
}
private void authenticate(String email, String firstName, String lastName, String provider, String secret) {
try {
JSONObject result = invoker.authenticate(email, firstName, lastName, provider, secret);
String token = invoker.getToken();
postAuthenticate(result, token);
} catch (IOException e) {
e.printStackTrace();
fail("Error authenticating");
}
}
@SuppressWarnings("nls")
private void postAuthenticate(JSONObject result, String token) {
actFmPreferenceService.setToken(token);
Preferences.setString(ActFmPreferenceService.PREF_USER_ID,
Long.toString(result.optLong("id")));
Preferences.setString(ActFmPreferenceService.PREF_NAME, result.optString("name"));
Preferences.setString(ActFmPreferenceService.PREF_EMAIL, result.optString("email"));
Preferences.setString(ActFmPreferenceService.PREF_PICTURE, result.optString("picture"));
}
@Override
protected void waitAndSync() {
AndroidUtilities.sleepDeep(3000L);
final Semaphore sema = new Semaphore(0);
new ActFmSyncV2Provider().synchronizeActiveTasks(true, new SyncResultCallbackAdapter() {
@Override
public void finished() {
sema.release();
}
});
try {
sema.acquire();
} catch (InterruptedException e) {
fail("Interrupted while waiting for sync to finish");
}
AndroidUtilities.sleepDeep(3000L);
}
/**
* @param t
* @param expectedDueDate
*/
@Override
protected Task assertTaskExistsRemotely(Task t, long expectedDueDate) {
// Task remote = new Task();
// try {
// ActFmSyncService.JsonHelper.taskFromJson(invoker.invoke("task_show", "id", t.getValue(Task.UUID)), remote,
// new ArrayList<Metadata>());
// assertTimesMatch(expectedDueDate, remote.getValue(Task.DUE_DATE).longValue());
// } catch (Exception e) {
// e.printStackTrace();
// fail("Error in ActFm invoker");
// }
return null; //remote;
}
@Override
protected void testRepeating(boolean completeBefore, boolean fromCompletion, RRule rrule, Frequency frequency, String title) {
Task t = new Task();
t.setValue(Task.TITLE, title);
long dueDate = DateUtilities.now() + ((completeBefore ? -1 : 1) * DateUtilities.ONE_DAY * 3);
dueDate = Task.createDueDate(Task.URGENCY_SPECIFIC_DAY_TIME, (dueDate / 1000L) * 1000L); // Strip milliseconds
t.setValue(Task.DUE_DATE, dueDate);
if (rrule == null) {
rrule = new RRule();
rrule.setFreq(frequency);
int interval = 5;
rrule.setInterval(interval);
}
String result = rrule.toIcal();
if (fromCompletion)
result = result + ";FROM=COMPLETION";
t.setValue(Task.RECURRENCE, rrule.toIcal());
taskDao.save(t);
waitAndSync();
t = taskDao.fetch(t.getId(), Task.PROPERTIES); // Refetch
Task remoteModel = assertTaskExistsRemotely(t, dueDate);
long completionDate = setCompletionDate(completeBefore, t, remoteModel, dueDate);
waitAndSync();
TodorooCursor<Task> cursor = taskDao.query(Query.select(Task.PROPERTIES).where(TaskCriteria.notDeleted()));
try {
assertEquals(1, cursor.getCount());
cursor.moveToFirst();
t.readFromCursor(cursor);
long fromDate = (fromCompletion? completionDate : dueDate);
long expectedTime = computeNextDueDateFromDate(fromDate, rrule, fromCompletion);
long newDueDate = t.getValue(Task.DUE_DATE);
assertTaskExistsRemotely(t, expectedTime);
assertTrue(t.hasDueTime());
assertEquals(title, t.getValue(Task.TITLE));
assertTimesMatch(expectedTime, newDueDate);
assertFalse(t.isCompleted());
} finally {
cursor.close();
}
}
}

@ -1,32 +0,0 @@
/**
* Copyright (c) 2012 Todoroo Inc
*
* See the file "LICENSE" for the full license governing this code.
*/
package com.todoroo.astrid.sync.repeats;
import java.util.ArrayList;
import com.todoroo.andlib.utility.DateUtilities;
import com.todoroo.astrid.data.Task;
public class RepeatTestsActFmSyncRemote extends RepeatTestsActFmSync {
@Override
protected long setCompletionDate(boolean completeBefore, Task t,
Task remoteModel, long dueDate) {
long completionDate = DateUtilities.now();
ArrayList<Object> params = new ArrayList<Object>();
params.add("completed"); params.add(completionDate / 1000L);
params.add("id"); params.add(remoteModel.getValue(Task.UUID));
try {
invoker.invoke("task_save", params.toArray(new Object[params.size()]));
} catch (Exception e) {
e.printStackTrace();
fail("Error in actfm invoker");
}
return completionDate;
}
}
Loading…
Cancel
Save