mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-11-03 08:13:55 +01:00
#3077 Hide disambiguation items from depiction search - when fetching depictions get the entity instead of the search result (#3741)
This commit is contained in:
parent
34f02499e4
commit
057d11a0e0
31 changed files with 359 additions and 582 deletions
|
|
@ -4,7 +4,7 @@ import android.os.Parcelable
|
|||
import androidx.annotation.WorkerThread
|
||||
import fr.free.nrw.commons.wikidata.WikidataProperties.DEPICTS
|
||||
import kotlinx.android.parcel.Parcelize
|
||||
import org.wikipedia.wikidata.DataValue.DataValueEntityId
|
||||
import org.wikipedia.wikidata.DataValue.EntityId
|
||||
import org.wikipedia.wikidata.Entities
|
||||
import java.util.*
|
||||
|
||||
|
|
@ -18,7 +18,7 @@ data class Depictions(val depictions: List<IdAndLabel>) : Parcelable {
|
|||
entities.first?.statements
|
||||
?.getOrElse(DEPICTS.propertyName, { emptyList() })
|
||||
?.map { statement ->
|
||||
(statement.mainSnak.dataValue as DataValueEntityId).value.id
|
||||
(statement.mainSnak.dataValue as EntityId).value.id
|
||||
}
|
||||
?.map { id -> IdAndLabel(id, fetchLabel(mediaClient, id)) }
|
||||
?: emptyList()
|
||||
|
|
|
|||
|
|
@ -602,10 +602,9 @@ public class MediaDetailFragment extends CommonsDaggerSupportFragment {
|
|||
textView.setText(depictionName);
|
||||
if (depictionLoaded) {
|
||||
item.setOnClickListener(view -> {
|
||||
DepictedItem depictedItem = new DepictedItem(depictionName, "", "", false, entityId);
|
||||
Intent intent = new Intent(getContext(), WikidataItemDetailsActivity.class);
|
||||
intent.putExtra("wikidataItemName", depictedItem.getName());
|
||||
intent.putExtra("entityId", depictedItem.getId());
|
||||
intent.putExtra("wikidataItemName", depictionName);
|
||||
intent.putExtra("entityId", entityId);
|
||||
getContext().startActivity(intent);
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue