diff --git a/app/build.gradle b/app/build.gradle
index be506a6..4e7094f 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -3,7 +3,7 @@ apply plugin: 'com.android.application'
android {
compileSdkVersion 23
- buildToolsVersion "23.0.1"
+ buildToolsVersion "23.0.2"
defaultConfig {
applicationId "ch.dissem.apps.abit"
@@ -22,9 +22,9 @@ android {
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
- 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 'com.android.support:appcompat-v7:23.1.1'
+ compile 'com.android.support:support-v4:23.1.1'
+ compile 'com.android.support:design:23.1.1'
compile 'ch.dissem.jabit:jabit-domain:0.2.1-SNAPSHOT'
compile 'ch.dissem.jabit:jabit-networking:0.2.1-SNAPSHOT'
@@ -38,7 +38,7 @@ dependencies {
compile 'com.mikepenz:iconics:1.6.2@aar'
compile 'com.mikepenz:community-material-typeface:1.1.71@aar'
}
-
+5
idea.module {
downloadJavadoc = true
downloadSources = true
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 c43ae5f..6ca9ce0 100644
--- a/app/src/main/java/ch/dissem/apps/abit/MessageDetailFragment.java
+++ b/app/src/main/java/ch/dissem/apps/abit/MessageDetailFragment.java
@@ -3,21 +3,36 @@ package ch.dissem.apps.abit;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
-import android.view.*;
+import android.text.util.Linkify;
+import android.text.util.Linkify.TransformFilter;
+import android.util.Patterns;
+import android.view.LayoutInflater;
+import android.view.Menu;
+import android.view.MenuInflater;
+import android.view.MenuItem;
+import android.view.View;
+import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
+import com.mikepenz.google_material_typeface_library.GoogleMaterial;
+
+import java.util.Iterator;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
import ch.dissem.apps.abit.service.Singleton;
import ch.dissem.apps.abit.util.Drawables;
-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 ch.dissem.bitmessage.ports.MessageRepository;
-import com.mikepenz.google_material_typeface_library.GoogleMaterial;
-
-import java.util.Iterator;
+import static android.text.util.Linkify.ALL;
+import static android.text.util.Linkify.EMAIL_ADDRESSES;
+import static android.text.util.Linkify.WEB_URLS;
+import static ch.dissem.apps.abit.util.Constants.BITMESSAGE_ADDRESS_PATTERN;
+import static ch.dissem.apps.abit.util.Constants.BITMESSAGE_URL_SCHEMA;
/**
@@ -75,7 +90,19 @@ public class MessageDetailFragment extends Fragment {
} else if (item.getType() == Plaintext.Type.BROADCAST) {
((TextView) rootView.findViewById(R.id.recipient)).setText(R.string.broadcast);
}
- ((TextView) rootView.findViewById(R.id.text)).setText(item.getText());
+ TextView messageBody = (TextView) rootView.findViewById(R.id.text);
+ messageBody.setText(item.getText());
+
+ Linkify.addLinks(messageBody, WEB_URLS);
+ Linkify.addLinks(messageBody, BITMESSAGE_ADDRESS_PATTERN, BITMESSAGE_URL_SCHEMA, null,
+ new TransformFilter() {
+ public final String transformUrl(final Matcher match, String url) {
+ return match.group();
+ }
+ });
+
+ messageBody.setLinksClickable(true);
+ messageBody.setTextIsSelectable(true);
}
boolean removed = false;
diff --git a/app/src/main/java/ch/dissem/apps/abit/OpenBitmessageLinkActivity.java b/app/src/main/java/ch/dissem/apps/abit/OpenBitmessageLinkActivity.java
index 17ffe41..732ee2e 100644
--- a/app/src/main/java/ch/dissem/apps/abit/OpenBitmessageLinkActivity.java
+++ b/app/src/main/java/ch/dissem/apps/abit/OpenBitmessageLinkActivity.java
@@ -71,7 +71,6 @@ public class OpenBitmessageLinkActivity extends AppCompatActivity {
final TextView addressView = (TextView) findViewById(R.id.address);
final EditText label = (EditText) findViewById(R.id.label);
- final Switch importContact = (Switch) findViewById(R.id.import_contact);
final Switch subscribe = (Switch) findViewById(R.id.subscribe);
Uri uri = getIntent().getData();
@@ -83,7 +82,6 @@ public class OpenBitmessageLinkActivity extends AppCompatActivity {
label.setText(parameter.substring(parameter.indexOf('=') + 1).trim());
} else if (name.startsWith("action")) {
parameter = parameter.toLowerCase();
- importContact.setChecked(parameter.contains("add"));
subscribe.setChecked(parameter.contains("subscribe"));
}
}
@@ -107,26 +105,21 @@ public class OpenBitmessageLinkActivity extends AppCompatActivity {
bmAddress.setAlias(label.getText().toString());
final int what;
- if (subscribe.isChecked() && importContact.isChecked())
+ if (subscribe.isChecked())
what = MSG_SUBSCRIBE_AND_ADD_CONTACT;
- else if (subscribe.isChecked())
- what = MSG_SUBSCRIBE;
- else if (importContact.isChecked())
- what = MSG_ADD_CONTACT;
else
- what = 0;
+ what = MSG_ADD_CONTACT;
- if (what != 0) {
- try {
- Message message = Message.obtain(null, what);
- Bundle bundle = new Bundle();
- bundle.putSerializable(DATA_FIELD_ADDRESS, bmAddress);
- message.setData(bundle);
- service.send(message);
- } catch (RemoteException e) {
- LOG.error(e.getMessage(), e);
- }
+ try {
+ Message message = Message.obtain(null, what);
+ Bundle bundle = new Bundle();
+ bundle.putSerializable(DATA_FIELD_ADDRESS, bmAddress);
+ message.setData(bundle);
+ service.send(message);
+ } catch (RemoteException e) {
+ LOG.error(e.getMessage(), e);
}
+
setResult(Activity.RESULT_OK);
finish();
}
diff --git a/app/src/main/java/ch/dissem/apps/abit/util/Constants.java b/app/src/main/java/ch/dissem/apps/abit/util/Constants.java
new file mode 100644
index 0000000..436dd6c
--- /dev/null
+++ b/app/src/main/java/ch/dissem/apps/abit/util/Constants.java
@@ -0,0 +1,11 @@
+package ch.dissem.apps.abit.util;
+
+import java.util.regex.Pattern;
+
+/**
+ * Created by chrigu on 16.11.15.
+ */
+public class Constants {
+ public static final String BITMESSAGE_URL_SCHEMA = "bitmessage:";
+ public static final Pattern BITMESSAGE_ADDRESS_PATTERN = Pattern.compile("\\bBM-[a-zA-Z0-9]+\\b");
+}
diff --git a/app/src/main/res/layout/activity_open_bitmessage_link.xml b/app/src/main/res/layout/activity_open_bitmessage_link.xml
index fedbd9d..5f973d2 100644
--- a/app/src/main/res/layout/activity_open_bitmessage_link.xml
+++ b/app/src/main/res/layout/activity_open_bitmessage_link.xml
@@ -26,20 +26,11 @@
-
-
-
-
diff --git a/build.gradle b/build.gradle
index 8eb7947..7acef02 100644
--- a/build.gradle
+++ b/build.gradle
@@ -9,7 +9,7 @@ buildscript {
jcenter()
}
dependencies {
- classpath 'com.android.tools.build:gradle:1.4.+'
+ classpath 'com.android.tools.build:gradle:1.5.0-beta1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index 179dd79..07fc193 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-2.5-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-2.8-all.zip