ui: refresh account creation
Issue: #78218
Change-Id: Ib99d63534ed679af192300b5e949ccedaa923a1d
diff --git a/ring-android/app/app.iml b/ring-android/app/app.iml
index 3502718..279e649 100644
--- a/ring-android/app/app.iml
+++ b/ring-android/app/app.iml
@@ -70,6 +70,7 @@
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex-cache" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/appcompat-v7/23.0.1/jars" />
+ <excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/cardview-v7/23.0.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/design/23.0.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-v13/23.0.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-v4/23.0.1/jars" />
@@ -92,12 +93,13 @@
</content>
<orderEntry type="jdk" jdkName="Android API 23 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
- <orderEntry type="library" exported="" name="ormlite-android-4.48" level="project" />
<orderEntry type="library" exported="" name="libphonenumber-7.0.11" level="project" />
+ <orderEntry type="library" exported="" name="ormlite-android-4.48" level="project" />
<orderEntry type="library" exported="" name="pagerslidingtabstrip-1.0.1" level="project" />
<orderEntry type="library" exported="" name="ormlite-core-4.48" level="project" />
<orderEntry type="library" exported="" name="support-v13-23.0.1" level="project" />
<orderEntry type="library" exported="" name="stickylistheaders-2.7.0" level="project" />
+ <orderEntry type="library" exported="" name="cardview-v7-23.0.1" level="project" />
<orderEntry type="library" exported="" name="support-v4-23.0.1" level="project" />
<orderEntry type="library" exported="" name="robotium-solo-5.4.1" level="project" />
<orderEntry type="library" exported="" name="design-23.0.1" level="project" />
diff --git a/ring-android/app/build.gradle b/ring-android/app/build.gradle
index 2ca1c19..cf33e4a 100644
--- a/ring-android/app/build.gradle
+++ b/ring-android/app/build.gradle
@@ -6,6 +6,7 @@
compile 'com.j256.ormlite:ormlite-android:4.48'
compile 'com.android.support:support-v13:23.0.+'
compile 'com.android.support:design:23.0.+'
+ compile 'com.android.support:cardview-v7:23.0.+'
compile 'com.jayway.android.robotium:robotium-solo:5.4.1'
compile 'com.astuetz:pagerslidingtabstrip:1.0.1'
compile 'com.googlecode.libphonenumber:libphonenumber:7.0.11'
diff --git a/ring-android/app/src/main/AndroidManifest.xml b/ring-android/app/src/main/AndroidManifest.xml
index 999fbc0..4ba66eb 100644
--- a/ring-android/app/src/main/AndroidManifest.xml
+++ b/ring-android/app/src/main/AndroidManifest.xml
@@ -105,7 +105,7 @@
<activity
android:name=".client.AccountWizard"
android:screenOrientation="portrait"
- android:theme="@style/AppThemeWithoutOverlay" >
+ android:theme="@style/AppThemeWithoutOverlayCompat" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="cx.ring.client.AccountEditionActivity" />
diff --git a/ring-android/app/src/main/java/cx/ring/client/AccountWizard.java b/ring-android/app/src/main/java/cx/ring/client/AccountWizard.java
index 43cd2ba..931f47b 100644
--- a/ring-android/app/src/main/java/cx/ring/client/AccountWizard.java
+++ b/ring-android/app/src/main/java/cx/ring/client/AccountWizard.java
@@ -1,7 +1,8 @@
/*
- * Copyright (C) 2004-2014 Savoir-Faire Linux Inc.
+ * Copyright (C) 2004-2015 Savoir-Faire Linux Inc.
*
* Author: Alexandre Lision <alexandre.lision@savoirfairelinux.com>
+ * Author: Adrien Béraud <adrien.beraud@savoirfairelinux.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -16,22 +17,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * Additional permission under GNU GPL version 3 section 7:
- *
- * If you modify this program, or any covered work, by linking or
- * combining it with the OpenSSL project's OpenSSL library (or a
- * modified version of that library), containing parts covered by the
- * terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc.
- * grants you additional permission to convey the resulting work.
- * Corresponding Source for a non-source form of such a combination
- * shall include the source code for the parts of OpenSSL used as well
- * as that of the covered work.
*/
package cx.ring.client;
-import android.app.Activity;
import android.app.Fragment;
import android.app.FragmentManager;
import android.content.ComponentName;
@@ -42,27 +31,28 @@
import android.os.IBinder;
import android.support.v13.app.FragmentStatePagerAdapter;
import android.support.v4.view.ViewPager;
+import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.MenuItem;
import cx.ring.R;
import cx.ring.fragments.AccountCreationFragment;
import cx.ring.service.ISipService;
-import cx.ring.service.SipService;
+import cx.ring.service.LocalService;
import java.util.ArrayList;
import java.util.Locale;
-public class AccountWizard extends Activity implements AccountCreationFragment.Callbacks {
+public class AccountWizard extends AppCompatActivity implements LocalService.Callbacks {
static final String TAG = "AccountWizard";
private boolean mBound = false;
- private ISipService service;
+ private LocalService service;
ViewPager mViewPager;
private ServiceConnection mConnection = new ServiceConnection() {
@Override
public void onServiceConnected(ComponentName className, IBinder binder) {
- service = ISipService.Stub.asInterface(binder);
+ service = ((LocalService.LocalBinder) binder).getService();
mBound = true;
}
@@ -79,14 +69,14 @@
setContentView(R.layout.activity_wizard);
mViewPager = (ViewPager) findViewById(R.id.pager);
- getActionBar().setDisplayHomeAsUpEnabled(true);
- getActionBar().setHomeButtonEnabled(true);
+ getSupportActionBar().setDisplayHomeAsUpEnabled(true);
+ getSupportActionBar().setHomeButtonEnabled(true);
SectionsPagerAdapter mSectionsPagerAdapter = new SectionsPagerAdapter(AccountWizard.this, getFragmentManager());
mViewPager.setAdapter(mSectionsPagerAdapter);
if (!mBound) {
Log.i(TAG, "onCreate: Binding service...");
- Intent intent = new Intent(this, SipService.class);
+ Intent intent = new Intent(this, LocalService.class);
bindService(intent, mConnection, Context.BIND_AUTO_CREATE);
}
@@ -168,7 +158,12 @@
}
@Override
- public ISipService getService() {
+ public ISipService getRemoteService() {
+ return service.getRemoteService();
+ }
+
+ @Override
+ public LocalService getService() {
return service;
}
diff --git a/ring-android/app/src/main/java/cx/ring/client/HomeActivity.java b/ring-android/app/src/main/java/cx/ring/client/HomeActivity.java
index fcbabd3..ffd2c5c 100644
--- a/ring-android/app/src/main/java/cx/ring/client/HomeActivity.java
+++ b/ring-android/app/src/main/java/cx/ring/client/HomeActivity.java
@@ -59,10 +59,12 @@
import android.app.FragmentManager;
import android.app.FragmentTransaction;
+import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
+import android.content.IntentFilter;
import android.content.ServiceConnection;
import android.content.pm.PackageManager;
import android.content.res.AssetManager;
@@ -96,6 +98,7 @@
private LocalService service;
private boolean mBound = false;
+ private boolean mNoAccountOpened = false;
private NavigationView fMenu;
private MenuFragment fMenuHead = null;
@@ -136,6 +139,12 @@
setContentView(R.layout.activity_home);
// Bind to LocalService
+
+ IntentFilter intentFilter = new IntentFilter();
+ intentFilter.addAction(LocalService.ACTION_CONF_UPDATE);
+ intentFilter.addAction(LocalService.ACTION_ACCOUNT_UPDATE);
+ registerReceiver(receiver, intentFilter);
+
if (!mBound && LocalService.checkContactPermissions(this)) {
Log.i(TAG, "onStart: Binding service...");
/*Intent intent = new Intent(this, SipService.class);
@@ -177,6 +186,21 @@
}
+ final BroadcastReceiver receiver = new BroadcastReceiver() {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ Log.w(TAG, "onReceive " + intent.getAction());
+ switch (intent.getAction()) {
+ case LocalService.ACTION_ACCOUNT_UPDATE:
+ if (!mNoAccountOpened && service.getAccounts().isEmpty()) {
+ mNoAccountOpened = true;
+ startActivityForResult(new Intent().setClass(HomeActivity.this, AccountWizard.class), AccountsManagementFragment.ACCOUNT_CREATE_REQUEST);
+ }
+ break;
+ }
+ }
+ };
+
@Override
protected void onPostCreate(Bundle savedInstanceState) {
super.onPostCreate(savedInstanceState);
@@ -346,6 +370,7 @@
@Override
protected void onDestroy() {
super.onDestroy();
+ unregisterReceiver(receiver);
if (mBound) {
unbindService(mConnection);
mBound = false;
@@ -378,7 +403,6 @@
LocalService.LocalBinder binder = (LocalService.LocalBinder) s;
service = binder.getService();
- //service = ISipService.Stub.asInterface(binder);
fContent = new CallListFragment();
if (fMenuHead != null)
fMenu.removeHeaderView(fMenuHead.getView());
diff --git a/ring-android/app/src/main/java/cx/ring/fragments/AccountCreationFragment.java b/ring-android/app/src/main/java/cx/ring/fragments/AccountCreationFragment.java
index 14c5d09..2419666 100644
--- a/ring-android/app/src/main/java/cx/ring/fragments/AccountCreationFragment.java
+++ b/ring-android/app/src/main/java/cx/ring/fragments/AccountCreationFragment.java
@@ -1,3 +1,23 @@
+/*
+ * Copyright (C) 2004-2015 Savoir-Faire Linux Inc.
+ *
+ * Author: Adrien Béraud <adrien.beraud@savoirfairelinux.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
package cx.ring.fragments;
import java.util.HashMap;
@@ -14,6 +34,7 @@
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.RemoteException;
+import android.support.v7.app.AppCompatActivity;
import android.text.TextUtils;
import android.view.KeyEvent;
import android.view.LayoutInflater;
@@ -26,6 +47,7 @@
import android.widget.TextView.OnEditorActionListener;
import android.widget.Toast;
+import cx.ring.service.LocalService;
import cx.ring.views.PasswordEditText;
public class AccountCreationFragment extends Fragment {
@@ -43,24 +65,8 @@
private EditText mHostnameView;
private EditText mUsernameView;
private PasswordEditText mPasswordView;
- private Spinner mAccountTypeView;
- private ViewGroup mFieldsSip;
- private ViewGroup mFieldsRing;
- private Callbacks mCallbacks = sDummyCallbacks;
- private static Callbacks sDummyCallbacks = new Callbacks() {
-
- @Override
- public ISipService getService() {
- return null;
- }
- };
-
- public interface Callbacks {
-
- public ISipService getService();
-
- }
+ private LocalService.Callbacks mCallbacks = LocalService.DUMMY_CALLBACKS;
@Override
public void onCreate(Bundle savedInstanceState) {
@@ -71,62 +77,39 @@
public View onCreateView(LayoutInflater inflater, ViewGroup parent, Bundle savedInstanceState) {
View inflatedView = inflater.inflate(R.layout.frag_account_creation, parent, false);
- mFieldsSip = (ViewGroup) inflatedView.findViewById(R.id.sip_fields);
- mFieldsRing = (ViewGroup) inflatedView.findViewById(R.id.ring_fields);
-
mAliasView = (EditText) inflatedView.findViewById(R.id.alias);
mHostnameView = (EditText) inflatedView.findViewById(R.id.hostname);
mUsernameView = (EditText) inflatedView.findViewById(R.id.username);
mPasswordView = (PasswordEditText) inflatedView.findViewById(R.id.password);
- mAccountTypeView = (Spinner) inflatedView.findViewById(R.id.account_type);
- mAccountTypeView.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
- @Override
- public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
- if (parent.getSelectedItem().toString().equals("RING")) {
- mFieldsSip.setVisibility(View.GONE);
- mFieldsRing.setVisibility(View.VISIBLE);
- } else {
- mFieldsSip.setVisibility(View.VISIBLE);
- mFieldsRing.setVisibility(View.GONE);
- }
- }
- public void onNothingSelected(AdapterView<?> parent) {
- }
- });
mPasswordView.getEdit_text().setOnEditorActionListener(new OnEditorActionListener() {
-
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
- mAccountType = mAccountTypeView.getSelectedItem().toString();
- // if(actionId == EditorInfo.IME_ACTION_GO || event.getAction() == KeyEvent.KEYCODE_ENTER){
- if (mAccountType.equals("RING")) {
- initCreation();
- } else {
- mAlias = mAliasView.getText().toString();
- mHostname = mHostnameView.getText().toString();
- mUsername = mUsernameView.getText().toString();
- mPassword = mPasswordView.getText().toString();
- attemptCreation();
- }
- // }
-
+ mAccountType = "SIP";
+ mAlias = mAliasView.getText().toString();
+ mHostname = mHostnameView.getText().toString();
+ mUsername = mUsernameView.getText().toString();
+ mPassword = mPasswordView.getText().toString();
+ attemptCreation();
return true;
}
});
- inflatedView.findViewById(R.id.create_button).setOnClickListener(new View.OnClickListener() {
+ inflatedView.findViewById(R.id.create_ring_account).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
- mAccountType = mAccountTypeView.getSelectedItem().toString();
- if (mAccountType.equals("RING")) {
- initCreation();
- } else {
- mAlias = mAliasView.getText().toString();
- mHostname = mHostnameView.getText().toString();
- mUsername = mUsernameView.getText().toString();
- mPassword = mPasswordView.getText().toString();
- attemptCreation();
- }
+ mAccountType = "RING";
+ initCreation();
+ }
+ });
+ inflatedView.findViewById(R.id.create_sip_button).setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ mAccountType = "SIP";
+ mAlias = mAliasView.getText().toString();
+ mHostname = mHostnameView.getText().toString();
+ mUsername = mUsernameView.getText().toString();
+ mPassword = mPasswordView.getText().toString();
+ attemptCreation();
}
});
@@ -141,17 +124,17 @@
@Override
public void onStart() {
super.onStart();
-
+ ((AppCompatActivity)getActivity()).getSupportActionBar().setTitle(R.string.ab_account_creation);
}
@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
- if (!(activity instanceof Callbacks)) {
+ if (!(activity instanceof LocalService.Callbacks)) {
throw new IllegalStateException("Activity must implement fragment's callbacks.");
}
- mCallbacks = (Callbacks) activity;
+ mCallbacks = (LocalService.Callbacks) activity;
}
/**
@@ -212,7 +195,7 @@
try {
- HashMap<String, String> accountDetails = (HashMap<String, String>) mCallbacks.getService().getAccountTemplate(mAccountType);
+ HashMap<String, String> accountDetails = (HashMap<String, String>) mCallbacks.getRemoteService().getAccountTemplate(mAccountType);
accountDetails.put(AccountDetailBasic.CONFIG_ACCOUNT_TYPE, mAccountType);
if (mAccountType.equals("RING")) {
accountDetails.put(AccountDetailBasic.CONFIG_ACCOUNT_ALIAS, "Ring");
@@ -251,7 +234,7 @@
@Override
protected String doInBackground(HashMap<String, String>... accs) {
try {
- return mCallbacks.getService().addAccount(accs[0]);
+ return mCallbacks.getRemoteService().addAccount(accs[0]);
} catch (RemoteException e) {
e.printStackTrace();
}
diff --git a/ring-android/app/src/main/java/cx/ring/fragments/MenuFragment.java b/ring-android/app/src/main/java/cx/ring/fragments/MenuFragment.java
index bec95da..808aa2c 100644
--- a/ring-android/app/src/main/java/cx/ring/fragments/MenuFragment.java
+++ b/ring-android/app/src/main/java/cx/ring/fragments/MenuFragment.java
@@ -32,13 +32,10 @@
import android.app.Activity;
import android.app.Fragment;
-import android.app.LoaderManager;
-import android.content.AsyncTaskLoader;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
-import android.content.Loader;
import android.os.Bundle;
import android.os.RemoteException;
import android.util.Log;
@@ -50,25 +47,24 @@
import cx.ring.R;
import cx.ring.adapters.AccountSelectionAdapter;
import cx.ring.adapters.ContactPictureTask;
-import cx.ring.client.HomeActivity;
-import cx.ring.loaders.AccountsLoader;
-import cx.ring.loaders.LoaderConstants;
+import cx.ring.client.AccountWizard;
import cx.ring.model.account.Account;
import cx.ring.model.CallContact;
-import cx.ring.service.ConfigurationManagerCallback;
-import cx.ring.service.ISipService;
import cx.ring.service.LocalService;
import java.util.ArrayList;
+import java.util.List;
-public class MenuFragment extends Fragment /*extends AccountWrapperFragment implements LoaderManager.LoaderCallbacks<Bundle>*/ {
+public class MenuFragment extends Fragment {
@SuppressWarnings("unused")
private static final String TAG = MenuFragment.class.getSimpleName();
AccountSelectionAdapter mAccountAdapter;
private Spinner spinnerAccounts;
- private ImageButton share_btn;
+ private ImageButton shareBtn;
+ private Button newAccountBtn;
+
private LocalService.Callbacks mCallbacks = LocalService.DUMMY_CALLBACKS;
public Account retrieveAccountById(String accountID) {
@@ -137,8 +133,17 @@
public View onCreateView(LayoutInflater inflater, ViewGroup parent, Bundle savedInstanceState) {
View inflatedView = inflater.inflate(R.layout.frag_menu_header, parent, false);
- share_btn = (ImageButton) inflatedView.findViewById(R.id.share_btn);
- share_btn.setOnClickListener(new View.OnClickListener() {
+ newAccountBtn = (Button) inflatedView.findViewById(R.id.addaccount_btn);
+ newAccountBtn.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ Intent intent = new Intent().setClass(getActivity(), AccountWizard.class);
+ startActivityForResult(intent, AccountsManagementFragment.ACCOUNT_CREATE_REQUEST);
+ }
+ });
+
+ shareBtn = (ImageButton) inflatedView.findViewById(R.id.share_btn);
+ shareBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Account acc = mAccountAdapter.getSelectedAccount();
@@ -207,43 +212,18 @@
/*if (getActivity() != null)
getLoaderManager().restartLoader(LoaderConstants.ACCOUNTS_LOADER, null, this);*/
if (mAccountAdapter != null && mCallbacks.getService() != null) {
- mAccountAdapter.replaceAll(mCallbacks.getService().getAccounts());
+ List<Account> accs = mCallbacks.getService().getAccounts();
+ if (accs.isEmpty()) {
+ newAccountBtn.setVisibility(View.VISIBLE);
+ shareBtn.setVisibility(View.GONE);
+ spinnerAccounts.setVisibility(View.GONE);
+ } else {
+ newAccountBtn.setVisibility(View.GONE);
+ shareBtn.setVisibility(View.VISIBLE);
+ spinnerAccounts.setVisibility(View.VISIBLE);
+ mAccountAdapter.replaceAll(accs);
+ }
}
}
- /*
- @Override
- public void accountsChanged() {
- updateAllAccounts();
-
- }
-
- @Override
- public void accountStateChanged(String accoundID, String State, int code) {
- Log.w(TAG, "accountStateChanged " + accoundID + " " + State);
-
- if (mAccountAdapter != null)
- mAccountAdapter.updateAccount(accoundID, State, code);
- }
-
- @Override
- public AsyncTaskLoader<Bundle> onCreateLoader(int arg0, Bundle arg1) {
- AccountsLoader l = new AccountsLoader(getActivity(), mCallbacks.getRemoteService());
- l.forceLoad();
- return l;
- }
-
- @Override
- public void onLoadFinished(Loader<Bundle> loader, Bundle data) {
- mAccountAdapter.removeAll();
- ArrayList<Account> accounts = data.getParcelableArrayList(AccountsLoader.ACCOUNTS);
- accounts.add((Account)data.getParcelable(AccountsLoader.ACCOUNT_IP2IP));
- mAccountAdapter.addAll(accounts);
- }
-
- @Override
- public void onLoaderReset(Loader<Bundle> loader) {
-
- }*/
-
}
diff --git a/ring-android/app/src/main/res/drawable-hdpi/ic_dialer_sip_black_48dp.png b/ring-android/app/src/main/res/drawable-hdpi/ic_dialer_sip_black_48dp.png
new file mode 100644
index 0000000..d911ebd
--- /dev/null
+++ b/ring-android/app/src/main/res/drawable-hdpi/ic_dialer_sip_black_48dp.png
Binary files differ
diff --git a/ring-android/app/src/main/res/drawable-hdpi/ring_logo_48dp.png b/ring-android/app/src/main/res/drawable-hdpi/ring_logo_48dp.png
new file mode 100644
index 0000000..5cebe0a
--- /dev/null
+++ b/ring-android/app/src/main/res/drawable-hdpi/ring_logo_48dp.png
Binary files differ
diff --git a/ring-android/app/src/main/res/drawable-mdpi/ic_dialer_sip_black_48dp.png b/ring-android/app/src/main/res/drawable-mdpi/ic_dialer_sip_black_48dp.png
new file mode 100644
index 0000000..44b1470
--- /dev/null
+++ b/ring-android/app/src/main/res/drawable-mdpi/ic_dialer_sip_black_48dp.png
Binary files differ
diff --git a/ring-android/app/src/main/res/drawable-mdpi/ring_logo_48dp.png b/ring-android/app/src/main/res/drawable-mdpi/ring_logo_48dp.png
new file mode 100644
index 0000000..4309716
--- /dev/null
+++ b/ring-android/app/src/main/res/drawable-mdpi/ring_logo_48dp.png
Binary files differ
diff --git a/ring-android/app/src/main/res/drawable-xhdpi/ic_dialer_sip_black_48dp.png b/ring-android/app/src/main/res/drawable-xhdpi/ic_dialer_sip_black_48dp.png
new file mode 100644
index 0000000..d458d5d
--- /dev/null
+++ b/ring-android/app/src/main/res/drawable-xhdpi/ic_dialer_sip_black_48dp.png
Binary files differ
diff --git a/ring-android/app/src/main/res/drawable-xhdpi/ring_logo_48dp.png b/ring-android/app/src/main/res/drawable-xhdpi/ring_logo_48dp.png
new file mode 100644
index 0000000..dff9241
--- /dev/null
+++ b/ring-android/app/src/main/res/drawable-xhdpi/ring_logo_48dp.png
Binary files differ
diff --git a/ring-android/app/src/main/res/drawable-xxhdpi/ic_dialer_sip_black_48dp.png b/ring-android/app/src/main/res/drawable-xxhdpi/ic_dialer_sip_black_48dp.png
new file mode 100644
index 0000000..c9342b4
--- /dev/null
+++ b/ring-android/app/src/main/res/drawable-xxhdpi/ic_dialer_sip_black_48dp.png
Binary files differ
diff --git a/ring-android/app/src/main/res/drawable-xxhdpi/ring_logo_48dp.png b/ring-android/app/src/main/res/drawable-xxhdpi/ring_logo_48dp.png
new file mode 100644
index 0000000..cc4be60
--- /dev/null
+++ b/ring-android/app/src/main/res/drawable-xxhdpi/ring_logo_48dp.png
Binary files differ
diff --git a/ring-android/app/src/main/res/drawable-xxxhdpi/ic_dialer_sip_black_48dp.png b/ring-android/app/src/main/res/drawable-xxxhdpi/ic_dialer_sip_black_48dp.png
new file mode 100644
index 0000000..aed4ee2
--- /dev/null
+++ b/ring-android/app/src/main/res/drawable-xxxhdpi/ic_dialer_sip_black_48dp.png
Binary files differ
diff --git a/ring-android/app/src/main/res/drawable-xxxhdpi/ring_logo_48dp.png b/ring-android/app/src/main/res/drawable-xxxhdpi/ring_logo_48dp.png
new file mode 100644
index 0000000..ae84b04
--- /dev/null
+++ b/ring-android/app/src/main/res/drawable-xxxhdpi/ring_logo_48dp.png
Binary files differ
diff --git a/ring-android/app/src/main/res/layout/frag_account_creation.xml b/ring-android/app/src/main/res/layout/frag_account_creation.xml
index b8af89d..86ddb81 100644
--- a/ring-android/app/src/main/res/layout/frag_account_creation.xml
+++ b/ring-android/app/src/main/res/layout/frag_account_creation.xml
@@ -1,8 +1,29 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?><!--
+Copyright (C) 2004-2015 Savoir-Faire Linux Inc.
+
+Author: Adrien Béraud <adrien.beraud@savoirfairelinux.com>
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+-->
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/login_form"
android:layout_width="match_parent"
- android:layout_height="match_parent">
+ android:layout_height="match_parent"
+ tools:context=".client.AccountWizard"
+ android:background="#eeeeee">
<LinearLayout
style="@style/AccountFormContainer"
@@ -10,42 +31,118 @@
android:descendantFocusability="beforeDescendants"
android:focusableInTouchMode="true" >
- <LinearLayout
- android:orientation="horizontal"
- android:layout_width="match_parent"
+ <android.support.v7.widget.CardView
+ xmlns:card_view="http://schemas.android.com/apk/res-auto"
+ android:id="@+id/ring_card_view"
+ android:layout_gravity="center"
+ android:layout_width="280dp"
android:layout_height="wrap_content"
- android:gravity="center_vertical">
+ card_view:cardCornerRadius="2dp"
+ android:layout_marginBottom="8dp">
- <TextView
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:textAppearance="?android:attr/textAppearanceMedium"
- android:text="@string/account_type"
- android:id="@+id/textView3"
- android:layout_marginRight="16dp" />
-
- <Spinner
- android:id="@+id/account_type"
- android:layout_width="match_parent"
- android:layout_height="52dp"
-android:minHeight="52dp"
- android:entries="@array/accountType"
- android:typeface="monospace" />
-
- </LinearLayout>
-
- <FrameLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:id="@+id/field_flipper"
- >
-
- <LinearLayout
+ <RelativeLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
+ android:id="@+id/ring_fields">
+
+ <ImageView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:id="@+id/imageView6"
+ android:layout_alignParentTop="true"
+ android:layout_alignParentRight="true"
+ android:layout_alignParentEnd="true"
+ android:src="@drawable/ring_logo_48dp"
+ android:layout_margin="16dp" />
+
+ <TextView
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/help_ring_title"
+ android:singleLine="false"
+ android:textColor="@color/text_color_primary"
+ android:textSize="24sp"
+ android:paddingLeft="16dp"
+ android:paddingTop="24dp"
+ android:paddingRight="16dp"
+ android:layout_alignParentStart="true"
+ android:layout_alignParentTop="true"
+ android:id="@+id/ring_acc_title_txt"
+ android:layout_toLeftOf="@+id/imageView6"
+ android:layout_toStartOf="@+id/imageView6" />
+
+ <TextView
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/help_ring"
+ android:id="@+id/textView"
+ android:singleLine="false"
+ android:textColor="@color/text_color_primary"
+ android:padding="16dp"
+ android:textSize="14sp"
+ android:layout_alignParentStart="true"
+ android:layout_below="@+id/ring_acc_title_txt" />
+
+ <Button
+ android:id="@+id/create_ring_account"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/create_ring_account"
+ style="@style/Widget.AppCompat.Button.Borderless.Colored"
+ android:layout_margin="8dp"
+ android:padding="8dp"
+ android:layout_below="@+id/textView"
+ android:layout_alignParentStart="false"
+ android:layout_alignParentEnd="false" />
+ </RelativeLayout>
+
+ </android.support.v7.widget.CardView>
+
+ <android.support.v7.widget.CardView
+ xmlns:card_view="http://schemas.android.com/apk/res-auto"
+ android:id="@+id/card_view"
+ android:layout_gravity="center"
+ android:layout_width="280dp"
+ android:layout_height="wrap_content"
+ card_view:cardCornerRadius="2dp"
+ android:layout_margin="8dp">
+ <RelativeLayout
+ android:orientation="vertical"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
android:id="@+id/sip_fields"
- android:visibility="gone">
+ android:nestedScrollingEnabled="false">
+
+ <TextView
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/help_sip_title"
+ android:singleLine="false"
+ android:textColor="@color/text_color_primary"
+ android:textSize="24sp"
+ android:paddingTop="24dp"
+ android:paddingLeft="16dp"
+ android:paddingRight="16dp"
+ android:layout_alignParentLeft="true"
+ android:layout_alignParentTop="true"
+ android:id="@+id/textView3"
+ android:layout_alignParentStart="false"
+ android:layout_toLeftOf="@+id/imageView5"
+ android:layout_toStartOf="@+id/imageView5" />
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/help_sip"
+ android:singleLine="false"
+ android:textColor="@color/text_color_primary"
+ android:textSize="14sp"
+ android:layout_below="@+id/textView3"
+ android:id="@+id/textView4"
+ android:padding="16dp"
+ android:layout_alignParentEnd="true"
+ android:layout_alignParentStart="true" />
<EditText
android:id="@+id/alias"
@@ -53,7 +150,12 @@
android:layout_height="wrap_content"
android:hint="@string/prompt_alias"
android:singleLine="true"
- android:typeface="monospace" >
+ android:typeface="monospace"
+ android:layout_below="@+id/textView4"
+ android:layout_alignParentLeft="true"
+ android:layout_marginLeft="16dp"
+ android:layout_marginRight="16dp"
+ android:layout_marginBottom="8dp">
</EditText>
<EditText
@@ -62,7 +164,12 @@
android:layout_height="wrap_content"
android:hint="@string/prompt_hostname"
android:singleLine="true"
- android:typeface="monospace" >
+ android:typeface="monospace"
+ android:layout_below="@+id/alias"
+ android:layout_alignParentLeft="true"
+ android:layout_marginLeft="16dp"
+ android:layout_marginRight="16dp"
+ android:layout_marginBottom="8dp">
</EditText>
<EditText
@@ -71,7 +178,13 @@
android:layout_height="wrap_content"
android:hint="@string/prompt_username"
android:singleLine="true"
- android:typeface="monospace" />
+ android:typeface="monospace"
+ android:layout_below="@+id/hostname"
+ android:layout_alignParentLeft="true"
+ android:layout_alignParentStart="true"
+ android:layout_marginRight="16dp"
+ android:layout_marginLeft="16dp"
+ android:layout_marginBottom="8dp" />
<cx.ring.views.PasswordEditText
android:id="@+id/password"
@@ -82,34 +195,42 @@
android:imeOptions="actionGo"
android:inputType="textPassword"
android:singleLine="true"
- android:typeface="sans" />
- </LinearLayout>
+ android:typeface="sans"
+ android:layout_centerVertical="true"
+ android:layout_alignEnd="@+id/username"
+ android:layout_alignParentStart="true"
+ android:layout_alignParentLeft="true"
+ android:layout_below="@+id/username"
+ android:layout_marginLeft="16dp"
+ android:layout_marginRight="16dp"
+ android:layout_marginBottom="8dp" />
- <LinearLayout
- android:orientation="vertical"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:id="@+id/ring_fields">
-
- <TextView
+ <Button
+ android:id="@+id/create_sip_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:textAppearance="?android:attr/textAppearanceMedium"
- android:text="@string/help_ring"
- android:id="@+id/textView"
- android:singleLine="false" />
- </LinearLayout>
- </FrameLayout>
+ android:text="@string/create_sip_account"
+ style="@style/Widget.AppCompat.Button.Borderless.Colored"
+ android:padding="8dp"
+ android:layout_alignParentLeft="true"
+ android:layout_alignParentTop="false"
+ android:layout_alignParentStart="true"
+ android:layout_below="@+id/password"
+ android:layout_margin="8dp" />
- <Button
- android:id="@+id/create_button"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="right"
- android:layout_marginTop="16dp"
- android:paddingLeft="32dp"
- android:paddingRight="32dp"
- android:text="@string/action_create" />
+ <ImageView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:id="@+id/imageView5"
+ android:layout_alignParentTop="true"
+ android:layout_alignParentRight="true"
+ android:layout_alignParentEnd="true"
+ android:src="@drawable/ic_dialer_sip_black_48dp"
+ android:layout_margin="16dp" />
+ </RelativeLayout>
+
+ </android.support.v7.widget.CardView>
+
</LinearLayout>
diff --git a/ring-android/app/src/main/res/layout/frag_menu_header.xml b/ring-android/app/src/main/res/layout/frag_menu_header.xml
index 544f6ff..412ab99 100644
--- a/ring-android/app/src/main/res/layout/frag_menu_header.xml
+++ b/ring-android/app/src/main/res/layout/frag_menu_header.xml
@@ -6,28 +6,28 @@
android:background="@color/color_primary_dark"
android:paddingTop="40dp"
android:theme="@style/MenuHeader"
- android:paddingLeft="16dp">
+ android:paddingLeft="16dp"
+ tools:showIn="@layout/menuheader">
<ImageView
android:id="@+id/user_photo"
android:layout_width="70dp"
android:layout_height="70dp"
- android:layout_alignParentLeft="true"
- android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
- android:layout_marginBottom="8dp" />
+ android:layout_centerHorizontal="true" />
<TextView
android:id="@+id/user_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_alignParentLeft="true"
- android:layout_alignParentStart="true"
- android:layout_below="@+id/user_photo"
android:singleLine="true"
android:textSize="20sp"
android:textStyle="bold"
- android:textColor="@color/white" />
+ android:textColor="@color/white"
+ android:layout_below="@+id/user_photo"
+ android:layout_centerHorizontal="true"
+ android:layout_marginBottom="16dp"
+ android:layout_marginTop="8dp" />
<Spinner
android:id="@+id/account_selection"
@@ -37,17 +37,33 @@
android:layout_alignParentStart="true"
android:layout_below="@+id/user_name"
android:layout_toLeftOf="@+id/share_btn"
- android:layout_toStartOf="@+id/share_btn" />
+ android:layout_toStartOf="@+id/share_btn"
+ android:visibility="visible"
+ tools:listitem="@layout/item_account_selected"/>
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:text="New Button"
+ android:text="@string/share_number"
android:id="@+id/share_btn"
android:src="@drawable/ic_share_white_24dp"
style="?android:attr/borderlessButtonStyle"
android:layout_alignBottom="@+id/account_selection"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
- android:layout_alignTop="@+id/account_selection" />
+ android:layout_alignTop="@+id/account_selection"
+ android:visibility="visible" />
+
+ <Button
+ android:layout_width="wrap_content"
+ android:layout_height="72dp"
+ android:text="@string/action_create"
+ android:id="@+id/addaccount_btn"
+ android:layout_below="@+id/user_name"
+ android:layout_alignParentRight="true"
+ android:layout_alignParentEnd="true"
+ android:layout_alignParentLeft="true"
+ android:layout_alignParentStart="true"
+ style="@style/Widget.AppCompat.Button.Borderless"
+ android:visibility="gone" />
</RelativeLayout>
\ No newline at end of file
diff --git a/ring-android/app/src/main/res/values/strings.xml b/ring-android/app/src/main/res/values/strings.xml
index ce6280c..4884b2d 100644
--- a/ring-android/app/src/main/res/values/strings.xml
+++ b/ring-android/app/src/main/res/values/strings.xml
@@ -117,19 +117,9 @@
<string name="copyright">Copyright \u00A9 2004–2015 Savoir-Faire Linux Inc.</string>
<string name="web_site">Website</string>
<string name="help_gestures"> This view will help users with different interactions during calls. Different actions will be described; Long press, fling, swype etc.</string>
+ <string name="send_message">Send message</string>
<string name="ongoing_call">Ongoing call</string>
<string name="hist_in_call">Incoming call of %1$s</string>
<string name="hist_out_call">Outgoing call of %1$s</string>
- <!-- combobox protocol -->
- <string-array name="accountType">
- <item>RING</item>
- <item>SIP</item>
- <item>IAX</item>
- </string-array>
- <string name="help_ring">Ring accounts allow you to reach people securely in peer to peer through a fully distributed network.\n\n
-When creating a Ring account, a new 4096 bits RSA key pair is generated. The hash of the public key then becomes your Ring ID.
- </string>
- <string name="account_type">Account type</string>
-
</resources>
diff --git a/ring-android/app/src/main/res/values/strings_account.xml b/ring-android/app/src/main/res/values/strings_account.xml
index cedd0e5..1530db4 100644
--- a/ring-android/app/src/main/res/values/strings_account.xml
+++ b/ring-android/app/src/main/res/values/strings_account.xml
@@ -42,6 +42,22 @@
<string name="dialog_wait_create">Adding account</string>
<string name="dialog_wait_create_details">Please wait while your new account is added…</string>
+ <!-- Strings related to account creation -->
+ <string-array name="accountType">
+ <item>RING</item>
+ <item>SIP</item>
+ <item>IAX</item>
+ </string-array>
+ <string name="help_ring_title">Ring identity</string>
+ <string name="help_ring">A Ring identities allows you to reach people securely in peer to peer through a fully distributed network.</string>
+ <string name="create_ring_account">Create</string>
+
+ <string name="help_sip_title">SIP account</string>
+ <string name="help_sip">Configure an existing SIP account.</string>
+ <string name="create_sip_account">Add</string>
+ <string name="configure_sip_account">Configure</string>
+ <string name="share_number">Share number</string>
+
<!-- AccountManagementFragment -->
<string name="preference_section1">Accounts</string>
<string name="empty_account_list">No account registered</string>