Updated default and wizard settings

This commit is contained in:
Sylvain Berfini 2012-09-18 16:40:52 +02:00
parent acd9b95d20
commit 59b79eb7c1
6 changed files with 41 additions and 8 deletions

View file

@ -57,15 +57,15 @@
android:background="@drawable/chat_field_background"> android:background="@drawable/chat_field_background">
<ImageView <ImageView
android:contentDescription="@string/content_description_send_message"
android:id="@+id/sendPicture" android:id="@+id/sendPicture"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_alignParentLeft="true" android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:adjustViewBounds="true" android:adjustViewBounds="true"
android:src="@drawable/chat_send_picture" android:contentDescription="@string/content_description_send_message"
android:paddingLeft="10dp" /> android:paddingLeft="8dp"
android:src="@drawable/chat_send_picture" />
<ImageView <ImageView
android:contentDescription="@string/content_description_send_message" android:contentDescription="@string/content_description_send_message"

View file

@ -12,6 +12,7 @@
android:orientation="horizontal"> android:orientation="horizontal">
<ImageView <ImageView
android:contentDescription="@string/content_description_edit"
android:id="@+id/editContact" android:id="@+id/editContact"
android:src="@drawable/contact_edit" android:src="@drawable/contact_edit"
android:layout_width="match_parent" android:layout_width="match_parent"

View file

@ -143,6 +143,7 @@
<CheckBoxPreference <CheckBoxPreference
android:key="@string/pref_video_use_front_camera_key" android:key="@string/pref_video_use_front_camera_key"
android:defaultValue="true"
android:title="@string/pref_video_use_front_camera_title" android:title="@string/pref_video_use_front_camera_title"
android:dependency="@string/pref_video_enable_key"/> android:dependency="@string/pref_video_enable_key"/>
@ -246,7 +247,7 @@
<CheckBoxPreference <CheckBoxPreference
android:key="@string/pref_push_notification_key" android:key="@string/pref_push_notification_key"
android:title="@string/pref_push_notification" android:title="@string/pref_push_notification"
android:defaultValue="true"/> android:defaultValue="false"/>
</PreferenceScreen> </PreferenceScreen>

View file

