package com.yeshi.makemoney.video.app.utils.videos;
|
|
import android.content.Context;
|
import android.content.SharedPreferences;
|
|
public class NewsGoldCornUtil {
|
|
/**
|
* 增加资讯阅读数量
|
*
|
* @param context
|
*/
|
public static void addNewsCount(Context context) {
|
SharedPreferences sharedPreferences = context.getSharedPreferences("news_goldcorn", Context.MODE_PRIVATE);
|
int old = sharedPreferences.getInt("count", 0);
|
SharedPreferences.Editor editor = sharedPreferences.edit();
|
editor.putInt("count", old + 1);
|
editor.commit();
|
}
|
|
|
/**
|
* 获取资讯阅读数量
|
*
|
* @param context
|
* @return
|
*/
|
public static int getNewsCount(Context context) {
|
SharedPreferences sharedPreferences = context.getSharedPreferences("news_goldcorn", Context.MODE_PRIVATE);
|
int count = sharedPreferences.getInt("count", 0);
|
return count;
|
}
|
|
/**
|
* 设置资讯阅读数量
|
*
|
* @param count
|
* @param context
|
*/
|
public static void setNewsCount(int count, Context context) {
|
SharedPreferences sharedPreferences = context.getSharedPreferences("news_goldcorn", Context.MODE_PRIVATE);
|
SharedPreferences.Editor editor = sharedPreferences.edit();
|
editor.putInt("count", count);
|
editor.commit();
|
}
|
|
|
}
|