|
|
|
@ -5,8 +5,22 @@ import android.view.View; |
|
|
|
import android.widget.LinearLayout; |
|
|
|
import android.widget.TextView; |
|
|
|
|
|
|
|
import com.google.gson.Gson; |
|
|
|
import com.google.gson.JsonArray; |
|
|
|
import com.google.gson.JsonElement; |
|
|
|
import com.google.gson.JsonParser; |
|
|
|
import com.qhclh.ytzh.R; |
|
|
|
import com.qhclh.ytzh.base.BaseFragment; |
|
|
|
import com.qhclh.ytzh.home.RpcUrl; |
|
|
|
import com.qhclh.ytzh.tasks.ViewOnClickTask; |
|
|
|
|
|
|
|
import org.forks.jsonrpc.JsonRpcResult; |
|
|
|
import org.forks.jsonrpc.RpcFacade; |
|
|
|
import org.forks.jsonrpc.RpcObject; |
|
|
|
import org.json.JSONArray; |
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
import butterknife.BindView; |
|
|
|
|
|
|
|
@ -40,43 +54,56 @@ public class YuchuFragment extends BaseFragment { |
|
|
|
@Override |
|
|
|
public void onResume() { |
|
|
|
super.onResume(); |
|
|
|
firstContent.removeAllViews(); |
|
|
|
for (int i=0;i<3;i++){ |
|
|
|
View view = LayoutInflater.from(getActivity()).inflate(R.layout.view_first,null); |
|
|
|
TextView name = view.findViewById(R.id.name); |
|
|
|
|
|
|
|
LinearLayout secondContent = view.findViewById(R.id.secondContent); |
|
|
|
LinearLayout main_ll = view.findViewById(R.id.main_ll); |
|
|
|
|
|
|
|
name.setText("场:"+i); |
|
|
|
main_ll.setTag(i); |
|
|
|
secondContent.removeAllViews(); |
|
|
|
for (int j=0;j<i+1;j++){ |
|
|
|
View view2 = LayoutInflater.from(getActivity()).inflate(R.layout.view_second,null); |
|
|
|
TextView item1 = view2.findViewById(R.id.item1); |
|
|
|
TextView item2 = view2.findViewById(R.id.item2); |
|
|
|
TextView item3 = view2.findViewById(R.id.item3); |
|
|
|
TextView item4 = view2.findViewById(R.id.item4); |
|
|
|
|
|
|
|
item1.setText("批次"+i+":"+i+1); |
|
|
|
item2.setText("周龄"+i+":"+i+2); |
|
|
|
item3.setText("死淘"+i+":"+i+3); |
|
|
|
item4.setText("成活率"+i+":"+i+4); |
|
|
|
secondContent.addView(view2); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
BatchTotalCount1(); |
|
|
|
} |
|
|
|
|
|
|
|
firstContent.addView(view); |
|
|
|
main_ll.setOnClickListener(new View.OnClickListener() { |
|
|
|
@Override |
|
|
|
public void onClick(View view) { |
|
|
|
System.out.println("aaa++++++tag+++"+view.getTag()); |
|
|
|
if ((int)view.getTag()==1){ |
|
|
|
System.out.println("aaa+++++tttt+++"+view.getTag()); |
|
|
|
private void BatchTotalCount1() { |
|
|
|
ViewOnClickTask BatchTotalCount1Task = new ViewOnClickTask(getActivity(),"加载中...") { |
|
|
|
List<RpcObject> rpcStr; |
|
|
|
@Override |
|
|
|
protected void successUI() { |
|
|
|
firstContent.removeAllViews(); |
|
|
|
for (int i=0;i<rpcStr.size();i++){ |
|
|
|
View view = LayoutInflater.from(getActivity()).inflate(R.layout.view_first,null); |
|
|
|
TextView name = view.findViewById(R.id.name); |
|
|
|
|
|
|
|
LinearLayout secondContent = view.findViewById(R.id.secondContent); |
|
|
|
LinearLayout main_ll = view.findViewById(R.id.main_ll); |
|
|
|
|
|
|
|
name.setText(rpcStr.get(i).getString("BreedFactory_Name")); |
|
|
|
main_ll.setTag(rpcStr.get(i).getLong("BreedFactory_ID")); |
|
|
|
secondContent.removeAllViews(); |
|
|
|
List<RpcObject> detailsList = rpcStr.get(i).getList("Details"); |
|
|
|
for (int j=0;j<detailsList.size();j++){ |
|
|
|
View view2 = LayoutInflater.from(getActivity()).inflate(R.layout.view_second,null); |
|
|
|
TextView item1 = view2.findViewById(R.id.item1); |
|
|
|
TextView item2 = view2.findViewById(R.id.item2); |
|
|
|
TextView item3 = view2.findViewById(R.id.item3); |
|
|
|
TextView item4 = view2.findViewById(R.id.item4); |
|
|
|
|
|
|
|
item1.setText(detailsList.get(j).getString("Batch_Name")); |
|
|
|
item2.setText("周龄:"+i+2); |
|
|
|
item3.setText("死淘:"+detailsList.get(j).getInt("SiTaoNumber")); |
|
|
|
item4.setText("成活率:"+detailsList.get(j).getDecimal("SurvivalRate")); |
|
|
|
secondContent.addView(view2); |
|
|
|
} |
|
|
|
firstContent.addView(view); |
|
|
|
main_ll.setOnClickListener(new View.OnClickListener() { |
|
|
|
@Override |
|
|
|
public void onClick(View view) { |
|
|
|
System.out.println("aaa++++++tag+long++"+view.getTag()); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public Object call() throws Exception { |
|
|
|
JsonRpcResult result = RpcFacade.rpcCall(RpcUrl.BatchTotalCount1); |
|
|
|
rpcStr = result.getRpcObjectList(RpcUrl.BatchTotalCount1_fanhui); |
|
|
|
return null; |
|
|
|
} |
|
|
|
}; |
|
|
|
BatchTotalCount1Task.execute(); |
|
|
|
} |
|
|
|
} |