rework welcome screens to split use existing account / create new
closes #3440
This commit is contained in:
		
							parent
							
								
									a04b7a1c0f
								
							
						
					
					
						commit
						7b61bb9841
					
				| @ -12,9 +12,13 @@ | |||||||
|             android:name=".ui.WelcomeActivity" |             android:name=".ui.WelcomeActivity" | ||||||
|             android:label="@string/app_name" |             android:label="@string/app_name" | ||||||
|             android:launchMode="singleTask"/> |             android:launchMode="singleTask"/> | ||||||
|  |         <activity | ||||||
|  |             android:name=".ui.PickServerActivity" | ||||||
|  |             android:label="@string/create_new_account" | ||||||
|  |             android:launchMode="singleTask"/> | ||||||
|         <activity |         <activity | ||||||
|             android:name=".ui.MagicCreateActivity" |             android:name=".ui.MagicCreateActivity" | ||||||
|             android:label="@string/create_account" |             android:label="@string/create_new_account" | ||||||
|             android:launchMode="singleTask"/> |             android:launchMode="singleTask"/> | ||||||
|         <activity |         <activity | ||||||
|             android:name=".ui.ImportBackupActivity" |             android:name=".ui.ImportBackupActivity" | ||||||
|  | |||||||
| @ -0,0 +1,104 @@ | |||||||
|  | package eu.siacs.conversations.ui; | ||||||
|  | 
 | ||||||
|  | import android.content.Intent; | ||||||
|  | import android.content.pm.ActivityInfo; | ||||||
|  | import android.databinding.DataBindingUtil; | ||||||
|  | import android.os.Bundle; | ||||||
|  | import android.support.v7.app.AppCompatActivity; | ||||||
|  | import android.support.v7.widget.Toolbar; | ||||||
|  | import android.view.MenuItem; | ||||||
|  | 
 | ||||||
|  | import java.util.List; | ||||||
|  | 
 | ||||||
|  | import eu.siacs.conversations.R; | ||||||
|  | import eu.siacs.conversations.databinding.ActivityPickServerBinding; | ||||||
|  | import eu.siacs.conversations.entities.Account; | ||||||
|  | 
 | ||||||
