Android Open Source - post-to-friendfeed Auth Pref Adapter






From Project

Back to project page post-to-friendfeed.

License

The source code is released under:

Copyright (c) 2010, Larry Myers All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: R...

If you think the Android project post-to-friendfeed listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.larrymyers.android.posttoff;
//w ww . ja  va  2s  . com
import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;

public class AuthPrefAdapter implements AuthAdapter {
    
    private Context mCtx;
    
    public AuthPrefAdapter(Context ctx) {
        this.mCtx = ctx;
    }
    
    public void close() {
        // nothing to do here
    }

    public void createAuth(Auth auth) {
        SharedPreferences prefs = mCtx.getSharedPreferences("prefs", 0);
        Editor editor = prefs.edit();
        
        editor.putString("username", auth.getUsername());
        editor.putString("remoteKey", auth.getRemoteKey());
        
        editor.commit();
    }

    public Auth getAuth() {
        SharedPreferences prefs = mCtx.getSharedPreferences("prefs", 0);
        
        Auth auth = new Auth();
        
        auth.setUsername(prefs.getString("username", null));
        auth.setRemoteKey(prefs.getString("remoteKey", null));
        
        return auth;
    }

    public void updateAuth(Auth auth) {
        createAuth(auth);
    }
}




Java Source Code List

com.larrymyers.android.posttoff.AuthAdapter.java
com.larrymyers.android.posttoff.AuthDbAdapter.java
com.larrymyers.android.posttoff.AuthPrefAdapter.java
com.larrymyers.android.posttoff.AuthView.java
com.larrymyers.android.posttoff.Auth.java
com.larrymyers.android.posttoff.EntryAdapter.java
com.larrymyers.android.posttoff.EntryDbAdapter.java
com.larrymyers.android.posttoff.EntryService.java
com.larrymyers.android.posttoff.EntryView.java
com.larrymyers.android.posttoff.Entry.java
com.larrymyers.android.posttoff.OpenFF.java