ztvxurbg.zip

  • 1PleL5
    了解作者
  • R language
    开发工具
  • 2KB
    文件大小
  • zip
    文件格式
  • 0
    收藏次数
  • 1 积分
    下载积分
  • 0
    下载次数
  • 2018-10-15 22:10
    上传日期
ssh实现简单的论坛帖子增删改查,分页,回复帖子的项目实例
ztvxurbg.zip
  • ChatPresentComponent.java
    638B
  • UserStatusPresentComponent.java
    680B
  • FriendshipView.java
    183B
  • StatusDetailPresentComponent.java
    682B
  • UP.java
    2.5KB
内容介绍
package com.caij.emore.account; import android.content.SharedPreferences; import android.text.TextUtils; import com.caij.emore.EMApplication; import com.caij.emore.event.EventTag; import com.caij.emore.utils.GsonUtils; import com.caij.lib.util.SPBuilder; import com.caij.emore.utils.rxbus.RxBus; import com.google.gson.reflect.TypeToken; import java.util.ArrayList; import java.util.Iterator; import java.util.List; /** * Created by Ca1j on 2017/2/23. */ public class UP { private static final String ACCOUNT = "account_sp"; private static final String TOKENS = "tokens"; private static final SharedPreferences sharedPreferences; static { sharedPreferences = new SPBuilder(EMApplication.getInstance()) .open(ACCOUNT); } public static List<Token> loadTokens() { String tokensStr = sharedPreferences.getString(TOKENS, null); if (!TextUtils.isEmpty(tokensStr)) { List<Token> tokens = GsonUtils.fromJson(tokensStr, new TypeToken<List<Token>>(){}.getType()); if (tokens != null && tokens.size() > 0) { return tokens; } } return null; } public static void switchAccount(Token token) { if (token == null) throw new NullPointerException(); List<Token> tokens = loadTokens(); List<Token> saves = new ArrayList<>(); token.setStatus(Token.STATUS_USING); saves.add(token); if (tokens != null && tokens.size() > 0) { for (int i = 0 ; i < tokens.size(); i ++) { Token temp = tokens.get(i); if (temp.uid != token.uid) { temp.setStatus(Token.STATUS_BACKGROUND); saves.add(temp); } } } saveTokens(saves); } public static void deleteAccount(Token token) { List<Token> tokens = loadTokens(); if (tokens != null && tokens.size() > 0) { Iterator<Token> tokenIterator = tokens.iterator(); while (tokenIterator.hasNext()) { Token t = tokenIterator.next(); if (t.uid == token.uid) { tokenIterator.remove(); break; } } } saveTokens(tokens); } private static void saveTokens(List<Token> tokens) { sharedPreferences.edit() .putString(TOKENS, GsonUtils.toJson(tokens)) .apply(); RxBus.get().post(EventTag.EVENT_TOKEN_UPDATE, tokens); } }
评论
    相关推荐
    • Effective C#
      Effective C#. Effective C#.
    • c# splashsreen
      c# splashsreen c# splashsreen c# splashsreen c# splashsreen c# splashsreen c# splashsreen
    • c# SmartGridView
      c# SmartGridView c# SmartGridView
    • C# LRUcache
      C# LRUcache C# LRUcache
    • C# VistaButton
      C# VistaButto,C# button控件
    • autoupdater C#
      autoupdater C# autoupdater C#
    • c# splashsreen
      c# splashsreen c# splashsreen c# splashsreen c# splashsreen c# splashsreen
    • c# DotNetBar
      c# DotNetBar.rar c# DotNetBar.rar
    • C# 教程
      C#教程》以Microsoft Visual Studio 2008作为操作平台,包含教程、练习、实验部分。教程部分首先熟悉开发环境,然后比较系统地介绍C#语言基础、C#面向对象编程基础和C#面向对象编程进阶;在此基础上系统介绍...
    • c#点歌系统
      c#点歌系统c#点歌系统c#点歌系统c#点歌系统c#点歌系统c#点歌系统c#点歌系统c#点歌系统c#点歌系统c#点歌系统c#点歌系统c#点歌系统c#点歌系统c#点歌系统c#点歌系统c#点歌系统c#点歌系统c#点歌系统c#点歌系统c#点歌系统...