Skip to content

Commit

Permalink
UI change + Fix notification worker
Browse files Browse the repository at this point in the history
  • Loading branch information
Philipp0002 committed Mar 18, 2024
1 parent 946e0da commit e2f310d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import org.json.JSONObject;

import java.util.ArrayList;
import java.util.Locale;
import java.util.Optional;
import java.util.stream.Collectors;

Expand All @@ -35,7 +36,13 @@ public NotificationWorker(@NonNull Context context, @NonNull WorkerParameters wo
@Override
public Result doWork() {
try {
SharedPreferences preferences = getApplicationContext().getSharedPreferences(Constants.SP_NAME, Context.MODE_PRIVATE);

GetDeviceListAsync getDeviceListAsync = new GetDeviceListAsync();
getDeviceListAsync.paramUserId = preferences.getString("userId", "");
getDeviceListAsync.paramTypeId = "0";
getDeviceListAsync.paramMapType = "Google";
getDeviceListAsync.paramLanguage = Locale.getDefault().getLanguage() + "-" + Locale.getDefault().getCountry();
getDeviceListAsync.runFetch();

if (getDeviceListAsync.resultObject != null) {
Expand All @@ -47,7 +54,6 @@ public Result doWork() {
liveDevices.add(new NotifyDevice().setFromJson(liveDevice));
}

SharedPreferences preferences = getApplicationContext().getSharedPreferences(Constants.SP_NAME, Context.MODE_PRIVATE);
String notifyDevicesRaw = preferences.getString(Constants.NOTIFY_DEVICES_PREF_KEY, "[]");
JSONArray array = new JSONArray(notifyDevicesRaw);
for (int i = 0; i < array.length(); i++) {
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/layout/device_info_sheet.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
<androidx.cardview.widget.CardView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:cardElevation="0dp"
app:cardBackgroundColor="?attr/colorSecondaryContainer">

<TextView
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/res/layout/device_list_item.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@
app:cardBackgroundColor="?attr/colorTertiaryContainer"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@+id/imageView"
app:layout_constraintTop_toBottomOf="@+id/deviceItemName">
app:layout_constraintTop_toBottomOf="@+id/deviceItemName"
app:cardElevation="0dp">

<TextView
android:id="@+id/deviceItemState"
Expand Down

0 comments on commit e2f310d

Please sign in to comment.