Nur Mitarbeiter mit aktivem Chatcode werden auf die App geladen.
Beim Herunterziehen der Kontaktliste in der App werden die Kontakte aktualisiert. Teams sind noch davon ausgenommen.
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" />
|
||||
@@ -64,14 +66,6 @@
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/jni" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/shaders" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/aidl" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/jni" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
|
||||
@@ -80,10 +74,17 @@
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/aidl" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/jni" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/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" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/appcompat-v7/21.0.3/jars" />
|
||||
@@ -93,6 +94,7 @@
|
||||
<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" />
|
||||
@@ -115,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();
|
||||
|
||||
|
||||
@@ -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,15 +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.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
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;
|
||||
@@ -47,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<>();
|
||||
|
||||
@@ -68,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);
|
||||
@@ -88,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);
|
||||
@@ -103,15 +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();
|
||||
|
||||
swipeRefreshLayout.setRefreshing(false);
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
public UIHandler kontaktChatActivityUIHandler = new UIHandler() {
|
||||
@@ -163,6 +201,7 @@ public class KontaktChatActivity extends ActionBarActivity implements Connectivi
|
||||
ka.notifyDataSetChanged();
|
||||
}
|
||||
});
|
||||
|
||||
break;
|
||||
case STATUS_NOTIFICATION_LOGIN_BROADCAST:
|
||||
runOnUiThread(new Runnable() {
|
||||
@@ -287,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();
|
||||
@@ -295,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();
|
||||
@@ -306,20 +354,42 @@ 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
|
||||
// if(Util.contains(Util.convertStringArrayToIntegerArray(cp.TeamMemberOids.split(",")), cp.Oid)) {
|
||||
//
|
||||
// }
|
||||
|
||||
for(ContactListItem item : lc) {
|
||||
if(!item.isTeam) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
oid2VersionList.clear();
|
||||
|
||||
lc = databaseHandler.getAllContacts();
|
||||
|
||||
for(ContactListItem item : lc) {
|
||||
@@ -342,6 +412,10 @@ public class KontaktChatActivity extends ActionBarActivity implements Connectivi
|
||||
listView.setAdapter(adapter);
|
||||
|
||||
((KontaktAdapter) listView.getAdapter()).notifyDataSetChanged();
|
||||
|
||||
if(callback != null) {
|
||||
callback.doCallback();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -300,7 +300,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() {
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
package soapConnection;
|
||||
|
||||
/**
|
||||
* Created by JettenM on 20.09.2016.
|
||||
*/
|
||||
|
||||
public interface OnRequestSuccessCallback {
|
||||
void doCallback();
|
||||
}
|
||||
@@ -23,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<>();
|
||||
|
||||
@@ -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;
|
||||
@@ -260,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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
@@ -133,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);
|
||||
|
||||
@@ -162,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)
|
||||
|
||||
@@ -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,30 @@ 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>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user