minor code cleanup in UriHandlerActivity
This commit is contained in:
parent
20e4d108d4
commit
495537d087
|
@ -147,13 +147,7 @@ public class UriHandlerActivity extends AppCompatActivity {
|
||||||
final String body = xmppUri.getBody();
|
final String body = xmppUri.getBody();
|
||||||
|
|
||||||
if (jid != null) {
|
if (jid != null) {
|
||||||
Class clazz;
|
final Class<?> clazz = findShareViaAccountClass();
|
||||||
try {
|
|
||||||
clazz = Class.forName("eu.siacs.conversations.ui.ShareViaAccountActivity");
|
|
||||||
} catch (ClassNotFoundException e) {
|
|
||||||
clazz = null;
|
|
||||||
|
|
||||||
}
|
|
||||||
if (clazz != null) {
|
if (clazz != null) {
|
||||||
intent = new Intent(this, clazz);
|
intent = new Intent(this, clazz);
|
||||||
intent.putExtra("contact", jid.toEscapedString());
|
intent.putExtra("contact", jid.toEscapedString());
|
||||||
|
@ -164,7 +158,6 @@ public class UriHandlerActivity extends AppCompatActivity {
|
||||||
intent.setData(uri);
|
intent.setData(uri);
|
||||||
intent.putExtra("account", accounts.get(0).toEscapedString());
|
intent.putExtra("account", accounts.get(0).toEscapedString());
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
intent = new Intent(this, ShareWithActivity.class);
|
intent = new Intent(this, ShareWithActivity.class);
|
||||||
intent.setAction(Intent.ACTION_SEND);
|
intent.setAction(Intent.ACTION_SEND);
|
||||||
|
@ -191,6 +184,14 @@ public class UriHandlerActivity extends AppCompatActivity {
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static Class<?> findShareViaAccountClass() {
|
||||||
|
try {
|
||||||
|
return Class.forName("eu.siacs.conversations.ui.ShareViaAccountActivity");
|
||||||
|
} catch (final ClassNotFoundException e) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void handleIntent(Intent data) {
|
private void handleIntent(Intent data) {
|
||||||
if (handled) {
|
if (handled) {
|
||||||
return;
|
return;
|
||||||
|
@ -248,7 +249,7 @@ public class UriHandlerActivity extends AppCompatActivity {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean looksLikeJsonObject(final String input) {
|
private static boolean looksLikeJsonObject(final String input) {
|
||||||
final String trimmed = Strings.emptyToNull(input).trim();
|
final String trimmed = Strings.nullToEmpty(input).trim();
|
||||||
return trimmed.charAt(0) == '{' && trimmed.charAt(trimmed.length() - 1) == '}';
|
return trimmed.charAt(0) == '{' && trimmed.charAt(trimmed.length() - 1) == '}';
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue