Slightly changed behavior for exit button and drawer, forcing user to press menu to open it to improve exit button handling

This commit is contained in:
Sylvain Berfini 2013-01-08 15:17:43 +01:00
parent 43f66a1ba6
commit 02806e8966
4 changed files with 24 additions and 15 deletions

View file

@ -219,15 +219,16 @@
<TextView
android:id="@+id/exit"
android:text="@string/menu_exit"
android:textColor="@android:color/white"
android:textSize="18dp"
android:layout_centerVertical="true"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:layout_alignParentRight="true"
android:paddingRight="10dp" />
android:layout_centerVertical="true"
android:gravity="center_vertical"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:text="@string/menu_exit"
android:textColor="@android:color/white"
android:textSize="18dp" />
</RelativeLayout>

View file

@ -29,7 +29,7 @@
<bool name="disable_animations">false</bool>
<bool name="show_statusbar_only_on_dialer">true</bool>
<bool name="lock_statusbar">false</bool>
<bool name="lock_statusbar">true</bool>
<bool name="emoticons_in_messages">true</bool>
<bool name="only_display_username_if_unknown">true</bool>
<bool name="display_messages_time_and_status">true</bool> <!-- Used to show the time of each message arrival -->

View file

@ -1375,7 +1375,7 @@ public class LinphoneActivity extends FragmentActivity implements
}
} else if (keyCode == KeyEvent.KEYCODE_MENU && statusFragment != null) {
if (event.getRepeatCount() < 1) {
statusFragment.openOrCloseStatusBar();
statusFragment.openOrCloseStatusBar(true);
}
}
return super.onKeyDown(keyCode, event);

View file

@ -43,6 +43,7 @@ import android.preference.PreferenceManager;
import android.support.v4.app.Fragment;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
@ -99,12 +100,13 @@ public class StatusFragment extends Fragment {
sliderContentAccounts = (ListView) view.findViewById(R.id.accounts);
exit = (TextView) view.findViewById(R.id.exit);
exit.setOnClickListener(new OnClickListener() {
exit.setOnTouchListener(new View.OnTouchListener() {
@Override
public void onClick(View v) {
public boolean onTouch(View v, MotionEvent event) {
if (LinphoneActivity.isInstanciated()) {
LinphoneActivity.instance().exit();
}
return true;
}
});
@ -135,7 +137,11 @@ public class StatusFragment extends Fragment {
}
public void openOrCloseStatusBar() {
if (getResources().getBoolean(R.bool.lock_statusbar)) {
openOrCloseStatusBar(false);
}
public void openOrCloseStatusBar(boolean force) {
if (getResources().getBoolean(R.bool.lock_statusbar) && !force) {
return;
}
@ -535,7 +541,9 @@ public class StatusFragment extends Fragment {
private List<CheckBox> checkboxes;
AccountsListAdapter() {
prefs = PreferenceManager.getDefaultSharedPreferences(getActivity());
if (LinphoneActivity.isInstanciated()) {
prefs = PreferenceManager.getDefaultSharedPreferences(LinphoneActivity.instance());
}
checkboxes = new ArrayList<CheckBox>();
}
@ -612,7 +620,7 @@ public class StatusFragment extends Fragment {
isDefault.setChecked(false);
isDefault.setEnabled(true);
if (prefs.getInt(getString(R.string.pref_default_account_key), 0) == position) {
if (prefs != null && prefs.getInt(getString(R.string.pref_default_account_key), 0) == position) {
isDefault.setChecked(true);
isDefault.setEnabled(false);
status.setImageResource(getStatusIconResource(lpc.getState(), true));