From 4e4662871ce872477d203f1f87b5159ebb507a8a Mon Sep 17 00:00:00 2001 From: limqhz Date: Mon, 27 Jul 2020 14:38:53 +0800 Subject: [PATCH] simple project --- .../ydd/sportfaceid/config/SDAppConfig.java | 100 +----------------- 1 file changed, 1 insertion(+), 99 deletions(-) diff --git a/app/src/main/java/com/ydd/sportfaceid/config/SDAppConfig.java b/app/src/main/java/com/ydd/sportfaceid/config/SDAppConfig.java index 1cbda21..7174f84 100644 --- a/app/src/main/java/com/ydd/sportfaceid/config/SDAppConfig.java +++ b/app/src/main/java/com/ydd/sportfaceid/config/SDAppConfig.java @@ -1,51 +1,12 @@ package com.ydd.sportfaceid.config; import android.content.Context; -import android.content.SharedPreferences; -import android.text.TextUtils; -import android.util.Log; - -import org.w3c.dom.Text; public class SDAppConfig { - public final static String TAG = "sanderConfig"; - public static SDAppConfig config = null; - - public static String Key_sace_cache = "save_cache"; - - public static String camera_rstp_first = "rtsp://192.168.1.161/user=admin&password=&channel=1&stream=0.sdp?"; - public static String camera_rstp_sconde = "rtsp://192.168.1.160:8554/0/0/0"; - - - public String camera_local_rstp_first; - public final static String key_camera_local_rstp_first = "key_camera_local_rstp_first"; - - public String camera_local_rstp_last; - public final static String key_camera_local_rstp_last = "key_camera_local_rstp_last"; - - private Context mContext; - private SharedPreferences sp; - private SharedPreferences.Editor sp_editor; - - public int getCurrent_selected_camera() { - if (this.current_selected_camera >= 0 ){ - this.current_selected_camera = sp.getInt(key_current_selectd_camera,-1); - } - return current_selected_camera; - } - - public void setCurrent_selected_camera(int current_selected_camera) { - this.current_selected_camera = current_selected_camera; - sp_editor.putInt(key_current_selectd_camera, current_selected_camera); - sp_editor.commit(); - } - - private final static String key_current_selectd_camera = "key_current_selectd_camera"; - private int current_selected_camera = -1; public static SDAppConfig getInstance(){ synchronized (SDAppConfig.class){ if (config == null){ @@ -58,67 +19,8 @@ public class SDAppConfig { public void init(Context context){ this.mContext = context; synchronized (SDAppConfig.class){ - if (sp == null){ - sp = this.mContext.getSharedPreferences(Key_sace_cache, Context.MODE_PRIVATE); - sp_editor = sp.edit(); - this.configData(); - }else { - Log.e(TAG, "这里只能被执行一次"); - } + // Do SomeThing } } - public void configData(){ - this.camera_local_rstp_first = sp.getString(key_camera_local_rstp_first, ""); - if (TextUtils.isEmpty(this.camera_local_rstp_first)){ - this.setCamera_local_rstp_first(camera_rstp_first); - } - this.camera_local_rstp_last = sp.getString(key_camera_local_rstp_last, ""); - if (TextUtils.isEmpty(this.camera_local_rstp_last)){ - this.setCamera_local_rstp_last(camera_rstp_sconde); - } - this.current_selected_camera = sp.getInt(key_current_selectd_camera,-1); - if (this.current_selected_camera == -1){ - this.setCurrent_selected_camera(0); - } - - } - - - - public String getCamera_local_rstp_first() { - if (TextUtils.isEmpty(camera_local_rstp_first)){ - camera_local_rstp_first = sp.getString(key_camera_local_rstp_first, ""); - } - return camera_local_rstp_first; - } - - public void setCamera_local_rstp_first(String camera_local_rstp_first) { - this.camera_local_rstp_first = camera_local_rstp_first; - sp_editor.putString(key_camera_local_rstp_first, camera_local_rstp_first); - sp_editor.commit(); - } - - public String getCamera_local_rstp_last() { - if (TextUtils.isEmpty(camera_local_rstp_last)){ - camera_local_rstp_last = sp.getString(key_camera_local_rstp_last, ""); - } - return camera_local_rstp_last; - } - - public void setCamera_local_rstp_last(String camera_local_rstp_last) { - this.camera_local_rstp_last = camera_local_rstp_last; - sp_editor.putString(key_camera_local_rstp_last, camera_local_rstp_last); - sp_editor.commit(); - } - - public String getCurrentCameraUrl(){ - if (this.current_selected_camera == 1){ - return this.getCamera_local_rstp_last(); - } - return this.getCamera_local_rstp_first(); - } - - - }