BeWoApp: neues Launcher-Icon und Notify-Icon

This commit is contained in:
staccatomamba
2016-07-25 14:48:35 +02:00
parent 2823f2840f
commit ddafedea6b
35 changed files with 89 additions and 103 deletions

View File

@@ -1,5 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="EntryPointsManager">
<entry_points version="2.0" />
</component>
<component name="NullableNotNullManager">
<option name="myDefaultNullable" value="android.support.annotation.Nullable" />
<option name="myDefaultNotNull" value="android.support.annotation.NonNull" />
@@ -34,7 +37,7 @@
<ConfirmationsSetting value="0" id="Add" />
<ConfirmationsSetting value="0" id="Remove" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_6" assert-keyword="true" jdk-15="true">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" assert-keyword="true" jdk-15="true" project-jdk-name="1.7" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">

View File

@@ -3,6 +3,8 @@
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/BewoMitarbeiterApp.iml" filepath="$PROJECT_DIR$/BewoMitarbeiterApp.iml" />
<module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" />
<module fileurl="file://$PROJECT_DIR$/volley/volley.iml" filepath="$PROJECT_DIR$/volley/volley.iml" />
</modules>
</component>
</project>

View File

@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/../.." vcs="Git" />
<mapping directory="$PROJECT_DIR$/volley" vcs="Git" />
</component>
</project>

View File

@@ -13,7 +13,7 @@
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.gradle" />
</content>
<orderEntry type="jdk" jdkName="1.7" jdkType="JavaSDK" />
<orderEntry type="jdk" jdkName="Android API 23 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View File

@@ -115,9 +115,9 @@
<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-cache-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" />
</component>

View File

