blubb
This commit is contained in:
@@ -66,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" />
|
||||
@@ -82,6 +74,14 @@
|
||||
<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" />
|
||||
|
||||
@@ -38,7 +38,7 @@ public class DatabaseHandler extends SQLiteOpenHelper {
|
||||
private static final String LOGTAG = "DATABASE_HANDLER";
|
||||
|
||||
//DataBase version
|
||||
private static final int DATABASE_VERSION = 9;
|
||||
private static final int DATABASE_VERSION = 10;
|
||||
|
||||
//Database name
|
||||
private static final String DATABASE_NAME = "Contacts_Manager";
|
||||
|
||||
@@ -100,8 +100,6 @@ public class ChatActivity extends ActionBarActivity implements ConnectivityRecei
|
||||
|
||||
private final static String LOGTAG = "CHAT_ACTIVITY";
|
||||
|
||||
private int mLastFirstVisibleItem = 0;
|
||||
|
||||
@Override
|
||||
public void onNetworkConnectionChanged(boolean isConnected) {
|
||||
BeWoLog.writeToLogFile("onNetworkConnectionChanged in ChatActivity aufgerufen. Bin "+ (isConnected ? "online" : "offline"));
|
||||
@@ -142,7 +140,7 @@ public class ChatActivity extends ActionBarActivity implements ConnectivityRecei
|
||||
int cc = view.getChildCount();
|
||||
int lvp = view.getLastVisiblePosition();
|
||||
|
||||
ChatMessage oldest = chatMessages.get(view.getLastVisiblePosition());
|
||||
ChatMessage oldest = chatMessages.get(fvp);
|
||||
|
||||
String scrollStateName = "";
|
||||
switch (scrollState) {
|
||||
@@ -163,17 +161,18 @@ public class ChatActivity extends ActionBarActivity implements ConnectivityRecei
|
||||
String lvpStr = String.format(Locale.GERMAN, "%1$3d", lvp);
|
||||
String ccStr = String.format(Locale.GERMAN, "%1$3d", cc);
|
||||
|
||||
Log.i("ON_SCROLL_STATE_CHANGED", "ScrollState: " + scrollStateName + "; FirstVisiblePosition: " + fvpStr + " LastVisiblePosition: " + lvpStr + "; ChildCount: " + ccStr + "; Id der ältesten Nachricht: " + oldest.MessageId);
|
||||
|
||||
if(fvp == 0) {
|
||||
if(fvp == 0 && scrollState == SCROLL_STATE_IDLE) {
|
||||
//TODO: Nachichten nachladen
|
||||
// Log.i("ON_SCROLL_STATE_CHANGED", "ScrollState: " + scrollStateName + "; FirstVisiblePosition: " + fvpStr + " LastVisiblePosition: " + lvpStr + "; ChildCount: " + ccStr + "; Id der ältesten Nachricht: " + oldest.MessageId + "; " + oldest.ChatText);
|
||||
Log.i("ON_SCROLL_STATE_CHANGED", "Lade Nachrichten nach...");
|
||||
|
||||
// TODO: die MessageId der ältesten Nachricht übergeben!
|
||||
loadMessages(oldest.MessageId, false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
|
||||
// Log.i("ON_SCROLL", "Scrolle... firstVisibleItem: " + firstVisibleItem + "; visibleItemCount: " + visibleItemCount + "; totalItemCount" + totalItemCount);
|
||||
}
|
||||
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { }
|
||||
});
|
||||
|
||||
Bundle zielkorb = getIntent().getExtras();
|
||||
@@ -372,46 +371,21 @@ public class ChatActivity extends ActionBarActivity implements ConnectivityRecei
|
||||
}
|
||||
});
|
||||
|
||||
ArrayList<String> test = isTeam ? databaseHandler.getExistingTeamChatMessageUUIDs() : databaseHandler.getExistingChatMessageUUIDs();
|
||||
loadMessages(null, true);
|
||||
|
||||
String pExceptions = "";
|
||||
for(int i = 0; i < test.size(); i++) {
|
||||
pExceptions += test.get(i);
|
||||
NotificationManager mNotifyMgr = (NotificationManager) getApplicationContext().getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
|
||||
if(i < test.size() - 1) {
|
||||
pExceptions += ";";
|
||||
}
|
||||
ChatEntity entity = new ChatEntity(recipientOid, isTeam, isEmployee);
|
||||
|
||||
if(SocketManager.notificationEntities.get(entity) != null) {
|
||||
mNotifyMgr.cancel(SocketManager.notificationEntities.get(entity).getNotificationId());
|
||||
Util.removeMessagesCount(entity);
|
||||
} else {
|
||||
Log.i("CHAT_ACTIVITY", "Keine Notification für diesen Chat vorhanden.");
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Anfang Test ----------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
String newestMessageId = "";
|
||||
|
||||
if(test.size() > 0) {
|
||||
newestMessageId = test.get(test.size() - 1);
|
||||
}
|
||||
|
||||
Log.i("CHUNKS", "MessageId der Nachricht, die nicht geladen wird: " + newestMessageId);
|
||||
|
||||
ArrayList<PropertyInfo> propertyInfos2 = new ArrayList<>();
|
||||
propertyInfos2.add(SoapConnectionManager.BuildProperty("messageId", newestMessageId, String.class));
|
||||
propertyInfos2.add(SoapConnectionManager.BuildProperty("pRecipientPersonOid", recipientPersonOid, Long.class));
|
||||
propertyInfos2.add(SoapConnectionManager.BuildProperty("pSenderPersonOid", SoapConnectionManager.getUser().getPersonOid(), Long.class));
|
||||
propertyInfos2.add(SoapConnectionManager.BuildProperty("pIsForTeam", isTeam, Boolean.class));
|
||||
propertyInfos2.add(SoapConnectionManager.BuildProperty("pExceptions", pExceptions, String.class));
|
||||
|
||||
final JsonSoapPrimitiveRequest request = new JsonSoapPrimitiveRequest(SoapCalls.LOAD_CHATMESSAGES_CHUNKWISE, propertyInfos2);
|
||||
// spiceManager.execute(request, new JsonSoapChunkRequestListener());
|
||||
|
||||
// TODO: Ende Test ------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
// ArrayList<PropertyInfo> propertyInfos = new ArrayList<>();
|
||||
// propertyInfos.add(SoapConnectionManager.BuildProperty("pSenderPersonOid", SoapConnectionManager.getUser().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));
|
||||
//
|
||||
// final JsonSoapPrimitiveRequest request = new JsonSoapPrimitiveRequest(SoapCalls.GET_ALL_CHAT_MESSAGES, propertyInfos);
|
||||
|
||||
private void loadMessages(String pNewestMessage, final Boolean isInitialCall) {
|
||||
final Callback corruptedSpiceCallback = new Callback() {
|
||||
@Override
|
||||
public void doCallback() {
|
||||
@@ -440,16 +414,48 @@ public class ChatActivity extends ActionBarActivity implements ConnectivityRecei
|
||||
}
|
||||
};
|
||||
|
||||
ArrayList<String> test = isTeam ? databaseHandler.getExistingTeamChatMessageUUIDs() : databaseHandler.getExistingChatMessageUUIDs();
|
||||
|
||||
String pExceptions = "";
|
||||
for(int i = 0; i < test.size(); i++) {
|
||||
pExceptions += test.get(i);
|
||||
|
||||
if(i < test.size() - 1) {
|
||||
pExceptions += ";";
|
||||
}
|
||||
}
|
||||
|
||||
String newestMessageId = "";
|
||||
|
||||
if(pNewestMessage == null) {
|
||||
if (test.size() > 0) {
|
||||
newestMessageId = test.get(test.size() - 1);
|
||||
}
|
||||
} else {
|
||||
newestMessageId = pNewestMessage;
|
||||
}
|
||||
|
||||
Log.i("CHUNKS", "MessageId der ältesten, bereits heruntergeladenen Nachricht: " + newestMessageId);
|
||||
|
||||
ArrayList<PropertyInfo> propertyInfos2 = new ArrayList<>();
|
||||
propertyInfos2.add(SoapConnectionManager.BuildProperty("messageId", newestMessageId, String.class));
|
||||
propertyInfos2.add(SoapConnectionManager.BuildProperty("pRecipientPersonOid", recipientPersonOid, Long.class));
|
||||
propertyInfos2.add(SoapConnectionManager.BuildProperty("pSenderPersonOid", SoapConnectionManager.getUser().getPersonOid(), Long.class));
|
||||
propertyInfos2.add(SoapConnectionManager.BuildProperty("pIsForTeam", isTeam, Boolean.class));
|
||||
propertyInfos2.add(SoapConnectionManager.BuildProperty("pExceptions", pExceptions, String.class));
|
||||
|
||||
final JsonSoapPrimitiveRequest request = new JsonSoapPrimitiveRequest(SoapCalls.LOAD_CHATMESSAGES_CHUNKWISE, propertyInfos2);
|
||||
|
||||
if(ConnectivityReceiver.isConnected()) {
|
||||
if((Calendar.getInstance().getTime().getTime() - BeWoChatApplication.lastOnlineTS.getTime()) < BeWoChatApplication.getRefreshIntervalInMilliseconds()) {
|
||||
BeWoLog.writeToLogFile("Lade alle Nachrichten für diesen Chat herunter. (ChatActivity)");
|
||||
spiceManager.execute(request, new JsonSoapPrimitiveRequestListener(corruptedSpiceCallback));
|
||||
spiceManager.execute(request, new JsonSoapPrimitiveRequestListener(corruptedSpiceCallback, isInitialCall));
|
||||
} else {
|
||||
SocketManager.loginCallbackAfterConnectionLost = new Callback() {
|
||||
@Override
|
||||
public void doCallback() {
|
||||
BeWoLog.writeToLogFile("Lade alle Nachrichten für diesen Chat nach fehlgeschlagenem ersten Versuch herunter. (ChatActivity)");
|
||||
spiceManager.execute(request, new JsonSoapPrimitiveRequestListener(corruptedSpiceCallback));
|
||||
spiceManager.execute(request, new JsonSoapPrimitiveRequestListener(corruptedSpiceCallback, isInitialCall));
|
||||
}
|
||||
};
|
||||
SocketManager.connectToServer("ChatActivity -> Letzter Serverkontakt ist länger als " + BeWoChatApplication.getRefreshIntervalInMinutes() + " Minuten her");
|
||||
@@ -458,17 +464,6 @@ public class ChatActivity extends ActionBarActivity implements ConnectivityRecei
|
||||
BeWoLog.writeToLogFile("App ist offline. (ChatActivity)");
|
||||
Toast.makeText(getApplicationContext(), "Offline. Keine Aktion möglich.", Toast.LENGTH_LONG).show();
|
||||
}
|
||||
|
||||
NotificationManager mNotifyMgr = (NotificationManager) getApplicationContext().getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
|
||||
ChatEntity entity = new ChatEntity(recipientOid, isTeam, isEmployee);
|
||||
|
||||
if(SocketManager.notificationEntities.get(entity) != null) {
|
||||
mNotifyMgr.cancel(SocketManager.notificationEntities.get(entity).getNotificationId());
|
||||
Util.removeMessagesCount(entity);
|
||||
} else {
|
||||
Log.i("CHAT_ACTIVITY", "Keine Notification für diesen Chat vorhanden.");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -592,9 +587,11 @@ public class ChatActivity extends ActionBarActivity implements ConnectivityRecei
|
||||
private final class JsonSoapPrimitiveRequestListener implements RequestListener<SoapPrimitive> {
|
||||
|
||||
Callback corruptedRequestCallback;
|
||||
Boolean isInitialCall;
|
||||
|
||||
JsonSoapPrimitiveRequestListener(Callback corruptedRequestCallback) {
|
||||
JsonSoapPrimitiveRequestListener(Callback corruptedRequestCallback, Boolean isInitialCall) {
|
||||
this.corruptedRequestCallback = corruptedRequestCallback;
|
||||
this.isInitialCall = isInitialCall;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -671,6 +668,13 @@ public class ChatActivity extends ActionBarActivity implements ConnectivityRecei
|
||||
public void run() {
|
||||
chatMessages.addAll(result);
|
||||
adapter.sort(DATE_COMPARATOR);
|
||||
if(!isInitialCall) {
|
||||
try {
|
||||
listView.setSelection(0);
|
||||
} catch(Exception e) {
|
||||
Util.buildAlert(ChatActivity.this, "adapter.getCount() hat nicht funktioniert!");
|
||||
}
|
||||
}
|
||||
adapter.notifyDataSetChanged();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -16,24 +16,24 @@ public class SoapCalls {
|
||||
public static String LOAD_CHATMESSAGES_CHUNKWISE = "LoadChatMessagesChunkwise";
|
||||
|
||||
//TODO: "app4.bewoplaner.de";//
|
||||
// public static String DESTINATION_ADDRESS = "app4.bewoplaner.de";
|
||||
// public static int DESTINATION_PORT = 5000;
|
||||
//
|
||||
// public static String TOKEN_CHECK_URL = "https://" + DESTINATION_ADDRESS + "/mobil/main/checktoken?token=";
|
||||
//
|
||||
// public static String WEB_DOKU_URL = "https://app1.bewoplaner.de/mobil/login/1234567890";
|
||||
//
|
||||
// public static String WSDL_TARGET_NAME = "bliblablubb.org/";
|
||||
// public static String SOAP_ADDRESS = "https://" + DESTINATION_ADDRESS + "/BeWoPlanerAndroid/AndroidSoapService.asmx";
|
||||
|
||||
|
||||
public static String DESTINATION_ADDRESS = "192.168.1.103";
|
||||
public static String DESTINATION_ADDRESS = "app4.bewoplaner.de";
|
||||
public static int DESTINATION_PORT = 5000;
|
||||
|
||||
public static String TOKEN_CHECK_URL = "http://" + DESTINATION_ADDRESS + "/bewoplanermobil/main/checktoken?token=";
|
||||
public static String TOKEN_CHECK_URL = "https://" + DESTINATION_ADDRESS + "/mobil/main/checktoken?token=";
|
||||
|
||||
public static String WEB_DOKU_URL = "http://" + DESTINATION_ADDRESS + "/bewoplanermobil/login/demo";
|
||||
public static String WEB_DOKU_URL = "https://app1.bewoplaner.de/mobil/login/1234567890";
|
||||
|
||||
static String WSDL_TARGET_NAME = "bliblablubb.org/";
|
||||
static String SOAP_ADDRESS = "http://" + DESTINATION_ADDRESS + "/BeWoPlanerAndroid/AndroidSoapService.asmx";
|
||||
public static String WSDL_TARGET_NAME = "bliblablubb.org/";
|
||||
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;
|
||||
//
|
||||
// public static String TOKEN_CHECK_URL = "http://" + DESTINATION_ADDRESS + "/bewoplanermobil/main/checktoken?token=";
|
||||
//
|
||||
// public static String WEB_DOKU_URL = "http://" + DESTINATION_ADDRESS + "/bewoplanermobil/login/demo";
|
||||
//
|
||||
// static String WSDL_TARGET_NAME = "bliblablubb.org/";
|
||||
// static String SOAP_ADDRESS = "http://" + DESTINATION_ADDRESS + "/BeWoPlanerAndroid/AndroidSoapService.asmx";
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
android:listSelector="@android:color/transparent"
|
||||
android:stackFromBottom="true"
|
||||
android:background="@color/white"
|
||||
android:transcriptMode="alwaysScroll"
|
||||
android:transcriptMode="disabled"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user