hide (the right way) play-via-sms preference on non-gsm phones

This commit is contained in:
Eric House 2015-01-26 07:06:43 -08:00
parent 74ce8116ea
commit 5f5e35e885
4 changed files with 698 additions and 678 deletions

File diff suppressed because it is too large Load diff

View file

@ -58,6 +58,7 @@
<string name="key_notify_sound">key_notify_sound</string>
<string name="key_notify_vibrate">key_notify_vibrate</string>
<string name="key_enable_sms">key_enable_sms</string>
<string name="key_network_behavior">key_network_behavior</string>
<string name="key_keep_screenon">key_keep_screenon</string>
<string name="key_thumbsize">key_thumbsize3</string>
<string name="key_studyon">key_studyon</string>

View file

@ -265,6 +265,7 @@
<PreferenceScreen android:title="@string/network_behavior"
android:summary="@string/network_behavior_summary"
android:key="@string/key_network_behavior"
>
<org.eehouse.android.xw4.SMSCheckBoxPreference
android:key="@string/key_enable_sms"

View file

@ -27,8 +27,10 @@ import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.CheckBoxPreference;
import android.preference.ListPreference;
import android.preference.Preference;
import android.preference.PreferenceActivity;
import android.preference.PreferenceManager;
import android.preference.PreferenceScreen;
import android.view.View;
import android.widget.Button;
import java.io.File;
@ -157,6 +159,8 @@ public class PrefsDelegate extends DelegateBase
} );
setupLangPref();
hideStuff();
}
@Override
@ -260,4 +264,17 @@ public class PrefsDelegate extends DelegateBase
}
}
}
private void hideStuff()
{
if ( !XWApp.SMSSUPPORTED || !Utils.isGSMPhone( m_activity ) ) {
String key = getString( R.string.key_enable_sms );
Preference pref = m_activity.findPreference( key );
key = getString( R.string.key_network_behavior );
PreferenceScreen screen = (PreferenceScreen)
m_activity.findPreference( key );
screen.removePreference( pref );
}
}
}