mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-11-02 15:53:55 +01:00
Convert Edit to kotlin along with deleting unused class
This commit is contained in:
parent
64354fb9e4
commit
e4fdb7914c
3 changed files with 25 additions and 67 deletions
|
|
@ -1,36 +0,0 @@
|
||||||
package fr.free.nrw.commons.wikidata.model.edit;
|
|
||||||
|
|
||||||
import androidx.annotation.Nullable;
|
|
||||||
import fr.free.nrw.commons.wikidata.mwapi.MwPostResponse;
|
|
||||||
|
|
||||||
public class Edit extends MwPostResponse {
|
|
||||||
@Nullable private Result edit;
|
|
||||||
|
|
||||||
@Nullable public Result edit() {
|
|
||||||
return edit;
|
|
||||||
}
|
|
||||||
|
|
||||||
public class Result {
|
|
||||||
@Nullable private String result;
|
|
||||||
@Nullable private String code;
|
|
||||||
@Nullable private String info;
|
|
||||||
@Nullable private String warning;
|
|
||||||
|
|
||||||
public boolean editSucceeded() {
|
|
||||||
return "Success".equals(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nullable public String code() {
|
|
||||||
return code;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nullable public String info() {
|
|
||||||
return info;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nullable public String warning() {
|
|
||||||
return warning;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
package fr.free.nrw.commons.wikidata.model.edit
|
||||||
|
|
||||||
|
import fr.free.nrw.commons.wikidata.mwapi.MwPostResponse
|
||||||
|
|
||||||
|
class Edit : MwPostResponse() {
|
||||||
|
private val edit: Result? = null
|
||||||
|
|
||||||
|
fun edit(): Result? = edit
|
||||||
|
|
||||||
|
class Result {
|
||||||
|
private val result: String? = null
|
||||||
|
private val code: String? = null
|
||||||
|
private val info: String? = null
|
||||||
|
private val warning: String? = null
|
||||||
|
|
||||||
|
fun editSucceeded(): Boolean =
|
||||||
|
"Success" == result
|
||||||
|
|
||||||
|
fun code(): String? = code
|
||||||
|
|
||||||
|
fun info(): String? = info
|
||||||
|
|
||||||
|
fun warning(): String? = warning
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,31 +0,0 @@
|
||||||
package fr.free.nrw.commons.wikidata.model.edit;
|
|
||||||
|
|
||||||
import android.os.Parcel;
|
|
||||||
import android.os.Parcelable;
|
|
||||||
import fr.free.nrw.commons.wikidata.model.BaseModel;
|
|
||||||
|
|
||||||
public abstract class EditResult extends BaseModel implements Parcelable {
|
|
||||||
private final String result;
|
|
||||||
|
|
||||||
public EditResult(String result) {
|
|
||||||
this.result = result;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected EditResult(Parcel in) {
|
|
||||||
this.result = in.readString();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getResult() {
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int describeContents() {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeToParcel(Parcel dest, int flags) {
|
|
||||||
dest.writeString(result);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue