Removed unused parameters in non_localizable_custom

+ moved some hard coded settings to real settings
+ at least display LinphoneFriends if contacts permission isn't given
+ fix loop at startup
This commit is contained in:
Sylvain Berfini 2016-07-20 09:46:20 +02:00
parent c95b546dc5
commit 59b0121b7f
16 changed files with 154 additions and 147 deletions

Binary file not shown.

View file

@ -24,6 +24,10 @@
<bool name="hide_camera_settings">false</bool>
<bool name="hide_wizard">false</bool>
<bool name="disable_chat">false</bool>
<bool name="disable_chat_message_notification">false</bool>
<bool name="disable_chat_send_file">false</bool>
<bool name="setup_account_validation_mandatory">false</bool>
<bool name="hide_linphone_accounts_wizard">false</bool>
<bool name="hide_generic_accounts_wizard">false</bool>
@ -31,42 +35,26 @@
<bool name="allow_cancel_remote_provisioning_login_activity">true</bool>
<bool name="hide_accounts">false</bool>
<bool name="display_account_wizard_at_first_start">true</bool>
<bool name="use_linphone_server_ports">false</bool>
<bool name="allow_only_phone_numbers_in_wizard">false</bool>
<bool name="enable_linphone_friends">false</bool>
<bool name="use_linphone_tag">true</bool>
<bool name="disable_options_in_call">false</bool>
<bool name="pre_fill_email_in_wizard">true</bool> <!-- Set the email field of the wizard with one of the gmail account registered on the device -->
<bool name="call_last_log_if_adress_is_empty">true</bool>
<bool name="allow_ringing_while_early_media">true</bool>
<bool name="disable_chat">false</bool>
<bool name="disable_chat_message_notification">false</bool>
<bool name="disable_chat_send_file">false</bool>
<bool name="auto_answer_calls">false</bool>
<bool name="allow_transfers">true</bool>
<bool name="forbid_self_call">false</bool>
<bool name="disable_animations">false</bool>
<bool name="allow_ringing_while_early_media">true</bool>
<bool name="allow_transfers">true</bool>
<bool name="disable_options_in_call">false</bool>
<bool name="automatically_start_intercepted_outgoing_gsm_call">true</bool>
<!-- This settings handle the behavior of the view waiting for the remote provisioning configuration to be done -->
<bool name="display_sms_remote_provisioning_activity">false</bool>
<bool name="forbid_app_usage_until_remote_provisioning_completed">false</bool>
<bool name="display_confirmation_popup_after_first_configuration">false</bool>
<bool name="enable_log_collect">false</bool>
<bool name="disable_every_log">false</bool>
<bool name="disable_all_security_features_for_markets">false</bool> <!-- Disable TLS/SRTP/ZRTP -->
<bool name="disable_all_patented_codecs_for_markets">false</bool> <!-- Disable MPEG4/H264 -->
<string name="about_bugreport_email">linphone-android@belledonne-communications.com</string>
<bool name="use_linphonecore_ringing">false</bool>
<string name="temp_photo_name">linphone-android-photo-temp</string>
<string name="temp_photo_name_with_date">linphone-android-photo-%s</string>
@ -82,12 +70,9 @@
<bool name="setup_cancel_move_to_back">false</bool>
<bool name="enable_call_notification">true</bool>
<bool name="kill_service_with_task_manager">true</bool>
<bool name="hash_images_as_name_before_upload">true</bool>
<!-- Tutorial settings -->
<bool name="show_tutorials_instead_of_app">false</bool> <!-- Be careful ! Setting this to true prevent the app from working ! It will only display tutorial activities -->

View file

@ -201,4 +201,6 @@
</string-array>
<string name="pref_use_lime_encryption_key">pref_use_lime_encryption_key</string>
<string name="pref_device_ringtone_key">pref_device_ringtone_key</string>
<string name="pref_auto_answer_key">pref_auto_answer_key</string>
</resources>

View file

@ -267,6 +267,8 @@
<!-- Call settings -->
<string name="pref_call_title">Call</string>
<string name="pref_device_ringtone">Use device ringtone</string>
<string name="pref_auto_answer">Auto answer incoming calls</string>
<string name="pref_rfc2833_dtmf">Send RFC2833 DTMFs</string>
<string name="pref_sipinfo_dtmf">Send SIP INFO DTMFs</string>
<string name="pref_voice_mail">Voice mail URI</string>

View file

@ -151,6 +151,16 @@
<PreferenceScreen
android:title="@string/pref_call_title">
<CheckBoxPreference
android:title="@string/pref_device_ringtone"
android:key="@string/pref_device_ringtone_key"
android:persistent="false"/>
<ListPreference
android:title="@string/pref_media_encryption"
android:key="@string/pref_media_encryption_key"
android:persistent="false"/>
<CheckBoxPreference
android:title="@string/pref_sipinfo_dtmf"
android:key="@string/pref_sipinfo_dtmf_key"
@ -161,6 +171,11 @@
android:key="@string/pref_rfc2833_dtmf_key"
android:persistent="false"/>
<CheckBoxPreference
android:title="@string/pref_auto_answer"
android:key="@string/pref_auto_answer_key"
android:persistent="false"/>
<EditTextPreference
android:title="@string/pref_voice_mail"
android:key="@string/pref_voice_mail_key"
@ -170,17 +185,17 @@
<PreferenceScreen
android:title="@string/pref_chat_title">
<ListPreference
android:title="@string/pref_use_lime_encryption"
android:key="@string/pref_use_lime_encryption_key"
android:persistent="false"/>
<EditTextPreference
android:title="@string/pref_image_sharing_server_title"
android:key="@string/pref_image_sharing_server_key"
android:summary="@string/pref_image_sharing_server_desc"
android:persistent="false"/>
<ListPreference
android:title="@string/pref_use_lime_encryption"
android:key="@string/pref_use_lime_encryption_key"
android:persistent="false"/>
</PreferenceScreen>
@ -232,11 +247,6 @@
android:layout="@layout/hidden"
android:persistent="false"/>
<ListPreference
android:title="@string/pref_media_encryption"
android:key="@string/pref_media_encryption_key"
android:persistent="false"/>
<CheckBoxPreference
android:title="@string/pref_push_notification"
android:key="@string/pref_push_notification_key"

View file

@ -151,7 +151,7 @@ public class CallActivity extends Activity implements OnClickListener, SensorEve
BluetoothManager.getInstance().initBluetooth();
}
isAnimationDisabled = getApplicationContext().getResources().getBoolean(R.bool.disable_animations) || !LinphonePreferences.instance().areAnimationsEnabled();
isAnimationDisabled = !LinphonePreferences.instance().areAnimationsEnabled();
cameraNumber = AndroidCameraConfiguration.retrieveCameras().length;
try {

View file

@ -17,9 +17,7 @@ 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
import android.app.Activity;
import android.app.Fragment;
import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.MotionEvent;
@ -39,20 +37,15 @@ public class CallAudioFragment extends Fragment {
View view = inflater.inflate(R.layout.audio, container, false);
return view;
}
@Override
public void onAttach(Activity activity) {
super.onAttach((Context)activity);
incallActvityInstance = (CallActivity) activity;
if (incallActvityInstance != null) {
incallActvityInstance.bindAudioFragment(this);
}
}
@Override
public void onStart() {
super.onStart();
incallActvityInstance = (CallActivity) getActivity();
if (incallActvityInstance != null) {
incallActvityInstance.bindAudioFragment(this);
}
// Just to be sure we have incall controls
if (incallActvityInstance != null) {

View file

@ -25,9 +25,7 @@ import org.linphone.mediastream.Log;
import org.linphone.mediastream.video.AndroidVideoWindowImpl;
import org.linphone.mediastream.video.capture.hwconf.AndroidCameraConfiguration;
import android.app.Activity;
import android.app.Fragment;
import android.content.Context;
import android.os.Bundle;
import android.view.GestureDetector;
import android.view.GestureDetector.OnDoubleTapListener;
@ -132,6 +130,15 @@ public class CallVideoFragment extends Fragment implements OnGestureListener, On
});
return view;
}
@Override
public void onStart() {
super.onStart();
inCallActivity = (CallActivity) getActivity();
if (inCallActivity != null) {
inCallActivity.bindVideoFragment(this);
}
}
private void fixZOrder(SurfaceView video, SurfaceView preview) {
video.setZOrderOnTop(false);
@ -293,15 +300,6 @@ public class CallVideoFragment extends Fragment implements OnGestureListener, On
super.onDestroy();
}
@Override
public void onAttach(Activity activity) {
super.onAttach((Context)activity);
inCallActivity = (CallActivity) activity;
if (inCallActivity != null) {
inCallActivity.bindVideoFragment(this);
}
}
@Override
public boolean onDown(MotionEvent e) {

View file

@ -170,34 +170,6 @@ public class ContactDetailsFragment extends Fragment implements OnClickListener
v.findViewById(R.id.contact_chat).setTag(noa.getValue());
}
/*ImageView friend = (ImageView) v.findViewById(R.id.addFriend);
if (getResources().getBoolean(R.bool.enable_linphone_friends) && !displayChatAddressOnly) {
friend.setVisibility(View.VISIBLE);
boolean isAlreadyAFriend = LinphoneManager.getLc().findFriendByAddress(finalNumberOrAddress) != null;
if (!isAlreadyAFriend) {
friend.setImageResource(R.drawable.contact_add);
friend.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if (ContactsManager.getInstance().createNewFriend(contact, finalNumberOrAddress)) {
displayContact(ContactFragment.this.inflater, ContactFragment.this.view);
}
}
});
} else {
friend.setImageResource(R.drawable.delete);
friend.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if (ContactsManager.getInstance().removeFriend(finalNumberOrAddress)) {
displayContact(ContactFragment.this.inflater, ContactFragment.this.view);
}
}
});
}
}*/
if (getResources().getBoolean(R.bool.disable_chat)) {
v.findViewById(R.id.contact_chat).setVisibility(View.GONE);
}

View file

@ -243,7 +243,7 @@ public class ContactsManager extends ContentObserver {
c.close();
}
}
for (LinphoneFriend friend : LinphoneManager.getLc().getFriendList()) {
String refkey = friend.getRefKey();
if (refkey != null) {
@ -255,9 +255,13 @@ public class ContactsManager extends ContentObserver {
break;
}
}
if (!found) {
if (!found && hasContactAccess) {
// If refkey != null but there isn't a native contact with this value, then this contact has been deleted. Let's do the same with the LinphoneFriend
LinphoneManager.getLc().removeFriend(friend);
} else {
LinphoneContact contact = new LinphoneContact();
contact.setFriend(friend);
contacts.add(contact);
}
} else {
LinphoneContact contact = new LinphoneContact();

View file

@ -417,7 +417,7 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
}
private void updateAnimationsState() {
isAnimationDisabled = getResources().getBoolean(R.bool.disable_animations) || !LinphonePreferences.instance().areAnimationsEnabled();
isAnimationDisabled = !LinphonePreferences.instance().areAnimationsEnabled();
}
public boolean isAnimationDisabled() {
@ -1253,9 +1253,9 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
case PERMISSIONS_REQUEST_CONTACTS:
if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {
ContactsManager.getInstance().enableContactsAccess();
ContactsManager.getInstance().fetchContacts();
fetchedContactsOnce = true;
}
ContactsManager.getInstance().fetchContacts();
fetchedContactsOnce = true;
break;
case PERMISSIONS_RECORD_AUDIO_ECHO_CANCELLER:
if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {

View file

@ -170,7 +170,7 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
mLinphoneFactoryConfigFile = basePath + "/linphonerc";
mLinphoneConfigFile = basePath + "/.linphonerc";
mLinphoneRootCaFile = basePath + "/rootca.pem";
mRingSoundFile = basePath + "/oldphone_mono.wav";
mRingSoundFile = basePath + "/notes_of_the_optimistic.mkv";
mRingbackSoundFile = basePath + "/ringback.wav";
mPauseSoundFile = basePath + "/hold.mkv";
mChatDatabaseFile = basePath + "/linphone-history.db";
@ -691,12 +691,7 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
} catch (NameNotFoundException e) {
Log.e(e, "cannot get version name");
}
mLc.setRing(mRingSoundFile);
if (mR.getBoolean(R.bool.use_linphonecore_ringing)) {
disableRinging();
} else {
mLc.setRing(null); //We'll use the android media player api to play the ringtone
}
mLc.setRingback(mRingbackSoundFile);
mLc.setRootCA(mLinphoneRootCaFile);
mLc.setPlayFile(mPauseSoundFile);
@ -706,6 +701,7 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
mLc.setUserCertificatesPath(mUserCertificatePath);
subscribeFriendList(mPrefs.isFriendlistsubscriptionEnabled());
//mLc.setCallErrorTone(Reason.NotFound, mErrorToneFile);
enableDeviceRingtone(mPrefs.isDeviceRingtoneEnabled());
int availableCores = Runtime.getRuntime().availableProcessors();
Log.w("MediaStreamer : " + availableCores + " cores detected and configured");
@ -734,7 +730,7 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
}
private void copyAssetsFromPackage() throws IOException {
copyIfNotExist(R.raw.oldphone_mono, mRingSoundFile);
copyIfNotExist(R.raw.notes_of_the_optimistic, mRingSoundFile);
copyIfNotExist(R.raw.ringback, mRingbackSoundFile);
copyIfNotExist(R.raw.hold, mPauseSoundFile);
copyIfNotExist(R.raw.incoming_chat, mErrorToneFile);
@ -998,7 +994,7 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
}
}
if (state == State.IncomingReceived && mR.getBoolean(R.bool.auto_answer_calls)) {
if (state == State.IncomingReceived && LinphonePreferences.instance().isAutoAnswerEnabled()) {
try {
mLc.acceptCall(call);
} catch (LinphoneCoreException e) {
@ -1122,11 +1118,6 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
}
private boolean isRinging;
private boolean disableRinging = false;
public void disableRinging() {
disableRinging = true;
}
private void requestAudioFocus(){
if (!mAudioFocused){
@ -1135,12 +1126,21 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
if (res == AudioManager.AUDIOFOCUS_REQUEST_GRANTED) mAudioFocused=true;
}
}
public void enableDeviceRingtone(boolean use) {
if (use) {
mLc.setRing(null);
} else {
mLc.setRing(mRingSoundFile);
}
}
private synchronized void startRinging() {
if (disableRinging) {
if (!LinphonePreferences.instance().isDeviceRingtoneEnabled()) {
routeAudioToSpeaker();
return;
}
if (mR.getBoolean(R.bool.allow_ringing_while_early_media)) {
routeAudioToSpeaker(); // Need to be able to ear the ringtone during the early media
}

View file

@ -1337,4 +1337,28 @@ public class LinphonePreferences {
}
return firstTime;
}
public boolean isDeviceRingtoneEnabled() {
return getConfig().getBool("app", "device_ringtone", true);
}
public void enableDeviceRingtone(boolean enable) {
getConfig().setBool("app", "device_ringtone", enable);
}
public boolean isBisFeatureEnabled() {
return getConfig().getBool("app", "bis_feature", true);
}
public void enableBisFeature(boolean enable) {
getConfig().setBool("app", "bis_feature", enable);
}
public boolean isAutoAnswerEnabled() {
return getConfig().getBool("app", "auto_answer", false);
}
public void enableAutoAnswer(boolean enable) {
getConfig().setBool("app", "auto_answer", enable);
}
}

View file

@ -166,11 +166,6 @@ public class SettingsFragment extends PreferencesListFragment {
hidePreference(R.string.pref_in_app_store_key);
}
if (getResources().getBoolean(R.bool.disable_animations)) {
uncheckAndHidePreference(R.string.pref_animation_enable_key);
}
if (getResources().getBoolean(R.bool.disable_chat)) {
findPreference(getString(R.string.pref_image_sharing_server_key)).setLayoutResource(R.layout.hidden);
}
@ -776,9 +771,14 @@ public class SettingsFragment extends PreferencesListFragment {
}
private void initCallSettings() {
CheckBoxPreference deviceRingtone = (CheckBoxPreference) findPreference(getString(R.string.pref_device_ringtone_key));
CheckBoxPreference autoAnswer = (CheckBoxPreference) findPreference(getString(R.string.pref_auto_answer_key));
CheckBoxPreference rfc2833 = (CheckBoxPreference) findPreference(getString(R.string.pref_rfc2833_dtmf_key));
CheckBoxPreference sipInfo = (CheckBoxPreference) findPreference(getString(R.string.pref_sipinfo_dtmf_key));
deviceRingtone.setChecked(mPrefs.isDeviceRingtoneEnabled());
autoAnswer.setChecked(mPrefs.isAutoAnswerEnabled());
if (mPrefs.useRfc2833Dtmfs()) {
rfc2833.setChecked(true);
sipInfo.setChecked(false);
@ -793,6 +793,45 @@ public class SettingsFragment extends PreferencesListFragment {
}
private void setCallPreferencesListener() {
findPreference(getString(R.string.pref_device_ringtone_key)).setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
boolean use = (Boolean) newValue;
mPrefs.enableDeviceRingtone(use);
LinphoneManager.getInstance().enableDeviceRingtone(use);
return true;
}
});
findPreference(getString(R.string.pref_media_encryption_key)).setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
String value = newValue.toString();
MediaEncryption menc = MediaEncryption.None;
if (value.equals(getString(R.string.pref_media_encryption_key_srtp)))
menc = MediaEncryption.SRTP;
else if (value.equals(getString(R.string.pref_media_encryption_key_zrtp)))
menc = MediaEncryption.ZRTP;
else if (value.equals(getString(R.string.pref_media_encryption_key_dtls)))
menc = MediaEncryption.DTLS;
mPrefs.setMediaEncryption(menc);
preference.setSummary(mPrefs.getMediaEncryption().toString());
return true;
}
});
initMediaEncryptionPreference((ListPreference) findPreference(getString(R.string.pref_media_encryption_key)));
findPreference(getString(R.string.pref_auto_answer_key)).setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
boolean use = (Boolean) newValue;
mPrefs.enableAutoAnswer(use);
return true;
}
});
findPreference(getString(R.string.pref_rfc2833_dtmf_key)).setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
@ -871,8 +910,6 @@ public class SettingsFragment extends PreferencesListFragment {
}
private void initNetworkSettings() {
initMediaEncryptionPreference((ListPreference) findPreference(getString(R.string.pref_media_encryption_key)));
((CheckBoxPreference) findPreference(getString(R.string.pref_wifi_only_key))).setChecked(mPrefs.isWifiOnlyEnabled());
// Disable UPnP if ICE si enabled, or disable ICE if UPnP is enabled
@ -972,24 +1009,6 @@ public class SettingsFragment extends PreferencesListFragment {
}
});
findPreference(getString(R.string.pref_media_encryption_key)).setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
String value = newValue.toString();
MediaEncryption menc = MediaEncryption.None;
if (value.equals(getString(R.string.pref_media_encryption_key_srtp)))
menc = MediaEncryption.SRTP;
else if (value.equals(getString(R.string.pref_media_encryption_key_zrtp)))
menc = MediaEncryption.ZRTP;
else if (value.equals(getString(R.string.pref_media_encryption_key_dtls)))
menc = MediaEncryption.DTLS;
mPrefs.setMediaEncryption(menc);
preference.setSummary(mPrefs.getMediaEncryption().toString());
return true;
}
});
findPreference(getString(R.string.pref_push_notification_key)).setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {

View file

@ -143,6 +143,20 @@ public class StatusFragment extends Fragment {
};
isAttached = true;
Activity activity = getActivity();
if (activity instanceof LinphoneActivity) {
((LinphoneActivity) activity).updateStatusFragment(this);
isInCall = false;
} else if (activity instanceof CallActivity) {
((CallActivity) activity).updateStatusFragment(this);
isInCall = true;
} else if (activity instanceof AssistantActivity) {
((AssistantActivity) activity).updateStatusFragment(this);
isInCall = false;
}
return view;
}
@ -158,23 +172,6 @@ public class StatusFragment extends Fragment {
}
}
@Override
public void onAttach(Activity activity) {
super.onAttach((Context)activity);
isAttached = true;
if (activity instanceof LinphoneActivity) {
((LinphoneActivity) activity).updateStatusFragment(this);
isInCall = false;
} else if (activity instanceof CallActivity) {
((CallActivity) activity).updateStatusFragment(this);
isInCall = true;
} else if (activity instanceof AssistantActivity) {
((AssistantActivity) activity).updateStatusFragment(this);
isInCall = false;
}
}
@Override
public void onDetach() {
super.onDetach();

View file

@ -19,6 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
package org.linphone.ui;
import org.linphone.LinphoneManager;
import org.linphone.LinphonePreferences;
import org.linphone.R;
import org.linphone.core.CallDirection;
import org.linphone.core.LinphoneCallLog;
@ -54,7 +55,7 @@ public class CallButton extends ImageView implements OnClickListener, AddressAwa
if (mAddress.getText().length() > 0) {
LinphoneManager.getInstance().newOutgoingCall(mAddress);
} else {
if (getContext().getResources().getBoolean(R.bool.call_last_log_if_adress_is_empty)) {
if (LinphonePreferences.instance().isBisFeatureEnabled()) {
LinphoneCallLog[] logs = LinphoneManager.getLc().getCallLogs();
LinphoneCallLog log = null;
for (LinphoneCallLog l : logs) {