备份,准备回滚为无插件化
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
package com.jianrmg_v2.usermodel.Adapters;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class DownloadItemAdapter extends BaseAdapter {
|
||||
private Context context;
|
||||
private List<?> list;
|
||||
|
||||
public DownloadItemAdapter(Context context, List<?> list) {
|
||||
this.context = context;
|
||||
this.list = list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return list.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int i) {
|
||||
return list.get(i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int i) {
|
||||
return i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int i, View view, ViewGroup viewGroup) {
|
||||
Items items;
|
||||
if(view==null){
|
||||
view= LayoutInflater.from(context).inflate(com.yutou.jianrmg_v2.resmodl.R.layout.item_download,null);
|
||||
items=new Items();
|
||||
|
||||
view.setTag(items);
|
||||
}else{
|
||||
items= (Items) view.getTag();
|
||||
}
|
||||
return view;
|
||||
}
|
||||
private class Items{
|
||||
ImageView icon;
|
||||
TextView title;
|
||||
}
|
||||
}
|
||||
@@ -4,20 +4,80 @@ import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.ListView;
|
||||
|
||||
import com.yutou.jianrmg_v2.basemodel.Interfaces.HttpInterface;
|
||||
import com.yutou.jianrmg_v2.basemodel.Network.HttpApi;
|
||||
import com.yutou.jianrmg_v2.basemodel.Network.HttpUtils;
|
||||
import com.yutou.jianrmg_v2.basemodel.Tools.Utils;
|
||||
import com.yutou.jianrmg_v2.resmodl.R;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import Interfaces.BaseActivityInterface;
|
||||
|
||||
public class DownloadListActivity implements BaseActivityInterface ,Serializable {
|
||||
private Context context;
|
||||
private LinearLayout layout;
|
||||
private View view;
|
||||
private ListView listView;
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState, LinearLayout layout, Context context, Intent intent) {
|
||||
this.context=context;
|
||||
this.layout=layout;
|
||||
this.view= LayoutInflater.from(context).inflate(R.layout.activity_download_list,null);
|
||||
getDownloadFileList();
|
||||
initViews();
|
||||
layout.addView(view);
|
||||
}
|
||||
private void getDownloadFileList(){
|
||||
JSONObject json=new JSONObject();
|
||||
File rootPath=new File(Utils.getSDCardPath());
|
||||
try{
|
||||
JSONArray array=new JSONArray();
|
||||
for (File path : rootPath.listFiles()) {
|
||||
if (path.isDirectory()){
|
||||
try {
|
||||
array.put(Integer.valueOf(path.getName())+"");
|
||||
}catch (Exception e){}
|
||||
}
|
||||
}
|
||||
json.put("ids",array);
|
||||
HttpUtils.post(HttpApi.HOME_URL + HttpApi.MOD_MODS, json, new HttpInterface() {
|
||||
@Override
|
||||
public void httpGetData(String string, int code) {
|
||||
try {
|
||||
JSONObject json=new JSONObject(string);
|
||||
if(json.getInt("code")!=100){
|
||||
return;
|
||||
}
|
||||
JSONArray dataList=json.getJSONArray("data");
|
||||
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void httpError(Exception e) {
|
||||
|
||||
}
|
||||
});
|
||||
}catch (Exception e){}
|
||||
return;
|
||||
}
|
||||
private void initViews(){
|
||||
listView=view.findViewById(R.id.listView);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user