Exit button replaced by background mode advanced setting (back when on dialer to exit) + top bar can be scrolled again

This commit is contained in:
Sylvain Berfini 2013-01-29 17:49:29 +01:00
parent 79a6e9c9be
commit 481790d2f9
9 changed files with 23 additions and 30 deletions

View file

@ -216,19 +216,6 @@
android:adjustViewBounds="true"
android:visibility="gone"
android:layout_alignParentRight="true" />
<TextView
android:id="@+id/exit"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentRight="true"
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

@ -372,4 +372,6 @@
<string name="call_state_missed">Manqué</string>
<string name="call_state_outgoing">Émis</string>
<string name="call_state_incoming">Reçu</string>
<string name="pref_background_mode">Actif en arrière plan</string>
</resources>

View file

@ -32,7 +32,7 @@
<bool name="disable_animations">false</bool>
<bool name="show_statusbar_only_on_dialer">true</bool>
<bool name="lock_statusbar">true</bool>
<bool name="lock_statusbar">false</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

@ -61,4 +61,5 @@
<bool name="pref_sipinfo_dtmf_default">false</bool>
<bool name="pref_rfc2833_dtmf_default">true</bool>
<bool name="pref_background_mode_default">true</bool>
</resources>

View file

@ -92,6 +92,7 @@
<string name="pref_media_encryption_key_none">none</string>
<string name="pref_media_encryption_key_srtp">srtp</string>
<string name="pref_media_encryption_key_zrtp">zrtp</string>
<string name="pref_background_mode_key">pref_background_mode_key</string>
<string name="push_reg_id_key">push_reg_id_key</string>
<string name="push_sender_id_key">push_sender_id_key</string>

View file

@ -419,4 +419,6 @@
<string name="call_state_missed">Missed</string>
<string name="call_state_outgoing">Outgoing</string>
<string name="call_state_incoming">Incoming</string>
<string name="pref_background_mode">Background mode</string>
</resources>

View file

@ -283,6 +283,11 @@
android:title="@string/pref_debug"
android:defaultValue="@bool/pref_debug_default"/>
<CheckBoxPreference
android:key="@string/pref_background_mode_key"
android:title="@string/pref_background_mode"
android:defaultValue="@bool/pref_background_mode_default"/>
<CheckBoxPreference
android:defaultValue="@bool/pref_animation_enable_default"
android:title="@string/pref_animation_enable_title"

View file

@ -1242,6 +1242,10 @@ public class LinphoneActivity extends FragmentActivity implements
@Override
protected void onResume() {
super.onResume();
if (!LinphoneService.isReady()) {
startService(new Intent(ACTION_MAIN).setClass(this, LinphoneService.class));
}
// Remove to avoid duplication of the listeners
LinphoneManager.removeListener(this);
@ -1255,6 +1259,7 @@ public class LinphoneActivity extends FragmentActivity implements
chatStorage = new ChatStorage(this);
updateMissedChatCount();
displayMissedCalls(LinphoneManager.getLc().getMissedCallsCount());
if (LinphoneManager.getLc().getCalls().length > 0) {
@ -1360,7 +1365,11 @@ public class LinphoneActivity extends FragmentActivity implements
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
if (currentFragment == FragmentsAvailable.DIALER) {
if (LinphoneUtils.onKeyBackGoHome(this, keyCode, event)) {
boolean isBackgroundModeActive = PreferenceManager.getDefaultSharedPreferences(this).getBoolean(getString(R.string.pref_background_mode_key), getResources().getBoolean(R.bool.pref_background_mode_default));
if (!isBackgroundModeActive) {
stopService(new Intent(Intent.ACTION_MAIN).setClass(this, LinphoneService.class));
finish();
} else if (LinphoneUtils.onKeyBackGoHome(this, keyCode, event)) {
return true;
}
} else if (!isTablet()) {

View file

@ -43,7 +43,6 @@ 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;
@ -61,7 +60,7 @@ import android.widget.Toast;
public class StatusFragment extends Fragment {
private Handler mHandler = new Handler();
private Handler refreshHandler = new Handler();
private TextView statusText, exit;
private TextView statusText;
private ImageView statusLed, callQuality, encryption, background;
private ListView sliderContentAccounts;
private TableLayout callStats;
@ -98,17 +97,6 @@ public class StatusFragment extends Fragment {
});
sliderContentAccounts = (ListView) view.findViewById(R.id.accounts);
exit = (TextView) view.findViewById(R.id.exit);
exit.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
if (LinphoneActivity.isInstanciated()) {
LinphoneActivity.instance().exit();
}
return true;
}
});
// We create it once to not delay the first display
populateSliderContent();
@ -330,7 +318,6 @@ public class StatusFragment extends Fragment {
refreshStatusItems(call, call.getCurrentParamsCopy().getVideoEnabled());
}
exit.setVisibility(View.GONE);
statusText.setVisibility(View.GONE);
encryption.setVisibility(View.VISIBLE);
@ -338,7 +325,6 @@ public class StatusFragment extends Fragment {
statusLed.setImageResource(R.drawable.led_connected);
statusText.setText(getString(R.string.status_connected));
} else {
exit.setVisibility(View.VISIBLE);
statusText.setVisibility(View.VISIBLE);
background.setVisibility(View.VISIBLE);
encryption.setVisibility(View.GONE);