diff --git a/app/src/main/java/it/dhd/oxygencustomizer/customprefs/ListWithPopUpPreference.java b/app/src/main/java/it/dhd/oxygencustomizer/customprefs/ListWithPopUpPreference.java index cdd2cb85b..d7d36d250 100644 --- a/app/src/main/java/it/dhd/oxygencustomizer/customprefs/ListWithPopUpPreference.java +++ b/app/src/main/java/it/dhd/oxygencustomizer/customprefs/ListWithPopUpPreference.java @@ -144,4 +144,26 @@ public void createDefaultAdapter(Drawable[] drawables) { } }); } + + public void createDefaultAdapter(Drawable[] drawables, onItemClick listener) { + mHasImages = true; + mEntryDrawables = drawables; + mAdapter = new ListPreferenceAdapter(getEntries(), + getEntryValues(), + drawables, + getKey(), + mHasImages, + (view1, position) -> { + if (callChangeListener(getEntryValues()[position].toString())) { + setValueIndex(position); + } + if (listener != null) { + listener.onItemClick(position); + } + }); + } + + public interface onItemClick { + void onItemClick(int position); + } } diff --git a/app/src/main/java/it/dhd/oxygencustomizer/ui/adapters/CreditsAdapter.java b/app/src/main/java/it/dhd/oxygencustomizer/ui/adapters/CreditsAdapter.java index 75efe26b3..dcf58fbec 100644 --- a/app/src/main/java/it/dhd/oxygencustomizer/ui/adapters/CreditsAdapter.java +++ b/app/src/main/java/it/dhd/oxygencustomizer/ui/adapters/CreditsAdapter.java @@ -4,6 +4,7 @@ import android.net.Uri; import android.text.TextUtils; import android.view.LayoutInflater; +import android.view.View; import android.view.ViewGroup; import androidx.annotation.NonNull; @@ -73,7 +74,11 @@ public ItemViewHolder(@NonNull CreditsItemViewBinding binding) { public void bind(CreditsModel model) { binding.title.setText(model.getTitle()); - binding.desc.setText(model.getSummary()); + if (!TextUtils.isEmpty(model.getSummary())) { + binding.desc.setVisibility(View.VISIBLE); + binding.desc.setText(model.getSummary()); + } else + binding.desc.setVisibility(View.GONE); if (model.getIcon() != 0) { binding.icon.setImageResource(model.getIcon()); } else { diff --git a/app/src/main/java/it/dhd/oxygencustomizer/ui/fragments/Credits.java b/app/src/main/java/it/dhd/oxygencustomizer/ui/fragments/Credits.java index 42d0a3039..affd9f45f 100644 --- a/app/src/main/java/it/dhd/oxygencustomizer/ui/fragments/Credits.java +++ b/app/src/main/java/it/dhd/oxygencustomizer/ui/fragments/Credits.java @@ -66,6 +66,12 @@ public void onViewCreated(@NonNull View view, Bundle savedInstanceState) { For some customizations github/SuperiorExtended""", "https://github.com/SuperiorExtended/", R.drawable.ic_superior)); + credits.add(new CreditsModel("Testers")); + credits.add(new CreditsModel(VIEW_TYPE_ITEM, "Max", "", "", R.drawable.ic_default_person)); + credits.add(new CreditsModel(VIEW_TYPE_ITEM, "Siri00", "", "", R.drawable.ic_default_person)); + credits.add(new CreditsModel(VIEW_TYPE_ITEM, "Pasqui1978", "", "", R.drawable.ic_default_person)); + credits.add(new CreditsModel(VIEW_TYPE_ITEM, "ZioProne", "", "", R.drawable.ic_default_person)); + CreditsAdapter adapter = new CreditsAdapter(credits); binding.creditsRecyclerView.setLayoutManager(new LinearLayoutManager(getContext())); binding.creditsRecyclerView.setAdapter(adapter); diff --git a/app/src/main/java/it/dhd/oxygencustomizer/ui/fragments/mods/lockscreen/LockscreenWeather.java b/app/src/main/java/it/dhd/oxygencustomizer/ui/fragments/mods/lockscreen/LockscreenWeather.java index 291fe6256..d90714990 100644 --- a/app/src/main/java/it/dhd/oxygencustomizer/ui/fragments/mods/lockscreen/LockscreenWeather.java +++ b/app/src/main/java/it/dhd/oxygencustomizer/ui/fragments/mods/lockscreen/LockscreenWeather.java @@ -260,7 +260,8 @@ public void doLoadPreferences() { getAvailableWeatherIconPacks(entries, values, drawables); mWeatherIconPack.setEntries(entries.toArray(new String[0])); mWeatherIconPack.setEntryValues(values.toArray(new String[0])); - mWeatherIconPack.createDefaultAdapter(drawables.toArray(new Drawable[0])); + mWeatherIconPack.createDefaultAdapter(drawables.toArray(new Drawable[0]), + (position) -> mWeatherIconPack.setSummary(entries.get(position))); int valueIndex = mWeatherIconPack.findIndexOfValue(settingHeaderPackage); if (valueIndex == -1) { // no longer found @@ -272,7 +273,7 @@ public void doLoadPreferences() { mWeatherIconPack.setSummary(mWeatherIconPack.getEntry()); mWeatherIconPack.setOnPreferenceChangeListener(this); } else { - prefScreen.removePreference(mWeatherIconPack); + if (mWeatherIconPack != null) prefScreen.removePreference(mWeatherIconPack); } mUpdateStatus = findPreference(PREF_KEY_UPDATE_STATUS); if (mUpdateStatus != null) { diff --git a/app/src/main/res/layout/credits_item_view.xml b/app/src/main/res/layout/credits_item_view.xml index 83e48f106..b40fb4e8e 100644 --- a/app/src/main/res/layout/credits_item_view.xml +++ b/app/src/main/res/layout/credits_item_view.xml @@ -1,5 +1,6 @@ - + android:textColor="@color/text_color_primary" + app:layout_constraintBottom_toTopOf="@+id/desc" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent"/> + android:textColor="@color/text_color_secondary" + android:layout_marginTop="6dp" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/title"/> - + \ No newline at end of file