|
|
|
@ -1,13 +1,19 @@ |
|
|
|
package com.qhclh.ytzh.work.productiondailyw; |
|
|
|
|
|
|
|
import android.content.DialogInterface; |
|
|
|
import android.support.v7.app.AlertDialog; |
|
|
|
import android.view.View; |
|
|
|
import android.widget.AdapterView; |
|
|
|
import android.widget.ArrayAdapter; |
|
|
|
import android.widget.Spinner; |
|
|
|
import android.widget.TextView; |
|
|
|
|
|
|
|
import com.qhclh.ytzh.R; |
|
|
|
import com.qhclh.ytzh.base.BaseFragment; |
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
import butterknife.BindView; |
|
|
|
|
|
|
|
/** |
|
|
|
@ -17,7 +23,7 @@ import butterknife.BindView; |
|
|
|
public class DetailsofdocumentsFragment extends BaseFragment { |
|
|
|
private ProductiondailywActivity act; |
|
|
|
@BindView(R.id.detaild_buildinghome) |
|
|
|
Spinner detaild_buildinghome; |
|
|
|
TextView detaild_buildinghome; |
|
|
|
@Override |
|
|
|
protected int setLayout() { |
|
|
|
return R.layout.fragment_detailsofdoc; |
|
|
|
@ -32,23 +38,35 @@ public class DetailsofdocumentsFragment extends BaseFragment { |
|
|
|
protected void initData() { |
|
|
|
act = (ProductiondailywActivity) getActivity(); |
|
|
|
|
|
|
|
ArrayAdapter<String> adapter=new ArrayAdapter<String>(getActivity(), android.R.layout.simple_spinner_item,BasicattributesFragment.houseNameList); |
|
|
|
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); |
|
|
|
detaild_buildinghome.setAdapter(adapter); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
protected void initOper() { |
|
|
|
detaild_buildinghome.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { |
|
|
|
detaild_buildinghome.setOnClickListener(new View.OnClickListener() { |
|
|
|
@Override |
|
|
|
public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) { |
|
|
|
act.setHouseid(Long.parseLong(BasicattributesFragment.houseIdList.get(i))); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void onNothingSelected(AdapterView<?> adapterView) { |
|
|
|
|
|
|
|
public void onClick(View view) { |
|
|
|
int size = BasicattributesFragment.houseNameList.size(); |
|
|
|
final String items[] = BasicattributesFragment.houseNameList.toArray(new String[size]); |
|
|
|
new AlertDialog.Builder(getActivity()) |
|
|
|
.setTitle("请选择栋舍") |
|
|
|
.setIcon(R.mipmap.ic_launcher) |
|
|
|
.setSingleChoiceItems(items, 0, |
|
|
|
new DialogInterface.OnClickListener() { |
|
|
|
public void onClick(DialogInterface dialog, int which) { |
|
|
|
detaild_buildinghome.setText(items[which]); |
|
|
|
act.setHouseid(Long.parseLong(BasicattributesFragment.houseIdList.get(which))); |
|
|
|
dialog.dismiss(); |
|
|
|
} |
|
|
|
} |
|
|
|
) |
|
|
|
.setNegativeButton("取消", new DialogInterface.OnClickListener() { |
|
|
|
@Override |
|
|
|
public void onClick(DialogInterface dialogInterface, int i) { |
|
|
|
dialogInterface.dismiss(); |
|
|
|
} |
|
|
|
}) |
|
|
|
.show(); |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
|