Skip to content

Commit

Permalink
Update SettingsActivity.java
Browse files Browse the repository at this point in the history
fixed fragment for tablets
  • Loading branch information
jamenlang committed Sep 5, 2015
1 parent cd824bf commit fc1a8f1
Showing 1 changed file with 69 additions and 2 deletions.
71 changes: 69 additions & 2 deletions app/src/main/java/com/airlim/garagetrois/SettingsActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,75 @@ public void onCreate(Bundle savedInstanceState) {
// to their values. When their values change, their summaries are
// updated to reflect the new value, per the Android Design
// guidelines.
bindPreferenceSummaryToValue(findPreference("example_text"));
bindPreferenceSummaryToValue(findPreference("example_list"));
//bindPreferenceSummaryToValue(findPreference("example_text"));
//bindPreferenceSummaryToValue(findPreference("example_list"));

}
}
public static class ServerPreferenceFragment extends PreferenceFragment {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.pref_server_settings);

// Bind the summaries of EditText/List/Dialog/Ringtone preferences
// to their values. When their values change, their summaries are
// updated to reflect the new value, per the Android Design
// guidelines.
//bindPreferenceSummaryToValue(findPreference("example_text"));
//bindPreferenceSummaryToValue(findPreference("example_list"));
bindPreferenceSummaryToValue(findPreference("server_URL"));
bindPreferenceSummaryToValue(findPreference("script_path"));
bindPreferenceSummaryToValue(findPreference("script_name"));
bindPreferenceSummaryToValue(findPreference("sleepytime"));
}
}
public static class AuthenticationPreferenceFragment extends PreferenceFragment {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.pref_authentication_settings);

// Bind the summaries of EditText/List/Dialog/Ringtone preferences
// to their values. When their values change, their summaries are
// updated to reflect the new value, per the Android Design
// guidelines.
//bindPreferenceSummaryToValue(findPreference("example_text"));
//bindPreferenceSummaryToValue(findPreference("example_list"));

}
}
public static class OtherPreferenceFragment extends PreferenceFragment {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.pref_other_settings);

// Bind the summaries of EditText/List/Dialog/Ringtone preferences
// to their values. When their values change, their summaries are
// updated to reflect the new value, per the Android Design
// guidelines.
//bindPreferenceSummaryToValue(findPreference("example_text"));
//bindPreferenceSummaryToValue(findPreference("example_list"));

}
}

private final String[] FRAGMENTS = {
"com.airlim.garagetrois.SettingsActivity$GeneralPreferenceFragment",
"com.airlim.garagetrois.SettingsActivity$ServerPreferenceFragment",
"com.airlim.garagetrois.SettingsActivity$AuthenticationPreferenceFragment",
"com.airlim.garagetrois.SettingsActivity$OtherPreferenceFragment"
};

@Override
protected boolean isValidFragment(String fragmentName) {

for (String FRAGMENT : FRAGMENTS) {
if (FRAGMENT.equals(fragmentName)) {
return true;
}
}
return super.isValidFragment(fragmentName);
}
}

0 comments on commit fc1a8f1

Please sign in to comment.