From 3d043b1b84071cc4308674bf736d543b6d9972e0 Mon Sep 17 00:00:00 2001 From: tcruzibt Date: Wed, 7 Oct 2015 14:56:32 +0100 Subject: [PATCH 1/3] Refactor messaging parse on RTMChat for andoird --- .gitignore | 32 + .idea/gradle.xml | 18 + .idea/libraries/appcompat_v7_23_0_1.xml | 12 + .idea/libraries/gradle_wrapper.xml | 9 - .idea/libraries/json_simple_1_1.xml | 11 + .idea/libraries/messaging_android_2_1_56.xml | 12 + .idea/libraries/play_services_6_1_71.xml | 10 + .../libraries/support_annotations_23_0_1.xml | 11 + .idea/libraries/support_v4_23_0_1.xml | 13 + .idea/misc.xml | 29 +- .idea/modules.xml | 4 +- .idea/runConfigurations.xml | 12 + .idea/vcs.xml | 1 + .idea/workspace.xml | 1771 ++++++++++++++++- app/src/main/java/handlers/OrtcHandler.java | 5 +- build/intermediates/dex-cache/cache.xml | 41 +- local.properties | 2 +- 17 files changed, 1941 insertions(+), 52 deletions(-) create mode 100644 .gitignore create mode 100644 .idea/gradle.xml create mode 100644 .idea/libraries/appcompat_v7_23_0_1.xml delete mode 100644 .idea/libraries/gradle_wrapper.xml create mode 100644 .idea/libraries/json_simple_1_1.xml create mode 100644 .idea/libraries/messaging_android_2_1_56.xml create mode 100644 .idea/libraries/play_services_6_1_71.xml create mode 100644 .idea/libraries/support_annotations_23_0_1.xml create mode 100644 .idea/libraries/support_v4_23_0_1.xml create mode 100644 .idea/runConfigurations.xml diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1fd8992 --- /dev/null +++ b/.gitignore @@ -0,0 +1,32 @@ +### Android template +# Built application files +*.apk +*.ap_ + +# Files for the Dalvik VM +*.dex + +# Java class files +*.class + +# Generated files +bin/ +gen/ + +# Gradle files +.gradle/ +build/ + +# Local configuration file (sdk path, etc) +local.properties + +# Proguard folder generated by Eclipse +proguard/ + +# Log Files +*.log + +# Android Studio Navigation editor temp files +.navigation/ + +# Created by .ignore support plugin (hsz.mobi) diff --git a/.idea/gradle.xml b/.idea/gradle.xml new file mode 100644 index 0000000..8d2df47 --- /dev/null +++ b/.idea/gradle.xml @@ -0,0 +1,18 @@ + + + + + + \ No newline at end of file diff --git a/.idea/libraries/appcompat_v7_23_0_1.xml b/.idea/libraries/appcompat_v7_23_0_1.xml new file mode 100644 index 0000000..7898213 --- /dev/null +++ b/.idea/libraries/appcompat_v7_23_0_1.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/gradle_wrapper.xml b/.idea/libraries/gradle_wrapper.xml deleted file mode 100644 index c5ef1a1..0000000 --- a/.idea/libraries/gradle_wrapper.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/json_simple_1_1.xml b/.idea/libraries/json_simple_1_1.xml new file mode 100644 index 0000000..bd262a8 --- /dev/null +++ b/.idea/libraries/json_simple_1_1.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/messaging_android_2_1_56.xml b/.idea/libraries/messaging_android_2_1_56.xml new file mode 100644 index 0000000..4617128 --- /dev/null +++ b/.idea/libraries/messaging_android_2_1_56.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/play_services_6_1_71.xml b/.idea/libraries/play_services_6_1_71.xml new file mode 100644 index 0000000..11a9be7 --- /dev/null +++ b/.idea/libraries/play_services_6_1_71.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/support_annotations_23_0_1.xml b/.idea/libraries/support_annotations_23_0_1.xml new file mode 100644 index 0000000..4b8b4ab --- /dev/null +++ b/.idea/libraries/support_annotations_23_0_1.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/support_v4_23_0_1.xml b/.idea/libraries/support_v4_23_0_1.xml new file mode 100644 index 0000000..cd17459 --- /dev/null +++ b/.idea/libraries/support_v4_23_0_1.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index 98364ff..c469053 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,5 +1,32 @@ + + + + + + + @@ -10,7 +37,7 @@ - + diff --git a/.idea/modules.xml b/.idea/modules.xml index 52b8cb3..139a8c0 100644 --- a/.idea/modules.xml +++ b/.idea/modules.xml @@ -2,8 +2,8 @@ - - + + \ No newline at end of file diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml new file mode 100644 index 0000000..7f68460 --- /dev/null +++ b/.idea/runConfigurations.xml @@ -0,0 +1,12 @@ + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml index 35eb1dd..8306744 100644 --- a/.idea/vcs.xml +++ b/.idea/vcs.xml @@ -2,5 +2,6 @@ + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 4c27b29..3063507 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -5,8 +5,30 @@ + + - + + + + + + + + + + + + + + + + + + + + @@ -22,16 +44,33 @@ + + + + + + + - - + + + + + + + + + + + + - - + + @@ -43,10 +82,1463 @@ + + + + + + + @@ -79,8 +1571,6 @@ - - @@ -123,7 +1613,7 @@ - + @@ -137,16 +1627,108 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + - + - - - - - - - - - - - + + + + + + + + + + + + + + + - - + + + - - - - + - + - - + + + + file://$PROJECT_DIR$/app/src/main/java/handlers/OrtcHandler.java + 145 + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + diff --git a/app/src/main/java/handlers/OrtcHandler.java b/app/src/main/java/handlers/OrtcHandler.java index 18bf50e..1770457 100644 --- a/app/src/main/java/handlers/OrtcHandler.java +++ b/app/src/main/java/handlers/OrtcHandler.java @@ -141,10 +141,9 @@ public void sendMsg(Message msg, String channel) { OrtcHandler.client.send(channel, msg.toString()); } - public void handleMessage(String msg, String channel){ - String[] parts = msg.split(":"); + public void handleMessage(String msg, String channel){ SimpleDateFormat sdf = new SimpleDateFormat(Config.DATE_FORMAT); - Message newMsg = new Message(parts[0], parts[1],sdf.format(new Date())); + Message newMsg = new Message(msg.substring(0,msg.indexOf(":")), msg.substring(msg.indexOf(":")+1),sdf.format(new Date())); Channel list = messages.get(channel); list.setUnRead(list.getUnRead() + 1); diff --git a/build/intermediates/dex-cache/cache.xml b/build/intermediates/dex-cache/cache.xml index 83f550d..a57c21b 100644 --- a/build/intermediates/dex-cache/cache.xml +++ b/build/intermediates/dex-cache/cache.xml @@ -2,18 +2,53 @@ - + + + + + + + + + + + + + - + + + + diff --git a/local.properties b/local.properties index c1d177c..02dbec5 100644 --- a/local.properties +++ b/local.properties @@ -7,5 +7,5 @@ # Location of the SDK. This is only used by Gradle. # For customization when using a Version Control System, please read the # header note. -#Wed Oct 07 12:17:20 WEST 2015 +#Wed Oct 07 14:39:04 WEST 2015 sdk.dir=/Users/admin/Library/Android/sdk From 5b62bb9f630badcbe3c988a029717ef271f17a02 Mon Sep 17 00:00:00 2001 From: tcruzibt Date: Wed, 7 Oct 2015 15:11:45 +0100 Subject: [PATCH 2/3] Exclude files from source control --- .idea/libraries/appcompat_v7_23_0_1.xml | 3 + .idea/libraries/support_v4_23_0_1.xml | 3 + .idea/workspace.xml | 221 ++++++------------------ local.properties | 11 -- 4 files changed, 63 insertions(+), 175 deletions(-) delete mode 100644 local.properties diff --git a/.idea/libraries/appcompat_v7_23_0_1.xml b/.idea/libraries/appcompat_v7_23_0_1.xml index 7898213..91e40f4 100644 --- a/.idea/libraries/appcompat_v7_23_0_1.xml +++ b/.idea/libraries/appcompat_v7_23_0_1.xml @@ -1,5 +1,8 @@ + + + diff --git a/.idea/libraries/support_v4_23_0_1.xml b/.idea/libraries/support_v4_23_0_1.xml index cd17459..0bc367b 100644 --- a/.idea/libraries/support_v4_23_0_1.xml +++ b/.idea/libraries/support_v4_23_0_1.xml @@ -1,5 +1,8 @@ + + + diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 3063507..c9de7ba 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -9,24 +9,10 @@ - - - - - - - - - - - - - - - - - - + + + + @@ -56,21 +42,11 @@ - + - - - - - - - - - - - - + + @@ -1211,7 +1187,7 @@ @@ -1975,35 +1841,35 @@ - + - + - + - - - + - + + + @@ -2011,13 +1877,6 @@ - - - file://$PROJECT_DIR$/app/src/main/java/handlers/OrtcHandler.java - 145 - - - @@ -2035,7 +1894,7 @@ - + @@ -2043,6 +1902,13 @@ + + + + + + + @@ -2055,7 +1921,6 @@ - @@ -2063,7 +1928,6 @@ - @@ -2071,6 +1935,20 @@ + + + + + + + + + + + + + + @@ -2083,6 +1961,21 @@ + + + + + + + + + + + + + + + @@ -2091,10 +1984,10 @@ - + - - + + diff --git a/local.properties b/local.properties deleted file mode 100644 index 02dbec5..0000000 --- a/local.properties +++ /dev/null @@ -1,11 +0,0 @@ -## This file is automatically generated by Android Studio. -# Do not modify this file -- YOUR CHANGES WILL BE ERASED! -# -# This file must *NOT* be checked into Version Control Systems, -# as it contains information specific to your local configuration. -# -# Location of the SDK. This is only used by Gradle. -# For customization when using a Version Control System, please read the -# header note. -#Wed Oct 07 14:39:04 WEST 2015 -sdk.dir=/Users/admin/Library/Android/sdk From af2e0771d8449dffaa56c3a4367efb605cea5ee9 Mon Sep 17 00:00:00 2001 From: tcruzibt Date: Wed, 7 Oct 2015 15:35:50 +0100 Subject: [PATCH 3/3] Accept messages from unknown user --- app/src/main/java/handlers/OrtcHandler.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/handlers/OrtcHandler.java b/app/src/main/java/handlers/OrtcHandler.java index 1770457..0bca1b9 100644 --- a/app/src/main/java/handlers/OrtcHandler.java +++ b/app/src/main/java/handlers/OrtcHandler.java @@ -143,7 +143,14 @@ public void sendMsg(Message msg, String channel) { public void handleMessage(String msg, String channel){ SimpleDateFormat sdf = new SimpleDateFormat(Config.DATE_FORMAT); - Message newMsg = new Message(msg.substring(0,msg.indexOf(":")), msg.substring(msg.indexOf(":")+1),sdf.format(new Date())); + Message newMsg = null; + if(msg.contains(":")) + { + newMsg = new Message(msg.substring(0, msg.indexOf(":")), msg.substring(msg.indexOf(":") + 1), sdf.format(new Date())); + } + else { + newMsg = new Message("Unknown user", msg, sdf.format(new Date())); + } Channel list = messages.get(channel); list.setUnRead(list.getUnRead() + 1); @@ -154,6 +161,7 @@ public void handleMessage(String msg, String channel){ if(chatRoom != null) chatRoom.refreshData(newMsg); + } }