Packet: ClientseitigeOid (Id in der SQLite Datenbank) hinzugefügt, um die Nachricht in der App zuordnen zu können.
This commit is contained in:
@@ -82,7 +82,6 @@
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/builds" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/bundles" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
|
||||
|
||||
@@ -26,18 +26,22 @@ public class DatabaseHandler extends SQLiteOpenHelper {
|
||||
//DataBase version
|
||||
private static final int DATABASE_VERSION = 1;
|
||||
//Database name
|
||||
private static final String DATABASE_NAME = "Contacts_Manager";
|
||||
private static final String DATABASE_NAME = "Contacts_Manager";
|
||||
//Table Name
|
||||
private static final String TABLE_CONTACTS = "Contactlist";
|
||||
private static final String TABLE_CHATMESSAGE = "ChatMessage";
|
||||
|
||||
|
||||
//Table Columns name
|
||||
|
||||
// Contacts-Tabelle
|
||||
private static final String KEY_ID ="id";
|
||||
private static final String KEY_KontaktName = "kontaktname";
|
||||
private static final String KEY_PERSONOID = "personoid";
|
||||
private static final String KEY_Picture_BLOB = "bild";
|
||||
|
||||
|
||||
// ChatMessage-Tabelle
|
||||
private static final String KEY_ID_CHATMESSAGE = "id";
|
||||
private static final String KEY_SENDER_PERSON_OID_CHATMESSAGE = "senderpersonoid";
|
||||
private static final String KEY_RECIPIENT_PERSON_OID_CHATMESSAGE = "recipientpersonoid";
|
||||
@@ -84,7 +88,8 @@ public class DatabaseHandler extends SQLiteOpenHelper {
|
||||
values.put(KEY_IS_DELIVERED_CHATMESSAGE, (message.IsDelivered ? 1 : 0));
|
||||
values.put(KEY_SERVERSEITIGE_OID_CHATMESSAGE, message.ServerseitigeOid);
|
||||
|
||||
db.insert(TABLE_CHATMESSAGE, null, values);
|
||||
long rowId = db.insert(TABLE_CHATMESSAGE, null, values);
|
||||
Log.i("CHAT_MESSAGE_INSERT", "RowID: " + rowId);
|
||||
db.close();
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ public class KontaktChatActivity extends ListActivity {
|
||||
|
||||
databaseHandler = new DatabaseHandler(this);
|
||||
|
||||
//TODO: nicht löschen, sondern updaten
|
||||
//TODO: nicht löschen, sondern updaten...
|
||||
//databaseHandler.onUpgrade(databaseHandler.getReadableDatabase(), 1, 2);
|
||||
|
||||
Bundle bundle = getIntent().getExtras();
|
||||
@@ -99,14 +99,15 @@ public class KontaktChatActivity extends ListActivity {
|
||||
in.putExtras(bundle);
|
||||
|
||||
//Gib Bild für den Chat mit
|
||||
if(selectedValue.getPicture() == null){
|
||||
if(selectedValue.getPicture() == null) {
|
||||
ByteArrayOutputStream stream = new ByteArrayOutputStream();
|
||||
Bitmap a = BitmapFactory.decodeResource(getResources(), R.drawable.katze3);
|
||||
a.compress(Bitmap.CompressFormat.JPEG,0,stream);
|
||||
byte[] x = stream.toByteArray();
|
||||
in.putExtra("Bild", x);
|
||||
}else
|
||||
} else {
|
||||
in.putExtra("Bild", selectedValue.getPicture());
|
||||
}
|
||||
|
||||
startActivity(in);
|
||||
}
|
||||
@@ -137,6 +138,8 @@ public class KontaktChatActivity extends ListActivity {
|
||||
Log.i("KONTAKT_CHAT_ACTIVITY", "soapPrimitive ist NULL!");
|
||||
}
|
||||
|
||||
Log.i("SoapPrmitive", "" + soapPrimitive.toString());
|
||||
|
||||
Gson gson = new GsonBuilder().create();
|
||||
|
||||
Type listType = new TypeToken<ArrayList<ChatPerson>>(){}.getType();
|
||||
|
||||
@@ -18,8 +18,6 @@ import android.widget.Button;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.Socket;
|
||||
@@ -49,9 +47,6 @@ public class MainActivityMitarbeiter extends Activity {
|
||||
//Name, der Zum Server gesendet wird
|
||||
protected String loggedInUserName;
|
||||
|
||||
File file;
|
||||
File unsentFile;
|
||||
|
||||
public static Thread listen;
|
||||
public static SocketListener socketListener;
|
||||
|
||||
@@ -96,7 +91,6 @@ public class MainActivityMitarbeiter extends Activity {
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
|
||||
public void setzeButtonListener() {
|
||||
|
||||
dokubutton = (Button) findViewById(R.id.Dokubutton);
|
||||
@@ -355,11 +349,13 @@ public class MainActivityMitarbeiter extends Activity {
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
|
||||
super.onResume();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStop(){
|
||||
|
||||
super.onStop();
|
||||
}
|
||||
|
||||
|
||||
@@ -24,8 +24,7 @@ public class Packet {
|
||||
public String Tenant;
|
||||
public boolean IsDelivered;
|
||||
public int ServerseitigeOid;
|
||||
|
||||
// TODO: IsDelivered einbauen
|
||||
public int ClientseitigeOid;
|
||||
|
||||
public Packet() {
|
||||
ChatDataIdentifier = DataIdentifier.NULL;
|
||||
@@ -46,9 +45,9 @@ public class Packet {
|
||||
|
||||
//Aufbau Message:
|
||||
// die ersten fünf ";" ignorieren
|
||||
// SenderOid;RecipientOid;ClientNameLength;MessageLength;ChatDataIdentifier;ServerseitigeOid;Tenant;[ClientName][ChatMessage][MessageTimeStamp][IsDelivered]
|
||||
// SenderOid;RecipientOid;ClientNameLength;MessageLength;ChatDataIdentifier;ServerseitigeOid;ClientseitigeOid;Tenant;[ClientName][ChatMessage][MessageTimeStamp][IsDelivered]
|
||||
|
||||
//23;281;20;389;1;38;[Tenant]; 7 Semikola
|
||||
//23;281;20;389;1;38;932[Tenant]; 8 Semikola
|
||||
|
||||
public Packet(String message) {
|
||||
|
||||
@@ -60,18 +59,20 @@ public class Packet {
|
||||
String chatMessageLengthString = gesplittet[3];
|
||||
String chatIdentifierString = gesplittet[4];
|
||||
String serverseitigeOidString = gesplittet[5];
|
||||
Tenant = gesplittet[6];
|
||||
String clientseitigeOidString = gesplittet[6];
|
||||
Tenant = gesplittet[7];
|
||||
|
||||
SenderPersonOid = Integer.parseInt(senderPersonOidString);
|
||||
RecipientPersonOid = Integer.parseInt(recipientPersonOidString);
|
||||
ServerseitigeOid = Integer.parseInt(serverseitigeOidString);
|
||||
ServerseitigeOid = Integer.parseInt(serverseitigeOidString);
|
||||
ClientseitigeOid = Integer.parseInt(clientseitigeOidString);
|
||||
|
||||
ChatDataIdentifier = DataIdentifier.getEnumValue(Integer.parseInt(chatIdentifierString));
|
||||
|
||||
int chatNameLength = Integer.parseInt(chatNameLengthString);
|
||||
int chatMessageLength = Integer.parseInt(chatMessageLengthString);
|
||||
|
||||
int headerLength = senderPersonOidString.length() + recipientPersonOidString.length() + chatNameLengthString.length() + chatMessageLengthString.length() + chatIdentifierString.length() + Tenant.length() + serverseitigeOidString.length() + 8;
|
||||
int headerLength = senderPersonOidString.length() + recipientPersonOidString.length() + chatNameLengthString.length() + chatMessageLengthString.length() + chatIdentifierString.length() + Tenant.length() + serverseitigeOidString.length() + clientseitigeOidString.length() + 9;
|
||||
String actualMessage = message.substring(headerLength - 1);
|
||||
|
||||
ChatName = actualMessage.substring(0, chatNameLength);
|
||||
|
||||
Reference in New Issue
Block a user