Sync prefs pages now show name or email of logged in user

pull/14/head
Sam Bosley 13 years ago
parent 556ddfa204
commit a92f94703a

@ -189,6 +189,9 @@
<!-- Synchronize Now Button if not logged in--> <!-- Synchronize Now Button if not logged in-->
<string name="sync_SPr_sync_log_in">Log In &amp; Synchronize!</string> <string name="sync_SPr_sync_log_in">Log In &amp; Synchronize!</string>
<!-- Sync: Prefix string before logged in identifier -->
<string name="sync_SPr_logged_in_prefix">Logged in as:</string>
<!-- Sync: Clear Data Title --> <!-- Sync: Clear Data Title -->
<string name="sync_SPr_forget">Log Out</string> <string name="sync_SPr_forget">Log Out</string>
<!-- Sync: Clear Data Description --> <!-- Sync: Clear Data Description -->

@ -185,8 +185,12 @@ abstract public class SyncProviderPreferences extends TodorooPreferenceActivity
return true; return true;
} }
}); });
if(!loggedIn) if(!loggedIn) {
preference.setTitle(R.string.sync_SPr_sync_log_in); preference.setTitle(R.string.sync_SPr_sync_log_in);
preference.setSummary("");
}
else
preference.setSummary(r.getString(R.string.sync_SPr_logged_in_prefix) + " " + getUtilities().getLoggedInUserName());
} }
// log out button // log out button

@ -51,6 +51,9 @@ abstract public class SyncProviderUtilities {
return getPrefs().getString(getIdentifier() + PREF_TOKEN, null); return getPrefs().getString(getIdentifier() + PREF_TOKEN, null);
} }
/** Returns something like "Logged in as: user@gmail.com" */
abstract public String getLoggedInUserName();
/** Sets the authentication token. Set to null to clear. */ /** Sets the authentication token. Set to null to clear. */
public void setToken(String setting) { public void setToken(String setting) {
Editor editor = getPrefs().edit(); Editor editor = getPrefs().edit();

@ -111,4 +111,9 @@ public class ActFmPreferenceService extends SyncProviderUtilities {
return user; return user;
} }
@Override
public String getLoggedInUserName() {
return Preferences.getStringValue(PREF_NAME);
}
} }

@ -48,4 +48,9 @@ public class GtasksPreferenceService extends SyncProviderUtilities {
/** Pref that is set once migration to new GTasks API has occurred */ /** Pref that is set once migration to new GTasks API has occurred */
public static final String PREF_MIGRATION_HAS_OCCURRED = IDENTIFIER + "_migrated"; //$NON-NLS-1$ public static final String PREF_MIGRATION_HAS_OCCURRED = IDENTIFIER + "_migrated"; //$NON-NLS-1$
@Override
public String getLoggedInUserName() {
return Preferences.getStringValue(PREF_USER_NAME);
}
} }

@ -120,5 +120,8 @@ public class OpencrxCoreUtils extends SyncProviderUtilities{
return 0; return 0;
} }
@Override
public String getLoggedInUserName() {
return "";
}
} }

@ -71,4 +71,9 @@ public class ProducteevUtilities extends SyncProviderUtilities {
// prevent instantiation // prevent instantiation
} }
@Override
public String getLoggedInUserName() {
return Preferences.getStringValue(R.string.producteev_PPr_email);
}
} }

@ -34,7 +34,8 @@
<Preference <Preference
android:key="@string/sync_SPr_sync_key" android:key="@string/sync_SPr_sync_key"
android:title="@string/sync_SPr_sync" /> android:title="@string/sync_SPr_sync"
android:summary=""/>
<Preference <Preference
android:key="@string/sync_SPr_forget_key" android:key="@string/sync_SPr_forget_key"

@ -64,4 +64,9 @@ public class MilkUtilities extends SyncProviderUtilities {
return R.string.rmilk_MPr_interval_key; return R.string.rmilk_MPr_interval_key;
} }
@Override
public String getLoggedInUserName() {
return "";
}
} }

Loading…
Cancel
Save