|  | public class PickServerActivity extends XmppActivity { | ||||||
|  | 
 | ||||||
|  |     @Override | ||||||
|  |     protected void refreshUiReal() { | ||||||
|  | 
 | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     @Override | ||||||
|  |     void onBackendConnected() { | ||||||
|  | 
 | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     @Override | ||||||
|  |     public void onStart() { | ||||||
|  |         super.onStart(); | ||||||
|  |         final int theme = findTheme(); | ||||||
|  |         if (this.mTheme != theme) { | ||||||
|  |             recreate(); | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     @Override | ||||||
|  |     public boolean onOptionsItemSelected(final MenuItem item) { | ||||||
|  |         if (item.getItemId() == android.R.id.home) { | ||||||
|  |             startActivity(new Intent(this, WelcomeActivity.class)); | ||||||
|  |             finish(); | ||||||
|  |             return true; | ||||||
|  |         } | ||||||
|  |         return super.onOptionsItemSelected(item); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     @Override | ||||||
|  |     public void onBackPressed() { | ||||||
|  |         startActivity(new Intent(this, WelcomeActivity.class)); | ||||||
|  |         super.onBackPressed(); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     @Override | ||||||
|  |     public void onNewIntent(Intent intent) { | ||||||
|  |         if (intent != null) { | ||||||
|  |             setIntent(intent); | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     @Override | ||||||
|  |     protected void onCreate(final Bundle savedInstanceState) { | ||||||
|  |         if (getResources().getBoolean(R.bool.portrait_only)) { | ||||||
|  |             setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); | ||||||
|  |         } | ||||||
|  |         super.onCreate(savedInstanceState); | ||||||
|  |         ActivityPickServerBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_pick_server); | ||||||
|  |         setSupportActionBar((Toolbar) binding.toolbar); | ||||||
|  |         configureActionBar(getSupportActionBar()); | ||||||
|  |         binding.useCim.setOnClickListener(v -> { | ||||||
|  |             final Intent intent = new Intent(this, MagicCreateActivity.class); | ||||||
|  |             intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION); | ||||||
|  |             addInviteUri(intent); | ||||||
|  |             startActivity(intent); | ||||||
|  |         }); | ||||||
|  |         binding.useOwnProvider.setOnClickListener(v -> { | ||||||
|  |             List<Account> accounts = xmppConnectionService.getAccounts(); | ||||||
|  |             Intent intent = new Intent(this, EditAccountActivity.class); | ||||||
|  |             intent.putExtra(EditAccountActivity.EXTRA_FORCE_REGISTER, true); | ||||||
|  |             if (accounts.size() == 1) { | ||||||
|  |                 intent.putExtra("jid", accounts.get(0).getJid().asBareJid().toString()); | ||||||
|  |                 intent.putExtra("init", true); | ||||||
|  |             } else if (accounts.size() >= 1) { | ||||||
|  |                 intent = new Intent(this, ManageAccountActivity.class); | ||||||
|  |             } | ||||||
|  |             addInviteUri(intent); | ||||||
|  |             startActivity(intent); | ||||||
|  |         }); | ||||||
|  | 
 | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     public void addInviteUri(Intent intent) { | ||||||
|  |         StartConversationActivity.addInviteUri(intent, getIntent()); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     public static void launch(AppCompatActivity activity) { | ||||||
|  |         Intent intent = new Intent(activity, PickServerActivity.class); | ||||||
|  |         intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); | ||||||
|  |         activity.startActivity(intent); | ||||||
|  |         activity.overridePendingTransition(0, 0); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  | } | ||||||
| @ -2,18 +2,19 @@ package eu.siacs.conversations.ui; | |||||||
| 
 | 
 | ||||||
| import android.content.Intent; | import android.content.Intent; | ||||||
| import android.content.pm.ActivityInfo; | import android.content.pm.ActivityInfo; | ||||||
|  | import android.databinding.DataBindingUtil; | ||||||
| import android.os.Bundle; | import android.os.Bundle; | ||||||
| import android.support.annotation.NonNull; | import android.support.annotation.NonNull; | ||||||
| import android.support.v7.app.ActionBar; |  | ||||||
| import android.support.v7.app.AppCompatActivity; | import android.support.v7.app.AppCompatActivity; | ||||||
|  | import android.support.v7.widget.Toolbar; | ||||||
| import android.view.Menu; | import android.view.Menu; | ||||||
| import android.view.MenuItem; | import android.view.MenuItem; | ||||||
| import android.widget.Button; |  | ||||||
| import android.widget.Toast; | import android.widget.Toast; | ||||||
| 
 | 
 | ||||||
| import java.util.List; | import java.util.List; | ||||||
| 
 | 
 | ||||||
| import eu.siacs.conversations.R; | import eu.siacs.conversations.R; | ||||||
|  | import eu.siacs.conversations.databinding.ActivityWelcomeBinding; | ||||||
| import eu.siacs.conversations.entities.Account; | import eu.siacs.conversations.entities.Account; | ||||||
| 
 | 
 | ||||||
| import static eu.siacs.conversations.utils.PermissionUtils.allGranted; | import static eu.siacs.conversations.utils.PermissionUtils.allGranted; | ||||||
| @ -55,24 +56,18 @@ public class WelcomeActivity extends XmppActivity { | |||||||
|             setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); |             setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); | ||||||
|         } |         } | ||||||
|         super.onCreate(savedInstanceState); |         super.onCreate(savedInstanceState); | ||||||
|         setContentView(R.layout.welcome); |         ActivityWelcomeBinding binding = DataBindingUtil.setContentView(this,R.layout.activity_welcome); | ||||||
|         setSupportActionBar(findViewById(R.id.toolbar)); |         setSupportActionBar((Toolbar) binding.toolbar); | ||||||
|         final ActionBar ab = getSupportActionBar(); |         configureActionBar(getSupportActionBar(), false); | ||||||
|         if (ab != null) { |         binding.registerNewAccount.setOnClickListener(v -> { | ||||||
|             ab.setDisplayShowHomeEnabled(false); |             final Intent intent = new Intent(this, PickServerActivity.class); | ||||||
|             ab.setDisplayHomeAsUpEnabled(false); |  | ||||||
|         } |  | ||||||
|         final Button createAccount = findViewById(R.id.create_account); |  | ||||||
|         createAccount.setOnClickListener(v -> { |  | ||||||
|             final Intent intent = new Intent(WelcomeActivity.this, MagicCreateActivity.class); |  | ||||||
|             intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION); |  | ||||||
|             addInviteUri(intent); |             addInviteUri(intent); | ||||||
|             startActivity(intent); |             startActivity(intent); | ||||||
|         }); |         }); | ||||||
|         final Button useOwnProvider = findViewById(R.id.use_own_provider); |         binding.useExisting.setOnClickListener(v -> { | ||||||
|         useOwnProvider.setOnClickListener(v -> { |  | ||||||
|             List<Account> accounts = xmppConnectionService.getAccounts(); |             List<Account> accounts = xmppConnectionService.getAccounts(); | ||||||
|             Intent intent = new Intent(WelcomeActivity.this, EditAccountActivity.class); |             Intent intent = new Intent(WelcomeActivity.this, EditAccountActivity.class); | ||||||
|  |             intent.putExtra(EditAccountActivity.EXTRA_FORCE_REGISTER,false); | ||||||
|             if (accounts.size() == 1) { |             if (accounts.size() == 1) { | ||||||
|                 intent.putExtra("jid", accounts.get(0).getJid().asBareJid().toString()); |                 intent.putExtra("jid", accounts.get(0).getJid().asBareJid().toString()); | ||||||
|                 intent.putExtra("init", true); |                 intent.putExtra("init", true); | ||||||
|  | |||||||
| @ -9,13 +9,23 @@ import eu.siacs.conversations.services.XmppConnectionService; | |||||||
| import eu.siacs.conversations.ui.ConversationsActivity; | import eu.siacs.conversations.ui.ConversationsActivity; | ||||||
| import eu.siacs.conversations.ui.EditAccountActivity; | import eu.siacs.conversations.ui.EditAccountActivity; | ||||||
| import eu.siacs.conversations.ui.ManageAccountActivity; | import eu.siacs.conversations.ui.ManageAccountActivity; | ||||||
|  | import eu.siacs.conversations.ui.PickServerActivity; | ||||||
| import eu.siacs.conversations.ui.StartConversationActivity; | import eu.siacs.conversations.ui.StartConversationActivity; | ||||||
| import eu.siacs.conversations.ui.WelcomeActivity; | import eu.siacs.conversations.ui.WelcomeActivity; | ||||||
| 
 | 
 | ||||||
| public class SignupUtils { | public class SignupUtils { | ||||||
| 
 | 
 | ||||||
|     public static Intent getSignUpIntent(final Activity activity) { |     public static Intent getSignUpIntent(final Activity activity) { | ||||||
|         Intent intent = new Intent(activity, WelcomeActivity.class); |         return getSignUpIntent(activity, false); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     public static Intent getSignUpIntent(final Activity activity, final boolean toServerChooser) { | ||||||
|  |         Intent intent; | ||||||
|  |         if (toServerChooser) { | ||||||
|  |             intent = new Intent(activity, PickServerActivity.class); | ||||||
|  |         } else { | ||||||
|  |             intent = new Intent(activity, WelcomeActivity.class); | ||||||
|  |         } | ||||||
|         StartConversationActivity.addInviteUri(intent, activity.getIntent()); |         StartConversationActivity.addInviteUri(intent, activity.getIntent()); | ||||||
|         return intent; |         return intent; | ||||||
|     } |     } | ||||||
| @ -27,6 +37,9 @@ public class SignupUtils { | |||||||
|         if (pendingAccount != null) { |         if (pendingAccount != null) { | ||||||
|             intent = new Intent(activity, EditAccountActivity.class); |             intent = new Intent(activity, EditAccountActivity.class); | ||||||
|             intent.putExtra("jid", pendingAccount.getJid().asBareJid().toString()); |             intent.putExtra("jid", pendingAccount.getJid().asBareJid().toString()); | ||||||
|  |             if (!pendingAccount.isOptionSet(Account.OPTION_MAGIC_CREATE)) { | ||||||
|  |                 intent.putExtra(EditAccountActivity.EXTRA_FORCE_REGISTER, pendingAccount.isOptionSet(Account.OPTION_REGISTER)); | ||||||
|  |             } | ||||||
|         } else { |         } else { | ||||||
|             if (service.getAccounts().size() == 0) { |             if (service.getAccounts().size() == 0) { | ||||||
|                 if (Config.X509_VERIFICATION) { |                 if (Config.X509_VERIFICATION) { | ||||||
|  | |||||||
							
								
								
									
										102
									
								
								src/conversations/res/layout/activity_pick_server.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										102
									
								
								src/conversations/res/layout/activity_pick_server.xml
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,102 @@ | |||||||
|  | <?xml version="1.0" encoding="utf-8"?> | ||||||
|  | <layout xmlns:android="http://schemas.android.com/apk/res/android"> | ||||||
|  | 
 | ||||||
|  |     <LinearLayout | ||||||
|  | 
 | ||||||
|  |         android:layout_width="match_parent" | ||||||
|  |         android:layout_height="match_parent" | ||||||
|  |         android:orientation="vertical"> | ||||||
|  | 
 | ||||||
|  |         <include android:id="@+id/toolbar" layout="@layout/toolbar" /> | ||||||
|  | 
 | ||||||
|  |         <ScrollView | ||||||
|  |             android:layout_width="match_parent" | ||||||
|  |             android:layout_height="match_parent" | ||||||
|  |             android:fillViewport="true"> | ||||||
|  | 
 | ||||||
|  |             <RelativeLayout | ||||||
|  |                 android:layout_width="match_parent" | ||||||
|  |                 android:layout_height="match_parent" | ||||||
|  |                 android:background="?attr/color_background_primary"> | ||||||
|  | 
 | ||||||
|  |                 <LinearLayout | ||||||
|  |                     android:id="@+id/linearLayout" | ||||||
|  |                     android:layout_width="match_parent" | ||||||
|  |                     android:layout_height="wrap_content" | ||||||
|  |                     android:layout_alignParentStart="true" | ||||||
|  |                     android:layout_alignParentLeft="true" | ||||||
|  |                     android:layout_alignParentBottom="true" | ||||||
|  |                     android:minHeight="256dp" | ||||||
|  |                     android:orientation="vertical" | ||||||
|  |                     android:paddingLeft="16dp" | ||||||
|  |                     android:paddingRight="16dp" | ||||||
|  |                     android:paddingBottom="10dp"> | ||||||
|  | 
 | ||||||
|  |                     <Space | ||||||
|  |                         android:layout_width="match_parent" | ||||||
|  |                         android:layout_height="0dp" | ||||||
|  |                         android:layout_weight="1" /> | ||||||
|  | 
 | ||||||
|  |                     <TextView | ||||||
|  |                         android:layout_width="wrap_content" | ||||||
|  |                         android:layout_height="wrap_content" | ||||||
|  |                         android:text="@string/pick_a_server" | ||||||
|  |                         android:textAppearance="@style/TextAppearance.Conversations.Title" /> | ||||||
|  | 
 | ||||||
|  |                     <TextView | ||||||
|  |                         android:layout_width="wrap_content" | ||||||
|  |                         android:layout_height="wrap_content" | ||||||
|  |                         android:layout_marginTop="8dp" | ||||||
|  |                         android:text="@string/server_select_text" | ||||||
|  |                         android:textAppearance="@style/TextAppearance.Conversations.Body1" /> | ||||||
|  | 
 | ||||||
|  |                     <Button | ||||||
|  |                         android:id="@+id/use_cim" | ||||||
|  |                         style="@style/Widget.Conversations.Button.Borderless" | ||||||
|  |                         android:layout_width="wrap_content" | ||||||
|  |                         android:layout_height="wrap_content" | ||||||
|  |                         android:layout_gravity="right" | ||||||
|  |                         android:text="@string/use_conversations.im" | ||||||
|  |                         android:textColor="?colorAccent" /> | ||||||
|  | 
 | ||||||
|  |                     <Button | ||||||
|  |                         android:id="@+id/use_own_provider" | ||||||
|  |                         style="@style/Widget.Conversations.Button.Borderless" | ||||||
|  |                         android:layout_width="wrap_content" | ||||||
|  |                         android:layout_height="wrap_content" | ||||||
|  |                         android:layout_gravity="right" | ||||||
|  |                         android:text="@string/use_own_provider" | ||||||
|  |                         android:textColor="?android:textColorSecondary" /> | ||||||
|  |                 </LinearLayout> | ||||||
|  | 
 | ||||||
|  |                 <RelativeLayout | ||||||
|  |                     android:layout_width="match_parent" | ||||||
|  |                     android:layout_height="match_parent" | ||||||
|  |                     android:layout_above="@+id/linearLayout" | ||||||
|  |                     android:layout_alignParentStart="true" | ||||||
|  |                     android:layout_alignParentLeft="true"> | ||||||
|  | 
 | ||||||
|  |                     <ImageView | ||||||
|  |                         android:layout_width="wrap_content" | ||||||
|  |                         android:layout_height="wrap_content" | ||||||
|  |                         android:layout_centerHorizontal="true" | ||||||
|  |                         android:layout_centerVertical="true" | ||||||
|  |                         android:padding="8dp" | ||||||
|  |                         android:src="@drawable/main_logo" /> | ||||||
|  |                 </RelativeLayout> | ||||||
|  | 
 | ||||||
|  |                 <TextView | ||||||
|  |                     android:layout_width="wrap_content" | ||||||
|  |                     android:layout_height="wrap_content" | ||||||
|  |                     android:layout_alignParentBottom="true" | ||||||
|  |                     android:layout_centerHorizontal="true" | ||||||
|  |                     android:maxLines="1" | ||||||
|  |                     android:paddingLeft="8dp" | ||||||
|  |                     android:paddingRight="8dp" | ||||||
|  |                     android:text="@string/free_for_six_month" | ||||||
|  |                     android:textColor="?android:attr/textColorSecondary" | ||||||
|  |                     android:textSize="@dimen/fineprint_size" /> | ||||||
|  |             </RelativeLayout> | ||||||
|  |         </ScrollView> | ||||||
|  |     </LinearLayout> | ||||||
|  | </layout> | ||||||
							
								
								
									
										91
									
								
								src/conversations/res/layout/activity_welcome.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										91
									
								
								src/conversations/res/layout/activity_welcome.xml
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,91 @@ | |||||||
|  | <?xml version="1.0" encoding="utf-8"?> | ||||||
|  | <layout xmlns:android="http://schemas.android.com/apk/res/android"> | ||||||
|  | 
 | ||||||
|  |     <LinearLayout | ||||||
|  |         android:layout_width="match_parent" | ||||||
|  |         android:layout_height="match_parent" | ||||||
|  |         android:orientation="vertical"> | ||||||
|  | 
 | ||||||
|  |         <include | ||||||
|  |             android:id="@+id/toolbar" | ||||||
|  |             layout="@layout/toolbar" /> | ||||||
|  | 
 | ||||||
|  |         <ScrollView | ||||||
|  |             android:layout_width="match_parent" | ||||||
|  |             android:layout_height="match_parent" | ||||||
|  |             android:fillViewport="true"> | ||||||
|  | 
 | ||||||
|  |             <RelativeLayout | ||||||
|  |                 android:layout_width="match_parent" | ||||||
|  |                 android:layout_height="wrap_content" | ||||||
|  |                 android:background="?attr/color_background_primary"> | ||||||
|  | 
 | ||||||
|  |                 <LinearLayout | ||||||
|  |                     android:id="@+id/linearLayout" | ||||||
|  |                     android:layout_width="match_parent" | ||||||
|  |                     android:layout_height="wrap_content" | ||||||
|  |                     android:layout_alignParentStart="true" | ||||||
|  |                     android:layout_alignParentLeft="true" | ||||||
|  |                     android:layout_alignParentBottom="true" | ||||||
|  |                     android:minHeight="256dp" | ||||||
|  |                     android:orientation="vertical" | ||||||
|  |                     android:paddingLeft="16dp" | ||||||
|  |                     android:paddingRight="16dp" | ||||||
|  |                     android:paddingBottom="10dp"> | ||||||
|  | 
 | ||||||
|  |                     <Space | ||||||
|  |                         android:layout_width="match_parent" | ||||||
|  |                         android:layout_height="0dp" | ||||||
|  |                         android:layout_weight="1" /> | ||||||
|  | 
 | ||||||
|  |                     <TextView | ||||||
|  |                         android:layout_width="wrap_content" | ||||||
|  |                         android:layout_height="wrap_content" | ||||||
|  |                         android:text="@string/welcome_header" | ||||||
|  |                         android:textAppearance="@style/TextAppearance.Conversations.Title" /> | ||||||
|  | 
 | ||||||
|  |                     <TextView | ||||||
|  |                         android:layout_width="wrap_content" | ||||||
|  |                         android:layout_height="wrap_content" | ||||||
|  |                         android:layout_marginTop="8dp" | ||||||
|  |                         android:text="@string/welcome_text" | ||||||
|  |                         android:textAppearance="@style/TextAppearance.Conversations.Body1" /> | ||||||
|  | 
 | ||||||
|  |                     <Button | ||||||
|  |                         android:id="@+id/register_new_account" | ||||||
|  |                         style="@style/Widget.Conversations.Button.Borderless" | ||||||
|  |                         android:layout_width="wrap_content" | ||||||
|  |                         android:layout_height="wrap_content" | ||||||
|  |                         android:layout_gravity="right" | ||||||
|  |                         android:text="@string/create_new_account" | ||||||
|  |                         android:textColor="?colorAccent" /> | ||||||
|  | 
 | ||||||
|  |                     <Button | ||||||
|  |                         android:id="@+id/use_existing" | ||||||
|  |                         style="@style/Widget.Conversations.Button.Borderless" | ||||||
|  |                         android:layout_width="wrap_content" | ||||||
|  |                         android:layout_height="wrap_content" | ||||||
|  |                         android:layout_gravity="right" | ||||||
|  |                         android:text="@string/i_already_have_an_account" | ||||||
|  |                         android:textColor="?android:textColorSecondary" /> | ||||||
|  |                 </LinearLayout> | ||||||
|  | 
 | ||||||
|  |                 <RelativeLayout | ||||||
|  |                     android:layout_width="match_parent" | ||||||
|  |                     android:layout_height="match_parent" | ||||||
|  |                     android:layout_above="@+id/linearLayout" | ||||||
|  |                     android:layout_alignParentStart="true" | ||||||
|  |                     android:layout_alignParentLeft="true"> | ||||||
|  | 
 | ||||||
|  |                     <ImageView | ||||||
|  |                         android:layout_width="wrap_content" | ||||||
|  |                         android:layout_height="wrap_content" | ||||||
|  |                         android:layout_centerHorizontal="true" | ||||||
|  |                         android:layout_centerVertical="true" | ||||||
|  |                         android:padding="8dp" | ||||||
|  |                         android:src="@drawable/main_logo" /> | ||||||
|  |                 </RelativeLayout> | ||||||
|  |             </RelativeLayout> | ||||||
|  |         </ScrollView> | ||||||
|  |     </LinearLayout> | ||||||
|  | </layout> | ||||||
| @ -1,89 +0,0 @@ | |||||||
| <?xml version="1.0" encoding="utf-8"?> |  | ||||||
| <LinearLayout |  | ||||||
|     xmlns:android="http://schemas.android.com/apk/res/android" |  | ||||||
|     android:layout_width="match_parent" |  | ||||||
|     android:layout_height="match_parent" |  | ||||||
|     android:orientation="vertical"> |  | ||||||
| 
 |  | ||||||
|     <include layout="@layout/toolbar" /> |  | ||||||
| 
 |  | ||||||
|     <ScrollView android:layout_width="match_parent" |  | ||||||
|         android:layout_height="match_parent" |  | ||||||
|         android:fillViewport="true"> |  | ||||||
|         <RelativeLayout |  | ||||||
|             android:layout_width="match_parent" |  | ||||||
|             android:layout_height="match_parent" |  | ||||||
|             android:background="?attr/color_background_primary"> |  | ||||||
| 
 |  | ||||||
|             <LinearLayout |  | ||||||
|                 android:id="@+id/linearLayout" |  | ||||||
|                 android:layout_width="match_parent" |  | ||||||
|                 android:layout_height="wrap_content" |  | ||||||
|                 android:layout_alignParentBottom="true" |  | ||||||
|                 android:layout_alignParentLeft="true" |  | ||||||
|                 android:layout_alignParentStart="true" |  | ||||||
|                 android:minHeight="256dp" |  | ||||||
|                 android:orientation="vertical" |  | ||||||
|                 android:paddingBottom="10dp" |  | ||||||
|                 android:paddingLeft="16dp" |  | ||||||
|                 android:paddingRight="16dp"> |  | ||||||
|                 <Space |  | ||||||
|                     android:layout_width="match_parent" |  | ||||||
|                     android:layout_height="0dp" |  | ||||||
|                     android:layout_weight="1"/> |  | ||||||
|                 <TextView |  | ||||||
|                     android:layout_width="wrap_content" |  | ||||||
|                     android:layout_height="wrap_content" |  | ||||||
|                     android:text="@string/welcome_header" |  | ||||||
|                     android:textAppearance="@style/TextAppearance.Conversations.Title"/> |  | ||||||
|                 <TextView |  | ||||||
|                     android:layout_width="wrap_content" |  | ||||||
|                     android:layout_height="wrap_content" |  | ||||||
|                     android:layout_marginTop="8dp" |  | ||||||
|                     android:text="@string/welcome_text" |  | ||||||
|                     android:textAppearance="@style/TextAppearance.Conversations.Body1"/> |  | ||||||
|                 <Button |  | ||||||
|                     android:id="@+id/create_account" |  | ||||||
|                     style="@style/Widget.Conversations.Button.Borderless" |  | ||||||
|                     android:layout_width="wrap_content" |  | ||||||
|                     android:layout_height="wrap_content" |  | ||||||
|                     android:layout_gravity="right" |  | ||||||
|                     android:text="@string/create_account" |  | ||||||
|                     android:textColor="?colorAccent"/> |  | ||||||
|                 <Button |  | ||||||
|                     android:id="@+id/use_own_provider" |  | ||||||
|                     style="@style/Widget.Conversations.Button.Borderless" |  | ||||||
|                     android:layout_width="wrap_content" |  | ||||||
|                     android:layout_height="wrap_content" |  | ||||||
|                     android:layout_gravity="right" |  | ||||||
|                     android:text="@string/use_own_provider" |  | ||||||
|                     android:textColor="?android:textColorSecondary"/> |  | ||||||
|             </LinearLayout> |  | ||||||
|             <RelativeLayout |  | ||||||
|                 android:layout_width="match_parent" |  | ||||||
|                 android:layout_height="match_parent" |  | ||||||
|                 android:layout_above="@+id/linearLayout" |  | ||||||
|                 android:layout_alignParentLeft="true" |  | ||||||
|                 android:layout_alignParentStart="true"> |  | ||||||
|                 <ImageView |  | ||||||
|                     android:layout_width="wrap_content" |  | ||||||
|                     android:layout_height="wrap_content" |  | ||||||
|                     android:layout_centerHorizontal="true" |  | ||||||
|                     android:layout_centerVertical="true" |  | ||||||
|                     android:padding="8dp" |  | ||||||
|                     android:src="@drawable/main_logo"/> |  | ||||||
|             </RelativeLayout> |  | ||||||
|             <TextView |  | ||||||
|                 android:paddingLeft="8dp" |  | ||||||
|                 android:paddingRight="8dp" |  | ||||||
|                 android:layout_width="wrap_content" |  | ||||||
|                 android:layout_height="wrap_content" |  | ||||||
|                 android:layout_alignParentBottom="true" |  | ||||||
|                 android:textColor="?android:attr/textColorSecondary" |  | ||||||
|                 android:textSize="@dimen/fineprint_size" |  | ||||||
|                 android:maxLines="1" |  | ||||||
|                 android:text="@string/free_for_six_month" |  | ||||||
|                 android:layout_centerHorizontal="true"/> |  | ||||||
|         </RelativeLayout> |  | ||||||
|     </ScrollView> |  | ||||||
| </LinearLayout> |  | ||||||
							
								
								
									
										9
									
								
								src/conversations/res/values/strings.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								src/conversations/res/values/strings.xml
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,9 @@ | |||||||
|  | <?xml version="1.0" encoding="utf-8"?> | ||||||
|  | <resources> | ||||||
|  |     <string name="pick_a_server">Pick your XMPP provider</string> | ||||||
|  |     <string name="use_conversations.im">Use conversations.im</string> | ||||||
|  |     <string name="create_new_account">Create new account</string> | ||||||
|  |     <string name="welcome_text">Do you already have an XMPP account? This might be the case if you are already using a different XMPP client or have used Conversations before. If not you can create a new XMPP account right now.\nHint: Some email providers also provide XMPP accounts.</string> | ||||||
|  |     <string name="server_select_text">XMPP is a provider independent instant messaging network. You can use this client with what ever XMPP server you choose.\nHowever for your convenience we made it easy to create an account on conversations.im¹; a provider specially suited for the use with Conversations.</string> | ||||||
|  | 
 | ||||||
|  | </resources> | ||||||
| @ -83,6 +83,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat | |||||||
|         OnKeyStatusUpdated, OnCaptchaRequested, KeyChainAliasCallback, XmppConnectionService.OnShowErrorToast, XmppConnectionService.OnMamPreferencesFetched { |         OnKeyStatusUpdated, OnCaptchaRequested, KeyChainAliasCallback, XmppConnectionService.OnShowErrorToast, XmppConnectionService.OnMamPreferencesFetched { | ||||||
| 
 | 
 | ||||||
|     public static final String EXTRA_OPENED_FROM_NOTIFICATION = "opened_from_notification"; |     public static final String EXTRA_OPENED_FROM_NOTIFICATION = "opened_from_notification"; | ||||||
|  |     public static final String EXTRA_FORCE_REGISTER = "force_register"; | ||||||
| 
 | 
 | ||||||
|     private static final int REQUEST_DATA_SAVER = 0xf244; |     private static final int REQUEST_DATA_SAVER = 0xf244; | ||||||
|     private static final int REQUEST_CHANGE_STATUS = 0xee11; |     private static final int REQUEST_CHANGE_STATUS = 0xee11; | ||||||
| @ -92,6 +93,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat | |||||||
|     private AlertDialog mCaptchaDialog = null; |     private AlertDialog mCaptchaDialog = null; | ||||||
|     private Jid jidToEdit; |     private Jid jidToEdit; | ||||||
|     private boolean mInitMode = false; |     private boolean mInitMode = false; | ||||||
|  |     private Boolean mForceRegister = null; | ||||||
|     private boolean mUsernameMode = Config.DOMAIN_LOCK != null; |     private boolean mUsernameMode = Config.DOMAIN_LOCK != null; | ||||||
|     private boolean mShowOptions = false; |     private boolean mShowOptions = false; | ||||||
|     private Account mAccount; |     private Account mAccount; | ||||||
| @ -152,7 +154,12 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat | |||||||
|                 } |                 } | ||||||
|                 return; |                 return; | ||||||
|             } |             } | ||||||
|             final boolean registerNewAccount = binding.accountRegisterNew.isChecked() && !Config.DISALLOW_REGISTRATION_IN_UI; |             final boolean registerNewAccount; | ||||||
|  |             if (mForceRegister != null) { | ||||||
|  |                 registerNewAccount = mForceRegister; | ||||||
|  |             } else { | ||||||
|  |                 registerNewAccount = binding.accountRegisterNew.isChecked() && !Config.DISALLOW_REGISTRATION_IN_UI; | ||||||
|  |             } | ||||||
|             if (mUsernameMode && binding.accountJid.getText().toString().contains("@")) { |             if (mUsernameMode && binding.accountJid.getText().toString().contains("@")) { | ||||||
|                 binding.accountJidLayout.setError(getString(R.string.invalid_username)); |                 binding.accountJidLayout.setError(getString(R.string.invalid_username)); | ||||||
|                 removeErrorsOnAllBut(binding.accountJidLayout); |                 removeErrorsOnAllBut(binding.accountJidLayout); | ||||||
| @ -395,7 +402,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat | |||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         if (xmppConnectionService.getAccounts().size() == 0 && Config.MAGIC_CREATE_DOMAIN != null) { |         if (xmppConnectionService.getAccounts().size() == 0 && Config.MAGIC_CREATE_DOMAIN != null) { | ||||||
|             Intent intent = SignupUtils.getSignUpIntent(this); |             Intent intent = SignupUtils.getSignUpIntent(this, mForceRegister != null && mForceRegister); | ||||||
|             startActivity(intent); |             startActivity(intent); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| @ -676,6 +683,9 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat | |||||||
|             } |             } | ||||||
|             boolean init = intent.getBooleanExtra("init", false); |             boolean init = intent.getBooleanExtra("init", false); | ||||||
|             boolean openedFromNotification = intent.getBooleanExtra(EXTRA_OPENED_FROM_NOTIFICATION, false); |             boolean openedFromNotification = intent.getBooleanExtra(EXTRA_OPENED_FROM_NOTIFICATION, false); | ||||||
|  |             Log.d(Config.LOGTAG,"extras "+intent.getExtras()); | ||||||
|  |             this.mForceRegister = intent.hasExtra(EXTRA_FORCE_REGISTER) ? intent.getBooleanExtra(EXTRA_FORCE_REGISTER,false) : null; | ||||||
|  |             Log.d(Config.LOGTAG,"force register="+mForceRegister); | ||||||
|             this.mInitMode = init || this.jidToEdit == null; |             this.mInitMode = init || this.jidToEdit == null; | ||||||
|             this.messageFingerprint = intent.getStringExtra("fingerprint"); |             this.messageFingerprint = intent.getStringExtra("fingerprint"); | ||||||
|             if (!mInitMode) { |             if (!mInitMode) { | ||||||
| @ -685,13 +695,24 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat | |||||||
|             } else { |             } else { | ||||||
|                 this.binding.avater.setVisibility(View.GONE); |                 this.binding.avater.setVisibility(View.GONE); | ||||||
|                 configureActionBar(getSupportActionBar(), !(init && Config.MAGIC_CREATE_DOMAIN == null)); |                 configureActionBar(getSupportActionBar(), !(init && Config.MAGIC_CREATE_DOMAIN == null)); | ||||||
|                 setTitle(R.string.action_add_account); |                 if (mForceRegister != null) { | ||||||
|  |                     if (mForceRegister) { | ||||||
|  |                         setTitle(R.string.register_new_account); | ||||||
|  |                     } else { | ||||||
|  |                         setTitle(R.string.add_existing_account); | ||||||
|  |                     } | ||||||
|  |                 } else { | ||||||
|  |                     setTitle(R.string.action_add_account); | ||||||
|  |                 } | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|         SharedPreferences preferences = getPreferences(); |         SharedPreferences preferences = getPreferences(); | ||||||
|         mUseTor = QuickConversationsService.isConversations() && preferences.getBoolean("use_tor", getResources().getBoolean(R.bool.use_tor)); |         mUseTor = QuickConversationsService.isConversations() && preferences.getBoolean("use_tor", getResources().getBoolean(R.bool.use_tor)); | ||||||
|         this.mShowOptions = mUseTor || (QuickConversationsService.isConversations() && preferences.getBoolean("show_connection_options", getResources().getBoolean(R.bool.show_connection_options))); |         this.mShowOptions = mUseTor || (QuickConversationsService.isConversations() && preferences.getBoolean("show_connection_options", getResources().getBoolean(R.bool.show_connection_options))); | ||||||
|         this.binding.namePort.setVisibility(mShowOptions ? View.VISIBLE : View.GONE); |         this.binding.namePort.setVisibility(mShowOptions ? View.VISIBLE : View.GONE); | ||||||
|  |         if (mForceRegister != null) { | ||||||
|  |             this.binding.accountRegisterNew.setVisibility(View.GONE); | ||||||
|  |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     @Override |     @Override | ||||||
| @ -967,7 +988,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat | |||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|             this.binding.accountRegisterNew.setVisibility(View.GONE); |             this.binding.accountRegisterNew.setVisibility(View.GONE); | ||||||
|         } else if (this.mAccount.isOptionSet(Account.OPTION_REGISTER)) { |         } else if (this.mAccount.isOptionSet(Account.OPTION_REGISTER) && mForceRegister == null) { | ||||||
|             this.binding.accountRegisterNew.setVisibility(View.VISIBLE); |             this.binding.accountRegisterNew.setVisibility(View.VISIBLE); | ||||||
|         } else { |         } else { | ||||||
|             this.binding.accountRegisterNew.setVisibility(View.GONE); |             this.binding.accountRegisterNew.setVisibility(View.GONE); | ||||||
|  | |||||||
| @ -527,7 +527,6 @@ | |||||||
|     <string name="no_application_to_share_uri">No application found to share URI</string> |     <string name="no_application_to_share_uri">No application found to share URI</string> | ||||||
|     <string name="share_uri_with">Share URI with…</string> |     <string name="share_uri_with">Share URI with…</string> | ||||||
|     <string name="welcome_header" translatable="false">Join the Conversation</string> |     <string name="welcome_header" translatable="false">Join the Conversation</string> | ||||||
|     <string name="welcome_text">XMPP is a provider independent instant messaging network. You can use this client with what ever XMPP server you choose.\nHowever for your convenience we made it easy to create an account on conversations.im¹; a provider specially suited for the use with Conversations.</string> |  | ||||||
|     <string name="welcome_header_quicksy" translatable="false">Have some Quick Conversations</string> |     <string name="welcome_header_quicksy" translatable="false">Have some Quick Conversations</string> | ||||||
|     <string name="welcome_text_quicksy"><![CDATA[Quicksy is a spin off of the popular XMPP client Conversations with automatic contact discovery.<br><br>You sign up with your phone number and Quicksy will automatically—based on the phone numbers in your address book—suggest possible contacts to you.<br><br>By signing up you agree to our <a href="https://quicksy.im/#privacy">privacy policy</a>.]]></string> |     <string name="welcome_text_quicksy"><![CDATA[Quicksy is a spin off of the popular XMPP client Conversations with automatic contact discovery.<br><br>You sign up with your phone number and Quicksy will automatically—based on the phone numbers in your address book—suggest possible contacts to you.<br><br>By signing up you agree to our <a href="https://quicksy.im/#privacy">privacy policy</a>.]]></string> | ||||||
|     <string name="agree_and_continue">Agree & continue</string> |     <string name="agree_and_continue">Agree & continue</string> | ||||||
| @ -861,4 +860,7 @@ | |||||||
|     <string name="search_channels">Search channels</string> |     <string name="search_channels">Search channels</string> | ||||||
|     <string name="channel_discovery_opt_in_title">Possible privacy violation!</string> |     <string name="channel_discovery_opt_in_title">Possible privacy violation!</string> | ||||||
|     <string name="channel_discover_opt_in_message"><![CDATA[Channel discovery uses a third party service called <a href="https://search.jabbercat.org">search.jabbercat.org</a>.<br><br>Using this feature will transmit your IP address and search terms to that service. See their <a href="https://search.jabbercat.org/privacy">Privacy Policy</a> for more information.]]></string> |     <string name="channel_discover_opt_in_message"><![CDATA[Channel discovery uses a third party service called <a href="https://search.jabbercat.org">search.jabbercat.org</a>.<br><br>Using this feature will transmit your IP address and search terms to that service. See their <a href="https://search.jabbercat.org/privacy">Privacy Policy</a> for more information.]]></string> | ||||||
|  |     <string name="i_already_have_an_account">I already have an account</string> | ||||||
|  |     <string name="add_existing_account">Add existing account</string> | ||||||
|  |     <string name="register_new_account">Register new account</string> | ||||||
| </resources> | </resources> | ||||||
|  | |||||||
| @ -16,9 +16,12 @@ import eu.siacs.conversations.ui.VerifyActivity; | |||||||
| 
 | 
 | ||||||
| public class SignupUtils { | public class SignupUtils { | ||||||
| 
 | 
 | ||||||
|  |     public static Intent getSignUpIntent(Activity activity, boolean ignored) { | ||||||
|  |         return getSignUpIntent(activity); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     public static Intent getSignUpIntent(Activity activity) { |     public static Intent getSignUpIntent(Activity activity) { | ||||||
|         final Intent intent = new Intent(activity, EnterPhoneNumberActivity.class); |         return new Intent(activity, EnterPhoneNumberActivity.class); | ||||||
|         return intent; |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     public static Intent getRedirectionIntent(ConversationsActivity activity) { |     public static Intent getRedirectionIntent(ConversationsActivity activity) { | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Daniel Gultsch
						Daniel Gultsch