liuzhenxing1118 3 年之前
父节点
当前提交
f6b5979cd8

+ 2 - 2
.idea/deploymentTargetDropDown.xml

@@ -7,11 +7,11 @@
         <deviceKey>
           <Key>
             <type value="VIRTUAL_DEVICE_PATH" />
-            <value value="$USER_HOME$/.android/avd/xp_360x400_API_33.avd" />
+            <value value="$USER_HOME$/.android/avd/xp_watch_API_27.avd" />
           </Key>
         </deviceKey>
       </Target>
     </targetSelectedWithDropDown>
-    <timeTargetWasSelectedWithDropDown value="2022-08-01T02:08:23.899295Z" />
+    <timeTargetWasSelectedWithDropDown value="2022-08-08T06:03:02.216340Z" />
   </component>
 </project>

+ 2 - 2
app/src/main/java/com/xplora/xpchat/activity/ContactsActivity.java

@@ -37,7 +37,7 @@ public class ContactsActivity extends BaseActivity {
         super.onCreateBase();
         setContentView(R.layout.activity_itemlist);
 
-        if (!Macros.DEBUG_DATABASE) {
+        if (!Macros.DEBUG_DB_CHAT) {
             //registerContentObserver();
         }
     }
@@ -81,7 +81,7 @@ public class ContactsActivity extends BaseActivity {
 
     private void onSelectItem(int itemIndex, GridModel gridModel) {
         if (gridModel.type == Constant.E_FUNCTION.ADD) {
-            if (Macros.DEBUG_DATABASE_INSET) {
+            if (Macros.DEBUG_DB_INSET) {
                 new DatabaseUtils().testInsertContact();
             } else {
                 //加好友

+ 2 - 2
app/src/main/java/com/xplora/xpchat/activity/PagerActivity.java

@@ -290,7 +290,7 @@ public class PagerActivity extends BaseActivity implements Listener.PlayListener
 
         checkShareMessage();
 
-        if (!Macros.DEBUG_DATABASE) {
+        if (!Macros.DEBUG_DB_CHAT) {
             registerContentObserver();
         }
     }
@@ -310,7 +310,7 @@ public class PagerActivity extends BaseActivity implements Listener.PlayListener
             onRecordBtnTouchCancel();
         }
 
-        if (!Macros.DEBUG_DATABASE) {
+        if (!Macros.DEBUG_DB_CHAT) {
             unRegisterContentObserver();
         }
     }

+ 15 - 15
app/src/main/java/com/xplora/xpchat/manager/DatabaseUtils.java

@@ -24,7 +24,7 @@ public class DatabaseUtils {
 
     @SuppressLint("Range")
     public ArrayList<ContactBean> loadContacts() {
-        if (Macros.DEBUG_DATABASE) {
+        if (Macros.DEBUG_DB_CHAT) {
             return testContactList();
         } else {
             ArrayList<ContactBean> arrayList = new ArrayList<>();
@@ -56,7 +56,7 @@ public class DatabaseUtils {
     public ArrayList<GroupBean> loadFriendGroup() {
         ArrayList<GroupBean> arrayList = new ArrayList<>();
 
-//        if (Macros.DEBUG_DATABASE) {
+//        if (Macros.DEBUG_DB_CHAT) {
 //        }
 //        else {
 //            Cursor cursor = ChatApplication.getsContext().getContentResolver().query(Uri.parse(FGConstant.DB_GROUP), null, null, null, null);
@@ -78,7 +78,7 @@ public class DatabaseUtils {
 
     @SuppressLint("Range")
     public ArrayList<String> loadPresetText(String language) {
-        if (Macros.DEBUG_DATABASE) {
+        if (Macros.DEBUG_DB_PRESETTEXT) {
             return testPresetText();
         } else {
             ArrayList<String> arrayList = new ArrayList<>();
@@ -97,7 +97,7 @@ public class DatabaseUtils {
 
     @SuppressLint("Range")
     public List<EmojiBean> loadEmoji() {
-        if (Macros.DEBUG_DATABASE) {
+        if (Macros.DEBUG_DB_EMOJI) {
             return testEmojiList();
         } else {
             ArrayList<EmojiBean> arrayList = new ArrayList<>();
@@ -120,7 +120,7 @@ public class DatabaseUtils {
 
     @SuppressLint("Range")
     public ArrayList<MessageBean> loadNewMessages(int chatType, String chatId) {
-        if (Macros.DEBUG_DATABASE) {
+        if (Macros.DEBUG_DB_CHAT) {
             return testChatList();
         } else {
             ArrayList<MessageBean> arrayList = new ArrayList<>();
@@ -140,7 +140,7 @@ public class DatabaseUtils {
     @SuppressLint("Range")
     public ArrayList<MessageBean> loadOldMessages(int chatType, String chatId, int offset) {
         ArrayList<MessageBean> arrayList = new ArrayList<>();
-        if (Macros.DEBUG_DATABASE) {
+        if (Macros.DEBUG_DB_CHAT) {
             return arrayList;
         } else {
             Uri uri = Uri.parse(Constant.AUTHORITIES_CHAT + "/chat_msg" + "/{" + chatId + "}");
@@ -157,7 +157,7 @@ public class DatabaseUtils {
     }
 
     public int insert(MessageBean bean) {
-        if (Macros.DEBUG_DATABASE) {
+        if (Macros.DEBUG_DB_CHAT) {
             return ToolsUtils.getCurrentTime() % 1000000;
         } else {
             Uri insertUri = Uri.parse(Constant.DB_CHAT);
@@ -201,7 +201,7 @@ public class DatabaseUtils {
     }
 
     public void delete(int primaryKey) {
-        if (Macros.DEBUG_DATABASE) {
+        if (Macros.DEBUG_DB_CHAT) {
         } else {
             Uri uri = Uri.parse(Constant.DB_CHAT + "/" + primaryKey);
             int returnValue = ChatApplication.getsContext().getContentResolver().delete(uri,  null, null);
@@ -209,7 +209,7 @@ public class DatabaseUtils {
     }
 
     public void modifyMessageState(long primaryKey, int state) {
-        if (Macros.DEBUG_DATABASE)
+        if (Macros.DEBUG_DB_CHAT)
             return ;
 
         ContentValues values = new ContentValues();
@@ -221,7 +221,7 @@ public class DatabaseUtils {
     }
 
     public void modifyMessagePath(long primaryKey, String state, boolean isVideoPath) {
-        if (Macros.DEBUG_DATABASE)
+        if (Macros.DEBUG_DB_CHAT)
             return ;
 
         ContentValues values = new ContentValues();
@@ -237,7 +237,7 @@ public class DatabaseUtils {
     }
 
     public void updateUnread(ContactBean cb) {
-//        if (Macros.DEBUG_DATABASE)
+//        if (Macros.DEBUG_DB_CHAT)
 //            return ;
 //
 //        Uri uri = Uri.parse(Constant.DB_CONTACTS);
@@ -257,7 +257,7 @@ public class DatabaseUtils {
     }
 
     public StringBuilder getGroupFamilySelection() {
-        if (Macros.DEBUG_DATABASE)
+        if (Macros.DEBUG_DB_CHAT)
             return null;
 
         StringBuilder stringBuilder = new StringBuilder();
@@ -269,7 +269,7 @@ public class DatabaseUtils {
     }
 
     public StringBuilder getGroupFriendsSelection(String chatId) {
-        if (Macros.DEBUG_DATABASE)
+        if (Macros.DEBUG_DB_CHAT)
             return null;
 
         StringBuilder stringBuilder = new StringBuilder();
@@ -283,7 +283,7 @@ public class DatabaseUtils {
     }
 
     public StringBuilder getPrivateSelection(String chatId) {
-        if (Macros.DEBUG_DATABASE)
+        if (Macros.DEBUG_DB_CHAT)
             return null;
 
         StringBuilder stringBuilder = new StringBuilder();
@@ -338,7 +338,7 @@ public class DatabaseUtils {
     }
 
     public static void testInsertContact() {
-        if (Macros.DEBUG_DATABASE) {
+        if (Macros.DEBUG_DB_CHAT) {
         } else {
             Uri insertUri = Uri.parse(Constant.DB_CONTACTS);
             ContentValues values1 = new ContentValues();

+ 5 - 3
app/src/main/java/com/xplora/xpchat/utils/Macros.java

@@ -6,10 +6,12 @@ public class Macros {
 
     public static boolean DEBUG = true;
 
-    public static boolean DEBUG_DATABASE = false; //模拟数据库中数据
-    public static boolean DEBUG_DATABASE_INSET = false; //模拟数据库中数据
-
     public static boolean DEBUG_IMEI = true; //模拟用户imei号
 
     public static boolean DEBUG_RECORD = false; //模拟器录音
+
+    public static boolean DEBUG_DB_CHAT = false;
+    public static boolean DEBUG_DB_INSET = false;
+    public static boolean DEBUG_DB_EMOJI = true; //表情
+    public static boolean DEBUG_DB_PRESETTEXT = true; //预置文字
 }