Added remote provisioning menu to wizard + fix db crash when restart app after fresh install
This commit is contained in:
parent
35ba0ec662
commit
3801f2c795
13 changed files with 212 additions and 7 deletions
|
@ -5,7 +5,7 @@
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:paddingTop="40dp"
|
android:paddingTop="10dp"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:src="@drawable/setup_title_assistant"/>
|
android:src="@drawable/setup_title_assistant"/>
|
||||||
|
@ -13,7 +13,7 @@
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:paddingTop="40dp"
|
android:paddingTop="10dp"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
@ -97,6 +97,33 @@
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:id="@+id/setup_remote_provisioning_layout"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_weight="0.7"
|
||||||
|
android:layout_marginBottom="10dp"
|
||||||
|
android:paddingLeft="10dp"
|
||||||
|
android:paddingRight="10dp">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/setup_remote_provisioning"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:adjustViewBounds="true"
|
||||||
|
android:scaleType="fitXY"
|
||||||
|
android:src="@drawable/button"
|
||||||
|
android:layout_centerInParent="true" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_centerInParent="true"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/setup_remote_provisioning"
|
||||||
|
android:textColor="@android:color/black"/>
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
|
@ -88,6 +88,30 @@
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:id="@+id/setup_remote_provisioning_layout"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_weight="0.7"
|
||||||
|
android:paddingLeft="10dp"
|
||||||
|
android:paddingRight="10dp">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/setup_remote_provisioning"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:src="@drawable/button"
|
||||||
|
android:layout_centerInParent="true" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_centerInParent="true"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/setup_remote_provisioning"
|
||||||
|
android:textColor="@android:color/black"/>
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
<View
|
<View
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
|
75
res/layout/setup_remote_provisioning.xml
Normal file
75
res/layout/setup_remote_provisioning.xml
Normal file
|
@ -0,0 +1,75 @@
|
||||||
|
<?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">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:contentDescription="@string/content_description_welcome"
|
||||||
|
android:paddingTop="40dp"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:src="@drawable/setup_title_assistant"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:paddingTop="10dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/setup_remote_provisioning_hint"
|
||||||
|
android:textColor="@android:color/black"/>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:paddingTop="40dp"
|
||||||
|
android:paddingLeft="10dp"
|
||||||
|
android:paddingRight="10dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:textCursorDrawable="@null"
|
||||||
|
android:id="@+id/setup_remote_provisioning_url"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:hint="@string/setup_remote_provisioning_url_hint"
|
||||||
|
android:inputType="textUri"
|
||||||
|
android:paddingLeft="10dp"
|
||||||
|
android:paddingRight="10dp"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:textColor="@android:color/black"
|
||||||
|
android:background="@drawable/setup_field_background" />
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:id="@+id/setup_apply_button"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:contentDescription="@string/content_description_validate"
|
||||||
|
android:id="@+id/setup_apply"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:src="@drawable/button"
|
||||||
|
android:layout_centerInParent="true" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_centerInParent="true"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/setup_apply"
|
||||||
|
android:textColor="@android:color/black"/>
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:paddingLeft="10dp"
|
||||||
|
android:paddingRight="10dp" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
|
@ -381,6 +381,10 @@
|
||||||
<string name="importing_messages">Mise à jour de la base des messages</string>
|
<string name="importing_messages">Mise à jour de la base des messages</string>
|
||||||
<string name="default_account_flag">Compte par défaut</string>
|
<string name="default_account_flag">Compte par défaut</string>
|
||||||
|
|
||||||
|
<string name="setup_remote_provisioning">Télécharger ma configuration</string>
|
||||||
|
<string name="setup_remote_provisioning_hint">Cet assistant va télécharger une configuration existante.</string>
|
||||||
|
<string name="setup_remote_provisioning_url_hint">addresse où télécharger la configuration</string>
|
||||||
|
|
||||||
<string name="zrtp_accept">Accepter</string>
|
<string name="zrtp_accept">Accepter</string>
|
||||||
<string name="zrtp_deny">Refuser</string>
|
<string name="zrtp_deny">Refuser</string>
|
||||||
<string name="zrtp_help">Vous ne devriez accepter que si vous avez le même code (ci-dessus) que votre contact</string>
|
<string name="zrtp_help">Vous ne devriez accepter que si vous avez le même code (ci-dessus) que votre contact</string>
|
||||||
|
|
|
@ -436,6 +436,10 @@
|
||||||
<string name="importing_messages">Updating messages database</string>
|
<string name="importing_messages">Updating messages database</string>
|
||||||
<string name="default_account_flag">Default account</string>
|
<string name="default_account_flag">Default account</string>
|
||||||
|
|
||||||
|
<string name="setup_remote_provisioning">Download provisioning</string>
|
||||||
|
<string name="setup_remote_provisioning_hint">This assistant will download an existing configuration.</string>
|
||||||
|
<string name="setup_remote_provisioning_url_hint">provisioning url</string>
|
||||||
|
|
||||||
<string name="zrtp_accept">Accept</string>
|
<string name="zrtp_accept">Accept</string>
|
||||||
<string name="zrtp_deny">Deny</string>
|
<string name="zrtp_deny">Deny</string>
|
||||||
<string name="zrtp_help">You should only accept if you have the same code (see above) as your correspondent</string>
|
<string name="zrtp_help">You should only accept if you have the same code (see above) as your correspondent</string>
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
<bool name="setup_account_validation_mandatory">false</bool>
|
<bool name="setup_account_validation_mandatory">false</bool>
|
||||||
<bool name="hide_linphone_accounts_wizard">false</bool>
|
<bool name="hide_linphone_accounts_wizard">false</bool>
|
||||||
<bool name="hide_generic_accounts_wizard">false</bool>
|
<bool name="hide_generic_accounts_wizard">false</bool>
|
||||||
|
<bool name="hide_remote_provisioning_in_wizard">false</bool>
|
||||||
<bool name="hide_accounts">false</bool>
|
<bool name="hide_accounts">false</bool>
|
||||||
<bool name="display_account_wizard_at_first_start">true</bool>
|
<bool name="display_account_wizard_at_first_start">true</bool>
|
||||||
<bool name="use_linphone_server_ports">true</bool>
|
<bool name="use_linphone_server_ports">true</bool>
|
||||||
|
|
|
@ -436,6 +436,10 @@
|
||||||
<string name="importing_messages">Updating messages database</string>
|
<string name="importing_messages">Updating messages database</string>
|
||||||
<string name="default_account_flag">Default account</string>
|
<string name="default_account_flag">Default account</string>
|
||||||
|
|
||||||
|
<string name="setup_remote_provisioning">Download provisioning</string>
|
||||||
|
<string name="setup_remote_provisioning_hint">This assistant will download an existing configuration.</string>
|
||||||
|
<string name="setup_remote_provisioning_url_hint">provisioning url</string>
|
||||||
|
|
||||||
<string name="zrtp_accept">Accept</string>
|
<string name="zrtp_accept">Accept</string>
|
||||||
<string name="zrtp_deny">Deny</string>
|
<string name="zrtp_deny">Deny</string>
|
||||||
<string name="zrtp_help">You should only accept if you have the same code (see above) as your correspondent</string>
|
<string name="zrtp_help">You should only accept if you have the same code (see above) as your correspondent</string>
|
||||||
|
|
|
@ -68,7 +68,7 @@ public class ChatStorage {
|
||||||
context = c;
|
context = c;
|
||||||
boolean useLinphoneStorage = c.getResources().getBoolean(R.bool.use_linphone_chat_storage);
|
boolean useLinphoneStorage = c.getResources().getBoolean(R.bool.use_linphone_chat_storage);
|
||||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(LinphoneService.instance());
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(LinphoneService.instance());
|
||||||
boolean updateNeeded = prefs.getBoolean(c.getString(R.string.pref_first_time_linphone_chat_storage), true);
|
boolean updateNeeded = prefs.getBoolean(c.getString(R.string.pref_first_time_linphone_chat_storage), !LinphonePreferences.instance().isFirstLaunch());
|
||||||
useNativeAPI = useLinphoneStorage && !updateNeeded;
|
useNativeAPI = useLinphoneStorage && !updateNeeded;
|
||||||
Log.d("Using native API: " + useNativeAPI);
|
Log.d("Using native API: " + useNativeAPI);
|
||||||
|
|
||||||
|
|
|
@ -85,7 +85,6 @@ import android.content.ContentResolver;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.IntentFilter;
|
import android.content.IntentFilter;
|
||||||
import android.content.SharedPreferences;
|
|
||||||
import android.content.pm.PackageManager.NameNotFoundException;
|
import android.content.pm.PackageManager.NameNotFoundException;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.hardware.Sensor;
|
import android.hardware.Sensor;
|
||||||
|
@ -100,7 +99,6 @@ import android.os.Build;
|
||||||
import android.os.PowerManager;
|
import android.os.PowerManager;
|
||||||
import android.os.PowerManager.WakeLock;
|
import android.os.PowerManager.WakeLock;
|
||||||
import android.os.Vibrator;
|
import android.os.Vibrator;
|
||||||
import android.preference.PreferenceManager;
|
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
import android.provider.Settings.SettingNotFoundException;
|
import android.provider.Settings.SettingNotFoundException;
|
||||||
import android.telephony.TelephonyManager;
|
import android.telephony.TelephonyManager;
|
||||||
|
|
|
@ -30,7 +30,7 @@ import android.widget.ImageView;
|
||||||
* @author Sylvain Berfini
|
* @author Sylvain Berfini
|
||||||
*/
|
*/
|
||||||
public class MenuFragment extends Fragment implements OnClickListener {
|
public class MenuFragment extends Fragment implements OnClickListener {
|
||||||
private ImageView createAccount, logLinphoneAccount, logGenericAccount;
|
private ImageView createAccount, logLinphoneAccount, logGenericAccount, remoteProvisioning;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
|
@ -54,6 +54,13 @@ public class MenuFragment extends Fragment implements OnClickListener {
|
||||||
logGenericAccount.setOnClickListener(this);
|
logGenericAccount.setOnClickListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
remoteProvisioning = (ImageView) view.findViewById(R.id.setup_remote_provisioning);
|
||||||
|
if (getResources().getBoolean(R.bool.hide_remote_provisioning_in_wizard)) {
|
||||||
|
view.findViewById(R.id.setup_remote_provisioning_layout).setVisibility(View.GONE);
|
||||||
|
} else {
|
||||||
|
remoteProvisioning.setOnClickListener(this);
|
||||||
|
}
|
||||||
|
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,6 +74,8 @@ public class MenuFragment extends Fragment implements OnClickListener {
|
||||||
SetupActivity.instance().displayLoginLinphone();
|
SetupActivity.instance().displayLoginLinphone();
|
||||||
} else if (id == R.id.setup_create_account) {
|
} else if (id == R.id.setup_create_account) {
|
||||||
SetupActivity.instance().displayWizard();
|
SetupActivity.instance().displayWizard();
|
||||||
|
} else if (id == R.id.setup_remote_provisioning) {
|
||||||
|
SetupActivity.instance().displayRemoteProvisioning();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
49
src/org/linphone/setup/RemoteProvisioningFragment.java
Normal file
49
src/org/linphone/setup/RemoteProvisioningFragment.java
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
package org.linphone.setup;
|
||||||
|
|
||||||
|
import org.linphone.LinphoneActivity;
|
||||||
|
import org.linphone.LinphoneLauncherActivity;
|
||||||
|
import org.linphone.LinphonePreferences;
|
||||||
|
import org.linphone.R;
|
||||||
|
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.support.v4.app.Fragment;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.View.OnClickListener;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.EditText;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
|
||||||
|
public class RemoteProvisioningFragment extends Fragment implements OnClickListener {
|
||||||
|
private EditText remoteProvisioningUrl;
|
||||||
|
private ImageView apply;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
|
Bundle savedInstanceState) {
|
||||||
|
View view = inflater.inflate(R.layout.setup_remote_provisioning, container, false);
|
||||||
|
|
||||||
|
remoteProvisioningUrl = (EditText) view.findViewById(R.id.setup_remote_provisioning_url);
|
||||||
|
apply = (ImageView) view.findViewById(R.id.setup_apply);
|
||||||
|
apply.setOnClickListener(this);
|
||||||
|
|
||||||
|
return view;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
int id = v.getId();
|
||||||
|
|
||||||
|
if (id == R.id.setup_apply) {
|
||||||
|
String url = remoteProvisioningUrl.getText().toString();
|
||||||
|
LinphonePreferences.instance().setRemoteProvisioningUrl(url);
|
||||||
|
|
||||||
|
// Restart Linphone
|
||||||
|
Intent intent = new Intent();
|
||||||
|
intent.setClass(getActivity(), LinphoneLauncherActivity.class);
|
||||||
|
LinphoneActivity.instance().exit();
|
||||||
|
startActivity(intent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -153,7 +153,10 @@ public class SetupActivity extends FragmentActivity implements OnClickListener {
|
||||||
|
|
||||||
next.setVisibility(View.VISIBLE);
|
next.setVisibility(View.VISIBLE);
|
||||||
back.setVisibility(View.GONE);
|
back.setVisibility(View.GONE);
|
||||||
} else if (currentFragment == SetupFragmentsEnum.GENERIC_LOGIN || currentFragment == SetupFragmentsEnum.LINPHONE_LOGIN || currentFragment == SetupFragmentsEnum.WIZARD) {
|
} else if (currentFragment == SetupFragmentsEnum.GENERIC_LOGIN
|
||||||
|
|| currentFragment == SetupFragmentsEnum.LINPHONE_LOGIN
|
||||||
|
|| currentFragment == SetupFragmentsEnum.WIZARD
|
||||||
|
|| currentFragment == SetupFragmentsEnum.REMOTE_PROVISIONING) {
|
||||||
MenuFragment fragment = new MenuFragment();
|
MenuFragment fragment = new MenuFragment();
|
||||||
changeFragment(fragment);
|
changeFragment(fragment);
|
||||||
currentFragment = SetupFragmentsEnum.MENU;
|
currentFragment = SetupFragmentsEnum.MENU;
|
||||||
|
@ -268,6 +271,12 @@ public class SetupActivity extends FragmentActivity implements OnClickListener {
|
||||||
changeFragment(fragment);
|
changeFragment(fragment);
|
||||||
currentFragment = SetupFragmentsEnum.WIZARD;
|
currentFragment = SetupFragmentsEnum.WIZARD;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void displayRemoteProvisioning() {
|
||||||
|
fragment = new RemoteProvisioningFragment();
|
||||||
|
changeFragment(fragment);
|
||||||
|
currentFragment = SetupFragmentsEnum.REMOTE_PROVISIONING;
|
||||||
|
}
|
||||||
|
|
||||||
public void saveCreatedAccount(String username, String password, String domain) {
|
public void saveCreatedAccount(String username, String password, String domain) {
|
||||||
if (accountCreated)
|
if (accountCreated)
|
||||||
|
|
|
@ -27,5 +27,6 @@ public enum SetupFragmentsEnum {
|
||||||
WIZARD_CONFIRM,
|
WIZARD_CONFIRM,
|
||||||
LINPHONE_LOGIN,
|
LINPHONE_LOGIN,
|
||||||
GENERIC_LOGIN,
|
GENERIC_LOGIN,
|
||||||
|
REMOTE_PROVISIONING,
|
||||||
ECHO_CANCELLER_CALIBRATION;
|
ECHO_CANCELLER_CALIBRATION;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue