Merge branch 'master' of ssh://float.beyondsoft.de/git/beyondSoft/BeWo
This commit is contained in:
8
Android/BewoMitarbeiterApp/.idea/gradle.xml
generated
8
Android/BewoMitarbeiterApp/.idea/gradle.xml
generated
@@ -13,13 +13,7 @@
|
||||
<option value="$PROJECT_DIR$/volley" />
|
||||
</set>
|
||||
</option>
|
||||
<option name="myModules">
|
||||
<set>
|
||||
<option value="$PROJECT_DIR$" />
|
||||
<option value="$PROJECT_DIR$/app" />
|
||||
<option value="$PROJECT_DIR$/volley" />
|
||||
</set>
|
||||
</option>
|
||||
<option name="resolveModulePerSourceSet" value="false" />
|
||||
</GradleProjectSettings>
|
||||
</option>
|
||||
</component>
|
||||
|
||||
@@ -32,12 +32,14 @@
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/debug" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/debug" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/debug" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/debug" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/debug" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/debug" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/androidTest/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/androidTest/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/androidTest/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/androidTest/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/androidTest/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/androidTest/debug" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/androidTest/debug" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" />
|
||||
@@ -83,7 +85,6 @@
|
||||
<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" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/appcompat-v7/21.0.3/jars" />
|
||||
@@ -93,9 +94,11 @@
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-runtime-classes" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-safeguard" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-verifier" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant-run-resources" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant-run-support" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jniLibs" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/pre-dexed" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/reload-dex" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/restart-dex" />
|
||||
@@ -114,10 +117,32 @@
|
||||
<orderEntry type="library" exported="" name="support-v4-21.0.3" level="project" />
|
||||
<orderEntry type="library" exported="" name="support-annotations-21.0.3" level="project" />
|
||||
<orderEntry type="library" exported="" name="commons-lang3-3.3.2" level="project" />
|
||||
<orderEntry type="library" exported="" name="commons-io-1.3.2" level="project" />
|
||||
<orderEntry type="library" exported="" name="robospice-1.4.14" level="project" />
|
||||
<orderEntry type="library" exported="" name="robospice-cache-1.4.14" level="project" />
|
||||
<orderEntry type="library" exported="" name="commons-io-1.3.2" level="project" />
|
||||
<orderEntry type="module" module-name="volley" exported="" />
|
||||
<orderEntry type="library" exported="" name="android-android-21" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="objenesis-1.0" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="maven-ant-tasks-2.1.3" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="ant-1.8.0" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="icu4j-53.1" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="accessibility-test-framework-1.0" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="robolectric-resources-3.0" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="robolectric-annotations-3.0" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="asm-commons-5.0.1" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="ant-launcher-1.8.0" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="sqlite4java-0.282" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="asm-tree-5.0.1" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="asm-5.0.1" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="shadows-core-3.0" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="robolectric-utils-3.0" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="asm-analysis-5.0.1" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="vtd-xml-2.11" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="hamcrest-core-1.1" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="asm-util-5.0.1" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="bcprov-jdk16-1.46" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="junit-4.10" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="mockito-core-1.9.5" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="robolectric-3.0" level="project" />
|
||||
</component>
|
||||
</module>
|
||||
@@ -50,6 +50,7 @@ public class DatabaseHandler extends SQLiteOpenHelper {
|
||||
private static final String KEY_IS_TEAM = "isteam";
|
||||
private static final String KEY_TEAM_MEMBER_OIDS = "teammemberoids";
|
||||
private static final String KEY_TEAM_MEMBER_NAMES = "teammembernames";
|
||||
private static final String KEY_VERSION = "version";
|
||||
|
||||
|
||||
// ChatMessage-Tabelle
|
||||
@@ -98,7 +99,8 @@ public class DatabaseHandler extends SQLiteOpenHelper {
|
||||
KEY_PICTURE_BLOB + " BLOB, " +
|
||||
KEY_IS_TEAM + " INTEGER, " +
|
||||
KEY_TEAM_MEMBER_NAMES + " TEXT, " +
|
||||
KEY_TEAM_MEMBER_OIDS + " TEXT)";
|
||||
KEY_TEAM_MEMBER_OIDS + " TEXT, " +
|
||||
KEY_VERSION + " INTEGER)";
|
||||
|
||||
db.execSQL(CREATE_CONTACTS_TABLE);
|
||||
|
||||
@@ -291,6 +293,7 @@ public class DatabaseHandler extends SQLiteOpenHelper {
|
||||
values.put(KEY_IS_TEAM, contact.isTeam);
|
||||
values.put(KEY_TEAM_MEMBER_NAMES, contact.teamMemberNames);
|
||||
values.put(KEY_TEAM_MEMBER_OIDS, contact.teamMemberOids);
|
||||
values.put(KEY_VERSION, contact.getVersion());
|
||||
|
||||
writableDatabase.insertOrThrow(TABLE_CONTACTS, null, values);
|
||||
}
|
||||
@@ -403,7 +406,8 @@ public class DatabaseHandler extends SQLiteOpenHelper {
|
||||
KEY_PICTURE_BLOB,
|
||||
KEY_IS_TEAM,
|
||||
KEY_TEAM_MEMBER_NAMES,
|
||||
KEY_TEAM_MEMBER_OIDS},
|
||||
KEY_TEAM_MEMBER_OIDS,
|
||||
KEY_VERSION},
|
||||
KEY_ID + "=?",
|
||||
new String[]{String.valueOf(id)},
|
||||
null,null,null,null);
|
||||
@@ -418,8 +422,9 @@ public class DatabaseHandler extends SQLiteOpenHelper {
|
||||
boolean contactIsTeam = cursor.getInt(4) == 1;
|
||||
String teamMemberOids = cursor.getString(5);
|
||||
String teamMemberNames = cursor.getString(6);
|
||||
int contactVersion = cursor.getInt(7);
|
||||
|
||||
ContactListItem contact = new ContactListItem(contactId, contactName, contactPersonOid, contactPicture, contactIsTeam, teamMemberOids, teamMemberNames);
|
||||
ContactListItem contact = new ContactListItem(contactId, contactName, contactPersonOid, contactPicture, contactIsTeam, teamMemberOids, teamMemberNames, contactVersion);
|
||||
|
||||
cursor.close();
|
||||
|
||||
@@ -447,6 +452,7 @@ public class DatabaseHandler extends SQLiteOpenHelper {
|
||||
contact.isTeam = cursor.getInt(4) == 1;
|
||||
contact.teamMemberNames = cursor.getString(5);
|
||||
contact.teamMemberOids = cursor.getString(6);
|
||||
contact.setVersion(cursor.getInt(7));
|
||||
|
||||
contactList.add(contact);
|
||||
} while (cursor.moveToNext());
|
||||
@@ -499,6 +505,7 @@ public class DatabaseHandler extends SQLiteOpenHelper {
|
||||
values.put(KEY_IS_TEAM, (contact.isTeam ? 1 : 0));
|
||||
values.put(KEY_TEAM_MEMBER_NAMES, contact.teamMemberNames);
|
||||
values.put(KEY_TEAM_MEMBER_OIDS, contact.teamMemberOids);
|
||||
values.put(KEY_VERSION, contact.getVersion());
|
||||
|
||||
return writableDatabase.update(TABLE_CONTACTS, values, KEY_ID + " = ?", new String[] { String.valueOf(contact.getId()) });
|
||||
}
|
||||
@@ -551,7 +558,8 @@ public class DatabaseHandler extends SQLiteOpenHelper {
|
||||
KEY_PICTURE_BLOB,
|
||||
KEY_IS_TEAM,
|
||||
KEY_TEAM_MEMBER_NAMES,
|
||||
KEY_TEAM_MEMBER_OIDS},
|
||||
KEY_TEAM_MEMBER_OIDS,
|
||||
KEY_VERSION},
|
||||
KEY_PERSONOID + "=? AND " + KEY_IS_TEAM + "=?",
|
||||
new String[]{String.valueOf(personOid), String.valueOf((isTeam ? 1 : 0))},
|
||||
null,null,null,null);
|
||||
@@ -565,8 +573,9 @@ public class DatabaseHandler extends SQLiteOpenHelper {
|
||||
boolean contactIsTeam = cursor.getInt(4) == 1;
|
||||
String teamMemberOids = cursor.getString(5);
|
||||
String teamMemberNames = cursor.getString(6);
|
||||
int contactVersion = cursor.getInt(7);
|
||||
|
||||
ContactListItem contact = new ContactListItem(contactId, contactName, contactPersonOid, contactPicture, contactIsTeam, teamMemberOids, teamMemberNames);
|
||||
ContactListItem contact = new ContactListItem(contactId, contactName, contactPersonOid, contactPicture, contactIsTeam, teamMemberOids, teamMemberNames, contactVersion);
|
||||
|
||||
cursor.close();
|
||||
|
||||
|
||||
@@ -5,6 +5,22 @@ import android.app.NotificationManager;
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
import com.octo.android.robospice.SpiceManager;
|
||||
import com.octo.android.robospice.UncachedSpiceService;
|
||||
import com.octo.android.robospice.persistence.exception.SpiceException;
|
||||
import com.octo.android.robospice.request.listener.RequestListener;
|
||||
|
||||
import org.ksoap2.serialization.PropertyInfo;
|
||||
import org.ksoap2.serialization.SoapPrimitive;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import soapConnection.JsonSoapPrimitiveRequest;
|
||||
import soapConnection.SoapCalls;
|
||||
import util.ConnectivityReceiver;
|
||||
|
||||
/**
|
||||
@@ -13,13 +29,42 @@ import util.ConnectivityReceiver;
|
||||
public class BeWoChatApplication extends Application {
|
||||
private Thread.UncaughtExceptionHandler defaultUncaughtExceptionHandler;
|
||||
|
||||
private static final SpiceManager spiceManager = new SpiceManager(UncachedSpiceService.class);
|
||||
|
||||
private static BeWoChatApplication mInstance;
|
||||
|
||||
private static final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
|
||||
mInstance = this;
|
||||
|
||||
spiceManager.start(this);
|
||||
|
||||
keepAlive();
|
||||
}
|
||||
|
||||
public void keepAlive() {
|
||||
final Runnable blubb = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
JsonSoapPrimitiveRequest request = new JsonSoapPrimitiveRequest(SoapCalls.KEEP_ALIVE, new ArrayList<PropertyInfo>());
|
||||
spiceManager.execute(request, new JsonSoapPrimitiveRequestListener());
|
||||
|
||||
Log.i("LOOPER", "Halte Verbindung zum Soap-Server am leben...");
|
||||
}
|
||||
};
|
||||
|
||||
final ScheduledFuture<?> blubbHandle = scheduler.scheduleAtFixedRate(blubb, 10, 10, TimeUnit.MINUTES);
|
||||
|
||||
scheduler.schedule(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
blubbHandle.cancel(true);
|
||||
}
|
||||
}, 10, TimeUnit.DAYS);
|
||||
}
|
||||
|
||||
public static synchronized BeWoChatApplication getInstance() {
|
||||
@@ -49,4 +94,21 @@ public class BeWoChatApplication extends Application {
|
||||
|
||||
Thread.setDefaultUncaughtExceptionHandler(uncaughtExceptionHandler);
|
||||
}
|
||||
|
||||
private class JsonSoapPrimitiveRequestListener implements RequestListener<SoapPrimitive> {
|
||||
|
||||
@Override
|
||||
public void onRequestFailure(SpiceException spiceException) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRequestSuccess(SoapPrimitive soapPrimitive) {
|
||||
if(soapPrimitive == null) {
|
||||
Log.e("BEWOAPP", "Antwort ist null!");
|
||||
} else {
|
||||
Log.i("BEWOAPP", "Die Antwort hat einen Wert");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package beyondsoft.bewomitarbeiterapp;
|
||||
|
||||
import entities.ChatPerson;
|
||||
|
||||
/**
|
||||
* Created by JettenM on 24.08.2016.
|
||||
*/
|
||||
@@ -8,6 +10,7 @@ public class ContactListItem {
|
||||
private String mChatName;
|
||||
private byte[] mPicture;
|
||||
private int mPersonOid;
|
||||
private int mVersion;
|
||||
|
||||
public boolean isTeam;
|
||||
public boolean isOnline;
|
||||
@@ -16,7 +19,7 @@ public class ContactListItem {
|
||||
|
||||
public ContactListItem(){}
|
||||
|
||||
public ContactListItem(int id, String kontaktname, int personOid, byte[] picture, boolean isTeam, String teamMemberOids, String teamMemberNames){
|
||||
public ContactListItem(int id, String kontaktname, int personOid, byte[] picture, boolean isTeam, String teamMemberOids, String teamMemberNames, int version){
|
||||
this.mId = id;
|
||||
this.mChatName = kontaktname;
|
||||
this.mPersonOid = personOid;
|
||||
@@ -24,15 +27,17 @@ public class ContactListItem {
|
||||
this.isTeam = isTeam;
|
||||
this.teamMemberNames = teamMemberNames;
|
||||
this.teamMemberOids = teamMemberOids;
|
||||
this.mVersion = version;
|
||||
}
|
||||
|
||||
public ContactListItem(String kontaktname, int personOid, boolean isTeam, String teamMemberOids, String teamMemberNames){
|
||||
public ContactListItem(String kontaktname, int personOid, boolean isTeam, String teamMemberOids, String teamMemberNames, int version){
|
||||
this.mChatName = kontaktname;
|
||||
this.mPersonOid = personOid;
|
||||
this.mPicture = null;
|
||||
this.isTeam = isTeam;
|
||||
this.teamMemberNames = teamMemberNames;
|
||||
this.teamMemberOids = teamMemberOids;
|
||||
this.mVersion = version;
|
||||
}
|
||||
|
||||
public int getId(){
|
||||
@@ -73,4 +78,34 @@ public class ContactListItem {
|
||||
|
||||
this.mPersonOid = mPersonOid;
|
||||
}
|
||||
|
||||
public int getVersion() {
|
||||
return mVersion;
|
||||
}
|
||||
|
||||
public void setVersion(int mVersion) {
|
||||
this.mVersion = mVersion;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
String result = "";
|
||||
|
||||
result += "Id: " + mId;
|
||||
result += "\nChatName: " + mChatName;
|
||||
result += "\nPersonOid: " + mPersonOid;
|
||||
result += "\nIsTeam: " + isTeam;
|
||||
if(isTeam) {
|
||||
result += "\nTeam members: " + teamMemberNames;
|
||||
result += "\nMember Oids: " + teamMemberOids;
|
||||
}
|
||||
|
||||
result += "\nVersion: " + mVersion;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public Boolean compareToChatPerson(ChatPerson chatPerson) {
|
||||
return mPersonOid == chatPerson.Oid && isTeam == chatPerson.IsTeam;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import android.content.Intent;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.widget.SwipeRefreshLayout;
|
||||
import android.support.v7.app.ActionBarActivity;
|
||||
import android.util.Log;
|
||||
import android.view.Menu;
|
||||
@@ -27,11 +28,15 @@ import org.ksoap2.serialization.SoapPrimitive;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import Database.DatabaseHandler;
|
||||
import entities.ChatEntity;
|
||||
import entities.ChatPerson;
|
||||
import soapConnection.JsonSoapPrimitiveRequest;
|
||||
import soapConnection.OnRequestSuccessCallback;
|
||||
import soapConnection.Packet;
|
||||
import soapConnection.SoapCalls;
|
||||
import soapConnection.SoapConnectionManager;
|
||||
@@ -43,14 +48,16 @@ import util.Util;
|
||||
/**
|
||||
* Created by bib on 02.05.2016.
|
||||
*/
|
||||
public class KontaktChatActivity extends ActionBarActivity implements ConnectivityReceiver.ConnectivityReceiverListener {
|
||||
public class KontaktChatActivity extends ActionBarActivity implements ConnectivityReceiver.ConnectivityReceiverListener, SwipeRefreshLayout.OnRefreshListener {
|
||||
|
||||
private static final String LOGTAG = "";
|
||||
private static final String LOGTAG = "KONTAKT_CHAT_ACTIVITY";
|
||||
|
||||
private SpiceManager spiceManager = new SpiceManager(UncachedSpiceService.class);
|
||||
private DatabaseHandler databaseHandler;
|
||||
|
||||
public static ListView listView;
|
||||
public ListView listView;
|
||||
|
||||
private SwipeRefreshLayout swipeRefreshLayout;
|
||||
|
||||
ArrayList<ContactListItem> contactList = new ArrayList<>();
|
||||
|
||||
@@ -64,6 +71,8 @@ public class KontaktChatActivity extends ActionBarActivity implements Connectivi
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.kontakt_list_chat);
|
||||
|
||||
swipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.swipe_refresh_layout);
|
||||
|
||||
databaseHandler = DatabaseHandler.getInstance(this);
|
||||
|
||||
listView = (ListView) findViewById(R.id.contact_listview);
|
||||
@@ -84,7 +93,6 @@ public class KontaktChatActivity extends ActionBarActivity implements Connectivi
|
||||
Intent in = new Intent(getBaseContext(), ChatActivity.class);
|
||||
in.putExtras(bundle);
|
||||
|
||||
//Gib Bild für den Chat mit
|
||||
if(selectedValue.getPicture() == null) {
|
||||
ByteArrayOutputStream stream = new ByteArrayOutputStream();
|
||||
Bitmap a = BitmapFactory.decodeResource(getResources(), R.drawable.katze3);
|
||||
@@ -99,41 +107,49 @@ public class KontaktChatActivity extends ActionBarActivity implements Connectivi
|
||||
}
|
||||
});
|
||||
|
||||
swipeRefreshLayout.setOnRefreshListener(this);
|
||||
|
||||
swipeRefreshLayout.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
swipeRefreshLayout.setRefreshing(true);
|
||||
|
||||
updateContactList();
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
if(SocketManager.uiHandler == null ||! SocketManager.uiHandler.equals(kontaktChatActivityUIHandler)) {
|
||||
SocketManager.uiHandler = kontaktChatActivityUIHandler;
|
||||
}
|
||||
|
||||
// ArrayList<PropertyInfo> propertyInfos = new ArrayList<>();
|
||||
// propertyInfos.add(SoapConnectionManager.BuildProperty("pPersonOid", SoapConnectionManager.User.getPersonOid(), Long.class));
|
||||
//
|
||||
// JsonSoapPrimitiveRequest request = new JsonSoapPrimitiveRequest(SoapCalls.GET_CONTACTS_FOR_PERSON, propertyInfos);
|
||||
// spiceManager.execute(request, new JsonSoapPrimitiveRequestListener());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRefresh() {
|
||||
updateContactList();
|
||||
}
|
||||
|
||||
private void updateContactList() {
|
||||
swipeRefreshLayout.setRefreshing(true);
|
||||
|
||||
ArrayList<PropertyInfo> propertyInfos = new ArrayList<>();
|
||||
propertyInfos.add(SoapConnectionManager.BuildProperty("pPersonOid", SoapConnectionManager.User.getPersonOid(), Long.class));
|
||||
|
||||
JsonSoapPrimitiveRequest request = new JsonSoapPrimitiveRequest(SoapCalls.GET_CONTACTS_FOR_PERSON, propertyInfos);
|
||||
spiceManager.execute(request, new JsonSoapPrimitiveRequestListener());
|
||||
spiceManager.execute(request, new JsonSoapPrimitiveRequestListener(new OnRequestSuccessCallback() {
|
||||
@Override
|
||||
public void doCallback() {
|
||||
Util.sendStatusRequest();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// ArrayList<Integer> test = isTeam ? databaseHandler.getExistingTeamChatMessageIds() : databaseHandler.getExistingChatMessageIds();
|
||||
//
|
||||
// Log.i(LOGTAG, "Chat-Messages in der Datenbank: " + test.size());
|
||||
//
|
||||
// String pExceptions = "";
|
||||
// for(int i = 0; i < test.size(); i++) {
|
||||
// pExceptions += test.get(i);
|
||||
//
|
||||
// if(i < test.size() - 1) {
|
||||
// pExceptions += ";";
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// ArrayList<PropertyInfo> propertyInfos2 = new ArrayList<>();
|
||||
// propertyInfos.add(SoapConnectionManager.BuildProperty("pSenderPersonOid", SoapConnectionManager.User.getPersonOid(), Long.class));
|
||||
// propertyInfos.add(SoapConnectionManager.BuildProperty("pRecipientPersonOid", recipientPersonOid, Long.class));
|
||||
// propertyInfos.add(SoapConnectionManager.BuildProperty("pExceptions", pExceptions, String.class));
|
||||
// propertyInfos.add(SoapConnectionManager.BuildProperty("pIsForTeam", isTeam, Boolean.class));
|
||||
//
|
||||
// JsonSoapPrimitiveRequest request2 = new JsonSoapPrimitiveRequest(SoapCalls.GET_ALL_CHAT_MESSAGES, propertyInfos);
|
||||
// spiceManager.execute(request2, new JsonSoapPrimitiveRequestListenerForUnreadMessages());
|
||||
swipeRefreshLayout.setRefreshing(false);
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
public UIHandler kontaktChatActivityUIHandler = new UIHandler() {
|
||||
@@ -185,6 +201,7 @@ public class KontaktChatActivity extends ActionBarActivity implements Connectivi
|
||||
ka.notifyDataSetChanged();
|
||||
}
|
||||
});
|
||||
|
||||
break;
|
||||
case STATUS_NOTIFICATION_LOGIN_BROADCAST:
|
||||
runOnUiThread(new Runnable() {
|
||||
@@ -203,6 +220,25 @@ public class KontaktChatActivity extends ActionBarActivity implements Connectivi
|
||||
}
|
||||
});
|
||||
|
||||
break;
|
||||
|
||||
case STATUS_REQUEST:
|
||||
|
||||
Log.i(LOGTAG, "Aktualisiere die Kontaktliste");
|
||||
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
KontaktAdapter ka =((KontaktAdapter) listView.getAdapter());
|
||||
|
||||
for(ContactListItem item : ka.values) {
|
||||
item.isOnline = SocketManager.onlinePersonOids.contains(item.getPersonOid());
|
||||
}
|
||||
|
||||
ka.notifyDataSetChanged();
|
||||
}
|
||||
});
|
||||
|
||||
break;
|
||||
}
|
||||
} catch(Exception pe) {
|
||||
@@ -290,6 +326,13 @@ public class KontaktChatActivity extends ActionBarActivity implements Connectivi
|
||||
|
||||
private final class JsonSoapPrimitiveRequestListener implements RequestListener<SoapPrimitive> {
|
||||
|
||||
//TODO: zusätzliches onRequestSuccess-Callback einbauen
|
||||
OnRequestSuccessCallback callback;
|
||||
|
||||
JsonSoapPrimitiveRequestListener(OnRequestSuccessCallback callback) {
|
||||
this.callback = callback;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRequestFailure(SpiceException spiceException) {
|
||||
Toast.makeText(KontaktChatActivity.this, "Ein Fehler ist beim laden der Kontaktliste aufgetreten.", Toast.LENGTH_SHORT).show();
|
||||
@@ -298,9 +341,11 @@ public class KontaktChatActivity extends ActionBarActivity implements Connectivi
|
||||
@Override
|
||||
public void onRequestSuccess(SoapPrimitive soapPrimitive) {
|
||||
if(soapPrimitive == null) {
|
||||
Log.i("KONTAKT_CHAT_ACTIVITY", "soapPrimitive ist NULL!");
|
||||
Log.e("KONTAKT_CHAT_ACTIVITY", "soapPrimitive ist NULL!");
|
||||
}
|
||||
|
||||
Log.i(LOGTAG, "Lade Kontakte vom Server herunter");
|
||||
|
||||
Gson gson = new GsonBuilder().create();
|
||||
|
||||
Type listType = new TypeToken<ArrayList<ChatPerson>>(){}.getType();
|
||||
@@ -309,20 +354,31 @@ public class KontaktChatActivity extends ActionBarActivity implements Connectivi
|
||||
|
||||
List<ContactListItem> lc = databaseHandler.getAllContacts();
|
||||
|
||||
List<Integer> oidList = new ArrayList<>();
|
||||
Map<ChatEntity, Integer> oid2VersionList = new HashMap<>();
|
||||
|
||||
for(ContactListItem item : lc) {
|
||||
oidList.add(item.getPersonOid());
|
||||
Log.i(LOGTAG, "Aus DB: Oid: " + item.getPersonOid() + "; Version: " + item.getVersion() + "; " + item.getChatName());
|
||||
oid2VersionList.put(new ChatEntity(item.getPersonOid(), item.isTeam), item.getVersion());
|
||||
}
|
||||
|
||||
for(ChatPerson cp : result) {
|
||||
Log.i("KONTAKTLISTE", "Version: " + cp.Version);
|
||||
ContactListItem contact = new ContactListItem(cp.Name, cp.Oid, cp.IsTeam, cp.TeamMemberOids, cp.TeamMemberNames, cp.Version);
|
||||
|
||||
if(!oidList.contains(cp.Oid)) {
|
||||
databaseHandler.addContact(new ContactListItem(cp.Name, cp.Oid, cp.IsTeam, cp.TeamMemberOids, cp.TeamMemberNames));
|
||||
ChatEntity cliEntity = new ChatEntity(cp.Oid, cp.IsTeam);
|
||||
|
||||
if(!oid2VersionList.containsKey(cliEntity)) {
|
||||
databaseHandler.addContact(contact);
|
||||
} else if(oid2VersionList.get(cliEntity) < cp.Version) {
|
||||
|
||||
contact.setId(databaseHandler.getContactByPersonOid(cp.Oid, cp.IsTeam).getId());
|
||||
databaseHandler.updateContact(contact);
|
||||
|
||||
//TODO: Team updaten, wenn Person Mitglied ist
|
||||
}
|
||||
}
|
||||
|
||||
oid2VersionList.clear();
|
||||
|
||||
lc = databaseHandler.getAllContacts();
|
||||
|
||||
for(ContactListItem item : lc) {
|
||||
@@ -345,23 +401,10 @@ public class KontaktChatActivity extends ActionBarActivity implements Connectivi
|
||||
listView.setAdapter(adapter);
|
||||
|
||||
((KontaktAdapter) listView.getAdapter()).notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
private final class JsonSoapPrimitiveRequestListenerForUnreadMessages implements RequestListener<SoapPrimitive> {
|
||||
@Override
|
||||
public void onRequestFailure(SpiceException spiceException) {
|
||||
Toast.makeText(KontaktChatActivity.this, "Ein Fehler ist beim laden der ungelesenen Nachrichten aufgetreten.", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRequestSuccess(SoapPrimitive soapPrimitive) {
|
||||
//TODO: Nachrichten, die empfangen wurden als man offline war, laden und jeweils die neueste anzeigen.
|
||||
if(soapPrimitive == null) {
|
||||
Log.i("KONTAKT_CHAT_ACTIVITY", "soapPrimitive ist NULL!");
|
||||
if(callback != null) {
|
||||
callback.doCallback();
|
||||
}
|
||||
|
||||
Gson gson = new GsonBuilder().create();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ import android.content.SharedPreferences;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.app.ActionBarActivity;
|
||||
|
||||
import android.text.TextUtils;
|
||||
import android.util.Base64;
|
||||
import android.util.Log;
|
||||
@@ -300,7 +301,6 @@ public class LoginActivity extends ActionBarActivity {
|
||||
|
||||
SocketManager.tenant = mTenantView.getText().toString();
|
||||
|
||||
//TODO: stattdessen ConnectToServer und im Callback die ChatActivity aufrufen
|
||||
SocketManager.loginCallback = new LoginCallback() {
|
||||
@Override
|
||||
public void doCallback() {
|
||||
|
||||
@@ -18,7 +18,8 @@ public enum DataIdentifier {
|
||||
STATUS_NOTIFICATION_BESCHAEFTIGT(11),
|
||||
STATUS_NOTIFICATION_ONLINE(12),
|
||||
STATUS_NOTIFICATION_OFFLINE(13),
|
||||
LOGIN_SUCCESS(14);
|
||||
LOGIN_SUCCESS(14),
|
||||
STATUS_REQUEST(15);
|
||||
|
||||
private final int value;
|
||||
DataIdentifier(int value) {
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
package soapConnection;
|
||||
|
||||
/**
|
||||
* Created by JettenM on 20.09.2016.
|
||||
*/
|
||||
|
||||
public interface OnRequestSuccessCallback {
|
||||
void doCallback();
|
||||
}
|
||||
@@ -9,6 +9,7 @@ public class SoapCalls {
|
||||
public static String GET_CONTACTS_FOR_PERSON = "GetContactsForPerson";
|
||||
|
||||
public static String GET_ALL_CHAT_MESSAGES = "GetAllChatMessagesForSenderAndRecipient";
|
||||
public static String KEEP_ALIVE = "KeepAlive";
|
||||
|
||||
//TODO: "app4.bewoplaner.de";//
|
||||
// public static String DESTINATION_ADDRESS = "app4.bewoplaner.de";
|
||||
@@ -22,7 +23,6 @@ public class SoapCalls {
|
||||
// public static String SOAP_ADDRESS = "https://" + DESTINATION_ADDRESS + "/BeWoPlanerAndroid/AndroidSoapService.asmx";
|
||||
|
||||
|
||||
|
||||
public static String DESTINATION_ADDRESS = "192.168.1.103";
|
||||
public static int DESTINATION_PORT = 5000;
|
||||
|
||||
|
||||
@@ -38,12 +38,12 @@ public class SocketManager {
|
||||
private static DatabaseHandler databaseHandler = DatabaseHandler.getInstance(BeWoChatApplication.getInstance());
|
||||
|
||||
public static String tenant;
|
||||
public static Socket socket;
|
||||
public static Thread listenerThread;
|
||||
public static SocketListener socketListener;
|
||||
private static Socket socket;
|
||||
private static Thread listenerThread;
|
||||
private static SocketListener socketListener;
|
||||
public static UIHandler uiHandler;
|
||||
public static LoginCallback loginCallback;
|
||||
public static DataOutputStream dataOutputStream;
|
||||
private static DataOutputStream dataOutputStream;
|
||||
|
||||
public static ArrayList<Integer> onlinePersonOids = new ArrayList<>();
|
||||
public static ArrayList<ChatEntity> onlineEntities = new ArrayList<>();
|
||||
@@ -86,7 +86,7 @@ public class SocketManager {
|
||||
public void run() {
|
||||
connectToServer();
|
||||
}
|
||||
}, 30000);
|
||||
}, 5000);
|
||||
} catch(Exception exception2) {
|
||||
exception2.printStackTrace();
|
||||
}
|
||||
@@ -299,6 +299,20 @@ public class SocketManager {
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case STATUS_REQUEST:
|
||||
|
||||
String contactsCsv = chatPacket.ChatMessage;
|
||||
|
||||
String[] stringOids = contactsCsv.split(",");
|
||||
|
||||
SocketManager.onlinePersonOids.clear();
|
||||
|
||||
for(String item : stringOids) {
|
||||
SocketManager.onlinePersonOids.add(Integer.valueOf(item));
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
} catch(Exception e) {
|
||||
|
||||
@@ -18,7 +18,6 @@ import entities.ChatMessage;
|
||||
* Created by JettenM on 09.08.2016.
|
||||
*/
|
||||
public class ChatMessageDeserializer implements JsonDeserializer<ChatMessage> {
|
||||
private static final String LOGTAG = "MESSAGE_DESERIALIZER";
|
||||
|
||||
@Override
|
||||
public ChatMessage deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext jsonDeserializationContext) throws JsonParseException {
|
||||
|
||||
@@ -13,6 +13,7 @@ import android.support.v4.app.NotificationCompat;
|
||||
import android.util.Log;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Calendar;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@@ -46,7 +47,6 @@ public class Util {
|
||||
|
||||
public static final String NOTIFICATION_CANCELLED = "notification_cancelled";
|
||||
|
||||
//public static int unreadMessagesCount = 0;
|
||||
public static int conversationsCount = 0;
|
||||
|
||||
public static HashMap<ChatEntity, Integer> entity2MessagesCountRel = new HashMap<>();
|
||||
@@ -171,6 +171,11 @@ public class Util {
|
||||
Log.e("LOGIN_CALLBACK", "LoginCallback aufgerufen. Verschicke nicht verschickte Nachrichten...");
|
||||
|
||||
sendUnsentMessages(context);
|
||||
|
||||
sendStatusRequest();
|
||||
|
||||
// TODO: Nachrichten herunterladen, sofern man sich in der ChatActivity befindet
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
@@ -220,6 +225,17 @@ public class Util {
|
||||
thread.start();
|
||||
}
|
||||
|
||||
public static void sendStatusRequest() {
|
||||
final Packet requestPacket = new Packet();
|
||||
|
||||
requestPacket.ChatDataIdentifier = DataIdentifier.STATUS_REQUEST;
|
||||
requestPacket.ChatName = SoapConnectionManager.User.getFullName();
|
||||
requestPacket.SenderPersonOid = SoapConnectionManager.User.getPersonOid().intValue();
|
||||
requestPacket.Tenant = SoapConnectionManager.User.getTenant();
|
||||
|
||||
SocketManager.sendMessage(requestPacket);
|
||||
}
|
||||
|
||||
public static ChatEntity getChatEntityFromOnlineEntitiesByOid(int personOid, boolean isTeam) {
|
||||
for(ChatEntity item : SocketManager.onlineEntities) {
|
||||
if(item.getOid() == personOid && item.isTeam() == isTeam) {
|
||||
@@ -245,4 +261,25 @@ public class Util {
|
||||
entity2MessagesCountRel.remove(entity);
|
||||
}
|
||||
}
|
||||
|
||||
public static Integer[] convertStringArrayToIntegerArray(String[] arrayToConvert) {
|
||||
Integer[] result = new Integer[arrayToConvert.length];
|
||||
|
||||
try {
|
||||
for(int i = 0; i < arrayToConvert.length; i++) {
|
||||
result[i] = Integer.parseInt(arrayToConvert[i]);
|
||||
}
|
||||
} catch(NumberFormatException nfe) {
|
||||
Log.e("UTIL", nfe.getMessage());
|
||||
nfe.printStackTrace();
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public static boolean contains(final Integer[] array, final int key) {
|
||||
return Arrays.asList(array).contains(key);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_checked="true" android:state_window_focused="false"
|
||||
android:state_enabled="true"
|
||||
android:drawable="@drawable/btn_check_on" />
|
||||
<item android:state_checked="false" android:state_window_focused="false"
|
||||
android:state_enabled="true"
|
||||
android:drawable="@drawable/btn_check_off" />
|
||||
|
||||
<item android:state_checked="true" android:state_pressed="true"
|
||||
android:state_enabled="true"
|
||||
android:drawable="@drawable/btn_check_on_pressed" />
|
||||
<item android:state_checked="false" android:state_pressed="true"
|
||||
android:state_enabled="true"
|
||||
android:drawable="@drawable/btn_check_off_pressed" />
|
||||
|
||||
<item android:state_checked="true" android:state_focused="true"
|
||||
android:state_enabled="true"
|
||||
android:drawable="@drawable/btn_check_on_selected" />
|
||||
<item android:state_checked="false" android:state_focused="true"
|
||||
android:state_enabled="true"
|
||||
android:drawable="@drawable/btn_check_off_selected" />
|
||||
|
||||
<item android:state_checked="false"
|
||||
android:state_enabled="true"
|
||||
android:drawable="@drawable/btn_check_off" />
|
||||
<item android:state_checked="true"
|
||||
android:state_enabled="true"
|
||||
android:drawable="@drawable/btn_check_on" />
|
||||
|
||||
|
||||
<!-- Disabled states -->
|
||||
|
||||
<item android:state_checked="true" android:state_window_focused="false"
|
||||
android:drawable="@drawable/btn_check_on_disable" />
|
||||
<item android:state_checked="false" android:state_window_focused="false"
|
||||
android:drawable="@drawable/btn_check_off_disable" />
|
||||
|
||||
<item android:state_checked="true" android:state_focused="true"
|
||||
android:drawable="@drawable/btn_check_on_disable_focused" />
|
||||
<item android:state_checked="false" android:state_focused="true"
|
||||
android:drawable="@drawable/btn_check_off_disable_focused" />
|
||||
|
||||
<item android:state_checked="false" android:drawable="@drawable/btn_check_off_disable" />
|
||||
</selector>
|
||||
@@ -0,0 +1,42 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_pressed="true" >
|
||||
<shape>
|
||||
<solid
|
||||
android:color="#ef4444" />
|
||||
<stroke
|
||||
android:width="1dp"
|
||||
android:color="#992f2f" />
|
||||
<corners
|
||||
android:radius="6dp" />
|
||||
<padding
|
||||
android:left="10dp"
|
||||
android:top="10dp"
|
||||
android:right="10dp"
|
||||
android:bottom="10dp" />
|
||||
</shape>
|
||||
</item>
|
||||
<item>
|
||||
<shape>
|
||||
<gradient
|
||||
android:startColor="#ff6e1a"
|
||||
android:centerX="0.2"
|
||||
android:centerY="0.2"
|
||||
android:centerColor="#FF5E00"
|
||||
android:endColor="#FF5E00"
|
||||
android:type="linear"
|
||||
android:angle="225" />
|
||||
|
||||
<stroke
|
||||
android:width="0dp"
|
||||
android:color="#992f2f" />
|
||||
<corners
|
||||
android:radius="30dp" />
|
||||
<padding
|
||||
android:left="10dp"
|
||||
android:top="10dp"
|
||||
android:right="10dp"
|
||||
android:bottom="10dp" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
||||
@@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="ring">
|
||||
<solid android:color="#FF9900"/>
|
||||
<fill android:color="#FF9900"/>
|
||||
|
||||
|
||||
</shape>
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 1.5 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 1.4 KiB |
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
<!-- Draw a 2dp width border around shape -->
|
||||
<stroke
|
||||
android:color="#FF5E00"
|
||||
android:width="2dp"
|
||||
/>
|
||||
</shape>
|
||||
</item>
|
||||
<!-- Overlap the left, top and right border using background color -->
|
||||
<item
|
||||
android:bottom="2dp"
|
||||
>
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="#ffffff"/>
|
||||
</shape>
|
||||
</item>
|
||||
</layer-list>
|
||||
@@ -8,6 +8,7 @@
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
android:background="@color/white"
|
||||
tools:context="beyondsoft.bewomitarbeiterapp.LoginActivity">
|
||||
|
||||
<!-- Login progress -->
|
||||
@@ -37,7 +38,10 @@
|
||||
android:hint="@string/prompt_token"
|
||||
android:inputType="text"
|
||||
android:maxLines="1"
|
||||
android:singleLine="true"/>
|
||||
android:paddingTop="10dp"
|
||||
android:paddingBottom="2dp"
|
||||
android:background="@drawable/textlines"
|
||||
/>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/tenant"
|
||||
@@ -46,7 +50,10 @@
|
||||
android:hint="@string/prompt_tenant"
|
||||
android:inputType="text"
|
||||
android:maxLines="1"
|
||||
android:singleLine="true"/>
|
||||
android:paddingTop="10dp"
|
||||
android:paddingBottom="2dp"
|
||||
android:background="@drawable/textlines"
|
||||
/>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/username"
|
||||
@@ -55,7 +62,10 @@
|
||||
android:hint="@string/prompt_username"
|
||||
android:inputType="text"
|
||||
android:maxLines="1"
|
||||
android:singleLine="true"/>
|
||||
android:paddingTop="10dp"
|
||||
android:paddingBottom="2dp"
|
||||
android:background="@drawable/textlines"
|
||||
/>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/password"
|
||||
@@ -67,23 +77,31 @@
|
||||
android:imeOptions="actionUnspecified"
|
||||
android:inputType="textPassword"
|
||||
android:maxLines="1"
|
||||
android:singleLine="true"/>
|
||||
android:paddingTop="10dp"
|
||||
android:paddingBottom="3dp"
|
||||
android:background="@drawable/textlines"
|
||||
/>
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/remember_me_checkbox"
|
||||
style="checkBoxStyle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/prompt_remember_me"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingBottom="8dp"
|
||||
android:onClick="rememberMeOnClick"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/sign_in_button"
|
||||
style="?android:textAppearanceSmall"
|
||||
style="@style/button_text"
|
||||
android:background="@drawable/orange_button"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:text="@string/action_sign_in_short"
|
||||
android:textStyle="bold"/>
|
||||
android:fontFamily="sans-serif"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<LinearLayout
|
||||
<android.support.v4.widget.SwipeRefreshLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/swipe_refresh_layout"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
@@ -15,4 +16,4 @@
|
||||
>
|
||||
|
||||
</ListView>
|
||||
</LinearLayout>
|
||||
</android.support.v4.widget.SwipeRefreshLayout>
|
||||
@@ -2,4 +2,5 @@
|
||||
<resources>
|
||||
<color name="red">#f12727</color>
|
||||
<color name="green">#25ea20</color>
|
||||
<color name="white">#ffffff</color>
|
||||
</resources>
|
||||
@@ -5,5 +5,23 @@
|
||||
<!-- Customize your theme here. -->
|
||||
</style>
|
||||
|
||||
<style name="button_text" >
|
||||
<item name="android:layout_width" >fill_parent</item>
|
||||
<item name="android:layout_height" >wrap_content</item>
|
||||
<item name="android:textColor" >#ffffff</item>
|
||||
<item name="android:gravity" >center</item>
|
||||
<item name="android:layout_margin" >3dp</item>
|
||||
<item name="android:textSize" >30dp</item>
|
||||
<item name="android:textStyle" >normal</item>
|
||||
<item name="android:shadowColor" >#000000</item>
|
||||
<item name="android:shadowDx" >1</item>
|
||||
<item name="android:shadowDy" >1</item>
|
||||
<item name="android:shadowRadius" >2</item>
|
||||
</style>
|
||||
|
||||
<style name="checkBoxStyle" parent="Base.Theme.AppCompat">
|
||||
<item name="colorAccent">#ff0000</item>
|
||||
<item name="android:textColorSecondary">#fcad49</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
||||
|
||||
@@ -5,7 +5,7 @@ buildscript {
|
||||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:2.1.3'
|
||||
classpath 'com.android.tools.build:gradle:2.2.0'
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
// in the individual module build.gradle files
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1290,54 +1290,40 @@ namespace BeWo.View
|
||||
{
|
||||
try
|
||||
{
|
||||
List<long> listeOid = new List<long>();
|
||||
|
||||
|
||||
foreach (var count in ita)
|
||||
{
|
||||
if (!listeOid.Contains(count.EmpfaengerOid))
|
||||
{
|
||||
listeOid.Add(count.EmpfaengerOid);
|
||||
}
|
||||
}
|
||||
|
||||
var x = ServiceFacade.DoOperationsServiceSync(s => s.GetAllUnreadChatMessages(listeOid));
|
||||
var x = ServiceFacade.DoOperationsServiceSync(s => s.FindUnreadChatMessagesForRecipient(BeWoApp.LoggedOnEmployee.PersonOid.Value));
|
||||
|
||||
foreach (var ChatMessage in x)
|
||||
{
|
||||
if (ChatMessage.IstGelesen != 1)
|
||||
foreach (var aktChatPersons in ita)
|
||||
{
|
||||
foreach (var aktChatPersons in ita)
|
||||
if (aktChatPersons.EmpfaengerOid == ChatMessage.SenderPersonOid && aktChatPersons.TypeChat != ChatType.Team)
|
||||
{
|
||||
if (aktChatPersons.EmpfaengerOid == ChatMessage.SenderPersonOid && aktChatPersons.TypeChat != ChatType.Team)
|
||||
int aktc;
|
||||
bool wasdrin = int.TryParse(aktChatPersons.Receivems, out aktc);
|
||||
|
||||
if (wasdrin)
|
||||
{
|
||||
int aktc;
|
||||
bool wasdrin = int.TryParse(aktChatPersons.Receivems, out aktc);
|
||||
aktc++;
|
||||
aktChatPersons.Receivems = aktc.ToString();
|
||||
|
||||
if (wasdrin)
|
||||
{
|
||||
aktc++;
|
||||
aktChatPersons.Receivems = aktc.ToString();
|
||||
|
||||
}
|
||||
else
|
||||
aktChatPersons.Receivems = 1.ToString();
|
||||
|
||||
}else if(aktChatPersons.EmpfaengerOid == ChatMessage.TeamOid)
|
||||
{
|
||||
int aktt;
|
||||
bool wasdrin = int.TryParse(aktChatPersons.Receivems, out aktt);
|
||||
|
||||
if (wasdrin)
|
||||
{
|
||||
aktt++;
|
||||
aktChatPersons.Receivems = aktt.ToString();
|
||||
|
||||
}
|
||||
else
|
||||
aktChatPersons.Receivems = 1.ToString();
|
||||
|
||||
}
|
||||
else
|
||||
aktChatPersons.Receivems = 1.ToString();
|
||||
|
||||
}else if(aktChatPersons.EmpfaengerOid == ChatMessage.TeamOid)
|
||||
{
|
||||
int aktt;
|
||||
bool wasdrin = int.TryParse(aktChatPersons.Receivems, out aktt);
|
||||
|
||||
if (wasdrin)
|
||||
{
|
||||
aktt++;
|
||||
aktChatPersons.Receivems = aktt.ToString();
|
||||
|
||||
}
|
||||
else
|
||||
aktChatPersons.Receivems = 1.ToString();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -315,7 +315,7 @@ namespace BeWoChatServer
|
||||
|
||||
var notificationPacketLogout = new Packet(dataPacket.Socket, dataPacket.ClientName, dataPacket.SenderPersonOid, 0) {DataIdentifier = DataIdentifier.StatusNotificationLogout};
|
||||
|
||||
Console.WriteLine(DateTime.Now + ": Sende Logout an alle anderen Clients");
|
||||
Console.WriteLine(DateTime.Now + ": Sende Logout von " + dataPacket.ClientName + " an alle anderen Clients");
|
||||
foreach (var client in clientList.Where(w => !w.Value.PersonOid.Equals(dataPacket.SenderPersonOid)))
|
||||
{
|
||||
client.Key.Send(notificationPacketLogout.GetDataStream());
|
||||
@@ -404,23 +404,27 @@ namespace BeWoChatServer
|
||||
|
||||
break;
|
||||
|
||||
case DataIdentifier.MessageResponseToServer:
|
||||
case DataIdentifier.StatusRequest:
|
||||
|
||||
var onlinePersons = clientList.Where(w => w.Value.PersonOid != dataPacket.SenderPersonOid && w.Value.PersonOid > 0).Select(s => s.Value.PersonOid).Distinct().ToList();
|
||||
var oidCSV = "";
|
||||
|
||||
try
|
||||
{
|
||||
Monitor.Enter(_Lock);
|
||||
foreach (var oid in onlinePersons)
|
||||
{
|
||||
oidCSV += oid;
|
||||
|
||||
DefaultHibernateSessionManager.CurrentTenant = dataPacket.Tenant;
|
||||
if (onlinePersons.IndexOf(oid) != onlinePersons.Count - 1)
|
||||
{
|
||||
oidCSV += ",";
|
||||
}
|
||||
}
|
||||
|
||||
var message = DAOFactory.GenericDAO.LoadByID<ChatMessage>(dataPacket.ServerseitigeOid);
|
||||
message.IsDelivered = true;
|
||||
if (oidCSV.Length > 0)
|
||||
{
|
||||
var packet = new Packet { ChatMessage = oidCSV, ClientName = dataPacket.ClientName, DataIdentifier = DataIdentifier.StatusRequest, MessageTimeStamp = DateTime.Now, Tenant = dataPacket.Tenant, SenderPersonOid = dataPacket.SenderPersonOid };
|
||||
|
||||
DAOFactory.GenericDAO.Update(message);
|
||||
}
|
||||
finally
|
||||
{
|
||||
Monitor.Exit(_Lock);
|
||||
}
|
||||
dataPacket.Socket.Send(packet.GetDataStream());
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -429,7 +433,7 @@ namespace BeWoChatServer
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine(DateTime.Now + ": Ein Fehler ist aufgetreten oder die App ist abgestürzt. Der Client wird ausgeloggt");
|
||||
Console.WriteLine(DateTime.Now + ": Ein Fehler ist aufgetreten oder die App ist abgestürzt. Der Client wird ausgeloggt (" + dataPacket.ClientName + ")");
|
||||
|
||||
var sender = dataPacket.Socket;
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ using System.Text;
|
||||
using System.Web.Services;
|
||||
|
||||
using BeWo.Data.Access;
|
||||
using BeWo.Data.Entities;
|
||||
using BeWo.Service.DCEntityMapper;
|
||||
using BeWo.Service.ServiceContracts;
|
||||
using BeWo.Service.ServiceImplementations;
|
||||
@@ -41,6 +42,9 @@ namespace BeWoPlanerAndroid
|
||||
|
||||
SoapHibernateSessionManager.ConfigureHibernateSession();
|
||||
|
||||
var derTimeout = Session.Timeout;
|
||||
Debug.WriteLine("Timeout der Session: " + derTimeout);
|
||||
|
||||
var s = new UserServiceImp();
|
||||
|
||||
if(s.IsUserValid(pUsername, pPassword, null, "SOAPClient", false) == UserValidationResult.UserValid)
|
||||
@@ -100,24 +104,6 @@ namespace BeWoPlanerAndroid
|
||||
|
||||
var messages = DAOFactory.SearchDAO.FindAllChatMessagesForAndroid(pSenderPersonOid, pRecipientPersonOid, exceptions, pIsForTeam).DoForEach(dfe => jsonMessages.Add(new ChatMessageForJson(dfe.EmpfängerPersonOid, dfe.SenderPersonOid, dfe.IsDelivered, dfe.IstGelesen, dfe.TeamOid, dfe.ChatText, dfe.Uhrzeit, dfe.Oid, dfe.InsTs)));
|
||||
|
||||
//messages.DoForEach(d => Debug.WriteLine("ChatText: " + Encoding.UTF8.GetString(d.ChatText) + "; ByteArray: " + d.ChatText.ToString()));
|
||||
|
||||
foreach(var item in messages)
|
||||
{
|
||||
var str = "";
|
||||
item.ChatText.DoForEach(d => str += d.ToString() + ",");
|
||||
|
||||
var abc = MapperFactory.ChatMessagesDC_ChatMessages.MapToNewDC(item);
|
||||
|
||||
Debug.WriteLine("UTF-8: " + Encoding.UTF8.GetString(item.ChatText)
|
||||
+ "\nASCII: " + Encoding.ASCII.GetString(item.ChatText)
|
||||
+ "\nUTF-7: " + Encoding.UTF7.GetString(item.ChatText)
|
||||
+ "\nBigEndianUnicode: " + Encoding.BigEndianUnicode.GetString(item.ChatText)
|
||||
+ "\nUTF-32: " + Encoding.UTF32.GetString(item.ChatText));
|
||||
}
|
||||
|
||||
//jsonMessages.DoForEach(m => Debug.WriteLine("Team: " + (m.TeamOid == null ? "Nein" : m.TeamOid.Value.ToString()) + "; Text: " + m.ChatText));
|
||||
|
||||
return JsonConvert.SerializeObject(jsonMessages);
|
||||
}
|
||||
|
||||
@@ -148,13 +134,7 @@ namespace BeWoPlanerAndroid
|
||||
var isEmployee = customer == null;
|
||||
// mit den eigenen Klienten und allen anderen Mitarbeitern
|
||||
|
||||
var customerOids = employee.Employee2CustomerList.Select(s => s.CustomerOid.Value);
|
||||
var customers = CustomerService.GetCompactCustomersById(customerOids);
|
||||
|
||||
var employees = EmployeeService.GetAllActiveEmployeesCompact().Where(w => !Equals(w.EmployeeOid, employee.Oid.Value));
|
||||
|
||||
var result = employees.Select(emp => new ChatPerson(emp.PersonOid, emp.FirstName + " " + emp.LastName, false, null, null, emp.Version)).ToList();
|
||||
result.AddRange(customers.Select(cus => new ChatPerson(cus.PersonOid, cus.FullName, false, null, null, cus.Version)));
|
||||
var allPersons = DAOFactory.SearchDAO.FindAllChatAuthorizedPersonsForEmployee(employee.Oid.Value).Where(w => w.Oid.Value != employee.Person.Oid.Value).Select(s => new ChatPerson(s.Oid.Value, s.FirstNameLastName, false, null, null, s.Version.Value)).ToList();
|
||||
|
||||
var teams = DAOFactory.SearchDAO.FindTeamsOfEmployee(employee.Oid.Value).Where(w => w.MemberList.Count > 1);
|
||||
|
||||
@@ -177,10 +157,10 @@ namespace BeWoPlanerAndroid
|
||||
}
|
||||
}
|
||||
|
||||
result.Add(new ChatPerson(team.Oid.Value, team.Name, true, memberString, memberNames, team.Version.Value));
|
||||
allPersons.Add(new ChatPerson(team.Oid.Value, team.Name, true, memberString, memberNames, team.Version.Value));
|
||||
}
|
||||
|
||||
return SerializeObject(result);
|
||||
return SerializeObject(allPersons);
|
||||
}
|
||||
|
||||
private static string SerializeObject(object obj)
|
||||
@@ -188,6 +168,12 @@ namespace BeWoPlanerAndroid
|
||||
return JsonConvert.SerializeObject(obj, Formatting.Indented, new JsonSerializerSettings { ContractResolver = new ShouldSerializeContractResolver(), ReferenceLoopHandling = ReferenceLoopHandling.Ignore });
|
||||
}
|
||||
|
||||
[WebMethod(EnableSession = true)]
|
||||
public string KeepAlive()
|
||||
{
|
||||
return "lebt";
|
||||
}
|
||||
|
||||
public class ChatPerson
|
||||
{
|
||||
public long Oid { get; set; }
|
||||
|
||||
@@ -437,8 +437,7 @@ namespace BeWo.Data.Access
|
||||
return test;
|
||||
}
|
||||
|
||||
public IEnumerable<AccountingTransaction> FindAccoutingTransactions(DateTimeSpan pSpan,
|
||||
long? pSupportConceptOid, long? pSupportConceptCostBearerRelOid)
|
||||
public IEnumerable<AccountingTransaction> FindAccoutingTransactions(DateTimeSpan pSpan, long? pSupportConceptOid, long? pSupportConceptCostBearerRelOid)
|
||||
{
|
||||
var lCriteria = CreateCriteriaIsActive<AccountingTransaction>()
|
||||
.CreateAlias(AccountingTransaction.PropertyName_CostBearer2SupportConcept, "cb2sc", JoinType.LeftOuterJoin);
|
||||
@@ -561,7 +560,6 @@ namespace BeWo.Data.Access
|
||||
.List<Customer>();
|
||||
}
|
||||
|
||||
|
||||
public IEnumerable<Customer> GetAllCustomersWithRelatedEmployee()
|
||||
{
|
||||
return CreateCriteria<Customer>()
|
||||
@@ -1224,7 +1222,7 @@ namespace BeWo.Data.Access
|
||||
return criteria.List<SchedulerAppointment>();
|
||||
}
|
||||
|
||||
static string GetSpecificValueFromRecurrenceInfo(string str, int startIndex)
|
||||
private static string GetSpecificValueFromRecurrenceInfo(string str, int startIndex)
|
||||
{
|
||||
var valueBuilder = new StringBuilder();
|
||||
|
||||
@@ -1630,5 +1628,39 @@ namespace BeWo.Data.Access
|
||||
|
||||
return c.List<ChatMessage>();
|
||||
}
|
||||
|
||||
public IEnumerable<Person> FindAllChatAuthorizedPersonsForEmployee(long pEmployeeOid)
|
||||
{
|
||||
var employee = CreateCriteriaIsActive<Employee>().Add(Restrictions.Eq(BeWoEntityBase.PropertyName_Oid, pEmployeeOid)).UniqueResult<Employee>();
|
||||
|
||||
var relatedCustomerOids = employee.Employee2CustomerList.Select(s => s.CustomerOid.Value);
|
||||
|
||||
var c1 = CreateCriteriaIsActive<CustomerAPPCode>()
|
||||
.Add(Restrictions.Eq(CustomerAPPCode.PropertyName_IsChatAktiv, 1));
|
||||
var codes = c1.List<CustomerAPPCode>().Select(s => s.CustomerOid.Value).ToArray();
|
||||
var c2 = CreateCriteriaIsActive<Customer>()
|
||||
.Add(Restrictions.In(BeWoEntityBase.PropertyName_Oid, codes))
|
||||
.Add(Restrictions.In(BeWoEntityBase.PropertyName_Oid, relatedCustomerOids.ToList()));
|
||||
|
||||
var customers = c2.List<Customer>();
|
||||
var employees = FindAllChatActiveEmployees();
|
||||
|
||||
var oids = customers.Select(s => s.Person.Oid.Value).ToList();
|
||||
oids.AddRange(employees.Select(s => s.Person.Oid.Value));
|
||||
|
||||
var c = CreateCriteriaIsActive<Person>()
|
||||
.Add(Restrictions.In(BeWoEntityBase.PropertyName_Oid, oids.Distinct().ToList()));
|
||||
|
||||
return c.List<Person>();
|
||||
}
|
||||
|
||||
public IEnumerable<ChatMessage> FindUnreadChatMessagesForRecipient(long pRecipientOid)
|
||||
{
|
||||
var c = CreateCriteriaIsActive<ChatMessage>()
|
||||
.Add(Restrictions.Eq(ChatMessage.PropertyName_EmpfängerPersonOid, pRecipientOid))
|
||||
.Add(Restrictions.Eq(ChatMessage.PropertyName_IstGelesen, 0));
|
||||
|
||||
return c.List<ChatMessage>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -528,7 +528,7 @@ namespace BeWo.Service.ServiceContracts
|
||||
|
||||
[FaultContract(typeof(BeWoFault))]
|
||||
[OperationContract]
|
||||
List<ChatMessageDC> GetAllUnreadChatMessages(List<long> personOid);
|
||||
List<ChatMessageDC> FindUnreadChatMessagesForRecipient(long personOid);
|
||||
|
||||
[FaultContract(typeof(BeWoFault))]
|
||||
[OperationContract]
|
||||
|
||||
@@ -3146,6 +3146,7 @@ namespace BeWo.Service.ServiceImplementations
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: CompactPersonDCs benutzen
|
||||
public List<CompactCustomerDC> GetAllChatActiveCustomersCompact(long personOid)
|
||||
{
|
||||
try
|
||||
|
||||
@@ -3216,11 +3216,11 @@ namespace BeWo.Service.ServiceImplementations
|
||||
return Code;
|
||||
}
|
||||
|
||||
public List<ChatMessageDC> GetAllUnreadChatMessages(List<long>personOid)
|
||||
public List<ChatMessageDC> FindUnreadChatMessagesForRecipient(long personOid)
|
||||
{
|
||||
try
|
||||
{
|
||||
var chatMessage = DAOFactory.SearchDAO.FindAllUnreadChatMessages(personOid);
|
||||
var chatMessage = DAOFactory.SearchDAO.FindUnreadChatMessagesForRecipient(personOid);
|
||||
|
||||
var ChatMessagesDC = MapperFactory.ChatMessagesDC_ChatMessages.MapToNewDCs(chatMessage);
|
||||
|
||||
|
||||
@@ -839,7 +839,7 @@ namespace BS.Shared
|
||||
StatusNotificationOnline,
|
||||
StatusNotificationOffline,
|
||||
LoginSuccess,
|
||||
MessageResponseToServer
|
||||
StatusRequest
|
||||
}
|
||||
|
||||
public enum ChatType
|
||||
|
||||
Reference in New Issue
Block a user