diff --git a/res/drawable-hdpi/mark.png b/res/drawable-hdpi/mark.png new file mode 100644 index 000000000..38aa8a2c5 Binary files /dev/null and b/res/drawable-hdpi/mark.png differ diff --git a/res/drawable-mdpi/mark.png b/res/drawable-mdpi/mark.png new file mode 100644 index 000000000..2abe401f2 Binary files /dev/null and b/res/drawable-mdpi/mark.png differ diff --git a/res/drawable-xlarge-land-hdpi/mark.png b/res/drawable-xlarge-land-hdpi/mark.png new file mode 100644 index 000000000..a2c57acc1 Binary files /dev/null and b/res/drawable-xlarge-land-hdpi/mark.png differ diff --git a/res/layout-hdpi/main.xml b/res/layout-hdpi/main.xml deleted file mode 100644 index eacf13737..000000000 --- a/res/layout-hdpi/main.xml +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/res/layout/main.xml b/res/layout/main.xml index b908b461b..cefba495d 100644 --- a/res/layout/main.xml +++ b/res/layout/main.xml @@ -5,9 +5,65 @@ android:layout_width="match_parent" android:layout_height="match_parent"> + + + + + + + + + + + + + + + - + + diff --git a/res/layout/settings.xml b/res/layout/settings.xml index 107110dfc..c8cdcd0e4 100644 --- a/res/layout/settings.xml +++ b/res/layout/settings.xml @@ -3,11 +3,66 @@ android:layout_width="match_parent" android:layout_height="match_parent"> + + + + + + + + + + + + + + + + android:layout_height="match_parent" /> - - + + Chat Call Add to contacts - CONNECTED - NOT CONNECTED - CONNECTING - ERROR + Registered + Not Registered + Registration in progress + Registration failed Number or address diff --git a/src/org/linphone/LinphoneActivity.java b/src/org/linphone/LinphoneActivity.java index afda1cf01..dd66776d6 100644 --- a/src/org/linphone/LinphoneActivity.java +++ b/src/org/linphone/LinphoneActivity.java @@ -60,8 +60,8 @@ import android.support.v4.app.FragmentTransaction; import android.view.KeyEvent; import android.view.OrientationEventListener; import android.view.View; -import android.view.ViewGroup; import android.view.View.OnClickListener; +import android.view.ViewGroup; import android.view.WindowManager; import android.view.animation.AnimationUtils; import android.widget.AdapterView; @@ -107,6 +107,7 @@ public class LinphoneActivity extends FragmentActivity implements OnClickListene @Override protected void onCreate(Bundle savedInstanceState) { + FragmentManager.enableDebugLogging(true); super.onCreate(savedInstanceState); if (!LinphoneManager.isInstanciated()) { @@ -124,18 +125,19 @@ public class LinphoneActivity extends FragmentActivity implements OnClickListene } setContentView(R.layout.main); + instance = this; initButtons(); - - if (LinphoneManager.isInstanciated()) { - LinphoneManager.addListener(this); - } + + currentFragment = FragmentsAvailable.DIALER; + if (savedInstanceState != null) { + return; + } if (findViewById(R.id.fragmentContainer) != null) { dialerFragment = new DialerFragment(); dialerFragment.setArguments(getIntent().getExtras()); getSupportFragmentManager().beginTransaction() .add(R.id.fragmentContainer, dialerFragment).commit(); - currentFragment = FragmentsAvailable.DIALER; } int missedCalls = LinphoneManager.getLc().getMissedCallsCount(); @@ -150,8 +152,6 @@ public class LinphoneActivity extends FragmentActivity implements OnClickListene LinphoneManager.getLc().setDeviceRotation(rotation); mAlwaysChangingPhoneAngle = rotation; - - instance = this; } private void initButtons() { @@ -174,7 +174,7 @@ public class LinphoneActivity extends FragmentActivity implements OnClickListene changeCurrentFragment(newFragmentType, extras, false); } - private void changeCurrentFragment(FragmentsAvailable newFragmentType, Bundle extras, boolean withoutAnimation) { + private void changeCurrentFragment(FragmentsAvailable newFragmentType, Bundle extras, boolean withoutAnimation) { if (newFragmentType == currentFragment && newFragmentType != FragmentsAvailable.CHAT) { return; } @@ -241,15 +241,16 @@ public class LinphoneActivity extends FragmentActivity implements OnClickListene } } try { - getSupportFragmentManager().popBackStack(newFragmentType.toString(), FragmentManager.POP_BACK_STACK_INCLUSIVE); + getSupportFragmentManager().popBackStackImmediate(newFragmentType.toString(), FragmentManager.POP_BACK_STACK_INCLUSIVE); } catch (java.lang.IllegalStateException e) { } transaction.addToBackStack(newFragmentType.toString()); transaction.replace(R.id.fragmentContainer, newFragment); - transaction.commitAllowingStateLoss(); + getSupportFragmentManager().executePendingTransactions(); + currentFragment = newFragmentType; } @@ -266,9 +267,6 @@ public class LinphoneActivity extends FragmentActivity implements OnClickListene transaction.addToBackStack(newFragmentType.toString()); transaction.replace(R.id.fragmentContainer2, newFragment); - - transaction.commitAllowingStateLoss(); - } else { if (!withoutAnimation && !getResources().getBoolean(R.bool.disable_animations) && currentFragment.shouldAnimate()) { if (newFragmentType.isRightOf(currentFragment)) { @@ -282,16 +280,17 @@ public class LinphoneActivity extends FragmentActivity implements OnClickListene ll.setVisibility(View.GONE); try { - getSupportFragmentManager().popBackStack(newFragmentType.toString(), FragmentManager.POP_BACK_STACK_INCLUSIVE); + getSupportFragmentManager().popBackStackImmediate(newFragmentType.toString(), FragmentManager.POP_BACK_STACK_INCLUSIVE); } catch (java.lang.IllegalStateException e) { } transaction.addToBackStack(newFragmentType.toString()); transaction.replace(R.id.fragmentContainer, newFragment); - - transaction.commitAllowingStateLoss(); } + transaction.commitAllowingStateLoss(); + getSupportFragmentManager().executePendingTransactions(); + currentFragment = newFragmentType; } @@ -787,13 +786,14 @@ public class LinphoneActivity extends FragmentActivity implements OnClickListene @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { + super.onActivityResult(resultCode, requestCode, data); if (resultCode == Activity.RESULT_FIRST_USER && requestCode == SETTINGS_ACTIVITY) { if (data.getExtras().getBoolean("Exit", false)) { exit(); } else { FragmentsAvailable newFragment = (FragmentsAvailable) data.getExtras().getSerializable("FragmentToDisplay"); - changeCurrentFragment(newFragment, null, true); selectMenu(newFragment); + changeCurrentFragment(newFragment, null, true); } } else if (requestCode == callActivity) { @@ -804,13 +804,14 @@ public class LinphoneActivity extends FragmentActivity implements OnClickListene resetClassicMenuLayoutAndGoBackToCallIfStillRunning(); } } - super.onActivityResult(resultCode, requestCode, data); } @Override - protected void onResume() { + protected void onResume() { super.onResume(); + LinphoneManager.addListener(this); + prepareContactsInBackground(); if (chatStorage != null) { @@ -832,6 +833,8 @@ public class LinphoneActivity extends FragmentActivity implements OnClickListene @Override protected void onDestroy() { + LinphoneManager.removeListener(this); + if (chatStorage != null) { chatStorage.close(); chatStorage = null; diff --git a/src/org/linphone/NetworkManager.java b/src/org/linphone/NetworkManager.java index 652f2c970..ae463d504 100644 --- a/src/org/linphone/NetworkManager.java +++ b/src/org/linphone/NetworkManager.java @@ -36,7 +36,9 @@ public class NetworkManager extends BroadcastReceiver { public void onReceive(Context context, Intent intent) { ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); Boolean lNoConnectivity = intent.getBooleanExtra(ConnectivityManager.EXTRA_NO_CONNECTIVITY,false); - LinphoneManager.getInstance().connectivityChanged(cm, lNoConnectivity); + if (LinphoneManager.isInstanciated()) { + LinphoneManager.getInstance().connectivityChanged(cm, lNoConnectivity); + } } } diff --git a/src/org/linphone/StatusFragment.java b/src/org/linphone/StatusFragment.java index a6c126807..79aea185a 100644 --- a/src/org/linphone/StatusFragment.java +++ b/src/org/linphone/StatusFragment.java @@ -175,7 +175,7 @@ public class StatusFragment extends Fragment { private int getStatusIconResource(LinphoneCore.RegistrationState state, boolean isDefaultAccount) { try { - boolean defaultAccountConnected = (isDefaultAccount && LinphoneManager.getLc().getDefaultProxyConfig().isRegistered()) || !isDefaultAccount; + boolean defaultAccountConnected = (isDefaultAccount && LinphoneManager.getLcIfManagerNotDestroyedOrNull().getDefaultProxyConfig().isRegistered()) || !isDefaultAccount; if (state == RegistrationState.RegistrationOk && defaultAccountConnected) { return R.drawable.led_connected; } else if (state == RegistrationState.RegistrationProgress) { @@ -194,7 +194,7 @@ public class StatusFragment extends Fragment { private String getStatusIconText(LinphoneCore.RegistrationState state) { try { - if (state == RegistrationState.RegistrationOk && LinphoneManager.getLc().getDefaultProxyConfig().isRegistered()) { + if (state == RegistrationState.RegistrationOk && LinphoneManager.getLcIfManagerNotDestroyedOrNull().getDefaultProxyConfig().isRegistered()) { return getString(R.string.status_connected); } else if (state == RegistrationState.RegistrationProgress) { return getString(R.string.status_in_progress);