diff --git a/ring-android/app/app.iml b/ring-android/app/app.iml index 3502718a02a97aea65d57f19ae83e879f9359f94..279e649c4313abc998926fafa24b7daeaa94c578 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 2ca1c198830e77e6370966c0735d9b940e859df7..cf33e4ae2ee347b602f8ddac82f0101f2ff1c291 100644 --- a/ring-android/app/build.gradle +++ b/ring-android/app/build.gradle @@ -6,6 +6,7 @@ dependencies { 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 999fbc01c47f3fd68c6470522a30fcf7cafe6ee9..4ba66ebb1a4dc6206d5581d679430ee4b3a32140 100644 --- a/ring-android/app/src/main/AndroidManifest.xml +++ b/ring-android/app/src/main/AndroidManifest.xml @@ -105,7 +105,7 @@ as that of the covered work. <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 43cd2ba70b4a2d68daffda4a8dfac4cd395c45ea..931f47b05c7d654951768be22bd4b81e84b62fe2 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.Bundle; 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 @@ public class AccountWizard extends Activity implements AccountCreationFragment.C 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 @@ public class AccountWizard extends Activity implements AccountCreationFragment.C } @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 fcbabd381799ada5e12955a9a18a766a5781c192..ffd2c5c46a9639af892018f862d2891da220b521 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.Fragment; 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 @@ public class HomeActivity extends AppCompatActivity implements LocalService.Call private LocalService service; private boolean mBound = false; + private boolean mNoAccountOpened = false; private NavigationView fMenu; private MenuFragment fMenuHead = null; @@ -136,6 +139,12 @@ public class HomeActivity extends AppCompatActivity implements LocalService.Call 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 @@ public class HomeActivity extends AppCompatActivity implements LocalService.Call } + 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 @@ public class HomeActivity extends AppCompatActivity implements LocalService.Call @Override protected void onDestroy() { super.onDestroy(); + unregisterReceiver(receiver); if (mBound) { unbindService(mConnection); mBound = false; @@ -378,7 +403,6 @@ public class HomeActivity extends AppCompatActivity implements LocalService.Call 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 14c5d09f76f43a82863575cc9f3df6e36c9b79d4..24196665f2e56e9a8ad0b15bdb2cd52e8acc6322 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.content.Intent; 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; 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 @@ public class AccountCreationFragment extends Fragment { 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 class AccountCreationFragment extends Fragment { 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 @@ public class AccountCreationFragment extends Fragment { @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 @@ public class AccountCreationFragment extends Fragment { 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 @@ public class AccountCreationFragment extends Fragment { @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 bec95da815d6ab409a725fb33314eccd42beeaa6..808aa2cc2789c3f4466920775f796aa35cc1ae1c 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 @@ package cx.ring.fragments; 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 android.widget.AdapterView.OnItemSelectedListener; 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 class MenuFragment extends Fragment /*extends AccountWrapperFragment impl 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 @@ public class MenuFragment extends Fragment /*extends AccountWrapperFragment impl /*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 0000000000000000000000000000000000000000..d911ebd45fc28187891eb07bf35e1dd443f14d50 Binary files /dev/null and b/ring-android/app/src/main/res/drawable-hdpi/ic_dialer_sip_black_48dp.png 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 0000000000000000000000000000000000000000..5cebe0a4edae5c42dacf544a2ffc92d3bf8719cd Binary files /dev/null and b/ring-android/app/src/main/res/drawable-hdpi/ring_logo_48dp.png 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 0000000000000000000000000000000000000000..44b147019545c72f7f51b0aab1a2d0cdde31df51 Binary files /dev/null and b/ring-android/app/src/main/res/drawable-mdpi/ic_dialer_sip_black_48dp.png 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 0000000000000000000000000000000000000000..43097163ab6fb891a5cc90959096c0c692e5c71a Binary files /dev/null and b/ring-android/app/src/main/res/drawable-mdpi/ring_logo_48dp.png 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 0000000000000000000000000000000000000000..d458d5d4b27d4dff907a86188208766534549d65 Binary files /dev/null and b/ring-android/app/src/main/res/drawable-xhdpi/ic_dialer_sip_black_48dp.png 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 0000000000000000000000000000000000000000..dff924163e9e4ff5d42c0d96aa5a017ce66d6911 Binary files /dev/null and b/ring-android/app/src/main/res/drawable-xhdpi/ring_logo_48dp.png 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 0000000000000000000000000000000000000000..c9342b446875ca63b4bcf987f4ab531b2b4a548b Binary files /dev/null and b/ring-android/app/src/main/res/drawable-xxhdpi/ic_dialer_sip_black_48dp.png 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 0000000000000000000000000000000000000000..cc4be60470335ed5ca52665704e6ff7fbe6dead7 Binary files /dev/null and b/ring-android/app/src/main/res/drawable-xxhdpi/ring_logo_48dp.png 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 0000000000000000000000000000000000000000..aed4ee2d64637e7ab611d302ff1a3c34d7892d20 Binary files /dev/null and b/ring-android/app/src/main/res/drawable-xxxhdpi/ic_dialer_sip_black_48dp.png 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 0000000000000000000000000000000000000000..ae84b048ae72b9669fe584c20182b5ecdd8fbb1b Binary files /dev/null and b/ring-android/app/src/main/res/drawable-xxxhdpi/ring_logo_48dp.png 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 b8af89dcb434dde83cd7dd789708671d28a641e5..86ddb81bec354fc657c3c6b43d4217f38800803d 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" + <RelativeLayout + android:orientation="vertical" + android:layout_width="match_parent" android:layout_height="wrap_content" - android:textAppearance="?android:attr/textAppearanceMedium" - android:text="@string/account_type" - android:id="@+id/textView3" - android:layout_marginRight="16dp" /> + android:id="@+id/ring_fields"> - <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" /> + <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" /> - </LinearLayout> + <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" /> - <FrameLayout - android:layout_width="match_parent" + <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" - android:id="@+id/field_flipper" - > - - <LinearLayout + card_view:cardCornerRadius="2dp" + android:layout_margin="8dp"> + <RelativeLayout android:orientation="vertical" android:layout_width="match_parent" - android:layout_height="wrap_content" + 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:minHeight="52dp" 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:minHeight="52dp" 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:minHeight="52dp" 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:minHeight="52dp" android:imeOptions="actionGo" android:inputType="textPassword" android:singleLine="true" - android:typeface="sans" /> - </LinearLayout> - - <LinearLayout - android:orientation="vertical" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:id="@+id/ring_fields"> - - <TextView + 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" /> + + <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" /> + + <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> - <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" /> </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 544f6fff7182c01aa1cb91e2e1c7d32cd0824cf1..412ab99ff648aafbb707c24c1e59968758147abe 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 ce6280c63ed9f1eecc077006d7647c8bca3f56c2..4884b2d9f4c8de092c5b02e6523b59b79d4b4da7 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 @@ as that of the covered work. <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 cedd0e5022a3b7a7d8c796dfd3c6c822efdc0784..1530db4fea50bf8453ebbd50f2dc5437f8059624 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 @@ as that of the covered work. <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>