Android Open Source - Kwitter Settings






From Project

Back to project page Kwitter.

License

The source code is released under:

Apache License

If you think the Android project Kwitter 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.krossovochkin.kwitter.toolbox;
//  w w  w  .j av  a2s.  co m
import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;

/**
 * Created by Vasya Drobushkov <vasya.drobushkov@gmail.com> on 04.08.14.
 */
public class Settings {

    public static final String ACCESS_TOKEN_KEY = "access_token";
    public static final String ACCESS_TOKEN_SECRET_KEY = "access_token_secret";
    public static final String AUTH_DATA_EXISTS = "auth_data_exists";

    public static String getString(Context context, String key) {
        SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context);
        return sharedPreferences.getString(key, null);
    }

    public static boolean getBoolean(Context context, String key, boolean defaultValue) {
        SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context);
        return sharedPreferences.getBoolean(key, defaultValue);
    }

    public static void saveAuthData(Context context, String accessToken, String accessTokenSecret) {
        SharedPreferences.Editor editor = PreferenceManager.getDefaultSharedPreferences(context).edit();
        editor.putString(ACCESS_TOKEN_KEY, accessToken);
        editor.putString(ACCESS_TOKEN_SECRET_KEY, accessTokenSecret);
        editor.putBoolean(AUTH_DATA_EXISTS, true);
        editor.apply();
    }

}




Java Source Code List

com.krossovochkin.kwitter.activities.AuthActivity.java
com.krossovochkin.kwitter.activities.MainActivity.java
com.krossovochkin.kwitter.activities.SettingsActivity.java
com.krossovochkin.kwitter.adapters.TimelineAdapter.java
com.krossovochkin.kwitter.adapters.ViewPagerAdapter.java
com.krossovochkin.kwitter.fragments.BaseTimelineFragment.java
com.krossovochkin.kwitter.fragments.MainFragment.java
com.krossovochkin.kwitter.fragments.MentionsFragment.java
com.krossovochkin.kwitter.fragments.NavigationDrawerFragment.java
com.krossovochkin.kwitter.fragments.SendTweetFragment.java
com.krossovochkin.kwitter.fragments.SettingsFragment.java
com.krossovochkin.kwitter.fragments.TimelineFragment.java
com.krossovochkin.kwitter.fragments.ViewPagerFragment.java
com.krossovochkin.kwitter.listeners.FavoriteListener.java
com.krossovochkin.kwitter.listeners.GetTimelineListener.java
com.krossovochkin.kwitter.listeners.RetweetListener.java
com.krossovochkin.kwitter.listeners.SendTweetListener.java
com.krossovochkin.kwitter.listeners.TweetActionListener.java
com.krossovochkin.kwitter.listeners.TwitterActionListener.java
com.krossovochkin.kwitter.tasks.FavoriteAsyncTask.java
com.krossovochkin.kwitter.tasks.GetMentionsAsyncTask.java
com.krossovochkin.kwitter.tasks.GetTimelineAsyncTask.java
com.krossovochkin.kwitter.tasks.RetweetAsyncTask.java
com.krossovochkin.kwitter.tasks.SendReplyAsyncTask.java
com.krossovochkin.kwitter.tasks.SendTweetAsyncTask.java
com.krossovochkin.kwitter.toolbox.Constants.java
com.krossovochkin.kwitter.toolbox.FileManager.java
com.krossovochkin.kwitter.toolbox.KeyboardHelper.java
com.krossovochkin.kwitter.toolbox.Settings.java