-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SettingsFragment preferences.xml implementiert Rezept Style Counterreset überarbeitet
- Loading branch information
Showing
5 changed files
with
13 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
import android.net.Uri; | ||
import android.os.Bundle; | ||
|
||
import androidx.annotation.NonNull; | ||
import androidx.preference.CheckBoxPreference; | ||
import androidx.preference.EditTextPreference; | ||
import androidx.preference.ListPreference; | ||
|
@@ -26,23 +27,24 @@ public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { | |
SharedPreferences sharedPreferences = getPreferenceScreen().getSharedPreferences(); | ||
PreferenceScreen prefScreen = getPreferenceScreen(); | ||
|
||
|
||
Preference feedback_preference = getPreferenceManager().findPreference("feed_preference"); | ||
if (feedback_preference != null) { | ||
feedback_preference.setOnPreferenceClickListener(preference -> { | ||
Preference feedback_preference = findPreference("feedback_preference"); | ||
assert feedback_preference != null; | ||
feedback_preference.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { | ||
@Override | ||
public boolean onPreferenceClick(@NonNull Preference preference) { | ||
Intent intent = new Intent(Intent.ACTION_SENDTO); | ||
intent.setData(Uri.parse("mailto:")); | ||
intent.putExtra(Intent.EXTRA_EMAIL, new String[]{"[email protected]"}); | ||
intent.putExtra(Intent.EXTRA_SUBJECT, "Feedback"); | ||
startActivity(intent); | ||
return true; | ||
}); | ||
} | ||
return false; | ||
} | ||
}); | ||
|
||
Preference version_preference = getPreferenceManager().findPreference("version_preference"); | ||
|
||
assert version_preference != null; | ||
version_preference.setTitle("Palatschinkencounter "+BuildConfig.VERSION_NAME); | ||
version_preference.setTitle("Palatschinkencounter " + BuildConfig.VERSION_NAME); | ||
int count = prefScreen.getPreferenceCount(); | ||
|
||
// Go through all of the preferences, and set up their preference summary. | ||
|
@@ -58,44 +60,20 @@ public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { | |
} | ||
} | ||
|
||
|
||
Preference recipe_preference = getPreferenceManager().findPreference("recipe"); | ||
Objects.requireNonNull(recipe_preference).setOnPreferenceClickListener(preference -> { | ||
Intent recipe_intent = new Intent(getActivity(),RecipeActivity.class); | ||
Intent recipe_intent = new Intent(getActivity(), RecipeActivity.class); | ||
startActivity(recipe_intent); | ||
return false; | ||
}); | ||
Preference about_preference = getPreferenceManager().findPreference("about"); | ||
Objects.requireNonNull(about_preference).setOnPreferenceClickListener(preference -> { | ||
Intent about_intent = new Intent(getActivity(),AboutActivity.class); | ||
Intent about_intent = new Intent(getActivity(), AboutActivity.class); | ||
startActivity(about_intent); | ||
return false; | ||
}); | ||
|
||
} | ||
|
||
/* | ||
@Override | ||
public boolean onPreferenceChange(Preference preference, Object newValue) { | ||
Toast error = Toast.makeText(getContext(), "Please select a number.", Toast.LENGTH_SHORT); | ||
String sizeKey = getString(R.string.pref_size_key); | ||
if (preference.getKey().equals(sizeKey)) { | ||
String stringSize = (String) newValue; | ||
try { | ||
float size = Float.parseFloat(stringSize); | ||
} catch (NumberFormatException nfe) { | ||
error.show(); | ||
return false; | ||
} | ||
} | ||
return true; | ||
} */ | ||
|
||
@Override | ||
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { | ||
// Figure out which preference was changed | ||
|
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters