Skip to content

Commit

Permalink
Merge with Master (#51)
Browse files Browse the repository at this point in the history
Signed-off-by: Andrea Cappelli <[email protected]>
  • Loading branch information
sw1ftc0d3r committed Mar 18, 2014
1 parent 1bd439c commit 33ab693
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 24 deletions.
2 changes: 1 addition & 1 deletion src/org/kontalk/service/MessageCenterService.java
Original file line number Diff line number Diff line change
Expand Up @@ -1400,7 +1400,7 @@ private Uri incoming(CompositeMessage msg) {
public void run() {
ContentValues v = new ContentValues(1);
v.put(Messages.ATTACHMENT_PREVIEW_PATH, dest.toString());

Log.w ("Percorso: ",""+v.get(Messages.ATTACHMENT_PREVIEW_PATH));
getContentResolver().update(_uri, v, null, null);
}
},
Expand Down
38 changes: 20 additions & 18 deletions src/org/kontalk/ui/ComposeMessageFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -836,30 +836,32 @@ public void onClick(final DialogInterface dialog, @SuppressWarnings("unused") fi
final AlertDialog alert = builder.create();
alert.show();
}
criteria.setAccuracy(criteria.ACCURACY_FINE);
String provider = locationManager.getBestProvider(criteria, false);
LocationListener l = new LocationListener() {
public void onStatusChanged(String provider, int status, Bundle extras) {
}
else {
criteria.setAccuracy(criteria.ACCURACY_FINE);
String provider = locationManager.getBestProvider(criteria, false);
LocationListener l = new LocationListener() {
public void onStatusChanged(String provider, int status, Bundle extras) {
}

public void onProviderEnabled(String provider) {
}
public void onProviderEnabled(String provider) {
}

public void onProviderDisabled(String provider) {
}
public void onProviderDisabled(String provider) {
}

public void onLocationChanged(android.location.Location location) {
Log.w(TAG, "location = " + location.getLatitude() + ", " + location.getLongitude());
public void onLocationChanged(android.location.Location location) {
Log.w(TAG, "location = " + location.getLatitude() + ", " + location.getLongitude());

locationManager.removeUpdates(this);
locationManager.removeUpdates(this);

double lat = location.getLatitude();
double lon = location.getLongitude();
new TextMessageThread("Location", lat, lon).start();
}
};
double lat = location.getLatitude();
double lon = location.getLongitude();
new TextMessageThread("Location", lat, lon).start();
}
};

locationManager.requestLocationUpdates(provider, 0, 0, l);
locationManager.requestLocationUpdates(provider, 0, 0, l);
}
}

private void showSmileysPopup(View anchor) {
Expand Down
27 changes: 22 additions & 5 deletions src/org/kontalk/ui/MessagingNotification.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,23 @@
import android.content.Context;
import android.content.Intent;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Color;
import android.graphics.Typeface;
import android.graphics.drawable.BitmapDrawable;
import android.media.AudioManager;
import android.net.Uri;
import android.support.v4.app.NotificationCompat;
import android.support.v4.app.NotificationCompat.BigPictureStyle;
import android.support.v4.app.NotificationCompat.BigTextStyle;
import android.support.v4.app.NotificationCompat.InboxStyle;
import android.support.v4.app.NotificationCompat.Style;
import android.text.Spannable;
import android.text.SpannableStringBuilder;
import android.text.style.ForegroundColorSpan;
import android.text.style.StyleSpan;
import android.util.Log;


/**
Expand All @@ -72,6 +76,7 @@ public class MessagingNotification {
CommonColumns.PEER,
Messages.BODY_CONTENT,
Messages.ATTACHMENT_MIME,
Messages.ATTACHMENT_PREVIEW_PATH,
CommonColumns.ENCRYPTED,
};

Expand Down Expand Up @@ -199,6 +204,7 @@ public static void updateMessagesNotification(Context context, boolean isNew) {

if (supportsBigNotifications()) {
Map<String, CharSequence[]> convs = new HashMap<String, CharSequence[]>();
String previewPath = null;

String peer = null;
long id = 0;
Expand All @@ -208,6 +214,8 @@ public static void updateMessagesNotification(Context context, boolean isNew) {
peer = c.getString(1);
byte[] content = c.getBlob(2);
String attMime = c.getString(3);
previewPath = c.getString(4);
Log.w ("PATH", "" + previewPath);

CharSequence[] b = convs.get(peer);
if (b == null) {
Expand All @@ -222,7 +230,7 @@ public static void updateMessagesNotification(Context context, boolean isNew) {

String textContent;

boolean encrypted = c.getInt(4) != 0;
boolean encrypted = c.getInt(5) != 0;
if (encrypted) {
textContent = context.getString(R.string.text_encrypted);
}
Expand Down Expand Up @@ -303,10 +311,19 @@ else if (content == null && attMime != null) {
String content = convs.get(peer)[0].toString();
CharSequence last = convs.get(peer)[1];

// big text content
style = new BigTextStyle();
((BigTextStyle) style).bigText(content);
((BigTextStyle) style).setSummaryText(Authenticator.getDefaultAccount(context).name);
if (unread == 1 && previewPath != null) {
Log.d ("PATH",previewPath);
Bitmap b=BitmapFactory.decodeFile(previewPath);
style = new BigPictureStyle();
((BigPictureStyle) style).bigPicture(b);
}

else {
// big text content
style = new BigTextStyle();
((BigTextStyle) style).bigText(content);
((BigTextStyle) style).setSummaryText(Authenticator.getDefaultAccount(context).name);
}

// ticker
Contact contact = Contact.findByUserId(context, peer);
Expand Down

0 comments on commit 33ab693

Please sign in to comment.