Skip to content

Commit

Permalink
Minor text updates and a settings menu improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
Pikamander2 committed Sep 4, 2018
1 parent cf9be6b commit 447a9be
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import android.view.View;
import android.widget.Button;

import static android.preference.PreferenceActivity.EXTRA_SHOW_FRAGMENT;

public class MainActivity extends AppCompatActivity {

public final static String EXTRA_QUIZ_ID = "com.example.myfirstapp.MODE_ID";
Expand Down Expand Up @@ -72,7 +74,11 @@ public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();

if (id == R.id.action_settings) {
Intent intent = new Intent(this, SettingsActivity.class);
final Intent intent = new Intent(this, SettingsActivity.class);
intent.putExtra(EXTRA_SHOW_FRAGMENT, SettingsActivity.GeneralPreferenceFragment.class.getName());

/*intent.putExtra( SettingsActivity.EXTRA_SHOW_FRAGMENT, SettingsActivity.class.getName() );
intent.putExtra( SettingsActivity.EXTRA_NO_HEADERS, true );*/
//intent.putExtra(EXTRA_QUIZ_ID);
startActivity(intent);
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import android.preference.PreferenceFragment;
import android.preference.PreferenceManager;
import android.preference.RingtonePreference;
import android.preference.SwitchPreference;
import android.text.TextUtils;
import android.view.MenuItem;
import android.support.v4.app.NavUtils;
Expand Down Expand Up @@ -96,7 +97,17 @@ private static void bindPreferenceSummaryToValue(Preference preference) {

@Override
protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

/*
// By default, show MainPreferences
Intent intent = getIntent();
if (intent.getStringArrayExtra(EXTRA_SHOW_FRAGMENT) == null) {
getIntent().putExtra(EXTRA_SHOW_FRAGMENT, SwitchPreference.class.getName());
}
*/

setupActionBar();
}

Expand Down Expand Up @@ -159,6 +170,15 @@ protected boolean isValidFragment(String fragmentName) {
public static class GeneralPreferenceFragment extends PreferenceFragment {
@Override
public void onCreate(Bundle savedInstanceState) {

/*
// By default, show MainPreferences
Intent intent = getIntent();
if (intent.getStringArrayExtra(EXTRA_SHOW_FRAGMENT) == null) {
getIntent().putExtra(EXTRA_SHOW_FRAGMENT, SwitchPreference.class.getName());
}
*/

super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.pref_general);
setHasOptionsMenu(true);
Expand Down
12 changes: 3 additions & 9 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,6 @@
<color name="darkBG">#161622</color>
<color name="lightText">#FFFFFF</color>

<string name="ratingText">&quot;Please rate this app!&quot;</string>
<string name="radioButton1">Pizza</string>
<string name="radioButton2">Nachos</string>
<string name="radioButton3">Lemonade</string>
<string name="foodChoiceString">What kind of food will you bring?</string>
<string name="buttonStuff">Press to do stuff</string>
<string name="title_activity_display_message">DisplayMessageActivity</string>
<string name="placeholderDash">-</string>
<string name="buttonHiragana">Hiragana</string>
Expand All @@ -29,13 +23,13 @@

<!-- Example General settings -->
<string name="pref_header_general">General</string>
<string name="pref_title_easy_full">Easy/Full</string>
<string name="pref_description_easy_full">when activated, allow characters made of 2 symbols, such as ギョ</string>
<string name="pref_title_easy_full">Allow Yōon</string>
<string name="pref_description_easy_full">When activated, allow characters made of 2 symbols, such as キャ (kya)</string>

<string name="pref_title_display_name">Display name</string>
<string name="pref_default_display_name">John Smith</string>

<string name="pref_choices_title">How many proposals (2 is easy)</string>
<string name="pref_choices_title">Number of Answers</string>
<string-array name="pref_choices_list_entries">
<item>2</item>
<item>4</item>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/xml/pref_general.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
dismiss it. -->
<!-- NOTE: ListPreference's summary should be set to its value by the activity code. -->
<ListPreference
android:defaultValue="2"
android:defaultValue="4"
android:entries="@array/pref_choices_list_entries"
android:entryValues="@array/pref_choices_list_values"
android:key="choices_list"
Expand Down

0 comments on commit 447a9be

Please sign in to comment.