@@ -2,7 +2,7 @@ apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion '23.0.2'
buildToolsVersion '23.0.3'
defaultConfig {
applicationId "beyondsoft.bewomitarbeiterapp"
@@ -20,13 +20,9 @@ android {
}
dependencies {
//compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
// compile files('libs/gson-2.6.2.jar')
// compile files('libs/ksoap2-android-assembly-3.6.0-jar-with-dependencies.jar')
compile 'com.octo.android.robospice:robospice:1.4.14'
compile project(':volley')
compile files('src/libs/gson-2.6.2.jar')
compile files('src/libs/ksoap2-android-assembly-3.6.0-jar-with-dependencies.jar')
// compile files('src/libs/robospice-1.4.14.jar')
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

View File

@@ -76,8 +76,6 @@ public class ChatActivity extends ActionBarActivity{
String saveCompleteMessage;
// BufferedReader inputReader = null;
//Design View
protected ListView listView;
protected boolean isMe = true;
@@ -85,19 +83,12 @@ public class ChatActivity extends ActionBarActivity{
public static ArrayAdapter<ChatMessageFormat> adapter;
public static ChatMessageFormat chatMessage;
Thread currentlisten;
//Save/ Load Variblen
File file;
File Unsendfile = null;
//Chat Name
protected String name;
protected int personOid;
//Für Notification
private static boolean isOnStop = false;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -147,9 +138,7 @@ public class ChatActivity extends ActionBarActivity{
try {
socket = MainActivityMitarbeiter.socket;
MainActivityMitarbeiter.Test();
Log.i("CHAT", "listen is still alive: " + MainActivityMitarbeiter.listen.isAlive());
MainActivityMitarbeiter.CloseMainActivitySocketListener();
socketOutputStream = new DataOutputStream(socket.getOutputStream());
@@ -162,23 +151,13 @@ public class ChatActivity extends ActionBarActivity{
ReadMessageToStorage();
//Öffnet eine Verbindung zum Server
//new Thread(new OpenConnection()).start();
text = (EditText)findViewById(R.id.editText);
//Sendet eine Nachricht an den Server/Clienten
senden.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//isMe = true;
if(text.getText().toString().equals("exit")) {
//eine möglich keit die connection zu schließen
// new Thread(new ConnectionClose()).start();
} else if(!text.getText().toString().equals("")) {
if(!text.getText().toString().isEmpty()) {
new Thread(new MessageSender()).start();
} else {
Toast.makeText(ChatActivity.this, "Sie müssen schon Text eingeben ", Toast.LENGTH_SHORT).show();
@@ -279,8 +258,6 @@ public class ChatActivity extends ActionBarActivity{
continue;
}
Log.i("", "");
StringBuilder total = new StringBuilder(stream.available());
int counter = 0;
@@ -295,6 +272,8 @@ public class ChatActivity extends ActionBarActivity{
chatPacket = new Packet(total.toString());
Log.i("CHAT_ACTIVITY", "Erhaltene Nachricht: " + chatPacket.ChatMessage);
listV.post(new Runnable() {
@Override
public void run() {
@@ -431,41 +410,28 @@ public class ChatActivity extends ActionBarActivity{
public void SetNotify(String Username, String message){
//Convertiert in Pic Resource in ein Bitmap
//BitmapFactory.decodeResource(getResources(), R.drawable.bslogo)
NotificationCompat.Builder mBuilder =
new NotificationCompat.Builder(this)
.setSmallIcon(R.drawable.bslogo)
.setContentTitle(Username)
.setContentText(message)
.setAutoCancel(true)
//ab hier neuland
.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);
//neuland ende
Intent resultIntent = new Intent(this, ChatActivity.class);
//versuch ab hier neuland
resultIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
//neuland ende
PendingIntent resultPendingIntent =
PendingIntent.getActivity(
this.getApplicationContext(),
0,
resultIntent,
PendingIntent.FLAG_UPDATE_CURRENT
);
NotificationManager mNotifyMgr =
(NotificationManager) getSystemService(NOTIFICATION_SERVICE);
PendingIntent resultPendingIntent = PendingIntent.getActivity(this.getApplicationContext(), 0, resultIntent, PendingIntent.FLAG_UPDATE_CURRENT);
NotificationManager mNotifyMgr = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
mBuilder.setContentIntent(resultPendingIntent);
mNotifyMgr.notify(001, mBuilder.build());
mNotifyMgr.notify(1, mBuilder.build());
}
public void onResume() {

View File

@@ -136,6 +136,11 @@ public class KontaktChatActivity extends ListActivity {
@Override
public void onRequestSuccess(SoapPrimitive soapPrimitive) {
if(soapPrimitive == null) {
Log.i("KONTAKT_CHAT_ACTIVITY", "soapPrimitive ist NULL!");
}
Gson gson = new GsonBuilder().create();
Type listType = new TypeToken<ArrayList<ChatPerson>>(){}.getType();

View File

@@ -26,6 +26,7 @@ import java.io.InputStream;
import java.net.Socket;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Random;
import java.util.Timer;
import java.util.TimerTask;
@@ -61,10 +62,6 @@ public class MainActivityMitarbeiter extends Activity {
public static Thread listen;
public static SocketListener socketListener;
//Für Notification
private static boolean isOnStop = false;
private static boolean ankommenderName = false;
int personOid;
@Override
@@ -129,8 +126,20 @@ public class MainActivityMitarbeiter extends Activity {
logoutbutton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
System.exit(0);
if(socket.isConnected()) {
try {
Packet p = new Packet();
p.ChatDataIdentifier = DataIdentifier.LOGOUT;
new Thread(new TestMessageSender(p.GetDataStream())).start();
} catch(Exception e) {
Log.e("SendAfterGetConnection", "Fehler beim Logout: " + e.getMessage());
}
}
finish();
System.exit(0);
}
});
}
@@ -180,7 +189,7 @@ public class MainActivityMitarbeiter extends Activity {
}
}
public static void Test() {
public static void CloseMainActivitySocketListener() {
if(listen.isAlive()) {
try {
socketListener.terminate();
@@ -193,6 +202,8 @@ public class MainActivityMitarbeiter extends Activity {
public class SocketListener implements Runnable {
Packet chatPacket;
private volatile boolean running = true;
public void terminate() {
@@ -226,7 +237,13 @@ public class MainActivityMitarbeiter extends Activity {
counter++;
}
Log.i("MESSAGE/MAIN", "Empfangene Nachricht: " + total.toString());
chatPacket = new Packet(total.toString());
if(chatPacket.ChatDataIdentifier.equals(DataIdentifier.MESSAGE)) {
SetNotify(chatPacket.ChatName, chatPacket.ChatMessage);
}
Log.i("MAIN_ACTIVITY", "Erhaltene Nachricht: " + chatPacket.ChatMessage);
}
}
}
@@ -273,7 +290,7 @@ public class MainActivityMitarbeiter extends Activity {
Log.v("Fehler"," Das erstellen/öffnen einer Datei ist Derzeit nicht möglich");
}
// WriteMessagesfromStorage("\n ich teste weiter mit "+name);
} //---> Zu sortieren der message zum Jeweiligen kontakt
} //---> Zum Sortieren der Message zum jeweiligen Kontakt
public void SendAfterGetConnection(){
@@ -368,14 +385,9 @@ public class MainActivityMitarbeiter extends Activity {
try {
if(socket != null && dataOutputStream != null) {
Log.d("TestMessageSender", "Sende Packet... (" + packetToSend.length + ")");
dataOutputStream.write(packetToSend);
dataOutputStream.flush();
}
else {
Log.d("TestMessageSender", "Socket und/oder Stream ist null");
}
} catch(Exception e) {
Log.e("TestMessageSender", "Fehler beim Senden der TestMessage " + e.getMessage());
}
@@ -429,51 +441,35 @@ public class MainActivityMitarbeiter extends Activity {
NotificationCompat.Builder mBuilder =
new NotificationCompat.Builder(this)
.setSmallIcon(R.drawable.bslogo)
.setSmallIcon(R.drawable.ic_stat_name)
.setContentTitle(Username)
.setContentText(message)
.setAutoCancel(true)
//ab hier neuland
.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);
//neuland ende
Intent resultIntent = new Intent(this, MainActivityMitarbeiter.class);
//versuch ab hier neuland
resultIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
//neuland ende
PendingIntent resultPendingIntent =
PendingIntent.getActivity(
this.getApplicationContext(),
0,
resultIntent,
PendingIntent.FLAG_UPDATE_CURRENT
);
NotificationManager mNotifyMgr =
(NotificationManager) getSystemService(NOTIFICATION_SERVICE);
PendingIntent resultPendingIntent = PendingIntent.getActivity(this.getApplicationContext(), 0, resultIntent, PendingIntent.FLAG_UPDATE_CURRENT );
NotificationManager mNotifyMgr = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
mBuilder.setContentIntent(resultPendingIntent);
mNotifyMgr.notify(001, mBuilder.build());
Random random = new Random();
mNotifyMgr.notify(random.nextInt(9999 - 1000) + 1000, mBuilder.build());
}
@Override
public void onResume() {
isOnStop = false;
super.onResume();
}
@Override
public void onStop(){
// Thread t = new Thread(new ConnectionClose());
// t.start();
isOnStop = true;
super.onStop();
}

View File

@@ -8,7 +8,8 @@ public enum DataIdentifier {
LOGIN(1),
LOGOUT(2),
NULL(3),
STATUS_NOTIFICATION(4);
STATUS_NOTIFICATION_LOGIN(4),
STATUS_NOTIFICATION_LOGOUT(5);
private final int value;
DataIdentifier(int value) {

View File

@@ -10,6 +10,7 @@ import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Locale;
import java.util.zip.DataFormatException;
/**
@@ -47,6 +48,7 @@ public class Packet {
//23;281;20;389;1;[Tenant]; 6 Semikola
public Packet(String message) {
String[] gesplittet = message.split(";");
String senderPersonOidString = gesplittet[0];

Binary file not shown.

After

Width:  |  Height:  |  Size: 605 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 667 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 433 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 457 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 731 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 815 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 858 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 962 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.5 KiB

After

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

View File

@@ -46,7 +46,7 @@ namespace BeWoChatServer
}
catch (Exception e)
{
Debug.WriteLine("ChatServerException: " + e.Message);
Debug.WriteLine("ChatServerException (1010): " + e.Message);
}
}
@@ -66,7 +66,7 @@ namespace BeWoChatServer
}
catch (SocketException e)
{
Debug.WriteLine("ChatServerException: " + e.Message);
Debug.WriteLine("ChatServerException (1020): " + e.Message);
}
}
@@ -85,7 +85,7 @@ namespace BeWoChatServer
}
catch (Exception e)
{
Debug.WriteLine("ChatServerException: " + e.Message);
Debug.WriteLine("ChatServerException (1030): " + e.Message);
}
}
@@ -93,8 +93,6 @@ namespace BeWoChatServer
{
var dataPacket = (Packet) asyncResult.AsyncState;
Debug.WriteLine("Nachricht erhalten " + DateTime.Now);
try
{
var responseByteCount = dataPacket.Socket.EndReceive(asyncResult);
@@ -123,10 +121,12 @@ namespace BeWoChatServer
clientList[dataPacket.Socket] = dataPacket.SenderPersonOid;
}
//foreach(var client in clientList)
//{
// client.Key.Send(Encoding.UTF8.GetBytes("Client eingeloggt"));
//}
var notificationPacket = new Packet(dataPacket.Socket, dataPacket.ClientName, dataPacket.SenderPersonOid, 0) {DataIdentifier = DataIdentifier.StatusNotificationLogin};
foreach (var client in clientList.Where(w => !w.Value.Equals(dataPacket.SenderPersonOid)))
{
client.Key.Send(notificationPacket.GetDataStream());
}
break;
case DataIdentifier.Message:
@@ -172,6 +172,17 @@ namespace BeWoChatServer
break;
case DataIdentifier.Logout:
var endPointLogout = dataPacket.Socket.RemoteEndPoint;
var isRemoveSuccessful = clientList.Remove(dataPacket.Socket);
var notificationPacketLogout = new Packet(dataPacket.Socket, dataPacket.ClientName, dataPacket.SenderPersonOid, 0) {DataIdentifier = DataIdentifier.StatusNotificationLogout};
foreach (var client in clientList.Where(w => !w.Value.Equals(dataPacket.SenderPersonOid)))
{
client.Key.Send(notificationPacketLogout.GetDataStream());
}
break;
}

Binary file not shown.

File diff suppressed because one or more lines are too long

View File

@@ -15,13 +15,13 @@
NHibernate.Driver.MySqlDataDriver
</property>
<!-- <property name="connection.connection_string">
Server=localhost;Password=root;User ID=root;Initial Catalog=bewodemo
</property>-->
<property name="connection.connection_string">
Server=localhost;Password=root;User ID=root;Initial Catalog=bewodemo
</property>
<!--<property name="connection.connection_string">
Server=localhost;Password=root;User ID=root;Initial Catalog=1234567890
</property>
</property>-->
<property name="dialect">
NHibernate.Dialect.MySQLDialect

View File

@@ -828,6 +828,7 @@ namespace BS.Shared
Login,
Logout,
Null,
StatusNotification
StatusNotificationLogin,
StatusNotificationLogout
}
}

View File

@@ -35,6 +35,8 @@ namespace BeWoChatServer
SenderPersonOid = pSenderPersonOid;
RecipientPersonOid = pRecipientPersonOid;
MessageTimeStamp = DateTime.Now;
ChatMessage = "";
Tenant = "";
}
public void GetData(string message)