@ -95,6 +95,9 @@ public class ContactFragment extends Fragment implements OnClickListener {
for (String numberOrAddress : contact.getNumerosOrAddresses()) { for (String numberOrAddress : contact.getNumerosOrAddresses()) {
View v = inflater.inflate(R.layout.contact_control_row, null); View v = inflater.inflate(R.layout.contact_control_row, null);
if (numberOrAddress.startsWith("sip:")) {
numberOrAddress = numberOrAddress.substring(4);
}
((TextView) v.findViewById(R.id.numeroOrAddress)).setText(numberOrAddress); ((TextView) v.findViewById(R.id.numeroOrAddress)).setText(numberOrAddress);
v.findViewById(R.id.dial).setOnClickListener(dialListener); v.findViewById(R.id.dial).setOnClickListener(dialListener);

View file

@ -47,6 +47,7 @@ import org.linphone.setup.SetupActivity;
import org.linphone.ui.LedPreference; import org.linphone.ui.LedPreference;
import org.linphone.ui.PreferencesListFragment; import org.linphone.ui.PreferencesListFragment;
import android.app.Activity;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
@ -73,6 +74,7 @@ public class PreferencesFragment extends PreferencesListFragment implements EcCa
private static final int ACCOUNTS_SETTINGS_ID = 0; private static final int ACCOUNTS_SETTINGS_ID = 0;
private static final int WIZARD_SETTINGS_ID = 1; private static final int WIZARD_SETTINGS_ID = 1;
private static final int CAMERA_SETTINGS_ID = 5; private static final int CAMERA_SETTINGS_ID = 5;
private static final int WIZARD_INTENT = 1;
public PreferencesFragment() { public PreferencesFragment() {
super(R.xml.preferences); super(R.xml.preferences);
@ -131,8 +133,10 @@ public class PreferencesFragment extends PreferencesListFragment implements EcCa
// No video // No video
if (!Version.isVideoCapable()) { if (!Version.isVideoCapable()) {
uncheckAndDisableCheckbox(pref_video_enable_key); uncheckAndDisableCheckbox(pref_video_enable_key);
} else if (!AndroidCameraConfiguration.hasFrontCamera()) { } else {
uncheckDisableAndHideCheckbox(R.string.pref_video_use_front_camera_key); if (!AndroidCameraConfiguration.hasFrontCamera()) {
uncheckDisableAndHideCheckbox(R.string.pref_video_use_front_camera_key);
}
} }
if (prefs().getBoolean(LinphoneActivity.PREF_FIRST_LAUNCH,true)) { if (prefs().getBoolean(LinphoneActivity.PREF_FIRST_LAUNCH,true)) {
@ -413,12 +417,21 @@ public class PreferencesFragment extends PreferencesListFragment implements EcCa
wizard.setOnPreferenceClickListener(new OnPreferenceClickListener() { wizard.setOnPreferenceClickListener(new OnPreferenceClickListener() {
public boolean onPreferenceClick(Preference preference) { public boolean onPreferenceClick(Preference preference) {
Intent intent = new Intent(mContext, SetupActivity.class); Intent intent = new Intent(mContext, SetupActivity.class);
startActivity(intent); startActivityForResult(intent, WIZARD_INTENT);
return true; return true;
} }
}); });
} }
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == WIZARD_INTENT && resultCode == Activity.RESULT_OK) {
if (LinphoneActivity.isInstanciated()) {
LinphoneActivity.instance().goToDialer();
}
}
}
private void initializeMediaEncryptionPreferences() { private void initializeMediaEncryptionPreferences() {
LinphoneCore lc=LinphoneManager.getLc(); LinphoneCore lc=LinphoneManager.getLc();
boolean hasZrtp=lc.mediaEncryptionSupported(MediaEncryption.ZRTP); boolean hasZrtp=lc.mediaEncryptionSupported(MediaEncryption.ZRTP);

View file

@ -21,6 +21,7 @@ import org.linphone.LinphoneManager;
import org.linphone.R; import org.linphone.R;
import org.linphone.core.Log; import org.linphone.core.Log;
import android.app.Activity;
import android.content.Context; import android.content.Context;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.os.Bundle; import android.os.Bundle;
@ -143,6 +144,7 @@ public class SetupActivity extends FragmentActivity implements OnClickListener {
if (LinphoneManager.getLc().getDefaultProxyConfig() != null) { if (LinphoneManager.getLc().getDefaultProxyConfig() != null) {
writePreference(R.string.first_launch_suceeded_once_key, true); writePreference(R.string.first_launch_suceeded_once_key, true);
setResult(Activity.RESULT_OK);
finish(); finish();
} }
} }
@ -189,6 +191,19 @@ public class SetupActivity extends FragmentActivity implements OnClickListener {
writePreference(R.string.pref_username_key, username); writePreference(R.string.pref_username_key, username);
writePreference(R.string.pref_passwd_key, password); writePreference(R.string.pref_passwd_key, password);
writePreference(R.string.pref_domain_key, domain); writePreference(R.string.pref_domain_key, domain);
boolean isMainAccountLinphoneDotOrg = domain.equals(getString(R.string.default_domain));
if (isMainAccountLinphoneDotOrg) {
writePreference(R.string.pref_proxy_key, domain + ":5223");
writePreference(R.string.pref_enable_outbound_proxy_key, true);
writePreference(R.string.pref_stun_server_key, "stun.linphone.org");
writePreference(R.string.pref_ice_enable_key, true);
writePreference(R.string.pref_push_notification_key, true);
writePreference(R.string.pref_transport_tls_key, true);
writePreference(R.string.pref_transport_tcp_key, false);
writePreference(R.string.pref_transport_udp_key, false);
}
} else { } else {
writePreference(getString(R.string.pref_username_key) + newAccountId, username); writePreference(getString(R.string.pref_username_key) + newAccountId, username);
writePreference(getString(R.string.pref_passwd_key) + newAccountId, password); writePreference(getString(R.string.pref_passwd_key) + newAccountId, password);