diff --git a/app/build.gradle b/app/build.gradle index 0e3dcb4..be506a6 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -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' diff --git a/app/src/main/java/ch/dissem/apps/abit/AbstractItemListFragment.java b/app/src/main/java/ch/dissem/apps/abit/AbstractItemListFragment.java index 3500931..6e25693 100644 --- a/app/src/main/java/ch/dissem/apps/abit/AbstractItemListFragment.java +++ b/app/src/main/java/ch/dissem/apps/abit/AbstractItemListFragment.java @@ -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; diff --git a/app/src/main/java/ch/dissem/apps/abit/MessageDetailFragment.java b/app/src/main/java/ch/dissem/apps/abit/MessageDetailFragment.java index dbca865..4652f6b 100644 --- a/app/src/main/java/ch/dissem/apps/abit/MessageDetailFragment.java +++ b/app/src/main/java/ch/dissem/apps/abit/MessageDetailFragment.java @@ -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; diff --git a/app/src/main/java/ch/dissem/apps/abit/MessageListActivity.java b/app/src/main/java/ch/dissem/apps/abit/MessageListActivity.java index 048a886..1da5bf0 100644 --- a/app/src/main/java/ch/dissem/apps/abit/MessageListActivity.java +++ b/app/src/main/java/ch/dissem/apps/abit/MessageListActivity.java @@ -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()) diff --git a/app/src/main/java/ch/dissem/apps/abit/MessageListFragment.java b/app/src/main/java/ch/dissem/apps/abit/MessageListFragment.java index a5515c5..c31b091 100644 --- a/app/src/main/java/ch/dissem/apps/abit/MessageListFragment.java +++ b/app/src/main/java/ch/dissem/apps/abit/MessageListFragment.java @@ -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; diff --git a/app/src/main/java/ch/dissem/apps/abit/listeners/ActionBarListener.java b/app/src/main/java/ch/dissem/apps/abit/listener/ActionBarListener.java similarity index 94% rename from app/src/main/java/ch/dissem/apps/abit/listeners/ActionBarListener.java rename to app/src/main/java/ch/dissem/apps/abit/listener/ActionBarListener.java index 11b309a..7dfcdf2 100644 --- a/app/src/main/java/ch/dissem/apps/abit/listeners/ActionBarListener.java +++ b/app/src/main/java/ch/dissem/apps/abit/listener/ActionBarListener.java @@ -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. diff --git a/app/src/main/java/ch/dissem/apps/abit/listeners/ListSelectionListener.java b/app/src/main/java/ch/dissem/apps/abit/listener/ListSelectionListener.java similarity index 95% rename from app/src/main/java/ch/dissem/apps/abit/listeners/ListSelectionListener.java rename to app/src/main/java/ch/dissem/apps/abit/listener/ListSelectionListener.java index 6e050a3..03fdc19 100644 --- a/app/src/main/java/ch/dissem/apps/abit/listeners/ListSelectionListener.java +++ b/app/src/main/java/ch/dissem/apps/abit/listener/ListSelectionListener.java @@ -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 diff --git a/app/src/main/java/ch/dissem/apps/abit/listeners/MessageListener.java b/app/src/main/java/ch/dissem/apps/abit/listener/MessageListener.java similarity index 54% rename from app/src/main/java/ch/dissem/apps/abit/listeners/MessageListener.java rename to app/src/main/java/ch/dissem/apps/abit/listener/MessageListener.java index 104ef70..edf17b3 100644 --- a/app/src/main/java/ch/dissem/apps/abit/listeners/MessageListener.java +++ b/app/src/main/java/ch/dissem/apps/abit/listener/MessageListener.java @@ -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; *

