Skip to content

Commit 0515b55

Browse files
committed
Add more Credits
Fix Weather Icon Summary
1 parent 771cb8c commit 0515b55

File tree

5 files changed

+49
-7
lines changed

5 files changed

+49
-7
lines changed

app/src/main/java/it/dhd/oxygencustomizer/customprefs/ListWithPopUpPreference.java

+22
Original file line numberDiff line numberDiff line change
@@ -144,4 +144,26 @@ public void createDefaultAdapter(Drawable[] drawables) {
144144
}
145145
});
146146
}
147+
148+
public void createDefaultAdapter(Drawable[] drawables, onItemClick listener) {
149+
mHasImages = true;
150+
mEntryDrawables = drawables;
151+
mAdapter = new ListPreferenceAdapter(getEntries(),
152+
getEntryValues(),
153+
drawables,
154+
getKey(),
155+
mHasImages,
156+
(view1, position) -> {
157+
if (callChangeListener(getEntryValues()[position].toString())) {
158+
setValueIndex(position);
159+
}
160+
if (listener != null) {
161+
listener.onItemClick(position);
162+
}
163+
});
164+
}
165+
166+
public interface onItemClick {
167+
void onItemClick(int position);
168+
}
147169
}

app/src/main/java/it/dhd/oxygencustomizer/ui/adapters/CreditsAdapter.java

+6-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import android.net.Uri;
55
import android.text.TextUtils;
66
import android.view.LayoutInflater;
7+
import android.view.View;
78
import android.view.ViewGroup;
89

910
import androidx.annotation.NonNull;
@@ -73,7 +74,11 @@ public ItemViewHolder(@NonNull CreditsItemViewBinding binding) {
7374

7475
public void bind(CreditsModel model) {
7576
binding.title.setText(model.getTitle());
76-
binding.desc.setText(model.getSummary());
77+
if (!TextUtils.isEmpty(model.getSummary())) {
78+
binding.desc.setVisibility(View.VISIBLE);
79+
binding.desc.setText(model.getSummary());
80+
} else
81+
binding.desc.setVisibility(View.GONE);
7782
if (model.getIcon() != 0) {
7883
binding.icon.setImageResource(model.getIcon());
7984
} else {

app/src/main/java/it/dhd/oxygencustomizer/ui/fragments/Credits.java

+6
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,12 @@ public void onViewCreated(@NonNull View view, Bundle savedInstanceState) {
6666
For some customizations
6767
github/SuperiorExtended""", "https://github.com/SuperiorExtended/", R.drawable.ic_superior));
6868

69+
credits.add(new CreditsModel("Testers"));
70+
credits.add(new CreditsModel(VIEW_TYPE_ITEM, "Max", "", "", R.drawable.ic_default_person));
71+
credits.add(new CreditsModel(VIEW_TYPE_ITEM, "Siri00", "", "", R.drawable.ic_default_person));
72+
credits.add(new CreditsModel(VIEW_TYPE_ITEM, "Pasqui1978", "", "", R.drawable.ic_default_person));
73+
credits.add(new CreditsModel(VIEW_TYPE_ITEM, "ZioProne", "", "", R.drawable.ic_default_person));
74+
6975
CreditsAdapter adapter = new CreditsAdapter(credits);
7076
binding.creditsRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
7177
binding.creditsRecyclerView.setAdapter(adapter);

app/src/main/java/it/dhd/oxygencustomizer/ui/fragments/mods/lockscreen/LockscreenWeather.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,8 @@ public void doLoadPreferences() {
260260
getAvailableWeatherIconPacks(entries, values, drawables);
261261
mWeatherIconPack.setEntries(entries.toArray(new String[0]));
262262
mWeatherIconPack.setEntryValues(values.toArray(new String[0]));
263-
mWeatherIconPack.createDefaultAdapter(drawables.toArray(new Drawable[0]));
263+
mWeatherIconPack.createDefaultAdapter(drawables.toArray(new Drawable[0]),
264+
(position) -> mWeatherIconPack.setSummary(entries.get(position)));
264265
int valueIndex = mWeatherIconPack.findIndexOfValue(settingHeaderPackage);
265266
if (valueIndex == -1) {
266267
// no longer found
@@ -272,7 +273,7 @@ public void doLoadPreferences() {
272273
mWeatherIconPack.setSummary(mWeatherIconPack.getEntry());
273274
mWeatherIconPack.setOnPreferenceChangeListener(this);
274275
} else {
275-
prefScreen.removePreference(mWeatherIconPack);
276+
if (mWeatherIconPack != null) prefScreen.removePreference(mWeatherIconPack);
276277
}
277278
mUpdateStatus = findPreference(PREF_KEY_UPDATE_STATUS);
278279
if (mUpdateStatus != null) {

app/src/main/res/layout/credits_item_view.xml

+12-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
3+
xmlns:app="http://schemas.android.com/apk/res-auto"
34
android:id="@+id/list_info_item"
45
android:layout_width="match_parent"
56
android:layout_height="wrap_content"
@@ -14,7 +15,7 @@
1415
android:layout_marginStart="24dp"
1516
android:contentDescription="@string/credits_title" />
1617

17-
<LinearLayout
18+
<androidx.constraintlayout.widget.ConstraintLayout
1819
android:layout_width="match_parent"
1920
android:layout_height="wrap_content"
2021
android:layout_centerVertical="true"
@@ -29,14 +30,21 @@
2930
style="@style/TextAppearance.Material3.TitleMedium"
3031
android:layout_width="wrap_content"
3132
android:layout_height="wrap_content"
32-
android:textColor="@color/text_color_primary" />
33+
android:textColor="@color/text_color_primary"
34+
app:layout_constraintBottom_toTopOf="@+id/desc"
35+
app:layout_constraintStart_toStartOf="parent"
36+
app:layout_constraintTop_toTopOf="parent"/>
3337

3438
<TextView
3539
android:id="@+id/desc"
40+
android:visibility="visible"
3641
style="@style/TextAppearance.Material3.BodyMedium"
3742
android:layout_width="wrap_content"
3843
android:layout_height="wrap_content"
39-
android:textColor="@color/text_color_secondary" />
44+
android:textColor="@color/text_color_secondary"
45+
android:layout_marginTop="6dp"
46+
app:layout_constraintStart_toStartOf="parent"
47+
app:layout_constraintTop_toBottomOf="@+id/title"/>
4048

41-
</LinearLayout>
49+
</androidx.constraintlayout.widget.ConstraintLayout>
4250
</RelativeLayout>

0 commit comments

Comments
 (0)