Android Open Source - Lessaging User Pref






From Project

Back to project page Lessaging.

License

The source code is released under:

GNU General Public License

If you think the Android project Lessaging 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 fr.lessaging.utils;
//w w w.  jav a  2  s  . c o  m
import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;

/**
 * Created by lheido on 06/12/14.
 */
public class UserPref {

    public static final String DELETE_OLD_SMS_KEY = "delete_old_sms";
    public static final String HIDE_KEYBOARD_KEY = "hide_keyboard";
    public static final String FIRST_UPPER_LETTER_KEY = "first_upper_letter";
    public static final String DRAWER_START_OPENED_KEY = "drawer_start_opened";
    public static final String RECEIVER_NOTIFICATION_KEY = "receiver_notification";
    public static final String RECEIVER_VIBRATE_KEY = "receiver_vibrate";
    public static final String RECEIVER_VIBRATE_DELIVERED_KEY = "receiver_vibrate_delivered";
    public static final String RECEIVER_RINGTONE_KEY = "receiver_ringtone";

    public static final String SMS_ONLOAD_KEY = "sms_onload";
    public static final String TEXT_SIZE_KEY = "text_size";
    public static final String OLD_MESSAGE_NUM_KEY = "limit_old_sms";
    public static final String CONVERSATION_JAZZYEFFECT_KEY = "conversation_jazzyeffect";
    public static final String LIST_CONVERSATIONS_JAZZYEFFECT_KEY = "list_conversations_jazzyeffect";

    public static final int maxSms = 21;
    public static final  float textSize = 13.0F;
    public static final  int oldMessageNum = 500;
    public static final  int conversationEffect = 14;
    public static final  int listConversationEffect = 14;

    private static SharedPreferences userPref(Context context){
        return PreferenceManager.getDefaultSharedPreferences(context);
    }

    public static int getMaxSms(Context context) {
        return Integer.parseInt(userPref(context).getString(SMS_ONLOAD_KEY, ""+maxSms));
    }

    public static float getTextSize(Context context) {
        return Float.parseFloat(userPref(context).getString(TEXT_SIZE_KEY, ""+textSize));
    }

    public static int getOldMessageNum(Context context) {
        return Integer.parseInt(userPref(context).getString(OLD_MESSAGE_NUM_KEY, ""+oldMessageNum));
    }

    public static int getConversationEffect(Context context) {
        return Integer.parseInt(userPref(context).getString(CONVERSATION_JAZZYEFFECT_KEY, ""+conversationEffect));
    }

    public static int getListConversationEffect(Context context) {
        return Integer.parseInt(userPref(context).getString(LIST_CONVERSATIONS_JAZZYEFFECT_KEY, ""+listConversationEffect));
    }

    public static boolean deleteOldSmsIsEnabled(Context context){
        return userPref(context).getBoolean(DELETE_OLD_SMS_KEY, false);
    }
    public static boolean hideKeyboardIsEnabled(Context context){
        return userPref(context).getBoolean(HIDE_KEYBOARD_KEY, true);
    }
    public static boolean firstUpperLetterIsEnabled(Context context){
        return userPref(context).getBoolean(FIRST_UPPER_LETTER_KEY, true);
    }
    public static boolean drawerStartOpenedIsEnabled(Context context){
        return userPref(context).getBoolean(DRAWER_START_OPENED_KEY, true);
    }
    public static boolean receiverNotificationIsEnabled(Context context){
        return userPref(context).getBoolean(RECEIVER_NOTIFICATION_KEY, true);
    }
    public static boolean receiverVibrateIsEnabled(Context context){
        return userPref(context).getBoolean(RECEIVER_VIBRATE_KEY, true);
    }
    public static boolean receiverVibrateDelyveredIsEnabled(Context context){
        return userPref(context).getBoolean(RECEIVER_VIBRATE_DELIVERED_KEY, true);
    }
    public static boolean receiverRingtoneIsEnabled(Context context){
        return userPref(context).getBoolean(RECEIVER_RINGTONE_KEY, true);
    }
}




Java Source Code List

fr.lessaging.ApplicationTest.java
fr.lessaging.MainActivity.java
fr.lessaging.adapters.ConversationsListAdapter.java
fr.lessaging.adapters.MmsAdapter.java
fr.lessaging.adapters.SmsAdapter.java
fr.lessaging.adapters.SmsBaseAdapter.java
fr.lessaging.adapters.ViewPagerAdapter.java
fr.lessaging.conversation.Conversation.java
fr.lessaging.conversation.ConversationsList.java
fr.lessaging.fragments.CurrentConversationFragment.java
fr.lessaging.fragments.MmsFragment.java
fr.lessaging.fragments.NavigationDrawerFragment.java
fr.lessaging.fragments.SmsBaseFragment.java
fr.lessaging.fragments.SmsFragment.java
fr.lessaging.message.MessageManager.java
fr.lessaging.message.MessageTaskCallback.java
fr.lessaging.message.Message.java
fr.lessaging.message.MmsTask.java
fr.lessaging.message.SmsTask.java
fr.lessaging.preferences.LessagingPreference.java
fr.lessaging.preferences.PrefConversationFragment.java
fr.lessaging.preferences.PrefGeneralFragment.java
fr.lessaging.preferences.PrefListConversationsFragment.java
fr.lessaging.preferences.PrefReceiveFragment.java
fr.lessaging.receiver.MessageReceiver.java
fr.lessaging.utils.AppConfig.java
fr.lessaging.utils.BuildFragment.java
fr.lessaging.utils.LessagingNotification.java
fr.lessaging.utils.LessagingVibrator.java
fr.lessaging.utils.UserPref.java