*/ 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 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); - } - } - 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.multiNotification(unacknowledged, numberOfUnacknowledgedMessages); } - - 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; diff --git a/app/src/main/java/ch/dissem/apps/abit/notification/AbstractNotification.java b/app/src/main/java/ch/dissem/apps/abit/notification/AbstractNotification.java new file mode 100644 index 0000000..60bb86d --- /dev/null +++ b/app/src/main/java/ch/dissem/apps/abit/notification/AbstractNotification.java @@ -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()); + } +} diff --git a/app/src/main/java/ch/dissem/apps/abit/notification/NetworkNotification.java b/app/src/main/java/ch/dissem/apps/abit/notification/NetworkNotification.java new file mode 100644 index 0000000..b51cc47 --- /dev/null +++ b/app/src/main/java/ch/dissem/apps/abit/notification/NetworkNotification.java @@ -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; + } +} diff --git a/app/src/main/java/ch/dissem/apps/abit/notification/NewMessageNotification.java b/app/src/main/java/ch/dissem/apps/abit/notification/NewMessageNotification.java new file mode 100644 index 0000000..ee10bf1 --- /dev/null +++ b/app/src/main/java/ch/dissem/apps/abit/notification/NewMessageNotification.java @@ -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; + } +} diff --git a/app/src/main/java/ch/dissem/apps/abit/repositories/AndroidAddressRepository.java b/app/src/main/java/ch/dissem/apps/abit/repository/AndroidAddressRepository.java similarity index 99% rename from app/src/main/java/ch/dissem/apps/abit/repositories/AndroidAddressRepository.java rename to app/src/main/java/ch/dissem/apps/abit/repository/AndroidAddressRepository.java index 6dee3d0..9d490df 100644 --- a/app/src/main/java/ch/dissem/apps/abit/repositories/AndroidAddressRepository.java +++ b/app/src/main/java/ch/dissem/apps/abit/repository/AndroidAddressRepository.java @@ -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; diff --git a/app/src/main/java/ch/dissem/apps/abit/repositories/AndroidInventory.java b/app/src/main/java/ch/dissem/apps/abit/repository/AndroidInventory.java similarity index 98% rename from app/src/main/java/ch/dissem/apps/abit/repositories/AndroidInventory.java rename to app/src/main/java/ch/dissem/apps/abit/repository/AndroidInventory.java index cafb76b..32b9ed8 100644 --- a/app/src/main/java/ch/dissem/apps/abit/repositories/AndroidInventory.java +++ b/app/src/main/java/ch/dissem/apps/abit/repository/AndroidInventory.java @@ -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; /** diff --git a/app/src/main/java/ch/dissem/apps/abit/repositories/AndroidMessageRepository.java b/app/src/main/java/ch/dissem/apps/abit/repository/AndroidMessageRepository.java similarity index 99% rename from app/src/main/java/ch/dissem/apps/abit/repositories/AndroidMessageRepository.java rename to app/src/main/java/ch/dissem/apps/abit/repository/AndroidMessageRepository.java index 30bacb8..eba1b0d 100644 --- a/app/src/main/java/ch/dissem/apps/abit/repositories/AndroidMessageRepository.java +++ b/app/src/main/java/ch/dissem/apps/abit/repository/AndroidMessageRepository.java @@ -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. diff --git a/app/src/main/java/ch/dissem/apps/abit/repositories/SqlHelper.java b/app/src/main/java/ch/dissem/apps/abit/repository/SqlHelper.java similarity index 96% rename from app/src/main/java/ch/dissem/apps/abit/repositories/SqlHelper.java rename to app/src/main/java/ch/dissem/apps/abit/repository/SqlHelper.java index 0d8abfd..f79bbb2 100644 --- a/app/src/main/java/ch/dissem/apps/abit/repositories/SqlHelper.java +++ b/app/src/main/java/ch/dissem/apps/abit/repository/SqlHelper.java @@ -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. diff --git a/app/src/main/java/ch/dissem/apps/abit/service/Singleton.java b/app/src/main/java/ch/dissem/apps/abit/service/Singleton.java index e16b235..220dc36 100644 --- a/app/src/main/java/ch/dissem/apps/abit/service/Singleton.java +++ b/app/src/main/java/ch/dissem/apps/abit/service/Singleton.java @@ -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; diff --git a/app/src/main/java/ch/dissem/apps/abit/utils/Assets.java b/app/src/main/java/ch/dissem/apps/abit/util/Assets.java similarity index 98% rename from app/src/main/java/ch/dissem/apps/abit/utils/Assets.java rename to app/src/main/java/ch/dissem/apps/abit/util/Assets.java index 71fe65b..e3e2dc6 100644 --- a/app/src/main/java/ch/dissem/apps/abit/utils/Assets.java +++ b/app/src/main/java/ch/dissem/apps/abit/util/Assets.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package ch.dissem.apps.abit.utils; +package ch.dissem.apps.abit.util; import android.content.Context; diff --git a/app/src/main/java/ch/dissem/apps/abit/utils/Drawables.java b/app/src/main/java/ch/dissem/apps/abit/util/Drawables.java similarity index 65% rename from app/src/main/java/ch/dissem/apps/abit/utils/Drawables.java rename to app/src/main/java/ch/dissem/apps/abit/util/Drawables.java index d646608..e392e36 100644 --- a/app/src/main/java/ch/dissem/apps/abit/utils/Drawables.java +++ b/app/src/main/java/ch/dissem/apps/abit/util/Drawables.java @@ -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; + } } diff --git a/app/src/main/res/drawable-hdpi/ic_action_close.png b/app/src/main/res/drawable-hdpi/ic_action_close.png deleted file mode 100644 index 7031319..0000000 Binary files a/app/src/main/res/drawable-hdpi/ic_action_close.png and /dev/null differ diff --git a/app/src/main/res/drawable-hdpi/ic_action_delete.png b/app/src/main/res/drawable-hdpi/ic_action_delete.png deleted file mode 100755 index d912755..0000000 Binary files a/app/src/main/res/drawable-hdpi/ic_action_delete.png and /dev/null differ diff --git a/app/src/main/res/drawable-hdpi/ic_action_mark_unread.png b/app/src/main/res/drawable-hdpi/ic_action_mark_unread.png deleted file mode 100644 index c9ce724..0000000 Binary files a/app/src/main/res/drawable-hdpi/ic_action_mark_unread.png and /dev/null differ diff --git a/app/src/main/res/drawable-hdpi/ic_action_placeholder.png b/app/src/main/res/drawable-hdpi/ic_action_placeholder.png deleted file mode 100644 index cde7713..0000000 Binary files a/app/src/main/res/drawable-hdpi/ic_action_placeholder.png and /dev/null differ diff --git a/app/src/main/res/drawable-hdpi/ic_action_reply.png b/app/src/main/res/drawable-hdpi/ic_action_reply.png deleted file mode 100755 index 7414772..0000000 Binary files a/app/src/main/res/drawable-hdpi/ic_action_reply.png and /dev/null differ diff --git a/app/src/main/res/drawable-hdpi/ic_action_send.png b/app/src/main/res/drawable-hdpi/ic_action_send.png deleted file mode 100644 index e6c165d..0000000 Binary files a/app/src/main/res/drawable-hdpi/ic_action_send.png and /dev/null differ diff --git a/app/src/main/res/drawable-hdpi/ic_fab_compose_message.png b/app/src/main/res/drawable-hdpi/ic_fab_compose_message.png deleted file mode 100644 index 4c86788..0000000 Binary files a/app/src/main/res/drawable-hdpi/ic_fab_compose_message.png and /dev/null differ diff --git a/app/src/main/res/drawable-hdpi/ic_notification_new_message.png b/app/src/main/res/drawable-hdpi/ic_notification_new_message.png deleted file mode 100644 index 096746b..0000000 Binary files a/app/src/main/res/drawable-hdpi/ic_notification_new_message.png and /dev/null differ diff --git a/app/src/main/res/drawable-hdpi/ic_plus_sign.png b/app/src/main/res/drawable-hdpi/ic_plus_sign.png deleted file mode 100755 index 54aef05..0000000 Binary files a/app/src/main/res/drawable-hdpi/ic_plus_sign.png and /dev/null differ diff --git a/app/src/main/res/drawable-mdpi/ic_action_close.png b/app/src/main/res/drawable-mdpi/ic_action_close.png deleted file mode 100644 index c71f1c4..0000000 Binary files a/app/src/main/res/drawable-mdpi/ic_action_close.png and /dev/null differ diff --git a/app/src/main/res/drawable-mdpi/ic_action_delete.png b/app/src/main/res/drawable-mdpi/ic_action_delete.png deleted file mode 100755 index 864553a..0000000 Binary files a/app/src/main/res/drawable-mdpi/ic_action_delete.png and /dev/null differ diff --git a/app/src/main/res/drawable-mdpi/ic_action_mark_unread.png b/app/src/main/res/drawable-mdpi/ic_action_mark_unread.png deleted file mode 100644 index f74f84a..0000000 Binary files a/app/src/main/res/drawable-mdpi/ic_action_mark_unread.png and /dev/null differ diff --git a/app/src/main/res/drawable-mdpi/ic_action_placeholder.png b/app/src/main/res/drawable-mdpi/ic_action_placeholder.png deleted file mode 100644 index 6fd4dcd..0000000 Binary files a/app/src/main/res/drawable-mdpi/ic_action_placeholder.png and /dev/null differ diff --git a/app/src/main/res/drawable-mdpi/ic_action_reply.png b/app/src/main/res/drawable-mdpi/ic_action_reply.png deleted file mode 100755 index a25803b..0000000 Binary files a/app/src/main/res/drawable-mdpi/ic_action_reply.png and /dev/null differ diff --git a/app/src/main/res/drawable-mdpi/ic_action_send.png b/app/src/main/res/drawable-mdpi/ic_action_send.png deleted file mode 100644 index ca5ad5c..0000000 Binary files a/app/src/main/res/drawable-mdpi/ic_action_send.png and /dev/null differ diff --git a/app/src/main/res/drawable-mdpi/ic_fab_compose_message.png b/app/src/main/res/drawable-mdpi/ic_fab_compose_message.png deleted file mode 100644 index ea4de02..0000000 Binary files a/app/src/main/res/drawable-mdpi/ic_fab_compose_message.png and /dev/null differ diff --git a/app/src/main/res/drawable-mdpi/ic_notification_new_message.png b/app/src/main/res/drawable-mdpi/ic_notification_new_message.png deleted file mode 100644 index 456614b..0000000 Binary files a/app/src/main/res/drawable-mdpi/ic_notification_new_message.png and /dev/null differ diff --git a/app/src/main/res/drawable-mdpi/ic_plus_sign.png b/app/src/main/res/drawable-mdpi/ic_plus_sign.png deleted file mode 100755 index 7284077..0000000 Binary files a/app/src/main/res/drawable-mdpi/ic_plus_sign.png and /dev/null differ diff --git a/app/src/main/res/drawable-xhdpi/ic_action_close.png b/app/src/main/res/drawable-xhdpi/ic_action_close.png deleted file mode 100644 index 2eb9589..0000000 Binary files a/app/src/main/res/drawable-xhdpi/ic_action_close.png and /dev/null differ diff --git a/app/src/main/res/drawable-xhdpi/ic_action_delete.png b/app/src/main/res/drawable-xhdpi/ic_action_delete.png deleted file mode 100755 index 37e9c21..0000000 Binary files a/app/src/main/res/drawable-xhdpi/ic_action_delete.png and /dev/null differ diff --git a/app/src/main/res/drawable-xhdpi/ic_action_mark_unread.png b/app/src/main/res/drawable-xhdpi/ic_action_mark_unread.png deleted file mode 100644 index 35083d1..0000000 Binary files a/app/src/main/res/drawable-xhdpi/ic_action_mark_unread.png and /dev/null differ diff --git a/app/src/main/res/drawable-xhdpi/ic_action_placeholder.png b/app/src/main/res/drawable-xhdpi/ic_action_placeholder.png deleted file mode 100644 index ae7c98f..0000000 Binary files a/app/src/main/res/drawable-xhdpi/ic_action_placeholder.png and /dev/null differ diff --git a/app/src/main/res/drawable-xhdpi/ic_action_reply.png b/app/src/main/res/drawable-xhdpi/ic_action_reply.png deleted file mode 100755 index 8b1d033..0000000 Binary files a/app/src/main/res/drawable-xhdpi/ic_action_reply.png and /dev/null differ diff --git a/app/src/main/res/drawable-xhdpi/ic_action_send.png b/app/src/main/res/drawable-xhdpi/ic_action_send.png deleted file mode 100644 index 04daa14..0000000 Binary files a/app/src/main/res/drawable-xhdpi/ic_action_send.png and /dev/null differ diff --git a/app/src/main/res/drawable-xhdpi/ic_fab_compose_message.png b/app/src/main/res/drawable-xhdpi/ic_fab_compose_message.png deleted file mode 100644 index af0217a..0000000 Binary files a/app/src/main/res/drawable-xhdpi/ic_fab_compose_message.png and /dev/null differ diff --git a/app/src/main/res/drawable-xhdpi/ic_notification_new_message.png b/app/src/main/res/drawable-xhdpi/ic_notification_new_message.png deleted file mode 100644 index 5621edb..0000000 Binary files a/app/src/main/res/drawable-xhdpi/ic_notification_new_message.png and /dev/null differ diff --git a/app/src/main/res/drawable-xhdpi/ic_plus_sign.png b/app/src/main/res/drawable-xhdpi/ic_plus_sign.png deleted file mode 100755 index d320ebf..0000000 Binary files a/app/src/main/res/drawable-xhdpi/ic_plus_sign.png and /dev/null differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_action_close.png b/app/src/main/res/drawable-xxhdpi/ic_action_close.png deleted file mode 100644 index 76de2b1..0000000 Binary files a/app/src/main/res/drawable-xxhdpi/ic_action_close.png and /dev/null differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_action_delete.png b/app/src/main/res/drawable-xxhdpi/ic_action_delete.png deleted file mode 100755 index ef8e4bb..0000000 Binary files a/app/src/main/res/drawable-xxhdpi/ic_action_delete.png and /dev/null differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_action_mark_unread.png b/app/src/main/res/drawable-xxhdpi/ic_action_mark_unread.png deleted file mode 100644 index 968b849..0000000 Binary files a/app/src/main/res/drawable-xxhdpi/ic_action_mark_unread.png and /dev/null differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_action_placeholder.png b/app/src/main/res/drawable-xxhdpi/ic_action_placeholder.png deleted file mode 100644 index 55f33b9..0000000 Binary files a/app/src/main/res/drawable-xxhdpi/ic_action_placeholder.png and /dev/null differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_action_reply.png b/app/src/main/res/drawable-xxhdpi/ic_action_reply.png deleted file mode 100755 index 15a3089..0000000 Binary files a/app/src/main/res/drawable-xxhdpi/ic_action_reply.png and /dev/null differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_action_send.png b/app/src/main/res/drawable-xxhdpi/ic_action_send.png deleted file mode 100644 index d36f994..0000000 Binary files a/app/src/main/res/drawable-xxhdpi/ic_action_send.png and /dev/null differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_fab_compose_message.png b/app/src/main/res/drawable-xxhdpi/ic_fab_compose_message.png deleted file mode 100644 index 40ae82a..0000000 Binary files a/app/src/main/res/drawable-xxhdpi/ic_fab_compose_message.png and /dev/null differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_notification_new_message.png b/app/src/main/res/drawable-xxhdpi/ic_notification_new_message.png deleted file mode 100644 index 2b218df..0000000 Binary files a/app/src/main/res/drawable-xxhdpi/ic_notification_new_message.png and /dev/null differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_plus_sign.png b/app/src/main/res/drawable-xxhdpi/ic_plus_sign.png deleted file mode 100755 index 24e567d..0000000 Binary files a/app/src/main/res/drawable-xxhdpi/ic_plus_sign.png and /dev/null differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_action_delete.png b/app/src/main/res/drawable-xxxhdpi/ic_action_delete.png deleted file mode 100755 index b664828..0000000 Binary files a/app/src/main/res/drawable-xxxhdpi/ic_action_delete.png and /dev/null differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_action_reply.png b/app/src/main/res/drawable-xxxhdpi/ic_action_reply.png deleted file mode 100755 index 2f08cc8..0000000 Binary files a/app/src/main/res/drawable-xxxhdpi/ic_action_reply.png and /dev/null differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_plus_sign.png b/app/src/main/res/drawable-xxxhdpi/ic_plus_sign.png deleted file mode 100755 index 491d801..0000000 Binary files a/app/src/main/res/drawable-xxxhdpi/ic_plus_sign.png and /dev/null differ diff --git a/app/src/main/res/drawable/ic_action_archive.xml b/app/src/main/res/drawable/ic_action_archive.xml new file mode 100644 index 0000000..899700e --- /dev/null +++ b/app/src/main/res/drawable/ic_action_archive.xml @@ -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> diff --git a/app/src/main/res/drawable/ic_action_close.xml b/app/src/main/res/drawable/ic_action_close.xml new file mode 100644 index 0000000..a9f3069 --- /dev/null +++ b/app/src/main/res/drawable/ic_action_close.xml @@ -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> diff --git a/app/src/main/res/drawable/ic_action_compose_message.xml b/app/src/main/res/drawable/ic_action_compose_message.xml new file mode 100644 index 0000000..fc450f7 --- /dev/null +++ b/app/src/main/res/drawable/ic_action_compose_message.xml @@ -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> diff --git a/app/src/main/res/drawable/ic_action_delete.xml b/app/src/main/res/drawable/ic_action_delete.xml new file mode 100644 index 0000000..d555d63 --- /dev/null +++ b/app/src/main/res/drawable/ic_action_delete.xml @@ -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> diff --git a/app/src/main/res/drawable/ic_action_mark_unread.xml b/app/src/main/res/drawable/ic_action_mark_unread.xml new file mode 100644 index 0000000..d07b8cd --- /dev/null +++ b/app/src/main/res/drawable/ic_action_mark_unread.xml @@ -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> diff --git a/app/src/main/res/drawable/ic_action_reply.xml b/app/src/main/res/drawable/ic_action_reply.xml new file mode 100644 index 0000000..1cfa52c --- /dev/null +++ b/app/src/main/res/drawable/ic_action_reply.xml @@ -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> diff --git a/app/src/main/res/drawable/ic_action_send.xml b/app/src/main/res/drawable/ic_action_send.xml new file mode 100644 index 0000000..121d6e8 --- /dev/null +++ b/app/src/main/res/drawable/ic_action_send.xml @@ -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> diff --git a/app/src/main/res/drawable/ic_notification_full_node.xml b/app/src/main/res/drawable/ic_notification_full_node.xml new file mode 100644 index 0000000..4790d6e --- /dev/null +++ b/app/src/main/res/drawable/ic_notification_full_node.xml @@ -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> diff --git a/app/src/main/res/drawable/ic_notification_new_message.xml b/app/src/main/res/drawable/ic_notification_new_message.xml new file mode 100644 index 0000000..395fdb0 --- /dev/null +++ b/app/src/main/res/drawable/ic_notification_new_message.xml @@ -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> diff --git a/app/src/main/res/layout/fragment_message_list.xml b/app/src/main/res/layout/fragment_message_list.xml index cd73e5b..ba540ad 100644 --- a/app/src/main/res/layout/fragment_message_list.xml +++ b/app/src/main/res/layout/fragment_message_list.xml @@ -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" diff --git a/app/src/main/res/layout/fragment_subscribtions.xml b/app/src/main/res/layout/fragment_subscribtions.xml index cd73e5b..ba540ad 100644 --- a/app/src/main/res/layout/fragment_subscribtions.xml +++ b/app/src/main/res/layout/fragment_subscribtions.xml @@ -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" diff --git a/app/src/main/res/layout/toolbar_layout.xml b/app/src/main/res/layout/toolbar_layout.xml index 049a0b0..ade8b53 100644 --- a/app/src/main/res/layout/toolbar_layout.xml +++ b/app/src/main/res/layout/toolbar_layout.xml @@ -1,34 +1,33 @@ <?xml version="1.0" encoding="utf-8"?> -<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" - android:fitsSystemWindows="true"> +<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" + android:fitsSystemWindows="true"> <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" - tools:context=".MessageListActivity" - tools:layout="@android:layout/list_content" - app:layout_behavior="@string/appbar_scrolling_view_behavior" /> + xmlns:tools="http://schemas.android.com/tools" + 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" /> <android.support.design.widget.AppBarLayout - android:layout_width="match_parent" - android:layout_height="wrap_content"> + android:layout_width="match_parent" + android:layout_height="wrap_content"> <android.support.v7.widget.Toolbar - android:id="@+id/toolbar" - android:layout_width="match_parent" - android:layout_height="?attr/actionBarSize" - 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"/> + android:id="@+id/toolbar" + android:layout_width="match_parent" + android:layout_height="?attr/actionBarSize" + android:background="?attr/colorPrimary" + android:elevation="4dp" + android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" + app:layout_scrollFlags="scroll|enterAlways" + app:popupTheme="@style/ThemeOverlay.AppCompat.Light" /> </android.support.design.widget.AppBarLayout> diff --git a/app/src/main/res/menu/message.xml b/app/src/main/res/menu/message.xml index aee2121..dc31fc3 100644 --- a/app/src/main/res/menu/message.xml +++ b/app/src/main/res/menu/message.xml @@ -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> \ No newline at end of file diff --git a/app/src/main/res/menu/message_list.xml b/app/src/main/res/menu/message_list.xml index 75f182b..295a7e1 100644 --- a/app/src/main/res/menu/message_list.xml +++ b/app/src/main/res/menu/message_list.xml @@ -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> \ No newline at end of file diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 43a43cc..28b28b6 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -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> \ No newline at end of file diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index 8cbeca3..eb1f6e8 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -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> diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index adf6794..727b3eb 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -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> diff --git a/build.gradle b/build.gradle index 37a428b..8eb7947 100644 --- a/build.gradle +++ b/build.gradle @@ -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