Skip to content

Commit

Permalink
Cleanup inspection warnings (#537)
Browse files Browse the repository at this point in the history
  • Loading branch information
frimtec authored May 4, 2024
1 parent 3cfc777 commit 05ae6b8
Show file tree
Hide file tree
Showing 15 changed files with 42 additions and 24 deletions.
3 changes: 1 addition & 2 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
android:name=".ui.support.SendLogActivity"
android:exported="false">
<intent-filter>
<action android:name="com.github.frimtec.android.pikettassist.SEND_LOG" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public class DonationFragment extends DialogFragment {

private static final String PAYPAL_ME_BASE_LINK = "https://paypal.me/frimtec";
private static final String PAYPAL_ME_LINK = PAYPAL_ME_BASE_LINK + "?country.x=CH&locale.x=de_DE";
private static final String ALTERNATIVE_DONATION_TEXT_TEMPLATE = "" +
private static final String ALTERNATIVE_DONATION_TEXT_TEMPLATE =
"<h3>" +
"%s" +
"</h3>" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

import com.github.frimtec.android.pikettassist.R;

final class RowViewHolder extends RecyclerView.ViewHolder {
public final class RowViewHolder extends RecyclerView.ViewHolder {

final TextView title;
final TextView price;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
import android.content.Context;
import android.content.Intent;
import android.util.Log;

import androidx.work.Data;

import com.github.frimtec.android.pikettassist.domain.OnOffState;
import com.github.frimtec.android.pikettassist.domain.TestAlarm;
import com.github.frimtec.android.pikettassist.domain.TestAlarmContext;
Expand All @@ -15,7 +17,6 @@

import java.time.Duration;
import java.time.ZonedDateTime;
import java.time.temporal.ChronoField;
import java.time.temporal.ChronoUnit;
import java.util.Map;
import java.util.Optional;
Expand Down Expand Up @@ -107,7 +108,7 @@ public Optional<ScheduleInfo> apply(Data inputData) {
private ZonedDateTime getTodaysCheckTime(ZonedDateTime now) {
String[] testAlarmCheckTime = this.applicationPreferences.getTestAlarmCheckTime(context).split(":");
return now.truncatedTo(ChronoUnit.MINUTES)
.with(ChronoField.HOUR_OF_DAY, Integer.parseInt(testAlarmCheckTime[0]))
.with(ChronoField.MINUTE_OF_HOUR, Integer.parseInt(testAlarmCheckTime[1]));
.withHour(Integer.parseInt(testAlarmCheckTime[0]))
.withMinute(Integer.parseInt(testAlarmCheckTime[1]));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import java.util.function.Function;

@FunctionalInterface
interface WorkUnit extends Function<Data, Optional<ScheduleInfo>> {
public interface WorkUnit extends Function<Data, Optional<ScheduleInfo>> {

@Override
Optional<ScheduleInfo> apply(Data intent);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ private void registerOnSmsAdapter() {
private void refresh() {
refreshTabLabels();
FragmentManager fm = getSupportFragmentManager();
//noinspection rawtypes
var activeFragment = (AbstractListFragment) fm.findFragmentByTag("f" + viewPager.getCurrentItem());
if (activeFragment != null) {
activeFragment.refresh();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@ private void setupAppInfo() {
textView.setText(Html.fromHtml(
"<h2><a href='https://github.com/frimtec/pikett-assist'>PAssist</a></h2>" +
"<p>Version: <b>" + version + "</b><br/>" + "Build: " + build + "</p>" +
"<p>&copy; 2019-2024 <a href='https://github.com/frimtec'>frimTEC</a></p>" +
""
"<p>&copy; 2019-2024 <a href='https://github.com/frimtec'>frimTEC</a></p>"
, Html.FROM_HTML_MODE_COMPACT));
textView.setMovementMethod(LinkMovementMethod.getInstance());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public abstract class AbstractAlarmActivity extends AppCompatActivity {
public static final int ONE_SECOND_MILLIS = 1000;
public static final int VIBRATION_START_DELAY_MS = 50;

protected enum SwipeButtonStyle {
public enum SwipeButtonStyle {
ALARM, NO_SIGNAL, MISSING_TEST_ALARM
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@

import android.os.Bundle;
import android.text.TextUtils;

import androidx.annotation.Nullable;
import androidx.preference.MultiSelectListPreference;
import androidx.preference.Preference;

import com.github.frimtec.android.pikettassist.R;
import com.github.frimtec.android.pikettassist.domain.TestAlarm;
import com.github.frimtec.android.pikettassist.domain.TestAlarmContext;
Expand All @@ -22,6 +24,9 @@

public class TestAlarmFragment extends PreferenceFragmentCompat {

/**
* @noinspection SimplifyStreamApiCallChains
*/
@Override
public void onCreatePreferencesFix(@Nullable Bundle savedInstanceState, String rootKey) {
setPreferencesFromResource(R.xml.test_alarm_preferences, rootKey);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@

public class SendLogActivity extends AppCompatActivity {

public static final String ACTION_SEND_LOG = "com.github.frimtec.android.pikettassist.SEND_LOG";

private ActivityResultLauncher<Intent> sendCrashReportActivityResultLauncher;

@Override
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/values-it/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
<string name="list_item_menu_clear">Chiaro</string>
<string name="list_item_menu_activate">Attivare</string>
<string name="list_item_menu_bogus_alarm">Programma allarme falso</string>
<string name="toast_bogus_alarm">L\'allarme fasullo verrà attivato tra 10 secondi...</string>
<string name="toast_bogus_alarm">L\'allarme fasullo verrà attivato tra 10 secondi</string>
<string name="list_item_menu_deactivate">Disattivare</string>
<string name="list_item_menu_set_manually_on">Attiva manualmente</string>
<string name="list_item_menu_reset">Ripristina</string>
Expand Down Expand Up @@ -161,7 +161,7 @@
<string name="state_fragment_sms_adapter_not_installed">Non installato</string>
<string name="state_fragment_sms_adapter_no_sms_permissions">Nessun permesso SMS</string>
<string name="state_fragment_phone_numbers_blocked">Numero bloccato</string>
<string name="state_fragment_loopback_sms_sent">SMS di prova inviato...</string>
<string name="state_fragment_loopback_sms_sent">SMS di prova inviato</string>
<string name="sms_listener_loopback_sms_received">SMS di prova ricevuto!</string>
<string name="sms_listener_meta_sms_filtered">SMS ricevuti e filtrati!</string>
<string name="state_fragment_s2msp_requires_update">Richiede aggiornamento</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ void getSerializedStringForIncompleteReference() {
@Test
void equalsForSameReference() {
ContactReference reference = new ContactReference(12, "key");
//noinspection EqualsWithItself
assertThat(reference).isEqualTo(reference);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,33 @@
package com.github.frimtec.android.pikettassist.service.dao;

import static com.github.frimtec.android.pikettassist.state.DbFactory.Mode.READ_ONLY;
import static com.github.frimtec.android.pikettassist.state.DbFactory.Mode.WRITABLE;
import static com.github.frimtec.android.pikettassist.state.DbHelper.TABLE_ALERT_COLUMN_ID;
import static com.github.frimtec.android.pikettassist.state.DbHelper.TABLE_TEST_ALARM_STATE;
import static com.github.frimtec.android.pikettassist.state.DbHelper.TABLE_TEST_ALARM_STATE_COLUMN_ALERT_STATE;
import static com.github.frimtec.android.pikettassist.state.DbHelper.TABLE_TEST_ALARM_STATE_COLUMN_ALIAS;
import static com.github.frimtec.android.pikettassist.state.DbHelper.TABLE_TEST_ALARM_STATE_COLUMN_ID;
import static com.github.frimtec.android.pikettassist.state.DbHelper.TABLE_TEST_ALARM_STATE_COLUMN_LAST_RECEIVED_TIME;
import static com.github.frimtec.android.pikettassist.state.DbHelper.TABLE_TEST_ALARM_STATE_COLUMN_MESSAGE;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.any;
import static org.mockito.Mockito.eq;
import static org.mockito.Mockito.isNotNull;
import static org.mockito.Mockito.isNull;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.notNull;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;

import com.github.frimtec.android.pikettassist.domain.OnOffState;
import com.github.frimtec.android.pikettassist.domain.TestAlarm;
import com.github.frimtec.android.pikettassist.domain.TestAlarmContext;
import com.github.frimtec.android.pikettassist.state.DbFactory;

import org.junit.jupiter.api.Test;

import java.time.Instant;
Expand All @@ -16,13 +38,6 @@
import java.util.Optional;
import java.util.stream.Collectors;

import static com.github.frimtec.android.pikettassist.state.DbFactory.Mode.READ_ONLY;
import static com.github.frimtec.android.pikettassist.state.DbFactory.Mode.WRITABLE;
import static com.github.frimtec.android.pikettassist.state.DbHelper.*;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.*;
import static org.mockito.Mockito.*;

class TestAlarmDaoTest {

@Test
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@ allprojects {
}

tasks.register('clean', Delete) {
delete rootProject.buildDir
delete rootProject.layout.buildDirectory
}

0 comments on commit 05ae6b8

Please sign in to comment.