1package eu.siacs.conversations.ui;
2
3import android.app.ActionBar;
4import android.content.Intent;
5import android.content.pm.ActivityInfo;
6import android.os.Bundle;
7import android.view.View;
8import android.widget.Button;
9
10import java.util.List;
11
12import eu.siacs.conversations.R;
13import eu.siacs.conversations.entities.Account;
14
15public class WelcomeActivity extends XmppActivity {
16
17 @Override
18 protected void refreshUiReal() {
19
20 }
21
22 @Override
23 void onBackendConnected() {
24
25 }
26
27 @Override
28 public void onStart() {
29 super.onStart();
30 final int theme = findTheme();
31 if (this.mTheme != theme) {
32 recreate();
33 }
34 }
35
36 @Override
37 protected void onCreate(final Bundle savedInstanceState) {
38 if (getResources().getBoolean(R.bool.portrait_only)) {
39 setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
40 }
41 super.onCreate(savedInstanceState);
42 setContentView(R.layout.welcome);
43 final ActionBar ab = getActionBar();
44 if (ab != null) {
45 ab.setDisplayShowHomeEnabled(false);
46 ab.setDisplayHomeAsUpEnabled(false);
47 }
48 final Button createAccount = (Button) findViewById(R.id.create_account);
49 createAccount.setOnClickListener(new View.OnClickListener() {
50 @Override
51 public void onClick(View v) {
52 Intent intent = new Intent(WelcomeActivity.this, MagicCreateActivity.class);
53 intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
54 startActivity(intent);
55 }
56 });
57 final Button useOwnProvider = (Button) findViewById(R.id.use_own_provider);
58 useOwnProvider.setOnClickListener(new View.OnClickListener() {
59 @Override
60 public void onClick(View v) {
61 List<Account> accounts = xmppConnectionService.getAccounts();
62 Intent intent = new Intent(WelcomeActivity.this, EditAccountActivity.class);
63 if (accounts.size() == 1) {
64 intent.putExtra("jid",accounts.get(0).getJid().toBareJid().toString());
65 intent.putExtra("init",true);
66 } else if (accounts.size() >= 1) {
67 intent = new Intent(WelcomeActivity.this, ManageAccountActivity.class);
68 }
69 startActivity(intent);
70 }
71 });
72
73 }
74
75}