Cleanup: properly name method (has side effect).

This commit is contained in:
Dennis Guse
2025-06-19 17:46:58 +02:00
parent b883bb3862
commit 6e42857023
17 changed files with 42 additions and 18 deletions
@@ -3,6 +3,7 @@ package de.dennisguse.opentracks;
import android.os.Bundle;
import android.view.View;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import de.dennisguse.opentracks.databinding.AboutBinding;
@@ -29,7 +30,8 @@ public class AboutActivity extends AbstractActivity {
ViewUtils.makeClickableLinks(findViewById(android.R.id.content));
}
protected View getRootView() {
@NonNull
protected View createRootView() {
viewBinding = AboutBinding.inflate(getLayoutInflater());
return viewBinding.getRoot();
}
@@ -47,7 +47,7 @@ public abstract class AbstractActivity extends AppCompatActivity {
// Set volume control stream for text to speech
setVolumeControlStream(TTSManager.AUDIO_STREAM);
View rootView = getRootView();
View rootView = createRootView();
setContentView(rootView);
apply_insets(rootView);
@@ -93,5 +93,6 @@ public abstract class AbstractActivity extends AppCompatActivity {
return true;
}
protected abstract View getRootView();
@NonNull
protected abstract View createRootView();
}
@@ -3,6 +3,7 @@ package de.dennisguse.opentracks;
import android.os.Bundle;
import android.view.View;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import de.dennisguse.opentracks.databinding.HelpBinding;
@@ -19,8 +20,9 @@ public class HelpActivity extends AbstractActivity {
ViewUtils.makeClickableLinks(findViewById(android.R.id.content));
}
@NonNull
@Override
protected View getRootView() {
protected View createRootView() {
helpBinding = HelpBinding.inflate(getLayoutInflater());
return helpBinding.getRoot();
}
@@ -7,6 +7,8 @@ import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import androidx.annotation.NonNull;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
@@ -28,8 +30,9 @@ public class ShowErrorActivity extends AbstractActivity {
setSupportActionBar(viewBinding.bottomAppBarLayout.bottomAppBar);
}
@NonNull
@Override
protected View getRootView() {
protected View createRootView() {
viewBinding = ActivityShowErrorBinding.inflate(getLayoutInflater());
return viewBinding.getRoot();
}
@@ -115,8 +115,9 @@ public class TrackEditActivity extends AbstractActivity implements ChooseActivit
outState.putSerializable(ICON_VALUE_KEY, activityType);
}
@NonNull
@Override
protected View getRootView() {
protected View createRootView() {
viewBinding = TrackEditBinding.inflate(getLayoutInflater());
return viewBinding.getRoot();
}
@@ -30,6 +30,7 @@ import android.view.MenuItem;
import android.view.View;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.content.res.AppCompatResources;
import androidx.core.content.ContextCompat;
@@ -242,8 +243,9 @@ public class TrackListActivity extends AbstractTrackDeleteActivity implements Co
adapter = null;
}
@NonNull
@Override
protected View getRootView() {
protected View createRootView() {
viewBinding = TrackListBinding.inflate(getLayoutInflater());
viewBinding.trackListSearchView.getEditText().setOnEditorActionListener((v, actionId, event) -> {
@@ -136,8 +136,9 @@ public class TrackRecordedActivity extends AbstractTrackDeleteActivity implement
outState.putInt(CURRENT_TAB_TAG_KEY, viewBinding.trackDetailActivityViewPager.getCurrentItem());
}
@NonNull
@Override
protected View getRootView() {
protected View createRootView() {
viewBinding = TrackRecordedBinding.inflate(getLayoutInflater());
return viewBinding.getRoot();
}
@@ -250,8 +250,9 @@ public class TrackRecordingActivity extends AbstractActivity implements ChooseAc
trackRecordingServiceConnection = null;
}
@NonNull
@Override
protected View getRootView() {
protected View createRootView() {
viewBinding = TrackRecordingBinding.inflate(getLayoutInflater());
return viewBinding.getRoot();
}
@@ -7,6 +7,8 @@ import android.util.Pair;
import android.view.View;
import android.widget.ArrayAdapter;
import androidx.annotation.NonNull;
import de.dennisguse.opentracks.data.ContentProviderUtils;
import de.dennisguse.opentracks.data.models.ActivityType;
import de.dennisguse.opentracks.data.models.DistanceFormatter;
@@ -110,8 +112,9 @@ public class TrackStoppedActivity extends AbstractTrackDeleteActivity implements
contentProviderUtils);
}
@NonNull
@Override
protected View getRootView() {
protected View createRootView() {
viewBinding = TrackStoppedBinding.inflate(getLayoutInflater());
return viewBinding.getRoot();
}
@@ -47,8 +47,9 @@ public class IntroductionActivity extends AbstractActivity {
viewBinding.introductionViewPager.setUserInputEnabled(false);
}
@NonNull
@Override
protected View getRootView() {
protected View createRootView() {
viewBinding = IntroductionBinding.inflate(getLayoutInflater());
return viewBinding.getRoot();
}
@@ -72,8 +72,9 @@ public class SettingsActivity extends AbstractActivity implements ChooseActivity
}
}
@NonNull
@Override
protected View getRootView() {
protected View createRootView() {
viewBinding = SettingsBinding.inflate(getLayoutInflater());
return viewBinding.getRoot();
}
@@ -116,8 +116,9 @@ public class SettingsCustomLayoutEditActivity extends AbstractActivity implement
recordingLayoutFieldsVisible = null;
}
@NonNull
@Override
protected View getRootView() {
protected View createRootView() {
viewBinding = ActivitySettingsCustomLayoutBinding.inflate(getLayoutInflater());
return viewBinding.getRoot();
}
@@ -108,8 +108,9 @@ public class SettingsCustomLayoutListActivity extends AbstractActivity implement
adapter.reloadLayouts();
}
@NonNull
@Override
protected View getRootView() {
protected View createRootView() {
PreferencesUtils.getCustomLayout();
viewBinding = ActivitySettingsCustomLayoutListBinding.inflate(getLayoutInflater());
return viewBinding.getRoot();
@@ -83,8 +83,9 @@ public class AggregatedStatisticsActivity extends AbstractActivity implements Fi
outState.putBoolean(STATE_ARE_FILTERS_APPLIED, areFiltersApplied);
}
@NonNull
@Override
protected View getRootView() {
protected View createRootView() {
viewBinding = AggregatedStatsBinding.inflate(getLayoutInflater());
return viewBinding.getRoot();
}
@@ -110,8 +110,9 @@ public class MarkerDetailActivity extends AbstractActivity implements DeleteMark
setSupportActionBar(viewBinding.bottomAppBarLayout.bottomAppBar);
}
@NonNull
@Override
protected View getRootView() {
protected View createRootView() {
viewBinding = MarkerDetailActivityBinding.inflate(getLayoutInflater());
return viewBinding.getRoot();
}
@@ -85,8 +85,9 @@ public class MarkerEditActivity extends AbstractActivity {
// UI elements
private MarkerEditBinding viewBinding;
@NonNull
@Override
protected View getRootView() {
protected View createRootView() {
viewBinding = MarkerEditBinding.inflate(getLayoutInflater());
return viewBinding.getRoot();
}
@@ -145,8 +145,9 @@ public class MarkerListActivity extends AbstractActivity implements DeleteMarker
contentProviderUtils = null;
}
@NonNull
@Override
protected View getRootView() {
protected View createRootView() {
viewBinding = MarkerListBinding.inflate(getLayoutInflater());
viewBinding.markerListSearchView.getEditText().setOnEditorActionListener((v, actionId, event) -> {