Fix missing status bar when using back button
This commit is contained in:
parent
4ff6ae2d5f
commit
ac6361fe2a
2 changed files with 21 additions and 17 deletions
|
@ -137,7 +137,7 @@ public class DialerFragment extends Fragment {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
if (LinphoneActivity.isInstanciated()) {
|
if (LinphoneActivity.isInstanciated()) {
|
||||||
LinphoneActivity.instance().selectMenu(FragmentsAvailable.DIALER);
|
LinphoneActivity.instance().selectMenu(FragmentsAvailable.DIALER);
|
||||||
|
|
|
@ -59,6 +59,7 @@ import android.support.v4.app.Fragment;
|
||||||
import android.support.v4.app.Fragment.SavedState;
|
import android.support.v4.app.Fragment.SavedState;
|
||||||
import android.support.v4.app.FragmentActivity;
|
import android.support.v4.app.FragmentActivity;
|
||||||
import android.support.v4.app.FragmentManager;
|
import android.support.v4.app.FragmentManager;
|
||||||
|
import android.support.v4.app.FragmentManager.BackStackEntry;
|
||||||
import android.support.v4.app.FragmentTransaction;
|
import android.support.v4.app.FragmentTransaction;
|
||||||
import android.view.Gravity;
|
import android.view.Gravity;
|
||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
|
@ -197,20 +198,12 @@ public class LinphoneActivity extends FragmentActivity implements OnClickListene
|
||||||
}
|
}
|
||||||
|
|
||||||
private void hideStatusBar() {
|
private void hideStatusBar() {
|
||||||
if (statusFragment == null) {
|
findViewById(R.id.status).setVisibility(View.GONE);
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
statusFragment.getView().setVisibility(View.GONE);
|
|
||||||
findViewById(R.id.fragmentContainer).setPadding(0, 0, 0, 0);
|
findViewById(R.id.fragmentContainer).setPadding(0, 0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showStatusBar() {
|
private void showStatusBar() {
|
||||||
if (statusFragment == null || statusFragment.isVisible()) {
|
findViewById(R.id.status).setVisibility(View.VISIBLE);
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
statusFragment.getView().setVisibility(View.VISIBLE);
|
|
||||||
findViewById(R.id.fragmentContainer).setPadding(0, LinphoneUtils.pixelsToDpi(getResources(), 40), 0, 0);
|
findViewById(R.id.fragmentContainer).setPadding(0, LinphoneUtils.pixelsToDpi(getResources(), 40), 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -226,7 +219,9 @@ public class LinphoneActivity extends FragmentActivity implements OnClickListene
|
||||||
nextFragment = newFragmentType;
|
nextFragment = newFragmentType;
|
||||||
|
|
||||||
if (currentFragment == FragmentsAvailable.DIALER) {
|
if (currentFragment == FragmentsAvailable.DIALER) {
|
||||||
dialerSavedState = getSupportFragmentManager().saveFragmentInstanceState(dialerFragment);
|
try {
|
||||||
|
dialerSavedState = getSupportFragmentManager().saveFragmentInstanceState(dialerFragment);
|
||||||
|
} catch (Exception e) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
Fragment newFragment = null;
|
Fragment newFragment = null;
|
||||||
|
@ -1072,12 +1067,21 @@ public class LinphoneActivity extends FragmentActivity implements OnClickListene
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||||
if (keyCode == KeyEvent.KEYCODE_BACK && currentFragment == FragmentsAvailable.DIALER) {
|
if (keyCode == KeyEvent.KEYCODE_BACK) {
|
||||||
if (LinphoneUtils.onKeyBackGoHome(this, keyCode, event)) {
|
if (currentFragment == FragmentsAvailable.DIALER) {
|
||||||
return true;
|
if (LinphoneUtils.onKeyBackGoHome(this, keyCode, event)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
int backStackEntryCount = getSupportFragmentManager().getBackStackEntryCount();
|
||||||
|
if (backStackEntryCount == 1) {
|
||||||
|
showStatusBar();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (currentFragment == FragmentsAvailable.SETTINGS) {
|
||||||
|
reloadConfig();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (keyCode == KeyEvent.KEYCODE_BACK && currentFragment == FragmentsAvailable.SETTINGS) {
|
|
||||||
reloadConfig();
|
|
||||||
} else if (keyCode == KeyEvent.KEYCODE_MENU && statusFragment != null) {
|
} else if (keyCode == KeyEvent.KEYCODE_MENU && statusFragment != null) {
|
||||||
statusFragment.openOrCloseStatusBar();
|
statusFragment.openOrCloseStatusBar();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue