Merge remote-tracking branch 'origin/develop' into feature/SyncAdapter
Conflicts: app/src/main/java/ch/dissem/apps/abit/AbstractItemListFragment.java app/src/main/java/ch/dissem/apps/abit/MessageListActivity.java app/src/main/java/ch/dissem/apps/abit/MessageListFragment.java app/src/main/res/values-de/strings.xml app/src/main/res/values/strings.xml
@ -22,9 +22,9 @@ android {
|
||||
|
||||
dependencies {
|
||||
compile fileTree(dir: 'libs', include: ['*.jar'])
|
||||
compile 'com.android.support:appcompat-v7:23.0.1'
|
||||
compile 'com.android.support:support-v4:23.0.1'
|
||||
compile 'com.android.support:design:23.0.1'
|
||||
compile 'com.android.support:appcompat-v7:23.1.0'
|
||||
compile 'com.android.support:support-v4:23.1.0'
|
||||
compile 'com.android.support:design:23.1.0'
|
||||
|
||||
compile 'ch.dissem.jabit:jabit-domain:0.2.1-SNAPSHOT'
|
||||
compile 'ch.dissem.jabit:jabit-networking:0.2.1-SNAPSHOT'
|
||||
|
@ -22,7 +22,7 @@ import android.support.v4.app.ListFragment;
|
||||
import android.view.View;
|
||||
import android.widget.ListView;
|
||||
|
||||
import ch.dissem.apps.abit.listeners.ListSelectionListener;
|
||||
import ch.dissem.apps.abit.listener.ListSelectionListener;
|
||||
import ch.dissem.apps.abit.service.Singleton;
|
||||
import ch.dissem.bitmessage.BitmessageContext;
|
||||
import ch.dissem.bitmessage.entity.valueobject.Label;
|
||||
|
@ -7,7 +7,7 @@ import android.view.*;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import ch.dissem.apps.abit.service.Singleton;
|
||||
import ch.dissem.apps.abit.utils.Drawables;
|
||||
import ch.dissem.apps.abit.util.Drawables;
|
||||
import ch.dissem.bitmessage.BitmessageContext;
|
||||
import ch.dissem.bitmessage.entity.BitmessageAddress;
|
||||
import ch.dissem.bitmessage.entity.Plaintext;
|
||||
|
@ -12,6 +12,15 @@ import android.view.View;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.CompoundButton;
|
||||
|
||||
import ch.dissem.apps.abit.listener.ActionBarListener;
|
||||
import ch.dissem.apps.abit.listener.ListSelectionListener;
|
||||
import ch.dissem.apps.abit.notification.NetworkNotification;
|
||||
import ch.dissem.apps.abit.service.Singleton;
|
||||
import ch.dissem.bitmessage.BitmessageContext;
|
||||
import ch.dissem.bitmessage.entity.BitmessageAddress;
|
||||
import ch.dissem.bitmessage.entity.Plaintext;
|
||||
import ch.dissem.bitmessage.entity.valueobject.Label;
|
||||
|
||||
import com.mikepenz.community_material_typeface_library.CommunityMaterial;
|
||||
import com.mikepenz.google_material_typeface_library.GoogleMaterial;
|
||||
import com.mikepenz.iconics.IconicsDrawable;
|
||||
@ -33,6 +42,8 @@ import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
import ch.dissem.apps.abit.listeners.ActionBarListener;
|
||||
import ch.dissem.apps.abit.listeners.ListSelectionListener;
|
||||
@ -253,8 +264,10 @@ public class MessageListActivity extends AppCompatActivity
|
||||
@Override
|
||||
public void onCheckedChanged(IDrawerItem drawerItem, CompoundButton buttonView, boolean isChecked) {
|
||||
// TODO: warn user, option to restrict to WiFi
|
||||
if (isChecked && !bmc.isRunning()) bmc.startup();
|
||||
else if (bmc.isRunning()) bmc.shutdown();
|
||||
if (isChecked && !bmc.isRunning()) {
|
||||
bmc.startup();
|
||||
new NetworkNotification(MessageListActivity.this).show();
|
||||
} else if (bmc.isRunning()) bmc.shutdown();
|
||||
}
|
||||
})
|
||||
.withChecked(bmc.isRunning())
|
||||
|
@ -12,6 +12,8 @@ import android.widget.ArrayAdapter;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
import ch.dissem.apps.abit.listener.ActionBarListener;
|
||||
import ch.dissem.apps.abit.listener.ListSelectionListener;
|
||||
|
||||
import ch.dissem.apps.abit.listeners.ActionBarListener;
|
||||
import ch.dissem.apps.abit.listeners.ListSelectionListener;
|
||||
|
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package ch.dissem.apps.abit.listeners;
|
||||
package ch.dissem.apps.abit.listener;
|
||||
|
||||
/**
|
||||
* Created by chris on 06.09.15.
|
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package ch.dissem.apps.abit.listeners;
|
||||
package ch.dissem.apps.abit.listener;
|
||||
|
||||
/**
|
||||
* A callback interface that all activities containing this fragment must
|
@ -14,10 +14,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package ch.dissem.apps.abit.listeners;
|
||||
package ch.dissem.apps.abit.listener;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.app.Notification;
|
||||
import android.app.NotificationManager;
|
||||
import android.app.PendingIntent;
|
||||
import android.content.Context;
|
||||
@ -34,9 +33,11 @@ import android.text.Spannable;
|
||||
import android.text.SpannableString;
|
||||
import android.text.Spanned;
|
||||
import android.text.style.StyleSpan;
|
||||
|
||||
import ch.dissem.apps.abit.Identicon;
|
||||
import ch.dissem.apps.abit.MessageListActivity;
|
||||
import ch.dissem.apps.abit.R;
|
||||
import ch.dissem.apps.abit.notification.NewMessageNotification;
|
||||
import ch.dissem.bitmessage.BitmessageContext;
|
||||
import ch.dissem.bitmessage.entity.Plaintext;
|
||||
|
||||
@ -50,18 +51,17 @@ import java.util.LinkedList;
|
||||
* </p>
|
||||
*/
|
||||
public class MessageListener implements BitmessageContext.Listener {
|
||||
private static final StyleSpan SPAN_EMPHASIS = new StyleSpan(Typeface.BOLD);
|
||||
private final Context ctx;
|
||||
private final NotificationManager manager;
|
||||
private final LinkedList<Plaintext> unacknowledged = new LinkedList<>();
|
||||
private final int pictureSize;
|
||||
private int numberOfUnacknowledgedMessages = 0;
|
||||
private final NewMessageNotification notification;
|
||||
|
||||
public MessageListener(Context ctx) {
|
||||
this.ctx = ctx.getApplicationContext();
|
||||
this.manager = (NotificationManager) ctx.getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
|
||||
this.pictureSize = getMaxContactPhotoSize(ctx);
|
||||
this.notification = new NewMessageNotification(ctx);
|
||||
}
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
|
||||
@ -94,57 +94,15 @@ public class MessageListener implements BitmessageContext.Listener {
|
||||
|
||||
NotificationCompat.Builder builder = new NotificationCompat.Builder(ctx);
|
||||
if (numberOfUnacknowledgedMessages == 1) {
|
||||
Spannable bigText = new SpannableString(plaintext.getSubject() + "\n" + plaintext.getText());
|
||||
bigText.setSpan(SPAN_EMPHASIS, 0, plaintext.getSubject().length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||
builder.setSmallIcon(R.drawable.ic_notification_new_message)
|
||||
.setLargeIcon(toBitmap(new Identicon(plaintext.getFrom())))
|
||||
.setContentTitle(plaintext.getFrom().toString())
|
||||
.setContentText(plaintext.getSubject())
|
||||
.setStyle(new NotificationCompat.BigTextStyle().bigText(bigText))
|
||||
.setContentInfo("Info");
|
||||
|
||||
Intent showMessageIntent = new Intent(ctx, MessageListActivity.class);
|
||||
showMessageIntent.putExtra(MessageListActivity.EXTRA_SHOW_MESSAGE, plaintext);
|
||||
PendingIntent pendingIntent = PendingIntent.getActivity(ctx, 0, showMessageIntent, PendingIntent.FLAG_UPDATE_CURRENT);
|
||||
builder.setContentIntent(pendingIntent);
|
||||
|
||||
builder.addAction(R.drawable.ic_action_reply, ctx.getString(R.string.reply), pendingIntent);
|
||||
builder.addAction(R.drawable.ic_action_delete, ctx.getString(R.string.delete), pendingIntent);
|
||||
notification.singleNotification(plaintext);
|
||||
} else {
|
||||
builder.setSmallIcon(R.drawable.ic_notification_new_message)
|
||||
.setContentTitle(ctx.getString(R.string.n_new_messages, this.unacknowledged.size()))
|
||||
.setContentText(ctx.getString(R.string.app_name));
|
||||
|
||||
NotificationCompat.InboxStyle inboxStyle = new NotificationCompat.InboxStyle();
|
||||
synchronized (unacknowledged) {
|
||||
inboxStyle.setBigContentTitle(ctx.getString(R.string.n_new_messages, numberOfUnacknowledgedMessages));
|
||||
for (Plaintext msg : unacknowledged) {
|
||||
Spannable sb = new SpannableString(msg.getFrom() + " " + msg.getSubject());
|
||||
sb.setSpan(SPAN_EMPHASIS, 0, String.valueOf(msg.getFrom()).length(), Spannable.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||
inboxStyle.addLine(sb);
|
||||
notification.multiNotification(unacknowledged, numberOfUnacknowledgedMessages);
|
||||
}
|
||||
}
|
||||
builder.setStyle(inboxStyle);
|
||||
|
||||
Intent intent = new Intent(ctx, MessageListActivity.class);
|
||||
intent.setAction(MessageListActivity.ACTION_SHOW_INBOX);
|
||||
PendingIntent pendingIntent = PendingIntent.getActivity(ctx, 1, intent, 0);
|
||||
builder.setContentIntent(pendingIntent);
|
||||
}
|
||||
|
||||
manager.notify(0, builder.build());
|
||||
}
|
||||
|
||||
private Bitmap toBitmap(Identicon identicon) {
|
||||
Bitmap bitmap = Bitmap.createBitmap(pictureSize, pictureSize, Bitmap.Config.ARGB_8888);
|
||||
Canvas canvas = new Canvas(bitmap);
|
||||
identicon.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
|
||||
identicon.draw(canvas);
|
||||
return bitmap;
|
||||
notification.show();
|
||||
}
|
||||
|
||||
public void resetNotification() {
|
||||
manager.cancel(0);
|
||||
notification.hide();
|
||||
synchronized (unacknowledged) {
|
||||
unacknowledged.clear();
|
||||
numberOfUnacknowledgedMessages = 0;
|
@ -0,0 +1,33 @@
|
||||
package ch.dissem.apps.abit.notification;
|
||||
|
||||
import android.app.Notification;
|
||||
import android.app.NotificationManager;
|
||||
import android.content.Context;
|
||||
|
||||
/**
|
||||
* Some base class to create and handle notifications.
|
||||
*/
|
||||
public abstract class AbstractNotification {
|
||||
protected final Context ctx;
|
||||
protected final NotificationManager manager;
|
||||
public Notification notification;
|
||||
|
||||
|
||||
public AbstractNotification(Context ctx) {
|
||||
this.ctx = ctx;
|
||||
this.manager = (NotificationManager) ctx.getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return an id unique to this notification class
|
||||
*/
|
||||
protected abstract int getNotificationId();
|
||||
|
||||
public void show() {
|
||||
manager.notify(getNotificationId(), notification);
|
||||
}
|
||||
|
||||
public void hide() {
|
||||
manager.cancel(getNotificationId());
|
||||
}
|
||||
}
|
@ -0,0 +1,87 @@
|
||||
package ch.dissem.apps.abit.notification;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.PendingIntent;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.support.v7.app.NotificationCompat;
|
||||
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
import ch.dissem.apps.abit.MessageListActivity;
|
||||
import ch.dissem.apps.abit.R;
|
||||
import ch.dissem.apps.abit.service.Singleton;
|
||||
import ch.dissem.bitmessage.BitmessageContext;
|
||||
import ch.dissem.bitmessage.utils.Property;
|
||||
|
||||
/**
|
||||
* Shows the network status (as long as the client is connected as a full node)
|
||||
*/
|
||||
public class NetworkNotification extends AbstractNotification {
|
||||
private final BitmessageContext bmc;
|
||||
private NotificationCompat.Builder builder;
|
||||
|
||||
public NetworkNotification(Context ctx) {
|
||||
super(ctx);
|
||||
bmc = Singleton.getBitmessageContext(ctx);
|
||||
builder = new NotificationCompat.Builder(ctx);
|
||||
builder.setSmallIcon(R.drawable.ic_notification_full_node)
|
||||
.setContentTitle(ctx.getString(R.string.bitmessage_active))
|
||||
.setVisibility(NotificationCompat.VISIBILITY_PUBLIC);
|
||||
}
|
||||
|
||||
@SuppressLint("StringFormatMatches")
|
||||
private boolean update() {
|
||||
boolean running = bmc.isRunning();
|
||||
builder.setOngoing(running);
|
||||
Property connections = bmc.status().getProperty("network").getProperty("connections");
|
||||
if (!running) {
|
||||
builder.setContentText(ctx.getString(R.string.connection_info_disconnected));
|
||||
} else if (connections.getProperties().length == 0) {
|
||||
builder.setContentText(ctx.getString(R.string.connection_info_pending));
|
||||
} else {
|
||||
StringBuilder info = new StringBuilder();
|
||||
for (Property stream : connections.getProperties()) {
|
||||
int streamNumber = Integer.parseInt(stream.getName().substring("stream ".length()));
|
||||
Integer nodeCount = (Integer) stream.getProperty("nodes").getValue();
|
||||
if (nodeCount == 1) {
|
||||
info.append(ctx.getString(R.string.connection_info_1,
|
||||
streamNumber));
|
||||
} else {
|
||||
info.append(ctx.getString(R.string.connection_info_n,
|
||||
streamNumber, nodeCount));
|
||||
}
|
||||
info.append('\n');
|
||||
}
|
||||
builder.setContentText(info);
|
||||
}
|
||||
Intent showMessageIntent = new Intent(ctx, MessageListActivity.class);
|
||||
PendingIntent pendingIntent = PendingIntent.getActivity(ctx, 1, showMessageIntent, 0);
|
||||
builder.setContentIntent(pendingIntent);
|
||||
notification = builder.build();
|
||||
return running;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
update();
|
||||
super.show();
|
||||
|
||||
final Timer timer = new Timer();
|
||||
timer.schedule(new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (!update()) {
|
||||
cancel();
|
||||
}
|
||||
NetworkNotification.super.show();
|
||||
}
|
||||
}, 10_000, 10_000);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getNotificationId() {
|
||||
return 2;
|
||||
}
|
||||
}
|
@ -0,0 +1,81 @@
|
||||
package ch.dissem.apps.abit.notification;
|
||||
|
||||
import android.app.NotificationManager;
|
||||
import android.app.PendingIntent;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Typeface;
|
||||
import android.support.v7.app.NotificationCompat;
|
||||
import android.text.Spannable;
|
||||
import android.text.SpannableString;
|
||||
import android.text.Spanned;
|
||||
import android.text.style.StyleSpan;
|
||||
|
||||
import java.util.LinkedList;
|
||||
|
||||
import ch.dissem.apps.abit.Identicon;
|
||||
import ch.dissem.apps.abit.MessageListActivity;
|
||||
import ch.dissem.apps.abit.R;
|
||||
import ch.dissem.bitmessage.entity.Plaintext;
|
||||
|
||||
import static ch.dissem.apps.abit.util.Drawables.toBitmap;
|
||||
|
||||
public class NewMessageNotification extends AbstractNotification {
|
||||
private static final StyleSpan SPAN_EMPHASIS = new StyleSpan(Typeface.BOLD);
|
||||
|
||||
public NewMessageNotification(Context ctx) {
|
||||
super(ctx);
|
||||
}
|
||||
|
||||
public NewMessageNotification singleNotification(Plaintext plaintext) {
|
||||
NotificationCompat.Builder builder = new NotificationCompat.Builder(ctx);
|
||||
Spannable bigText = new SpannableString(plaintext.getSubject() + "\n" + plaintext.getText());
|
||||
bigText.setSpan(SPAN_EMPHASIS, 0, plaintext.getSubject().length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||
builder.setSmallIcon(R.drawable.ic_notification_new_message)
|
||||
.setLargeIcon(toBitmap(new Identicon(plaintext.getFrom()), 192))
|
||||
.setContentTitle(plaintext.getFrom().toString())
|
||||
.setContentText(plaintext.getSubject())
|
||||
.setStyle(new NotificationCompat.BigTextStyle().bigText(bigText))
|
||||
.setContentInfo("Info");
|
||||
|
||||
Intent showMessageIntent = new Intent(ctx, MessageListActivity.class);
|
||||
showMessageIntent.putExtra(MessageListActivity.EXTRA_SHOW_MESSAGE, plaintext);
|
||||
PendingIntent pendingIntent = PendingIntent.getActivity(ctx, 0, showMessageIntent, PendingIntent.FLAG_UPDATE_CURRENT);
|
||||
builder.setContentIntent(pendingIntent);
|
||||
|
||||
builder.addAction(R.drawable.ic_action_reply, ctx.getString(R.string.reply), pendingIntent);
|
||||
builder.addAction(R.drawable.ic_action_delete, ctx.getString(R.string.delete), pendingIntent);
|
||||
notification = builder.build();
|
||||
return this;
|
||||
}
|
||||
|
||||
public NewMessageNotification multiNotification(LinkedList<Plaintext> unacknowledged, int numberOfUnacknowledgedMessages) {
|
||||
NotificationCompat.Builder builder = new NotificationCompat.Builder(ctx);
|
||||
builder.setSmallIcon(R.drawable.ic_notification_new_message)
|
||||
.setContentTitle(ctx.getString(R.string.n_new_messages, unacknowledged.size()))
|
||||
.setContentText(ctx.getString(R.string.app_name));
|
||||
|
||||
NotificationCompat.InboxStyle inboxStyle = new NotificationCompat.InboxStyle();
|
||||
synchronized (unacknowledged) {
|
||||
inboxStyle.setBigContentTitle(ctx.getString(R.string.n_new_messages, numberOfUnacknowledgedMessages));
|
||||
for (Plaintext msg : unacknowledged) {
|
||||
Spannable sb = new SpannableString(msg.getFrom() + " " + msg.getSubject());
|
||||
sb.setSpan(SPAN_EMPHASIS, 0, String.valueOf(msg.getFrom()).length(), Spannable.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||
inboxStyle.addLine(sb);
|
||||
}
|
||||
}
|
||||
builder.setStyle(inboxStyle);
|
||||
|
||||
Intent intent = new Intent(ctx, MessageListActivity.class);
|
||||
intent.setAction(MessageListActivity.ACTION_SHOW_INBOX);
|
||||
PendingIntent pendingIntent = PendingIntent.getActivity(ctx, 1, intent, 0);
|
||||
builder.setContentIntent(pendingIntent);
|
||||
notification = builder.build();
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getNotificationId() {
|
||||
return 1;
|
||||
}
|
||||
}
|
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package ch.dissem.apps.abit.repositories;
|
||||
package ch.dissem.apps.abit.repository;
|
||||
|
||||
import android.content.ContentValues;
|
||||
import android.database.Cursor;
|
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package ch.dissem.apps.abit.repositories;
|
||||
package ch.dissem.apps.abit.repository;
|
||||
|
||||
import android.content.ContentValues;
|
||||
import android.database.Cursor;
|
||||
@ -36,7 +36,7 @@ import java.io.IOException;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import static ch.dissem.apps.abit.repositories.SqlHelper.join;
|
||||
import static ch.dissem.apps.abit.repository.SqlHelper.join;
|
||||
import static ch.dissem.bitmessage.utils.UnixTime.now;
|
||||
|
||||
/**
|
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package ch.dissem.apps.abit.repositories;
|
||||
package ch.dissem.apps.abit.repository;
|
||||
|
||||
import android.content.ContentValues;
|
||||
import android.content.Context;
|
||||
@ -40,7 +40,7 @@ import java.util.Collection;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import static ch.dissem.apps.abit.repositories.SqlHelper.join;
|
||||
import static ch.dissem.apps.abit.repository.SqlHelper.join;
|
||||
|
||||
/**
|
||||
* {@link MessageRepository} implementation using the Android SQL API.
|
@ -14,12 +14,12 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package ch.dissem.apps.abit.repositories;
|
||||
package ch.dissem.apps.abit.repository;
|
||||
|
||||
import android.content.Context;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.database.sqlite.SQLiteOpenHelper;
|
||||
import ch.dissem.apps.abit.utils.Assets;
|
||||
import ch.dissem.apps.abit.util.Assets;
|
||||
|
||||
/**
|
||||
* Handles database migration and provides access.
|
@ -2,11 +2,11 @@ package ch.dissem.apps.abit.service;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import ch.dissem.apps.abit.listeners.MessageListener;
|
||||
import ch.dissem.apps.abit.repositories.AndroidAddressRepository;
|
||||
import ch.dissem.apps.abit.repositories.AndroidInventory;
|
||||
import ch.dissem.apps.abit.repositories.AndroidMessageRepository;
|
||||
import ch.dissem.apps.abit.repositories.SqlHelper;
|
||||
import ch.dissem.apps.abit.listener.MessageListener;
|
||||
import ch.dissem.apps.abit.repository.AndroidAddressRepository;
|
||||
import ch.dissem.apps.abit.repository.AndroidInventory;
|
||||
import ch.dissem.apps.abit.repository.AndroidMessageRepository;
|
||||
import ch.dissem.apps.abit.repository.SqlHelper;
|
||||
import ch.dissem.bitmessage.BitmessageContext;
|
||||
import ch.dissem.bitmessage.networking.DefaultNetworkHandler;
|
||||
import ch.dissem.bitmessage.ports.MemoryNodeRegistry;
|
||||
|
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package ch.dissem.apps.abit.utils;
|
||||
package ch.dissem.apps.abit.util;
|
||||
|
||||
import android.content.Context;
|
||||
|
@ -14,11 +14,16 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package ch.dissem.apps.abit.utils;
|
||||
package ch.dissem.apps.abit.util;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Canvas;
|
||||
import android.view.Menu;
|
||||
|
||||
import ch.dissem.apps.abit.Identicon;
|
||||
import ch.dissem.apps.abit.R;
|
||||
|
||||
import com.mikepenz.google_material_typeface_library.GoogleMaterial;
|
||||
import com.mikepenz.iconics.IconicsDrawable;
|
||||
|
||||
@ -29,4 +34,16 @@ public class Drawables {
|
||||
public static void addIcon(Context ctx, Menu menu, int menuItem, GoogleMaterial.Icon icon) {
|
||||
menu.findItem(menuItem).setIcon(new IconicsDrawable(ctx, icon).colorRes(R.color.primary_text_default_material_dark).actionBar());
|
||||
}
|
||||
|
||||
public static Bitmap toBitmap(Identicon identicon, int size) {
|
||||
return toBitmap(identicon, size, size);
|
||||
}
|
||||
|
||||
public static Bitmap toBitmap(Identicon identicon, int width, int height) {
|
||||
Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
|
||||
Canvas canvas = new Canvas(bitmap);
|
||||
identicon.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
|
||||
identicon.draw(canvas);
|
||||
return bitmap;
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 246 B |
Before Width: | Height: | Size: 399 B |
Before Width: | Height: | Size: 347 B |
Before Width: | Height: | Size: 678 B |
Before Width: | Height: | Size: 632 B |
Before Width: | Height: | Size: 371 B |
Before Width: | Height: | Size: 862 B |
Before Width: | Height: | Size: 356 B |
Before Width: | Height: | Size: 302 B |
Before Width: | Height: | Size: 182 B |
Before Width: | Height: | Size: 257 B |
Before Width: | Height: | Size: 257 B |
Before Width: | Height: | Size: 433 B |
Before Width: | Height: | Size: 412 B |
Before Width: | Height: | Size: 277 B |
Before Width: | Height: | Size: 593 B |
Before Width: | Height: | Size: 273 B |
Before Width: | Height: | Size: 232 B |
Before Width: | Height: | Size: 280 B |
Before Width: | Height: | Size: 491 B |
Before Width: | Height: | Size: 394 B |
Before Width: | Height: | Size: 844 B |
Before Width: | Height: | Size: 849 B |
Before Width: | Height: | Size: 497 B |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 455 B |
Before Width: | Height: | Size: 383 B |
Before Width: | Height: | Size: 422 B |
Before Width: | Height: | Size: 849 B |
Before Width: | Height: | Size: 620 B |
Before Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 814 B |
Before Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 660 B |
Before Width: | Height: | Size: 759 B |
Before Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 1.0 KiB |
9
app/src/main/res/drawable/ic_action_archive.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#DEFFFFFF"
|
||||
android:pathData="M3,3H21V7H3V3M4,8H20V21H4V8M9.5,11A0.5,0.5 0,0 0,9 11.5V13H15V11.5A0.5,0.5 0,0 0,14.5 11H9.5Z"/>
|
||||
</vector>
|
9
app/src/main/res/drawable/ic_action_close.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#DEFFFFFF"
|
||||
android:pathData="M19,6.41L17.59,5 12,10.59 6.41,5 5,6.41 10.59,12 5,17.59 6.41,19 12,13.41 17.59,19 19,17.59 13.41,12z"/>
|
||||
</vector>
|
9
app/src/main/res/drawable/ic_action_compose_message.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#DEFFFFFF"
|
||||
android:pathData="M3,17.25V21h3.75L17.81,9.94l-3.75,-3.75L3,17.25zM20.71,7.04c0.39,-0.39 0.39,-1.02 0,-1.41l-2.34,-2.34c-0.39,-0.39 -1.02,-0.39 -1.41,0l-1.83,1.83 3.75,3.75 1.83,-1.83z"/>
|
||||
</vector>
|
9
app/src/main/res/drawable/ic_action_delete.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#DEFFFFFF"
|
||||
android:pathData="M6,19c0,1.1 0.9,2 2,2h8c1.1,0 2,-0.9 2,-2V7H6v12zM19,4h-3.5l-1,-1h-5l-1,1H5v2h14V4z"/>
|
||||
</vector>
|
9
app/src/main/res/drawable/ic_action_mark_unread.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#DEFFFFFF"
|
||||
android:pathData="M20,4H4c-1.1,0 -1.99,0.9 -1.99,2L2,18c0,1.1 0.9,2 2,2h16c1.1,0 2,-0.9 2,-2V6c0,-1.1 -0.9,-2 -2,-2zm0,4l-8,5 -8,-5V6l8,5 8,-5v2z"/>
|
||||
</vector>
|
9
app/src/main/res/drawable/ic_action_reply.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#DEFFFFFF"
|
||||
android:pathData="M10,9V5L3,12L10,19V14.9C15,14.9 18.5,16.5 21,20C20,15 17,10 10,9Z"/>
|
||||
</vector>
|
9
app/src/main/res/drawable/ic_action_send.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#DEFFFFFF"
|
||||
android:pathData="M2,21L23,12L2,3V10L17,12L2,14V21Z"/>
|
||||
</vector>
|
9
app/src/main/res/drawable/ic_notification_full_node.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M19.35,10.03C18.67,6.59 15.64,4 12,4C9.11,4 6.6,5.64 5.35,8.03C2.34,8.36 0,10.9 0,14A6,6 0,0 0,6 20H19A5,5 0,0 0,24 15C24,12.36 21.95,10.22 19.35,10.03Z"/>
|
||||
</vector>
|
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M20.5,0A2.5,2.5 0,0 1,23 2.5V3A1,1 0,0 1,24 4V8A1,1 0,0 1,23 9H18A1,1 0,0 1,17 8V4A1,1 0,0 1,18 3V2.5A2.5,2.5 0,0 1,20.5 0M12,11L4,6V8L12,13L16.18,10.39C16.69,10.77 17.32,11 18,11H22V18A2,2 0,0 1,20 20H4A2,2 0,0 1,2 18V6A2,2 0,0 1,4 4H15V8C15,8.36 15.06,8.7 15.18,9L12,11M20.5,1A1.5,1.5 0,0 0,19 2.5V3H22V2.5A1.5,1.5 0,0 0,20.5 1Z"/>
|
||||
</vector>
|
@ -22,7 +22,7 @@
|
||||
android:id="@+id/fab_compose_message"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/ic_fab_compose_message"
|
||||
android:src="@drawable/ic_action_compose_message"
|
||||
app:elevation="8dp"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
|
@ -22,7 +22,7 @@
|
||||
android:id="@+id/fab_compose_message"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/ic_fab_compose_message"
|
||||
android:src="@drawable/ic_action_compose_message"
|
||||
app:elevation="8dp"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
|
@ -1,6 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.design.widget.CoordinatorLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
@ -8,13 +7,13 @@
|
||||
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_below="@id/toolbar"
|
||||
android:id="@+id/content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_below="@id/toolbar"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
||||
tools:context=".MessageListActivity"
|
||||
tools:layout="@android:layout/list_content"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
|
||||
tools:layout="@android:layout/list_content" />
|
||||
|
||||
<android.support.design.widget.AppBarLayout
|
||||
android:layout_width="match_parent"
|
||||
@ -27,8 +26,8 @@
|
||||
android:background="?attr/colorPrimary"
|
||||
android:elevation="4dp"
|
||||
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
|
||||
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
|
||||
app:layout_scrollFlags="scroll|enterAlways"/>
|
||||
app:layout_scrollFlags="scroll|enterAlways"
|
||||
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
|
||||
|
||||
</android.support.design.widget.AppBarLayout>
|
||||
|
||||
|
@ -5,21 +5,21 @@
|
||||
<item
|
||||
android:id="@+id/reply"
|
||||
app:showAsAction="ifRoom"
|
||||
android:icon="@drawable/ic_action_placeholder"
|
||||
android:icon="@drawable/ic_action_reply"
|
||||
android:title="@string/reply"/>
|
||||
<item
|
||||
android:id="@+id/delete"
|
||||
app:showAsAction="ifRoom"
|
||||
android:icon="@drawable/ic_action_placeholder"
|
||||
android:icon="@drawable/ic_action_delete"
|
||||
android:title="@string/delete"/>
|
||||
<item
|
||||
android:id="@+id/mark_unread"
|
||||
app:showAsAction="ifRoom"
|
||||
android:icon="@drawable/ic_action_placeholder"
|
||||
android:icon="@drawable/ic_action_mark_unread"
|
||||
android:title="@string/mark_unread"/>
|
||||
<item
|
||||
android:id="@+id/archive"
|
||||
app:showAsAction="ifRoom"
|
||||
android:icon="@drawable/ic_action_placeholder"
|
||||
android:icon="@drawable/ic_action_archive"
|
||||
android:title="@string/archive"/>
|
||||
</menu>
|
@ -5,7 +5,7 @@
|
||||
<item
|
||||
android:id="@+id/empty_trash"
|
||||
app:showAsAction="never"
|
||||
android:icon="@drawable/ic_action_placeholder"
|
||||
android:icon="@drawable/ic_action_delete"
|
||||
android:title="@string/empty_trash"
|
||||
android:visible="false"/>
|
||||
</menu>
|
@ -28,7 +28,7 @@
|
||||
<string name="archive">Archiv</string>
|
||||
<string name="empty_trash">Papierkorb leeren</string>
|
||||
<string name="mark_unread">Als ungelesen markieren</string>
|
||||
<string name="stream_number">Stream #%d</string>
|
||||
<string name="stream_number">Stream %d</string>
|
||||
<string name="enabled">Aktiv</string>
|
||||
<string name="title_subscription_detail">Abonnement</string>
|
||||
<string name="sync_timeout">Zeitbeschränkung der Synchronisierung</string>
|
||||
@ -38,4 +38,8 @@
|
||||
<string name="full_node">Aktiver Knoten</string>
|
||||
<string name="send">Senden</string>
|
||||
<string name="write_message">Schreiben</string>
|
||||
<string name="connection_info_1">Stream %1$d: eine Verbindung</string>
|
||||
<string name="connection_info_n">Stream %1$d: %2$d Verbindungen</string>
|
||||
<string name="connection_info_disconnected">Getrennt</string>
|
||||
<string name="connection_info_pending">Verbindung wird aufgebaut…</string>
|
||||
</resources>
|
@ -3,6 +3,7 @@
|
||||
<resources>
|
||||
<color name="primary">#FFC107</color>
|
||||
<color name="primary_dark">#FFA000</color>
|
||||
<color name="primary_dark_text">#DEFFFFFF</color>
|
||||
<color name="primary_light">#FFECB3</color>
|
||||
<color name="accent">#607D8B</color>
|
||||
<color name="primary_text">#212121</color>
|
||||
|
@ -16,6 +16,8 @@
|
||||
<string name="title_activity_open_bitmessage_link">Import Contact</string>
|
||||
|
||||
<string name="action_settings">Settings</string>
|
||||
<string name="connection_info_1">Stream #%1$d: one connection</string>
|
||||
<string name="connection_info_n">Stream #%1$d: %2$d connections</string>
|
||||
<string name="import_address">Import Address</string>
|
||||
<string name="import_contact">Add to contacts</string>
|
||||
<string name="label">Label</string>
|
||||
@ -38,4 +40,6 @@
|
||||
<string name="write_message">Write message</string>
|
||||
<string name="full_node">Full node</string>
|
||||
<string name="send">Send</string>
|
||||
<string name="connection_info_disconnected">Disconnected</string>
|
||||
<string name="connection_info_pending">Connecting…</string>
|
||||
</resources>
|
||||
|
@ -9,7 +9,7 @@ buildscript {
|
||||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:1.3.0'
|
||||
classpath 'com.android.tools.build:gradle:1.4.+'
|
||||
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
// in the individual module build.gradle files
|
||||
|