mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
* Changed files required to get the app to run correctly. Removed suspend from affected DAO files and funcs, and changed to (Kotlin v1.9.22) and (Kotlin compiler v1.5.8) * Created refresh button icon, and added it to the nearby_fragment_menu.xml (header of the nearby page). Created function refresh() in NearbyParentFragment.java to handle refresh functionality. * Replaced refresh() func with emptyCache() and reloadMap() * Attempt at reloadMap(), no testing done yet. * added changes for a possibly working emptyCache implementation (needs testing). * Tested changes as working, edited emptyCache to correctly clear cache and then reload map --------- Co-authored-by: MarcusBarta <marcusbarta@icloud.com>
This commit is contained in:
parent
becc07d26b
commit
3e020ed973
15 changed files with 140 additions and 35 deletions
7
.idea/inspectionProfiles/Project_Default.xml
generated
7
.idea/inspectionProfiles/Project_Default.xml
generated
|
|
@ -1,16 +1,12 @@
|
||||||
<component name="InspectionProjectProfileManager">
|
<component name="InspectionProjectProfileManager">
|
||||||
<profile version="1.0">
|
<profile version="1.0">
|
||||||
<option name="myName" value="Project Default" />
|
<option name="myName" value="Project Default" />
|
||||||
<inspection_tool class="AndroidLintNewerVersionAvailable" enabled="true" level="WARNING" enabled_by_default="true" />
|
|
||||||
<inspection_tool class="AutoCloseableResource" enabled="true" level="WARNING" enabled_by_default="true" />
|
|
||||||
<inspection_tool class="ClassWithOnlyPrivateConstructors" enabled="true" level="WARNING" enabled_by_default="true" />
|
<inspection_tool class="ClassWithOnlyPrivateConstructors" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
<inspection_tool class="ConfusingElse" enabled="true" level="WARNING" enabled_by_default="true">
|
<inspection_tool class="ConfusingElse" enabled="true" level="WARNING" enabled_by_default="true">
|
||||||
<option name="reportWhenNoStatementFollow" value="true" />
|
<option name="reportWhenNoStatementFollow" value="true" />
|
||||||
</inspection_tool>
|
</inspection_tool>
|
||||||
<inspection_tool class="ControlFlowStatementWithoutBraces" enabled="true" level="ERROR" enabled_by_default="true" />
|
<inspection_tool class="ControlFlowStatementWithoutBraces" enabled="true" level="ERROR" enabled_by_default="true" />
|
||||||
<inspection_tool class="DefaultNotLastCaseInSwitch" enabled="true" level="WARNING" enabled_by_default="true" />
|
|
||||||
<inspection_tool class="ExplicitThis" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
|
<inspection_tool class="ExplicitThis" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
|
||||||
<inspection_tool class="FieldMayBeFinal" enabled="true" level="WARNING" enabled_by_default="true" />
|
|
||||||
<inspection_tool class="LocalCanBeFinal" enabled="true" level="WARNING" enabled_by_default="true">
|
<inspection_tool class="LocalCanBeFinal" enabled="true" level="WARNING" enabled_by_default="true">
|
||||||
<option name="REPORT_VARIABLES" value="true" />
|
<option name="REPORT_VARIABLES" value="true" />
|
||||||
<option name="REPORT_PARAMETERS" value="true" />
|
<option name="REPORT_PARAMETERS" value="true" />
|
||||||
|
|
@ -25,13 +21,11 @@
|
||||||
<option name="ignoreInMatchingInstanceof" value="false" />
|
<option name="ignoreInMatchingInstanceof" value="false" />
|
||||||
</inspection_tool>
|
</inspection_tool>
|
||||||
<inspection_tool class="ProblematicWhitespace" enabled="true" level="WARNING" enabled_by_default="true" />
|
<inspection_tool class="ProblematicWhitespace" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
<inspection_tool class="ProtectedMemberInFinalClass" enabled="true" level="WARNING" enabled_by_default="true" />
|
|
||||||
<inspection_tool class="RedundantFieldInitialization" enabled="true" level="WARNING" enabled_by_default="true" />
|
<inspection_tool class="RedundantFieldInitialization" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
<inspection_tool class="RedundantImplements" enabled="true" level="WARNING" enabled_by_default="true">
|
<inspection_tool class="RedundantImplements" enabled="true" level="WARNING" enabled_by_default="true">
|
||||||
<option name="ignoreSerializable" value="false" />
|
<option name="ignoreSerializable" value="false" />
|
||||||
<option name="ignoreCloneable" value="false" />
|
<option name="ignoreCloneable" value="false" />
|
||||||
</inspection_tool>
|
</inspection_tool>
|
||||||
<inspection_tool class="RedundantMethodOverride" enabled="true" level="WARNING" enabled_by_default="true" />
|
|
||||||
<inspection_tool class="SimplifiableEqualsExpression" enabled="true" level="WARNING" enabled_by_default="true" />
|
<inspection_tool class="SimplifiableEqualsExpression" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
<inspection_tool class="TypeParameterExtendsFinalClass" enabled="true" level="WARNING" enabled_by_default="true" />
|
<inspection_tool class="TypeParameterExtendsFinalClass" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
<inspection_tool class="UnnecessarilyQualifiedStaticUsage" enabled="true" level="WARNING" enabled_by_default="true">
|
<inspection_tool class="UnnecessarilyQualifiedStaticUsage" enabled="true" level="WARNING" enabled_by_default="true">
|
||||||
|
|
@ -47,6 +41,5 @@
|
||||||
<inspection_tool class="UnnecessaryQualifierForThis" enabled="true" level="WARNING" enabled_by_default="true" />
|
<inspection_tool class="UnnecessaryQualifierForThis" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
<inspection_tool class="UnnecessarySuperConstructor" enabled="true" level="WARNING" enabled_by_default="true" />
|
<inspection_tool class="UnnecessarySuperConstructor" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
<inspection_tool class="UnnecessaryThis" enabled="true" level="WARNING" enabled_by_default="true" />
|
<inspection_tool class="UnnecessaryThis" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
<inspection_tool class="UnnecessaryToStringCall" enabled="true" level="WARNING" enabled_by_default="true" />
|
|
||||||
</profile>
|
</profile>
|
||||||
</component>
|
</component>
|
||||||
|
|
@ -381,7 +381,7 @@ android {
|
||||||
compose true
|
compose true
|
||||||
}
|
}
|
||||||
composeOptions {
|
composeOptions {
|
||||||
kotlinCompilerExtensionVersion '1.3.2'
|
kotlinCompilerExtensionVersion '1.5.8'
|
||||||
}
|
}
|
||||||
namespace 'fr.free.nrw.commons'
|
namespace 'fr.free.nrw.commons'
|
||||||
lint {
|
lint {
|
||||||
|
|
|
||||||
|
|
@ -15,19 +15,19 @@ abstract class NotForUploadStatusDao {
|
||||||
* Insert into Not For Upload status.
|
* Insert into Not For Upload status.
|
||||||
*/
|
*/
|
||||||
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
||||||
abstract suspend fun insert(notForUploadStatus: NotForUploadStatus)
|
abstract fun insert(notForUploadStatus: NotForUploadStatus)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete Not For Upload status entry.
|
* Delete Not For Upload status entry.
|
||||||
*/
|
*/
|
||||||
@Delete
|
@Delete
|
||||||
abstract suspend fun delete(notForUploadStatus: NotForUploadStatus)
|
abstract fun delete(notForUploadStatus: NotForUploadStatus)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Query Not For Upload status with image sha1.
|
* Query Not For Upload status with image sha1.
|
||||||
*/
|
*/
|
||||||
@Query("SELECT * FROM images_not_for_upload_table WHERE imageSHA1 = (:imageSHA1) ")
|
@Query("SELECT * FROM images_not_for_upload_table WHERE imageSHA1 = (:imageSHA1) ")
|
||||||
abstract suspend fun getFromImageSHA1(imageSHA1: String): NotForUploadStatus?
|
abstract fun getFromImageSHA1(imageSHA1: String): NotForUploadStatus?
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Asynchronous image sha1 query.
|
* Asynchronous image sha1 query.
|
||||||
|
|
@ -38,7 +38,7 @@ abstract class NotForUploadStatusDao {
|
||||||
* Deletion Not For Upload status with image sha1.
|
* Deletion Not For Upload status with image sha1.
|
||||||
*/
|
*/
|
||||||
@Query("DELETE FROM images_not_for_upload_table WHERE imageSHA1 = (:imageSHA1) ")
|
@Query("DELETE FROM images_not_for_upload_table WHERE imageSHA1 = (:imageSHA1) ")
|
||||||
abstract suspend fun deleteWithImageSHA1(imageSHA1: String)
|
abstract fun deleteWithImageSHA1(imageSHA1: String)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Asynchronous image sha1 deletion.
|
* Asynchronous image sha1 deletion.
|
||||||
|
|
@ -49,5 +49,5 @@ abstract class NotForUploadStatusDao {
|
||||||
* Check whether the imageSHA1 is present in database
|
* Check whether the imageSHA1 is present in database
|
||||||
*/
|
*/
|
||||||
@Query("SELECT COUNT() FROM images_not_for_upload_table WHERE imageSHA1 = (:imageSHA1) ")
|
@Query("SELECT COUNT() FROM images_not_for_upload_table WHERE imageSHA1 = (:imageSHA1) ")
|
||||||
abstract suspend fun find(imageSHA1: String): Int
|
abstract fun find(imageSHA1: String): Int
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,31 +17,31 @@ abstract class UploadedStatusDao {
|
||||||
* Insert into uploaded status.
|
* Insert into uploaded status.
|
||||||
*/
|
*/
|
||||||
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
||||||
abstract suspend fun insert(uploadedStatus: UploadedStatus)
|
abstract fun insert(uploadedStatus: UploadedStatus)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update uploaded status entry.
|
* Update uploaded status entry.
|
||||||
*/
|
*/
|
||||||
@Update
|
@Update
|
||||||
abstract suspend fun update(uploadedStatus: UploadedStatus)
|
abstract fun update(uploadedStatus: UploadedStatus)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete uploaded status entry.
|
* Delete uploaded status entry.
|
||||||
*/
|
*/
|
||||||
@Delete
|
@Delete
|
||||||
abstract suspend fun delete(uploadedStatus: UploadedStatus)
|
abstract fun delete(uploadedStatus: UploadedStatus)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Query uploaded status with image sha1.
|
* Query uploaded status with image sha1.
|
||||||
*/
|
*/
|
||||||
@Query("SELECT * FROM uploaded_table WHERE imageSHA1 = (:imageSHA1) ")
|
@Query("SELECT * FROM uploaded_table WHERE imageSHA1 = (:imageSHA1) ")
|
||||||
abstract suspend fun getFromImageSHA1(imageSHA1: String): UploadedStatus?
|
abstract fun getFromImageSHA1(imageSHA1: String): UploadedStatus?
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Query uploaded status with modified image sha1.
|
* Query uploaded status with modified image sha1.
|
||||||
*/
|
*/
|
||||||
@Query("SELECT * FROM uploaded_table WHERE modifiedImageSHA1 = (:modifiedImageSHA1) ")
|
@Query("SELECT * FROM uploaded_table WHERE modifiedImageSHA1 = (:modifiedImageSHA1) ")
|
||||||
abstract suspend fun getFromModifiedImageSHA1(modifiedImageSHA1: String): UploadedStatus?
|
abstract fun getFromModifiedImageSHA1(modifiedImageSHA1: String): UploadedStatus?
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Asynchronous insert into uploaded status table.
|
* Asynchronous insert into uploaded status table.
|
||||||
|
|
@ -55,7 +55,7 @@ abstract class UploadedStatusDao {
|
||||||
* Check whether the imageSHA1 is present in database
|
* Check whether the imageSHA1 is present in database
|
||||||
*/
|
*/
|
||||||
@Query("SELECT COUNT() FROM uploaded_table WHERE imageSHA1 = (:imageSHA1) AND imageResult = (:imageResult) ")
|
@Query("SELECT COUNT() FROM uploaded_table WHERE imageSHA1 = (:imageSHA1) AND imageResult = (:imageResult) ")
|
||||||
abstract suspend fun findByImageSHA1(
|
abstract fun findByImageSHA1(
|
||||||
imageSHA1: String,
|
imageSHA1: String,
|
||||||
imageResult: Boolean,
|
imageResult: Boolean,
|
||||||
): Int
|
): Int
|
||||||
|
|
@ -66,7 +66,7 @@ abstract class UploadedStatusDao {
|
||||||
@Query(
|
@Query(
|
||||||
"SELECT COUNT() FROM uploaded_table WHERE modifiedImageSHA1 = (:modifiedImageSHA1) AND modifiedImageResult = (:modifiedImageResult) ",
|
"SELECT COUNT() FROM uploaded_table WHERE modifiedImageSHA1 = (:modifiedImageSHA1) AND modifiedImageResult = (:modifiedImageResult) ",
|
||||||
)
|
)
|
||||||
abstract suspend fun findByModifiedImageSHA1(
|
abstract fun findByModifiedImageSHA1(
|
||||||
modifiedImageSHA1: String,
|
modifiedImageSHA1: String,
|
||||||
modifiedImageResult: Boolean,
|
modifiedImageResult: Boolean,
|
||||||
): Int
|
): Int
|
||||||
|
|
|
||||||
|
|
@ -41,4 +41,23 @@ public abstract class PlaceDao {
|
||||||
saveSynchronous(place);
|
saveSynchronous(place);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deletes all Place objects from the database.
|
||||||
|
*
|
||||||
|
* @return A Completable that completes once the deletion operation is done.
|
||||||
|
*/
|
||||||
|
@Query("DELETE FROM place")
|
||||||
|
public abstract void deleteAllSynchronous();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deletes all Place objects from the database.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public Completable deleteAll() {
|
||||||
|
return Completable
|
||||||
|
.fromAction(() -> {
|
||||||
|
deleteAllSynchronous();
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -35,4 +35,8 @@ public class PlacesLocalDataSource {
|
||||||
public Completable savePlace(Place place) {
|
public Completable savePlace(Place place) {
|
||||||
return placeDao.save(place);
|
return placeDao.save(place);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Completable clearCache() {
|
||||||
|
return placeDao.deleteAll();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ package fr.free.nrw.commons.nearby;
|
||||||
import fr.free.nrw.commons.contributions.Contribution;
|
import fr.free.nrw.commons.contributions.Contribution;
|
||||||
import fr.free.nrw.commons.location.LatLng;
|
import fr.free.nrw.commons.location.LatLng;
|
||||||
import io.reactivex.Completable;
|
import io.reactivex.Completable;
|
||||||
|
import io.reactivex.schedulers.Schedulers;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -38,4 +39,13 @@ public class PlacesRepository {
|
||||||
return localDataSource.fetchPlace(entityID);
|
return localDataSource.fetchPlace(entityID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clears the Nearby cache on an IO thread.
|
||||||
|
*
|
||||||
|
* @return A Completable that completes once the cache has been successfully cleared.
|
||||||
|
*/
|
||||||
|
public Completable clearCache() {
|
||||||
|
return localDataSource.clearCache()
|
||||||
|
.subscribeOn(Schedulers.io()); // Ensure it runs on IO thread
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -108,6 +108,7 @@ import fr.free.nrw.commons.utils.NetworkUtils;
|
||||||
import fr.free.nrw.commons.utils.SystemThemeUtils;
|
import fr.free.nrw.commons.utils.SystemThemeUtils;
|
||||||
import fr.free.nrw.commons.utils.ViewUtil;
|
import fr.free.nrw.commons.utils.ViewUtil;
|
||||||
import fr.free.nrw.commons.wikidata.WikidataEditListener;
|
import fr.free.nrw.commons.wikidata.WikidataEditListener;
|
||||||
|
import io.reactivex.Completable;
|
||||||
import io.reactivex.Observable;
|
import io.reactivex.Observable;
|
||||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||||
import io.reactivex.disposables.Disposable;
|
import io.reactivex.disposables.Disposable;
|
||||||
|
|
@ -342,9 +343,21 @@ public class NearbyParentFragment extends CommonsDaggerSupportFragment
|
||||||
public void onCreateOptionsMenu(@NonNull final Menu menu,
|
public void onCreateOptionsMenu(@NonNull final Menu menu,
|
||||||
@NonNull final MenuInflater inflater) {
|
@NonNull final MenuInflater inflater) {
|
||||||
inflater.inflate(R.menu.nearby_fragment_menu, menu);
|
inflater.inflate(R.menu.nearby_fragment_menu, menu);
|
||||||
|
MenuItem refreshButton = menu.findItem(R.id.item_refresh);
|
||||||
MenuItem listMenu = menu.findItem(R.id.list_sheet);
|
MenuItem listMenu = menu.findItem(R.id.list_sheet);
|
||||||
MenuItem saveAsGPXButton = menu.findItem(R.id.list_item_gpx);
|
MenuItem saveAsGPXButton = menu.findItem(R.id.list_item_gpx);
|
||||||
MenuItem saveAsKMLButton = menu.findItem(R.id.list_item_kml);
|
MenuItem saveAsKMLButton = menu.findItem(R.id.list_item_kml);
|
||||||
|
refreshButton.setOnMenuItemClickListener(new OnMenuItemClickListener() {
|
||||||
|
@Override
|
||||||
|
public boolean onMenuItemClick(MenuItem item) {
|
||||||
|
try {
|
||||||
|
emptyCache();
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
listMenu.setOnMenuItemClickListener(new OnMenuItemClickListener() {
|
listMenu.setOnMenuItemClickListener(new OnMenuItemClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onMenuItemClick(MenuItem item) {
|
public boolean onMenuItemClick(MenuItem item) {
|
||||||
|
|
@ -1158,6 +1171,48 @@ public class NearbyParentFragment extends CommonsDaggerSupportFragment
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reloads the Nearby map
|
||||||
|
* Clears all location markers, refreshes them, reinserts them into the map.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private void reloadMap() {
|
||||||
|
clearAllMarkers(); // Clear the list of markers
|
||||||
|
binding.map.getController().setZoom(ZOOM_LEVEL); // Reset the zoom level
|
||||||
|
binding.map.getController().setCenter(lastMapFocus); // Recenter the focus
|
||||||
|
if (locationPermissionsHelper.checkLocationPermission(getActivity())) {
|
||||||
|
locationPermissionGranted(); // Reload map with user's location
|
||||||
|
} else {
|
||||||
|
startMapWithoutPermission(); // Reload map without user's location
|
||||||
|
}
|
||||||
|
binding.map.invalidate(); // Invalidate the map
|
||||||
|
presenter.updateMapAndList(LOCATION_SIGNIFICANTLY_CHANGED); // Restart the map
|
||||||
|
Timber.d("Reloaded Map Successfully");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clears the Nearby local cache and then calls for the map to be reloaded
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private void emptyCache() {
|
||||||
|
// reload the map once the cache is cleared
|
||||||
|
compositeDisposable.add(
|
||||||
|
placesRepository.clearCache()
|
||||||
|
.subscribeOn(Schedulers.io())
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
.andThen(Completable.fromAction(this::reloadMap))
|
||||||
|
.subscribe(
|
||||||
|
() -> {
|
||||||
|
Timber.d("Nearby Cache cleared successfully.");
|
||||||
|
},
|
||||||
|
throwable -> {
|
||||||
|
Timber.e(throwable, "Failed to clear the Nearby Cache");
|
||||||
|
}
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
private void savePlacesAsKML() {
|
private void savePlacesAsKML() {
|
||||||
final Observable<String> savePlacesObservable = Observable
|
final Observable<String> savePlacesObservable = Observable
|
||||||
.fromCallable(() -> nearbyController
|
.fromCallable(() -> nearbyController
|
||||||
|
|
|
||||||
|
|
@ -10,15 +10,13 @@ abstract class BaseDelegateAdapter<T>(
|
||||||
areContentsTheSame: (T, T) -> Boolean = { old, new -> old == new },
|
areContentsTheSame: (T, T) -> Boolean = { old, new -> old == new },
|
||||||
) : AsyncListDifferDelegationAdapter<T>(
|
) : AsyncListDifferDelegationAdapter<T>(
|
||||||
object : DiffUtil.ItemCallback<T>() {
|
object : DiffUtil.ItemCallback<T>() {
|
||||||
override fun areItemsTheSame(
|
override fun areItemsTheSame(oldItem: T & Any, newItem: T & Any): Boolean {
|
||||||
oldItem: T,
|
return areItemsTheSame(oldItem, newItem)
|
||||||
newItem: T,
|
}
|
||||||
) = areItemsTheSame(oldItem, newItem)
|
|
||||||
|
|
||||||
override fun areContentsTheSame(
|
override fun areContentsTheSame(oldItem: T & Any, newItem: T & Any): Boolean {
|
||||||
oldItem: T,
|
return areContentsTheSame(oldItem, newItem)
|
||||||
newItem: T,
|
}
|
||||||
) = areContentsTheSame(oldItem, newItem)
|
|
||||||
},
|
},
|
||||||
*delegates,
|
*delegates,
|
||||||
) {
|
) {
|
||||||
|
|
|
||||||
|
|
@ -22,16 +22,16 @@ abstract class DepictsDao {
|
||||||
private val maxItemsAllowed = 10
|
private val maxItemsAllowed = 10
|
||||||
|
|
||||||
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
||||||
abstract suspend fun insert(depictedItem: Depicts)
|
abstract fun insert(depictedItem: Depicts)
|
||||||
|
|
||||||
@Query("Select * From depicts_table order by lastUsed DESC")
|
@Query("Select * From depicts_table order by lastUsed DESC")
|
||||||
abstract suspend fun getAllDepicts(): List<Depicts>
|
abstract fun getAllDepicts(): List<Depicts>
|
||||||
|
|
||||||
@Query("Select * From depicts_table order by lastUsed DESC LIMIT :n OFFSET 10")
|
@Query("Select * From depicts_table order by lastUsed DESC LIMIT :n OFFSET 10")
|
||||||
abstract suspend fun getDepictsForDeletion(n: Int): List<Depicts>
|
abstract fun getDepictsForDeletion(n: Int): List<Depicts>
|
||||||
|
|
||||||
@Delete
|
@Delete
|
||||||
abstract suspend fun delete(depicts: Depicts)
|
abstract fun delete(depicts: Depicts)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets all Depicts objects from the database, ordered by lastUsed in descending order.
|
* Gets all Depicts objects from the database, ordered by lastUsed in descending order.
|
||||||
|
|
|
||||||
18
app/src/main/res/drawable/ic_refresh_24dp_nearby.xml
Normal file
18
app/src/main/res/drawable/ic_refresh_24dp_nearby.xml
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="@dimen/half_standard_height"
|
||||||
|
android:height="@dimen/half_standard_height"
|
||||||
|
android:viewportHeight="24.0"
|
||||||
|
android:viewportWidth="24.0">
|
||||||
|
|
||||||
|
<group
|
||||||
|
android:scaleX="1.0"
|
||||||
|
android:scaleY="1.0"
|
||||||
|
android:translateX="-0.0"
|
||||||
|
android:translateY="-0.0">
|
||||||
|
|
||||||
|
<path
|
||||||
|
android:fillColor="?attr/menu_item_tint"
|
||||||
|
android:pathData="M17.65,6.35C16.2,4.9 14.21,4 12,4c-4.42,0 -7.99,3.58 -7.99,8s3.57,8 7.99,8c3.73,0 6.84,-2.55 7.73,-6h-2.08c-0.82,2.33 -3.04,4 -5.65,4 -3.31,0 -6,-2.69 -6,-6s2.69,-6 6,-6c1.66,0 3.14,0.69 4.22,1.78L13,11h7V4l-2.35,2.35z"/>
|
||||||
|
|
||||||
|
</group>
|
||||||
|
</vector>
|
||||||
|
|
@ -1,17 +1,25 @@
|
||||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
|
|
||||||
|
<item android:id="@+id/item_refresh"
|
||||||
|
android:title="Refresh"
|
||||||
|
app:showAsAction="ifRoom"
|
||||||
|
android:icon="@drawable/ic_refresh_24dp_nearby" />
|
||||||
|
|
||||||
<item android:id="@+id/list_sheet"
|
<item android:id="@+id/list_sheet"
|
||||||
android:title="@string/list_sheet"
|
android:title="@string/list_sheet"
|
||||||
app:showAsAction="ifRoom|withText"
|
app:showAsAction="ifRoom|withText"
|
||||||
android:icon="@drawable/ic_list_white_24dp"
|
android:icon="@drawable/ic_list_white_24dp"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<item android:id="@+id/list_item_gpx"
|
<item android:id="@+id/list_item_gpx"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:title="Save as GPX file" />
|
android:title="Save as GPX file" />
|
||||||
|
|
||||||
<item android:id="@+id/list_item_kml"
|
<item android:id="@+id/list_item_kml"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:title="Save as KML file" />
|
android:title="Save as KML file" />
|
||||||
|
|
||||||
</menu>
|
</menu>
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ buildscript {
|
||||||
maven { url "https://plugins.gradle.org/m2/" }
|
maven { url "https://plugins.gradle.org/m2/" }
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:8.5.0'
|
classpath 'com.android.tools.build:gradle:8.7.0'
|
||||||
classpath 'com.getkeepsafe.dexcount:dexcount-gradle-plugin:0.8.2'
|
classpath 'com.getkeepsafe.dexcount:dexcount-gradle-plugin:0.8.2'
|
||||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$KOTLIN_VERSION"
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$KOTLIN_VERSION"
|
||||||
classpath 'org.codehaus.groovy:groovy-all:2.4.15'
|
classpath 'org.codehaus.groovy:groovy-all:2.4.15'
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ org.gradle.jvmargs=-Xmx1536M
|
||||||
org.gradle.caching=true
|
org.gradle.caching=true
|
||||||
android.enableR8.fullMode=false
|
android.enableR8.fullMode=false
|
||||||
|
|
||||||
KOTLIN_VERSION=1.7.20
|
KOTLIN_VERSION=1.9.22
|
||||||
LEAK_CANARY_VERSION=2.10
|
LEAK_CANARY_VERSION=2.10
|
||||||
DAGGER_VERSION=2.23
|
DAGGER_VERSION=2.23
|
||||||
ROOM_VERSION=2.5.0
|
ROOM_VERSION=2.5.0
|
||||||
|
|
|
||||||
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
|
|
@ -1,6 +1,6 @@
|
||||||
#Sun Apr 23 18:22:54 IST 2023
|
#Sun Apr 23 18:22:54 IST 2023
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
Loading…
Add table
Add a link
Reference in a new issue