Fix call errors and add portrait support for tablet
This commit is contained in:
parent
7f39dcf561
commit
0b867f947f
4 changed files with 51 additions and 15 deletions
|
@ -567,7 +567,6 @@ public class ContactsManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
contactCursor = getFriendListCursor(contactList,true);
|
contactCursor = getFriendListCursor(contactList,true);
|
||||||
Log.w(contactCursor.getCount());
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -77,6 +77,8 @@ import android.view.animation.AnimationUtils;
|
||||||
import android.widget.AdapterView;
|
import android.widget.AdapterView;
|
||||||
import android.widget.ArrayAdapter;
|
import android.widget.ArrayAdapter;
|
||||||
import android.widget.BaseAdapter;
|
import android.widget.BaseAdapter;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.EditText;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.ListView;
|
import android.widget.ListView;
|
||||||
|
@ -133,9 +135,7 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
if (isTablet() && getRequestedOrientation() != ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE) {
|
if (getResources().getBoolean(R.bool.orientation_portrait_only)) {
|
||||||
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
|
|
||||||
} else if (getResources().getBoolean(R.bool.orientation_portrait_only)) {
|
|
||||||
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -233,9 +233,9 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
|
||||||
// Convert LinphoneCore message for internalization
|
// Convert LinphoneCore message for internalization
|
||||||
if (message != null && call.getErrorInfo().getReason() == Reason.Declined) {
|
if (message != null && call.getErrorInfo().getReason() == Reason.Declined) {
|
||||||
displayCustomToast(getString(R.string.error_call_declined), Toast.LENGTH_SHORT);
|
displayCustomToast(getString(R.string.error_call_declined), Toast.LENGTH_SHORT);
|
||||||
} else if (message != null && call.getReason() == Reason.NotFound) {
|
} else if (message != null && call.getErrorInfo().getReason() == Reason.NotFound) {
|
||||||
displayCustomToast(getString(R.string.error_user_not_found), Toast.LENGTH_SHORT);
|
displayCustomToast(getString(R.string.error_user_not_found), Toast.LENGTH_SHORT);
|
||||||
} else if (message != null && call.getReason() == Reason.Media) {
|
} else if (message != null && call.getErrorInfo().getReason() == Reason.Media) {
|
||||||
displayCustomToast(getString(R.string.error_incompatible_media), Toast.LENGTH_SHORT);
|
displayCustomToast(getString(R.string.error_incompatible_media), Toast.LENGTH_SHORT);
|
||||||
} else if (message != null && state == State.Error) {
|
} else if (message != null && state == State.Error) {
|
||||||
displayCustomToast(getString(R.string.error_unknown) + " - " + message, Toast.LENGTH_SHORT);
|
displayCustomToast(getString(R.string.error_unknown) + " - " + message, Toast.LENGTH_SHORT);
|
||||||
|
@ -313,7 +313,6 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
|
||||||
}
|
}
|
||||||
|
|
||||||
findViewById(R.id.status).setVisibility(View.GONE);
|
findViewById(R.id.status).setVisibility(View.GONE);
|
||||||
findViewById(R.id.fragmentContainer).setPadding(0, 0, 0, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void showStatusBar() {
|
public void showStatusBar() {
|
||||||
|
@ -849,6 +848,7 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
|
||||||
missedCalls.startAnimation(AnimationUtils.loadAnimation(LinphoneActivity.this, R.anim.bounce));
|
missedCalls.startAnimation(AnimationUtils.loadAnimation(LinphoneActivity.this, R.anim.bounce));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
LinphoneManager.getLc().resetMissedCallsCount();
|
||||||
missedCalls.clearAnimation();
|
missedCalls.clearAnimation();
|
||||||
missedCalls.setVisibility(View.GONE);
|
missedCalls.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
@ -892,7 +892,7 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
|
||||||
Drawable d = new ColorDrawable(getResources().getColor(R.color.colorC));
|
Drawable d = new ColorDrawable(getResources().getColor(R.color.colorC));
|
||||||
d.setAlpha(200);
|
d.setAlpha(200);
|
||||||
dialog.setContentView(R.layout.dialog);
|
dialog.setContentView(R.layout.dialog);
|
||||||
dialog.getWindow().setLayout(WindowManager.LayoutParams.MATCH_PARENT,WindowManager.LayoutParams.MATCH_PARENT);
|
dialog.getWindow().setLayout(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT);
|
||||||
dialog.getWindow().setBackgroundDrawable(d);
|
dialog.getWindow().setBackgroundDrawable(d);
|
||||||
|
|
||||||
TextView customText = (TextView) dialog.findViewById(R.id.customText);
|
TextView customText = (TextView) dialog.findViewById(R.id.customText);
|
||||||
|
@ -900,6 +900,42 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
|
||||||
return dialog;
|
return dialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Dialog displayWrongPasswordDialog(final String username, final String realm, final String domain){
|
||||||
|
final Dialog dialog = new Dialog(this);
|
||||||
|
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||||
|
Drawable d = new ColorDrawable(getResources().getColor(R.color.colorC));
|
||||||
|
d.setAlpha(200);
|
||||||
|
dialog.setContentView(R.layout.input_dialog);
|
||||||
|
dialog.getWindow().setLayout(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT);
|
||||||
|
dialog.getWindow().setBackgroundDrawable(d);
|
||||||
|
|
||||||
|
TextView customText = (TextView) dialog.findViewById(R.id.customText);
|
||||||
|
customText.setText(getString(R.string.error_bad_credentials));
|
||||||
|
|
||||||
|
Button retry = (Button) dialog.findViewById(R.id.retry);
|
||||||
|
Button cancel = (Button) dialog.findViewById(R.id.cancel);
|
||||||
|
|
||||||
|
retry.setOnClickListener(new OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
String newPassword = ((EditText) dialog.findViewById(R.id.password)).getText().toString();
|
||||||
|
LinphoneAuthInfo authInfo = LinphoneCoreFactory.instance().createAuthInfo(username, null, newPassword, null, realm, domain);
|
||||||
|
LinphoneManager.getLc().addAuthInfo(authInfo);
|
||||||
|
LinphoneManager.getLc().refreshRegisters();
|
||||||
|
dialog.dismiss();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
cancel.setOnClickListener(new OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
dialog.dismiss();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return dialog;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setAddresGoToDialerAndCall(String number, String name, Uri photo) {
|
public void setAddresGoToDialerAndCall(String number, String name, Uri photo) {
|
||||||
// Bundle extras = new Bundle();
|
// Bundle extras = new Bundle();
|
||||||
|
|
|
@ -50,9 +50,7 @@ public class LinphoneLauncherActivity extends Activity {
|
||||||
new Log(getResources().getString(R.string.app_name), !getResources().getBoolean(R.bool.disable_every_log));
|
new Log(getResources().getString(R.string.app_name), !getResources().getBoolean(R.bool.disable_every_log));
|
||||||
|
|
||||||
// Hack to avoid to draw twice LinphoneActivity on tablets
|
// Hack to avoid to draw twice LinphoneActivity on tablets
|
||||||
if (getResources().getBoolean(R.bool.isTablet)) {
|
if (getResources().getBoolean(R.bool.orientation_portrait_only)) {
|
||||||
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
|
|
||||||
} else if (getResources().getBoolean(R.bool.orientation_portrait_only)) {
|
|
||||||
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
||||||
}
|
}
|
||||||
setContentView(R.layout.launch_screen);
|
setContentView(R.layout.launch_screen);
|
||||||
|
|
|
@ -713,9 +713,9 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
|
||||||
lInputStream.close();
|
lInputStream.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void loadConfig(int config_rc){
|
public void loadConfig(){
|
||||||
try {
|
try {
|
||||||
copyIfNotExist(config_rc, mConfigFile);
|
copyIfNotExist(R.raw.configrc, mConfigFile);
|
||||||
} catch (Exception e){
|
} catch (Exception e){
|
||||||
Log.w(e);
|
Log.w(e);
|
||||||
}
|
}
|
||||||
|
@ -824,7 +824,11 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
|
||||||
private Vibrator mVibrator;
|
private Vibrator mVibrator;
|
||||||
|
|
||||||
public void displayWarning(LinphoneCore lc, String message) {}
|
public void displayWarning(LinphoneCore lc, String message) {}
|
||||||
public void authInfoRequested(LinphoneCore lc, String realm, String username, String domain) {}
|
|
||||||
|
public void authInfoRequested(LinphoneCore lc, String realm, String username, String domain) {
|
||||||
|
//Dialog authInfoPassword = LinphoneActivity.instance().displayPasswordDialog(username, realm, domain);
|
||||||
|
//authInfoPassword.show();
|
||||||
|
}
|
||||||
public void byeReceived(LinphoneCore lc, String from) {}
|
public void byeReceived(LinphoneCore lc, String from) {}
|
||||||
public void displayMessage(LinphoneCore lc, String message) {}
|
public void displayMessage(LinphoneCore lc, String message) {}
|
||||||
public void show(LinphoneCore lc) {}
|
public void show(LinphoneCore lc) {}
|
||||||
|
@ -1288,7 +1292,6 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
|
||||||
Log.i("proximity sensor already active for " + activity.getLocalClassName());
|
Log.i("proximity sensor already active for " + activity.getLocalClassName());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sProximityDependentActivities.isEmpty()) {
|
if (sProximityDependentActivities.isEmpty()) {
|
||||||
SensorManager sm = (SensorManager) activity.getSystemService(Context.SENSOR_SERVICE);
|
SensorManager sm = (SensorManager) activity.getSystemService(Context.SENSOR_SERVICE);
|
||||||
Sensor s = sm.getDefaultSensor(Sensor.TYPE_PROXIMITY);
|
Sensor s = sm.getDefaultSensor(Sensor.TYPE_PROXIMITY);
|
||||||
|
|
Loading…
Reference in a new issue