mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
Remove unused classes
This commit is contained in:
parent
511e663f9b
commit
edc17afa0a
3 changed files with 0 additions and 133 deletions
|
|
@ -1,8 +0,0 @@
|
|||
package fr.free.nrw.commons.api;
|
||||
|
||||
import com.android.volley.RequestQueue;
|
||||
|
||||
public class MWApi {
|
||||
private RequestQueue queue;
|
||||
|
||||
}
|
||||
|
|
@ -1,66 +0,0 @@
|
|||
package fr.free.nrw.commons.contributions;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import fr.free.nrw.commons.CommonsApplication;
|
||||
import fr.free.nrw.commons.Media;
|
||||
import fr.free.nrw.commons.R;
|
||||
|
||||
public class MediaListAdapter extends BaseAdapter {
|
||||
private ArrayList<Media> mediaList;
|
||||
private Activity activity;
|
||||
|
||||
public MediaListAdapter(Activity activity, ArrayList<Media> mediaList) {
|
||||
this.mediaList = mediaList;
|
||||
this.activity = activity;
|
||||
}
|
||||
|
||||
public void updateMediaList(ArrayList<Media> newMediaList) {
|
||||
// FIXME: Hack for now, replace with something more efficient later on
|
||||
for(Media newMedia: newMediaList) {
|
||||
boolean isDuplicate = false;
|
||||
for(Media oldMedia: mediaList ) {
|
||||
if(newMedia.getFilename().equals(oldMedia.getFilename())) {
|
||||
isDuplicate = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!isDuplicate) {
|
||||
mediaList.add(0, newMedia);
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public int getCount() {
|
||||
return mediaList.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int i) {
|
||||
return mediaList.get(i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int i) {
|
||||
return i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int i, View view, ViewGroup viewGroup) {
|
||||
if(view == null) {
|
||||
view = activity.getLayoutInflater().inflate(R.layout.layout_contribution, null, false);
|
||||
view.setTag(new ContributionViewHolder(view));
|
||||
}
|
||||
|
||||
Media m = (Media) getItem(i);
|
||||
ContributionViewHolder holder = (ContributionViewHolder) view.getTag();
|
||||
holder.imageView.setMedia(m, ((CommonsApplication)activity.getApplicationContext()).getImageLoader());
|
||||
holder.titleView.setText(m.getDisplayTitle());
|
||||
return view;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,59 +0,0 @@
|
|||
package fr.free.nrw.commons.media;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.v4.content.AsyncTaskLoader;
|
||||
import android.util.Log;
|
||||
|
||||
import org.mediawiki.api.ApiResult;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import fr.free.nrw.commons.CommonsApplication;
|
||||
import fr.free.nrw.commons.Media;
|
||||
import fr.free.nrw.commons.Utils;
|
||||
|
||||
public class CategoryImagesLoader extends AsyncTaskLoader<List<Media>>{
|
||||
private final CommonsApplication app;
|
||||
private final String category;
|
||||
|
||||
public CategoryImagesLoader(Context context, String category) {
|
||||
super(context);
|
||||
this.app = (CommonsApplication) context.getApplicationContext();
|
||||
this.category = category;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStartLoading() {
|
||||
super.onStartLoading();
|
||||
super.forceLoad();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Media> loadInBackground() {
|
||||
ArrayList<Media> mediaList = new ArrayList<>();
|
||||
ApiResult result;
|
||||
try {
|
||||
result = app.getApi().action("query")
|
||||
.param("list", "categorymembers")
|
||||
.param("cmtitle", "Category:" + category)
|
||||
.param("cmprop", "title|timestamp")
|
||||
.param("cmtype", "file")
|
||||
.param("cmsort", "timestamp")
|
||||
.param("cmdir", "descending")
|
||||
.param("cmlimit", 50)
|
||||
.get();
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
Log.d("Commons", Utils.getStringFromDOM(result.getDocument()));
|
||||
|
||||
List<ApiResult> members = result.getNodes("/api/query/categorymembers/cm");
|
||||
for(ApiResult member : members) {
|
||||
mediaList.add(new Media(member.getString("@title")));
|
||||
}
|
||||
return mediaList;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue