Android-App:

- Kontakt anrufen
    - Kleinere Bugs behoben
This commit is contained in:
staccatomamba
2016-12-05 17:08:51 +01:00
parent 026e16c063
commit af1e2ac131
38 changed files with 334 additions and 208 deletions

View File

@@ -1,6 +1,7 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="AndroidLintRtlHardcoded" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="LoggerInitializedWithForeignClass" enabled="false" level="WARNING" enabled_by_default="false">
<option name="loggerClassName" value="org.apache.log4j.Logger,org.slf4j.LoggerFactory,org.apache.commons.logging.LogFactory,java.util.logging.Logger" />
<option name="loggerFactoryMethodName" value="getLogger,getLogger,getLog,getLogger" />

View File

@@ -84,7 +84,6 @@
<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/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" />

View File

@@ -6,7 +6,7 @@ android {
dexOptions {
maxProcessCount 2
javaMaxHeapSize "2g"
javaMaxHeapSize "3g"
}
defaultConfig {
applicationId "beyondsoft.bewomitarbeiterapp"

View File

@@ -2,6 +2,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="beyondsoft.bewomitarbeiterapp">
<uses-permission android:name="android.permission.CALL_PHONE"/>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

View File

@@ -46,7 +46,7 @@ public class DatabaseHandler extends SQLiteOpenHelper {
private static final String LOGTAG = "DATABASE_HANDLER";
//DataBase version
private static final int DATABASE_VERSION = 12;
private static final int DATABASE_VERSION = 13;
//Database name
private static final String DATABASE_NAME = "Contacts_Manager";
@@ -70,6 +70,7 @@ public class DatabaseHandler extends SQLiteOpenHelper {
private static final String KEY_TEAM_MEMBER_NAMES = "teammembernames";
private static final String KEY_VERSION = "version";
private static final String KEY_IS_EMPLOYEE = "isemployee";
private static final String KEY_PHONENUMBER = "phonenumber";
private static final String[] CONTACTS_COLUMNS = new String[] {
KEY_ID,
@@ -79,7 +80,8 @@ public class DatabaseHandler extends SQLiteOpenHelper {
KEY_TEAM_MEMBER_OIDS,
KEY_TEAM_MEMBER_NAMES,
KEY_VERSION,
KEY_IS_EMPLOYEE
KEY_IS_EMPLOYEE,
KEY_PHONENUMBER
};
// ChatMessage-Tabelle
@@ -162,7 +164,8 @@ public class DatabaseHandler extends SQLiteOpenHelper {
KEY_TEAM_MEMBER_NAMES + " TEXT, " +
KEY_TEAM_MEMBER_OIDS + " TEXT, " +
KEY_VERSION + " INTEGER, " +
KEY_IS_EMPLOYEE + " INTEGER)";
KEY_IS_EMPLOYEE + " INTEGER, " +
KEY_PHONENUMBER + " TEXT)";
db.execSQL(CREATE_CONTACTS_TABLE);
@@ -360,6 +363,7 @@ public class DatabaseHandler extends SQLiteOpenHelper {
values.put(KEY_TEAM_MEMBER_OIDS, contact.teamMemberOids);
values.put(KEY_VERSION, contact.getVersion());
values.put(KEY_IS_EMPLOYEE, contact.getIsEmployee());
values.put(KEY_PHONENUMBER, contact.getPhoneNumber());
writableDatabase.insertOrThrow(TABLE_CONTACTS, null, values);
}
@@ -505,8 +509,9 @@ public class DatabaseHandler extends SQLiteOpenHelper {
String teamMemberNames = cursor.getString(5);
int contactVersion = cursor.getInt(6);
boolean isEmployee = cursor.getInt(7) == 1;
String phoneNumber = cursor.getString(8);
ContactListItem contact = new ContactListItem(contactId, contactName, contactPersonOid, contactIsTeam, teamMemberOids, teamMemberNames, contactVersion, isEmployee);
ContactListItem contact = new ContactListItem(contactId, contactName, contactPersonOid, contactIsTeam, teamMemberOids, teamMemberNames, contactVersion, isEmployee, phoneNumber);
cursor.close();
@@ -535,6 +540,7 @@ public class DatabaseHandler extends SQLiteOpenHelper {
contact.teamMemberOids = cursor.getString(5);
contact.setVersion(cursor.getInt(6));
contact.setIsEmployee(cursor.getInt(7) == 1);
contact.setPhoneNumber(cursor.getString(8));
contactList.add(contact);
} while (cursor.moveToNext());
@@ -593,6 +599,7 @@ public class DatabaseHandler extends SQLiteOpenHelper {
values.put(KEY_TEAM_MEMBER_OIDS, contact.teamMemberOids);
values.put(KEY_VERSION, contact.getVersion());
values.put(KEY_IS_EMPLOYEE, contact.getIsEmployee());
values.put(KEY_PHONENUMBER, contact.getPhoneNumber());
return writableDatabase.update(TABLE_CONTACTS, values, KEY_ID + " = ?", new String[] { String.valueOf(contact.getId()) });
}
@@ -637,8 +644,9 @@ public class DatabaseHandler extends SQLiteOpenHelper {
String teamMemberNames = cursor.getString(5);
int contactVersion = cursor.getInt(6);
boolean isEmployee = cursor.getInt(7) == 1;
String phoneNumber = cursor.getString(8);
ContactListItem contact = new ContactListItem(contactId, contactName, contactPersonOid, contactIsTeam, teamMemberOids, teamMemberNames, contactVersion, isEmployee);
ContactListItem contact = new ContactListItem(contactId, contactName, contactPersonOid, contactIsTeam, teamMemberOids, teamMemberNames, contactVersion, isEmployee, phoneNumber);
cursor.close();

View File

@@ -18,11 +18,9 @@ import org.ksoap2.serialization.PropertyInfo;
import org.ksoap2.serialization.SoapPrimitive;
import java.lang.reflect.Type;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.Locale;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture;
@@ -71,7 +69,7 @@ public class BeWoChatApplication extends Application {
public static Date lastOnlineTS;
private static int refreshIntervalInMinutes = 6;
private static int refreshIntervalInMinutes = 2;
public static int getRefreshIntervalInMilliseconds() {
return refreshIntervalInMinutes * 60 * 1000;
}
@@ -96,7 +94,7 @@ public class BeWoChatApplication extends Application {
spiceManager.start(this);
keepAlive();
keepAliveSOAP();
keepAliveTCP();
}
@@ -104,6 +102,8 @@ public class BeWoChatApplication extends Application {
final Runnable blubb = new Runnable() {
@Override
public void run() {
BeWoLog.writeToLogFile("Führe ScheduledFuture von keepAliveTCP aus...");
Log.e("KEEP_ALIVE_TCP", "Führe keepAliveTCP aus");
if(ConnectivityReceiver.isConnected()) {
Packet packet = new Packet();
packet.ChatDataIdentifier = DataIdentifier.KEEP_ALIVE;
@@ -113,6 +113,9 @@ public class BeWoChatApplication extends Application {
packet.MessageTimeStamp = Calendar.getInstance().getTime();
SocketManager.sendMessage(packet);
} else {
BeWoLog.writeToLogFile("Bin offline (keepAliveTCP)");
Log.e("KEEP_ALIVE_TCP", "Bin offline (keepAliveTCP)");
}
}
};
@@ -127,20 +130,26 @@ public class BeWoChatApplication extends Application {
}, 10, TimeUnit.DAYS);
}
public void keepAlive() {
public void keepAliveSOAP() {
final Runnable blubb = new Runnable() {
@Override
public void run() {
BeWoLog.writeToLogFile("Führe ScheduledFuture von keepAliveSOAP des SOAP-Services aus...");
Log.e("KEEP_ALIVE_SOAP", "Führe keepAliveSOAP aus");
JsonSoapPrimitiveRequest request = new JsonSoapPrimitiveRequest(SoapCalls.KEEP_ALIVE, new ArrayList<PropertyInfo>());
if(ConnectivityReceiver.isConnected()) {
Log.e("KEEP_ALIVE_SOAP", "Ist mit dem Internet verbunden.");
if((Calendar.getInstance().getTime().getTime() - BeWoChatApplication.lastOnlineTS.getTime()) < getRefreshIntervalInMilliseconds()) {
BeWoLog.writeToLogFile("Schicke KeepAlive zum SOAP-Server. (SOAP-KeepAlive)");
Log.e("KEEP_ALIVE_SOAP", "Sende Keep-Alive zum SOAP-Server.");
BeWoLog.writeToLogFile("Schicke Keep-Alive zum SOAP-Server. (SOAP-KeepAlive)");
spiceManager.execute(request, new JsonSoapPrimitiveRequestListener());
} else {
Log.e("KEEP_ALIVE_SOAP", "Das Intervall von " + BeWoChatApplication.getRefreshIntervalInMinutes() + " Minuten wurde überschritten. Sende kein KeepAlive an den SOAP-Server. (SOAP-KeepAlive)");
BeWoLog.writeToLogFile("Das Intervall von " + BeWoChatApplication.getRefreshIntervalInMinutes() + " Minuten wurde überschritten. Sende kein KeepAlive an den SOAP-Server. (SOAP-KeepAlive)");
}
} else {
Log.e("KEEP_ALIVE_SOAP", "Keine Internetkonnektivität vorhanden. Sende kein Keep-Alive an den SOAP-Server.");
BeWoLog.writeToLogFile("Bin offline. Sende kein KeepAlive an den SOAP-Server. (SOAP-KeepAlive)");
}
}
@@ -190,20 +199,20 @@ public class BeWoChatApplication extends Application {
@Override
public void onRequestFailure(SpiceException spiceException) {
Log.e("BEWOAPP", "Fehler beim am Leben erhalten!");
Log.e("KEEP_ALIVE_SOAP", "Fehler beim SOAP-Keep-Alive.");
BeWoLog.writeToLogFile("Das JSON-Keep-Alives ist fehlgeschlagen (JsonSoapPrimitiveRequestListener->onRequestFailure)");
BeWoLog.writeToLogFile("Das SOAP-Keep-Alives ist fehlgeschlagen (JsonSoapPrimitiveRequestListener->onRequestFailure)");
}
@Override
public void onRequestSuccess(SoapPrimitive soapPrimitive) {
if(soapPrimitive == null) {
Log.e("BEWOAPP", "Antwort ist null!");
BeWoLog.writeToLogFile("Das JSON-Keep-Alives lieferte Null zurück. (JsonSoapPrimitiveRequestListener->onRequestSuccess)");
Log.e("KEEP_ALIVE_SOAP", "Antwort ist null!");
BeWoLog.writeToLogFile("Das SOAP-Keep-Alives lieferte Null zurück. (JsonSoapPrimitiveRequestListener->onRequestSuccess)");
} else {
BeWoChatApplication.lastOnlineTS = Calendar.getInstance().getTime();
BeWoLog.writeToLogFile("Erneuere die Verbindung. (JsonSoapPrimitiveRequestListener->onRequestSuccess)");
Log.i("BEWOAPP", "Die Antwort des JSON-Keep-Alives hat einen Wert");
Log.e("KEEP_ALIVE_SOAP", "Die Antwort des SOAP-Keep-Alives hat einen Wert");
}
}
}

View File

@@ -1,5 +1,6 @@
package beyondsoft.bewomitarbeiterapp;
import android.app.AlertDialog;
import android.app.NotificationManager;
import android.content.Context;
import android.content.Intent;
@@ -13,6 +14,7 @@ import android.graphics.PorterDuff;
import android.graphics.PorterDuffXfermode;
import android.graphics.Rect;
import android.graphics.RectF;
import android.net.Uri;
import android.os.Bundle;
import android.support.v7.app.ActionBar;
import android.support.v7.app.ActionBarActivity;
@@ -22,6 +24,7 @@ import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.Window;
import android.widget.AbsListView;
import android.widget.ArrayAdapter;
import android.widget.Button;
@@ -43,8 +46,8 @@ import org.ksoap2.serialization.PropertyInfo;
import org.ksoap2.serialization.SoapPrimitive;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.lang.reflect.Type;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Comparator;
@@ -52,6 +55,7 @@ import java.util.Date;
import java.util.List;
import java.util.Locale;
import java.util.UUID;
import java.util.regex.Pattern;
import Database.DatabaseHandler;
import entities.ChatEntity;
@@ -115,6 +119,8 @@ public class ChatActivity extends ActionBarActivity implements ConnectivityRecei
setContentView(R.layout.chat);
ActionBar action = getSupportActionBar();
action.setDisplayShowHomeEnabled(false);
@@ -126,6 +132,8 @@ public class ChatActivity extends ActionBarActivity implements ConnectivityRecei
action.setCustomView(mCustomView);
action.setDisplayShowCustomEnabled(true);
databaseHandler = DatabaseHandler.getInstance(this);
senden = (Button)findViewById(R.id.Sendebutton);
@@ -184,6 +192,11 @@ public class ChatActivity extends ActionBarActivity implements ConnectivityRecei
teamMemberNames = zielkorb.getString("TeamMemberNames");
isEmployee = zielkorb.getBoolean("IsEmployee");
ImageView phoneCallSymbol = (ImageView) mCustomView.findViewById(R.id.phoneCallImageView);
if(isTeam) {
phoneCallSymbol.setVisibility(View.GONE);
}
Log.i("EXTRAS_KONTROLLE", "Empfänger: " + recipientName + "; " + recipientPersonOid);
ReloadChatView(recipientName, recipientPersonOid, image, isTeam, teamMemberOids, teamMemberNames, isEmployee);
@@ -195,7 +208,6 @@ public class ChatActivity extends ActionBarActivity implements ConnectivityRecei
recipientPersonOid = recipientOid;
recipientName = contactName;
isTeam = pIsTeam;
Log.i("CHAT", "IsTeam: " + isTeam);
teamMemberOids = pTeamMemberOids;
teamMemberNames = pTeamMemberNames;
isEmployee = pIsEmployee;
@@ -204,6 +216,30 @@ public class ChatActivity extends ActionBarActivity implements ConnectivityRecei
TextView titlename = (TextView) mCustomView.findViewById(R.id.PersonalName);
RoundImageView titlepic = (RoundImageView) mCustomView.findViewById(R.id.PersonalPic);
boolean hasImage = databaseHandler.isImageExistingForPerson(recipientPersonOid);
if(hasImage && !isTeam) {
image = databaseHandler.getUserImage(recipientPersonOid);
Bitmap img = BitmapFactory.decodeByteArray(image, 0, image.length);
titlepic.setImageBitmap(img);
} else {
int bildId = R.drawable.mitarbeiter_avatar;
if(isTeam) {
bildId = R.drawable.mitarbeiter_team_avatar;
} else if(!isEmployee) {
bildId = R.drawable.klient_avatar;
}
Bitmap bitmap = KontaktAdapter.decodeSampledBitmapFromResource(this.getResources(), bildId, 100, 100);
titlepic.setImageBitmap(bitmap);
ByteArrayOutputStream stream = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, stream);
image = stream.toByteArray();
}
if(!isTeam) {
status.setImageResource((SocketManager.onlinePersonOids.contains(recipientPersonOid) ? R.drawable.statusonline : R.drawable.statusoffline));
}
@@ -220,7 +256,7 @@ public class ChatActivity extends ActionBarActivity implements ConnectivityRecei
chatMessages = isTeam ? databaseHandler.getMessagesForTeam(recipientPersonOid) : databaseHandler.getMessagesForRecipient(recipientPersonOid);
for(ChatMessage cm : chatMessages) {
Log.i("NACHRICHTEN", "" + cm.ChatText + "; MessageId: " + cm.MessageId);
Log.i("NACHRICHTEN", "Nachricht aus der Handy-DB: " + cm.ChatText + "; MessageId: " + cm.MessageId);
}
adapter = new MessageAdapter(this, R.layout.item_chat_left, chatMessages);
@@ -405,8 +441,6 @@ public class ChatActivity extends ActionBarActivity implements ConnectivityRecei
SocketManager.loginCallbackAfterConnectionLost = new Callback() {
@Override
public void doCallback() {
//ReloadChatView(contactName, recipientOid, contactImage, isTeam, teamMemberOids, teamMemberNames, isEmployee);
runOnUiThread(new Runnable() {
@Override
public void run() {
@@ -414,7 +448,6 @@ public class ChatActivity extends ActionBarActivity implements ConnectivityRecei
adapter.notifyDataSetChanged();
}
});
}
};
@@ -425,6 +458,7 @@ public class ChatActivity extends ActionBarActivity implements ConnectivityRecei
// TODO: nur zur Konversation gehörende MessageIds laden
ArrayList<String> test = isTeam ? databaseHandler.getExistingTeamChatMessageUUIDs(recipientPersonOid, SoapConnectionManager.getUser().getPersonOid().intValue()) : databaseHandler.getExistingChatMessageUUIDs(recipientPersonOid, SoapConnectionManager.getUser().getPersonOid().intValue());
Log.i("EXISTING_MESSAGEIDS", "MessageIds der Nachrichten aus der Handy-DB");
String pExceptions = "";
for(int i = 0; i < test.size(); i++) {
Log.i("EXISTING_MESSAGEIDS", test.get(i));
@@ -453,6 +487,7 @@ public class ChatActivity extends ActionBarActivity implements ConnectivityRecei
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));
propertyInfos2.add(SoapConnectionManager.BuildProperty("pIsInitialCall", isInitialCall, Boolean.class));
final JsonSoapPrimitiveRequest request = new JsonSoapPrimitiveRequest(SoapCalls.LOAD_CHATMESSAGES_CHUNKWISE, propertyInfos2);
@@ -542,9 +577,8 @@ public class ChatActivity extends ActionBarActivity implements ConnectivityRecei
return true;
case R.id.action_doku:
Intent dokuActivity = new Intent(ChatActivity.this, WebdokuActivity.class);
ChatActivity.this.startActivity(dokuActivity);
Intent brauser = new Intent(Intent.ACTION_VIEW, Uri.parse(SoapCalls.WEB_DOKU_URL + SoapConnectionManager.getUser().getTenant()));
startActivity(brauser);
return true;
default:
@@ -602,6 +636,46 @@ public class ChatActivity extends ActionBarActivity implements ConnectivityRecei
return output;
}
public void showBigImage(View view) {
Log.i("SHOW_IMAGE_ALERT", "Klick auf Avatar im Chat");
AlertDialog.Builder builder = new AlertDialog.Builder(this);
final AlertDialog dialog = builder.create();
LayoutInflater inflater = getLayoutInflater();
View dialogLayout = inflater.inflate(R.layout.image_alert, null);
Bitmap bitmap = BitmapFactory.decodeByteArray(image, 0, image.length);
ImageView image = (ImageView) dialogLayout.findViewById(R.id.fullimage);
image.setImageBitmap(bitmap);
dialog.setView(dialogLayout);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.show();
}
public void makePhoneCall(View view) {
ContactListItem cli = databaseHandler.getContactByPersonOid(recipientPersonOid, false);
String phoneNumber = cli.getPhoneNumber();
String pattern = "^([0-9\\+/\\(\\)\\s\\-]*)";
if(phoneNumber != null && phoneNumber.length() > 0 && Pattern.matches(pattern, phoneNumber)) {
try {
Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + cli.getPhoneNumber()));
ChatActivity.this.startActivity(intent);
} catch(Exception exception) {
Toast.makeText(ChatActivity.this, "Die Mobilnummer ist ungültig", Toast.LENGTH_LONG).show();
}
} else {
Util.buildAlert(ChatActivity.this, "Es wurde keine Mobilnummer für " + recipientName + " hinterlegt oder sie ist ungültig. Bitte tragen Sie diese im BeWoPlaner ein.");
}
}
private final class JsonSoapPrimitiveRequestListener implements RequestListener<SoapPrimitive> {
Callback corruptedRequestCallback;
@@ -693,15 +767,6 @@ 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();
}
});

View File

@@ -19,10 +19,11 @@ public class ContactListItem {
private String messagePreview;
private boolean isNewMessage2Preview;
private String phoneNumber;
public ContactListItem(){}
public ContactListItem(int id, String kontaktname, int personOid, boolean isTeam, String teamMemberOids, String teamMemberNames, int version, boolean isEmployee){
public ContactListItem(int id, String kontaktname, int personOid, boolean isTeam, String teamMemberOids, String teamMemberNames, int version, boolean isEmployee, String phoneNumber){
this.mId = id;
this.mChatName = kontaktname;
this.mPersonOid = personOid;
@@ -31,9 +32,10 @@ public class ContactListItem {
this.teamMemberOids = teamMemberOids;
this.mVersion = version;
this.mIsEmployee = isEmployee;
this.phoneNumber = phoneNumber;
}
ContactListItem(String kontaktname, int personOid, boolean isTeam, String teamMemberOids, String teamMemberNames, int version, boolean isEmployee){
ContactListItem(String kontaktname, int personOid, boolean isTeam, String teamMemberOids, String teamMemberNames, int version, boolean isEmployee, String phoneNumber){
this.mChatName = kontaktname;
this.mPersonOid = personOid;
@@ -42,6 +44,7 @@ public class ContactListItem {
this.teamMemberOids = teamMemberOids;
this.mVersion = version;
this.mIsEmployee = isEmployee;
this.phoneNumber = phoneNumber;
}
public int getId(){
@@ -127,4 +130,12 @@ public class ContactListItem {
public Boolean compareToChatPerson(ChatPerson chatPerson) {
return mPersonOid == chatPerson.Oid && isTeam == chatPerson.IsTeam && mIsEmployee == chatPerson.IsEmployee;
}
public void setPhoneNumber(String phoneNumber) {
this.phoneNumber = phoneNumber;
}
public String getPhoneNumber() {
return phoneNumber;
}
}

View File

@@ -60,8 +60,6 @@ public class KontaktAdapter extends ArrayAdapter<ContactListItem> {
messagePreview.setText(currentContact.getMessagePreview());
messagePreview.setTypeface(messagePreview.getTypeface(), currentContact.getIsNewMessage2Preview() ? 1 : 0);
if(currentContact.isTeam) {
minitext.setText(currentContact.teamMemberNames);
}
@@ -92,10 +90,6 @@ public class KontaktAdapter extends ArrayAdapter<ContactListItem> {
} else {
imageView.setImageBitmap(i);
}
// getPic = new Thread(new CircleBitmapCreator(i));
// getPic.start();
} else {
Log.i("KONTAKT_ADAPTER", "");
@@ -124,42 +118,7 @@ public class KontaktAdapter extends ArrayAdapter<ContactListItem> {
return rowView;
}
private class CircleBitmapCreator implements Runnable{
Bitmap bitmap;
CircleBitmapCreator(Bitmap _bitmap){
this.bitmap = _bitmap;
}
public void run(){
final Bitmap output = Bitmap.createBitmap(bitmap.getWidth(), bitmap.getHeight(), Bitmap.Config.ARGB_8888);
final Canvas canvas = new Canvas(output);
final int color = Color.RED;
final Paint paint = new Paint();
final Rect rect = new Rect(0, 0, bitmap.getWidth(), bitmap.getHeight());
final RectF rectF = new RectF(rect);
paint.setAntiAlias(true);
canvas.drawARGB(0, 0, 0, 0);
paint.setColor(color);
canvas.drawOval(rectF, paint);
paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN));
canvas.drawBitmap(bitmap, rect, rect, paint);
bitmap.recycle();
imageView.post(new Runnable() {
@Override
public void run() {
imageView.setImageBitmap(output);
}
});
}
}
private static Bitmap decodeSampledBitmapFromResource(Resources res, int resId, int reqWidth, int reqHeight) {
public static Bitmap decodeSampledBitmapFromResource(Resources res, int resId, int reqWidth, int reqHeight) {
final BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true;
BitmapFactory.decodeResource(res, resId, options);

View File

@@ -4,6 +4,7 @@ import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.app.ActionBarActivity;
@@ -65,7 +66,6 @@ import util.Util;
*/
public class KontaktChatActivity extends ActionBarActivity implements ConnectivityReceiver.ConnectivityReceiverListener, SwipeRefreshLayout.OnRefreshListener {
private static boolean isDownloadOfContacsInProgress = false;
private static boolean isDownloadOfNewestMessagesInProgress = false;
private static final String LOGTAG = "KONTAKT_CHAT_ACTIVITY";
private SpiceManager spiceManager = new SpiceManager(UncachedSpiceService.class);
@@ -117,24 +117,9 @@ public class KontaktChatActivity extends ActionBarActivity implements Connectivi
bundle.putString("TeamMemberNames", selectedValue.teamMemberNames);
bundle.putBoolean("IsEmployee", selectedValue.getIsEmployee());
if(!selectedValue.isTeam && databaseHandler.isImageExistingForPerson(selectedValue.getPersonOid())) {
bundle.putByteArray("Image", databaseHandler.getUserImage(selectedValue.getPersonOid()));
}
Intent in = new Intent(getBaseContext(), ChatActivity.class);
in.putExtras(bundle);
// TODO: durch Datebankaufruf ersetzen
// if(selectedValue.getPicture() == null) {
// ByteArrayOutputStream stream = new ByteArrayOutputStream();
// Bitmap a = BitmapFactory.decodeResource(getResources(), R.drawable.mitarbeiter_avatar);
// a.compress(Bitmap.CompressFormat.JPEG,0,stream);
// byte[] x = stream.toByteArray();
// in.putExtra("Bild", x);
// } else {
// in.putExtra("Bild", selectedValue.getPicture());
// }
startActivity(in);
}
});
@@ -459,8 +444,8 @@ public class KontaktChatActivity extends ActionBarActivity implements Connectivi
switch (item.getItemId()) {
case R.id.action_kontaktlist_doku:
Intent dokuActivity = new Intent(KontaktChatActivity.this, WebdokuActivity.class);
KontaktChatActivity.this.startActivity(dokuActivity);
Intent brauser = new Intent(Intent.ACTION_VIEW, Uri.parse(SoapCalls.WEB_DOKU_URL + SoapConnectionManager.getUser().getTenant()));
startActivity(brauser);
return true;
case R.id.action_kontaktlist_logout:
@@ -734,7 +719,7 @@ public class KontaktChatActivity extends ActionBarActivity implements Connectivi
}
for(ChatPerson cp : result) {
ContactListItem contact = new ContactListItem(cp.Name, cp.Oid, cp.IsTeam, cp.TeamMemberOids, cp.TeamMemberNames, cp.Version, cp.IsEmployee);
ContactListItem contact = new ContactListItem(cp.Name, cp.Oid, cp.IsTeam, cp.TeamMemberOids, cp.TeamMemberNames, cp.Version, cp.IsEmployee, cp.PhoneNumber);
ChatEntity cliEntity = new ChatEntity(cp.Oid, cp.IsTeam, cp.IsEmployee);

View File

@@ -42,8 +42,12 @@ import java.io.IOException;
import java.security.InvalidAlgorithmParameterException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.Locale;
import javax.crypto.NoSuchPaddingException;
@@ -251,42 +255,50 @@ public class LoginActivity extends ActionBarActivity {
else {
showProgress(true);
RequestQueue queue = Volley.newRequestQueue(LoginActivity.this);
String url = SoapCalls.VOUCHER_ADDRESS + token;
if(SoapCalls.isInDevelopingMode) {
ArrayList<PropertyInfo> propertyInfos = new ArrayList<>();
propertyInfos.add(SoapConnectionManager.BuildProperty("pTenant", tenant, String.class));
propertyInfos.add(SoapConnectionManager.BuildProperty("pUsername", username, String.class));
propertyInfos.add(SoapConnectionManager.BuildProperty("pPassword", password, String.class));
// 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();
//
// mChatCodeView.setError(getString(R.string.error_invalid_input));
//
// return;
// }
//
// Util.buildAlert(LoginActivity.this, response);
JsonSoapPrimitiveRequest request = new JsonSoapPrimitiveRequest(SoapCalls.LOGIN_CALL, propertyInfos);
spiceManager.execute(request, new JsonSoapPrimitiveRequestListener());
} else {
RequestQueue queue = Volley.newRequestQueue(LoginActivity.this);
String url = SoapCalls.VOUCHER_ADDRESS + token;
ArrayList<PropertyInfo> propertyInfos = new ArrayList<>();
propertyInfos.add(SoapConnectionManager.BuildProperty("pTenant", tenant, String.class));
propertyInfos.add(SoapConnectionManager.BuildProperty("pUsername", username, String.class));
propertyInfos.add(SoapConnectionManager.BuildProperty("pPassword", password, String.class));
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);
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()));
// }
// });
//
// queue.add(stringRequest);
clearSharedPreferences();
mChatCodeView.setError(getString(R.string.error_invalid_input));
return;
}
ArrayList<PropertyInfo> propertyInfos = new ArrayList<>();
propertyInfos.add(SoapConnectionManager.BuildProperty("pTenant", tenant, String.class));
propertyInfos.add(SoapConnectionManager.BuildProperty("pUsername", username, String.class));
propertyInfos.add(SoapConnectionManager.BuildProperty("pPassword", password, String.class));
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()));
}
});
queue.add(stringRequest);
}
}
}
@@ -344,6 +356,13 @@ public class LoginActivity extends ActionBarActivity {
Log.i("LOGIN", abc);
if(abc.contains(";")) {
Date currentDate = Calendar.getInstance().getTime();
DateFormat dateFormat = new SimpleDateFormat("yyyy_MM_dd_HH_mm_ss_SSS", Locale.GERMAN);
String dateString = dateFormat.format(currentDate);
BeWoLog.LOGFILENAME = "BeWoLog" + dateString + ".txt";
BeWoLog.writeToLogFile("Der User ist angemeldet (LoginActivity->JsonSoapPrimitiveRequestListener->onRequestSuccess)");
String[] blubb = abc.split(";");
@@ -404,6 +423,8 @@ public class LoginActivity extends ActionBarActivity {
public void doCallback() {
Log.e("LOGIN_CALLBACK", "LoginCallback aufgerufen. Ist verbunden und ruft die ChatActivity nun auf.");
BeWoLog.writeToLogFile("Rufe die KontaktChatActivity auf (LoginActivity->JsonSoapPrimitiveRequestListener->onRequestSuccess)");
runOnUiThread(new Runnable() {

View File

@@ -11,14 +11,16 @@ public class ChatPerson {
public String TeamMemberOids;
public int Version;
public boolean IsEmployee;
public String PhoneNumber;
public ChatPerson(int oid, String name, boolean isTeam, String teamMemberNames, String teamMemberOids, int version, boolean isEmployee) {
Oid = oid;
Name = name;
IsTeam = isTeam;
public ChatPerson(int oid, String name, boolean isTeam, String teamMemberNames, String teamMemberOids, int version, boolean isEmployee, String phoneNumber) {
Oid = oid;
Name = name;
IsTeam = isTeam;
TeamMemberNames = teamMemberNames;
TeamMemberOids = teamMemberOids;
Version = version;
IsEmployee = isEmployee;
TeamMemberOids = teamMemberOids;
Version = version;
IsEmployee = isEmployee;
PhoneNumber = phoneNumber;
}
}

View File

@@ -19,24 +19,24 @@ public class SoapCalls {
public static String LOAD_USER_IMAGES = "LoadUserImages";
//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 WEB_DOKU_URL = "https://app1.bewoplaner.de/mobil/login/1234567890";
public static String WEB_DOKU_URL = "https://" + DESTINATION_ADDRESS + "/mobil/login/";
public static String WEB_DOKU_URL = "http://" + DESTINATION_ADDRESS + "/bewoplanermobil/login/demo";
public static String WSDL_TARGET_NAME = "bliblablubb.org/";
public static String SOAP_ADDRESS = "https://" + DESTINATION_ADDRESS + "/BeWoPlanerAndroid/AndroidSoapService.asmx";
static String WSDL_TARGET_NAME = "bliblablubb.org/";
static String SOAP_ADDRESS = "http://" + DESTINATION_ADDRESS + "/BeWoPlanerAndroid/AndroidSoapService.asmx";
public static boolean isInDevelopingMode = false;
// public static String DESTINATION_ADDRESS = "192.168.1.103";
// public static int DESTINATION_PORT = 5000;
//
// 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";
}

View File

@@ -251,7 +251,7 @@ public class SocketManager {
e.printStackTrace();
}
} else {
SocketManager.connectToServer("MessageSender. Socket und/oder OutputStream sind null");
SocketManager.connectToServer("MessageSender. Socket und/oder OutputStream sind null.");
}
} else {
BeWoLog.writeToLogFile("Letzer Serverkontakt ist länger als " + BeWoChatApplication.getRefreshIntervalInMilliseconds() + " Minuten. (MessageSender)");
@@ -269,8 +269,6 @@ public class SocketManager {
private static class SocketListener implements Runnable {
Packet chatPacket;
private volatile boolean isRunning = true;
@Override
@@ -328,7 +326,7 @@ public class SocketManager {
switch (chatPacket.ChatDataIdentifier) {
case KEEP_ALIVE:
Log.e("KEEP_ALIVE_TCP", "TCP-Keep-Alive-Antwort erhalten.");
BeWoLog.writeToLogFile("KeepAlive-Antwort erhalten. (SocketManger)");
break;

View File

@@ -18,6 +18,8 @@ import java.util.Locale;
*/
public class BeWoLog {
public static String LOGFILENAME = "BeWoLog.txt";
public static void writeToLogFile(String data) {
if(!Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState())) {
Log.e("BEWOLOG", "Kein externes Speichermedium vorhanden.");
@@ -34,7 +36,7 @@ public class BeWoLog {
File dir = new File(root.getAbsolutePath() + "/" + Util.LOGFILEDIRECTORYNAME);
dir.mkdirs();
File file = new File(dir, Util.LOGFILENAME);
File file = new File(dir, LOGFILENAME);
try {
FileOutputStream fileOutputStream = new FileOutputStream(file, true);
PrintWriter printWriter = new PrintWriter(fileOutputStream);
@@ -56,7 +58,7 @@ public class BeWoLog {
}
File root = android.os.Environment.getExternalStorageDirectory();
File logFile = new File(root.getAbsolutePath() + "/" + Util.LOGFILEDIRECTORYNAME + "/" + Util.LOGFILENAME);
File logFile = new File(root.getAbsolutePath() + "/" + Util.LOGFILEDIRECTORYNAME + "/" + LOGFILENAME);
return logFile.delete();
}

View File

@@ -24,13 +24,16 @@ public class ChatPersonDeserializer implements JsonDeserializer<ChatPerson> {
boolean isTeam = json.get("IsTeam").getAsBoolean();
boolean isTeamMemberNamesNull = json.get("TeamMemberNames").isJsonNull();
boolean isTeamMemberOidsNull = json.get("TeamMemberOids").isJsonNull();
boolean isTeamMemberOidsNull = json.get("TeamMemberOids").isJsonNull();
String teamMemberNames = isTeamMemberNamesNull ? null : json.get("TeamMemberNames").getAsString(); // könnte NULL sein
String teamMemberOids = isTeamMemberOidsNull ? null : json.get("TeamMemberOids").getAsString(); // könnte NULL sein
int version = Long.valueOf(json.get("Version").getAsLong()).intValue();
boolean isEmployee = json.get("IsEmployee").getAsBoolean();
return new ChatPerson(oid, name, isTeam, teamMemberNames, teamMemberOids, version, isEmployee);
boolean isPhoneNumberNull = json.get("PhoneNumber").isJsonNull();
String phoneNumber = isPhoneNumberNull ? null : json.get("PhoneNumber").getAsString();
return new ChatPerson(oid, name, isTeam, teamMemberNames, teamMemberOids, version, isEmployee, phoneNumber);
}
}

View File

@@ -46,7 +46,6 @@ public class Util {
static final String NOTIFICATION_CANCELLED = "notification_cancelled";
static String LOGFILENAME = "BeWoLog.txt";
static String LOGFILEDIRECTORYNAME = "BeWo";
static int conversationsCount = 0;

Binary file not shown.

After

Width:  |  Height:  |  Size: 276 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 276 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 276 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 202 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 202 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 202 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 340 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 340 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 340 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 491 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 491 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 491 B

View File

@@ -1,9 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="45dp"
>
android:layout_width="fill_parent"
android:background="@color/beyondsoft_orange"
android:layout_height="45dp">
<beyondsoft.bewomitarbeiterapp.RoundImageView
android:layout_width="30dp"
@@ -13,6 +12,7 @@
android:layout_centerVertical="true"
android:layout_marginStart="2dp"
android:scaleType="centerCrop"
android:onClick="showBigImage"
/>
@@ -26,16 +26,30 @@
/>
<ImageView
android:id="@+id/status"
android:layout_width="20dp"
android:src="@drawable/statusoffline"
android:layout_height="wrap_content"
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="horizontal"
android:layout_alignParentEnd="true"
android:layout_gravity="center_vertical" />
android:layout_gravity="center_vertical"
>
<ImageView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:src="@drawable/ic_call_white_18dp"
android:onClick="makePhoneCall"
android:id="@+id/phoneCallImageView"
android:layout_marginRight="20dp"
/>
<!-- Merke: Das Design muss noch angepasst werden, da der Text über dem Bild liegt. /
Vorläufig gelöst mit margin. Dies kann aber nicht die endgültige Lösung sein. -->
<ImageView
android:id="@+id/status"
android:layout_width="20dp"
android:src="@drawable/statusoffline"
android:layout_height="wrap_content"
/>
</LinearLayout>
</RelativeLayout>

View File

@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/layout_root"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="0dp">
<ImageView android:id="@+id/fullimage"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:adjustViewBounds="true">
</ImageView>
</LinearLayout>

View File

@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white">
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white">
<ImageView
@@ -12,9 +12,9 @@
android:layout_height="wrap_content"
android:src="@drawable/bwp_logo"
android:scaleType="fitCenter"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginTop="20dp"
android:layout_marginLeft="50dp"
android:layout_marginRight="50dp"
android:layout_marginTop="80dp"
android:layout_alignParentTop="true"
android:layout_alignParentStart="true"
android:contentDescription="@string/bwp_logo_description"/>

View File

@@ -11,7 +11,7 @@
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx10248m -XX:MaxPermSize=256m
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
org.gradle.jvmargs=-Xmx2048m
org.gradle.jvmargs=-Xmx3072m
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects