美文网首页
可以作为保存全局数据使用,比如在mianActivity中使用,

可以作为保存全局数据使用,比如在mianActivity中使用,

作者: 皓皓amous | 来源:发表于2022-06-16 15:33 被阅读0次
    public class CacheManager {
    
      private static volatile CacheManager instance;
    
      private OnMainActivityListener mainActivityListener;
    
      public List<BaseInfoBean> inInterDataList = new ArrayList<>();
    
      public List<BaseInfoBean> baseInfoBeansLists = new ArrayList<>();
    
      private int chatScreenHeight;//chatActivity的可视布局高度,用于软键盘的全屏与缩放功能计算
    
      public boolean smsStatus;
    
      public static CacheManager getInstance(){
          if(instance == null){
              synchronized (CacheManager.class) {
                  if(instance == null){
                      instance = new CacheManager();
                  }
              }
          }
          return instance;
      }
    
      public OnMainActivityListener getMainActivityListener() {
          return mainActivityListener;
      }
    
      public void setMainActivityListener(OnMainActivityListener mainActivityListener) {
          this.mainActivityListener = mainActivityListener;
      }
    
      public void clear(){
          this.mainActivityListener = null;
          instance = null;
      }
    
      public int getChatScreenHeight() {
          return chatScreenHeight;
      }
    
      public  void setChatScreenHeight(int chatScreenHeight) {
          this.chatScreenHeight = chatScreenHeight;
      }
    
      public void setBaseBeaanListTest(List<BaseInfoBean> baseInfoBeansList) {
          this.baseInfoBeansLists = baseInfoBeansList;
          for (int i= 0;i< baseInfoBeansList.size();i++) {
              if (baseInfoBeansList.get(i).getServerFlag() != 0) {
                  this.inInterDataList.add(baseInfoBeansLists.get(i));
              }
          }
      }
    
      public void setSmsStatus(boolean smsStatus) {
          this.smsStatus = smsStatus;
      }
    
      private int rtcSecLevelSend=0;//发起请求,由输入框,聊天对象等级更新;
    
      public int getRtcSecLevelReceive() {
          int rtcSecLevelReceive=0;
          try{
              rtcSecLevelReceive = Integer.parseInt(VIMVideoClient.videoState.getMultiExtend().get("securityLevel"));
          }catch (Exception e){
              VideoLog.d("VideoRequestHandler"," getRtcSecLevelReceive e "+ e.toString());
          }
          VideoLog.d("VideoRequestHandler"," getRtcSecLevelReceive "+ rtcSecLevelReceive);
          return rtcSecLevelReceive;
      }
    
      public void setRtcSecLevelReceive(int rtcSecLevelReceive) {
          VideoLog.d("VideoRequestHandler"," setRtcSecLevelReceive "+ rtcSecLevelReceive);
          VIMVideoClient.videoState.getMultiExtend().put("securityLevel",rtcSecLevelReceive+"");
      }
    
      public int getRtcSecLevelSend() {
          return rtcSecLevelSend;
      }
    
      public void setRtcSecLevelSend(int rtcSecLevelSend) {
          this.rtcSecLevelSend = rtcSecLevelSend;
      }
    }
    
    
    
    
    

    相关文章

      网友评论

          本文标题:可以作为保存全局数据使用,比如在mianActivity中使用,

          本文链接:https://www.haomeiwen.com/subject/devxvrtx.html