mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-12 18:59:06 +01:00
Compare commits
63 Commits
hash-trees
...
1233-remot
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d9c32d900d | ||
|
|
da29c001d0 | ||
|
|
e7df7810a6 | ||
|
|
82258a21ab | ||
|
|
ecc73b95e3 | ||
|
|
6985f2d31a | ||
|
|
b0b233d3dd | ||
|
|
1135b984f7 | ||
|
|
0d75636720 | ||
|
|
66c667e553 | ||
|
|
9e8c75fe10 | ||
|
|
8317f9fdcf | ||
|
|
9fde41cc46 | ||
|
|
98add37b8d | ||
|
|
924ba38dae | ||
|
|
c6fb695b3c | ||
|
|
1e22e6819f | ||
|
|
6c0ef388fa | ||
|
|
ef1bcd1299 | ||
|
|
87b1c36d02 | ||
|
|
f88b176632 | ||
|
|
030036bceb | ||
|
|
c373aab555 | ||
|
|
aa1fd4e84a | ||
|
|
a3fbe3abda | ||
|
|
8bdd7bc595 | ||
|
|
2d9b6302d3 | ||
|
|
5bf0103859 | ||
|
|
1799cfae89 | ||
|
|
f7013dfcb2 | ||
|
|
dd92ec8394 | ||
|
|
bbc6907c1d | ||
|
|
ace2ea3c5b | ||
|
|
101b600f0e | ||
|
|
2546f8c2f8 | ||
|
|
416f023fb4 | ||
|
|
a8080ad84b | ||
|
|
cdf4f3a24b | ||
|
|
fb1d8e860f | ||
|
|
a3c526ec9a | ||
|
|
dee488d06d | ||
|
|
b29c7d8022 | ||
|
|
0725d207ec | ||
|
|
5a7599a88d | ||
|
|
59cd98db81 | ||
|
|
768488eb04 | ||
|
|
a6b1ad48c3 | ||
|
|
77299a68ed | ||
|
|
5e5705c73b | ||
|
|
e6229a3a13 | ||
|
|
5fbacb4ee4 | ||
|
|
c7f4e976ed | ||
|
|
419f2d966a | ||
|
|
d6c18db9e9 | ||
|
|
8fe49d9961 | ||
|
|
f536cfdab8 | ||
|
|
4d594acad5 | ||
|
|
800dfed5c1 | ||
|
|
54b823e401 | ||
|
|
52ec56d690 | ||
|
|
7b3afcca99 | ||
|
|
a22d03d028 | ||
|
|
d857338ad0 |
@@ -13,6 +13,8 @@ import java.util.Collection;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import static org.briarproject.bramble.api.contact.PendingContact.PendingContactState.FAILED;
|
||||
|
||||
@NotNullByDefault
|
||||
public interface ContactManager {
|
||||
|
||||
@@ -52,6 +54,35 @@ public interface ContactManager {
|
||||
long timestamp, boolean alice, boolean verified, boolean active)
|
||||
throws DbException;
|
||||
|
||||
/**
|
||||
* Returns the static link that needs to be sent to the contact to be added.
|
||||
*/
|
||||
String getRemoteContactLink();
|
||||
|
||||
/**
|
||||
* Returns true if the given link is syntactically valid.
|
||||
*/
|
||||
boolean isValidRemoteContactLink(String link);
|
||||
|
||||
/**
|
||||
* Requests a new contact to be added via the given {@code link}.
|
||||
*
|
||||
* @param link The link received from the contact we want to add.
|
||||
* @param alias The alias the user has given this contact.
|
||||
* @return A PendingContact representing the contact to be added.
|
||||
*/
|
||||
PendingContact addRemoteContactRequest(String link, String alias);
|
||||
|
||||
/**
|
||||
* Returns a list of {@link PendingContact}s.
|
||||
*/
|
||||
Collection<PendingContact> getPendingContacts();
|
||||
|
||||
/**
|
||||
* Removes a {@link PendingContact} that is in state {@link FAILED}.
|
||||
*/
|
||||
void removePendingContact(PendingContact pendingContact);
|
||||
|
||||
/**
|
||||
* Returns the contact with the given ID.
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
package org.briarproject.bramble.api.contact;
|
||||
|
||||
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
||||
|
||||
import javax.annotation.concurrent.Immutable;
|
||||
|
||||
@Immutable
|
||||
@NotNullByDefault
|
||||
public class PendingContact {
|
||||
|
||||
public enum PendingContactState {
|
||||
WAITING_FOR_CONNECTION,
|
||||
CONNECTED,
|
||||
ADDING_CONTACT,
|
||||
FAILED
|
||||
}
|
||||
|
||||
private final PendingContactId id;
|
||||
private final String alias;
|
||||
private final PendingContactState state;
|
||||
private final long timestamp;
|
||||
|
||||
public PendingContact(PendingContactId id, String alias,
|
||||
PendingContactState state, long timestamp) {
|
||||
this.id = id;
|
||||
this.alias = alias;
|
||||
this.state = state;
|
||||
this.timestamp = timestamp;
|
||||
}
|
||||
|
||||
public String getAlias() {
|
||||
return alias;
|
||||
}
|
||||
|
||||
public PendingContactState getState() {
|
||||
return state;
|
||||
}
|
||||
|
||||
public long getTimestamp() {
|
||||
return timestamp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return id.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
return o instanceof PendingContact &&
|
||||
id.equals(((PendingContact) o).id);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package org.briarproject.bramble.api.contact;
|
||||
|
||||
import org.briarproject.bramble.api.UniqueId;
|
||||
|
||||
public class PendingContactId extends UniqueId {
|
||||
|
||||
public PendingContactId(byte[] id) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package org.briarproject.bramble.api.contact.event;
|
||||
|
||||
import org.briarproject.bramble.api.contact.PendingContact.PendingContactState;
|
||||
import org.briarproject.bramble.api.contact.PendingContactId;
|
||||
import org.briarproject.bramble.api.event.Event;
|
||||
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
||||
|
||||
import javax.annotation.concurrent.Immutable;
|
||||
|
||||
/**
|
||||
* An event that is broadcast when a pending contact's state is changed.
|
||||
*/
|
||||
@Immutable
|
||||
@NotNullByDefault
|
||||
public class PendingContactStateChangedEvent extends Event {
|
||||
|
||||
private final PendingContactId id;
|
||||
private final PendingContactState state;
|
||||
|
||||
public PendingContactStateChangedEvent(PendingContactId id,
|
||||
PendingContactState state) {
|
||||
this.id = id;
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
public PendingContactId getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public PendingContactState getPendingContactState() {
|
||||
return state;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -153,4 +153,15 @@ public class StringUtils {
|
||||
return new String(c);
|
||||
}
|
||||
|
||||
|
||||
public static String getRandomBase32String(int length) {
|
||||
char[] c = new char[length];
|
||||
for (int i = 0; i < length; i++) {
|
||||
int character = random.nextInt(32);
|
||||
if (character < 26) c[i] = (char) ('a' + character);
|
||||
else c[i] = (char) ('2' + (character - 26));
|
||||
}
|
||||
return new String(c);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@ package org.briarproject.bramble.contact;
|
||||
import org.briarproject.bramble.api.contact.Contact;
|
||||
import org.briarproject.bramble.api.contact.ContactId;
|
||||
import org.briarproject.bramble.api.contact.ContactManager;
|
||||
import org.briarproject.bramble.api.contact.PendingContact;
|
||||
import org.briarproject.bramble.api.contact.PendingContactId;
|
||||
import org.briarproject.bramble.api.crypto.SecretKey;
|
||||
import org.briarproject.bramble.api.db.DatabaseComponent;
|
||||
import org.briarproject.bramble.api.db.DbException;
|
||||
@@ -19,12 +21,16 @@ import org.briarproject.bramble.api.transport.KeyManager;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import javax.annotation.concurrent.ThreadSafe;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import static java.util.Collections.emptyList;
|
||||
import static org.briarproject.bramble.api.contact.PendingContact.PendingContactState.WAITING_FOR_CONNECTION;
|
||||
import static org.briarproject.bramble.api.identity.AuthorConstants.MAX_AUTHOR_NAME_LENGTH;
|
||||
import static org.briarproject.bramble.api.identity.AuthorInfo.Status.OURSELVES;
|
||||
import static org.briarproject.bramble.api.identity.AuthorInfo.Status.UNKNOWN;
|
||||
@@ -36,6 +42,12 @@ import static org.briarproject.bramble.util.StringUtils.toUtf8;
|
||||
@NotNullByDefault
|
||||
class ContactManagerImpl implements ContactManager {
|
||||
|
||||
private static final int LINK_LENGTH = 64;
|
||||
private static final String REMOTE_CONTACT_LINK =
|
||||
"briar://" + getRandomBase32String(LINK_LENGTH);
|
||||
private static final Pattern LINK_REGEX =
|
||||
Pattern.compile("(briar://)?([a-z2-7]{" + LINK_LENGTH + "})");
|
||||
|
||||
private final DatabaseComponent db;
|
||||
private final KeyManager keyManager;
|
||||
private final IdentityManager identityManager;
|
||||
@@ -84,6 +96,48 @@ class ContactManagerImpl implements ContactManager {
|
||||
verified, active));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRemoteContactLink() {
|
||||
// TODO replace with real implementation
|
||||
return REMOTE_CONTACT_LINK;
|
||||
}
|
||||
|
||||
@SuppressWarnings("SameParameterValue")
|
||||
private static String getRandomBase32String(int length) {
|
||||
Random random = new Random();
|
||||
char[] c = new char[length];
|
||||
for (int i = 0; i < length; i++) {
|
||||
int character = random.nextInt(32);
|
||||
if (character < 26) c[i] = (char) ('a' + character);
|
||||
else c[i] = (char) ('2' + (character - 26));
|
||||
}
|
||||
return new String(c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValidRemoteContactLink(String link) {
|
||||
return LINK_REGEX.matcher(link).matches();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PendingContact addRemoteContactRequest(String link, String alias) {
|
||||
// TODO replace with real implementation
|
||||
PendingContactId id = new PendingContactId(link.getBytes());
|
||||
return new PendingContact(id, alias, WAITING_FOR_CONNECTION,
|
||||
System.currentTimeMillis());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<PendingContact> getPendingContacts() {
|
||||
// TODO replace with real implementation
|
||||
return emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removePendingContact(PendingContact pendingContact) {
|
||||
// TODO replace with real implementation
|
||||
}
|
||||
|
||||
@Override
|
||||
public Contact getContact(ContactId c) throws DbException {
|
||||
return db.transactionWithResult(true, txn -> db.getContact(txn, c));
|
||||
|
||||
59
briar-android/artwork/ic_link_down.svg
Normal file
59
briar-android/artwork/ic_link_down.svg
Normal file
@@ -0,0 +1,59 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
style="width:24px;height:24px"
|
||||
viewBox="0 0 24 24"
|
||||
version="1.1"
|
||||
id="svg4"
|
||||
sodipodi:docname="ic_link_down.svg"
|
||||
inkscape:version="0.92.3 (2405546, 2018-03-11)">
|
||||
<metadata
|
||||
id="metadata10">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<defs
|
||||
id="defs8" />
|
||||
<sodipodi:namedview
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1"
|
||||
objecttolerance="10"
|
||||
gridtolerance="10"
|
||||
guidetolerance="10"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="1020"
|
||||
id="namedview6"
|
||||
showgrid="false"
|
||||
inkscape:zoom="13.906433"
|
||||
inkscape:cx="5.1490538"
|
||||
inkscape:cy="22.945407"
|
||||
inkscape:window-x="1440"
|
||||
inkscape:window-y="24"
|
||||
inkscape:window-maximized="0"
|
||||
inkscape:current-layer="svg4" />
|
||||
<path
|
||||
fill="#000000"
|
||||
d="M16,6H13V7.9H16C18.26,7.9 20.1,9.73 20.1,12A4.1,4.1 0 0,1 16,16.1H13V18H16A6,6 0 0,0 22,12C22,8.68 19.31,6 16,6M3.9,12C3.9,9.73 5.74,7.9 8,7.9H11V6H8A6,6 0 0,0 2,12A6,6 0 0,0 8,18H11V16.1H8C5.74,16.1 3.9,14.26 3.9,12M8,13H16V11H8V13Z"
|
||||
id="path2" />
|
||||
<path
|
||||
id="path884"
|
||||
d="m 21.659779,17.473157 h -2.295918 v 3.061224 H 17.51182 l 3.000001,3 2.999999,-3 h -1.852041 z"
|
||||
inkscape:connector-curvature="0"
|
||||
style="fill:#000000;stroke-width:0.38265303" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.0 KiB |
58
briar-android/artwork/ic_link_up.svg
Normal file
58
briar-android/artwork/ic_link_up.svg
Normal file
@@ -0,0 +1,58 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
style="width:24px;height:24px"
|
||||
viewBox="0 0 24 24"
|
||||
version="1.1"
|
||||
id="svg4"
|
||||
sodipodi:docname="ic_link_up.svg"
|
||||
inkscape:version="0.92.3 (2405546, 2018-03-11)">
|
||||
<metadata
|
||||
id="metadata10">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<defs
|
||||
id="defs8" />
|
||||
<sodipodi:namedview
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1"
|
||||
objecttolerance="10"
|
||||
gridtolerance="10"
|
||||
guidetolerance="10"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="1020"
|
||||
id="namedview6"
|
||||
showgrid="false"
|
||||
inkscape:zoom="13.906433"
|
||||
inkscape:cx="5.1490538"
|
||||
inkscape:cy="22.945407"
|
||||
inkscape:window-x="1440"
|
||||
inkscape:window-y="24"
|
||||
inkscape:window-maximized="0"
|
||||
inkscape:current-layer="svg4" />
|
||||
<path
|
||||
fill="#000000"
|
||||
d="M16,6H13V7.9H16C18.26,7.9 20.1,9.73 20.1,12A4.1,4.1 0 0,1 16,16.1H13V18H16A6,6 0 0,0 22,12C22,8.68 19.31,6 16,6M3.9,12C3.9,9.73 5.74,7.9 8,7.9H11V6H8A6,6 0 0,0 2,12A6,6 0 0,0 8,18H11V16.1H8C5.74,16.1 3.9,14.26 3.9,12M8,13H16V11H8V13Z"
|
||||
id="path2" />
|
||||
<path
|
||||
id="path884"
|
||||
d="M 21.659779,23.534381 H 19.363861 V 20.473157 H 17.51182 l 3.000001,-3 2.999999,3 h -1.852041 z"
|
||||
inkscape:connector-curvature="0"
|
||||
style="fill:#000000;stroke-width:0.38265303" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.9 KiB |
57
briar-android/artwork/ic_nearby.svg
Normal file
57
briar-android/artwork/ic_nearby.svg
Normal file
@@ -0,0 +1,57 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
version="1.1"
|
||||
id="svg12"
|
||||
sodipodi:docname="nearby.svg"
|
||||
style="fill:none"
|
||||
inkscape:version="0.92.3 (2405546, 2018-03-11)">
|
||||
<metadata
|
||||
id="metadata18">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<defs
|
||||
id="defs16" />
|
||||
<sodipodi:namedview
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1"
|
||||
objecttolerance="10"
|
||||
gridtolerance="10"
|
||||
guidetolerance="10"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="1020"
|
||||
id="namedview14"
|
||||
showgrid="false"
|
||||
inkscape:zoom="15.170655"
|
||||
inkscape:cx="9.6488139"
|
||||
inkscape:cy="11.430963"
|
||||
inkscape:window-x="1440"
|
||||
inkscape:window-y="24"
|
||||
inkscape:window-maximized="0"
|
||||
inkscape:current-layer="svg12" />
|
||||
<path
|
||||
style="opacity:1;fill:#110000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1.37658679px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||
d="M 11.173062,2.4030645 C 9.9685672,2.4471125 8.7753453,2.7130268 7.6640583,3.2033016 8.187015,3.7262611 8.3967456,4.1446273 8.6059301,4.5629964 11.639055,3.412486 15.091396,4.0393524 17.497058,6.4449696 c 0.732151,0.7321412 1.359335,1.5691523 1.673062,2.5104781 0.418424,-0.2091845 0.941213,-0.3133673 1.464151,-0.3133672 h 0.104456 C 20.215788,7.3869735 19.482978,6.3401088 18.541616,5.2941863 16.528265,3.2807917 13.82295,2.3061587 11.173062,2.4030645 Z M 5.1695142,3.2316286 A 2.7193895,2.7193895 0 0 0 2.4501247,5.9510181 2.7193895,2.7193895 0 0 0 5.1695142,8.6704075 2.7193895,2.7193895 0 0 0 7.8889037,5.9510181 2.7193895,2.7193895 0 0 0 5.1695142,3.2316286 Z M 2.5404169,8.5358543 C 0.97153856,12.196552 1.7027262,16.484811 4.6313017,19.413413 c 1.8826514,1.987239 4.497171,2.930071 7.0073853,2.930071 2.510177,0 5.126431,-0.942832 7.009154,-2.930071 0.941272,-0.941362 1.672402,-2.091035 2.195341,-3.346124 h -0.104455 c -0.522939,0 -1.045818,-0.104155 -1.464151,-0.313367 -0.418423,0.941362 -0.940911,1.778328 -1.673062,2.510478 -3.242327,3.242419 -8.5770829,3.242419 -11.819429,0 C 3.27188,15.858828 2.6451458,12.406442 3.795656,9.3732707 3.377287,9.164086 2.9587814,8.9542233 2.5404169,8.5358543 Z m 9.0540081,0.8444984 a 2.9913288,2.9913284 0 0 0 -2.9902654,2.9902663 2.9913288,2.9913284 0 0 0 2.9902654,2.992036 2.9913288,2.9913284 0 0 0 2.992037,-2.992036 2.9913288,2.9913284 0 0 0 -2.992037,-2.9902663 z m 9.138991,0.423134 a 2.7193895,2.7193895 0 0 0 -2.71939,2.7193903 2.7193895,2.7193895 0 0 0 2.71939,2.719389 2.7193895,2.7193895 0 0 0 2.719389,-2.719389 2.7193895,2.7193895 0 0 0 -2.719389,-2.7193903 z"
|
||||
id="path832-3-6"
|
||||
inkscape:connector-curvature="0" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 3.3 KiB |
176
briar-android/artwork/nickname.svg
Normal file
176
briar-android/artwork/nickname.svg
Normal file
@@ -0,0 +1,176 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="150"
|
||||
height="178"
|
||||
viewBox="0 0 150 178"
|
||||
fill="none"
|
||||
version="1.1"
|
||||
id="svg129"
|
||||
sodipodi:docname="nickname.svg"
|
||||
inkscape:version="0.92.3 (2405546, 2018-03-11)">
|
||||
<metadata
|
||||
id="metadata133">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<sodipodi:namedview
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1"
|
||||
objecttolerance="10"
|
||||
gridtolerance="10"
|
||||
guidetolerance="10"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="1020"
|
||||
id="namedview131"
|
||||
showgrid="false"
|
||||
inkscape:zoom="3.7500494"
|
||||
inkscape:cx="84.461975"
|
||||
inkscape:cy="96.344913"
|
||||
inkscape:window-x="1440"
|
||||
inkscape:window-y="24"
|
||||
inkscape:window-maximized="0"
|
||||
inkscape:current-layer="svg129" />
|
||||
<path
|
||||
d="M 85.1905,0.127869 3.35693,0.328805 C 2.46521,0.330621 1.6107,0.690255 0.981217,1.32866 0.351735,1.96706 -0.0011965,2.83198 3.04782e-6,3.73331 L 0.372743,156.201 c 0.001185,0.446 0.089367,0.888 0.259505,1.3 0.170138,0.412 0.418902,0.786 0.732092,1.101 0.31319,0.315 0.68466,0.564 1.09322,0.734 0.40856,0.17 0.84619,0.257 1.28792,0.256 l 81.83362,-0.201 c 0.8917,-0.003 1.746,-0.363 2.375,-1.002 0.6291,-0.639 0.9814,-1.504 0.9796,-2.405 L 88.5542,3.51639 C 88.5512,2.61665 88.1955,1.75479 87.565,1.11965 86.9345,0.484503 86.0807,0.127864 85.1905,0.127869 Z"
|
||||
id="path2"
|
||||
inkscape:connector-curvature="0"
|
||||
style="display:inline;opacity:0.25;fill:url(#paint0_linear)" />
|
||||
<path
|
||||
d="M 84.2815,-0.0019907 4.27572,0.195606 C 2.57395,0.199809 1.19777,1.59763 1.20193,3.31772 L 1.56691,154.298 c 0.00416,1.72 1.38709,3.111 3.08885,3.107 l 80.00584,-0.198 c 1.7017,-0.004 3.0779,-1.402 3.0737,-3.122 L 87.3704,3.1049 C 87.3662,1.38481 85.9833,-0.0061937 84.2815,-0.0019907 Z"
|
||||
id="path4"
|
||||
inkscape:connector-curvature="0"
|
||||
style="display:inline;opacity:0.25;fill:#6d6d6d;fill-opacity:0.7" />
|
||||
<path
|
||||
style="display:inline;opacity:0.25;fill:#646464"
|
||||
d="M 81.939453 3.9570312 L 65.933594 3.9960938 C 65.688694 5.6638138 64.861562 7.1881588 63.601562 8.2929688 C 62.341563 9.3977688 60.732453 10.010031 59.064453 10.019531 L 29.302734 10.091797 C 27.634734 10.090597 26.021259 9.4871919 24.755859 8.3886719 C 23.490459 7.2901519 22.655444 5.7700256 22.402344 4.1035156 L 6.6367188 4.1425781 C 5.7689587 4.1449981 4.9382819 4.4954875 4.3261719 5.1171875 C 3.7140519 5.7388975 3.3712469 6.5799313 3.3730469 7.4570312 L 3.4609375 44.068359 L 3.7167969 150.16797 C 3.7209769 151.04497 4.0691969 151.88495 4.6855469 152.50195 C 5.3018969 153.11895 6.1361462 153.46394 7.0039062 153.46094 L 82.306641 153.27539 C 83.171641 153.27039 83.999475 152.92078 84.609375 152.30078 C 85.219375 151.68078 85.560547 150.8408 85.560547 149.9668 L 85.306641 43.5625 L 85.220703 7.2558594 C 85.218303 6.3787594 84.870959 5.5386319 84.255859 4.9199219 C 83.640859 4.3012219 82.807253 3.9552112 81.939453 3.9570312 z M 52.652344 5.7910156 L 34.357422 6.0683594 C 34.107922 6.0721494 33.908409 6.27906 33.912109 6.53125 L 33.916016 6.8300781 C 33.919716 7.0822681 34.1255 7.28504 34.375 7.28125 L 52.671875 7.0019531 C 52.921375 6.9981731 53.118934 6.7912525 53.115234 6.5390625 L 53.111328 6.2402344 C 53.107628 5.9880444 52.901844 5.7872256 52.652344 5.7910156 z "
|
||||
id="path6" />
|
||||
<path
|
||||
d="M 57.2036,6.934 C 57.6016,6.92797 57.9193,6.59699 57.9133,6.19476 57.9074,5.79252 57.5799,5.47134 57.182,5.47738 c -0.398,0.00604 -0.7157,0.33701 -0.7098,0.73924 0.006,0.40224 0.3335,0.72342 0.7314,0.71738 z"
|
||||
id="path10"
|
||||
inkscape:connector-curvature="0"
|
||||
style="opacity:0.25;fill:#dbdbdb" />
|
||||
<path
|
||||
style="display:inline;opacity:0.25;fill:#e0e0e0"
|
||||
d="m 17.640625,19.458984 c -4.1846,0 -7.576172,3.445513 -7.576172,7.695313 0,4.2498 3.391572,7.695312 7.576172,7.695312 4.1845,0 7.576172,-3.445512 7.576172,-7.695312 0,-4.2498 -3.391672,-7.695313 -7.576172,-7.695313 z m 19.882813,4.177735 v 3.234375 h 40.117187 v -3.234375 z m 0,6.466797 v 3.234375 H 77.640625 V 30.103516 Z M 17.640625,44.087891 c -4.1846,0 -7.576172,3.443559 -7.576172,7.693359 0,4.2498 3.391572,7.695313 7.576172,7.695312 4.1845,0 7.576172,-3.445512 7.576172,-7.695312 0,-4.2498 -3.391672,-7.693359 -7.576172,-7.693359 z m 19.882813,4.177734 V 51.5 h 40.117187 v -3.234375 z m 0,6.466797 v 3.232422 H 77.640625 V 54.732422 Z M 17.640625,68.714844 c -4.1846,0 -7.576172,3.445512 -7.576172,7.695312 0,4.2498 3.391572,7.695313 7.576172,7.695313 4.1845,0 7.576172,-3.445513 7.576172,-7.695313 0,-4.2498 -3.391672,-7.695312 -7.576172,-7.695312 z m 19.882813,4.179687 v 3.232422 h 40.117187 v -3.232422 z m 0,6.466797 V 82.59375 H 77.640625 V 79.361328 Z M 17.640625,93.34375 c -4.1846,0 -7.576172,3.445613 -7.576172,7.69531 0,4.25 3.391572,7.69532 7.576172,7.69532 4.1845,0 7.576172,-3.44532 7.576172,-7.69532 0,-4.249698 -3.391672,-7.69531 -7.576172,-7.69531 z m 19.882813,4.179688 v 3.232422 h 40.117187 v -3.232422 z m 0,6.464842 v 3.23438 h 40.117187 v -3.23438 z m -19.882813,13.98438 c -4.1846,0 -7.576172,3.44631 -7.576172,7.69531 0,4.25 3.391572,7.69336 7.576172,7.69336 4.1845,0 7.576172,-3.44336 7.576172,-7.69336 0,-4.249 -3.391672,-7.69531 -7.576172,-7.69531 z m 19.882813,4.17773 v 3.23438 h 40.117187 v -3.23438 z m 0,6.4668 v 3.23437 h 40.117187 v -3.23437 z"
|
||||
id="path12"
|
||||
inkscape:connector-curvature="0" />
|
||||
<path
|
||||
style="display:inline;fill:#313131"
|
||||
inkscape:connector-curvature="0"
|
||||
id="path44"
|
||||
d="m 136.95,18.4066 -80.0056,0.1976 c -1.7018,0.0042 -3.078,1.402 -3.0738,3.1221 l 0.365,150.9807 c 0.0041,1.72 1.3871,3.111 3.0888,3.107 l 80.0056,-0.198 c 1.702,-0.004 3.078,-1.402 3.074,-3.122 L 140.039,21.5135 c -0.004,-1.7201 -1.387,-3.1111 -3.089,-3.1069 z" />
|
||||
<path
|
||||
style="display:inline;fill:#3e3e3e"
|
||||
d="M 134.60938 22.357422 L 118.59961 22.394531 C 118.35561 24.062231 117.52758 25.586606 116.26758 26.691406 C 115.00758 27.796206 113.39847 28.408469 111.73047 28.417969 L 81.96875 28.492188 C 80.30065 28.490987 78.689228 27.885609 77.423828 26.787109 C 76.158428 25.688609 75.323313 24.168453 75.070312 22.501953 L 59.304688 22.541016 C 58.436887 22.543416 57.604288 22.893925 56.992188 23.515625 C 56.380088 24.137325 56.037262 24.980322 56.039062 25.857422 L 56.128906 62.46875 L 56.748047 62.466797 L 56.128906 62.470703 L 56.382812 168.57031 C 56.385213 169.44731 56.732656 170.28725 57.347656 170.90625 C 57.962756 171.52425 58.796362 171.87114 59.664062 171.86914 L 134.9668 171.68359 C 135.8348 171.68159 136.66534 171.33098 137.27734 170.70898 C 137.88934 170.08798 138.23247 169.24614 138.23047 168.36914 L 137.97266 62.21875 L 137.97461 62.21875 L 137.88867 25.65625 C 137.88667 24.77915 137.54078 23.939012 136.92578 23.320312 C 136.31078 22.701612 135.47738 22.355522 134.60938 22.357422 z "
|
||||
id="path46" />
|
||||
<path
|
||||
style="display:inline;fill:#e0e0e0"
|
||||
d="M 109.84961 23.890625 C 109.45161 23.896725 109.13462 24.228559 109.14062 24.630859 C 109.14663 25.033059 109.47309 25.353756 109.87109 25.347656 C 110.26909 25.341656 110.58608 25.009622 110.58008 24.607422 C 110.57408 24.205222 110.24761 23.884625 109.84961 23.890625 z M 105.32031 24.201172 L 87.025391 24.478516 C 86.775891 24.482316 86.576378 24.691159 86.580078 24.943359 L 86.583984 25.242188 C 86.587684 25.494387 86.793469 25.695206 87.042969 25.691406 L 105.33984 25.414062 C 105.58884 25.410363 105.7872 25.203372 105.7832 24.951172 L 105.7793 24.650391 C 105.7753 24.398191 105.56931 24.197372 105.32031 24.201172 z M 63.365234 37.568359 L 63.365234 53.738281 L 79.365234 53.738281 L 79.365234 37.568359 L 63.365234 37.568359 z M 86.748047 37.568359 L 86.748047 40.800781 L 126.86523 40.800781 L 126.86523 37.568359 L 86.748047 37.568359 z M 86.748047 44.037109 L 86.748047 47.269531 L 126.86523 47.269531 L 126.86523 44.037109 L 86.748047 44.037109 z M 71.787109 112.99609 C 67.602609 112.99609 64.210937 116.44141 64.210938 120.69141 C 64.210938 124.94141 67.602609 128.38672 71.787109 128.38672 C 75.971709 128.38672 79.365234 124.94141 79.365234 120.69141 C 79.365234 116.44141 75.971709 112.99609 71.787109 112.99609 z M 86.748047 116.92773 L 86.748047 120.16016 L 126.86523 120.16016 L 126.86523 116.92773 L 86.748047 116.92773 z M 86.748047 123.39258 L 86.748047 126.62695 L 126.86523 126.62695 L 126.86523 123.39258 L 86.748047 123.39258 z M 71.787109 142.60156 C 67.602609 142.60156 64.210937 146.04687 64.210938 150.29688 C 64.210938 154.54688 67.602609 157.99023 71.787109 157.99023 C 75.971709 157.99023 79.365234 154.54688 79.365234 150.29688 C 79.365234 146.04688 75.971709 142.60156 71.787109 142.60156 z M 86.748047 145.53516 L 86.748047 148.76758 L 126.86523 148.76758 L 126.86523 145.53516 L 86.748047 145.53516 z M 86.748047 152.00195 L 86.748047 155.23438 L 126.86523 155.23438 L 126.86523 152.00195 L 86.748047 152.00195 z "
|
||||
id="path50" />
|
||||
<path
|
||||
style="display:inline;fill:#d5d6d7"
|
||||
inkscape:connector-curvature="0"
|
||||
id="path56"
|
||||
d="M 148.744,68.6655 H 45.619 v 33.5835 h 103.125 z" />
|
||||
<path
|
||||
style="display:inline;fill:#87c214"
|
||||
d="m 97.822266,50.503906 v 5.722656 h 17.966794 v -5.722656 z m -11.074219,30.59961 v 3.232422 h 40.117183 v -3.232422 z m 0,6.46875 v 3.232422 h 40.117183 v -3.232422 z"
|
||||
id="path58"
|
||||
inkscape:connector-curvature="0" />
|
||||
<path
|
||||
style="display:inline;fill:#f5f5f5"
|
||||
inkscape:connector-curvature="0"
|
||||
id="path68"
|
||||
d="m 66.8652,92.3143 c 4.1846,0 7.5768,-3.4451 7.5768,-7.695 0,-4.2498 -3.3922,-7.6949 -7.5768,-7.6949 -4.1846,0 -7.5768,3.4451 -7.5768,7.6949 0,4.2499 3.3922,7.695 7.5768,7.695 z" />
|
||||
<path
|
||||
style="display:inline;fill:#87c214"
|
||||
inkscape:connector-curvature="0"
|
||||
id="path70"
|
||||
d="m 70.1296,90.0058 h -6.5738 c -0.3153,0.0024 -0.6253,0.0818 -0.9038,0.2312 -0.2784,0.1495 -0.5171,0.3647 -0.6956,0.6274 1.4766,0.8563 3.1474,1.3114 4.8498,1.321 1.7023,0.0096 3.3781,-0.4266 4.864,-1.2662 -0.1666,-0.265 -0.3932,-0.486 -0.6612,-0.6448 -0.2679,-0.1588 -0.5693,-0.2509 -0.8794,-0.2686 z" />
|
||||
<path
|
||||
style="display:inline;fill:#333333"
|
||||
d="m 66.861328,80.746094 c -2.0798,0 -3.765625,1.70444 -3.765625,3.80664 0,0.393506 0.07586,0.766 0.185547,1.123047 -0.327549,0.812667 -0.821888,1.878261 -1.158203,1.708985 0,0 5.069822,4.4252 9.544922,0 -0.355198,-0.613452 -0.773279,-1.18389 -1.21875,-1.732422 0.10502,-0.350063 0.177734,-0.714879 0.177734,-1.09961 0,-2.1022 -1.685825,-3.80664 -3.765625,-3.80664 z"
|
||||
id="path72"
|
||||
inkscape:connector-curvature="0" />
|
||||
<path
|
||||
style="display:inline;fill:#fda57d"
|
||||
d="m 66.861328,81.570312 c -1.800651,0 -3.302121,1.279176 -3.673828,2.986329 -0.0049,-3.79e-4 -0.0088,-0.0059 -0.01367,-0.0059 -0.1933,0 -0.349609,0.297063 -0.349609,0.664063 0,0.347156 0.141531,0.622551 0.320312,0.652344 0.180942,1.407599 1.108928,2.5691 2.38086,3.058593 v 0.732422 c 0,0.3234 0.127315,0.634681 0.353515,0.863281 0.2263,0.2287 0.533616,0.357422 0.853516,0.357422 h 0.224609 c 0.1588,3e-4 0.316091,-0.03245 0.462891,-0.09375 0.1467,-0.0613 0.280278,-0.150172 0.392578,-0.263672 0.1123,-0.1135 0.201119,-0.248084 0.261719,-0.396484 0.0606,-0.1483 0.0921,-0.30825 0.0918,-0.46875 v -0.720703 c 1.288752,-0.483775 2.232282,-1.654559 2.412109,-3.076172 0.168226,-0.0485 0.298828,-0.311757 0.298828,-0.644531 0,-0.363137 -0.153161,-0.655938 -0.34375,-0.66211 -0.373249,-1.705035 -1.87271,-2.982422 -3.671875,-2.982422 z"
|
||||
id="path78"
|
||||
inkscape:connector-curvature="0" />
|
||||
<path
|
||||
style="display:inline;fill:#333333"
|
||||
inkscape:connector-curvature="0"
|
||||
id="path84"
|
||||
d="m 63.2529,83.9344 h 7.1792 c 0,0 -0.6122,-2.9296 -3.3275,-2.7401 -2.7154,0.1895 -3.8517,2.7401 -3.8517,2.7401 z" />
|
||||
<defs
|
||||
id="defs127">
|
||||
<linearGradient
|
||||
id="paint0_linear"
|
||||
x1="10.0511"
|
||||
y1="162.566"
|
||||
x2="80.1467"
|
||||
y2="-2.31086"
|
||||
gradientUnits="userSpaceOnUse">
|
||||
<stop
|
||||
stop-color="#808080"
|
||||
stop-opacity="0.25"
|
||||
id="stop110" />
|
||||
<stop
|
||||
offset="0.54"
|
||||
stop-color="#808080"
|
||||
stop-opacity="0.12"
|
||||
id="stop112" />
|
||||
<stop
|
||||
offset="1"
|
||||
stop-color="#808080"
|
||||
stop-opacity="0.1"
|
||||
id="stop114" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
id="paint1_linear"
|
||||
x1="45488.3"
|
||||
y1="16529.6"
|
||||
x2="45488.3"
|
||||
y2="10752.2"
|
||||
gradientUnits="userSpaceOnUse">
|
||||
<stop
|
||||
stop-color="#808080"
|
||||
stop-opacity="0.25"
|
||||
id="stop117" />
|
||||
<stop
|
||||
offset="0.54"
|
||||
stop-color="#808080"
|
||||
stop-opacity="0.12"
|
||||
id="stop119" />
|
||||
<stop
|
||||
offset="1"
|
||||
stop-color="#808080"
|
||||
stop-opacity="0.1"
|
||||
id="stop121" />
|
||||
</linearGradient>
|
||||
<clipPath
|
||||
id="clip0">
|
||||
<rect
|
||||
width="150"
|
||||
height="178"
|
||||
fill="white"
|
||||
id="rect124" />
|
||||
</clipPath>
|
||||
</defs>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 13 KiB |
@@ -2,6 +2,70 @@ apply plugin: 'com.android.application'
|
||||
apply plugin: 'witness'
|
||||
apply from: 'witness.gradle'
|
||||
|
||||
// prototype
|
||||
repositories {
|
||||
maven { url 'https://jitpack.io' }
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation project(path: ':briar-core', configuration: 'default')
|
||||
implementation project(path: ':bramble-core', configuration: 'default')
|
||||
implementation project(':bramble-android')
|
||||
|
||||
def supportVersion = '28.0.0'
|
||||
implementation "com.android.support:support-v4:$supportVersion"
|
||||
implementation("com.android.support:appcompat-v7:$supportVersion") {
|
||||
exclude module: 'support-v4'
|
||||
}
|
||||
implementation("com.android.support:preference-v14:$supportVersion") {
|
||||
exclude module: 'support-v4'
|
||||
}
|
||||
implementation("com.android.support:design:$supportVersion") {
|
||||
exclude module: 'support-v4'
|
||||
exclude module: 'recyclerview-v7'
|
||||
}
|
||||
implementation "com.android.support:cardview-v7:$supportVersion"
|
||||
implementation "com.android.support:support-annotations:$supportVersion"
|
||||
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
|
||||
|
||||
implementation('ch.acra:acra:4.9.1') {
|
||||
exclude module: 'support-v4'
|
||||
exclude module: 'support-annotations'
|
||||
}
|
||||
implementation 'info.guardianproject.panic:panic:0.5'
|
||||
implementation 'info.guardianproject.trustedintents:trustedintents:0.2'
|
||||
implementation 'de.hdodenhof:circleimageview:2.2.0'
|
||||
implementation 'com.google.zxing:core:3.3.0'
|
||||
implementation 'uk.co.samuelwall:material-tap-target-prompt:2.8.0'
|
||||
implementation 'com.vanniktech:emoji-google:0.5.1'
|
||||
|
||||
annotationProcessor 'com.google.dagger:dagger-compiler:2.0.2'
|
||||
|
||||
compileOnly 'javax.annotation:jsr250-api:1.0'
|
||||
|
||||
testImplementation project(path: ':bramble-api', configuration: 'testOutput')
|
||||
testImplementation project(path: ':bramble-core', configuration: 'testOutput')
|
||||
testImplementation 'org.robolectric:robolectric:3.8'
|
||||
testImplementation 'org.robolectric:shadows-support-v4:3.3.2'
|
||||
testImplementation 'org.mockito:mockito-core:2.13.0'
|
||||
testImplementation 'junit:junit:4.12'
|
||||
testImplementation "org.jmock:jmock:2.8.2"
|
||||
testImplementation "org.jmock:jmock-junit4:2.8.2"
|
||||
testImplementation "org.jmock:jmock-legacy:2.8.2"
|
||||
testImplementation "org.hamcrest:hamcrest-library:1.3"
|
||||
testImplementation "org.hamcrest:hamcrest-core:1.3"
|
||||
|
||||
def espressoVersion = '3.0.2'
|
||||
androidTestImplementation "com.android.support.test.espresso:espresso-core:$espressoVersion"
|
||||
androidTestImplementation "com.android.support.test.espresso:espresso-contrib:$espressoVersion"
|
||||
androidTestImplementation "com.android.support.test.espresso:espresso-intents:$espressoVersion"
|
||||
androidTestImplementation "tools.fastlane:screengrab:1.1.0"
|
||||
androidTestImplementation "com.android.support.test.uiautomator:uiautomator-v18:2.1.3"
|
||||
androidTestAnnotationProcessor "com.google.dagger:dagger-compiler:2.0.2"
|
||||
androidTestCompileOnly 'javax.annotation:jsr250-api:1.0'
|
||||
androidTestImplementation 'junit:junit:4.12'
|
||||
}
|
||||
|
||||
def getStdout = { command, defaultValue ->
|
||||
def stdout = new ByteArrayOutputStream()
|
||||
try {
|
||||
@@ -35,7 +99,7 @@ android {
|
||||
|
||||
buildTypes {
|
||||
debug {
|
||||
applicationIdSuffix ".debug"
|
||||
applicationIdSuffix ".test"
|
||||
shrinkResources false
|
||||
minifyEnabled true
|
||||
crunchPngs false
|
||||
@@ -105,6 +169,7 @@ dependencies {
|
||||
implementation "com.android.support:cardview-v7:$supportVersion"
|
||||
implementation "com.android.support:support-annotations:$supportVersion"
|
||||
implementation "com.android.support:exifinterface:$supportVersion"
|
||||
implementation "com.android.support:palette-v7:$supportVersion"
|
||||
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
|
||||
implementation "android.arch.lifecycle:extensions:1.1.1"
|
||||
|
||||
@@ -125,6 +190,9 @@ dependencies {
|
||||
}
|
||||
implementation 'com.github.chrisbanes:PhotoView:2.1.4' // later versions already use androidx
|
||||
|
||||
// prototype
|
||||
implementation "com.github.kobakei:MaterialFabSpeedDial:1.2.0"
|
||||
|
||||
annotationProcessor 'com.google.dagger:dagger-compiler:2.19'
|
||||
annotationProcessor "com.github.bumptech.glide:compiler:$glideVersion"
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="app_name" translatable="false">Briar Debug</string>
|
||||
<string name="app_package" translatable="false">org.briarproject.briar.android.debug</string>
|
||||
<string name="app_name" translatable="false">Briar Test</string>
|
||||
<string name="app_package" translatable="false">org.briarproject.briar.android.test</string>
|
||||
</resources>
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest
|
||||
package="org.briarproject.briar"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<uses-feature android:name="android.hardware.bluetooth" android:required="false"/>
|
||||
<uses-feature android:name="android.hardware.camera" android:required="false"/>
|
||||
@@ -17,6 +18,7 @@
|
||||
<uses-permission android:name="android.permission.USE_FINGERPRINT"/>
|
||||
<uses-permission android:name="android.permission.VIBRATE" />
|
||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<uses-permission-sdk-23 android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
||||
<uses-permission-sdk-23 android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS"/>
|
||||
<uses-permission-sdk-23 android:name="android.permission.USE_BIOMETRIC" />
|
||||
@@ -28,7 +30,8 @@
|
||||
android:label="@string/app_name"
|
||||
android:logo="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/BriarTheme">
|
||||
android:theme="@style/BriarTheme"
|
||||
tools:ignore="GoogleAppIndexingWarning">
|
||||
|
||||
<receiver
|
||||
android:name="org.briarproject.briar.android.login.SignInReminderReceiver"
|
||||
@@ -421,5 +424,29 @@
|
||||
android:launchMode="singleTask"
|
||||
android:theme="@style/BriarTheme.NoActionBar"/>
|
||||
|
||||
<!-- Prototype -->
|
||||
<activity
|
||||
android:name=".android.contact.ContactLinkExchangeActivity"
|
||||
android:theme="@style/BriarTheme"
|
||||
android:label="@string/add_contact_title"
|
||||
android:windowSoftInputMode="stateHidden|adjustResize">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
<data android:scheme="briar"/>
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.SEND"/>
|
||||
<category android:name="android.intent.category.DEFAULT"/>
|
||||
<data android:mimeType="text/plain"/>
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".android.contact.PendingRequestsActivity"
|
||||
android:label="@string/pending_contact_requests"
|
||||
android:theme="@style/BriarTheme"/>
|
||||
|
||||
</application>
|
||||
</manifest>
|
||||
|
||||
@@ -32,7 +32,7 @@ import org.briarproject.briar.BriarCoreModule;
|
||||
import org.briarproject.briar.android.conversation.glide.BriarModelLoader;
|
||||
import org.briarproject.briar.android.login.SignInReminderReceiver;
|
||||
import org.briarproject.briar.android.reporting.BriarReportSender;
|
||||
import org.briarproject.briar.android.view.TextInputView;
|
||||
import org.briarproject.briar.android.view.EmojiTextInputView;
|
||||
import org.briarproject.briar.api.android.AndroidNotificationManager;
|
||||
import org.briarproject.briar.api.android.DozeWatchdog;
|
||||
import org.briarproject.briar.api.android.LockManager;
|
||||
@@ -169,7 +169,7 @@ public interface AndroidComponent
|
||||
|
||||
void inject(NotificationCleanupService notificationCleanupService);
|
||||
|
||||
void inject(TextInputView textInputView);
|
||||
void inject(EmojiTextInputView textInputView);
|
||||
|
||||
void inject(BriarModelLoader briarModelLoader);
|
||||
|
||||
|
||||
@@ -30,4 +30,10 @@ public interface TestingConstants {
|
||||
long EXPIRY_DATE = IS_DEBUG_BUILD || IS_BETA_BUILD ?
|
||||
BuildConfig.BuildTimestamp + 90 * 24 * 60 * 60 * 1000L :
|
||||
Long.MAX_VALUE;
|
||||
|
||||
/**
|
||||
* Feature flag for enabling image attachments.
|
||||
*/
|
||||
boolean FEATURE_FLAG_IMAGE_ATTACHMENTS = IS_DEBUG_BUILD;
|
||||
|
||||
}
|
||||
|
||||
@@ -15,8 +15,14 @@ import org.briarproject.briar.android.blog.ReblogFragment;
|
||||
import org.briarproject.briar.android.blog.RssFeedImportActivity;
|
||||
import org.briarproject.briar.android.blog.RssFeedManageActivity;
|
||||
import org.briarproject.briar.android.blog.WriteBlogPostActivity;
|
||||
import org.briarproject.briar.android.contact.ContactLinkExchangeActivity;
|
||||
import org.briarproject.briar.android.contact.ContactLinkExchangeFragment;
|
||||
import org.briarproject.briar.android.contact.ContactListFragment;
|
||||
import org.briarproject.briar.android.contact.ContactModule;
|
||||
import org.briarproject.briar.android.contact.ContactNicknameFragment;
|
||||
import org.briarproject.briar.android.contact.ContactQrCodeInputFragment;
|
||||
import org.briarproject.briar.android.contact.ContactQrCodeOutputFragment;
|
||||
import org.briarproject.briar.android.contact.PendingRequestsActivity;
|
||||
import org.briarproject.briar.android.conversation.AliasDialogFragment;
|
||||
import org.briarproject.briar.android.conversation.ConversationActivity;
|
||||
import org.briarproject.briar.android.conversation.ImageActivity;
|
||||
@@ -171,6 +177,10 @@ public interface ActivityComponent {
|
||||
|
||||
void inject(UnlockActivity activity);
|
||||
|
||||
void inject(ContactLinkExchangeActivity activity);
|
||||
|
||||
void inject(PendingRequestsActivity activity);
|
||||
|
||||
// Fragments
|
||||
void inject(AuthorNameFragment fragment);
|
||||
|
||||
@@ -218,4 +228,12 @@ public interface ActivityComponent {
|
||||
|
||||
void inject(AliasDialogFragment aliasDialogFragment);
|
||||
|
||||
void inject(ContactLinkExchangeFragment fragment);
|
||||
|
||||
void inject(ContactNicknameFragment fragment);
|
||||
|
||||
void inject(ContactQrCodeOutputFragment fragment);
|
||||
|
||||
void inject(ContactQrCodeInputFragment fragment);
|
||||
|
||||
}
|
||||
|
||||
@@ -14,5 +14,7 @@ public interface RequestCodes {
|
||||
int REQUEST_BLUETOOTH_DISCOVERABLE = 10;
|
||||
int REQUEST_UNLOCK = 11;
|
||||
int REQUEST_KEYGUARD_UNLOCK = 12;
|
||||
int REQUEST_ATTACH_IMAGE = 13;
|
||||
int REQUEST_SAVE_ATTACHMENT = 14;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.briarproject.briar.android.blog;
|
||||
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
@@ -18,7 +19,10 @@ import org.briarproject.briar.android.controller.handler.UiExceptionHandler;
|
||||
import org.briarproject.briar.android.controller.handler.UiResultExceptionHandler;
|
||||
import org.briarproject.briar.android.fragment.BaseFragment;
|
||||
import org.briarproject.briar.android.view.TextInputView;
|
||||
import org.briarproject.briar.android.view.TextInputView.TextInputListener;
|
||||
import org.briarproject.briar.android.view.TextSendController;
|
||||
import org.briarproject.briar.android.view.TextSendController.SendListener;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import javax.inject.Inject;
|
||||
@@ -29,10 +33,11 @@ import static android.view.View.INVISIBLE;
|
||||
import static android.view.View.VISIBLE;
|
||||
import static org.briarproject.briar.android.activity.BriarActivity.GROUP_ID;
|
||||
import static org.briarproject.briar.android.blog.BasePostFragment.POST_ID;
|
||||
import static org.briarproject.briar.api.blog.BlogConstants.MAX_BLOG_POST_TEXT_LENGTH;
|
||||
|
||||
@MethodsNotNullByDefault
|
||||
@ParametersNotNullByDefault
|
||||
public class ReblogFragment extends BaseFragment implements TextInputListener {
|
||||
public class ReblogFragment extends BaseFragment implements SendListener {
|
||||
|
||||
public static final String TAG = ReblogFragment.class.getName();
|
||||
|
||||
@@ -77,7 +82,11 @@ public class ReblogFragment extends BaseFragment implements TextInputListener {
|
||||
View v = inflater.inflate(R.layout.fragment_reblog, container, false);
|
||||
ui = new ViewHolder(v);
|
||||
ui.post.setTransitionName(postId);
|
||||
ui.input.setSendButtonEnabled(false);
|
||||
TextSendController sendController =
|
||||
new TextSendController(ui.input, this, true);
|
||||
ui.input.setSendController(sendController);
|
||||
ui.input.setEnabled(false);
|
||||
ui.input.setMaxTextLength(MAX_BLOG_POST_TEXT_LENGTH);
|
||||
showProgressBar();
|
||||
|
||||
return v;
|
||||
@@ -112,16 +121,14 @@ public class ReblogFragment extends BaseFragment implements TextInputListener {
|
||||
ui.post.bindItem(item);
|
||||
ui.post.hideReblogButton();
|
||||
|
||||
ui.input.setListener(this);
|
||||
ui.input.setSendButtonEnabled(true);
|
||||
ui.input.setEnabled(true);
|
||||
ui.scrollView.post(() -> ui.scrollView.fullScroll(FOCUS_DOWN));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSendClick(String text) {
|
||||
public void onSendClick(@Nullable String text, List<Uri> imageUris) {
|
||||
ui.input.hideSoftKeyboard();
|
||||
String comment = getComment();
|
||||
feedController.repeatPost(item, comment,
|
||||
feedController.repeatPost(item, text,
|
||||
new UiExceptionHandler<DbException>(this) {
|
||||
@Override
|
||||
public void onExceptionUi(DbException exception) {
|
||||
@@ -131,12 +138,6 @@ public class ReblogFragment extends BaseFragment implements TextInputListener {
|
||||
finish();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private String getComment() {
|
||||
if (ui.input.getText().length() == 0) return null;
|
||||
return ui.input.getText().toString();
|
||||
}
|
||||
|
||||
private void showProgressBar() {
|
||||
ui.progressBar.setVisibility(VISIBLE);
|
||||
ui.input.setVisibility(GONE);
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package org.briarproject.briar.android.blog;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.MenuItem;
|
||||
import android.widget.ProgressBar;
|
||||
@@ -14,19 +14,22 @@ import org.briarproject.bramble.api.FormatException;
|
||||
import org.briarproject.bramble.api.db.DbException;
|
||||
import org.briarproject.bramble.api.identity.IdentityManager;
|
||||
import org.briarproject.bramble.api.identity.LocalAuthor;
|
||||
import org.briarproject.bramble.api.nullsafety.MethodsNotNullByDefault;
|
||||
import org.briarproject.bramble.api.nullsafety.ParametersNotNullByDefault;
|
||||
import org.briarproject.bramble.api.sync.GroupId;
|
||||
import org.briarproject.bramble.util.StringUtils;
|
||||
import org.briarproject.briar.R;
|
||||
import org.briarproject.briar.android.activity.ActivityComponent;
|
||||
import org.briarproject.briar.android.activity.BriarActivity;
|
||||
import org.briarproject.briar.android.view.TextInputView;
|
||||
import org.briarproject.briar.android.view.TextInputView.TextInputListener;
|
||||
import org.briarproject.briar.android.view.TextSendController;
|
||||
import org.briarproject.briar.android.view.TextSendController.SendListener;
|
||||
import org.briarproject.briar.api.android.AndroidNotificationManager;
|
||||
import org.briarproject.briar.api.blog.BlogManager;
|
||||
import org.briarproject.briar.api.blog.BlogPost;
|
||||
import org.briarproject.briar.api.blog.BlogPostFactory;
|
||||
|
||||
import java.security.GeneralSecurityException;
|
||||
import java.util.List;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import javax.inject.Inject;
|
||||
@@ -35,10 +38,13 @@ import static android.view.View.GONE;
|
||||
import static android.view.View.VISIBLE;
|
||||
import static java.util.logging.Level.WARNING;
|
||||
import static org.briarproject.bramble.util.LogUtils.logException;
|
||||
import static org.briarproject.bramble.util.StringUtils.isNullOrEmpty;
|
||||
import static org.briarproject.briar.api.blog.BlogConstants.MAX_BLOG_POST_TEXT_LENGTH;
|
||||
|
||||
@MethodsNotNullByDefault
|
||||
@ParametersNotNullByDefault
|
||||
public class WriteBlogPostActivity extends BriarActivity
|
||||
implements OnEditorActionListener, TextInputListener {
|
||||
implements OnEditorActionListener, SendListener {
|
||||
|
||||
private static final Logger LOG =
|
||||
Logger.getLogger(WriteBlogPostActivity.class.getName());
|
||||
@@ -58,9 +64,8 @@ public class WriteBlogPostActivity extends BriarActivity
|
||||
@Inject
|
||||
volatile BlogManager blogManager;
|
||||
|
||||
@SuppressWarnings("ConstantConditions")
|
||||
@Override
|
||||
public void onCreate(Bundle state) {
|
||||
public void onCreate(@Nullable Bundle state) {
|
||||
super.onCreate(state);
|
||||
|
||||
Intent i = getIntent();
|
||||
@@ -71,24 +76,10 @@ public class WriteBlogPostActivity extends BriarActivity
|
||||
setContentView(R.layout.activity_write_blog_post);
|
||||
|
||||
input = findViewById(R.id.textInput);
|
||||
input.setSendButtonEnabled(false);
|
||||
input.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count,
|
||||
int after) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before,
|
||||
int count) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
enableOrDisablePublishButton();
|
||||
}
|
||||
});
|
||||
input.setListener(this);
|
||||
TextSendController sendController =
|
||||
new TextSendController(input, this, false);
|
||||
input.setSendController(sendController);
|
||||
input.setMaxTextLength(MAX_BLOG_POST_TEXT_LENGTH);
|
||||
|
||||
progressBar = findViewById(R.id.progressBar);
|
||||
}
|
||||
@@ -127,18 +118,15 @@ public class WriteBlogPostActivity extends BriarActivity
|
||||
return true;
|
||||
}
|
||||
|
||||
private void enableOrDisablePublishButton() {
|
||||
input.setSendButtonEnabled(input.getText().length() > 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSendClick(String text) {
|
||||
public void onSendClick(@Nullable String text, List<Uri> imageUris) {
|
||||
if (isNullOrEmpty(text)) throw new AssertionError();
|
||||
|
||||
// hide publish button, show progress bar
|
||||
input.hideSoftKeyboard();
|
||||
input.setVisibility(GONE);
|
||||
progressBar.setVisibility(VISIBLE);
|
||||
|
||||
text = StringUtils.truncateUtf8(text, MAX_BLOG_POST_TEXT_LENGTH);
|
||||
storePost(text);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,196 @@
|
||||
package org.briarproject.briar.android.contact;
|
||||
|
||||
import android.app.AlarmManager;
|
||||
import android.app.PendingIntent;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.app.ActionBar;
|
||||
import android.view.MenuItem;
|
||||
|
||||
import org.briarproject.bramble.api.contact.ContactId;
|
||||
import org.briarproject.bramble.api.db.DbException;
|
||||
import org.briarproject.bramble.api.lifecycle.LifecycleManager;
|
||||
import org.briarproject.bramble.api.plugin.ConnectionRegistry;
|
||||
import org.briarproject.bramble.api.plugin.TorConstants;
|
||||
import org.briarproject.bramble.api.system.Clock;
|
||||
import org.briarproject.briar.R;
|
||||
import org.briarproject.briar.android.activity.ActivityComponent;
|
||||
import org.briarproject.briar.android.activity.BriarActivity;
|
||||
import org.briarproject.briar.android.fragment.BaseFragment.BaseFragmentListener;
|
||||
import org.briarproject.briar.api.messaging.MessagingManager;
|
||||
|
||||
import java.util.logging.Logger;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import static android.app.AlarmManager.ELAPSED_REALTIME;
|
||||
import static android.content.Intent.ACTION_SEND;
|
||||
import static android.content.Intent.ACTION_VIEW;
|
||||
import static android.content.Intent.EXTRA_TEXT;
|
||||
import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;
|
||||
import static android.os.SystemClock.elapsedRealtime;
|
||||
import static java.lang.String.CASE_INSENSITIVE_ORDER;
|
||||
import static java.util.Objects.requireNonNull;
|
||||
import static java.util.concurrent.TimeUnit.SECONDS;
|
||||
import static java.util.logging.Level.WARNING;
|
||||
import static org.briarproject.bramble.api.lifecycle.LifecycleManager.LifecycleState.RUNNING;
|
||||
import static org.briarproject.bramble.util.LogUtils.logException;
|
||||
import static org.briarproject.bramble.util.StringUtils.getRandomBase32String;
|
||||
|
||||
public class ContactLinkExchangeActivity extends BriarActivity implements
|
||||
BaseFragmentListener {
|
||||
|
||||
private static final Logger LOG =
|
||||
Logger.getLogger(ContactLinkExchangeActivity.class.getName());
|
||||
|
||||
static final int LINK_LENGTH = 128;
|
||||
static final Pattern LINK_REGEX =
|
||||
Pattern.compile("(briar://)?([a-z2-7]{" + LINK_LENGTH + "})");
|
||||
static final String OUR_LINK = "briar://" + getRandomBase32String(LINK_LENGTH);;
|
||||
|
||||
@Inject
|
||||
LifecycleManager lifecycleManager;
|
||||
@Inject
|
||||
MessagingManager messagingManager;
|
||||
@Inject
|
||||
ConnectionRegistry connectionRegistry;
|
||||
@Inject
|
||||
Clock clock;
|
||||
|
||||
@Override
|
||||
public void injectActivity(ActivityComponent component) {
|
||||
component.inject(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(@Nullable Bundle state) {
|
||||
super.onCreate(state);
|
||||
setContentView(R.layout.activity_fragment_container);
|
||||
|
||||
ActionBar ab = getSupportActionBar();
|
||||
if (ab != null) {
|
||||
ab.setDisplayHomeAsUpEnabled(true);
|
||||
}
|
||||
|
||||
Intent i = getIntent();
|
||||
if (i != null) {
|
||||
String action = i.getAction();
|
||||
if (ACTION_SEND.equals(action) || ACTION_VIEW.equals(action)) {
|
||||
String text = i.getStringExtra(EXTRA_TEXT);
|
||||
if (text != null) {
|
||||
showInitialFragment(
|
||||
ContactLinkExchangeFragment.newInstance(text));
|
||||
return;
|
||||
}
|
||||
String uri = i.getDataString();
|
||||
if (uri != null) {
|
||||
showInitialFragment(
|
||||
ContactLinkExchangeFragment.newInstance(uri));
|
||||
return;
|
||||
}
|
||||
} else if ("addContact".equals(action)) {
|
||||
removeFakeRequest(i.getStringExtra("name"),
|
||||
i.getLongExtra("timestamp", 0), i.getLongExtra("addAt", 0));
|
||||
setIntent(null);
|
||||
finish();
|
||||
}
|
||||
}
|
||||
if (state == null) {
|
||||
showInitialFragment(new ContactLinkExchangeFragment());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case android.R.id.home:
|
||||
onBackPressed();
|
||||
return true;
|
||||
default:
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
}
|
||||
|
||||
boolean isBriarLink(@Nullable CharSequence s) {
|
||||
return s != null && LINK_REGEX.matcher(s).matches();
|
||||
}
|
||||
|
||||
void scanCode() {
|
||||
showNextFragment(new ContactQrCodeInputFragment());
|
||||
}
|
||||
|
||||
void linkScanned(@Nullable String link) {
|
||||
// FIXME: Contact name is lost
|
||||
showNextFragment(ContactLinkExchangeFragment.newInstance(link));
|
||||
}
|
||||
|
||||
void showCode() {
|
||||
showNextFragment(new ContactQrCodeOutputFragment());
|
||||
}
|
||||
|
||||
void addFakeRequest(String name, String link) {
|
||||
|
||||
AlarmManager alarmManager =
|
||||
(AlarmManager) requireNonNull(getSystemService(ALARM_SERVICE));
|
||||
double random = getPseudoRandom(link, OUR_LINK.replace("briar://", ""));
|
||||
long m = SECONDS.toMillis(50);
|
||||
long fromNow = (long) (-m * Math.log(random));
|
||||
// it should take at least 30 seconds
|
||||
if (fromNow < SECONDS.toMillis(30)) fromNow = SECONDS.toMillis(30);
|
||||
LOG.info("Delay " + fromNow + " ms based on seed " + random);
|
||||
long triggerAt = elapsedRealtime() + fromNow;
|
||||
|
||||
long timestamp = clock.currentTimeMillis();
|
||||
try {
|
||||
messagingManager.addNewPendingContact(name, timestamp, timestamp + fromNow);
|
||||
} catch (DbException e) {
|
||||
logException(LOG, WARNING, e);
|
||||
}
|
||||
|
||||
Intent i = new Intent(this, ContactLinkExchangeActivity.class);
|
||||
i.setAction("addContact");
|
||||
i.setFlags(FLAG_ACTIVITY_NEW_TASK);
|
||||
i.putExtra("name", name);
|
||||
i.putExtra("timestamp", timestamp);
|
||||
i.putExtra("addAt", timestamp + fromNow);
|
||||
PendingIntent pendingIntent =
|
||||
PendingIntent.getActivity(this, (int) timestamp / 1000, i, 0);
|
||||
alarmManager.set(ELAPSED_REALTIME, triggerAt, pendingIntent);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a pseudo-random value greater than or equal to 0 and less than 1,
|
||||
* approximately uniformly distributed, based on the given strings. The
|
||||
* same value is returned if the strings are swapped.
|
||||
*/
|
||||
private double getPseudoRandom(String a, String b) {
|
||||
String first, second;
|
||||
if (CASE_INSENSITIVE_ORDER.compare(a, b) < 0) {
|
||||
first = a;
|
||||
second = b;
|
||||
} else {
|
||||
first = b;
|
||||
second = a;
|
||||
}
|
||||
int hash = (first + second).hashCode() & Integer.MAX_VALUE;
|
||||
return hash / (1.0 + Integer.MAX_VALUE);
|
||||
}
|
||||
|
||||
private void removeFakeRequest(String name, long timestamp, long addAt) {
|
||||
if (lifecycleManager.getLifecycleState() != RUNNING) {
|
||||
LOG.info("Lifecycle not started, not adding contact " + name);
|
||||
return;
|
||||
}
|
||||
LOG.info("Adding Contact " + name);
|
||||
try {
|
||||
ContactId c = messagingManager
|
||||
.removePendingContact(name, timestamp, addAt);
|
||||
// fake contact online status
|
||||
connectionRegistry.registerConnection(c, TorConstants.ID, true);
|
||||
} catch (DbException e) {
|
||||
logException(LOG, WARNING, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,184 @@
|
||||
package org.briarproject.briar.android.contact;
|
||||
|
||||
import android.content.ClipData;
|
||||
import android.content.ClipboardManager;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.design.widget.TextInputEditText;
|
||||
import android.support.design.widget.TextInputLayout;
|
||||
import android.support.v4.app.ShareCompat.IntentBuilder;
|
||||
import android.support.v7.widget.AppCompatImageButton;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import org.briarproject.briar.R;
|
||||
import org.briarproject.briar.android.activity.ActivityComponent;
|
||||
import org.briarproject.briar.android.fragment.BaseFragment;
|
||||
|
||||
import java.util.regex.Matcher;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import static android.content.Context.CLIPBOARD_SERVICE;
|
||||
import static android.os.Build.VERSION.SDK_INT;
|
||||
import static android.support.v4.graphics.drawable.DrawableCompat.setTint;
|
||||
import static android.support.v4.graphics.drawable.DrawableCompat.wrap;
|
||||
import static android.widget.Toast.LENGTH_SHORT;
|
||||
import static java.util.Objects.requireNonNull;
|
||||
import static org.briarproject.briar.android.contact.ContactLinkExchangeActivity.LINK_REGEX;
|
||||
import static org.briarproject.briar.android.contact.ContactLinkExchangeActivity.OUR_LINK;
|
||||
import static org.briarproject.briar.android.util.UiUtils.resolveColorAttribute;
|
||||
|
||||
public class ContactLinkExchangeFragment extends BaseFragment {
|
||||
|
||||
static final String TAG = ContactLinkExchangeFragment.class.getName();
|
||||
|
||||
static BaseFragment newInstance(@Nullable String link) {
|
||||
BaseFragment f = new ContactLinkExchangeFragment();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("link", link);
|
||||
f.setArguments(bundle);
|
||||
return f;
|
||||
}
|
||||
|
||||
private ClipboardManager clipboard;
|
||||
private TextInputLayout linkInputLayout;
|
||||
private TextInputEditText linkInput;
|
||||
|
||||
@Override
|
||||
public String getUniqueTag() {
|
||||
return TAG;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void injectFragment(ActivityComponent component) {
|
||||
component.inject(this);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater,
|
||||
@Nullable ViewGroup container,
|
||||
@Nullable Bundle savedInstanceState) {
|
||||
if (getActivity() == null || getContext() == null) return null;
|
||||
|
||||
getActivity().setTitle(R.string.add_contact_remotely_title_case);
|
||||
|
||||
View v = inflater.inflate(R.layout.fragment_contact_link_exchange,
|
||||
container, false);
|
||||
|
||||
clipboard = (ClipboardManager) requireNonNull(
|
||||
getContext().getSystemService(CLIPBOARD_SERVICE));
|
||||
|
||||
int color =
|
||||
resolveColorAttribute(getContext(), R.attr.colorControlNormal);
|
||||
|
||||
Button continueButton = v.findViewById(R.id.addButton);
|
||||
continueButton.setOnClickListener(view -> onContinueButtonClicked());
|
||||
|
||||
linkInputLayout = v.findViewById(R.id.linkInputLayout);
|
||||
linkInput = v.findViewById(R.id.linkInput);
|
||||
if (SDK_INT < 23) {
|
||||
Drawable drawable = wrap(linkInput.getCompoundDrawables()[0]);
|
||||
setTint(drawable, color);
|
||||
linkInput.setCompoundDrawables(drawable, null, null, null);
|
||||
}
|
||||
if (getArguments() != null)
|
||||
linkInput.setText(getArguments().getString("link"));
|
||||
|
||||
AppCompatImageButton pasteButton = v.findViewById(R.id.pasteButton);
|
||||
pasteButton.setOnClickListener(view -> {
|
||||
ClipData clip = clipboard.getPrimaryClip();
|
||||
if (clip != null)
|
||||
linkInput.setText(clip.getItemAt(0).getText());
|
||||
});
|
||||
|
||||
Button scanCodeButton = v.findViewById(R.id.scanCodeButton);
|
||||
scanCodeButton.setOnClickListener(view -> {
|
||||
ContactLinkExchangeActivity activity = getCastActivity();
|
||||
if (activity != null) activity.scanCode();
|
||||
});
|
||||
|
||||
TextView linkView = v.findViewById(R.id.linkView);
|
||||
linkView.setText(OUR_LINK);
|
||||
|
||||
ClipData clip = ClipData.newPlainText(
|
||||
getString(R.string.link_clip_label), OUR_LINK);
|
||||
|
||||
Button copyButton = v.findViewById(R.id.copyButton);
|
||||
copyButton.setOnClickListener(view -> {
|
||||
clipboard.setPrimaryClip(clip);
|
||||
Toast.makeText(getContext(), R.string.link_copied_toast,
|
||||
LENGTH_SHORT).show();
|
||||
});
|
||||
|
||||
Button shareButton = v.findViewById(R.id.shareButton);
|
||||
shareButton.setOnClickListener(view -> {
|
||||
IntentBuilder.from(getActivity())
|
||||
.setText(OUR_LINK)
|
||||
.setType("text/plain")
|
||||
.startChooser();
|
||||
});
|
||||
|
||||
Button showCodeButton = v.findViewById(R.id.showCodeButton);
|
||||
showCodeButton.setOnClickListener(
|
||||
view -> {
|
||||
ContactLinkExchangeActivity activity = getCastActivity();
|
||||
if (activity != null) activity.showCode();
|
||||
});
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
private ContactLinkExchangeActivity getCastActivity() {
|
||||
return (ContactLinkExchangeActivity) getActivity();
|
||||
}
|
||||
|
||||
private boolean isInputError() {
|
||||
boolean briarLink = isBriarLink(linkInput.getText());
|
||||
if (!briarLink) {
|
||||
linkInputLayout.setError(getString(R.string.invalid_link));
|
||||
linkInput.requestFocus();
|
||||
return true;
|
||||
} else linkInputLayout.setError(null);
|
||||
String link = getLink();
|
||||
boolean isOurLink = link != null && OUR_LINK.equals("briar://" + link);
|
||||
if (isOurLink) {
|
||||
linkInputLayout.setError(getString(R.string.own_link_error));
|
||||
linkInput.requestFocus();
|
||||
return true;
|
||||
} else linkInputLayout.setError(null);
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean isBriarLink(@Nullable CharSequence s) {
|
||||
ContactLinkExchangeActivity activity = getCastActivity();
|
||||
return activity != null && activity.isBriarLink(s);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private String getLink() {
|
||||
Matcher matcher = LINK_REGEX.matcher(linkInput.getText());
|
||||
if (matcher.matches()) // needs to be called before groups become available
|
||||
return matcher.group(2);
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
private void onContinueButtonClicked() {
|
||||
ContactLinkExchangeActivity activity = getCastActivity();
|
||||
if (activity == null || isInputError()) return;
|
||||
|
||||
String linkText = getLink();
|
||||
if (linkText == null) throw new AssertionError();
|
||||
|
||||
BaseFragment f = ContactNicknameFragment.newInstance(linkText);
|
||||
activity.showNextFragment(f);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,20 +2,22 @@ package org.briarproject.briar.android.contact;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.support.design.widget.FloatingActionButton;
|
||||
import android.support.design.widget.Snackbar;
|
||||
import android.support.v4.app.ActivityCompat;
|
||||
import android.support.v4.app.ActivityOptionsCompat;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v4.util.Pair;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
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.TextView;
|
||||
|
||||
import org.briarproject.bramble.api.contact.Contact;
|
||||
import org.briarproject.bramble.api.contact.ContactId;
|
||||
import org.briarproject.bramble.api.contact.ContactManager;
|
||||
import org.briarproject.bramble.api.contact.event.ContactAddedEvent;
|
||||
import org.briarproject.bramble.api.contact.event.ContactRemovedEvent;
|
||||
import org.briarproject.bramble.api.contact.event.ContactStatusChangedEvent;
|
||||
import org.briarproject.bramble.api.db.DbException;
|
||||
@@ -40,15 +42,22 @@ import org.briarproject.briar.api.client.MessageTracker.GroupCount;
|
||||
import org.briarproject.briar.api.conversation.ConversationManager;
|
||||
import org.briarproject.briar.api.conversation.ConversationMessageHeader;
|
||||
import org.briarproject.briar.api.conversation.event.ConversationMessageReceivedEvent;
|
||||
import org.briarproject.briar.api.messaging.MessagingManager;
|
||||
import org.briarproject.briar.api.messaging.MessagingManager.PendingContact;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import io.github.kobakei.materialfabspeeddial.FabSpeedDial;
|
||||
import io.github.kobakei.materialfabspeeddial.FabSpeedDial.OnMenuItemClickListener;
|
||||
|
||||
import static android.os.Build.VERSION.SDK_INT;
|
||||
import static android.support.design.widget.Snackbar.LENGTH_INDEFINITE;
|
||||
import static android.support.v4.app.ActivityOptionsCompat.makeSceneTransitionAnimation;
|
||||
import static android.support.v4.view.ViewCompat.getTransitionName;
|
||||
import static java.util.logging.Level.WARNING;
|
||||
@@ -59,7 +68,8 @@ import static org.briarproject.briar.android.conversation.ConversationActivity.C
|
||||
|
||||
@MethodsNotNullByDefault
|
||||
@ParametersNotNullByDefault
|
||||
public class ContactListFragment extends BaseFragment implements EventListener {
|
||||
public class ContactListFragment extends BaseFragment implements EventListener,
|
||||
OnMenuItemClickListener {
|
||||
|
||||
public static final String TAG = ContactListFragment.class.getName();
|
||||
private static final Logger LOG = Logger.getLogger(TAG);
|
||||
@@ -71,8 +81,13 @@ public class ContactListFragment extends BaseFragment implements EventListener {
|
||||
@Inject
|
||||
AndroidNotificationManager notificationManager;
|
||||
|
||||
// TODO remove
|
||||
@Inject
|
||||
MessagingManager messagingManager;
|
||||
|
||||
private ContactListAdapter adapter;
|
||||
private BriarRecyclerView list;
|
||||
private Snackbar snackbar;
|
||||
|
||||
// Fields that are accessed from background threads must be volatile
|
||||
@Inject
|
||||
@@ -105,7 +120,12 @@ public class ContactListFragment extends BaseFragment implements EventListener {
|
||||
|
||||
getActivity().setTitle(R.string.contact_list_button);
|
||||
|
||||
View contentView = inflater.inflate(R.layout.list, container, false);
|
||||
View contentView =
|
||||
inflater.inflate(R.layout.fragment_contact_list, container,
|
||||
false);
|
||||
|
||||
FabSpeedDial speedDialView = contentView.findViewById(R.id.speedDial);
|
||||
speedDialView.addOnMenuItemClickListener(this);
|
||||
|
||||
OnContactClickListener<ContactListItem> onContactClickListener =
|
||||
(view, item) -> {
|
||||
@@ -144,26 +164,32 @@ public class ContactListFragment extends BaseFragment implements EventListener {
|
||||
list.setEmptyText(getString(R.string.no_contacts));
|
||||
list.setEmptyAction(getString(R.string.no_contacts_action));
|
||||
|
||||
snackbar = Snackbar.make(contentView,
|
||||
R.string.pending_contact_requests_snackbar, LENGTH_INDEFINITE);
|
||||
snackbar.getView().setBackgroundResource(R.color.briar_primary);
|
||||
snackbar.setAction(R.string.show, v -> startActivity(
|
||||
new Intent(getContext(), PendingRequestsActivity.class)));
|
||||
snackbar.setActionTextColor(ContextCompat
|
||||
.getColor(getContext(), R.color.briar_button_text_positive));
|
||||
|
||||
return contentView;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
||||
inflater.inflate(R.menu.contact_list_actions, menu);
|
||||
super.onCreateOptionsMenu(menu, inflater);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
// Handle presses on the action bar items
|
||||
switch (item.getItemId()) {
|
||||
case R.id.action_add_contact:
|
||||
public void onMenuItemClick(FloatingActionButton fab, @Nullable TextView v,
|
||||
int itemId) {
|
||||
switch (itemId) {
|
||||
case R.id.action_add_contact_nearby:
|
||||
Intent intent =
|
||||
new Intent(getContext(), ContactExchangeActivity.class);
|
||||
startActivity(intent);
|
||||
return true;
|
||||
return;
|
||||
case R.id.action_add_contact_remotely:
|
||||
startActivity(new Intent(getContext(),
|
||||
ContactLinkExchangeActivity.class));
|
||||
return;
|
||||
default:
|
||||
return super.onOptionsItemSelected(item);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -175,6 +201,26 @@ public class ContactListFragment extends BaseFragment implements EventListener {
|
||||
notificationManager.clearAllIntroductionNotifications();
|
||||
loadContacts();
|
||||
list.startPeriodicUpdate();
|
||||
|
||||
// TODO remove
|
||||
checkForPendingContacts();
|
||||
}
|
||||
|
||||
// TODO remove
|
||||
private void checkForPendingContacts() {
|
||||
listener.runOnDbThread(() -> {
|
||||
try {
|
||||
Collection<PendingContact> contacts =
|
||||
messagingManager.getPendingContacts();
|
||||
if (contacts.isEmpty()) {
|
||||
runOnUiThreadUnlessDestroyed(() -> snackbar.dismiss());
|
||||
} else {
|
||||
runOnUiThreadUnlessDestroyed(() -> snackbar.show());
|
||||
}
|
||||
} catch (DbException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -250,6 +296,11 @@ public class ContactListFragment extends BaseFragment implements EventListener {
|
||||
ConversationMessageHeader h = p.getMessageHeader();
|
||||
updateItem(p.getContactId(), h);
|
||||
}
|
||||
|
||||
// TODO remove
|
||||
else if (e instanceof ContactAddedEvent) {
|
||||
checkForPendingContacts();
|
||||
}
|
||||
}
|
||||
|
||||
private void updateItem(ContactId c, ConversationMessageHeader h) {
|
||||
|
||||
@@ -0,0 +1,120 @@
|
||||
package org.briarproject.briar.android.contact;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.MainThread;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.UiThread;
|
||||
import android.support.design.widget.TextInputEditText;
|
||||
import android.support.design.widget.TextInputLayout;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
|
||||
import org.briarproject.briar.R;
|
||||
import org.briarproject.briar.android.activity.ActivityComponent;
|
||||
import org.briarproject.briar.android.fragment.BaseFragment;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import static android.os.Build.VERSION.SDK_INT;
|
||||
import static android.support.v4.graphics.drawable.DrawableCompat.setTint;
|
||||
import static android.support.v4.graphics.drawable.DrawableCompat.wrap;
|
||||
import static java.util.Objects.requireNonNull;
|
||||
import static org.briarproject.briar.android.util.UiUtils.resolveColorAttribute;
|
||||
|
||||
public class ContactNicknameFragment extends BaseFragment {
|
||||
|
||||
static final String TAG = ContactNicknameFragment.class.getName();
|
||||
|
||||
static BaseFragment newInstance(@Nullable String link) {
|
||||
BaseFragment f = new ContactNicknameFragment();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("link", link);
|
||||
f.setArguments(bundle);
|
||||
return f;
|
||||
}
|
||||
|
||||
private TextInputLayout contactNameLayout;
|
||||
private TextInputEditText contactNameInput;
|
||||
|
||||
@Nullable
|
||||
private String link;
|
||||
|
||||
@Override
|
||||
public String getUniqueTag() {
|
||||
return TAG;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void injectFragment(ActivityComponent component) {
|
||||
component.inject(this);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater,
|
||||
@Nullable ViewGroup container,
|
||||
@Nullable Bundle savedInstanceState) {
|
||||
if (getActivity() == null || getContext() == null) return null;
|
||||
|
||||
getActivity().setTitle(R.string.add_contact_remotely_title_case);
|
||||
|
||||
link = requireNonNull(getArguments()).getString("link");
|
||||
Log.e(TAG, link);
|
||||
|
||||
View v = inflater.inflate(R.layout.fragment_contact_choose_nickname,
|
||||
container, false);
|
||||
|
||||
int color =
|
||||
resolveColorAttribute(getContext(), R.attr.colorControlNormal);
|
||||
|
||||
Button addButton = v.findViewById(R.id.addButton);
|
||||
addButton.setOnClickListener(view -> onAddButtonClicked());
|
||||
|
||||
contactNameLayout = v.findViewById(R.id.contactNameLayout);
|
||||
contactNameInput = v.findViewById(R.id.contactNameInput);
|
||||
if (SDK_INT < 23) {
|
||||
Drawable drawable = wrap(contactNameInput.getCompoundDrawables()[0]);
|
||||
setTint(drawable, color);
|
||||
contactNameInput.setCompoundDrawables(drawable, null, null, null);
|
||||
}
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
private ContactLinkExchangeActivity getCastActivity() {
|
||||
return (ContactLinkExchangeActivity) getActivity();
|
||||
}
|
||||
|
||||
@MainThread
|
||||
@UiThread
|
||||
private boolean isInputError() {
|
||||
boolean validContactName = contactNameInput.getText() != null &&
|
||||
contactNameInput.getText().toString().trim().length() > 0;
|
||||
if (!validContactName) {
|
||||
contactNameLayout.setError(getString(R.string.nickname_missing));
|
||||
contactNameInput.requestFocus();
|
||||
return true;
|
||||
} else contactNameLayout.setError(null);
|
||||
return false;
|
||||
}
|
||||
|
||||
private void onAddButtonClicked() {
|
||||
ContactLinkExchangeActivity activity = getCastActivity();
|
||||
if (activity == null || isInputError()) return;
|
||||
|
||||
String name = requireNonNull(contactNameInput.getText()).toString();
|
||||
if (link == null) throw new AssertionError();
|
||||
|
||||
activity.addFakeRequest(name, link);
|
||||
|
||||
Intent intent = new Intent(activity, PendingRequestsActivity.class);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,185 @@
|
||||
package org.briarproject.briar.android.contact;
|
||||
|
||||
import android.content.DialogInterface;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v4.app.ActivityCompat;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.google.zxing.Result;
|
||||
|
||||
import org.briarproject.briar.R;
|
||||
import org.briarproject.briar.android.activity.ActivityComponent;
|
||||
import org.briarproject.briar.android.fragment.BaseFragment;
|
||||
import org.briarproject.briar.android.keyagreement.CameraException;
|
||||
import org.briarproject.briar.android.keyagreement.CameraView;
|
||||
import org.briarproject.briar.android.keyagreement.QrCodeDecoder;
|
||||
import org.briarproject.briar.android.util.UiUtils;
|
||||
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import static android.Manifest.permission.CAMERA;
|
||||
import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_NOSENSOR;
|
||||
import static android.content.pm.PackageManager.PERMISSION_GRANTED;
|
||||
import static android.widget.Toast.LENGTH_LONG;
|
||||
import static android.widget.Toast.LENGTH_SHORT;
|
||||
import static java.util.logging.Level.WARNING;
|
||||
import static org.briarproject.bramble.util.LogUtils.logException;
|
||||
import static org.briarproject.briar.android.activity.RequestCodes.REQUEST_PERMISSION_CAMERA_LOCATION;
|
||||
|
||||
public class ContactQrCodeInputFragment extends BaseFragment
|
||||
implements QrCodeDecoder.ResultCallback {
|
||||
|
||||
static final String TAG = ContactQrCodeInputFragment.class.getName();
|
||||
|
||||
private static final Logger LOG = Logger.getLogger(TAG);
|
||||
|
||||
private CameraView cameraView;
|
||||
|
||||
@Override
|
||||
public String getUniqueTag() {
|
||||
return TAG;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void injectFragment(ActivityComponent component) {
|
||||
component.inject(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
|
||||
if (getActivity() == null) throw new AssertionError();
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
getActivity().setRequestedOrientation(SCREEN_ORIENTATION_NOSENSOR);
|
||||
cameraView.setPreviewConsumer(new QrCodeDecoder(this));
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater,
|
||||
@Nullable ViewGroup container,
|
||||
@Nullable Bundle savedInstanceState) {
|
||||
if (getActivity() == null) return null;
|
||||
|
||||
getActivity().setTitle(R.string.scan_qr_code_title);
|
||||
|
||||
View v = inflater.inflate(R.layout.fragment_contact_qr_code_input,
|
||||
container, false);
|
||||
|
||||
cameraView = v.findViewById(R.id.camera_view);
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
if (checkPermissions()) {
|
||||
startCamera();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStop() {
|
||||
super.onStop();
|
||||
try {
|
||||
cameraView.stop();
|
||||
} catch (CameraException e) {
|
||||
logException(LOG, WARNING, e);
|
||||
}
|
||||
}
|
||||
|
||||
private void startCamera() {
|
||||
try {
|
||||
cameraView.start();
|
||||
} catch (CameraException e) {
|
||||
logException(LOG, WARNING, e);
|
||||
Toast.makeText(getContext(), R.string.camera_error_toast,
|
||||
LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
private boolean checkPermissions() {
|
||||
if (getContext() == null) return false;
|
||||
if (ActivityCompat.checkSelfPermission(getContext(), CAMERA) !=
|
||||
PERMISSION_GRANTED) {
|
||||
// Should we show an explanation?
|
||||
if (shouldShowRequestPermissionRationale(CAMERA)) {
|
||||
DialogInterface.OnClickListener continueListener =
|
||||
(dialog, which) -> requestPermission();
|
||||
AlertDialog.Builder
|
||||
builder = new AlertDialog.Builder(getContext(),
|
||||
R.style.BriarDialogTheme);
|
||||
builder.setTitle(R.string.permission_camera_title);
|
||||
builder.setMessage(R.string.permission_camera_request_body);
|
||||
builder.setNeutralButton(R.string.continue_button,
|
||||
continueListener);
|
||||
builder.show();
|
||||
} else {
|
||||
requestPermission();
|
||||
}
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRequestPermissionsResult(int requestCode,
|
||||
@NonNull String[] permissions, @NonNull int[] grantResults) {
|
||||
if (getContext() == null) return;
|
||||
if (requestCode == REQUEST_PERMISSION_CAMERA_LOCATION) {
|
||||
// If request is cancelled, the result arrays are empty.
|
||||
if (grantResults.length > 0 &&
|
||||
grantResults[0] == PERMISSION_GRANTED) {
|
||||
startCamera();
|
||||
} else {
|
||||
if (!shouldShowRequestPermissionRationale(CAMERA)) {
|
||||
// The user has permanently denied the request
|
||||
AlertDialog.Builder
|
||||
builder = new AlertDialog.Builder(getContext(),
|
||||
R.style.BriarDialogTheme);
|
||||
builder.setTitle(R.string.permission_camera_title);
|
||||
builder.setMessage(R.string.permission_camera_denied_body);
|
||||
builder.setPositiveButton(R.string.ok,
|
||||
UiUtils.getGoToSettingsListener(getContext()));
|
||||
builder.setNegativeButton(R.string.cancel,
|
||||
(dialog, which) -> cancel());
|
||||
builder.show();
|
||||
} else {
|
||||
Toast.makeText(getContext(),
|
||||
R.string.permission_camera_denied_body,
|
||||
LENGTH_LONG).show();
|
||||
cancel();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void requestPermission() {
|
||||
requestPermissions(new String[] {CAMERA}, REQUEST_PERMISSION_CAMERA_LOCATION);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private ContactLinkExchangeActivity getCastActivity() {
|
||||
return (ContactLinkExchangeActivity) getActivity();
|
||||
}
|
||||
|
||||
private void cancel() {
|
||||
ContactLinkExchangeActivity activity = getCastActivity();
|
||||
if (activity != null) activity.linkScanned(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleResult(@NonNull Result result) {
|
||||
LOG.info("Scanned link: " + result.getText());
|
||||
ContactLinkExchangeActivity activity = getCastActivity();
|
||||
if (activity != null) activity.linkScanned(result.getText());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package org.briarproject.briar.android.contact;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import org.briarproject.briar.R;
|
||||
import org.briarproject.briar.android.activity.ActivityComponent;
|
||||
import org.briarproject.briar.android.fragment.BaseFragment;
|
||||
import org.briarproject.briar.android.view.QrCodeView;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import static org.briarproject.briar.android.contact.ContactLinkExchangeActivity.OUR_LINK;
|
||||
import static org.briarproject.briar.android.keyagreement.QrCodeUtils.createQrCode;
|
||||
|
||||
public class ContactQrCodeOutputFragment extends BaseFragment {
|
||||
|
||||
static final String TAG = ContactQrCodeOutputFragment.class.getName();
|
||||
|
||||
@Override
|
||||
public String getUniqueTag() {
|
||||
return TAG;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void injectFragment(ActivityComponent component) {
|
||||
component.inject(this);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater,
|
||||
@Nullable ViewGroup container,
|
||||
@Nullable Bundle savedInstanceState) {
|
||||
if (getActivity() == null) return null;
|
||||
|
||||
getActivity().setTitle(R.string.show_qr_code_title);
|
||||
|
||||
View v = inflater.inflate(R.layout.fragment_contact_qr_code_output,
|
||||
container, false);
|
||||
|
||||
DisplayMetrics dm = getResources().getDisplayMetrics();
|
||||
Bitmap qrCode = createQrCode(dm, OUR_LINK);
|
||||
QrCodeView qrCodeView = v.findViewById(R.id.qrCodeView);
|
||||
qrCodeView.setQrCode(qrCode);
|
||||
|
||||
return v;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,127 @@
|
||||
package org.briarproject.briar.android.contact;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.app.ActionBar;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.view.MenuItem;
|
||||
|
||||
import org.briarproject.bramble.api.contact.Contact;
|
||||
import org.briarproject.bramble.api.contact.ContactManager;
|
||||
import org.briarproject.bramble.api.contact.event.ContactAddedEvent;
|
||||
import org.briarproject.bramble.api.db.DbException;
|
||||
import org.briarproject.bramble.api.event.Event;
|
||||
import org.briarproject.bramble.api.event.EventBus;
|
||||
import org.briarproject.bramble.api.event.EventListener;
|
||||
import org.briarproject.briar.R;
|
||||
import org.briarproject.briar.android.activity.ActivityComponent;
|
||||
import org.briarproject.briar.android.activity.BriarActivity;
|
||||
import org.briarproject.briar.android.view.BriarRecyclerView;
|
||||
import org.briarproject.briar.api.messaging.MessagingManager;
|
||||
import org.briarproject.briar.api.messaging.MessagingManager.PendingContact;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import static java.util.concurrent.TimeUnit.SECONDS;
|
||||
|
||||
public class PendingRequestsActivity extends BriarActivity
|
||||
implements EventListener {
|
||||
|
||||
@Inject
|
||||
MessagingManager messagingManager;
|
||||
@Inject
|
||||
ContactManager contactManager;
|
||||
@Inject
|
||||
EventBus eventBus;
|
||||
|
||||
private PendingRequestsAdapter adapter;
|
||||
private BriarRecyclerView list;
|
||||
|
||||
@Override
|
||||
public void injectActivity(ActivityComponent component) {
|
||||
component.inject(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(@Nullable Bundle state) {
|
||||
super.onCreate(state);
|
||||
|
||||
setContentView(R.layout.list);
|
||||
|
||||
ActionBar ab = getSupportActionBar();
|
||||
if (ab != null) {
|
||||
ab.setDisplayHomeAsUpEnabled(true);
|
||||
}
|
||||
|
||||
adapter = new PendingRequestsAdapter(this, PendingContact.class);
|
||||
list = findViewById(R.id.list);
|
||||
list.setLayoutManager(new LinearLayoutManager(this));
|
||||
list.setAdapter(adapter);
|
||||
list.setPERIODIC_UPDATE_MILLIS(SECONDS.toMillis(9));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
eventBus.addListener(this);
|
||||
list.startPeriodicUpdate();
|
||||
runOnDbThread(() -> {
|
||||
try {
|
||||
Collection<PendingContact> contacts =
|
||||
messagingManager.getPendingContacts();
|
||||
addPendingContacts(contacts);
|
||||
} catch (DbException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
list.stopPeriodicUpdate();
|
||||
adapter.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case android.R.id.home:
|
||||
onBackPressed();
|
||||
return true;
|
||||
default:
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void eventOccurred(Event e) {
|
||||
if (e instanceof ContactAddedEvent) {
|
||||
runOnDbThread(() -> {
|
||||
try {
|
||||
Contact contact = contactManager
|
||||
.getContact(((ContactAddedEvent) e).getContactId());
|
||||
runOnUiThreadUnlessDestroyed(() -> {
|
||||
adapter.remove(contact);
|
||||
if (adapter.isEmpty()) finish();
|
||||
});
|
||||
} catch (DbException e1) {
|
||||
e1.printStackTrace();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void addPendingContacts(Collection<PendingContact> contacts) {
|
||||
runOnUiThreadUnlessDestroyed(() -> {
|
||||
if (contacts.isEmpty()) {
|
||||
list.showData();
|
||||
} else {
|
||||
adapter.addAll(contacts);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
package org.briarproject.briar.android.contact;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import org.briarproject.bramble.api.contact.Contact;
|
||||
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
||||
import org.briarproject.briar.R;
|
||||
import org.briarproject.briar.android.util.BriarAdapter;
|
||||
import org.briarproject.briar.api.messaging.MessagingManager.PendingContact;
|
||||
|
||||
@NotNullByDefault
|
||||
public class PendingRequestsAdapter extends
|
||||
BriarAdapter<PendingContact, PendingRequestsViewHolder> {
|
||||
|
||||
public PendingRequestsAdapter(Context ctx, Class<PendingContact> c) {
|
||||
super(ctx, c);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public PendingRequestsViewHolder onCreateViewHolder(
|
||||
ViewGroup viewGroup, int i) {
|
||||
View v = LayoutInflater.from(viewGroup.getContext()).inflate(
|
||||
R.layout.list_item_pending_contact, viewGroup, false);
|
||||
return new PendingRequestsViewHolder(v);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(
|
||||
PendingRequestsViewHolder pendingRequestsViewHolder, int i) {
|
||||
pendingRequestsViewHolder.bind(items.get(i));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compare(PendingContact item1, PendingContact item2) {
|
||||
return (int) (item1.getTimestamp() - item2.getTimestamp());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean areContentsTheSame(PendingContact item1,
|
||||
PendingContact item2) {
|
||||
return item1.getName().equals(item2.getName()) &&
|
||||
item1.getTimestamp() == item2.getTimestamp();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean areItemsTheSame(PendingContact item1,
|
||||
PendingContact item2) {
|
||||
return item1.getName().equals(item2.getName()) &&
|
||||
item1.getTimestamp() == item2.getTimestamp();
|
||||
}
|
||||
|
||||
// TODO remove
|
||||
public void remove(Contact contact) {
|
||||
for (int i = 0; i < items.size(); i++) {
|
||||
if (items.get(i).getName().equals(contact.getAuthor().getName())) {
|
||||
items.removeItemAt(i);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package org.briarproject.briar.android.contact;
|
||||
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v7.widget.RecyclerView.ViewHolder;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
||||
import org.briarproject.briar.R;
|
||||
import org.briarproject.briar.android.view.TextAvatarView;
|
||||
import org.briarproject.briar.api.messaging.MessagingManager.PendingContact;
|
||||
|
||||
import static java.util.concurrent.TimeUnit.SECONDS;
|
||||
import static org.briarproject.bramble.util.StringUtils.toUtf8;
|
||||
import static org.briarproject.briar.android.util.UiUtils.formatDate;
|
||||
|
||||
@NotNullByDefault
|
||||
public class PendingRequestsViewHolder extends ViewHolder {
|
||||
|
||||
private final TextAvatarView avatar;
|
||||
private final TextView name;
|
||||
private final TextView time;
|
||||
private final TextView status;
|
||||
|
||||
public PendingRequestsViewHolder(View v) {
|
||||
super(v);
|
||||
avatar = v.findViewById(R.id.avatar);
|
||||
name = v.findViewById(R.id.name);
|
||||
time = v.findViewById(R.id.time);
|
||||
status = v.findViewById(R.id.status);
|
||||
}
|
||||
|
||||
public void bind(PendingContact item) {
|
||||
avatar.setText(item.getName());
|
||||
avatar.setBackgroundBytes(toUtf8(item.getName() + item.getTimestamp()));
|
||||
name.setText(item.getName());
|
||||
time.setText(formatDate(time.getContext(), item.getTimestamp()));
|
||||
long diff = item.getAddAt() - System.currentTimeMillis();
|
||||
Log.e("TEST", "diff: " + diff);
|
||||
int color = ContextCompat
|
||||
.getColor(status.getContext(), R.color.briar_green);
|
||||
if (diff < SECONDS.toMillis(10)) {
|
||||
status.setText(R.string.adding_contact);
|
||||
} else if (diff < SECONDS.toMillis(20)) {
|
||||
status.setText(R.string.connecting);
|
||||
} else if (diff < SECONDS.toMillis(30)) {
|
||||
status.setText(R.string.waiting_for_contact_to_come_online);
|
||||
color = ContextCompat
|
||||
.getColor(status.getContext(), R.color.briar_yellow);
|
||||
}
|
||||
status.setTextColor(color);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import android.content.res.Resources;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.media.ExifInterface;
|
||||
import android.webkit.MimeTypeMap;
|
||||
|
||||
import org.briarproject.bramble.api.Pair;
|
||||
import org.briarproject.bramble.api.db.DatabaseExecutor;
|
||||
@@ -127,12 +128,20 @@ class AttachmentController {
|
||||
}
|
||||
|
||||
// calculate thumbnail size
|
||||
Size thumbnailSize = new Size(defaultSize, defaultSize);
|
||||
Size thumbnailSize = new Size(defaultSize, defaultSize, size.mimeType);
|
||||
if (!size.error) {
|
||||
thumbnailSize = getThumbnailSize(size.width, size.height);
|
||||
thumbnailSize =
|
||||
getThumbnailSize(size.width, size.height, size.mimeType);
|
||||
}
|
||||
// get file extension
|
||||
MimeTypeMap mimeTypeMap = MimeTypeMap.getSingleton();
|
||||
String extension = mimeTypeMap.getExtensionFromMimeType(size.mimeType);
|
||||
if (extension == null) {
|
||||
return new AttachmentItem(messageId, 0, 0, "", "", 0, 0, true);
|
||||
}
|
||||
return new AttachmentItem(messageId, size.width, size.height,
|
||||
thumbnailSize.width, thumbnailSize.height, size.error);
|
||||
size.mimeType, extension, thumbnailSize.width, thumbnailSize.height,
|
||||
size.error);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -151,9 +160,9 @@ class AttachmentController {
|
||||
orientation == ORIENTATION_TRANSVERSE ||
|
||||
orientation == ORIENTATION_TRANSPOSE) {
|
||||
//noinspection SuspiciousNameCombination
|
||||
return new Size(height, width);
|
||||
return new Size(height, width, "image/jpeg");
|
||||
}
|
||||
return new Size(width, height);
|
||||
return new Size(width, height, "image/jpeg");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -165,10 +174,11 @@ class AttachmentController {
|
||||
BitmapFactory.decodeStream(is, null, options);
|
||||
if (options.outWidth < 1 || options.outHeight < 1)
|
||||
return new Size();
|
||||
return new Size(options.outWidth, options.outHeight);
|
||||
return new Size(options.outWidth, options.outHeight,
|
||||
options.outMimeType);
|
||||
}
|
||||
|
||||
private Size getThumbnailSize(int width, int height) {
|
||||
private Size getThumbnailSize(int width, int height, String mimeType) {
|
||||
float widthPercentage = maxWidth / (float) width;
|
||||
float heightPercentage = maxHeight / (float) height;
|
||||
float scaleFactor = Math.min(widthPercentage, heightPercentage);
|
||||
@@ -184,24 +194,27 @@ class AttachmentController {
|
||||
if (thumbnailWidth > maxWidth) thumbnailWidth = maxWidth;
|
||||
if (thumbnailHeight > maxHeight) thumbnailHeight = maxHeight;
|
||||
}
|
||||
return new Size(thumbnailWidth, thumbnailHeight);
|
||||
return new Size(thumbnailWidth, thumbnailHeight, mimeType);
|
||||
}
|
||||
|
||||
private static class Size {
|
||||
|
||||
private final int width;
|
||||
private final int height;
|
||||
private final String mimeType;
|
||||
private final boolean error;
|
||||
|
||||
private Size(int width, int height) {
|
||||
private Size(int width, int height, String mimeType) {
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
this.mimeType = mimeType;
|
||||
this.error = false;
|
||||
}
|
||||
|
||||
private Size() {
|
||||
this.width = 0;
|
||||
this.height = 0;
|
||||
this.mimeType = "";
|
||||
this.error = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ public class AttachmentItem implements Parcelable {
|
||||
|
||||
private final MessageId messageId;
|
||||
private final int width, height;
|
||||
private final String mimeType, extension;
|
||||
private final int thumbnailWidth, thumbnailHeight;
|
||||
private final boolean hasError;
|
||||
|
||||
@@ -30,11 +31,14 @@ public class AttachmentItem implements Parcelable {
|
||||
}
|
||||
};
|
||||
|
||||
AttachmentItem(MessageId messageId, int width, int height,
|
||||
int thumbnailWidth, int thumbnailHeight, boolean hasError) {
|
||||
AttachmentItem(MessageId messageId, int width, int height, String mimeType,
|
||||
String extension, int thumbnailWidth, int thumbnailHeight,
|
||||
boolean hasError) {
|
||||
this.messageId = messageId;
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
this.mimeType = mimeType;
|
||||
this.extension = extension;
|
||||
this.thumbnailWidth = thumbnailWidth;
|
||||
this.thumbnailHeight = thumbnailHeight;
|
||||
this.hasError = hasError;
|
||||
@@ -46,6 +50,8 @@ public class AttachmentItem implements Parcelable {
|
||||
messageId = new MessageId(messageIdByte);
|
||||
width = in.readInt();
|
||||
height = in.readInt();
|
||||
mimeType = in.readString();
|
||||
extension = in.readString();
|
||||
thumbnailWidth = in.readInt();
|
||||
thumbnailHeight = in.readInt();
|
||||
hasError = in.readByte() != 0;
|
||||
@@ -63,6 +69,14 @@ public class AttachmentItem implements Parcelable {
|
||||
return height;
|
||||
}
|
||||
|
||||
String getMimeType() {
|
||||
return mimeType;
|
||||
}
|
||||
|
||||
String getExtension() {
|
||||
return extension;
|
||||
}
|
||||
|
||||
int getThumbnailWidth() {
|
||||
return thumbnailWidth;
|
||||
}
|
||||
@@ -90,6 +104,8 @@ public class AttachmentItem implements Parcelable {
|
||||
dest.writeByteArray(messageId.getBytes());
|
||||
dest.writeInt(width);
|
||||
dest.writeInt(height);
|
||||
dest.writeString(mimeType);
|
||||
dest.writeString(extension);
|
||||
dest.writeInt(thumbnailWidth);
|
||||
dest.writeInt(thumbnailHeight);
|
||||
dest.writeByte((byte) (hasError ? 1 : 0));
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
package org.briarproject.briar.android.conversation;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.arch.lifecycle.Observer;
|
||||
import android.arch.lifecycle.ViewModelProvider;
|
||||
import android.arch.lifecycle.ViewModelProviders;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.annotation.UiThread;
|
||||
@@ -51,7 +53,6 @@ import org.briarproject.bramble.api.sync.Message;
|
||||
import org.briarproject.bramble.api.sync.MessageId;
|
||||
import org.briarproject.bramble.api.sync.event.MessagesAckedEvent;
|
||||
import org.briarproject.bramble.api.sync.event.MessagesSentEvent;
|
||||
import org.briarproject.bramble.util.StringUtils;
|
||||
import org.briarproject.briar.R;
|
||||
import org.briarproject.briar.android.activity.ActivityComponent;
|
||||
import org.briarproject.briar.android.activity.BriarActivity;
|
||||
@@ -62,8 +63,12 @@ import org.briarproject.briar.android.forum.ForumActivity;
|
||||
import org.briarproject.briar.android.introduction.IntroductionActivity;
|
||||
import org.briarproject.briar.android.privategroup.conversation.GroupActivity;
|
||||
import org.briarproject.briar.android.view.BriarRecyclerView;
|
||||
import org.briarproject.briar.android.view.ImagePreview;
|
||||
import org.briarproject.briar.android.view.TextAttachmentController;
|
||||
import org.briarproject.briar.android.view.TextAttachmentController.AttachImageListener;
|
||||
import org.briarproject.briar.android.view.TextInputView;
|
||||
import org.briarproject.briar.android.view.TextInputView.TextInputListener;
|
||||
import org.briarproject.briar.android.view.TextSendController;
|
||||
import org.briarproject.briar.android.view.TextSendController.SendListener;
|
||||
import org.briarproject.briar.api.android.AndroidNotificationManager;
|
||||
import org.briarproject.briar.api.blog.BlogSharingManager;
|
||||
import org.briarproject.briar.api.client.ProtocolStateException;
|
||||
@@ -104,7 +109,8 @@ import static android.os.Build.VERSION.SDK_INT;
|
||||
import static android.support.v4.app.ActivityOptionsCompat.makeSceneTransitionAnimation;
|
||||
import static android.support.v4.view.ViewCompat.setTransitionName;
|
||||
import static android.support.v7.util.SortedList.INVALID_POSITION;
|
||||
import static android.view.Gravity.END;
|
||||
import static android.view.Gravity.RIGHT;
|
||||
import static android.widget.Toast.LENGTH_LONG;
|
||||
import static android.widget.Toast.LENGTH_SHORT;
|
||||
import static java.util.Collections.emptyList;
|
||||
import static java.util.Collections.sort;
|
||||
@@ -114,6 +120,9 @@ import static java.util.logging.Level.WARNING;
|
||||
import static org.briarproject.bramble.util.LogUtils.logDuration;
|
||||
import static org.briarproject.bramble.util.LogUtils.logException;
|
||||
import static org.briarproject.bramble.util.LogUtils.now;
|
||||
import static org.briarproject.bramble.util.StringUtils.isNullOrEmpty;
|
||||
import static org.briarproject.briar.android.TestingConstants.FEATURE_FLAG_IMAGE_ATTACHMENTS;
|
||||
import static org.briarproject.briar.android.activity.RequestCodes.REQUEST_ATTACH_IMAGE;
|
||||
import static org.briarproject.briar.android.activity.RequestCodes.REQUEST_INTRODUCTION;
|
||||
import static org.briarproject.briar.android.conversation.ImageActivity.ATTACHMENT;
|
||||
import static org.briarproject.briar.android.conversation.ImageActivity.DATE;
|
||||
@@ -129,8 +138,8 @@ import static uk.co.samuelwall.materialtaptargetprompt.MaterialTapTargetPrompt.S
|
||||
@MethodsNotNullByDefault
|
||||
@ParametersNotNullByDefault
|
||||
public class ConversationActivity extends BriarActivity
|
||||
implements EventListener, ConversationListener, TextInputListener,
|
||||
TextCache, AttachmentCache {
|
||||
implements EventListener, ConversationListener, SendListener,
|
||||
TextCache, AttachmentCache, AttachImageListener {
|
||||
|
||||
public static final String CONTACT_ID = "briar.CONTACT_ID";
|
||||
|
||||
@@ -160,6 +169,7 @@ public class ConversationActivity extends BriarActivity
|
||||
private BriarRecyclerView list;
|
||||
private LinearLayoutManager layoutManager;
|
||||
private TextInputView textInputView;
|
||||
private TextSendController sendController;
|
||||
|
||||
// Fields that are accessed from background threads must be volatile
|
||||
@Inject
|
||||
@@ -197,7 +207,9 @@ public class ConversationActivity extends BriarActivity
|
||||
@Override
|
||||
public void onCreate(@Nullable Bundle state) {
|
||||
if (SDK_INT >= 21) {
|
||||
Transition slide = new Slide(END);
|
||||
// Spurious lint warning - using END causes a crash
|
||||
@SuppressLint("RtlHardcoded")
|
||||
Transition slide = new Slide(RIGHT);
|
||||
setSceneTransitionAnimation(slide, null, slide);
|
||||
}
|
||||
super.onCreate(state);
|
||||
@@ -247,7 +259,16 @@ public class ConversationActivity extends BriarActivity
|
||||
list.setEmptyText(getString(R.string.no_private_messages));
|
||||
|
||||
textInputView = findViewById(R.id.text_input_container);
|
||||
textInputView.setListener(this);
|
||||
if (FEATURE_FLAG_IMAGE_ATTACHMENTS) {
|
||||
ImagePreview imagePreview = findViewById(R.id.imagePreview);
|
||||
sendController = new TextAttachmentController(textInputView,
|
||||
imagePreview, this, this);
|
||||
} else {
|
||||
sendController = new TextSendController(textInputView, this, false);
|
||||
}
|
||||
textInputView.setSendController(sendController);
|
||||
textInputView.setMaxTextLength(MAX_PRIVATE_MESSAGE_TEXT_LENGTH);
|
||||
textInputView.setEnabled(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -264,6 +285,9 @@ public class ConversationActivity extends BriarActivity
|
||||
Snackbar.LENGTH_SHORT);
|
||||
snackbar.getView().setBackgroundResource(R.color.briar_primary);
|
||||
snackbar.show();
|
||||
} else if (request == REQUEST_ATTACH_IMAGE && result == RESULT_OK) {
|
||||
// remove cast when removing FEATURE_FLAG_IMAGE_ATTACHMENTS
|
||||
((TextAttachmentController) sendController).onImageReceived(data);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -402,7 +426,7 @@ public class ConversationActivity extends BriarActivity
|
||||
runOnUiThreadUnlessDestroyed(() -> {
|
||||
if (revision == adapter.getRevision()) {
|
||||
adapter.incrementRevision();
|
||||
textInputView.setSendButtonEnabled(true);
|
||||
textInputView.setEnabled(true);
|
||||
List<ConversationItem> items = createItems(headers);
|
||||
adapter.addAll(items);
|
||||
list.showData();
|
||||
@@ -570,14 +594,23 @@ public class ConversationActivity extends BriarActivity
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSendClick(String text) {
|
||||
if (text.isEmpty()) return;
|
||||
text = StringUtils.truncateUtf8(text, MAX_PRIVATE_MESSAGE_TEXT_LENGTH);
|
||||
public void onAttachImage(Intent intent) {
|
||||
startActivityForResult(intent, REQUEST_ATTACH_IMAGE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSendClick(@Nullable String text, List<Uri> imageUris) {
|
||||
if (!imageUris.isEmpty()) {
|
||||
Toast.makeText(this, "Not yet implemented.", LENGTH_LONG).show();
|
||||
textInputView.clearText();
|
||||
return;
|
||||
}
|
||||
if (isNullOrEmpty(text)) throw new AssertionError();
|
||||
long timestamp = System.currentTimeMillis();
|
||||
timestamp = Math.max(timestamp, getMinTimestampForNewMessage());
|
||||
if (messagingGroupId == null) loadGroupId(text, timestamp);
|
||||
else createMessage(text, timestamp);
|
||||
textInputView.setText("");
|
||||
textInputView.clearText();
|
||||
}
|
||||
|
||||
private long getMinTimestampForNewMessage() {
|
||||
|
||||
@@ -1,14 +1,23 @@
|
||||
package org.briarproject.briar.android.conversation;
|
||||
|
||||
import android.arch.lifecycle.ViewModelProvider;
|
||||
import android.arch.lifecycle.ViewModelProviders;
|
||||
import android.content.DialogInterface.OnClickListener;
|
||||
import android.content.Intent;
|
||||
import android.graphics.drawable.Animatable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.annotation.RequiresApi;
|
||||
import android.support.design.widget.AppBarLayout;
|
||||
import android.support.design.widget.Snackbar;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v4.graphics.drawable.DrawableCompat;
|
||||
import android.support.v7.app.AlertDialog.Builder;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.transition.Fade;
|
||||
import android.transition.Transition;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
@@ -26,8 +35,18 @@ import org.briarproject.briar.android.activity.BriarActivity;
|
||||
import org.briarproject.briar.android.conversation.glide.GlideApp;
|
||||
import org.briarproject.briar.android.view.PullDownLayout;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import static android.content.Intent.ACTION_CREATE_DOCUMENT;
|
||||
import static android.content.Intent.CATEGORY_OPENABLE;
|
||||
import static android.content.Intent.EXTRA_TITLE;
|
||||
import static android.graphics.Color.TRANSPARENT;
|
||||
import static android.os.Build.VERSION.SDK_INT;
|
||||
import static android.support.design.widget.Snackbar.LENGTH_LONG;
|
||||
import static android.view.View.GONE;
|
||||
import static android.view.View.SYSTEM_UI_FLAG_FULLSCREEN;
|
||||
import static android.view.View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN;
|
||||
@@ -37,6 +56,7 @@ import static android.view.WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS;
|
||||
import static android.widget.ImageView.ScaleType.FIT_START;
|
||||
import static com.bumptech.glide.load.engine.DiskCacheStrategy.NONE;
|
||||
import static java.util.Objects.requireNonNull;
|
||||
import static org.briarproject.briar.android.activity.RequestCodes.REQUEST_SAVE_ATTACHMENT;
|
||||
import static org.briarproject.briar.android.util.UiUtils.formatDateAbsolute;
|
||||
|
||||
public class ImageActivity extends BriarActivity
|
||||
@@ -46,9 +66,14 @@ public class ImageActivity extends BriarActivity
|
||||
final static String NAME = "name";
|
||||
final static String DATE = "date";
|
||||
|
||||
@Inject
|
||||
ViewModelProvider.Factory viewModelFactory;
|
||||
|
||||
private ImageViewModel viewModel;
|
||||
private PullDownLayout layout;
|
||||
private AppBarLayout appBarLayout;
|
||||
private PhotoView photoView;
|
||||
private AttachmentItem attachment;
|
||||
|
||||
@Override
|
||||
public void injectActivity(ActivityComponent component) {
|
||||
@@ -67,6 +92,11 @@ public class ImageActivity extends BriarActivity
|
||||
setSceneTransitionAnimation(transition, null, transition);
|
||||
}
|
||||
|
||||
// get View Model
|
||||
viewModel = ViewModelProviders.of(this, viewModelFactory)
|
||||
.get(ImageViewModel.class);
|
||||
viewModel.getSaveState().observe(this, this::onImageSaveStateChanged);
|
||||
|
||||
// inflate layout
|
||||
setContentView(R.layout.activity_image);
|
||||
layout = findViewById(R.id.layout);
|
||||
@@ -88,7 +118,7 @@ public class ImageActivity extends BriarActivity
|
||||
TextView dateView = toolbar.findViewById(R.id.dateView);
|
||||
|
||||
// Intent Extras
|
||||
AttachmentItem attachment = getIntent().getParcelableExtra(ATTACHMENT);
|
||||
attachment = getIntent().getParcelableExtra(ATTACHMENT);
|
||||
String name = getIntent().getStringExtra(NAME);
|
||||
long time = getIntent().getLongExtra(DATE, 0);
|
||||
String date = formatDateAbsolute(this, time);
|
||||
@@ -143,17 +173,34 @@ public class ImageActivity extends BriarActivity
|
||||
.into(photoView);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
getMenuInflater().inflate(R.menu.image_actions, menu);
|
||||
return super.onCreateOptionsMenu(menu);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case android.R.id.home:
|
||||
onBackPressed();
|
||||
return true;
|
||||
case R.id.action_save_image:
|
||||
showSaveImageDialog();
|
||||
return true;
|
||||
default:
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int request, int result, Intent data) {
|
||||
super.onActivityResult(request, result, data);
|
||||
if (request == REQUEST_SAVE_ATTACHMENT && result == RESULT_OK) {
|
||||
viewModel.saveImage(attachment, data.getData());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPullStart() {
|
||||
appBarLayout.animate()
|
||||
@@ -190,9 +237,8 @@ public class ImageActivity extends BriarActivity
|
||||
|
||||
@RequiresApi(api = 16)
|
||||
private void hideSystemUi(View decorView) {
|
||||
decorView.setSystemUiVisibility(SYSTEM_UI_FLAG_LAYOUT_STABLE
|
||||
| SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
||||
| SYSTEM_UI_FLAG_FULLSCREEN
|
||||
decorView.setSystemUiVisibility(SYSTEM_UI_FLAG_FULLSCREEN |
|
||||
SYSTEM_UI_FLAG_LAYOUT_STABLE | SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
||||
);
|
||||
appBarLayout.animate()
|
||||
.translationYBy(-1 * appBarLayout.getHeight())
|
||||
@@ -204,8 +250,7 @@ public class ImageActivity extends BriarActivity
|
||||
@RequiresApi(api = 16)
|
||||
private void showSystemUi(View decorView) {
|
||||
decorView.setSystemUiVisibility(
|
||||
SYSTEM_UI_FLAG_LAYOUT_STABLE
|
||||
| SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
||||
SYSTEM_UI_FLAG_LAYOUT_STABLE | SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
||||
);
|
||||
appBarLayout.animate()
|
||||
.translationYBy(appBarLayout.getHeight())
|
||||
@@ -230,4 +275,49 @@ public class ImageActivity extends BriarActivity
|
||||
drawableTop != appBarLayout.getTop();
|
||||
}
|
||||
|
||||
private void showSaveImageDialog() {
|
||||
OnClickListener okListener = (dialog, which) -> {
|
||||
if (SDK_INT >= 19) {
|
||||
Intent intent = getCreationIntent();
|
||||
startActivityForResult(intent, REQUEST_SAVE_ATTACHMENT);
|
||||
} else {
|
||||
viewModel.saveImage(attachment);
|
||||
}
|
||||
};
|
||||
Builder builder = new Builder(this, R.style.BriarDialogTheme);
|
||||
builder.setTitle(getString(R.string.dialog_title_save_image));
|
||||
builder.setMessage(getString(R.string.dialog_message_save_image));
|
||||
Drawable icon = ContextCompat.getDrawable(this, R.drawable.ic_security);
|
||||
DrawableCompat.setTint(requireNonNull(icon),
|
||||
ContextCompat.getColor(this, R.color.color_primary));
|
||||
builder.setIcon(icon);
|
||||
builder.setPositiveButton(R.string.save_image, okListener);
|
||||
builder.setNegativeButton(R.string.cancel, null);
|
||||
builder.show();
|
||||
}
|
||||
|
||||
@RequiresApi(api = 19)
|
||||
private Intent getCreationIntent() {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss",
|
||||
Locale.getDefault());
|
||||
String fileName = sdf.format(new Date());
|
||||
Intent intent = new Intent(ACTION_CREATE_DOCUMENT);
|
||||
intent.addCategory(CATEGORY_OPENABLE);
|
||||
intent.setType(attachment.getMimeType());
|
||||
intent.putExtra(EXTRA_TITLE, fileName);
|
||||
return intent;
|
||||
}
|
||||
|
||||
private void onImageSaveStateChanged(@Nullable Boolean error) {
|
||||
if (error == null) return;
|
||||
int stringRes = error ?
|
||||
R.string.save_image_error : R.string.save_image_success;
|
||||
int colorRes = error ?
|
||||
R.color.briar_red : R.color.briar_primary;
|
||||
Snackbar s = Snackbar.make(layout, stringRes, LENGTH_LONG);
|
||||
s.getView().setBackgroundResource(colorRes);
|
||||
s.show();
|
||||
viewModel.onSaveStateSeen();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,166 @@
|
||||
package org.briarproject.briar.android.conversation;
|
||||
|
||||
import android.app.Application;
|
||||
import android.arch.lifecycle.AndroidViewModel;
|
||||
import android.arch.lifecycle.LiveData;
|
||||
import android.arch.lifecycle.MutableLiveData;
|
||||
import android.net.Uri;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.annotation.UiThread;
|
||||
|
||||
import org.briarproject.bramble.api.db.DatabaseExecutor;
|
||||
import org.briarproject.bramble.api.db.DbException;
|
||||
import org.briarproject.bramble.api.lifecycle.IoExecutor;
|
||||
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
||||
import org.briarproject.bramble.api.sync.MessageId;
|
||||
import org.briarproject.briar.api.messaging.Attachment;
|
||||
import org.briarproject.briar.api.messaging.MessagingManager;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import static android.media.MediaScannerConnection.scanFile;
|
||||
import static android.os.Environment.DIRECTORY_PICTURES;
|
||||
import static android.os.Environment.getExternalStoragePublicDirectory;
|
||||
import static java.util.logging.Level.WARNING;
|
||||
import static java.util.logging.Logger.getLogger;
|
||||
import static org.briarproject.bramble.util.IoUtils.copyAndClose;
|
||||
import static org.briarproject.bramble.util.LogUtils.logException;
|
||||
|
||||
@NotNullByDefault
|
||||
public class ImageViewModel extends AndroidViewModel {
|
||||
|
||||
private static Logger LOG = getLogger(ImageViewModel.class.getName());
|
||||
|
||||
private final MessagingManager messagingManager;
|
||||
@DatabaseExecutor
|
||||
private final Executor dbExecutor;
|
||||
@IoExecutor
|
||||
private final Executor ioExecutor;
|
||||
|
||||
private MutableLiveData<Boolean> saveState = new MutableLiveData<>();
|
||||
|
||||
@Inject
|
||||
public ImageViewModel(Application application,
|
||||
MessagingManager messagingManager,
|
||||
@DatabaseExecutor Executor dbExecutor,
|
||||
@IoExecutor Executor ioExecutor) {
|
||||
super(application);
|
||||
this.messagingManager = messagingManager;
|
||||
this.dbExecutor = dbExecutor;
|
||||
this.ioExecutor = ioExecutor;
|
||||
}
|
||||
|
||||
/**
|
||||
* A LiveData that is true if the image was saved,
|
||||
* false if there was an error and null otherwise.
|
||||
*
|
||||
* Call {@link #onSaveStateSeen()} after consuming an update.
|
||||
*/
|
||||
LiveData<Boolean> getSaveState() {
|
||||
return saveState;
|
||||
}
|
||||
|
||||
@UiThread
|
||||
void onSaveStateSeen() {
|
||||
saveState.setValue(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves the attachment to a writeable {@link Uri}.
|
||||
*/
|
||||
@UiThread
|
||||
void saveImage(AttachmentItem attachment, @Nullable Uri uri) {
|
||||
if (uri == null) {
|
||||
saveState.setValue(false);
|
||||
} else {
|
||||
saveImage(attachment, () -> getOutputStream(uri), null);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves the attachment on external storage,
|
||||
* assuming the permission was granted during install time.
|
||||
*/
|
||||
void saveImage(AttachmentItem attachment) {
|
||||
File file = getImageFile(attachment);
|
||||
saveImage(attachment, () -> getOutputStream(file), () -> scanFile(
|
||||
getApplication(), new String[] {file.toString()}, null, null));
|
||||
}
|
||||
|
||||
private void saveImage(AttachmentItem attachment, OutputStreamProvider osp,
|
||||
@Nullable Runnable afterCopy) {
|
||||
MessageId messageId = attachment.getMessageId();
|
||||
dbExecutor.execute(() -> {
|
||||
try {
|
||||
Attachment a = messagingManager.getAttachment(messageId);
|
||||
copyImageFromDb(a, osp, afterCopy);
|
||||
} catch (DbException e) {
|
||||
logException(LOG, WARNING, e);
|
||||
saveState.postValue(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void copyImageFromDb(Attachment a, OutputStreamProvider osp,
|
||||
@Nullable Runnable afterCopy) {
|
||||
ioExecutor.execute(() -> {
|
||||
try {
|
||||
InputStream is = a.getStream();
|
||||
OutputStream os = osp.getOutputStream();
|
||||
copyAndClose(is, os);
|
||||
if (afterCopy != null) afterCopy.run();
|
||||
saveState.postValue(false);
|
||||
} catch (IOException e) {
|
||||
logException(LOG, WARNING, e);
|
||||
saveState.postValue(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private String getFileName() {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss",
|
||||
Locale.getDefault());
|
||||
return sdf.format(new Date());
|
||||
}
|
||||
|
||||
private File getImageFile(AttachmentItem attachment) {
|
||||
File path = getExternalStoragePublicDirectory(DIRECTORY_PICTURES);
|
||||
//noinspection ResultOfMethodCallIgnored
|
||||
path.mkdirs();
|
||||
String fileName = getFileName();
|
||||
String ext = "." + attachment.getExtension();
|
||||
File file = new File(path, fileName + ext);
|
||||
int i = 1;
|
||||
while (file.exists()) {
|
||||
file = new File(path, fileName + " (" + i + ")" + ext);
|
||||
}
|
||||
return file;
|
||||
}
|
||||
|
||||
private OutputStream getOutputStream(File file) throws IOException {
|
||||
return new FileOutputStream(file);
|
||||
}
|
||||
|
||||
private OutputStream getOutputStream(Uri uri) throws IOException {
|
||||
OutputStream os =
|
||||
getApplication().getContentResolver().openOutputStream(uri);
|
||||
if (os == null) throw new IOException();
|
||||
return os;
|
||||
}
|
||||
|
||||
private interface OutputStreamProvider {
|
||||
OutputStream getOutputStream() throws IOException;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
package org.briarproject.briar.android.introduction;
|
||||
|
||||
import android.content.Context;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v7.app.ActionBar;
|
||||
import android.view.LayoutInflater;
|
||||
@@ -17,14 +17,17 @@ import org.briarproject.bramble.api.contact.Contact;
|
||||
import org.briarproject.bramble.api.contact.ContactId;
|
||||
import org.briarproject.bramble.api.contact.ContactManager;
|
||||
import org.briarproject.bramble.api.db.DbException;
|
||||
import org.briarproject.bramble.util.StringUtils;
|
||||
import org.briarproject.bramble.api.nullsafety.MethodsNotNullByDefault;
|
||||
import org.briarproject.bramble.api.nullsafety.ParametersNotNullByDefault;
|
||||
import org.briarproject.briar.R;
|
||||
import org.briarproject.briar.android.activity.ActivityComponent;
|
||||
import org.briarproject.briar.android.fragment.BaseFragment;
|
||||
import org.briarproject.briar.android.view.TextInputView;
|
||||
import org.briarproject.briar.android.view.TextInputView.TextInputListener;
|
||||
import org.briarproject.briar.android.view.TextSendController;
|
||||
import org.briarproject.briar.android.view.TextSendController.SendListener;
|
||||
import org.briarproject.briar.api.introduction.IntroductionManager;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import javax.inject.Inject;
|
||||
@@ -41,8 +44,10 @@ import static org.briarproject.bramble.util.LogUtils.logException;
|
||||
import static org.briarproject.briar.android.util.UiUtils.getContactDisplayName;
|
||||
import static org.briarproject.briar.api.introduction.IntroductionConstants.MAX_INTRODUCTION_TEXT_LENGTH;
|
||||
|
||||
@MethodsNotNullByDefault
|
||||
@ParametersNotNullByDefault
|
||||
public class IntroductionMessageFragment extends BaseFragment
|
||||
implements TextInputListener {
|
||||
implements SendListener {
|
||||
|
||||
public static final String TAG =
|
||||
IntroductionMessageFragment.class.getName();
|
||||
@@ -84,8 +89,9 @@ public class IntroductionMessageFragment extends BaseFragment
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater,
|
||||
ViewGroup container, Bundle savedInstanceState) {
|
||||
public View onCreateView(LayoutInflater inflater,
|
||||
@Nullable ViewGroup container,
|
||||
@Nullable Bundle savedInstanceState) {
|
||||
|
||||
// change toolbar text
|
||||
ActionBar actionBar = introductionActivity.getSupportActionBar();
|
||||
@@ -97,7 +103,11 @@ public class IntroductionMessageFragment extends BaseFragment
|
||||
View v = inflater.inflate(R.layout.introduction_message, container,
|
||||
false);
|
||||
ui = new ViewHolder(v);
|
||||
ui.message.setSendButtonEnabled(false);
|
||||
TextSendController sendController =
|
||||
new TextSendController(ui.message, this, true);
|
||||
ui.message.setSendController(sendController);
|
||||
ui.message.setMaxTextLength(MAX_INTRODUCTION_TEXT_LENGTH);
|
||||
ui.message.setEnabled(false);
|
||||
|
||||
return v;
|
||||
}
|
||||
@@ -156,13 +166,10 @@ public class IntroductionMessageFragment extends BaseFragment
|
||||
ui.progressBar.setVisibility(GONE);
|
||||
|
||||
if (possible) {
|
||||
// set button action
|
||||
ui.message.setListener(IntroductionMessageFragment.this);
|
||||
|
||||
// show views
|
||||
ui.notPossible.setVisibility(GONE);
|
||||
ui.message.setVisibility(VISIBLE);
|
||||
ui.message.setSendButtonEnabled(true);
|
||||
ui.message.setEnabled(true);
|
||||
ui.message.showSoftKeyboard();
|
||||
} else {
|
||||
ui.notPossible.setVisibility(VISIBLE);
|
||||
@@ -184,14 +191,11 @@ public class IntroductionMessageFragment extends BaseFragment
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSendClick(@NonNull String text) {
|
||||
public void onSendClick(@Nullable String text, List<Uri> imageUris) {
|
||||
// disable button to prevent accidental double invitations
|
||||
ui.message.setSendButtonEnabled(false);
|
||||
ui.message.setEnabled(false);
|
||||
|
||||
String txt = ui.message.getText().toString();
|
||||
if (txt.isEmpty()) txt = null;
|
||||
else txt = StringUtils.truncateUtf8(txt, MAX_INTRODUCTION_TEXT_LENGTH);
|
||||
makeIntroduction(contact1, contact2, txt);
|
||||
makeIntroduction(contact1, contact2, text);
|
||||
|
||||
// don't wait for the introduction to be made before finishing activity
|
||||
introductionActivity.hideSoftKeyboard(ui.message);
|
||||
|
||||
@@ -2,7 +2,7 @@ package org.briarproject.briar.android.keyagreement;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
class CameraException extends IOException {
|
||||
public class CameraException extends IOException {
|
||||
|
||||
CameraException(String message) {
|
||||
super(message);
|
||||
|
||||
@@ -7,7 +7,7 @@ import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@NotNullByDefault
|
||||
interface PreviewConsumer {
|
||||
public interface PreviewConsumer {
|
||||
|
||||
@UiThread
|
||||
void start(Camera camera, int cameraIndex);
|
||||
|
||||
@@ -29,7 +29,7 @@ import static java.util.logging.Level.WARNING;
|
||||
@SuppressWarnings("deprecation")
|
||||
@MethodsNotNullByDefault
|
||||
@ParametersNotNullByDefault
|
||||
class QrCodeDecoder implements PreviewConsumer, PreviewCallback {
|
||||
public class QrCodeDecoder implements PreviewConsumer, PreviewCallback {
|
||||
|
||||
private static final Logger LOG =
|
||||
Logger.getLogger(QrCodeDecoder.class.getName());
|
||||
@@ -40,7 +40,7 @@ class QrCodeDecoder implements PreviewConsumer, PreviewCallback {
|
||||
private Camera camera = null;
|
||||
private int cameraIndex = 0;
|
||||
|
||||
QrCodeDecoder(ResultCallback callback) {
|
||||
public QrCodeDecoder(ResultCallback callback) {
|
||||
this.callback = callback;
|
||||
}
|
||||
|
||||
@@ -141,7 +141,7 @@ class QrCodeDecoder implements PreviewConsumer, PreviewCallback {
|
||||
}
|
||||
|
||||
@NotNullByDefault
|
||||
interface ResultCallback {
|
||||
public interface ResultCallback {
|
||||
|
||||
void handleResult(Result result);
|
||||
}
|
||||
|
||||
@@ -21,13 +21,13 @@ import static java.util.logging.Level.WARNING;
|
||||
import static org.briarproject.bramble.util.LogUtils.logException;
|
||||
|
||||
@NotNullByDefault
|
||||
class QrCodeUtils {
|
||||
public class QrCodeUtils {
|
||||
|
||||
private static final Logger LOG =
|
||||
Logger.getLogger(QrCodeUtils.class.getName());
|
||||
|
||||
@Nullable
|
||||
static Bitmap createQrCode(DisplayMetrics dm, String input) {
|
||||
public static Bitmap createQrCode(DisplayMetrics dm, String input) {
|
||||
int smallestDimen = Math.min(dm.widthPixels, dm.heightPixels);
|
||||
try {
|
||||
// Generate QR code
|
||||
|
||||
@@ -57,7 +57,6 @@ import static android.view.View.VISIBLE;
|
||||
import static org.briarproject.bramble.api.lifecycle.LifecycleManager.LifecycleState.RUNNING;
|
||||
import static org.briarproject.briar.android.BriarService.EXTRA_STARTUP_FAILED;
|
||||
import static org.briarproject.briar.android.activity.RequestCodes.REQUEST_PASSWORD;
|
||||
import static org.briarproject.briar.android.navdrawer.NavDrawerController.ExpiryWarning.NO;
|
||||
import static org.briarproject.briar.android.navdrawer.NavDrawerController.ExpiryWarning.UPDATE;
|
||||
import static org.briarproject.briar.android.util.UiUtils.getDaysUntilExpiry;
|
||||
|
||||
@@ -156,12 +155,12 @@ public class NavDrawerActivity extends BriarActivity implements
|
||||
super.onStart();
|
||||
updateTransports();
|
||||
lockManager.checkIfLockable();
|
||||
controller.showExpiryWarning(new UiResultHandler<ExpiryWarning>(this) {
|
||||
@Override
|
||||
public void onResultUi(ExpiryWarning expiry) {
|
||||
if (expiry != NO) showExpiryWarning(expiry);
|
||||
}
|
||||
});
|
||||
// controller.showExpiryWarning(new UiResultHandler<ExpiryWarning>(this) {
|
||||
// @Override
|
||||
// public void onResultUi(ExpiryWarning expiry) {
|
||||
// if (expiry != NO) showExpiryWarning(expiry);
|
||||
// }
|
||||
// });
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -196,7 +196,7 @@ public class GroupActivity extends
|
||||
|
||||
private void setGroupEnabled(boolean enabled) {
|
||||
isDissolved = !enabled;
|
||||
textInput.setSendButtonEnabled(enabled);
|
||||
textInput.setEnabled(enabled);
|
||||
list.getRecyclerView().setAlpha(enabled ? 1f : 0.5f);
|
||||
|
||||
if (!enabled) {
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package org.briarproject.briar.android.privategroup.creation;
|
||||
|
||||
import android.support.annotation.Nullable;
|
||||
|
||||
import org.briarproject.bramble.api.contact.ContactId;
|
||||
import org.briarproject.bramble.api.db.DbException;
|
||||
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
||||
@@ -18,6 +20,7 @@ public interface CreateGroupController
|
||||
ResultExceptionHandler<GroupId, DbException> result);
|
||||
|
||||
void sendInvitation(GroupId g, Collection<ContactId> contacts,
|
||||
String text, ResultExceptionHandler<Void, DbException> result);
|
||||
@Nullable String text,
|
||||
ResultExceptionHandler<Void, DbException> result);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package org.briarproject.briar.android.privategroup.creation;
|
||||
|
||||
import android.support.annotation.Nullable;
|
||||
|
||||
import org.briarproject.bramble.api.contact.Contact;
|
||||
import org.briarproject.bramble.api.contact.ContactId;
|
||||
import org.briarproject.bramble.api.contact.ContactManager;
|
||||
@@ -123,7 +125,8 @@ class CreateGroupControllerImpl extends ContactSelectorControllerImpl
|
||||
|
||||
@Override
|
||||
public void sendInvitation(GroupId g, Collection<ContactId> contactIds,
|
||||
String text, ResultExceptionHandler<Void, DbException> handler) {
|
||||
@Nullable String text,
|
||||
ResultExceptionHandler<Void, DbException> handler) {
|
||||
runOnDbThread(() -> {
|
||||
try {
|
||||
LocalAuthor localAuthor = identityManager.getLocalAuthor();
|
||||
@@ -144,7 +147,7 @@ class CreateGroupControllerImpl extends ContactSelectorControllerImpl
|
||||
}
|
||||
|
||||
private void signInvitations(GroupId g, LocalAuthor localAuthor,
|
||||
Collection<Contact> contacts, String text,
|
||||
Collection<Contact> contacts, @Nullable String text,
|
||||
ResultExceptionHandler<Void, DbException> handler) {
|
||||
cryptoExecutor.execute(() -> {
|
||||
long timestamp = clock.currentTimeMillis();
|
||||
@@ -160,15 +163,14 @@ class CreateGroupControllerImpl extends ContactSelectorControllerImpl
|
||||
}
|
||||
|
||||
private void sendInvitations(GroupId g,
|
||||
Collection<InvitationContext> contexts, String text,
|
||||
Collection<InvitationContext> contexts, @Nullable String text,
|
||||
ResultExceptionHandler<Void, DbException> handler) {
|
||||
runOnDbThread(() -> {
|
||||
try {
|
||||
String txt = text.isEmpty() ? null : text;
|
||||
for (InvitationContext context : contexts) {
|
||||
try {
|
||||
groupInvitationManager.sendInvitation(g,
|
||||
context.contactId, txt, context.timestamp,
|
||||
context.contactId, text, context.timestamp,
|
||||
context.signature);
|
||||
} catch (NoSuchContactException e) {
|
||||
// Continue
|
||||
|
||||
@@ -55,7 +55,7 @@ public class GroupInviteActivity extends ContactSelectorActivity
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onButtonClick(String text) {
|
||||
public void onButtonClick(@Nullable String text) {
|
||||
if (groupId == null)
|
||||
throw new IllegalStateException("GroupId was not initialized");
|
||||
controller.sendInvitation(groupId, contacts, text,
|
||||
@@ -72,7 +72,6 @@ public class GroupInviteActivity extends ContactSelectorActivity
|
||||
handleDbException(exception);
|
||||
}
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -42,6 +42,7 @@ import static android.content.Context.WIFI_SERVICE;
|
||||
import static android.net.ConnectivityManager.TYPE_MOBILE;
|
||||
import static android.net.ConnectivityManager.TYPE_WIFI;
|
||||
import static android.net.wifi.WifiManager.WIFI_STATE_ENABLED;
|
||||
import static org.briarproject.bramble.util.PrivacyUtils.scrubInetAddress;
|
||||
import static org.briarproject.bramble.util.PrivacyUtils.scrubMacAddress;
|
||||
|
||||
public class BriarReportPrimer implements ReportPrimer {
|
||||
@@ -192,7 +193,7 @@ public class BriarReportPrimer implements ReportPrimer {
|
||||
int ip3 = (ip >> 16) & 0xFF;
|
||||
int ip4 = (ip >> 24) & 0xFF;
|
||||
String address = ip1 + "." + ip2 + "." + ip3 + "." + ip4;
|
||||
customData.put("Wi-Fi address", address);
|
||||
customData.put("Wi-Fi address", scrubInetAddress(address));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,28 +1,31 @@
|
||||
package org.briarproject.briar.android.sharing;
|
||||
|
||||
import android.content.Context;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.annotation.StringRes;
|
||||
import android.support.annotation.UiThread;
|
||||
import android.support.design.widget.Snackbar;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import org.briarproject.bramble.api.nullsafety.MethodsNotNullByDefault;
|
||||
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
||||
import org.briarproject.bramble.api.nullsafety.ParametersNotNullByDefault;
|
||||
import org.briarproject.briar.R;
|
||||
import org.briarproject.briar.android.fragment.BaseFragment;
|
||||
import org.briarproject.briar.android.view.LargeTextInputView;
|
||||
import org.briarproject.briar.android.view.TextInputView.TextInputListener;
|
||||
import org.briarproject.briar.android.view.TextSendController;
|
||||
import org.briarproject.briar.android.view.TextSendController.SendListener;
|
||||
|
||||
import static android.support.design.widget.Snackbar.LENGTH_SHORT;
|
||||
import static org.briarproject.bramble.util.StringUtils.truncateUtf8;
|
||||
import static org.briarproject.bramble.util.StringUtils.utf8IsTooLong;
|
||||
import static org.briarproject.briar.api.sharing.SharingConstants.MAX_INVITATION_TEXT_LENGTH;
|
||||
import java.util.List;
|
||||
|
||||
@MethodsNotNullByDefault
|
||||
@ParametersNotNullByDefault
|
||||
public abstract class BaseMessageFragment extends BaseFragment
|
||||
implements TextInputListener {
|
||||
implements SendListener {
|
||||
|
||||
protected LargeTextInputView message;
|
||||
private MessageFragmentListener listener;
|
||||
@@ -34,16 +37,20 @@ public abstract class BaseMessageFragment extends BaseFragment
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
public View onCreateView(@Nullable LayoutInflater inflater,
|
||||
@Nullable ViewGroup container,
|
||||
@Nullable Bundle savedInstanceState) {
|
||||
|
||||
// inflate view
|
||||
View v = inflater.inflate(R.layout.fragment_message, container,
|
||||
false);
|
||||
message = v.findViewById(R.id.messageView);
|
||||
TextSendController sendController =
|
||||
new TextSendController(message, this, true);
|
||||
message.setSendController(sendController);
|
||||
message.setMaxTextLength(listener.getMaximumTextLength());
|
||||
message.setButtonText(getString(getButtonText()));
|
||||
message.setHint(getHintText());
|
||||
message.setListener(this);
|
||||
|
||||
return v;
|
||||
}
|
||||
@@ -76,21 +83,12 @@ public abstract class BaseMessageFragment extends BaseFragment
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSendClick(String text) {
|
||||
if (utf8IsTooLong(text, listener.getMaximumTextLength())) {
|
||||
Snackbar.make(message, R.string.text_too_long, LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
|
||||
public void onSendClick(@Nullable String text, List<Uri> imageUris) {
|
||||
// disable button to prevent accidental double actions
|
||||
message.setSendButtonEnabled(false);
|
||||
message.setEnabled(false);
|
||||
message.hideSoftKeyboard();
|
||||
|
||||
text = truncateUtf8(text, MAX_INVITATION_TEXT_LENGTH);
|
||||
if(!listener.onButtonClick(text)) {
|
||||
message.setSendButtonEnabled(true);
|
||||
message.showSoftKeyboard();
|
||||
}
|
||||
listener.onButtonClick(text);
|
||||
}
|
||||
|
||||
@UiThread
|
||||
@@ -101,8 +99,7 @@ public abstract class BaseMessageFragment extends BaseFragment
|
||||
|
||||
void setTitle(@StringRes int titleRes);
|
||||
|
||||
/** Returns true when the button click has been consumed. */
|
||||
boolean onButtonClick(String text);
|
||||
void onButtonClick(@Nullable String text);
|
||||
|
||||
int getMaximumTextLength();
|
||||
|
||||
|
||||
@@ -41,13 +41,12 @@ public abstract class ShareActivity extends ContactSelectorActivity
|
||||
|
||||
@UiThread
|
||||
@Override
|
||||
public boolean onButtonClick(String text) {
|
||||
public void onButtonClick(@Nullable String text) {
|
||||
share(contacts, text);
|
||||
setResult(RESULT_OK);
|
||||
supportFinishAfterTransition();
|
||||
return true;
|
||||
}
|
||||
|
||||
abstract void share(Collection<ContactId> contacts, String text);
|
||||
abstract void share(Collection<ContactId> contacts, @Nullable String text);
|
||||
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ public class ShareBlogActivity extends ShareActivity {
|
||||
}
|
||||
|
||||
@Override
|
||||
void share(Collection<ContactId> contacts, String text) {
|
||||
void share(Collection<ContactId> contacts, @Nullable String text) {
|
||||
controller.share(groupId, contacts, text,
|
||||
new UiExceptionHandler<DbException>(this) {
|
||||
@Override
|
||||
|
||||
@@ -9,10 +9,12 @@ import org.briarproject.briar.android.controller.handler.ExceptionHandler;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public interface ShareBlogController
|
||||
extends ContactSelectorController<SelectableContactItem> {
|
||||
|
||||
void share(GroupId g, Collection<ContactId> contacts, String text,
|
||||
void share(GroupId g, Collection<ContactId> contacts, @Nullable String text,
|
||||
ExceptionHandler<DbException> handler);
|
||||
|
||||
}
|
||||
|
||||
@@ -20,12 +20,12 @@ import java.util.Collection;
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import javax.annotation.concurrent.Immutable;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import static java.util.logging.Level.WARNING;
|
||||
import static org.briarproject.bramble.util.LogUtils.logException;
|
||||
import static org.briarproject.bramble.util.StringUtils.isNullOrEmpty;
|
||||
|
||||
@Immutable
|
||||
@NotNullByDefault
|
||||
@@ -56,17 +56,16 @@ class ShareBlogControllerImpl extends ContactSelectorControllerImpl
|
||||
}
|
||||
|
||||
@Override
|
||||
public void share(GroupId g, Collection<ContactId> contacts, String text,
|
||||
ExceptionHandler<DbException> handler) {
|
||||
public void share(GroupId g, Collection<ContactId> contacts, @Nullable
|
||||
String text, ExceptionHandler<DbException> handler) {
|
||||
runOnDbThread(() -> {
|
||||
try {
|
||||
String txt = isNullOrEmpty(text) ? null : text;
|
||||
for (ContactId c : contacts) {
|
||||
try {
|
||||
long time = Math.max(clock.currentTimeMillis(),
|
||||
conversationManager.getGroupCount(c)
|
||||
.getLatestMsgTime() + 1);
|
||||
blogSharingManager.sendInvitation(g, c, txt, time);
|
||||
blogSharingManager.sendInvitation(g, c, text, time);
|
||||
} catch (NoSuchContactException | NoSuchGroupException e) {
|
||||
logException(LOG, WARNING, e);
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ public class ShareForumActivity extends ShareActivity {
|
||||
}
|
||||
|
||||
@Override
|
||||
void share(Collection<ContactId> contacts, String text) {
|
||||
void share(Collection<ContactId> contacts, @Nullable String text) {
|
||||
controller.share(groupId, contacts, text,
|
||||
new UiExceptionHandler<DbException>(this) {
|
||||
@Override
|
||||
|
||||
@@ -9,10 +9,12 @@ import org.briarproject.briar.android.controller.handler.ExceptionHandler;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public interface ShareForumController
|
||||
extends ContactSelectorController<SelectableContactItem> {
|
||||
|
||||
void share(GroupId g, Collection<ContactId> contacts, String text,
|
||||
void share(GroupId g, Collection<ContactId> contacts, @Nullable String text,
|
||||
ExceptionHandler<DbException> handler);
|
||||
|
||||
}
|
||||
|
||||
@@ -13,19 +13,19 @@ import org.briarproject.bramble.api.sync.GroupId;
|
||||
import org.briarproject.bramble.api.system.Clock;
|
||||
import org.briarproject.briar.android.contactselection.ContactSelectorControllerImpl;
|
||||
import org.briarproject.briar.android.controller.handler.ExceptionHandler;
|
||||
import org.briarproject.briar.api.forum.ForumSharingManager;
|
||||
import org.briarproject.briar.api.conversation.ConversationManager;
|
||||
import org.briarproject.briar.api.forum.ForumSharingManager;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import javax.annotation.concurrent.Immutable;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import static java.util.logging.Level.WARNING;
|
||||
import static org.briarproject.bramble.util.LogUtils.logException;
|
||||
import static org.briarproject.bramble.util.StringUtils.isNullOrEmpty;
|
||||
|
||||
@Immutable
|
||||
@NotNullByDefault
|
||||
@@ -57,16 +57,15 @@ class ShareForumControllerImpl extends ContactSelectorControllerImpl
|
||||
|
||||
@Override
|
||||
public void share(GroupId g, Collection<ContactId> contacts,
|
||||
String text, ExceptionHandler<DbException> handler) {
|
||||
@Nullable String text, ExceptionHandler<DbException> handler) {
|
||||
runOnDbThread(() -> {
|
||||
try {
|
||||
String txt = isNullOrEmpty(text) ? null : text;
|
||||
for (ContactId c : contacts) {
|
||||
try {
|
||||
long time = Math.max(clock.currentTimeMillis(),
|
||||
conversationManager.getGroupCount(c)
|
||||
.getLatestMsgTime() + 1);
|
||||
forumSharingManager.sendInvitation(g, c, txt, time);
|
||||
forumSharingManager.sendInvitation(g, c, text, time);
|
||||
} catch (NoSuchContactException | NoSuchGroupException e) {
|
||||
logException(LOG, WARNING, e);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.briarproject.briar.android.threaded;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.CallSuper;
|
||||
import android.support.annotation.StringRes;
|
||||
@@ -26,13 +27,15 @@ import org.briarproject.briar.android.threaded.ThreadItemAdapter.ThreadItemListe
|
||||
import org.briarproject.briar.android.threaded.ThreadListController.ThreadListDataSource;
|
||||
import org.briarproject.briar.android.threaded.ThreadListController.ThreadListListener;
|
||||
import org.briarproject.briar.android.view.BriarRecyclerView;
|
||||
import org.briarproject.briar.android.view.KeyboardAwareLinearLayout;
|
||||
import org.briarproject.briar.android.view.TextInputView;
|
||||
import org.briarproject.briar.android.view.TextInputView.TextInputListener;
|
||||
import org.briarproject.briar.android.view.TextSendController;
|
||||
import org.briarproject.briar.android.view.TextSendController.SendListener;
|
||||
import org.briarproject.briar.android.view.UnreadMessageButton;
|
||||
import org.briarproject.briar.api.client.NamedGroup;
|
||||
import org.thoughtcrime.securesms.components.KeyboardAwareLinearLayout;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
@@ -42,14 +45,14 @@ import static android.support.design.widget.Snackbar.make;
|
||||
import static android.support.v7.widget.RecyclerView.NO_POSITION;
|
||||
import static android.support.v7.widget.RecyclerView.SCROLL_STATE_IDLE;
|
||||
import static java.util.logging.Level.INFO;
|
||||
import static org.briarproject.bramble.util.StringUtils.utf8IsTooLong;
|
||||
import static org.briarproject.bramble.util.StringUtils.isNullOrEmpty;
|
||||
import static org.briarproject.briar.android.threaded.ThreadItemAdapter.UnreadCount;
|
||||
|
||||
@MethodsNotNullByDefault
|
||||
@ParametersNotNullByDefault
|
||||
public abstract class ThreadListActivity<G extends NamedGroup, I extends ThreadItem, A extends ThreadItemAdapter<I>>
|
||||
extends BriarActivity
|
||||
implements ThreadListListener<I>, TextInputListener, SharingListener,
|
||||
implements ThreadListListener<I>, SendListener, SharingListener,
|
||||
ThreadItemListener<I>, ThreadListDataSource {
|
||||
|
||||
protected static final String KEY_REPLY_ID = "replyId";
|
||||
@@ -86,7 +89,10 @@ public abstract class ThreadListActivity<G extends NamedGroup, I extends ThreadI
|
||||
getController().setGroupId(groupId);
|
||||
|
||||
textInput = findViewById(R.id.text_input_container);
|
||||
textInput.setListener(this);
|
||||
TextSendController sendController =
|
||||
new TextSendController(textInput, this, false);
|
||||
textInput.setSendController(sendController);
|
||||
textInput.setMaxTextLength(getMaxTextLength());
|
||||
list = findViewById(R.id.list);
|
||||
layoutManager = new LinearLayoutManager(this);
|
||||
// FIXME pre-fetching messes with read state, find better solution #1289
|
||||
@@ -266,7 +272,7 @@ public abstract class ThreadListActivity<G extends NamedGroup, I extends ThreadI
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
if (adapter.getHighlightedItem() != null) {
|
||||
textInput.setText("");
|
||||
textInput.clearText();
|
||||
replyId = null;
|
||||
updateTextInput();
|
||||
} else {
|
||||
@@ -348,13 +354,9 @@ public abstract class ThreadListActivity<G extends NamedGroup, I extends ThreadI
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSendClick(String text) {
|
||||
if (text.trim().length() == 0)
|
||||
return;
|
||||
if (utf8IsTooLong(text, getMaxTextLength())) {
|
||||
displaySnackbar(R.string.text_too_long);
|
||||
return;
|
||||
}
|
||||
public void onSendClick(@Nullable String text, List<Uri> imageUris) {
|
||||
if (isNullOrEmpty(text)) throw new AssertionError();
|
||||
|
||||
I replyItem = adapter.getHighlightedItem();
|
||||
UiResultExceptionHandler<I, DbException> handler =
|
||||
new UiResultExceptionHandler<I, DbException>(this) {
|
||||
@@ -370,7 +372,7 @@ public abstract class ThreadListActivity<G extends NamedGroup, I extends ThreadI
|
||||
};
|
||||
getController().createAndStoreMessage(text, replyItem, handler);
|
||||
textInput.hideSoftKeyboard();
|
||||
textInput.setText("");
|
||||
textInput.clearText();
|
||||
replyId = null;
|
||||
updateTextInput();
|
||||
}
|
||||
|
||||
@@ -207,7 +207,7 @@ public class UiUtils {
|
||||
runnable.run();
|
||||
}
|
||||
};
|
||||
ssb.setSpan(cSpan, start + 1, end, 0);
|
||||
ssb.setSpan(cSpan, start, end, 0);
|
||||
textView.setText(ssb);
|
||||
textView.setMovementMethod(new LinkMovementMethod());
|
||||
}
|
||||
|
||||
@@ -28,6 +28,8 @@ public class BriarRecyclerView extends FrameLayout {
|
||||
|
||||
private final Handler handler = new Handler(Looper.getMainLooper());
|
||||
|
||||
private long PERIODIC_UPDATE_MILLIS = MIN_DATE_RESOLUTION;
|
||||
|
||||
private RecyclerView recyclerView;
|
||||
private Group emptyState;
|
||||
private AppCompatImageView emptyImage;
|
||||
@@ -215,9 +217,9 @@ public class BriarRecyclerView extends FrameLayout {
|
||||
refresher = () -> {
|
||||
Adapter adapter = recyclerView.getAdapter();
|
||||
adapter.notifyItemRangeChanged(0, adapter.getItemCount());
|
||||
handler.postDelayed(refresher, MIN_DATE_RESOLUTION);
|
||||
handler.postDelayed(refresher, PERIODIC_UPDATE_MILLIS);
|
||||
};
|
||||
handler.postDelayed(refresher, MIN_DATE_RESOLUTION);
|
||||
handler.postDelayed(refresher, PERIODIC_UPDATE_MILLIS);
|
||||
}
|
||||
|
||||
public void stopPeriodicUpdate() {
|
||||
@@ -227,4 +229,8 @@ public class BriarRecyclerView extends FrameLayout {
|
||||
}
|
||||
}
|
||||
|
||||
public void setPERIODIC_UPDATE_MILLIS(long millis) {
|
||||
PERIODIC_UPDATE_MILLIS = millis;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,239 @@
|
||||
package org.briarproject.briar.android.view;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.Rect;
|
||||
import android.os.IBinder;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.annotation.StringRes;
|
||||
import android.support.v7.widget.AppCompatImageButton;
|
||||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.EditText;
|
||||
|
||||
import com.vanniktech.emoji.EmojiEditText;
|
||||
import com.vanniktech.emoji.EmojiPopup;
|
||||
import com.vanniktech.emoji.RecentEmoji;
|
||||
|
||||
import org.briarproject.briar.R;
|
||||
import org.briarproject.briar.android.BriarApplication;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import static android.content.Context.INPUT_METHOD_SERVICE;
|
||||
import static android.content.Context.LAYOUT_INFLATER_SERVICE;
|
||||
import static android.view.KeyEvent.KEYCODE_ENTER;
|
||||
import static android.view.inputmethod.InputMethodManager.SHOW_IMPLICIT;
|
||||
import static java.util.Objects.requireNonNull;
|
||||
import static org.briarproject.bramble.util.StringUtils.utf8IsTooLong;
|
||||
|
||||
public class EmojiTextInputView extends KeyboardAwareLinearLayout implements
|
||||
TextWatcher {
|
||||
|
||||
@Inject
|
||||
RecentEmoji recentEmoji;
|
||||
|
||||
private final AppCompatImageButton emojiToggle;
|
||||
private final EmojiPopup emojiPopup;
|
||||
private final EditText editText;
|
||||
|
||||
@Nullable
|
||||
private TextInputListener listener;
|
||||
private int maxLength = Integer.MAX_VALUE;
|
||||
private boolean emptyTextAllowed = false;
|
||||
private boolean isEmpty = true;
|
||||
|
||||
public EmojiTextInputView(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public EmojiTextInputView(Context context, @Nullable AttributeSet attrs) {
|
||||
this(context, attrs, 0);
|
||||
}
|
||||
|
||||
public EmojiTextInputView(Context context, @Nullable AttributeSet attrs,
|
||||
int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
|
||||
// inflate layout
|
||||
LayoutInflater inflater = (LayoutInflater) requireNonNull(
|
||||
context.getSystemService(LAYOUT_INFLATER_SERVICE));
|
||||
inflater.inflate(R.layout.emoji_text_input_view, this, true);
|
||||
|
||||
// get attributes
|
||||
TypedArray a = context.obtainStyledAttributes(attrs,
|
||||
R.styleable.EmojiTextInputView);
|
||||
int paddingBottom = a.getDimensionPixelSize(
|
||||
R.styleable.EmojiTextInputView_textPaddingBottom, 0);
|
||||
int paddingEnd = a.getDimensionPixelSize(
|
||||
R.styleable.EmojiTextInputView_textPaddingEnd, 0);
|
||||
int maxLines =
|
||||
a.getInteger(R.styleable.EmojiTextInputView_maxTextLines, 0);
|
||||
a.recycle();
|
||||
|
||||
// apply attributes to editText
|
||||
editText = findViewById(R.id.input_text);
|
||||
editText.setPadding(0, 0, paddingEnd, paddingBottom);
|
||||
if (maxLines > 0) editText.setMaxLines(maxLines);
|
||||
editText.setOnClickListener(v -> showSoftKeyboard());
|
||||
editText.addTextChangedListener(this);
|
||||
// support sending with Ctrl+Enter
|
||||
editText.setOnKeyListener((v, keyCode, event) -> {
|
||||
if (listener != null && keyCode == KEYCODE_ENTER &&
|
||||
event.isCtrlPressed()) {
|
||||
listener.onSendEvent();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
emojiToggle = findViewById(R.id.emoji_toggle);
|
||||
|
||||
// stuff we can't do in edit mode goes below
|
||||
if (isInEditMode()) {
|
||||
emojiPopup = null;
|
||||
return;
|
||||
}
|
||||
BriarApplication app =
|
||||
(BriarApplication) context.getApplicationContext();
|
||||
app.getApplicationComponent().inject(this);
|
||||
emojiPopup = EmojiPopup.Builder
|
||||
.fromRootView(this)
|
||||
.setRecentEmoji(recentEmoji)
|
||||
.setOnEmojiPopupShownListener(this::showKeyboardIcon)
|
||||
.setOnEmojiPopupDismissListener(this::showEmojiIcon)
|
||||
.build((EmojiEditText) editText);
|
||||
emojiToggle.setOnClickListener(v -> emojiPopup.toggle());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count,
|
||||
int after) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before,
|
||||
int count) {
|
||||
// Need to start at position 0 to change empty
|
||||
if (start != 0 || emptyTextAllowed || listener == null) return;
|
||||
if (s.length() == 0) {
|
||||
if (!isEmpty) {
|
||||
isEmpty = true;
|
||||
listener.onTextIsEmptyChanged(true);
|
||||
}
|
||||
} else if (isEmpty) {
|
||||
isEmpty = false;
|
||||
listener.onTextIsEmptyChanged(false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEnabled(boolean enabled) {
|
||||
super.setEnabled(enabled);
|
||||
editText.setEnabled(enabled);
|
||||
emojiToggle.setEnabled(enabled);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGravity(int gravity) {
|
||||
editText.setGravity(gravity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean requestFocus(int direction, Rect previouslyFocusedRect) {
|
||||
return editText.requestFocus(direction, previouslyFocusedRect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow();
|
||||
if (emojiPopup.isShowing()) emojiPopup.dismiss();
|
||||
}
|
||||
|
||||
void setTextInputListener(@Nullable TextInputListener listener) {
|
||||
this.listener = listener;
|
||||
}
|
||||
|
||||
void setAllowEmptyText(boolean emptyTextAllowed) {
|
||||
this.emptyTextAllowed = emptyTextAllowed;
|
||||
}
|
||||
|
||||
void setMaxLength(int maxLength) {
|
||||
this.maxLength = maxLength;
|
||||
}
|
||||
|
||||
void setMaxLines(int maxLines) {
|
||||
editText.setMaxLines(maxLines);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current text or {@code null},
|
||||
* if it is empty or only consists of white-spaces.
|
||||
*/
|
||||
@Nullable
|
||||
String getText() {
|
||||
Editable editable = editText.getText();
|
||||
String str = editable == null ? null : editable.toString().trim();
|
||||
if (str == null || str.length() == 0) return null;
|
||||
return str;
|
||||
}
|
||||
|
||||
void clearText() {
|
||||
editText.setText(null);
|
||||
}
|
||||
|
||||
boolean isEmpty() {
|
||||
return getText() == null;
|
||||
}
|
||||
|
||||
boolean isTooLong() {
|
||||
return editText.getText() != null &&
|
||||
utf8IsTooLong(editText.getText().toString().trim(), maxLength);
|
||||
}
|
||||
|
||||
CharSequence getHint() {
|
||||
return editText.getHint();
|
||||
}
|
||||
|
||||
void setHint(@StringRes int res) {
|
||||
setHint(getContext().getString(res));
|
||||
}
|
||||
|
||||
void setHint(CharSequence hint) {
|
||||
editText.setHint(hint);
|
||||
}
|
||||
|
||||
private void showEmojiIcon() {
|
||||
emojiToggle.setImageResource(R.drawable.ic_emoji_toggle);
|
||||
}
|
||||
|
||||
private void showKeyboardIcon() {
|
||||
emojiToggle.setImageResource(R.drawable.ic_keyboard);
|
||||
}
|
||||
|
||||
void showSoftKeyboard() {
|
||||
Object o = getContext().getSystemService(INPUT_METHOD_SERVICE);
|
||||
InputMethodManager imm = (InputMethodManager) requireNonNull(o);
|
||||
imm.showSoftInput(editText, SHOW_IMPLICIT);
|
||||
}
|
||||
|
||||
void hideSoftKeyboard() {
|
||||
if (emojiPopup.isShowing()) emojiPopup.dismiss();
|
||||
IBinder token = editText.getWindowToken();
|
||||
Object o = getContext().getSystemService(INPUT_METHOD_SERVICE);
|
||||
InputMethodManager imm = (InputMethodManager) requireNonNull(o);
|
||||
imm.hideSoftInputFromWindow(token, 0);
|
||||
}
|
||||
|
||||
interface TextInputListener {
|
||||
void onTextIsEmptyChanged(boolean isEmpty);
|
||||
void onSendEvent();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
package org.briarproject.briar.android.view;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.net.Uri;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.constraint.ConstraintLayout;
|
||||
import android.support.v7.graphics.Palette;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.bumptech.glide.load.DataSource;
|
||||
import com.bumptech.glide.load.engine.GlideException;
|
||||
import com.bumptech.glide.request.RequestListener;
|
||||
import com.bumptech.glide.request.target.Target;
|
||||
|
||||
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
||||
import org.briarproject.briar.R;
|
||||
import org.briarproject.briar.android.conversation.glide.GlideApp;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static android.content.Context.LAYOUT_INFLATER_SERVICE;
|
||||
import static android.graphics.Color.BLACK;
|
||||
import static android.graphics.Color.WHITE;
|
||||
import static android.support.v7.app.AppCompatDelegate.MODE_NIGHT_YES;
|
||||
import static android.support.v7.app.AppCompatDelegate.getDefaultNightMode;
|
||||
import static android.widget.Toast.LENGTH_LONG;
|
||||
import static com.bumptech.glide.load.engine.DiskCacheStrategy.NONE;
|
||||
import static com.bumptech.glide.load.resource.bitmap.DownsampleStrategy.FIT_CENTER;
|
||||
import static java.util.Objects.requireNonNull;
|
||||
|
||||
@NotNullByDefault
|
||||
public class ImagePreview extends ConstraintLayout {
|
||||
|
||||
private final ImageView imageView;
|
||||
private final int backgroundColor =
|
||||
getDefaultNightMode() == MODE_NIGHT_YES ? BLACK : WHITE;
|
||||
|
||||
@Nullable
|
||||
private ImagePreviewListener listener;
|
||||
|
||||
public ImagePreview(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public ImagePreview(Context context, @Nullable AttributeSet attrs) {
|
||||
this(context, attrs, 0);
|
||||
}
|
||||
|
||||
public ImagePreview(Context context, @Nullable AttributeSet attrs,
|
||||
int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
|
||||
// inflate layout
|
||||
LayoutInflater inflater = (LayoutInflater) requireNonNull(
|
||||
context.getSystemService(LAYOUT_INFLATER_SERVICE));
|
||||
inflater.inflate(R.layout.image_preview, this, true);
|
||||
|
||||
// find image view and set background color
|
||||
imageView = findViewById(R.id.imageView);
|
||||
imageView.setBackgroundColor(backgroundColor);
|
||||
|
||||
// set cancel listener
|
||||
findViewById(R.id.imageCancelButton).setOnClickListener(view -> {
|
||||
if (listener != null) listener.onCancel();
|
||||
});
|
||||
}
|
||||
|
||||
void setImagePreviewListener(ImagePreviewListener listener) {
|
||||
this.listener = listener;
|
||||
}
|
||||
|
||||
void showPreview(List<Uri> imageUris) {
|
||||
setVisibility(VISIBLE);
|
||||
GlideApp.with(imageView)
|
||||
.asBitmap()
|
||||
.load(imageUris.get(0)) // TODO show more than the first
|
||||
.diskCacheStrategy(NONE)
|
||||
.downsample(FIT_CENTER)
|
||||
.addListener(new RequestListener<Bitmap>() {
|
||||
@Override
|
||||
public boolean onLoadFailed(@Nullable GlideException e,
|
||||
Object model, Target<Bitmap> target,
|
||||
boolean isFirstResource) {
|
||||
if (listener != null) listener.onCancel();
|
||||
Toast.makeText(imageView.getContext(),
|
||||
R.string.image_attach_error, LENGTH_LONG)
|
||||
.show();
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onResourceReady(Bitmap resource,
|
||||
Object model, Target<Bitmap> target,
|
||||
DataSource dataSource, boolean isFirstResource) {
|
||||
Palette.from(resource).generate(
|
||||
ImagePreview.this::onPaletteGenerated);
|
||||
return false;
|
||||
}
|
||||
})
|
||||
.into(imageView);
|
||||
}
|
||||
|
||||
void onPaletteGenerated(@Nullable Palette palette) {
|
||||
if (palette == null) return;
|
||||
int color = getDefaultNightMode() == MODE_NIGHT_YES ?
|
||||
palette.getDarkMutedColor(backgroundColor) :
|
||||
palette.getLightMutedColor(backgroundColor);
|
||||
imageView.setBackgroundColor(color);
|
||||
}
|
||||
|
||||
interface ImagePreviewListener {
|
||||
void onCancel();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,4 +1,8 @@
|
||||
package org.thoughtcrime.securesms.components;
|
||||
/*
|
||||
Taken from Signal, licences under GPLv3
|
||||
*/
|
||||
|
||||
package org.briarproject.briar.android.view;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.content.Context;
|
||||
@@ -24,6 +28,7 @@ import javax.annotation.Nullable;
|
||||
import static android.content.Context.WINDOW_SERVICE;
|
||||
import static android.view.Surface.ROTATION_270;
|
||||
import static android.view.Surface.ROTATION_90;
|
||||
import static java.util.Objects.requireNonNull;
|
||||
import static java.util.logging.Level.INFO;
|
||||
import static java.util.logging.Level.WARNING;
|
||||
|
||||
@@ -38,8 +43,6 @@ public class KeyboardAwareLinearLayout extends LinearLayout {
|
||||
Logger.getLogger(KeyboardAwareLinearLayout.class.getName());
|
||||
|
||||
private final Rect rect = new Rect();
|
||||
private final Set<OnKeyboardHiddenListener> hiddenListeners =
|
||||
new HashSet<>();
|
||||
private final Set<OnKeyboardShownListener> shownListeners = new HashSet<>();
|
||||
private final int minKeyboardSize;
|
||||
private final int minCustomKeyboardSize;
|
||||
@@ -153,7 +156,6 @@ public class KeyboardAwareLinearLayout extends LinearLayout {
|
||||
protected void onKeyboardClose() {
|
||||
LOG.info("onKeyboardClose()");
|
||||
keyboardOpen = false;
|
||||
notifyHiddenListeners();
|
||||
}
|
||||
|
||||
public boolean isKeyboardOpen() {
|
||||
@@ -173,7 +175,7 @@ public class KeyboardAwareLinearLayout extends LinearLayout {
|
||||
private int getDeviceRotation() {
|
||||
WindowManager windowManager =
|
||||
(WindowManager) getContext().getSystemService(WINDOW_SERVICE);
|
||||
return windowManager.getDefaultDisplay().getRotation();
|
||||
return requireNonNull(windowManager).getDefaultDisplay().getRotation();
|
||||
}
|
||||
|
||||
private int getKeyboardLandscapeHeight() {
|
||||
@@ -199,43 +201,6 @@ public class KeyboardAwareLinearLayout extends LinearLayout {
|
||||
prefs.edit().putInt("keyboard_height_portrait", height).apply();
|
||||
}
|
||||
|
||||
public void postOnKeyboardClose(Runnable runnable) {
|
||||
if (keyboardOpen) {
|
||||
addOnKeyboardHiddenListener(new OnKeyboardHiddenListener() {
|
||||
@Override
|
||||
public void onKeyboardHidden() {
|
||||
removeOnKeyboardHiddenListener(this);
|
||||
runnable.run();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
runnable.run();
|
||||
}
|
||||
}
|
||||
|
||||
public void postOnKeyboardOpen(Runnable runnable) {
|
||||
if (!keyboardOpen) {
|
||||
addOnKeyboardShownListener(new OnKeyboardShownListener() {
|
||||
@Override
|
||||
public void onKeyboardShown() {
|
||||
removeOnKeyboardShownListener(this);
|
||||
runnable.run();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
runnable.run();
|
||||
}
|
||||
}
|
||||
|
||||
public void addOnKeyboardHiddenListener(OnKeyboardHiddenListener listener) {
|
||||
hiddenListeners.add(listener);
|
||||
}
|
||||
|
||||
public void removeOnKeyboardHiddenListener(
|
||||
OnKeyboardHiddenListener listener) {
|
||||
hiddenListeners.remove(listener);
|
||||
}
|
||||
|
||||
public void addOnKeyboardShownListener(OnKeyboardShownListener listener) {
|
||||
shownListeners.add(listener);
|
||||
}
|
||||
@@ -245,15 +210,6 @@ public class KeyboardAwareLinearLayout extends LinearLayout {
|
||||
shownListeners.remove(listener);
|
||||
}
|
||||
|
||||
private void notifyHiddenListeners() {
|
||||
// Make a copy as listeners may remove themselves when called
|
||||
Set<OnKeyboardHiddenListener> listeners =
|
||||
new HashSet<>(hiddenListeners);
|
||||
for (OnKeyboardHiddenListener listener : listeners) {
|
||||
listener.onKeyboardHidden();
|
||||
}
|
||||
}
|
||||
|
||||
private void notifyShownListeners() {
|
||||
// Make a copy as listeners may remove themselves when called
|
||||
Set<OnKeyboardShownListener> listeners = new HashSet<>(shownListeners);
|
||||
@@ -262,11 +218,8 @@ public class KeyboardAwareLinearLayout extends LinearLayout {
|
||||
}
|
||||
}
|
||||
|
||||
public interface OnKeyboardHiddenListener {
|
||||
void onKeyboardHidden();
|
||||
}
|
||||
|
||||
public interface OnKeyboardShownListener {
|
||||
void onKeyboardShown();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4,7 +4,6 @@ import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.support.annotation.UiThread;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
|
||||
@@ -14,6 +13,7 @@ import org.briarproject.briar.R;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import static android.view.Gravity.BOTTOM;
|
||||
import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;
|
||||
|
||||
@UiThread
|
||||
@@ -32,18 +32,6 @@ public class LargeTextInputView extends TextInputView {
|
||||
public LargeTextInputView(Context context, @Nullable AttributeSet attrs,
|
||||
int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void inflateLayout(Context context) {
|
||||
LayoutInflater inflater = (LayoutInflater) context
|
||||
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||
inflater.inflate(R.layout.text_input_view_large, this, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setUpViews(Context context, @Nullable AttributeSet attrs) {
|
||||
super.setUpViews(context, attrs);
|
||||
|
||||
// get attributes
|
||||
TypedArray attributes = context.obtainStyledAttributes(attrs,
|
||||
@@ -57,21 +45,27 @@ public class LargeTextInputView extends TextInputView {
|
||||
attributes.recycle();
|
||||
|
||||
if (buttonText != null) setButtonText(buttonText);
|
||||
if (maxLines > 0) editText.setMaxLines(maxLines);
|
||||
if (maxLines > 0) textInput.setMaxLines(maxLines);
|
||||
if (fillHeight) {
|
||||
ViewGroup layout = findViewById(R.id.input_layout);
|
||||
LayoutParams params = (LayoutParams) layout.getLayoutParams();
|
||||
params.height = 0;
|
||||
params.weight = 1;
|
||||
layout.setLayoutParams(params);
|
||||
ViewGroup.LayoutParams editParams = editText.getLayoutParams();
|
||||
editParams.height = MATCH_PARENT;
|
||||
editText.setLayoutParams(editParams);
|
||||
ViewGroup.LayoutParams inputParams = textInput.getLayoutParams();
|
||||
inputParams.height = MATCH_PARENT;
|
||||
textInput.setLayoutParams(inputParams);
|
||||
}
|
||||
textInput.setGravity(BOTTOM);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getLayout() {
|
||||
return R.layout.text_input_view_large;
|
||||
}
|
||||
|
||||
public void setButtonText(String text) {
|
||||
((Button) sendButton).setText(text);
|
||||
((Button) findViewById(R.id.btn_send)).setText(text);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -39,6 +39,9 @@ public class QrCodeView extends FrameLayout {
|
||||
listener.setFullscreen(fullscreen);
|
||||
}
|
||||
);
|
||||
|
||||
// TODO remove
|
||||
fullscreenButton.setVisibility(INVISIBLE);
|
||||
}
|
||||
|
||||
@UiThread
|
||||
|
||||
@@ -0,0 +1,214 @@
|
||||
package org.briarproject.briar.android.view;
|
||||
|
||||
import android.content.ClipData;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.annotation.UiThread;
|
||||
import android.support.v4.view.AbsSavedState;
|
||||
import android.support.v7.widget.AppCompatImageButton;
|
||||
|
||||
import org.briarproject.briar.R;
|
||||
import org.briarproject.briar.android.view.ImagePreview.ImagePreviewListener;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static android.content.Intent.ACTION_GET_CONTENT;
|
||||
import static android.content.Intent.ACTION_OPEN_DOCUMENT;
|
||||
import static android.content.Intent.CATEGORY_OPENABLE;
|
||||
import static android.content.Intent.EXTRA_ALLOW_MULTIPLE;
|
||||
import static android.os.Build.VERSION.SDK_INT;
|
||||
import static android.support.v4.view.AbsSavedState.EMPTY_STATE;
|
||||
import static android.view.View.GONE;
|
||||
import static android.view.View.INVISIBLE;
|
||||
import static android.view.View.VISIBLE;
|
||||
import static java.util.Collections.emptyList;
|
||||
import static java.util.Collections.singletonList;
|
||||
import static java.util.Objects.requireNonNull;
|
||||
|
||||
@UiThread
|
||||
public class TextAttachmentController extends TextSendController
|
||||
implements ImagePreviewListener {
|
||||
|
||||
private final AppCompatImageButton imageButton;
|
||||
private final ImagePreview imagePreview;
|
||||
|
||||
private final AttachImageListener imageListener;
|
||||
|
||||
private CharSequence textHint;
|
||||
private List<Uri> imageUris = emptyList();
|
||||
|
||||
public TextAttachmentController(TextInputView v, ImagePreview imagePreview,
|
||||
SendListener listener, AttachImageListener imageListener) {
|
||||
super(v, listener, false);
|
||||
this.imageListener = imageListener;
|
||||
this.imagePreview = imagePreview;
|
||||
this.imagePreview.setImagePreviewListener(this);
|
||||
|
||||
imageButton = v.findViewById(R.id.imageButton);
|
||||
imageButton.setOnClickListener(view -> onImageButtonClicked());
|
||||
|
||||
textHint = textInput.getHint();
|
||||
|
||||
// show image button
|
||||
showImageButton(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextIsEmptyChanged(boolean isEmpty) {
|
||||
if (imageUris.isEmpty()) showImageButton(isEmpty);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSendEvent() {
|
||||
if (canSend()) {
|
||||
listener.onSendClick(textInput.getText(), imageUris);
|
||||
reset();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canSendEmptyText() {
|
||||
return !imageUris.isEmpty();
|
||||
}
|
||||
|
||||
private void onImageButtonClicked() {
|
||||
Intent intent = new Intent(SDK_INT >= 19 ?
|
||||
ACTION_OPEN_DOCUMENT : ACTION_GET_CONTENT);
|
||||
intent.addCategory(CATEGORY_OPENABLE);
|
||||
intent.setType("image/*");
|
||||
if (SDK_INT >= 18) // TODO set true to allow attaching multiple images
|
||||
intent.putExtra(EXTRA_ALLOW_MULTIPLE, false);
|
||||
requireNonNull(imageListener).onAttachImage(intent);
|
||||
}
|
||||
|
||||
public void onImageReceived(@Nullable Intent resultData) {
|
||||
if (resultData == null) return;
|
||||
if (resultData.getData() != null) {
|
||||
imageUris = singletonList(resultData.getData());
|
||||
onNewUris();
|
||||
} else if (SDK_INT >= 18 && resultData.getClipData() != null) {
|
||||
ClipData clipData = resultData.getClipData();
|
||||
imageUris = new ArrayList<>(clipData.getItemCount());
|
||||
for (int i = 0; i < clipData.getItemCount(); i++) {
|
||||
imageUris.add(clipData.getItemAt(i).getUri());
|
||||
}
|
||||
onNewUris();
|
||||
}
|
||||
}
|
||||
|
||||
private void onNewUris() {
|
||||
if (imageUris.isEmpty()) return;
|
||||
showImageButton(false);
|
||||
textInput.setHint(R.string.image_caption_hint);
|
||||
imagePreview.showPreview(imageUris);
|
||||
}
|
||||
|
||||
private void showImageButton(boolean showImageButton) {
|
||||
if (showImageButton) {
|
||||
imageButton.setVisibility(VISIBLE);
|
||||
sendButton.setEnabled(false);
|
||||
if (SDK_INT <= 15) {
|
||||
sendButton.setVisibility(INVISIBLE);
|
||||
imageButton.setEnabled(true);
|
||||
} else {
|
||||
sendButton.clearAnimation();
|
||||
sendButton.animate().alpha(0f).withEndAction(() -> {
|
||||
sendButton.setVisibility(INVISIBLE);
|
||||
imageButton.setEnabled(true);
|
||||
}).start();
|
||||
imageButton.clearAnimation();
|
||||
imageButton.animate().alpha(1f).start();
|
||||
}
|
||||
} else {
|
||||
sendButton.setVisibility(VISIBLE);
|
||||
// enable/disable buttons right away to allow fast sending
|
||||
sendButton.setEnabled(enabled);
|
||||
imageButton.setEnabled(false);
|
||||
if (SDK_INT <= 15) {
|
||||
imageButton.setVisibility(INVISIBLE);
|
||||
} else {
|
||||
sendButton.clearAnimation();
|
||||
sendButton.animate().alpha(1f).start();
|
||||
imageButton.clearAnimation();
|
||||
imageButton.animate().alpha(0f).withEndAction(() ->
|
||||
imageButton.setVisibility(INVISIBLE)
|
||||
).start();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void reset() {
|
||||
// restore hint
|
||||
textInput.setHint(textHint);
|
||||
// hide image layout
|
||||
imagePreview.setVisibility(GONE);
|
||||
// reset image URIs
|
||||
imageUris = emptyList();
|
||||
// show the image button again, so images can get attached
|
||||
showImageButton(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Parcelable onSaveInstanceState(@Nullable Parcelable superState) {
|
||||
SavedState state =
|
||||
new SavedState(superState == null ? EMPTY_STATE : superState);
|
||||
state.imageUris = imageUris;
|
||||
return state;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Parcelable onRestoreInstanceState(@NonNull Parcelable inState) {
|
||||
SavedState state = (SavedState) inState;
|
||||
imageUris = state.imageUris;
|
||||
onNewUris();
|
||||
return state.getSuperState();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancel() {
|
||||
textInput.clearText();
|
||||
reset();
|
||||
}
|
||||
|
||||
private static class SavedState extends AbsSavedState {
|
||||
private List<Uri> imageUris;
|
||||
|
||||
private SavedState(Parcelable superState) {
|
||||
super(superState);
|
||||
}
|
||||
|
||||
private SavedState(Parcel in) {
|
||||
super(in);
|
||||
//noinspection unchecked
|
||||
imageUris = in.readArrayList(Uri.class.getClassLoader());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel out, int flags) {
|
||||
super.writeToParcel(out, flags);
|
||||
out.writeList(imageUris);
|
||||
}
|
||||
|
||||
public static final Parcelable.Creator<SavedState> CREATOR
|
||||
= new Parcelable.Creator<SavedState>() {
|
||||
public SavedState createFromParcel(Parcel in) {
|
||||
return new SavedState(in);
|
||||
}
|
||||
|
||||
public SavedState[] newArray(int size) {
|
||||
return new SavedState[size];
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public interface AttachImageListener {
|
||||
void onAttachImage(Intent intent);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4,51 +4,31 @@ import android.animation.LayoutTransition;
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.Rect;
|
||||
import android.os.IBinder;
|
||||
import android.support.annotation.CallSuper;
|
||||
import android.os.Parcelable;
|
||||
import android.support.annotation.LayoutRes;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.annotation.StringRes;
|
||||
import android.support.annotation.UiThread;
|
||||
import android.support.v7.widget.AppCompatImageButton;
|
||||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
|
||||
import com.vanniktech.emoji.EmojiEditText;
|
||||
import com.vanniktech.emoji.EmojiPopup;
|
||||
import com.vanniktech.emoji.RecentEmoji;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import org.briarproject.bramble.api.nullsafety.MethodsNotNullByDefault;
|
||||
import org.briarproject.bramble.api.nullsafety.ParametersNotNullByDefault;
|
||||
import org.briarproject.briar.R;
|
||||
import org.briarproject.briar.android.BriarApplication;
|
||||
import org.thoughtcrime.securesms.components.KeyboardAwareLinearLayout;
|
||||
import org.briarproject.briar.android.view.KeyboardAwareLinearLayout.OnKeyboardShownListener;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import static android.content.Context.INPUT_METHOD_SERVICE;
|
||||
import static android.content.Context.LAYOUT_INFLATER_SERVICE;
|
||||
import static android.view.KeyEvent.KEYCODE_ENTER;
|
||||
import static android.view.inputmethod.InputMethodManager.SHOW_IMPLICIT;
|
||||
import static java.util.Objects.requireNonNull;
|
||||
|
||||
@UiThread
|
||||
@MethodsNotNullByDefault
|
||||
@ParametersNotNullByDefault
|
||||
public class TextInputView extends KeyboardAwareLinearLayout {
|
||||
|
||||
@Inject
|
||||
RecentEmoji recentEmoji;
|
||||
public class TextInputView extends LinearLayout {
|
||||
|
||||
@Nullable
|
||||
TextInputListener listener;
|
||||
|
||||
AppCompatImageButton emojiToggle;
|
||||
EmojiEditText editText;
|
||||
EmojiPopup emojiPopup;
|
||||
View sendButton;
|
||||
TextSendController textSendController;
|
||||
final EmojiTextInputView textInput;
|
||||
|
||||
public TextInputView(Context context) {
|
||||
this(context, null);
|
||||
@@ -61,118 +41,109 @@ public class TextInputView extends KeyboardAwareLinearLayout {
|
||||
public TextInputView(Context context, @Nullable AttributeSet attrs,
|
||||
int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
if (!isInEditMode()) {
|
||||
BriarApplication app =
|
||||
(BriarApplication) context.getApplicationContext();
|
||||
app.getApplicationComponent().inject(this);
|
||||
}
|
||||
setSaveEnabled(true);
|
||||
setOrientation(VERTICAL);
|
||||
setLayoutTransition(new LayoutTransition());
|
||||
inflateLayout(context);
|
||||
setUpViews(context, attrs);
|
||||
}
|
||||
|
||||
protected void inflateLayout(Context context) {
|
||||
LayoutInflater inflater = (LayoutInflater) context
|
||||
.getSystemService(LAYOUT_INFLATER_SERVICE);
|
||||
inflater.inflate(R.layout.text_input_view, this, true);
|
||||
}
|
||||
|
||||
@CallSuper
|
||||
protected void setUpViews(Context context, @Nullable AttributeSet attrs) {
|
||||
emojiToggle = findViewById(R.id.emoji_toggle);
|
||||
editText = findViewById(R.id.input_text);
|
||||
emojiPopup = EmojiPopup.Builder
|
||||
.fromRootView(this)
|
||||
.setRecentEmoji(recentEmoji)
|
||||
.setOnEmojiPopupShownListener(this::showKeyboardIcon)
|
||||
.setOnEmojiPopupDismissListener(this::showEmojiIcon)
|
||||
.build(editText);
|
||||
sendButton = findViewById(R.id.btn_send);
|
||||
// inflate layout
|
||||
LayoutInflater inflater = (LayoutInflater) requireNonNull(
|
||||
context.getSystemService(LAYOUT_INFLATER_SERVICE));
|
||||
inflater.inflate(getLayout(), this, true);
|
||||
|
||||
// get attributes
|
||||
TypedArray attributes = context.obtainStyledAttributes(attrs,
|
||||
R.styleable.TextInputView);
|
||||
String hint = attributes.getString(R.styleable.TextInputView_hint);
|
||||
boolean allowEmptyText = attributes
|
||||
.getBoolean(R.styleable.TextInputView_allowEmptyText, false);
|
||||
attributes.recycle();
|
||||
|
||||
if (hint != null) editText.setHint(hint);
|
||||
|
||||
emojiToggle.setOnClickListener(v -> emojiPopup.toggle());
|
||||
editText.setOnClickListener(v -> showSoftKeyboard());
|
||||
editText.setOnKeyListener((v, keyCode, event) -> {
|
||||
if (keyCode == KEYCODE_ENTER && event.isCtrlPressed()) {
|
||||
trySendMessage();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
sendButton.setOnClickListener(v -> trySendMessage());
|
||||
textInput = findViewById(R.id.emojiTextInput);
|
||||
textInput.setAllowEmptyText(allowEmptyText);
|
||||
if (hint != null) textInput.setHint(hint);
|
||||
}
|
||||
|
||||
private void showEmojiIcon() {
|
||||
emojiToggle.setImageResource(R.drawable.ic_emoji_toggle);
|
||||
@LayoutRes
|
||||
protected int getLayout() {
|
||||
return R.layout.text_input_view;
|
||||
}
|
||||
|
||||
private void showKeyboardIcon() {
|
||||
emojiToggle.setImageResource(R.drawable.ic_keyboard);
|
||||
}
|
||||
|
||||
private void trySendMessage() {
|
||||
if (listener != null) {
|
||||
listener.onSendClick(editText.getText().toString());
|
||||
@Nullable
|
||||
@Override
|
||||
protected Parcelable onSaveInstanceState() {
|
||||
Parcelable superState = super.onSaveInstanceState();
|
||||
if (textSendController != null) {
|
||||
superState = textSendController.onSaveInstanceState(superState);
|
||||
}
|
||||
return superState;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onRestoreInstanceState(Parcelable state) {
|
||||
if (textSendController != null) {
|
||||
Parcelable outState =
|
||||
textSendController.onRestoreInstanceState(state);
|
||||
super.onRestoreInstanceState(outState);
|
||||
} else {
|
||||
super.onRestoreInstanceState(state);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Call this in onCreate() before any other methods of this class.
|
||||
*/
|
||||
public <T extends TextSendController> void setSendController(T controller) {
|
||||
textSendController = controller;
|
||||
textInput.setTextInputListener(textSendController);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEnabled(boolean enabled) {
|
||||
super.setEnabled(enabled);
|
||||
textInput.setEnabled(enabled);
|
||||
requireNonNull(textSendController).setEnabled(enabled);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean requestFocus(int direction, Rect previouslyFocusedRect) {
|
||||
return editText.requestFocus(direction, previouslyFocusedRect);
|
||||
return textInput.requestFocus(direction, previouslyFocusedRect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow();
|
||||
if (emojiPopup.isShowing()) emojiPopup.dismiss();
|
||||
EmojiTextInputView getEmojiTextInputView() {
|
||||
return textInput;
|
||||
}
|
||||
|
||||
public void setText(String text) {
|
||||
editText.setText(text);
|
||||
}
|
||||
|
||||
public Editable getText() {
|
||||
return editText.getText();
|
||||
public void clearText() {
|
||||
textInput.clearText();
|
||||
}
|
||||
|
||||
public void setHint(@StringRes int res) {
|
||||
editText.setHint(res);
|
||||
textInput.setHint(getContext().getString(res));
|
||||
}
|
||||
|
||||
public void setSendButtonEnabled(boolean enabled) {
|
||||
sendButton.setEnabled(enabled);
|
||||
public void setMaxTextLength(int maxLength) {
|
||||
textInput.setMaxLength(maxLength);
|
||||
}
|
||||
|
||||
public void addTextChangedListener(TextWatcher watcher) {
|
||||
editText.addTextChangedListener(watcher);
|
||||
}
|
||||
|
||||
public void setListener(TextInputListener listener) {
|
||||
this.listener = listener;
|
||||
public boolean isKeyboardOpen() {
|
||||
return textInput.isKeyboardOpen();
|
||||
}
|
||||
|
||||
public void showSoftKeyboard() {
|
||||
Object o = getContext().getSystemService(INPUT_METHOD_SERVICE);
|
||||
((InputMethodManager) o).showSoftInput(editText, SHOW_IMPLICIT);
|
||||
textInput.showSoftKeyboard();
|
||||
}
|
||||
|
||||
public void hideSoftKeyboard() {
|
||||
if (emojiPopup.isShowing()) emojiPopup.dismiss();
|
||||
IBinder token = editText.getWindowToken();
|
||||
Object o = getContext().getSystemService(INPUT_METHOD_SERVICE);
|
||||
((InputMethodManager) o).hideSoftInputFromWindow(token, 0);
|
||||
textInput.hideSoftKeyboard();
|
||||
}
|
||||
|
||||
public interface TextInputListener {
|
||||
void onSendClick(String text);
|
||||
public void addOnKeyboardShownListener(OnKeyboardShownListener listener) {
|
||||
textInput.addOnKeyboardShownListener(listener);
|
||||
}
|
||||
|
||||
public void removeOnKeyboardShownListener(
|
||||
OnKeyboardShownListener listener) {
|
||||
textInput.removeOnKeyboardShownListener(listener);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
package org.briarproject.briar.android.view;
|
||||
|
||||
import android.net.Uri;
|
||||
import android.os.Parcelable;
|
||||
import android.support.annotation.CallSuper;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.annotation.UiThread;
|
||||
import android.support.design.widget.Snackbar;
|
||||
import android.view.View;
|
||||
|
||||
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
||||
import org.briarproject.briar.R;
|
||||
import org.briarproject.briar.android.view.EmojiTextInputView.TextInputListener;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static android.support.design.widget.Snackbar.LENGTH_SHORT;
|
||||
import static java.util.Collections.emptyList;
|
||||
|
||||
@UiThread
|
||||
@NotNullByDefault
|
||||
public class TextSendController implements TextInputListener {
|
||||
|
||||
protected final EmojiTextInputView textInput;
|
||||
protected final View sendButton;
|
||||
protected final SendListener listener;
|
||||
protected boolean enabled = true;
|
||||
protected final boolean allowEmptyText;
|
||||
|
||||
private boolean wasEmpty = true;
|
||||
|
||||
public TextSendController(TextInputView v, SendListener listener,
|
||||
boolean allowEmptyText) {
|
||||
this.sendButton = v.findViewById(R.id.btn_send);
|
||||
this.sendButton.setOnClickListener(view -> onSendEvent());
|
||||
this.sendButton.setEnabled(allowEmptyText);
|
||||
this.listener = listener;
|
||||
this.textInput = v.getEmojiTextInputView();
|
||||
this.allowEmptyText = allowEmptyText;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextIsEmptyChanged(boolean isEmpty) {
|
||||
sendButton.setEnabled(enabled && (!isEmpty || canSendEmptyText()));
|
||||
wasEmpty = isEmpty;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSendEvent() {
|
||||
if (canSend()) {
|
||||
listener.onSendClick(textInput.getText(), emptyList());
|
||||
}
|
||||
}
|
||||
|
||||
protected final boolean canSend() {
|
||||
if (textInput.isTooLong()) {
|
||||
Snackbar.make(sendButton, R.string.text_too_long, LENGTH_SHORT)
|
||||
.show();
|
||||
return false;
|
||||
}
|
||||
return enabled && (canSendEmptyText() || !textInput.isEmpty());
|
||||
}
|
||||
|
||||
protected boolean canSendEmptyText() {
|
||||
return allowEmptyText;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Parcelable onSaveInstanceState(@Nullable Parcelable superState) {
|
||||
return superState;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Parcelable onRestoreInstanceState(Parcelable state) {
|
||||
return state;
|
||||
}
|
||||
|
||||
@CallSuper
|
||||
public void setEnabled(boolean enabled) {
|
||||
sendButton.setEnabled(enabled && (!wasEmpty || canSendEmptyText()));
|
||||
this.enabled = enabled;
|
||||
}
|
||||
|
||||
public interface SendListener {
|
||||
void onSendClick(@Nullable String text, List<Uri> imageUris);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import android.arch.lifecycle.ViewModel;
|
||||
import android.arch.lifecycle.ViewModelProvider;
|
||||
|
||||
import org.briarproject.briar.android.conversation.ConversationViewModel;
|
||||
import org.briarproject.briar.android.conversation.ImageViewModel;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
|
||||
@@ -20,6 +21,12 @@ public abstract class ViewModelModule {
|
||||
abstract ViewModel bindConversationViewModel(
|
||||
ConversationViewModel conversationViewModel);
|
||||
|
||||
@Binds
|
||||
@IntoMap
|
||||
@ViewModelKey(ImageViewModel.class)
|
||||
abstract ViewModel bindImageViewModel(
|
||||
ImageViewModel imageViewModel);
|
||||
|
||||
@Binds
|
||||
@Singleton
|
||||
abstract ViewModelProvider.Factory bindViewModelFactory(
|
||||
|
||||
@@ -1,621 +0,0 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
13
briar-android/src/main/res/drawable/bubble_accent.xml
Normal file
13
briar-android/src/main/res/drawable/bubble_accent.xml
Normal file
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
|
||||
<corners
|
||||
android:radius="32dp"/>
|
||||
|
||||
<solid
|
||||
android:color="@color/briar_accent"/>
|
||||
|
||||
</shape>
|
||||
|
||||
9
briar-android/src/main/res/drawable/ic_add_nearby.xml
Normal file
9
briar-android/src/main/res/drawable/ic_add_nearby.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportHeight="24.0"
|
||||
android:viewportWidth="24.0">
|
||||
<path
|
||||
android:fillColor="#FFFFFFFF"
|
||||
android:pathData="M12,11c-1.1,0 -2,0.9 -2,2s0.9,2 2,2 2,-0.9 2,-2 -0.9,-2 -2,-2zM18,13c0,-3.31 -2.69,-6 -6,-6s-6,2.69 -6,6c0,2.22 1.21,4.15 3,5.19l1,-1.74c-1.19,-0.7 -2,-1.97 -2,-3.45 0,-2.21 1.79,-4 4,-4s4,1.79 4,4c0,1.48 -0.81,2.75 -2,3.45l1,1.74c1.79,-1.04 3,-2.97 3,-5.19zM12,3C6.48,3 2,7.48 2,13c0,3.7 2.01,6.92 4.99,8.65l1,-1.73C5.61,18.53 4,15.96 4,13c0,-4.42 3.58,-8 8,-8s8,3.58 8,8c0,2.96 -1.61,5.53 -4,6.92l1,1.73c2.99,-1.73 5,-4.95 5,-8.65 0,-5.52 -4.48,-10 -10,-10z"/>
|
||||
</vector>
|
||||
9
briar-android/src/main/res/drawable/ic_call_made.xml
Normal file
9
briar-android/src/main/res/drawable/ic_call_made.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportHeight="24.0"
|
||||
android:viewportWidth="24.0">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M9,5v2h6.59L4,18.59 5.41,20 17,8.41V15h2V5z"/>
|
||||
</vector>
|
||||
10
briar-android/src/main/res/drawable/ic_call_received.xml
Normal file
10
briar-android/src/main/res/drawable/ic_call_received.xml
Normal file
@@ -0,0 +1,10 @@
|
||||
<vector
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportHeight="24.0"
|
||||
android:viewportWidth="24.0">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M20,5.41L18.59,4 7,15.59V9H5v10h10v-2H8.41z"/>
|
||||
</vector>
|
||||
10
briar-android/src/main/res/drawable/ic_content_copy.xml
Normal file
10
briar-android/src/main/res/drawable/ic_content_copy.xml
Normal file
@@ -0,0 +1,10 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:tint="#2A93C6"
|
||||
android:viewportHeight="24.0"
|
||||
android:viewportWidth="24.0">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M16,1L4,1c-1.1,0 -2,0.9 -2,2v14h2L4,3h12L16,1zM19,5L8,5c-1.1,0 -2,0.9 -2,2v14c0,1.1 0.9,2 2,2h11c1.1,0 2,-0.9 2,-2L21,7c0,-1.1 -0.9,-2 -2,-2zM19,21L8,21L8,7h11v14z"/>
|
||||
</vector>
|
||||
10
briar-android/src/main/res/drawable/ic_content_paste.xml
Normal file
10
briar-android/src/main/res/drawable/ic_content_paste.xml
Normal file
@@ -0,0 +1,10 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:tint="#2A93C6"
|
||||
android:viewportHeight="24.0"
|
||||
android:viewportWidth="24.0">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M19,2h-4.18C14.4,0.84 13.3,0 12,0c-1.3,0 -2.4,0.84 -2.82,2L5,2c-1.1,0 -2,0.9 -2,2v16c0,1.1 0.9,2 2,2h14c1.1,0 2,-0.9 2,-2L21,4c0,-1.1 -0.9,-2 -2,-2zM12,2c0.55,0 1,0.45 1,1s-0.45,1 -1,1 -1,-0.45 -1,-1 0.45,-1 1,-1zM19,20L5,20L5,4h2v3h10L17,4h2v16z"/>
|
||||
</vector>
|
||||
10
briar-android/src/main/res/drawable/ic_image.xml
Normal file
10
briar-android/src/main/res/drawable/ic_image.xml
Normal file
@@ -0,0 +1,10 @@
|
||||
<vector
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportHeight="24.0"
|
||||
android:viewportWidth="24.0">
|
||||
<path
|
||||
android:fillColor="#000000"
|
||||
android:pathData="M21,19V5c0,-1.1 -0.9,-2 -2,-2H5c-1.1,0 -2,0.9 -2,2v14c0,1.1 0.9,2 2,2h14c1.1,0 2,-0.9 2,-2zM8.5,13.5l2.5,3.01L14.5,12l4.5,6H5l3.5,-4.5z"/>
|
||||
</vector>
|
||||
9
briar-android/src/main/res/drawable/ic_link.xml
Normal file
9
briar-android/src/main/res/drawable/ic_link.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportHeight="24.0"
|
||||
android:viewportWidth="24.0">
|
||||
<path
|
||||
android:fillColor="#FFFFFF"
|
||||
android:pathData="M3.9,12c0,-1.71 1.39,-3.1 3.1,-3.1h4L11,7L7,7c-2.76,0 -5,2.24 -5,5s2.24,5 5,5h4v-1.9L7,15.1c-1.71,0 -3.1,-1.39 -3.1,-3.1zM8,13h8v-2L8,11v2zM17,7h-4v1.9h4c1.71,0 3.1,1.39 3.1,3.1s-1.39,3.1 -3.1,3.1h-4L13,17h4c2.76,0 5,-2.24 5,-5s-2.24,-5 -5,-5z"/>
|
||||
</vector>
|
||||
12
briar-android/src/main/res/drawable/ic_link_down.xml
Normal file
12
briar-android/src/main/res/drawable/ic_link_down.xml
Normal file
@@ -0,0 +1,12 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportHeight="24"
|
||||
android:viewportWidth="24">
|
||||
<path
|
||||
android:fillColor="#FFFFFF"
|
||||
android:pathData="M16,6H13V7.9H16C18.26,7.9 20.1,9.73 20.1,12A4.1,4.1 0,0 1,16 16.1H13V18H16A6,6 0,0 0,22 12C22,8.68 19.31,6 16,6M3.9,12C3.9,9.73 5.74,7.9 8,7.9H11V6H8A6,6 0,0 0,2 12A6,6 0,0 0,8 18H11V16.1H8C5.74,16.1 3.9,14.26 3.9,12M8,13H16V11H8V13Z"/>
|
||||
<path
|
||||
android:fillColor="#FFFFFF"
|
||||
android:pathData="m21.6598,17.4732h-2.2959v3.0612H17.5118l3,3 3,-3h-1.852z"/>
|
||||
</vector>
|
||||
9
briar-android/src/main/res/drawable/ic_link_menu.xml
Normal file
9
briar-android/src/main/res/drawable/ic_link_menu.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportHeight="24.0"
|
||||
android:viewportWidth="24.0">
|
||||
<path
|
||||
android:fillColor="#FFFFFF"
|
||||
android:pathData="M3.9,12c0,-1.71 1.39,-3.1 3.1,-3.1h4L11,7L7,7c-2.76,0 -5,2.24 -5,5s2.24,5 5,5h4v-1.9L7,15.1c-1.71,0 -3.1,-1.39 -3.1,-3.1zM8,13h8v-2L8,11v2zM17,7h-4v1.9h4c1.71,0 3.1,1.39 3.1,3.1s-1.39,3.1 -3.1,3.1h-4L13,17h4c2.76,0 5,-2.24 5,-5s-2.24,-5 -5,-5z"/>
|
||||
</vector>
|
||||
12
briar-android/src/main/res/drawable/ic_link_up.xml
Normal file
12
briar-android/src/main/res/drawable/ic_link_up.xml
Normal file
@@ -0,0 +1,12 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportHeight="24"
|
||||
android:viewportWidth="24">
|
||||
<path
|
||||
android:fillColor="#FFFFFF"
|
||||
android:pathData="M16,6H13V7.9H16C18.26,7.9 20.1,9.73 20.1,12A4.1,4.1 0,0 1,16 16.1H13V18H16A6,6 0,0 0,22 12C22,8.68 19.31,6 16,6M3.9,12C3.9,9.73 5.74,7.9 8,7.9H11V6H8A6,6 0,0 0,2 12A6,6 0,0 0,8 18H11V16.1H8C5.74,16.1 3.9,14.26 3.9,12M8,13H16V11H8V13Z"/>
|
||||
<path
|
||||
android:fillColor="#FFFFFF"
|
||||
android:pathData="M21.6598,23.5344H19.3639V20.4732H17.5118l3,-3 3,3h-1.852z"/>
|
||||
</vector>
|
||||
9
briar-android/src/main/res/drawable/ic_nearby.xml
Normal file
9
briar-android/src/main/res/drawable/ic_nearby.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportHeight="24"
|
||||
android:viewportWidth="24">
|
||||
<path
|
||||
android:fillColor="#FFFFFFFF"
|
||||
android:pathData="M11.1731,2.4031C9.9686,2.4471 8.7753,2.713 7.6641,3.2033 8.187,3.7263 8.3967,4.1446 8.6059,4.563 11.6391,3.4125 15.0914,4.0394 17.4971,6.445c0.7322,0.7321 1.3593,1.5692 1.6731,2.5105 0.4184,-0.2092 0.9412,-0.3134 1.4642,-0.3134h0.1045C20.2158,7.387 19.483,6.3401 18.5416,5.2942 16.5283,3.2808 13.823,2.3062 11.1731,2.4031ZM5.1695,3.2316A2.7194,2.7194 0,0 0,2.4501 5.951,2.7194 2.7194,0 0,0 5.1695,8.6704 2.7194,2.7194 0,0 0,7.8889 5.951,2.7194 2.7194,0 0,0 5.1695,3.2316ZM2.5404,8.5359C0.9715,12.1966 1.7027,16.4848 4.6313,19.4134c1.8827,1.9872 4.4972,2.9301 7.0074,2.9301 2.5102,0 5.1264,-0.9428 7.0092,-2.9301 0.9413,-0.9414 1.6724,-2.091 2.1953,-3.3461h-0.1045c-0.5229,0 -1.0458,-0.1042 -1.4642,-0.3134 -0.4184,0.9414 -0.9409,1.7783 -1.6731,2.5105 -3.2423,3.2424 -8.5771,3.2424 -11.8194,0C3.2719,15.8588 2.6451,12.4064 3.7957,9.3733 3.3773,9.1641 2.9588,8.9542 2.5404,8.5359ZM11.5944,9.3804a2.9913,2.9913 0,0 0,-2.9903 2.9903,2.9913 2.9913,0 0,0 2.9903,2.992 2.9913,2.9913 0,0 0,2.992 -2.992,2.9913 2.9913,0 0,0 -2.992,-2.9903zM20.7334,9.8035a2.7194,2.7194 0,0 0,-2.7194 2.7194,2.7194 2.7194,0 0,0 2.7194,2.7194 2.7194,2.7194 0,0 0,2.7194 -2.7194,2.7194 2.7194,0 0,0 -2.7194,-2.7194z"/>
|
||||
</vector>
|
||||
57
briar-android/src/main/res/drawable/ic_nickname.xml
Normal file
57
briar-android/src/main/res/drawable/ic_nickname.xml
Normal file
@@ -0,0 +1,57 @@
|
||||
<vector
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="200dp"
|
||||
android:height="237dp"
|
||||
android:viewportHeight="178"
|
||||
android:viewportWidth="150">
|
||||
<path
|
||||
android:fillAlpha="0.25"
|
||||
android:pathData="M85.19,0.128 L3.357,0.329C2.465,0.331 1.611,0.69 0.981,1.329 0.352,1.967 -0.001,2.832 0,3.733L0.373,156.201c0.001,0.446 0.089,0.888 0.26,1.3 0.17,0.412 0.419,0.786 0.732,1.101 0.313,0.315 0.685,0.564 1.093,0.734 0.409,0.17 0.846,0.257 1.288,0.256l81.834,-0.201c0.892,-0.003 1.746,-0.363 2.375,-1.002 0.629,-0.639 0.981,-1.504 0.98,-2.405L88.554,3.516C88.551,2.617 88.196,1.755 87.565,1.12 86.935,0.485 86.081,0.128 85.19,0.128Z">
|
||||
</path>
|
||||
<path
|
||||
android:fillAlpha="0.175"
|
||||
android:fillColor="#6d6d6d"
|
||||
android:pathData="M84.282,-0.002 L4.276,0.196C2.574,0.2 1.198,1.598 1.202,3.318L1.567,154.298c0.004,1.72 1.387,3.111 3.089,3.107l80.006,-0.198c1.702,-0.004 3.078,-1.402 3.074,-3.122L87.37,3.105C87.366,1.385 85.983,-0.006 84.282,-0.002Z"/>
|
||||
<path
|
||||
android:fillAlpha="0.25"
|
||||
android:fillColor="#646464"
|
||||
android:pathData="M81.939,3.957L65.934,3.996C65.689,5.664 64.862,7.188 63.602,8.293C62.342,9.398 60.732,10.01 59.064,10.02L29.303,10.092C27.635,10.091 26.021,9.487 24.756,8.389C23.49,7.29 22.655,5.77 22.402,4.104L6.637,4.143C5.769,4.145 4.938,4.495 4.326,5.117C3.714,5.739 3.371,6.58 3.373,7.457L3.461,44.068L3.717,150.168C3.721,151.045 4.069,151.885 4.686,152.502C5.302,153.119 6.136,153.464 7.004,153.461L82.307,153.275C83.172,153.27 83.999,152.921 84.609,152.301C85.219,151.681 85.561,150.841 85.561,149.967L85.307,43.563L85.221,7.256C85.218,6.379 84.871,5.539 84.256,4.92C83.641,4.301 82.807,3.955 81.939,3.957zM52.652,5.791L34.357,6.068C34.108,6.072 33.908,6.279 33.912,6.531L33.916,6.83C33.92,7.082 34.125,7.285 34.375,7.281L52.672,7.002C52.921,6.998 53.119,6.791 53.115,6.539L53.111,6.24C53.108,5.988 52.902,5.787 52.652,5.791z"/>
|
||||
<path
|
||||
android:fillAlpha="0.25"
|
||||
android:fillColor="#dbdbdb"
|
||||
android:pathData="M57.204,6.934C57.602,6.928 57.919,6.597 57.913,6.195 57.907,5.793 57.58,5.471 57.182,5.477c-0.398,0.006 -0.716,0.337 -0.71,0.739 0.006,0.402 0.333,0.723 0.731,0.717z"/>
|
||||
<path
|
||||
android:fillAlpha="0.25"
|
||||
android:fillColor="#e0e0e0"
|
||||
android:pathData="m17.641,19.459c-4.185,0 -7.576,3.446 -7.576,7.695 0,4.25 3.392,7.695 7.576,7.695 4.185,0 7.576,-3.446 7.576,-7.695 0,-4.25 -3.392,-7.695 -7.576,-7.695zM37.523,23.637v3.234h40.117v-3.234zM37.523,30.104v3.234L77.641,33.338L77.641,30.104ZM17.641,44.088c-4.185,0 -7.576,3.444 -7.576,7.693 0,4.25 3.392,7.695 7.576,7.695 4.185,0 7.576,-3.446 7.576,-7.695 0,-4.25 -3.392,-7.693 -7.576,-7.693zM37.523,48.266L37.523,51.5h40.117v-3.234zM37.523,54.732v3.232L77.641,57.965L77.641,54.732ZM17.641,68.715c-4.185,0 -7.576,3.446 -7.576,7.695 0,4.25 3.392,7.695 7.576,7.695 4.185,0 7.576,-3.446 7.576,-7.695 0,-4.25 -3.392,-7.695 -7.576,-7.695zM37.523,72.895v3.232h40.117v-3.232zM37.523,79.361L37.523,82.594L77.641,82.594L77.641,79.361ZM17.641,93.344c-4.185,0 -7.576,3.446 -7.576,7.695 0,4.25 3.392,7.695 7.576,7.695 4.185,0 7.576,-3.445 7.576,-7.695 0,-4.25 -3.392,-7.695 -7.576,-7.695zM37.523,97.523v3.232h40.117v-3.232zM37.523,103.988v3.234h40.117v-3.234zM17.641,117.973c-4.185,0 -7.576,3.446 -7.576,7.695 0,4.25 3.392,7.693 7.576,7.693 4.185,0 7.576,-3.443 7.576,-7.693 0,-4.249 -3.392,-7.695 -7.576,-7.695zM37.523,122.15v3.234h40.117v-3.234zM37.523,128.617v3.234h40.117v-3.234z"/>
|
||||
<path
|
||||
android:fillColor="#313131"
|
||||
android:pathData="m136.95,18.407 l-80.006,0.198c-1.702,0.004 -3.078,1.402 -3.074,3.122l0.365,150.981c0.004,1.72 1.387,3.111 3.089,3.107l80.006,-0.198c1.702,-0.004 3.078,-1.402 3.074,-3.122L140.039,21.514c-0.004,-1.72 -1.387,-3.111 -3.089,-3.107z"/>
|
||||
<path
|
||||
android:fillColor="#3e3e3e"
|
||||
android:pathData="M134.609,22.357L118.6,22.395C118.356,24.062 117.528,25.587 116.268,26.691C115.008,27.796 113.398,28.408 111.73,28.418L81.969,28.492C80.301,28.491 78.689,27.886 77.424,26.787C76.158,25.689 75.323,24.168 75.07,22.502L59.305,22.541C58.437,22.543 57.604,22.894 56.992,23.516C56.38,24.137 56.037,24.98 56.039,25.857L56.129,62.469L56.748,62.467L56.129,62.471L56.383,168.57C56.385,169.447 56.733,170.287 57.348,170.906C57.963,171.524 58.796,171.871 59.664,171.869L134.967,171.684C135.835,171.682 136.665,171.331 137.277,170.709C137.889,170.088 138.232,169.246 138.23,168.369L137.973,62.219L137.975,62.219L137.889,25.656C137.887,24.779 137.541,23.939 136.926,23.32C136.311,22.702 135.477,22.356 134.609,22.357z"/>
|
||||
<path
|
||||
android:fillColor="#e0e0e0"
|
||||
android:pathData="M109.85,23.891C109.452,23.897 109.135,24.229 109.141,24.631C109.147,25.033 109.473,25.354 109.871,25.348C110.269,25.342 110.586,25.01 110.58,24.607C110.574,24.205 110.248,23.885 109.85,23.891zM105.32,24.201L87.025,24.479C86.776,24.482 86.576,24.691 86.58,24.943L86.584,25.242C86.588,25.494 86.793,25.695 87.043,25.691L105.34,25.414C105.589,25.41 105.787,25.203 105.783,24.951L105.779,24.65C105.775,24.398 105.569,24.197 105.32,24.201zM63.365,37.568L63.365,53.738L79.365,53.738L79.365,37.568L63.365,37.568zM86.748,37.568L86.748,40.801L126.865,40.801L126.865,37.568L86.748,37.568zM86.748,44.037L86.748,47.27L126.865,47.27L126.865,44.037L86.748,44.037zM71.787,112.996C67.603,112.996 64.211,116.441 64.211,120.691C64.211,124.941 67.603,128.387 71.787,128.387C75.972,128.387 79.365,124.941 79.365,120.691C79.365,116.441 75.972,112.996 71.787,112.996zM86.748,116.928L86.748,120.16L126.865,120.16L126.865,116.928L86.748,116.928zM86.748,123.393L86.748,126.627L126.865,126.627L126.865,123.393L86.748,123.393zM71.787,142.602C67.603,142.602 64.211,146.047 64.211,150.297C64.211,154.547 67.603,157.99 71.787,157.99C75.972,157.99 79.365,154.547 79.365,150.297C79.365,146.047 75.972,142.602 71.787,142.602zM86.748,145.535L86.748,148.768L126.865,148.768L126.865,145.535L86.748,145.535zM86.748,152.002L86.748,155.234L126.865,155.234L126.865,152.002L86.748,152.002z"/>
|
||||
<path
|
||||
android:fillColor="#d5d6d7"
|
||||
android:pathData="M148.744,68.665H45.619v33.583h103.125z"/>
|
||||
<path
|
||||
android:fillColor="#87c214"
|
||||
android:pathData="m97.822,50.504v5.723h17.967v-5.723zM86.748,81.104v3.232h40.117v-3.232zM86.748,87.572v3.232h40.117v-3.232z"/>
|
||||
<path
|
||||
android:fillColor="#f5f5f5"
|
||||
android:pathData="m66.865,92.314c4.185,0 7.577,-3.445 7.577,-7.695 0,-4.25 -3.392,-7.695 -7.577,-7.695 -4.185,0 -7.577,3.445 -7.577,7.695 0,4.25 3.392,7.695 7.577,7.695z"/>
|
||||
<path
|
||||
android:fillColor="#87c214"
|
||||
android:pathData="m70.13,90.006h-6.574c-0.315,0.002 -0.625,0.082 -0.904,0.231 -0.278,0.149 -0.517,0.365 -0.696,0.627 1.477,0.856 3.147,1.311 4.85,1.321 1.702,0.01 3.378,-0.427 4.864,-1.266 -0.167,-0.265 -0.393,-0.486 -0.661,-0.645 -0.268,-0.159 -0.569,-0.251 -0.879,-0.269z"/>
|
||||
<path
|
||||
android:fillColor="#333333"
|
||||
android:pathData="m66.861,80.746c-2.08,0 -3.766,1.704 -3.766,3.807 0,0.394 0.076,0.766 0.186,1.123 -0.328,0.813 -0.822,1.878 -1.158,1.709 0,0 5.07,4.425 9.545,0 -0.355,-0.613 -0.773,-1.184 -1.219,-1.732 0.105,-0.35 0.178,-0.715 0.178,-1.1 0,-2.102 -1.686,-3.807 -3.766,-3.807z"/>
|
||||
<path
|
||||
android:fillColor="#fda57d"
|
||||
android:pathData="m66.861,81.57c-1.801,0 -3.302,1.279 -3.674,2.986 -0.005,-0 -0.009,-0.006 -0.014,-0.006 -0.193,0 -0.35,0.297 -0.35,0.664 0,0.347 0.142,0.623 0.32,0.652 0.181,1.408 1.109,2.569 2.381,3.059v0.732c0,0.323 0.127,0.635 0.354,0.863 0.226,0.229 0.534,0.357 0.854,0.357h0.225c0.159,0 0.316,-0.032 0.463,-0.094 0.147,-0.061 0.28,-0.15 0.393,-0.264 0.112,-0.113 0.201,-0.248 0.262,-0.396 0.061,-0.148 0.092,-0.308 0.092,-0.469v-0.721c1.289,-0.484 2.232,-1.655 2.412,-3.076 0.168,-0.049 0.299,-0.312 0.299,-0.645 0,-0.363 -0.153,-0.656 -0.344,-0.662 -0.373,-1.705 -1.873,-2.982 -3.672,-2.982z"/>
|
||||
<path
|
||||
android:fillColor="#333333"
|
||||
android:pathData="m63.253,83.934h7.179c0,0 -0.612,-2.93 -3.328,-2.74 -2.715,0.19 -3.852,2.74 -3.852,2.74z"/>
|
||||
</vector>
|
||||
5
briar-android/src/main/res/drawable/ic_person.xml
Normal file
5
briar-android/src/main/res/drawable/ic_person.xml
Normal file
@@ -0,0 +1,5 @@
|
||||
<vector android:height="24dp" android:tint="#FFFFFF"
|
||||
android:viewportHeight="24.0" android:viewportWidth="24.0"
|
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#FF000000" android:pathData="M12,12c2.21,0 4,-1.79 4,-4s-1.79,-4 -4,-4 -4,1.79 -4,4 1.79,4 4,4zM12,14c-2.67,0 -8,1.34 -8,4v2h16v-2c0,-2.66 -5.33,-4 -8,-4z"/>
|
||||
</vector>
|
||||
5
briar-android/src/main/res/drawable/ic_person_add.xml
Normal file
5
briar-android/src/main/res/drawable/ic_person_add.xml
Normal file
@@ -0,0 +1,5 @@
|
||||
<vector android:height="24dp" android:tint="#FFFFFF"
|
||||
android:viewportHeight="24.0" android:viewportWidth="24.0"
|
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#FF000000" android:pathData="M15,12c2.21,0 4,-1.79 4,-4s-1.79,-4 -4,-4 -4,1.79 -4,4 1.79,4 4,4zM6,10L6,7L4,7v3L1,10v2h3v3h2v-3h3v-2L6,10zM15,14c-2.67,0 -8,1.34 -8,4v2h16v-2c0,-2.66 -5.33,-4 -8,-4z"/>
|
||||
</vector>
|
||||
10
briar-android/src/main/res/drawable/ic_qr_code.xml
Normal file
10
briar-android/src/main/res/drawable/ic_qr_code.xml
Normal file
@@ -0,0 +1,10 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:tint="#2A93C6"
|
||||
android:viewportHeight="24"
|
||||
android:viewportWidth="24">
|
||||
<path
|
||||
android:fillColor="#FFFFFFFF"
|
||||
android:pathData="M3,11H5V13H3V11M11,5H13V9H11V5M9,11H13V15H11V13H9V11M15,11H17V13H19V11H21V13H19V15H21V19H19V21H17V19H13V21H11V17H15V15H17V13H15V11M19,19V15H17V19H19M15,3H21V9H15V3M17,5V7H19V5H17M3,3H9V9H3V3M5,5V7H7V5H5M3,15H9V21H3V15M5,17V19H7V17H5Z"/>
|
||||
</vector>
|
||||
9
briar-android/src/main/res/drawable/ic_qr_code_scan.xml
Normal file
9
briar-android/src/main/res/drawable/ic_qr_code_scan.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportHeight="24"
|
||||
android:viewportWidth="24">
|
||||
<path
|
||||
android:fillColor="#FFFFFF"
|
||||
android:pathData="M4,4H10V10H4V4M20,4V10H14V4H20M14,15H16V13H14V11H16V13H18V11H20V13H18V15H20V18H18V20H16V18H13V20H11V16H14V15M16,15V18H18V15H16M4,20V14H10V20H4M6,6V8H8V6H6M16,6V8H18V6H16M6,16V18H8V16H6M4,11H6V13H4V11M9,11H13V15H11V13H9V11M11,6H13V10H11V6M2,2V6H0V2A2,2 0 0,1 2,0H6V2H2M22,0A2,2 0 0,1 24,2V6H22V2H18V0H22M2,18V22H6V24H2A2,2 0 0,1 0,22V18H2M22,22V18H24V22A2,2 0 0,1 22,24H18V22H22Z"/>
|
||||
</vector>
|
||||
9
briar-android/src/main/res/drawable/ic_security.xml
Normal file
9
briar-android/src/main/res/drawable/ic_security.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="M12,1L3,5v6c0,5.55 3.84,10.74 9,12 5.16,-1.26 9,-6.45 9,-12L21,5l-9,-4zM12,11.99h7c-0.53,4.12 -3.28,7.79 -7,8.94L12,12L5,12L5,6.3l7,-3.11v8.8z"/>
|
||||
</vector>
|
||||
10
briar-android/src/main/res/drawable/social_share_blue.xml
Normal file
10
briar-android/src/main/res/drawable/social_share_blue.xml
Normal file
@@ -0,0 +1,10 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:tint="#2A93C6"
|
||||
android:viewportHeight="24.0"
|
||||
android:viewportWidth="24.0">
|
||||
<path
|
||||
android:fillColor="#FFFFFFFF"
|
||||
android:pathData="M18,16.08c-0.76,0 -1.44,0.3 -1.96,0.77L8.91,12.7c0.05,-0.23 0.09,-0.46 0.09,-0.7s-0.04,-0.47 -0.09,-0.7l7.05,-4.11c0.54,0.5 1.25,0.81 2.04,0.81 1.66,0 3,-1.34 3,-3s-1.34,-3 -3,-3 -3,1.34 -3,3c0,0.24 0.04,0.47 0.09,0.7L8.04,9.81C7.5,9.31 6.79,9 6,9c-1.66,0 -3,1.34 -3,3s1.34,3 3,3c0.79,0 1.5,-0.31 2.04,-0.81l7.12,4.16c-0.05,0.21 -0.08,0.43 -0.08,0.65 0,1.61 1.31,2.92 2.92,2.92 1.61,0 2.92,-1.31 2.92,-2.92s-1.31,-2.92 -2.92,-2.92z"/>
|
||||
</vector>
|
||||
@@ -5,6 +5,7 @@
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:animateLayoutChanges="true"
|
||||
android:orientation="vertical"
|
||||
tools:context=".android.conversation.ConversationActivity">
|
||||
|
||||
@@ -32,9 +33,9 @@
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="@dimen/margin_medium"
|
||||
android:layout_marginStart="@dimen/margin_medium"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center"
|
||||
android:maxLines="1"
|
||||
android:ellipsize="end"
|
||||
android:textColor="@color/action_bar_text"
|
||||
tools:text="Contact Name of someone who chose a long name"/>
|
||||
|
||||
@@ -48,7 +49,15 @@
|
||||
android:id="@+id/conversationView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"/>
|
||||
android:layout_weight="2"/>
|
||||
|
||||
<org.briarproject.briar.android.view.ImagePreview
|
||||
android:id="@+id/imagePreview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible"/>
|
||||
|
||||
<org.briarproject.briar.android.view.TextInputView
|
||||
android:id="@+id/text_input_container"
|
||||
|
||||
34
briar-android/src/main/res/layout/emoji_text_input_view.xml
Normal file
34
briar-android/src/main/res/layout/emoji_text_input_view.xml
Normal file
@@ -0,0 +1,34 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<merge
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal"
|
||||
tools:parentTag="org.briarproject.briar.android.view.KeyboardAwareLinearLayout"
|
||||
tools:showIn="@layout/fragment_reblog">
|
||||
|
||||
<android.support.v7.widget.AppCompatImageButton
|
||||
android:id="@+id/emoji_toggle"
|
||||
android:layout_width="@dimen/text_input_height"
|
||||
android:layout_height="@dimen/text_input_height"
|
||||
android:layout_gravity="bottom"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:padding="@dimen/margin_small"
|
||||
android:scaleType="center"
|
||||
android:src="@drawable/ic_emoji_toggle"
|
||||
app:tint="?attr/colorControlNormal"/>
|
||||
|
||||
<com.vanniktech.emoji.EmojiEditText
|
||||
android:id="@+id/input_text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom"
|
||||
android:background="@android:color/transparent"
|
||||
android:inputType="textMultiLine|textCapSentences|textAutoCorrect"
|
||||
android:minHeight="@dimen/text_input_height"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
tools:text="Line 1\nLine 2\nLine 3"/>
|
||||
|
||||
</merge>
|
||||
@@ -0,0 +1,37 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.constraint.ConstraintLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/contactNameInput"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/margin_large"
|
||||
android:hint="@string/contact_name_hint"
|
||||
android:importantForAutofill="no"
|
||||
android:inputType="text|textCapWords"
|
||||
app:layout_constraintBottom_toTopOf="@id/linkInput"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_chainStyle="packed"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/addButton"
|
||||
style="@style/BriarButton"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/margin_large"
|
||||
android:layout_marginTop="8dp"
|
||||
android:enabled="false"
|
||||
android:text="@string/add_contact_button"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/contactNameInput"
|
||||
tools:enabled="true"/>
|
||||
|
||||
</android.support.constraint.ConstraintLayout>
|
||||
@@ -0,0 +1,157 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ScrollView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fillViewport="true">
|
||||
|
||||
<android.support.constraint.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="@dimen/margin_large">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:src="@drawable/ic_nickname"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:ignore="ContentDescription"/>
|
||||
|
||||
<android.support.v7.widget.AppCompatImageView
|
||||
android:id="@+id/nicknameIcon"
|
||||
android:layout_width="38dp"
|
||||
android:layout_height="38dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:background="@drawable/bubble_accent"
|
||||
android:scaleType="center"
|
||||
android:src="@drawable/ic_person"
|
||||
app:layout_constraintBottom_toTopOf="@+id/contactNameLayout"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/imageView"
|
||||
app:layout_constraintVertical_chainStyle="packed"
|
||||
app:tint="@color/briar_white"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/nicknameIntro"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:gravity="left|start"
|
||||
android:text="@string/nickname_intro"
|
||||
android:textSize="16sp"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/nicknameIcon"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toEndOf="@+id/nicknameIcon"
|
||||
app:layout_constraintTop_toTopOf="@+id/nicknameIcon"/>
|
||||
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:id="@+id/contactNameLayout"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
app:errorEnabled="true"
|
||||
app:hintEnabled="false"
|
||||
app:layout_constraintBottom_toTopOf="@+id/stepOne"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/nicknameIcon">
|
||||
|
||||
<android.support.design.widget.TextInputEditText
|
||||
android:id="@+id/contactNameInput"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:hint="@string/add_contact_choose_a_nickname"
|
||||
android:importantForAutofill="no"
|
||||
android:inputType="text|textCapWords"/>
|
||||
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
|
||||
<android.support.constraint.Guideline
|
||||
android:id="@+id/guideline"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintGuide_percent="0.5"/>
|
||||
|
||||
|
||||
<android.support.v7.widget.AppCompatImageView
|
||||
android:id="@+id/stepOne"
|
||||
android:layout_width="28dp"
|
||||
android:layout_height="28dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:background="@drawable/bubble_accent"
|
||||
android:gravity="center"
|
||||
android:scaleType="center"
|
||||
android:src="@drawable/ic_check_white"
|
||||
android:textColor="@color/briar_white"
|
||||
android:textSize="18sp"
|
||||
app:layout_constraintBottom_toTopOf="@+id/stepOneText"
|
||||
app:layout_constraintEnd_toStartOf="@+id/guideline"
|
||||
app:layout_constraintStart_toStartOf="parent"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/stepOneText"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="8dp"
|
||||
android:text="@string/send_link_title"
|
||||
app:layout_constraintBottom_toTopOf="@+id/addButton"
|
||||
app:layout_constraintEnd_toStartOf="@+id/guideline"
|
||||
app:layout_constraintStart_toStartOf="parent"/>
|
||||
|
||||
<View
|
||||
android:id="@+id/stepConnector"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="1dp"
|
||||
android:layout_margin="16dp"
|
||||
android:background="@color/briar_accent"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/stepOne"
|
||||
app:layout_constraintEnd_toStartOf="@+id/stepTwo"
|
||||
app:layout_constraintStart_toEndOf="@+id/stepOne"
|
||||
app:layout_constraintTop_toTopOf="@+id/stepOne"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/stepTwo"
|
||||
android:layout_width="28dp"
|
||||
android:layout_height="28dp"
|
||||
android:background="@drawable/bubble_accent"
|
||||
android:gravity="center"
|
||||
android:text="2"
|
||||
android:textColor="@color/private_message_date_inverse"
|
||||
android:textSize="18sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="@+id/guideline"
|
||||
app:layout_constraintTop_toTopOf="@+id/stepOne"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/stepTwoText"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/add_contact_choose_nickname"
|
||||
app:layout_constraintBottom_toTopOf="@+id/addButton"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/guideline"
|
||||
app:layout_constraintTop_toBottomOf="@+id/stepTwo"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/addButton"
|
||||
style="@style/BriarButton"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/add_contact_button"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"/>
|
||||
|
||||
</android.support.constraint.ConstraintLayout>
|
||||
</ScrollView>
|
||||
@@ -0,0 +1,278 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ScrollView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fillViewport="true">
|
||||
|
||||
<android.support.constraint.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="@dimen/margin_large">
|
||||
|
||||
<android.support.v7.widget.AppCompatImageView
|
||||
android:id="@+id/yourLinkIcon"
|
||||
android:layout_width="38dp"
|
||||
android:layout_height="38dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:background="@drawable/bubble_accent"
|
||||
android:scaleType="center"
|
||||
android:src="@drawable/ic_call_made"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:tint="@color/briar_white"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/yourLink"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:gravity="left|start"
|
||||
android:text="@string/your_link"
|
||||
android:textSize="16sp"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/yourLinkIcon"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/yourLinkIcon"
|
||||
app:layout_constraintTop_toTopOf="@+id/yourLinkIcon"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/linkView"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:background="@color/briar_white"
|
||||
android:padding="8dp"
|
||||
android:textColor="@color/briar_primary"
|
||||
android:textIsSelectable="true"
|
||||
android:textSize="18sp"
|
||||
android:typeface="monospace"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/yourLinkIcon"
|
||||
tools:text="briar://scnsdflamslkfjgluoblmksdfbwevlewajfdlkjewwhqliafskfjhskdjhvoieiv"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/shareButton"
|
||||
style="@style/BriarButtonFlat.Positive.Tiny"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:drawableLeft="@drawable/social_share_blue"
|
||||
android:drawablePadding="8dp"
|
||||
android:drawableStart="@drawable/social_share_blue"
|
||||
android:text="@string/share_button"
|
||||
app:layout_constraintBottom_toBottomOf="@id/copyButton"
|
||||
app:layout_constraintEnd_toStartOf="@id/showCodeButton"
|
||||
app:layout_constraintStart_toEndOf="@id/copyButton"
|
||||
app:layout_constraintTop_toTopOf="@id/copyButton"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/copyButton"
|
||||
style="@style/BriarButtonFlat.Positive.Tiny"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:drawableLeft="@drawable/ic_content_copy"
|
||||
android:drawablePadding="8dp"
|
||||
android:drawableStart="@drawable/ic_content_copy"
|
||||
android:text="@string/copy_button"
|
||||
app:layout_constraintEnd_toStartOf="@id/shareButton"
|
||||
app:layout_constraintHorizontal_bias="1.0"
|
||||
app:layout_constraintHorizontal_chainStyle="packed"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/linkView"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/showCodeButton"
|
||||
style="@style/BriarButtonFlat.Positive.Tiny"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:drawableLeft="@drawable/ic_qr_code"
|
||||
android:drawablePadding="8dp"
|
||||
android:drawableStart="@drawable/ic_qr_code"
|
||||
android:drawableTint="@color/briar_button_text_positive"
|
||||
android:text="@string/show_qr_code_button"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="@id/copyButton"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/shareButton"
|
||||
app:layout_constraintTop_toTopOf="@id/copyButton"
|
||||
tools:visibility="gone"/>
|
||||
|
||||
<android.support.v7.widget.AppCompatImageView
|
||||
android:id="@+id/linkInputIcon"
|
||||
android:layout_width="38dp"
|
||||
android:layout_height="38dp"
|
||||
android:layout_marginTop="24dp"
|
||||
android:background="@drawable/bubble_accent"
|
||||
android:scaleType="center"
|
||||
android:src="@drawable/ic_call_received"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/copyButton"
|
||||
app:tint="@color/briar_white"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/inputLink"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:gravity="left|start"
|
||||
android:text="@string/contact_link_intro"
|
||||
android:textSize="16sp"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/linkInputIcon"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/linkInputIcon"
|
||||
app:layout_constraintTop_toTopOf="@+id/linkInputIcon"/>
|
||||
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:id="@+id/linkInputLayout"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
app:errorEnabled="true"
|
||||
app:hintEnabled="false"
|
||||
app:layout_constraintEnd_toStartOf="@+id/pasteButton"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/linkInputIcon">
|
||||
|
||||
<android.support.design.widget.TextInputEditText
|
||||
android:id="@+id/linkInput"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:hint="@string/contact_link_hint"
|
||||
android:importantForAutofill="no"
|
||||
android:inputType="textUri"/>
|
||||
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
|
||||
<android.support.v7.widget.AppCompatImageButton
|
||||
android:id="@+id/pasteButton"
|
||||
style="@style/BriarButtonFlat.Positive.Tiny"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/ic_content_paste"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/linkInputLayout"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/linkInputLayout"
|
||||
app:layout_constraintTop_toTopOf="@+id/linkInputLayout"
|
||||
app:layout_constraintVertical_bias="0.0"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/scanCodeButton"
|
||||
style="@style/BriarButtonFlat.Positive.Tiny"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:drawableLeft="@drawable/ic_qr_code"
|
||||
android:drawablePadding="8dp"
|
||||
android:drawableStart="@drawable/ic_qr_code"
|
||||
android:text="@string/scan_qr_code_button"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toEndOf="@id/pasteButton"
|
||||
app:layout_constraintTop_toTopOf="@+id/pasteButton"
|
||||
tools:visibility="gone"/>
|
||||
|
||||
<android.support.constraint.Guideline
|
||||
android:id="@+id/guideline"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintGuide_percent="0.5"/>
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/stepOne"
|
||||
android:layout_width="28dp"
|
||||
android:layout_height="28dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:background="@drawable/bubble_accent"
|
||||
android:gravity="center"
|
||||
android:text="1"
|
||||
android:textColor="@color/briar_white"
|
||||
android:textSize="18sp"
|
||||
app:layout_constraintBottom_toTopOf="@+id/stepOneText"
|
||||
app:layout_constraintEnd_toStartOf="@+id/guideline"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/linkInputLayout"
|
||||
app:layout_constraintVertical_bias="1.0"
|
||||
app:layout_constraintVertical_chainStyle="packed"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/stepOneText"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginRight="8dp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:text="@string/send_link_title"
|
||||
app:layout_constraintBottom_toTopOf="@+id/addButton"
|
||||
app:layout_constraintEnd_toStartOf="@+id/guideline"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/stepOne"/>
|
||||
|
||||
<View
|
||||
android:id="@+id/stepConnector"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="1dp"
|
||||
android:layout_margin="16dp"
|
||||
android:alpha="0.5"
|
||||
android:background="@color/briar_accent"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/stepOne"
|
||||
app:layout_constraintEnd_toStartOf="@+id/stepTwo"
|
||||
app:layout_constraintStart_toEndOf="@+id/stepOne"
|
||||
app:layout_constraintTop_toTopOf="@+id/stepOne"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/stepTwo"
|
||||
android:layout_width="28dp"
|
||||
android:layout_height="28dp"
|
||||
android:alpha="0.5"
|
||||
android:background="@drawable/bubble_accent"
|
||||
android:gravity="center"
|
||||
android:text="2"
|
||||
android:textColor="@color/private_message_date_inverse"
|
||||
android:textSize="18sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="@+id/guideline"
|
||||
app:layout_constraintTop_toTopOf="@+id/stepOne"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/stepTwoText"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginRight="8dp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:text="@string/add_contact_choose_nickname"
|
||||
app:layout_constraintBottom_toTopOf="@+id/addButton"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toEndOf="@+id/guideline"
|
||||
app:layout_constraintTop_toBottomOf="@+id/stepTwo"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/addButton"
|
||||
style="@style/BriarButton"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/continue_button"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/stepOneText"/>
|
||||
|
||||
|
||||
</android.support.constraint.ConstraintLayout>
|
||||
</ScrollView>
|
||||
@@ -0,0 +1,95 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.constraint.ConstraintLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/contactNameInput"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/margin_large"
|
||||
android:drawableLeft="@drawable/ic_person"
|
||||
android:drawablePadding="8dp"
|
||||
android:drawableTint="?attr/colorControlNormal"
|
||||
android:hint="@string/contact_name_hint"
|
||||
android:importantForAutofill="no"
|
||||
android:inputType="text|textCapWords"
|
||||
app:layout_constraintBottom_toTopOf="@id/linkInput"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_chainStyle="packed"
|
||||
android:drawableStart="@drawable/ic_person"/>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/linkInput"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_marginLeft="@dimen/margin_large"
|
||||
android:layout_marginRight="8dp"
|
||||
android:layout_marginStart="@dimen/margin_large"
|
||||
android:layout_marginTop="16dp"
|
||||
android:drawableLeft="@drawable/ic_link"
|
||||
android:drawablePadding="8dp"
|
||||
android:drawableTint="?attr/colorControlNormal"
|
||||
android:hint="@string/contact_link_hint"
|
||||
android:importantForAutofill="no"
|
||||
android:inputType="textUri"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/contactNameInput"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/pasteButton"
|
||||
style="@style/BriarButtonFlat.Positive"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:drawableLeft="@drawable/ic_content_paste"
|
||||
android:drawablePadding="8dp"
|
||||
android:text="@string/paste_button"
|
||||
app:layout_constraintEnd_toStartOf="@+id/scanCodeButton"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintHorizontal_chainStyle="spread"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/linkInput"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/scanCodeButton"
|
||||
style="@style/BriarButtonFlat.Positive"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:drawableLeft="@drawable/ic_qr_code"
|
||||
android:drawablePadding="8dp"
|
||||
android:text="Scan Code"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toEndOf="@+id/pasteButton"
|
||||
app:layout_constraintTop_toBottomOf="@+id/linkInput"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/addButton"
|
||||
style="@style/BriarButton"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/margin_large"
|
||||
android:layout_marginTop="8dp"
|
||||
android:enabled="false"
|
||||
android:text="@string/add_contact_button"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.75"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/pasteButton"
|
||||
tools:enabled="true"/>
|
||||
|
||||
</android.support.constraint.ConstraintLayout>
|
||||
@@ -0,0 +1,87 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.constraint.ConstraintLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/linkIntro"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/margin_large"
|
||||
android:text="@string/your_link"
|
||||
android:textIsSelectable="true"
|
||||
android:textSize="18sp"
|
||||
app:layout_constraintBottom_toTopOf="@id/linkView"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_chainStyle="packed"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/linkView"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/margin_large"
|
||||
android:layout_marginLeft="@dimen/margin_large"
|
||||
android:layout_marginRight="@dimen/margin_large"
|
||||
android:layout_marginStart="@dimen/margin_large"
|
||||
android:background="@color/briar_white"
|
||||
android:padding="8dp"
|
||||
android:textColor="@color/briar_primary"
|
||||
android:textIsSelectable="true"
|
||||
android:textSize="18sp"
|
||||
android:typeface="monospace"
|
||||
app:layout_constraintBottom_toTopOf="@+id/copyButton"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/linkIntro"
|
||||
tools:text="briar://scnsdflamslkfjgluoblmksdfbwevlewajfdlkjewwhqliafskfjhskdjhvoieiv"/>
|
||||
|
||||
<android.support.v7.widget.AppCompatButton
|
||||
android:id="@+id/copyButton"
|
||||
style="@style/BriarButtonFlat.Positive"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/margin_large"
|
||||
android:drawableLeft="@drawable/ic_content_copy"
|
||||
android:drawablePadding="8dp"
|
||||
android:text="@string/copy_button"
|
||||
app:layout_constraintEnd_toStartOf="@+id/shareButton"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintHorizontal_chainStyle="spread"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/linkView"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/shareButton"
|
||||
style="@style/BriarButtonFlat.Positive"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:drawableLeft="@drawable/social_share_blue"
|
||||
android:drawablePadding="8dp"
|
||||
android:text="@string/share_button"
|
||||
app:layout_constraintBottom_toBottomOf="@id/copyButton"
|
||||
app:layout_constraintEnd_toStartOf="@+id/showCodeButton"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toEndOf="@+id/copyButton"
|
||||
app:layout_constraintTop_toTopOf="@id/copyButton"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/showCodeButton"
|
||||
style="@style/BriarButtonFlat.Positive"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:drawableLeft="@drawable/ic_qr_code"
|
||||
android:drawablePadding="8dp"
|
||||
android:drawableTint="@color/briar_button_text_positive"
|
||||
android:text="QR Code"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/copyButton"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toEndOf="@+id/shareButton"
|
||||
app:layout_constraintTop_toTopOf="@+id/copyButton"/>
|
||||
|
||||
</android.support.constraint.ConstraintLayout>
|
||||
24
briar-android/src/main/res/layout/fragment_contact_list.xml
Normal file
24
briar-android/src/main/res/layout/fragment_contact_list.xml
Normal file
@@ -0,0 +1,24 @@
|
||||
<?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">
|
||||
|
||||
<org.briarproject.briar.android.view.BriarRecyclerView
|
||||
android:id="@+id/list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:scrollToEnd="false"/>
|
||||
|
||||
<io.github.kobakei.materialfabspeeddial.FabSpeedDial
|
||||
android:id="@+id/speedDial"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:fab_fabDrawable="@drawable/ic_action_add"
|
||||
app:fab_fabRippleColor="@android:color/transparent"
|
||||
app:fab_menu="@menu/contact_list_actions"
|
||||
app:fab_miniFabTextBackground="@color/briar_accent"
|
||||
app:fab_miniFabTextColor="@android:color/white"/>
|
||||
|
||||
</android.support.design.widget.CoordinatorLayout>
|
||||
@@ -0,0 +1,53 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.constraint.ConstraintLayout
|
||||
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">
|
||||
|
||||
<org.briarproject.briar.android.keyagreement.CameraView
|
||||
android:id="@+id/camera_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintBottom_toTopOf="@+id/textView3"
|
||||
app:layout_constraintTop_toTopOf="parent"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginRight="8dp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:visibility="gone"
|
||||
android:text="or"
|
||||
android:textSize="18sp"
|
||||
app:layout_constraintBottom_toTopOf="@+id/enterLinkButton"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/camera_view"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/enterLinkButton"
|
||||
style="@style/BriarButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:drawableLeft="@drawable/ic_link"
|
||||
android:drawablePadding="8dp"
|
||||
android:visibility="gone"
|
||||
android:text="Enter Link"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/textView3"/>
|
||||
|
||||
</android.support.constraint.ConstraintLayout>
|
||||
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<org.briarproject.briar.android.view.QrCodeView
|
||||
android:id="@+id/qrCodeView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@android:color/white"/>
|
||||
|
||||
</FrameLayout>
|
||||
@@ -5,6 +5,7 @@
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:allowEmptyText="true"
|
||||
app:buttonText="@string/forum_share_button"
|
||||
app:fillHeight="true"
|
||||
app:hint="@string/forum_share_message"/>
|
||||
@@ -39,6 +39,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="bottom"
|
||||
app:allowEmptyText="true"
|
||||
app:buttonText="@string/blogs_reblog_button"
|
||||
app:hint="@string/blogs_reblog_comment_hint"
|
||||
app:maxLines="5"/>
|
||||
|
||||
49
briar-android/src/main/res/layout/image_preview.xml
Normal file
49
briar-android/src/main/res/layout/image_preview.xml
Normal file
@@ -0,0 +1,49 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<merge
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:animateLayoutChanges="true"
|
||||
tools:parentTag="android.support.constraint.ConstraintLayout"
|
||||
tools:showIn="@layout/activity_conversation">
|
||||
|
||||
<View
|
||||
android:id="@+id/divider"
|
||||
style="@style/Divider.Horizontal"
|
||||
android:layout_alignParentTop="true"
|
||||
app:layout_constraintBottom_toTopOf="@+id/imageView"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/divider"
|
||||
tools:ignore="ContentDescription"
|
||||
tools:srcCompat="@tools:sample/avatars"/>
|
||||
|
||||
<android.support.design.widget.FloatingActionButton
|
||||
android:id="@+id/imageCancelButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_marginRight="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:src="@drawable/ic_close"
|
||||
app:backgroundTint="@color/briar_red"
|
||||
app:fabCustomSize="26dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0"
|
||||
app:maxImageSize="18dp"/>
|
||||
|
||||
</merge>
|
||||
@@ -118,6 +118,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/margin_large"
|
||||
android:visibility="gone"
|
||||
app:allowEmptyText="true"
|
||||
app:buttonText="@string/introduction_button"
|
||||
app:hint="@string/introduction_message_hint"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.constraint.ConstraintLayout
|
||||
android:id="@+id/linearLayout4"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<org.briarproject.briar.android.view.TextAvatarView
|
||||
android:id="@+id/avatar"
|
||||
android:layout_width="@dimen/listitem_picture_frame_size"
|
||||
android:layout_height="@dimen/listitem_picture_frame_size"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:layout_marginLeft="@dimen/listitem_horizontal_margin"
|
||||
android:layout_marginStart="@dimen/listitem_horizontal_margin"
|
||||
android:layout_marginTop="8dp"
|
||||
app:layout_constraintBottom_toTopOf="@+id/divider"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"/>
|
||||
|
||||
<com.vanniktech.emoji.EmojiTextView
|
||||
android:id="@+id/name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/margin_large"
|
||||
android:layout_marginStart="@dimen/margin_large"
|
||||
android:layout_marginTop="@dimen/margin_large"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:textSize="@dimen/text_size_medium"
|
||||
app:layout_constrainedWidth="true"
|
||||
app:layout_constraintBottom_toTopOf="@+id/status"
|
||||
app:layout_constraintEnd_toStartOf="@+id/time"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintHorizontal_chainStyle="spread_inside"
|
||||
app:layout_constraintStart_toEndOf="@+id/avatar"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_chainStyle="packed"
|
||||
tools:text="This is a name of a contact"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/status"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:text="@string/waiting_for_contact_to_come_online"
|
||||
app:layout_constrainedWidth="true"
|
||||
app:layout_constraintBottom_toTopOf="@+id/divider"
|
||||
app:layout_constraintEnd_toStartOf="@+id/time"
|
||||
app:layout_constraintHorizontal_bias="0.0"
|
||||
app:layout_constraintStart_toStartOf="@+id/name"
|
||||
app:layout_constraintTop_toBottomOf="@+id/name"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/time"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/margin_large"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:textSize="@dimen/text_size_small"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/name"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:text="Dec 24"/>
|
||||
|
||||
<View
|
||||
android:id="@+id/divider"
|
||||
style="@style/Divider.ContactList"
|
||||
android:layout_width="0dp"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginStart="8dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/avatar"/>
|
||||
|
||||
</android.support.constraint.ConstraintLayout>
|
||||
@@ -5,6 +5,7 @@
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:animateLayoutChanges="true"
|
||||
tools:showIn="@layout/activity_conversation">
|
||||
|
||||
<View
|
||||
@@ -16,46 +17,48 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/card_background">
|
||||
|
||||
<android.support.v7.widget.AppCompatImageButton
|
||||
android:id="@+id/emoji_toggle"
|
||||
android:layout_width="@dimen/text_input_height"
|
||||
android:layout_height="@dimen/text_input_height"
|
||||
android:layout_gravity="bottom"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:padding="@dimen/margin_small"
|
||||
android:scaleType="center"
|
||||
android:src="@drawable/ic_emoji_toggle"
|
||||
app:tint="?attr/colorControlNormal"/>
|
||||
|
||||
<com.vanniktech.emoji.EmojiEditText
|
||||
android:id="@+id/input_text"
|
||||
<org.briarproject.briar.android.view.EmojiTextInputView
|
||||
android:id="@+id/emojiTextInput"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:background="@android:color/transparent"
|
||||
android:inputType="textMultiLine|textCapSentences"
|
||||
android:maxLines="4"
|
||||
android:minHeight="@dimen/text_input_height"
|
||||
android:paddingLeft="2dp"
|
||||
android:paddingStart="2dp"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
tools:ignore="RtlSymmetry"
|
||||
tools:text="Line 1\nLine 2\nLine 3"/>
|
||||
app:maxTextLines="4"/>
|
||||
|
||||
<android.support.v7.widget.AppCompatImageButton
|
||||
android:id="@+id/btn_send"
|
||||
<FrameLayout
|
||||
android:layout_width="@dimen/text_input_height"
|
||||
android:layout_height="@dimen/text_input_height"
|
||||
android:layout_gravity="bottom"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:clickable="true"
|
||||
android:contentDescription="@string/send"
|
||||
android:enabled="false"
|
||||
android:focusable="true"
|
||||
android:padding="4dp"
|
||||
android:scaleType="center"
|
||||
android:src="@drawable/social_send_now_white"
|
||||
app:tint="@color/briar_accent"/>
|
||||
android:layout_gravity="bottom">
|
||||
|
||||
<android.support.v7.widget.AppCompatImageButton
|
||||
android:id="@+id/imageButton"
|
||||
android:layout_width="@dimen/text_input_height"
|
||||
android:layout_height="@dimen/text_input_height"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:clickable="true"
|
||||
android:contentDescription="@string/image_attach"
|
||||
android:enabled="false"
|
||||
android:focusable="true"
|
||||
android:padding="4dp"
|
||||
android:scaleType="center"
|
||||
android:src="@drawable/ic_image"
|
||||
android:visibility="invisible"
|
||||
app:tint="?attr/colorControlNormal"/>
|
||||
|
||||
<android.support.v7.widget.AppCompatImageButton
|
||||
android:id="@+id/btn_send"
|
||||
android:layout_width="@dimen/text_input_height"
|
||||
android:layout_height="@dimen/text_input_height"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:clickable="true"
|
||||
android:contentDescription="@string/send"
|
||||
android:enabled="false"
|
||||
android:focusable="true"
|
||||
android:padding="4dp"
|
||||
android:scaleType="center"
|
||||
android:src="@drawable/social_send_now_white"
|
||||
app:tint="@color/briar_accent"/>
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user