abc
This commit is contained in:
3
Android/BewoMitarbeiterApp/.idea/gradle.xml
generated
3
Android/BewoMitarbeiterApp/.idea/gradle.xml
generated
@@ -3,8 +3,9 @@
|
||||
<component name="GradleSettings">
|
||||
<option name="linkedExternalProjectsSettings">
|
||||
<GradleProjectSettings>
|
||||
<option name="distributionType" value="DEFAULT_WRAPPED" />
|
||||
<option name="distributionType" value="LOCAL" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
<option name="gradleHome" value="C:\Program Files\Android\Android Studio\gradle\gradle-2.14.1" />
|
||||
<option name="modules">
|
||||
<set>
|
||||
<option value="$PROJECT_DIR$" />
|
||||
|
||||
@@ -82,24 +82,18 @@
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/builds" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/bundles" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/appcompat-v7/21.0.3/jars" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-v4/21.0.3/jars" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-classes" />
|
||||
<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-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" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/shaders" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
|
||||
@@ -115,8 +109,8 @@
|
||||
<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="robospice-1.4.14" 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="module" module-name="volley" exported="" />
|
||||
<orderEntry type="library" exported="" name="android-android-21" level="project" />
|
||||
|
||||
@@ -9,7 +9,9 @@
|
||||
android:allowBackup="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:theme="@style/AppTheme">
|
||||
android:theme="@style/AppTheme"
|
||||
android:name=".BeWoChatApplication">
|
||||
|
||||
<activity
|
||||
android:name=".SplashScreenActivity"
|
||||
android:theme="@android:style/Theme.NoTitleBar">
|
||||
|
||||
@@ -544,7 +544,7 @@ public class DatabaseHandler extends SQLiteOpenHelper {
|
||||
return picture;
|
||||
}
|
||||
|
||||
public ContactListItem getContactByPersonOid(int personOid) {
|
||||
public ContactListItem getContactByPersonOid(int personOid, boolean isTeam) {
|
||||
SQLiteDatabase db = this.getReadableDatabase();
|
||||
|
||||
Cursor cursor = db.query(TABLE_CONTACTS,
|
||||
@@ -556,8 +556,8 @@ public class DatabaseHandler extends SQLiteOpenHelper {
|
||||
KEY_IS_TEAM,
|
||||
KEY_TEAM_MEMBER_NAMES,
|
||||
KEY_TEAM_MEMBER_OIDS},
|
||||
KEY_PERSONOID + "=?",
|
||||
new String[]{String.valueOf(personOid)},
|
||||
KEY_PERSONOID + "=? AND " + KEY_IS_TEAM + "=?",
|
||||
new String[]{String.valueOf(personOid), String.valueOf((isTeam ? 1 : 0))},
|
||||
null,null,null,null);
|
||||
|
||||
if(cursor != null && cursor.moveToFirst()) {
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
package beyondsoft.bewomitarbeiterapp;
|
||||
|
||||
import android.app.Application;
|
||||
import android.app.NotificationManager;
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
/**
|
||||
* Created by JettenM on 24.08.2016.
|
||||
*/
|
||||
public class BeWoChatApplication extends Application {
|
||||
private Thread.UncaughtExceptionHandler defaultUncaughtExceptionHandler;
|
||||
|
||||
public BeWoChatApplication() {
|
||||
defaultUncaughtExceptionHandler = Thread.getDefaultUncaughtExceptionHandler();
|
||||
|
||||
Thread.UncaughtExceptionHandler uncaughtExceptionHandler = new Thread.UncaughtExceptionHandler() {
|
||||
@Override
|
||||
public void uncaughtException(Thread thread, Throwable ex) {
|
||||
|
||||
//TODO: Notifications löschen
|
||||
|
||||
Log.e("UNCAUGHT_EXCEPTION", "Eine unbehandelte Ausnahme ist aufgetreten!");
|
||||
|
||||
NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
|
||||
nm.cancelAll();
|
||||
|
||||
defaultUncaughtExceptionHandler.uncaughtException(thread, ex);
|
||||
}
|
||||
};
|
||||
|
||||
Thread.setDefaultUncaughtExceptionHandler(uncaughtExceptionHandler);
|
||||
}
|
||||
}
|
||||
@@ -51,6 +51,8 @@ import java.security.InvalidKeyException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
@@ -143,7 +145,7 @@ public class ChatActivity extends ActionBarActivity {
|
||||
TextView titlename = (TextView) mCustomView.findViewById(R.id.PersonalName);
|
||||
ImageView titlepic = (ImageView) mCustomView.findViewById(R.id.PersonalPic);
|
||||
|
||||
status.setImageResource((SocketManager.onlinePersonOids.contains(recipientPersonOid) ? R.drawable.online : R.drawable.offline));
|
||||
status.setImageResource((SocketManager.onlinePersonOids.contains(recipientPersonOid) ? R.drawable.statusonline : R.drawable.statusoffline));
|
||||
|
||||
Bitmap customerImage;
|
||||
|
||||
@@ -156,6 +158,8 @@ public class ChatActivity extends ActionBarActivity {
|
||||
|
||||
chatMessages = isTeam ? databaseHandler.getMessagesForTeam(recipientPersonOid) : databaseHandler.getMessagesForRecipient(recipientPersonOid);
|
||||
|
||||
Collections.sort(chatMessages, DATE_COMPARATOR);
|
||||
|
||||
adapter = new MessageAdapter(this, R.layout.item_chat_left, chatMessages);
|
||||
listView.setAdapter(adapter);
|
||||
|
||||
@@ -163,6 +167,8 @@ public class ChatActivity extends ActionBarActivity {
|
||||
@Override
|
||||
public void updateUserInterface(final Packet chatPacket) {
|
||||
try {
|
||||
Log.i("CHAT_SOCKET_LISTENER", "Nachricht vom Typ " + chatPacket.ChatDataIdentifier.name() + " empfangen");
|
||||
|
||||
switch(chatPacket.ChatDataIdentifier) {
|
||||
case MESSAGE:
|
||||
listView.post(new Runnable() {
|
||||
@@ -187,7 +193,6 @@ public class ChatActivity extends ActionBarActivity {
|
||||
|
||||
cm.ServerseitigeOid = chatPacket.ServerseitigeOid;
|
||||
|
||||
Log.i("CHAT_SOCKET_LISTENER", "" + cm.IsTeam + "; Clientseitige Id: " + cm.Id + "; Serverseitige Oid: " + cm.ServerseitigeOid);
|
||||
databaseHandler.updateChatMessage(cm);
|
||||
|
||||
break;
|
||||
@@ -207,15 +212,15 @@ public class ChatActivity extends ActionBarActivity {
|
||||
listView.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
ChatMessage message = new ChatMessage(chatPacket.SenderPersonOid, chatPacket.RecipientPersonOid, chatPacket.MessageTimeStamp, chatPacket.ChatMessage, false, chatPacket.ServerseitigeOid, false);
|
||||
ChatMessage message = new ChatMessage(chatPacket.SenderPersonOid, chatPacket.RecipientPersonOid, chatPacket.MessageTimeStamp, chatPacket.ChatMessage, false, chatPacket.ServerseitigeOid, true);
|
||||
|
||||
databaseHandler.addChatMessage(message);
|
||||
|
||||
if(chatPacket.SenderPersonOid == recipientPersonOid) {
|
||||
if(isTeam && chatPacket.RecipientPersonOid == recipientPersonOid) {
|
||||
chatMessages.add(message);
|
||||
adapter.notifyDataSetChanged();
|
||||
} else {
|
||||
SetNotify(chatPacket.ChatName, chatPacket.ChatMessage, chatPacket.SenderPersonOid, isTeam, teamMemberOids, teamMemberNames);
|
||||
Util.SetNotify(chatPacket.ChatName, chatPacket.ChatMessage, chatPacket.RecipientPersonOid, true, teamMemberOids, teamMemberNames, getApplicationContext());
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -233,15 +238,19 @@ public class ChatActivity extends ActionBarActivity {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if(!text.getText().toString().isEmpty()) {
|
||||
|
||||
Calendar c = Calendar.getInstance();
|
||||
Date now = c.getTime();
|
||||
|
||||
Packet packet = new Packet();
|
||||
packet.ChatMessage = text.getText().toString();
|
||||
Packet packet = new Packet();
|
||||
packet.ChatMessage = text.getText().toString();
|
||||
packet.ChatDataIdentifier = isTeam ? DataIdentifier.TEAM : DataIdentifier.MESSAGE;
|
||||
|
||||
if(isTeam) {
|
||||
packet.ChatName = recipientName;
|
||||
}
|
||||
|
||||
packet.RecipientPersonOid = recipientPersonOid;
|
||||
packet.MessageTimeStamp = now;
|
||||
packet.MessageTimeStamp = now;
|
||||
|
||||
SharedPreferences settings = getSharedPreferences(Util.PREFS_NAME, 0);
|
||||
|
||||
@@ -260,14 +269,13 @@ public class ChatActivity extends ActionBarActivity {
|
||||
|
||||
packet.ClientseitigeOid = Long.valueOf(coid).intValue();
|
||||
|
||||
packet.writeToLog();
|
||||
|
||||
SocketManager.sendMessage(packet);
|
||||
|
||||
listView.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
chatMessages.add(message);
|
||||
|
||||
adapter.notifyDataSetChanged();
|
||||
|
||||
text.setText("");
|
||||
@@ -354,15 +362,14 @@ public class ChatActivity extends ActionBarActivity {
|
||||
String tMemberOids = zielkorb.getString("TeamMemberOids");
|
||||
String tMemberNames = zielkorb.getString("TeamMemberNames");
|
||||
|
||||
Toast.makeText(getApplicationContext(), "" + blahIsTeam, Toast.LENGTH_LONG).show();
|
||||
|
||||
byte[] imageAsByteArray = databaseHandler.getUserImage(rpoid);
|
||||
|
||||
Log.i("CHAT_ON_NEW_INTENT", "Bild ist null: " + (imageAsByteArray == null));
|
||||
|
||||
ReloadChatView(rn, rpoid, null, blahIsTeam, tMemberOids, tMemberNames);
|
||||
ReloadChatView(rn, rpoid, imageAsByteArray, blahIsTeam, tMemberOids, tMemberNames);
|
||||
}
|
||||
|
||||
public void SetNotify(String username, String message, int recipientOid, boolean isTeam, String teamMemberOids, String teamMemberNames){
|
||||
|
||||
NotificationCompat.Builder mBuilder =
|
||||
new NotificationCompat.Builder(this)
|
||||
.setSmallIcon(R.drawable.ic_stat_name)
|
||||
@@ -380,7 +387,6 @@ public class ChatActivity extends ActionBarActivity {
|
||||
bundle.putBoolean("IsTeam", isTeam);
|
||||
bundle.putString("TeamMemberOids", teamMemberOids);
|
||||
bundle.putString("TeamMemberNames", teamMemberNames);
|
||||
//TODO: Bild laden
|
||||
|
||||
Intent resultIntent = new Intent(this, ChatActivity.class);
|
||||
resultIntent.putExtras(bundle);
|
||||
@@ -391,7 +397,6 @@ public class ChatActivity extends ActionBarActivity {
|
||||
|
||||
NotificationManager mNotifyMgr = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
|
||||
|
||||
|
||||
mBuilder.setContentIntent(resultPendingIntent);
|
||||
|
||||
mNotifyMgr.notify((new Random()).nextInt(9999 - 1000) + 1000, mBuilder.build());
|
||||
@@ -445,10 +450,19 @@ public class ChatActivity extends ActionBarActivity {
|
||||
listView.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Collections.sort(result, DATE_COMPARATOR);
|
||||
|
||||
chatMessages.addAll(result);
|
||||
adapter.notifyDataSetChanged();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public static final Comparator<ChatMessage> DATE_COMPARATOR = new Comparator<ChatMessage>() {
|
||||
@Override
|
||||
public int compare(ChatMessage lhs, ChatMessage rhs) {
|
||||
return lhs.InsTs.getTime() > rhs.InsTs.getTime() ? 0 : 1;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,81 +0,0 @@
|
||||
package beyondsoft.bewomitarbeiterapp;
|
||||
|
||||
/**
|
||||
* Created by bib on 07.06.2016.
|
||||
*/
|
||||
public class ContactList {
|
||||
private int _id;
|
||||
private String _kontaktname;
|
||||
private String _art;
|
||||
private byte[] _picture;
|
||||
|
||||
//default Construkt
|
||||
public ContactList(){}
|
||||
|
||||
//Construkt 1
|
||||
public ContactList(int id, String kontaktname, String art,byte[] picture){
|
||||
this._id = id;
|
||||
this._kontaktname = kontaktname;
|
||||
this._art = art;
|
||||
this._picture = picture;
|
||||
}
|
||||
|
||||
//Construkt 2
|
||||
public ContactList(String kontaktname,String art,byte[] picture){
|
||||
this._kontaktname = kontaktname;
|
||||
this._art = art;
|
||||
this._picture = picture;
|
||||
}
|
||||
|
||||
//Construkt 3
|
||||
public ContactList(String kontaktname,String art){
|
||||
this._kontaktname = kontaktname;
|
||||
this._art = art;
|
||||
this._picture = null;
|
||||
}
|
||||
|
||||
//Construkt4
|
||||
public ContactList(int id, String kontaktname, String art){
|
||||
this._id = id;
|
||||
this._kontaktname = kontaktname;
|
||||
this._art = art;
|
||||
this._picture = null;
|
||||
}
|
||||
|
||||
//ID
|
||||
public int getID(){
|
||||
return this._id;
|
||||
}
|
||||
|
||||
public void setID(int id){
|
||||
this._id = id;
|
||||
}
|
||||
|
||||
|
||||
// KONTAKT
|
||||
public String getKontaktName(){
|
||||
return this._kontaktname;
|
||||
}
|
||||
|
||||
public void setKontaktName(String k){
|
||||
this._kontaktname = k;
|
||||
}
|
||||
|
||||
//ART
|
||||
public String getArt(){
|
||||
return this._art;
|
||||
}
|
||||
|
||||
public void setArt(String a){
|
||||
this._art = a;
|
||||
}
|
||||
|
||||
//Picture
|
||||
public byte[] getPicture(){
|
||||
return this._picture;
|
||||
}
|
||||
|
||||
public void setPicture(byte[] d){
|
||||
this._picture = d;
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
package beyondsoft.bewomitarbeiterapp;
|
||||
|
||||
/**
|
||||
* Created by JettenM on 05.07.2016.
|
||||
* Created by JettenM on 24.08.2016.
|
||||
*/
|
||||
public class ContactListItem {
|
||||
private int mId;
|
||||
|
||||
@@ -63,6 +63,7 @@ public class KontaktAdapter extends ArrayAdapter<ContactListItem> {
|
||||
}
|
||||
|
||||
if(values.get(position).getPicture() != null) {
|
||||
|
||||
byte[] imageAsByteArray = values.get(position).getPicture();
|
||||
|
||||
Bitmap i = BitmapFactory.decodeByteArray(imageAsByteArray, 0, imageAsByteArray.length);
|
||||
@@ -76,7 +77,7 @@ public class KontaktAdapter extends ArrayAdapter<ContactListItem> {
|
||||
getPic.start();
|
||||
}
|
||||
|
||||
onlinestats.setImageResource((values.get(position).isOnline ? R.drawable.online : R.drawable.offline));
|
||||
onlinestats.setImageResource((values.get(position).isOnline ? R.drawable.statusonline : R.drawable.statusoffline));
|
||||
|
||||
return rowView;
|
||||
}
|
||||
|
||||
@@ -43,6 +43,7 @@ import soapConnection.SoapCalls;
|
||||
import soapConnection.SoapConnectionManager;
|
||||
import tcpConnection.SocketManager;
|
||||
import tcpConnection.UIHandler;
|
||||
import util.Util;
|
||||
|
||||
/**
|
||||
* Created by bib on 02.05.2016.
|
||||
@@ -82,14 +83,16 @@ public class KontaktChatActivity extends ListActivity {
|
||||
|
||||
databaseHandler.addChatMessage(message);
|
||||
|
||||
SetNotify(chatPacket.ChatName, chatPacket.ChatMessage, chatPacket.SenderPersonOid);
|
||||
Util.SetNotify(chatPacket.ChatName, chatPacket.ChatMessage, chatPacket.SenderPersonOid, false, null, null, getApplicationContext());
|
||||
break;
|
||||
case TEAM:
|
||||
ChatMessage teamMessage = new ChatMessage(chatPacket.SenderPersonOid, chatPacket.RecipientPersonOid, chatPacket.MessageTimeStamp, chatPacket.ChatMessage, false, chatPacket.ServerseitigeOid, true);
|
||||
|
||||
databaseHandler.addChatMessage(teamMessage);
|
||||
|
||||
SetNotify(chatPacket.ChatName, chatPacket.ChatMessage, chatPacket.SenderPersonOid);
|
||||
ContactListItem cli = DatabaseHandler.getInstance(getApplicationContext()).getContactByPersonOid(chatPacket.RecipientPersonOid, true);
|
||||
|
||||
Util.SetNotify(chatPacket.ChatName, chatPacket.ChatMessage, chatPacket.RecipientPersonOid, true, cli.teamMemberOids, cli.teamMemberNames, getApplicationContext());
|
||||
break;
|
||||
case STATUS_NOTIFICATION_LOGIN:
|
||||
Log.i("KONTAKTLISTE", "Login registriert: (" + chatPacket.SenderPersonOid + ") " + chatPacket.ChatName);
|
||||
@@ -168,7 +171,6 @@ public class KontaktChatActivity extends ListActivity {
|
||||
|
||||
@Override
|
||||
protected void onListItemClick(ListView l, View v, int position, long id) {
|
||||
//get selected items
|
||||
ContactListItem selectedValue = (ContactListItem) getListAdapter().getItem(position);
|
||||
|
||||
Bundle bundle = new Bundle();
|
||||
@@ -286,35 +288,4 @@ public class KontaktChatActivity extends ListActivity {
|
||||
((KontaktAdapter) listView.getAdapter()).notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public void SetNotify(String username, String message, int recipientOid){
|
||||
NotificationCompat.Builder mBuilder =
|
||||
new NotificationCompat.Builder(this)
|
||||
.setSmallIcon(R.drawable.ic_stat_name)
|
||||
.setContentTitle(username)
|
||||
.setContentText(message)
|
||||
.setAutoCancel(true)
|
||||
.setDefaults(Notification.DEFAULT_SOUND)
|
||||
.setVibrate(new long[] { 1000, 1000, 1000, 1000, 1000 }) //Notification.Default_Vibrate
|
||||
.setLights(Color.YELLOW, 3000, 3000) //Notification.Default_Lights
|
||||
.setOngoing(true);
|
||||
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("Name", username);
|
||||
bundle.putInt("RecipientOid", recipientOid);
|
||||
|
||||
Intent resultIntent = new Intent(this, ChatActivity.class);
|
||||
resultIntent.putExtras(bundle);
|
||||
|
||||
resultIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
|
||||
PendingIntent resultPendingIntent = PendingIntent.getActivity(this.getApplicationContext(), 0, resultIntent, PendingIntent.FLAG_UPDATE_CURRENT );
|
||||
|
||||
NotificationManager mNotifyMgr = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
|
||||
|
||||
mBuilder.setContentIntent(resultPendingIntent);
|
||||
|
||||
Random random = new Random();
|
||||
|
||||
mNotifyMgr.notify(random.nextInt(9999 - 1000) + 1000, mBuilder.build());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,8 @@ import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.app.ActionBarActivity;
|
||||
@@ -193,21 +195,21 @@ public class LoginActivity extends ActionBarActivity {
|
||||
RequestQueue queue = Volley.newRequestQueue(LoginActivity.this);
|
||||
String url = SoapCalls.TOKEN_CHECK_URL + token;
|
||||
|
||||
StringRequest stringRequest = new StringRequest(Request.Method.GET, url, new Response.Listener<String>() {
|
||||
@Override
|
||||
public void onResponse(String response) {
|
||||
if(response == null || TextUtils.isEmpty(response)) {
|
||||
showProgress(false);
|
||||
|
||||
clearSharedPreferences();
|
||||
|
||||
mPasswordView.setError(getString(R.string.error_invalid_input));
|
||||
mUsernameView.setError(getString(R.string.error_invalid_input));
|
||||
mChatCodeView.setError(getString(R.string.error_invalid_input));
|
||||
mTenantView.setError(getString(R.string.error_invalid_input));
|
||||
|
||||
return;
|
||||
}
|
||||
// StringRequest stringRequest = new StringRequest(Request.Method.GET, url, new Response.Listener<String>() {
|
||||
// @Override
|
||||
// public void onResponse(String response) {
|
||||
// if(response == null || TextUtils.isEmpty(response)) {
|
||||
// showProgress(false);
|
||||
//
|
||||
// clearSharedPreferences();
|
||||
//
|
||||
// mPasswordView.setError(getString(R.string.error_invalid_input));
|
||||
// mUsernameView.setError(getString(R.string.error_invalid_input));
|
||||
// mChatCodeView.setError(getString(R.string.error_invalid_input));
|
||||
// mTenantView.setError(getString(R.string.error_invalid_input));
|
||||
//
|
||||
// return;
|
||||
// }
|
||||
|
||||
ArrayList<PropertyInfo> propertyInfos = new ArrayList<>();
|
||||
propertyInfos.add(SoapConnectionManager.BuildProperty("pTenant", tenant, String.class));
|
||||
@@ -216,16 +218,16 @@ public class LoginActivity extends ActionBarActivity {
|
||||
|
||||
JsonSoapPrimitiveRequest request = new JsonSoapPrimitiveRequest(SoapCalls.LOGIN_CALL, propertyInfos);
|
||||
spiceManager.execute(request, new JsonSoapPrimitiveRequestListener());
|
||||
}
|
||||
}, new Response.ErrorListener() {
|
||||
@Override
|
||||
public void onErrorResponse(VolleyError error) {
|
||||
showProgress(false);
|
||||
Log.e("Error sending request", (error == null ? "error is null" : error.getMessage()));
|
||||
}
|
||||
});
|
||||
// }
|
||||
// }, new Response.ErrorListener() {
|
||||
// @Override
|
||||
// public void onErrorResponse(VolleyError error) {
|
||||
// showProgress(false);
|
||||
// Log.e("Error sending request", (error == null ? "error is null" : error.getMessage()));
|
||||
// }
|
||||
// });
|
||||
|
||||
queue.add(stringRequest);
|
||||
// queue.add(stringRequest);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -273,6 +275,18 @@ public class LoginActivity extends ActionBarActivity {
|
||||
databaseHandler.insertOwnerOid(SoapConnectionManager.User.getPersonOid().intValue());
|
||||
}
|
||||
|
||||
ContactListItem cli = databaseHandler.getContactByPersonOid(4, false);
|
||||
if (getResources().getDrawable(R.drawable.katyperry) != null && cli != null) {
|
||||
Bitmap bitch = ((BitmapDrawable) getResources().getDrawable(R.drawable.katyperry)).getBitmap();
|
||||
ByteArrayOutputStream stream = new ByteArrayOutputStream();
|
||||
bitch.compress(Bitmap.CompressFormat.JPEG, 100, stream);
|
||||
byte[] byteArray = stream.toByteArray();
|
||||
|
||||
cli.setPicture(byteArray);
|
||||
|
||||
databaseHandler.getInstance(getApplicationContext()).updateContact(cli);
|
||||
}
|
||||
|
||||
if(mRememberMeCheckBoxView.isChecked()) {
|
||||
ByteArrayOutputStream tokenOutputStream = new ByteArrayOutputStream();
|
||||
ByteArrayOutputStream tenantOutputStream = new ByteArrayOutputStream();
|
||||
|
||||
@@ -6,21 +6,26 @@ import android.app.NotificationManager;
|
||||
import android.app.PendingIntent;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Color;
|
||||
import android.os.Looper;
|
||||
import android.support.v4.app.NotificationCompat;
|
||||
import android.os.Bundle;
|
||||
|
||||
import android.util.Log;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.Toast;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import Database.DatabaseHandler;
|
||||
import soapConnection.Packet;
|
||||
import soapConnection.SoapConnectionManager;
|
||||
|
||||
import tcpConnection.SocketManager;
|
||||
import tcpConnection.UIHandler;
|
||||
import util.Util;
|
||||
|
||||
|
||||
public class MainActivityMitarbeiter extends Activity {
|
||||
@@ -54,7 +59,7 @@ public class MainActivityMitarbeiter extends Activity {
|
||||
public void updateUserInterface(Packet chatPacket) {
|
||||
switch(chatPacket.ChatDataIdentifier) {
|
||||
case MESSAGE:
|
||||
SetNotify(chatPacket.ChatName, chatPacket.ChatMessage, chatPacket.SenderPersonOid);
|
||||
Util.SetNotify(chatPacket.ChatName, chatPacket.ChatMessage, chatPacket.SenderPersonOid, false, null, null, getApplicationContext());
|
||||
|
||||
break;
|
||||
case STATUS_NOTIFICATION_LOGIN_BROADCAST:
|
||||
@@ -77,6 +82,12 @@ public class MainActivityMitarbeiter extends Activity {
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case TEAM:
|
||||
ContactListItem cli = DatabaseHandler.getInstance(getApplicationContext()).getContactByPersonOid(chatPacket.RecipientPersonOid, true);
|
||||
|
||||
Util.SetNotify(chatPacket.ChatName, chatPacket.ChatMessage, chatPacket.RecipientPersonOid, true, cli.teamMemberOids, cli.teamMemberNames, getApplicationContext());
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -136,41 +147,6 @@ public class MainActivityMitarbeiter extends Activity {
|
||||
});
|
||||
}
|
||||
|
||||
public void SetNotify(String username, String message, int recipientOid){
|
||||
|
||||
//Convertiert in Pic Resource in ein Bitmap
|
||||
//BitmapFactory.decodeResource(getResources(), R.drawable.bslogo)
|
||||
|
||||
NotificationCompat.Builder mBuilder =
|
||||
new NotificationCompat.Builder(this)
|
||||
.setSmallIcon(R.drawable.ic_stat_name)
|
||||
.setContentTitle(username)
|
||||
.setContentText(message)
|
||||
.setAutoCancel(true)
|
||||
.setDefaults(Notification.DEFAULT_SOUND)
|
||||
.setVibrate(new long[] { 1000, 1000, 1000, 1000, 1000 }) //Notification.Default_Vibrate
|
||||
.setLights(Color.YELLOW, 3000, 3000) //Notification.Default_Lights
|
||||
.setOngoing(true);
|
||||
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("Name", username);
|
||||
bundle.putInt("RecipientOid", recipientOid);
|
||||
|
||||
Intent resultIntent = new Intent(this, ChatActivity.class);
|
||||
resultIntent.putExtras(bundle);
|
||||
|
||||
resultIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
|
||||
PendingIntent resultPendingIntent = PendingIntent.getActivity(this.getApplicationContext(), 0, resultIntent, PendingIntent.FLAG_UPDATE_CURRENT );
|
||||
|
||||
NotificationManager mNotifyMgr = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
|
||||
|
||||
mBuilder.setContentIntent(resultPendingIntent);
|
||||
|
||||
Random random = new Random();
|
||||
|
||||
mNotifyMgr.notify(random.nextInt(9999 - 1000) + 1000, mBuilder.build());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
SocketManager.uiHandler = mainUIHandler;
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
package beyondsoft.bewomitarbeiterapp;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.provider.ContactsContract;
|
||||
import android.text.Html;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@@ -22,13 +19,12 @@ import soapConnection.SoapConnectionManager;
|
||||
public class MessageAdapter extends ArrayAdapter<ChatMessage> {
|
||||
|
||||
private Activity activity;
|
||||
private List<ChatMessage> messages;
|
||||
//private List<ChatMessage> messages;
|
||||
|
||||
public MessageAdapter(Activity context, int resource, List<ChatMessage> objects) {
|
||||
super(context, resource, objects);
|
||||
this.activity = context;
|
||||
this.messages = objects;
|
||||
|
||||
//this.messages = objects;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -45,23 +41,18 @@ public class MessageAdapter extends ArrayAdapter<ChatMessage> {
|
||||
layoutResource = R.layout.item_chat_left;
|
||||
}
|
||||
|
||||
|
||||
|
||||
convertView = inflater.inflate(layoutResource, parent, false);
|
||||
holder = new ViewHolder(convertView);
|
||||
convertView.setTag(holder);
|
||||
|
||||
holder.msg.setText(chatMessage.ChatText);
|
||||
|
||||
Log.i("MESSAGE_ADAPTER", "IsTeam: " + chatMessage.IsTeam + "; SenderPersonOid: " + chatMessage.SenderPersonOid + "; LoggedinUserPersonOid: " + SoapConnectionManager.User.getPersonOid());
|
||||
if(chatMessage.IsTeam && chatMessage.SenderPersonOid != SoapConnectionManager.User.getPersonOid()) {
|
||||
DatabaseHandler instance = DatabaseHandler.getInstance(this.getContext());
|
||||
ContactListItem sender = instance.getContactByPersonOid(chatMessage.SenderPersonOid);
|
||||
ContactListItem sender = instance.getContactByPersonOid(chatMessage.SenderPersonOid, false);
|
||||
|
||||
String name = sender != null ? sender.getChatName() : "";
|
||||
|
||||
Log.i("MESSAGE_ADAPTER", "Name <" + name + ">");
|
||||
|
||||
holder.teamMemberName.setText(name);
|
||||
holder.teamMemberName.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
@@ -25,7 +25,6 @@ public class Packet {
|
||||
public boolean IsDelivered;
|
||||
public int ServerseitigeOid;
|
||||
public int ClientseitigeOid;
|
||||
public boolean IsTeam;
|
||||
|
||||
public Packet() {
|
||||
ChatDataIdentifier = DataIdentifier.NULL;
|
||||
@@ -50,9 +49,6 @@ public class Packet {
|
||||
//23;281;20;389;1;38;932[Tenant]; 8 Semikola
|
||||
|
||||
public Packet(String message) {
|
||||
|
||||
Log.d("PACKET >>>>>>>>>", message);
|
||||
|
||||
String[] gesplittet = message.split(";");
|
||||
|
||||
String senderPersonOidString = gesplittet[0];
|
||||
@@ -91,10 +87,11 @@ public class Packet {
|
||||
}
|
||||
|
||||
IsDelivered = Integer.parseInt(actualMessage.substring(chatMessageLength + chatNameLength + 19, chatMessageLength + chatNameLength + 20)) != 0;
|
||||
|
||||
writeToLog("Konstruktor");
|
||||
}
|
||||
|
||||
public byte[] getDataStream() {
|
||||
|
||||
String dataStreamAsString = "" + SenderPersonOid + ";" + RecipientPersonOid + ";" + ChatName.length() + ";" + ChatMessage.length()+ ";" + ChatDataIdentifier.getValue() + ";" + ServerseitigeOid + ";" + ClientseitigeOid + ";" + Tenant + ";";
|
||||
|
||||
dataStreamAsString += ChatName + ChatMessage + getFormattedMessageTimeStamp() + "" + (IsDelivered ? 1 : 0);
|
||||
@@ -107,10 +104,12 @@ public class Packet {
|
||||
Log.e("Packet.getDataStream", e.getMessage());
|
||||
}
|
||||
|
||||
writeToLog("getDataStream()");
|
||||
|
||||
return blaaah;
|
||||
}
|
||||
|
||||
public void writeToLog() {
|
||||
Log.i("PACKET_LOG", "SenderPersonOid: " + SenderPersonOid + "\nRecipientPersonOid: " + RecipientPersonOid + "\nChatDataIdentifier: " + ChatDataIdentifier.name() + "\nChatName: " + ChatName + "\nChatMessage: " + ChatMessage + "\nTenant: " + Tenant + "\nIsDelivered: " + IsDelivered + "\nMessageTimeStamp: " + MessageTimeStamp + "\nServerseitigeOid: " + ServerseitigeOid + "\nClientseitigeOid: " + ClientseitigeOid);
|
||||
public void writeToLog(String prefix) {
|
||||
Log.i("PACKET_LOG", prefix + ": SenderPersonOid: " + SenderPersonOid + "\nRecipientPersonOid: " + RecipientPersonOid + "\nChatDataIdentifier: " + ChatDataIdentifier.name() + "\nChatName: " + ChatName + "\nChatMessage: " + ChatMessage + "\nTenant: " + Tenant + "\nIsDelivered: " + IsDelivered + "\nMessageTimeStamp: " + MessageTimeStamp + "\nServerseitigeOid: " + ServerseitigeOid + "\nClientseitigeOid: " + ClientseitigeOid);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,12 +10,13 @@ public class SoapCalls {
|
||||
|
||||
public static String GET_ALL_CHAT_MESSAGES = "GetAllChatMessagesForSenderAndRecipient";
|
||||
|
||||
//"app4.bewoplaner.de";//
|
||||
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 TOKEN_CHECK_URL = "http://" + DESTINATION_ADDRESS + "/mobil/main/checktoken?token=";
|
||||
|
||||
public static String WEB_DOKU_URL = "http://" + DESTINATION_ADDRESS + "/BewoPlanerMobil/login/demo";
|
||||
public static String WEB_DOKU_URL = "http://" + DESTINATION_ADDRESS + "/mobil/login/demo";
|
||||
|
||||
public static String WSDL_TARGET_NAME = "bliblablubb.org/";
|
||||
public static String SOAP_ADDRESS = "http://" + DESTINATION_ADDRESS + "/BeWoPlanerAndroid/AndroidSoapService.asmx";
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package util;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import com.google.gson.JsonDeserializationContext;
|
||||
import com.google.gson.JsonDeserializer;
|
||||
import com.google.gson.JsonElement;
|
||||
@@ -45,6 +47,8 @@ public class ChatMessageDeserializer implements JsonDeserializer<ChatMessage> {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return new ChatMessage(senderPersonOid, recipientPersonOid, insTs, chatText, isDelivered, serverseitigeOid, isTeam);
|
||||
ChatMessage result = new ChatMessage(senderPersonOid, recipientPersonOid, insTs, chatText, isDelivered, serverseitigeOid, isTeam);
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,20 @@
|
||||
package util;
|
||||
|
||||
import android.app.Notification;
|
||||
import android.app.NotificationManager;
|
||||
import android.app.PendingIntent;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.NotificationCompat;
|
||||
import android.util.Log;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import beyondsoft.bewomitarbeiterapp.ChatActivity;
|
||||
import beyondsoft.bewomitarbeiterapp.R;
|
||||
|
||||
/**
|
||||
* Created by JettenM on 05.07.2016.
|
||||
*/
|
||||
@@ -13,6 +28,39 @@ public class Util {
|
||||
public static final String PREFS_USERNAME_KEY = "username";
|
||||
public static final String PREFS_PASSWORD = "password";
|
||||
|
||||
public static final String DEVICE_ID_FILE_NAME = "bewodeviceidfile";
|
||||
public static final String DEVICE_ID = "";
|
||||
|
||||
public static void SetNotify(String username, String message, int recipientOid, boolean isTeam, String teamMemberOids, String teamMemberNames, Context packageContext){
|
||||
NotificationCompat.Builder mBuilder =
|
||||
new NotificationCompat.Builder(packageContext)
|
||||
.setSmallIcon(R.drawable.ic_stat_name)
|
||||
.setContentTitle(username)
|
||||
.setContentText(message)
|
||||
.setAutoCancel(true)
|
||||
.setDefaults(Notification.DEFAULT_SOUND)
|
||||
.setVibrate(new long[] { 1000, 1000, 1000, 1000, 1000 }) //Notification.Default_Vibrate
|
||||
.setLights(Color.YELLOW, 3000, 3000) //Notification.Default_Lights
|
||||
.setOngoing(true);
|
||||
|
||||
Log.i("CHAT_SET_NOTIFY", username + "; " + recipientOid + "; " + isTeam + "; " + teamMemberOids + "; " + teamMemberNames);
|
||||
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("Name", username);
|
||||
bundle.putInt("RecipientOid", recipientOid);
|
||||
bundle.putBoolean("IsTeam", isTeam);
|
||||
bundle.putString("TeamMemberOids", teamMemberOids);
|
||||
bundle.putString("TeamMemberNames", teamMemberNames);
|
||||
|
||||
Intent resultIntent = new Intent(packageContext, ChatActivity.class);
|
||||
resultIntent.putExtras(bundle);
|
||||
|
||||
resultIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
|
||||
|
||||
PendingIntent resultPendingIntent = PendingIntent.getActivity(packageContext.getApplicationContext(), (int) (Math.random() * 100), resultIntent, PendingIntent.FLAG_UPDATE_CURRENT);
|
||||
|
||||
NotificationManager mNotifyMgr = (NotificationManager) packageContext.getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
|
||||
mBuilder.setContentIntent(resultPendingIntent);
|
||||
|
||||
mNotifyMgr.notify((new Random()).nextInt(9999 - 1000) + 1000, mBuilder.build());
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 813 B |
Binary file not shown.
|
After Width: | Height: | Size: 821 B |
Binary file not shown.
|
After Width: | Height: | Size: 815 B |
@@ -5,7 +5,7 @@ buildscript {
|
||||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:2.1.2'
|
||||
classpath 'com.android.tools.build:gradle:2.1.3'
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
// in the individual module build.gradle files
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#Mon May 09 15:43:30 CEST 2016
|
||||
#Tue Aug 23 08:50:04 CEST 2016
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
|
||||
|
||||
Submodule Android/BewoMitarbeiterApp/volley updated: b1f507ab59...c7de21ae29
Reference in New Issue
Block a user