2016-04-19 16:03:24 +00:00
|
|
|
package eu.siacs.conversations.ui;
|
|
|
|
|
2016-10-08 16:24:20 +00:00
|
|
|
import android.app.ActionBar;
|
2016-04-19 16:03:24 +00:00
|
|
|
import android.content.Intent;
|
2016-08-26 14:05:38 +00:00
|
|
|
import android.content.pm.ActivityInfo;
|
2016-04-19 16:03:24 +00:00
|
|
|
import android.os.Bundle;
|
|
|
|
import android.view.View;
|
|
|
|
import android.widget.Button;
|
|
|
|
|
2016-11-17 10:40:29 +00:00
|
|
|
import java.util.List;
|
|
|
|
|
2016-04-19 16:03:24 +00:00
|
|
|
import eu.siacs.conversations.R;
|
2016-11-17 10:40:29 +00:00
|
|
|
import eu.siacs.conversations.entities.Account;
|
|
|
|
|
|
|
|
public class WelcomeActivity extends XmppActivity {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected void refreshUiReal() {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
void onBackendConnected() {
|
2016-04-19 16:03:24 +00:00
|
|
|
|
2016-11-17 10:40:29 +00:00
|
|
|
}
|
2016-04-19 16:03:24 +00:00
|
|
|
|
2017-06-30 19:22:35 +00:00
|
|
|
@Override
|
|
|
|
public void onStart() {
|
|
|
|
super.onStart();
|
|
|
|
final int theme = findTheme();
|
|
|
|
if (this.mTheme != theme) {
|
|
|
|
recreate();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-04-19 16:03:24 +00:00
|
|
|
@Override
|
|
|
|
protected void onCreate(final Bundle savedInstanceState) {
|
2016-08-26 14:05:38 +00:00
|
|
|
if (getResources().getBoolean(R.bool.portrait_only)) {
|
|
|
|
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
|
|
|
}
|
2016-11-17 10:40:29 +00:00
|
|
|
super.onCreate(savedInstanceState);
|
|
|
|
setContentView(R.layout.welcome);
|
2016-10-08 16:24:20 +00:00
|
|
|
final ActionBar ab = getActionBar();
|
|
|
|
if (ab != null) {
|
|
|
|
ab.setDisplayShowHomeEnabled(false);
|
|
|
|
ab.setDisplayHomeAsUpEnabled(false);
|
|
|
|
}
|
2016-04-19 16:03:24 +00:00
|
|
|
final Button createAccount = (Button) findViewById(R.id.create_account);
|
|
|
|
createAccount.setOnClickListener(new View.OnClickListener() {
|
|
|
|
@Override
|
|
|
|
public void onClick(View v) {
|
|
|
|
Intent intent = new Intent(WelcomeActivity.this, MagicCreateActivity.class);
|
|
|
|
intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
|
|
|
|
startActivity(intent);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
final Button useOwnProvider = (Button) findViewById(R.id.use_own_provider);
|
|
|
|
useOwnProvider.setOnClickListener(new View.OnClickListener() {
|
|
|
|
@Override
|
|
|
|
public void onClick(View v) {
|
2016-11-17 10:40:29 +00:00
|
|
|
List<Account> accounts = xmppConnectionService.getAccounts();
|
|
|
|
Intent intent = new Intent(WelcomeActivity.this, EditAccountActivity.class);
|
|
|
|
if (accounts.size() == 1) {
|
|
|
|
intent.putExtra("jid",accounts.get(0).getJid().toBareJid().toString());
|
|
|
|
intent.putExtra("init",true);
|
|
|
|
} else if (accounts.size() >= 1) {
|
|
|
|
intent = new Intent(WelcomeActivity.this, ManageAccountActivity.class);
|
|
|
|
}
|
|
|
|
startActivity(intent);
|
2016-04-19 16:03:24 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|