Skip to content

Commit

Permalink
Palatschinkencounter 1.0.7
Browse files Browse the repository at this point in the history
SettingsFragment preferences.xml implementiert
Rezept
Style
Counterreset überarbeitet
  • Loading branch information
amarradi committed Jun 23, 2022
1 parent 36f6f68 commit f883908
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
oss.setTypeface(typeface_regular);
TextView resethow = findViewById(R.id.resethowto);
resethow.setTypeface(typeface_regular);
//Resources resources = getResources();
@SuppressLint({"StringFormatInvalid", "LocalSuppress"}) String version = String.format(getResources().getString(R.string.version), BuildConfig.VERSION_NAME);
appVersion.setText(version);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

public class RecipeActivity extends AppCompatActivity {
ListView listView_Recipe;

String[] listItem_Recipe;


Expand All @@ -20,9 +19,6 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {

listView_Recipe = findViewById(R.id.listViewIngredients);
listItem_Recipe = getResources().getStringArray(R.array.ingredients_array);



final ArrayAdapter<String> arrayAdapter_Ingredients = new ArrayAdapter<>(this,
R.layout.simple_list_item_1, listItem_Recipe);
listView_Recipe.setAdapter(arrayAdapter_Ingredients);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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.
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
android:layout_marginEnd="16dp"
android:layout_marginRight="16dp"
android:layout_marginBottom="32dp"
android:background="@drawable/counter_txt_button_bg"
android:background="@drawable/counter_plus_btn_bg_shape"
android:text="@string/btnCounter"
android:fontFamily="@font/opensans_extrabold"
app:layout_constraintBottom_toBottomOf="parent"
Expand Down

0 comments on commit f883908

Please sign in to comment.