mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 21:03:54 +01:00
Rest of the work and documentation
This commit is contained in:
parent
71a83385e7
commit
ab7edc4cd2
5 changed files with 84 additions and 7 deletions
|
|
@ -20,6 +20,32 @@ abstract class NotForUploadStatusDao {
|
||||||
*/
|
*/
|
||||||
@Delete
|
@Delete
|
||||||
abstract suspend fun delete(notForUploadStatus: NotForUploadStatus)
|
abstract suspend fun delete(notForUploadStatus: NotForUploadStatus)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Query Not For Upload status with image sha1.
|
||||||
|
*/
|
||||||
|
@Query("SELECT * FROM not_for_upload_table WHERE imageSHA1 = (:imageSHA1) ")
|
||||||
|
abstract suspend fun getFromImageSHA1(imageSHA1 : String) : NotForUploadStatus?
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Asynchronous image sha1 query.
|
||||||
|
*/
|
||||||
|
suspend fun getNotForUploadFromImageSHA1(imageSHA1: String):NotForUploadStatus? {
|
||||||
|
return getFromImageSHA1(imageSHA1)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deletion Not For Upload status with image sha1.
|
||||||
|
*/
|
||||||
|
@Query("DELETE FROM not_for_upload_table WHERE imageSHA1 = (:imageSHA1) ")
|
||||||
|
abstract suspend fun deleteWithImageSHA1(imageSHA1 : String)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Asynchronous image sha1 deletion.
|
||||||
|
*/
|
||||||
|
suspend fun deleteNotForUploadWithImageSHA1(imageSHA1: String) {
|
||||||
|
return deleteWithImageSHA1(imageSHA1)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
package fr.free.nrw.commons.customselector.database
|
package fr.free.nrw.commons.customselector.database
|
||||||
|
|
||||||
import androidx.room.Entity
|
import androidx.room.*
|
||||||
import androidx.room.PrimaryKey
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Entity class for Not For Upload status.
|
* Entity class for Not For Upload status.
|
||||||
|
|
@ -13,5 +12,10 @@ data class NotForUploadStatus(
|
||||||
* Original image sha1.
|
* Original image sha1.
|
||||||
*/
|
*/
|
||||||
@PrimaryKey
|
@PrimaryKey
|
||||||
val imageSHA1 : String
|
val imageSHA1 : String,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* imageSHA1 query result from API.
|
||||||
|
*/
|
||||||
|
var imageResult : Boolean
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ import android.view.Window
|
||||||
import android.widget.Button
|
import android.widget.Button
|
||||||
import android.widget.ImageButton
|
import android.widget.ImageButton
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
|
import androidx.constraintlayout.widget.ConstraintLayout
|
||||||
import androidx.lifecycle.ViewModelProvider
|
import androidx.lifecycle.ViewModelProvider
|
||||||
import fr.free.nrw.commons.R
|
import fr.free.nrw.commons.R
|
||||||
import fr.free.nrw.commons.customselector.listeners.FolderClickListener
|
import fr.free.nrw.commons.customselector.listeners.FolderClickListener
|
||||||
|
|
@ -128,7 +129,7 @@ class CustomSelectorActivity: BaseActivity(), FolderClickListener, ImageSelectLi
|
||||||
val back : ImageButton = findViewById(R.id.back)
|
val back : ImageButton = findViewById(R.id.back)
|
||||||
back.setOnClickListener { onBackPressed() }
|
back.setOnClickListener { onBackPressed() }
|
||||||
|
|
||||||
val done : ImageButton = findViewById(R.id.done)
|
val done : Button = findViewById(R.id.upload)
|
||||||
done.setOnClickListener { onDone() }
|
done.setOnClickListener { onDone() }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -154,8 +155,8 @@ class CustomSelectorActivity: BaseActivity(), FolderClickListener, ImageSelectLi
|
||||||
override fun onSelectedImagesChanged(selectedImages: ArrayList<Image>) {
|
override fun onSelectedImagesChanged(selectedImages: ArrayList<Image>) {
|
||||||
viewModel.selectedImages.value = selectedImages
|
viewModel.selectedImages.value = selectedImages
|
||||||
|
|
||||||
val done : ImageButton = findViewById(R.id.done)
|
val bottomLayout : ConstraintLayout = findViewById(R.id.bottom_layout)
|
||||||
done.visibility = if (selectedImages.isEmpty()) View.INVISIBLE else View.VISIBLE
|
bottomLayout.visibility = if (selectedImages.isEmpty()) View.GONE else View.VISIBLE
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ import fr.free.nrw.commons.upload.depicts.DepictsDao
|
||||||
* The database for accessing the respective DAOs
|
* The database for accessing the respective DAOs
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Database(entities = [Contribution::class, Depicts::class, UploadedStatus::class, NotForUploadStatus::class], version = 12, exportSchema = false)
|
@Database(entities = [Contribution::class, Depicts::class, UploadedStatus::class, NotForUploadStatus::class], version = 13, exportSchema = false)
|
||||||
@TypeConverters(Converters::class)
|
@TypeConverters(Converters::class)
|
||||||
abstract class AppDatabase : RoomDatabase() {
|
abstract class AppDatabase : RoomDatabase() {
|
||||||
abstract fun contributionDao(): ContributionDao
|
abstract fun contributionDao(): ContributionDao
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,52 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintBottom_toTopOf="@id/bottom_layout"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/toolbar_layout"/>
|
app:layout_constraintTop_toBottomOf="@+id/toolbar_layout"/>
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:id="@+id/bottom_layout"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="@color/white"
|
||||||
|
android:visibility="gone"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent">
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/not_for_upload"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Mark as not for upload"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:visibility="visible"
|
||||||
|
android:layout_margin="5dp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@id/bottom_layout"
|
||||||
|
app:layout_constraintEnd_toStartOf="@+id/guideline3"
|
||||||
|
app:layout_constraintStart_toStartOf="@id/bottom_layout"
|
||||||
|
app:layout_constraintTop_toTopOf="@id/bottom_layout" />
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.Guideline
|
||||||
|
android:id="@+id/guideline3"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
app:layout_constraintGuide_percent="0.5" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/upload"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:text="Upload"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:visibility="visible"
|
||||||
|
android:layout_margin="5dp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@id/bottom_layout"
|
||||||
|
app:layout_constraintEnd_toEndOf="@id/bottom_layout"
|
||||||
|
app:layout_constraintStart_toStartOf="@+id/guideline3"
|
||||||
|
app:layout_constraintTop_toTopOf="@id/bottom_layout" />
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
Loading…
Add table
Add a link
Reference in a new issue