mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-11-02 15:53:55 +01:00
Convert WikidataEditListener to kotlin
This commit is contained in:
parent
16d4a64224
commit
4dac09a3b3
5 changed files with 25 additions and 37 deletions
|
|
@ -1,16 +0,0 @@
|
||||||
package fr.free.nrw.commons.wikidata;
|
|
||||||
|
|
||||||
public abstract class WikidataEditListener {
|
|
||||||
|
|
||||||
protected WikidataP18EditListener wikidataP18EditListener;
|
|
||||||
|
|
||||||
public abstract void onSuccessfulWikidataEdit();
|
|
||||||
|
|
||||||
public void setAuthenticationStateListener(WikidataP18EditListener wikidataP18EditListener) {
|
|
||||||
this.wikidataP18EditListener = wikidataP18EditListener;
|
|
||||||
}
|
|
||||||
|
|
||||||
public interface WikidataP18EditListener {
|
|
||||||
void onWikidataEditSuccessful();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
package fr.free.nrw.commons.wikidata
|
||||||
|
|
||||||
|
abstract class WikidataEditListener {
|
||||||
|
var authenticationStateListener: WikidataP18EditListener? = null
|
||||||
|
|
||||||
|
abstract fun onSuccessfulWikidataEdit()
|
||||||
|
|
||||||
|
interface WikidataP18EditListener {
|
||||||
|
fun onWikidataEditSuccessful()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,20 +0,0 @@
|
||||||
package fr.free.nrw.commons.wikidata;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Listener for wikidata edits
|
|
||||||
*/
|
|
||||||
public class WikidataEditListenerImpl extends WikidataEditListener {
|
|
||||||
|
|
||||||
public WikidataEditListenerImpl() {
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Fired when wikidata P18 edit is successful. If there's an active listener, then it is fired
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void onSuccessfulWikidataEdit() {
|
|
||||||
if (wikidataP18EditListener != null) {
|
|
||||||
wikidataP18EditListener.onWikidataEditSuccessful();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
package fr.free.nrw.commons.wikidata
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Listener for wikidata edits
|
||||||
|
*/
|
||||||
|
class WikidataEditListenerImpl : WikidataEditListener() {
|
||||||
|
/**
|
||||||
|
* Fired when wikidata P18 edit is successful. If there's an active listener, then it is fired
|
||||||
|
*/
|
||||||
|
override fun onSuccessfulWikidataEdit() {
|
||||||
|
authenticationStateListener?.onWikidataEditSuccessful()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -325,7 +325,7 @@ class NearbyParentFragmentUnitTest {
|
||||||
@Throws(Exception::class)
|
@Throws(Exception::class)
|
||||||
fun testOnDestroy() {
|
fun testOnDestroy() {
|
||||||
fragment.onDestroy()
|
fragment.onDestroy()
|
||||||
verify(wikidataEditListener).setAuthenticationStateListener(null)
|
verify(wikidataEditListener).authenticationStateListener = null
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test @Ignore
|
@Test @Ignore
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue