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();
|
||||
|
||||
if (jid != null) {
|
||||
Class clazz;
|
||||
try {
|
||||
clazz = Class.forName("eu.siacs.conversations.ui.ShareViaAccountActivity");
|
||||
} catch (ClassNotFoundException e) {
|
||||
clazz = null;
|
||||
|
||||
}
|
||||
final Class<?> clazz = findShareViaAccountClass();
|
||||
if (clazz != null) {
|
||||
intent = new Intent(this, clazz);
|
||||
intent.putExtra("contact", jid.toEscapedString());
|
||||
|
@ -164,7 +158,6 @@ public class UriHandlerActivity extends AppCompatActivity {
|
|||
intent.setData(uri);
|
||||
intent.putExtra("account", accounts.get(0).toEscapedString());
|
||||
}
|
||||
|
||||
} else {
|
||||
intent = new Intent(this, ShareWithActivity.class);
|
||||
intent.setAction(Intent.ACTION_SEND);
|
||||
|
@ -191,6 +184,14 @@ public class UriHandlerActivity extends AppCompatActivity {
|
|||
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) {
|
||||
if (handled) {
|
||||
return;
|
||||
|
@ -248,7 +249,7 @@ public class UriHandlerActivity extends AppCompatActivity {
|
|||
}
|
||||
|
||||
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) == '}';
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue