use of de.pixart.messenger.ui.util.ActivityResult in project Pix-Art-Messenger by kriztan.
the class ConversationActivity method onActivityResult.
@Override
public void onActivityResult(int requestCode, int resultCode, final Intent data) {
super.onActivityResult(requestCode, resultCode, data);
ActivityResult activityResult = ActivityResult.of(requestCode, resultCode, data);
if (xmppConnectionService != null) {
handleActivityResult(activityResult);
} else {
this.postponedActivityResult.push(activityResult);
}
}
use of de.pixart.messenger.ui.util.ActivityResult in project Pix-Art-Messenger by kriztan.
the class ConversationActivity method onBackendConnected.
@Override
void onBackendConnected() {
if (performRedirectIfNecessary(true)) {
return;
}
xmppConnectionService.getNotificationService().setIsInForeground(true);
final Intent FirstStartIntent = getIntent();
final Bundle extras = FirstStartIntent.getExtras();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
if (extras != null && extras.containsKey(PREF_FIRST_START)) {
FirstStartTime = extras.getLong(PREF_FIRST_START);
Log.d(Config.LOGTAG, "Get first start time from StartUI: " + FirstStartTime);
}
} else {
FirstStartTime = System.currentTimeMillis();
Log.d(Config.LOGTAG, "Device is running Android < SDK 23, no restart required: " + FirstStartTime);
}
Intent intent = pendingViewIntent.pop();
if (intent != null) {
if (processViewIntent(intent)) {
if (binding.secondaryFragment != null) {
notifyFragmentOfBackendConnected(R.id.main_fragment);
}
invalidateActionBarTitle();
return;
}
}
if (FirstStartTime == 0) {
Log.d(Config.LOGTAG, "First start time: " + FirstStartTime + ", restarting App");
// write first start timestamp to file
FirstStartTime = System.currentTimeMillis();
SharedPreferences FirstStart = getApplicationContext().getSharedPreferences(PREF_FIRST_START, Context.MODE_PRIVATE);
SharedPreferences.Editor editor = FirstStart.edit();
editor.putLong(PREF_FIRST_START, FirstStartTime);
editor.commit();
// restart
Intent restartintent = getBaseContext().getPackageManager().getLaunchIntentForPackage(getBaseContext().getPackageName());
restartintent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
restartintent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(restartintent);
System.exit(0);
}
if (xmppConnectionService.getAccounts().size() != 0) {
if (xmppConnectionService.hasInternetConnection()) {
if (xmppConnectionService.isWIFI() || (xmppConnectionService.isMobile() && !xmppConnectionService.isMobileRoaming())) {
if (!xmppConnectionService.installedFromFDroid()) {
AppUpdate(xmppConnectionService.installedFromPlayStore());
}
}
}
}
for (@IdRes int id : FRAGMENT_ID_NOTIFICATION_ORDER) {
notifyFragmentOfBackendConnected(id);
}
ActivityResult activityResult = postponedActivityResult.pop();
if (activityResult != null) {
handleActivityResult(activityResult);
}
invalidateActionBarTitle();
if (binding.secondaryFragment != null && ConversationFragment.getConversation(this) == null) {
Conversation conversation = ConversationsOverviewFragment.getSuggestion(this);
if (conversation != null) {
openConversation(conversation, null);
}
}
showDialogsIfMainIsOverview();
}
use of de.pixart.messenger.ui.util.ActivityResult in project Pix-Art-Messenger by kriztan.
the class ConversationFragment method onBackendConnected.
@Override
public void onBackendConnected() {
Log.d(Config.LOGTAG, "ConversationFragment.onBackendConnected()");
String uuid = pendingConversationsUuid.pop();
if (uuid != null) {
Conversation conversation = activity.xmppConnectionService.findConversationByUuid(uuid);
if (conversation == null) {
Log.d(Config.LOGTAG, "unable to restore activity");
clearPending();
return;
}
reInit(conversation);
ScrollState scrollState = pendingScrollState.pop();
if (scrollState != null) {
setScrollPosition(scrollState);
}
}
ActivityResult activityResult = postponedActivityResult.pop();
if (activityResult != null) {
handleActivityResult(activityResult);
}
clearPending();
}
use of de.pixart.messenger.ui.util.ActivityResult in project Pix-Art-Messenger by kriztan.
the class ConversationFragment method onActivityResult.
@Override
public void onActivityResult(int requestCode, int resultCode, final Intent data) {
super.onActivityResult(requestCode, resultCode, data);
ActivityResult activityResult = ActivityResult.of(requestCode, resultCode, data);
if (activity != null && activity.xmppConnectionService != null) {
handleActivityResult(activityResult);
} else {
this.postponedActivityResult.push(activityResult);
}
}
Aggregations