when action-bar-equipped device tries to hide title bar warn and then

disable pref.
This commit is contained in:
Eric House 2013-11-19 07:22:14 -08:00
parent 63ba7d45d3
commit 51a561077c
2 changed files with 25 additions and 2 deletions

View file

@ -2181,4 +2181,7 @@
<string name="enable_nfc">NFC is turned off on this device. Use
the Android Settings app to turn it on .</string>
<string name="button_go_settings">Launch Settings</string>
<string name="no_hide_titlebar">This setting is ignored on devices
like yours that depend on the \"Action bar\".</string>
</resources>

View file

@ -19,13 +19,15 @@
*/
package org.eehouse.android.xw4;
import android.app.AlertDialog;
import android.app.Dialog;
import android.preference.PreferenceActivity;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.CheckBoxPreference;
import android.preference.PreferenceActivity;
import android.preference.PreferenceManager;
import android.view.View;
import android.widget.Button;
@ -37,6 +39,7 @@ public class PrefsActivity extends PreferenceActivity
private static final int REVERT_COLORS = 1;
private static final int REVERT_ALL = 2;
public static final int CONFIRM_SMS = 3;
public static final int EXPLAIN_TITLE = 4;
private String m_keyLogging;
private String m_smsToasting;
@ -44,6 +47,7 @@ public class PrefsActivity extends PreferenceActivity
private String m_downloadPath;
private String m_thumbEnabled;
private String m_thumbSize;
private String m_hideTitle;
@Override
@ -100,6 +104,13 @@ public class PrefsActivity extends PreferenceActivity
case CONFIRM_SMS:
dialog = SMSCheckBoxPreference.onCreateDialog( this, id );
break;
case EXPLAIN_TITLE:
dialog = new AlertDialog.Builder( this )
.setMessage( R.string.no_hide_titlebar )
.setTitle( R.string.info_title )
.setPositiveButton( R.string.button_ok, null )
.create();
break;
}
if ( null == dialog && null != lstnr ) {
@ -128,6 +139,7 @@ public class PrefsActivity extends PreferenceActivity
m_downloadPath = getString( R.string.key_download_path );
m_thumbEnabled = getString( R.string.key_thumb_enabled );
m_thumbSize = getString( R.string.key_thumbsize );
m_hideTitle = getString( R.string.key_hide_title );
Button button = (Button)findViewById( R.id.revert_colors );
button.setOnClickListener( new View.OnClickListener() {
@ -193,7 +205,15 @@ public class PrefsActivity extends PreferenceActivity
} else if ( key.equals( m_thumbEnabled )
|| key.equals( m_thumbSize ) ) {
DBUtils.clearThumbnails( this );
}
} else if ( key.equals( m_hideTitle ) ) {
if ( sp.getBoolean( key, false ) && ABUtils.haveActionBar() ) {
CheckBoxPreference pref
= (CheckBoxPreference)findPreference(key);
pref.setChecked( false );
pref.setEnabled( false );
showDialog( EXPLAIN_TITLE );
}
}
}
private void relaunch()