android - 房源登记模版
生活随笔
收集整理的這篇文章主要介紹了
android - 房源登记模版
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
[1] 實現順序
房源登記-》房源預審核-》
房屋信息house_regist01 (首頁改為模版)-》
選擇模版(添加模版+模版列表)-》
編輯模版
[2] 具體圖片
[3] 實現代碼
house_regist01 Layout
<com.cnhct.hechen.View.Titlebarandroid:id="@+id/titlebar_house_regist01"android:layout_width="match_parent"android:layout_height="wrap_content"android:background="@color/red"android:padding="10sp"custom:leftButtonText="返回"custom:leftButtonTextColor="@color/white"custom:leftButtonTextSize="8sp"custom:rightButtonText="模版"custom:rightButtonTextSize="8sp"custom:rightButtonTextColor="@color/white"custom:titleColor="@color/colorWhite"custom:titleSize="8sp"custom:titleText="房屋信息">house_regist01 Activity
public void initDate() {tb = (Titlebar) findViewById(R.id.titlebar_house_regist01);tb.setOnButtonClickListener(new Titlebar.OnButtonClickListener() {@Overridepublic void onLeftClick() {final WarningDialog dialog = SmartisanDialog.createWarningDialog(house_regist01.this);dialog.setTitle("您信息尚未填寫完整,確定退出嗎").setConfirmText("退出").show();dialog.setOnConfirmListener(new WarningDialog.OnConfirmListener() {@Overridepublic void onConfirm() {EventBus.getDefault().post("FLAG_FINISH_ALL");dialog.dismiss();}});}@Overridepublic void onRightClick() {//選擇模版Intent intent = new Intent(house_regist01.this, TemplateListActivity.class);startActivity(intent);finish();}});TemplateListActivity 選擇模版(添加模版+模版列表)
Layout
template_item
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"android:orientation="vertical"android:layout_width="match_parent"android:layout_height="match_parent"><TextViewandroid:layout_height="1dp"android:layout_width="match_parent"android:background="@color/gray"/><TextViewandroid:id="@+id/tv_template_title"android:layout_width="match_parent"android:layout_height="wrap_content"android:text="@string/template_one"android:textColor="@color/black"android:textSize="20sp" /><LinearLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"android:orientation="horizontal"><TextViewandroid:id="@+id/tv_template_time"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_weight="10"android:text="@string/time"android:textColor="@color/wgray"android:textSize="16sp" /><Buttonandroid:id="@+id/btn_template_use"android:layout_width="wrap_content"android:layout_height="30dp"android:layout_weight="1"android:background="@drawable/shape"android:text="@string/user"android:textColor="@color/red"android:textSize="12sp" /></LinearLayout><TextViewandroid:layout_height="1dp"android:layout_width="match_parent"android:background="@color/gray"/> </LinearLayout>btn_shape
<?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android"><!-- 邊框顏色值 --><item><shape><solid android:color="@android:color/holo_red_dark" /><!-- android:radius 弧形的半徑 --><corners android:radius="5dip" /></shape></item><!-- 主體背景顏色值,控件間的間距 --><itemandroid:bottom="1dp"android:top="1dp"android:left="1dp"android:right="1dp"><shape><solid android:color="@android:color/white" /></shape></item></layer-list>TemplateListActivity
package com.cnhct.hechen.activity; import android.content.Intent; import android.support.v4.widget.SwipeRefreshLayout; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.view.KeyEvent; import android.view.View; import android.widget.Button; import android.widget.Toast; import com.cnhct.hechen.R; import com.cnhct.hechen.View.Titlebar; import com.cnhct.hechen.adapter.TemplateRecyclerViewAdapter; import cc.duduhuo.dialog.smartisan.SmartisanDialog; import cc.duduhuo.dialog.smartisan.WarningDialog;public class TemplateListActivity extends AppCompatActivity {private RecyclerView mRecyclerView;private SwipeRefreshLayout mSwipeRefreshLayout;private LinearLayoutManager mLinearLayoutManager;private TemplateRecyclerViewAdapter mTemplateRecyclerViewAdapter;private Button btn_add;private Titlebar tb;@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.activity_template_list);initView();mLinearLayoutManager = new LinearLayoutManager(this);mTemplateRecyclerViewAdapter = new TemplateRecyclerViewAdapter(TemplateListActivity.this);mRecyclerView.setLayoutManager(mLinearLayoutManager);mRecyclerView.setAdapter(mTemplateRecyclerViewAdapter);mTemplateRecyclerViewAdapter.setOnItemClickListener(new TemplateRecyclerViewAdapter.OnItemClickListener(){@Overridepublic void OnItemClick(View view, int position) {int i = position +1;Toast.makeText(TemplateListActivity.this,"選擇模版"+i,Toast.LENGTH_SHORT).show();}});mSwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {public void onRefresh() {mTemplateRecyclerViewAdapter.notifyDataSetChanged();mSwipeRefreshLayout.setRefreshing(false);}});btn_add.setOnClickListener(new View.OnClickListener() {@Overridepublic void onClick(View v) {Intent intent = new Intent(TemplateListActivity.this, template.class);startActivity(intent);finish();}});}private void initView(){mRecyclerView = (RecyclerView)findViewById(R.id.new_recyclerView);mSwipeRefreshLayout = (SwipeRefreshLayout)findViewById(R.id.layout_swipe_refresh);btn_add = (Button)findViewById(R.id.btn_add);tb = (Titlebar) findViewById(R.id.titlebar_template);tb.setOnButtonClickListener(new Titlebar.OnButtonClickListener() {@Overridepublic void onLeftClick() {final WarningDialog dialog = SmartisanDialog.createWarningDialog(TemplateListActivity.this);dialog.setTitle("您信息尚未填寫完整,確定退出嗎").setConfirmText("退出").show();dialog.setOnConfirmListener(new WarningDialog.OnConfirmListener() {@Overridepublic void onConfirm() {//EventBus.getDefault().post("FLAG_FINISH_ALL");Intent intent1 =new Intent(TemplateListActivity.this,house_regist01.class);startActivity(intent1);finish();dialog.dismiss();}});}@Overridepublic void onRightClick() {//返回首頁Intent intent2 = new Intent(TemplateListActivity.this, home.class);startActivity(intent2);finish();}});}/*** 監聽返回鍵* @param keyCode 鍵* @param event 事件* @return*/@Overridepublic boolean onKeyDown(int keyCode, KeyEvent event) {if (keyCode == KeyEvent.KEYCODE_BACK) {final WarningDialog dialog = SmartisanDialog.createWarningDialog(TemplateListActivity.this);dialog.setTitle("您信息尚未填寫完整,確定退出嗎").setConfirmText("退出").show();dialog.setOnConfirmListener(new WarningDialog.OnConfirmListener() {@Overridepublic void onConfirm() {//EventBus.getDefault().post("FLAG_FINISH_ALL");Intent intent =new Intent(TemplateListActivity.this,house_regist01.class);startActivity(intent);finish();dialog.dismiss();}});}return super.onKeyDown(keyCode, event);}}TemplateRecyclerViewAdapter
package com.cnhct.hechen.adapter;import android.content.Context; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.TextView;import com.cnhct.hechen.R;public class TemplateRecyclerViewAdapter extends RecyclerView.Adapter<TemplateRecyclerViewAdapter.ViewHolder>{private LayoutInflater layoutInflater;private Context mContext;public TemplateRecyclerViewAdapter(Context context){this.mContext = context;layoutInflater = LayoutInflater.from(context);}@Overridepublic ViewHolder onCreateViewHolder(ViewGroup parent, int viewType){View itemView=layoutInflater.inflate(R.layout.template_item, parent,false);ViewHolder viewHolder=new ViewHolder(itemView);return viewHolder;}@Overridepublic void onBindViewHolder(ViewHolder holder, int position){holder.itemView.setTag(position);}@Overridepublic int getItemCount(){return 1;}class ViewHolder extends RecyclerView.ViewHolder{private TextView tv_template_title;private TextView tv_template_time;private Button btn_template_use;public ViewHolder(View itemView){super(itemView);tv_template_title = (TextView)itemView.findViewById(R.id.tv_template_title);tv_template_time = (TextView)itemView.findViewById(R.id.tv_template_time);btn_template_use = (Button)itemView.findViewById(R.id.btn_template_use);itemView.setOnClickListener(new View.OnClickListener() {@Overridepublic void onClick(View v) {if (onItemClickListener!=null){onItemClickListener.OnItemClick(v,(int)v.getTag());}}});}}public interface OnItemClickListener{void OnItemClick(View view, int position);}private OnItemClickListener onItemClickListener;public void setOnItemClickListener(OnItemClickListener onItemClickListener){this.onItemClickListener=onItemClickListener;} }編輯模版
activity_template_layout
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"xmlns:tools="http://schemas.android.com/tools"xmlns:custom="http://schemas.android.com/apk/res-auto"android:id="@+id/activity_template"android:layout_width="match_parent"android:layout_height="match_parent"android:orientation="vertical"tools:context="com.cnhct.hechen.activity.template"><com.cnhct.hechen.View.Titlebarandroid:id="@+id/title_bar_template"android:layout_width="match_parent"android:layout_height="wrap_content"android:background="@color/red"android:padding="10sp"custom:leftButtonText="返回"custom:leftButtonTextColor="@android:color/white"custom:leftButtonTextSize="8sp"custom:rightButtonText="首頁"custom:rightButtonTextColor="@android:color/white"custom:rightButtonTextSize="8sp"custom:titleColor="@color/colorWhite"custom:titleSize="8sp"custom:titleText="編輯模版"></com.cnhct.hechen.View.Titlebar><ScrollViewandroid:layout_width="match_parent"android:layout_height="match_parent"android:scrollbars="none"tools:ignore="UselessParent"><LinearLayoutandroid:id="@+id/linear_page"android:layout_width="match_parent"android:layout_height="wrap_content"android:orientation="vertical"android:paddingBottom="10dp"><LinearLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"android:orientation="vertical"><LinearLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"android:focusable="true"android:focusableInTouchMode="true"android:orientation="horizontal"android:paddingBottom="10dp"android:paddingLeft="5dp"android:paddingRight="5dp"android:paddingTop="10dp"><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="@string/asterisk"android:textColor="@color/red" /><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="@string/administrative"android:textSize="15sp" /><TextViewandroid:layout_width="5dp"android:layout_height="wrap_content" /><TextViewandroid:id="@+id/sp_xzq_template"android:layout_width="0dp"android:layout_height="match_parent"android:layout_weight="1"android:hint="@string/choose"android:spinnerMode="dialog"android:textColor="@color/black"android:textSize="15sp" /></LinearLayout><TextViewandroid:layout_width="match_parent"android:layout_height="1dp"android:background="@color/gray"android:paddingTop="10dp" /><LinearLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"android:orientation="horizontal"android:paddingBottom="10dp"android:paddingLeft="5dp"android:paddingRight="5dp"android:paddingTop="10dp"><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="@string/asterisk"android:textColor="@color/red" /><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="@string/town"android:textSize="15sp" /><TextViewandroid:layout_width="5dp"android:layout_height="wrap_content" /><TextViewandroid:id="@+id/sp_jd_template"android:layout_width="0dp"android:layout_height="match_parent"android:layout_weight="1"android:ems="10"android:hint="@string/choose"android:spinnerMode="dialog"android:textColor="@color/black"android:textSize="15sp" /></LinearLayout><TextViewandroid:layout_width="match_parent"android:layout_height="1dp"android:background="@color/gray"android:paddingTop="10dp" /><LinearLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"android:orientation="horizontal"android:paddingBottom="10dp"android:paddingLeft="5dp"android:paddingRight="5dp"android:paddingTop="10dp"><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="@string/asterisk"android:textColor="@color/red" /><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="@string/street"android:textSize="15sp" /><TextViewandroid:layout_width="5dp"android:layout_height="wrap_content" /><AutoCompleteTextViewandroid:id="@+id/auto_tv_house01_template"android:layout_width="0dp"android:layout_height="match_parent"android:layout_weight="1"android:background="@null"android:ems="10"android:hint="@string/keywords"android:spinnerMode="dialog"android:textColor="@color/black"android:textSize="15sp" /></LinearLayout><TextViewandroid:layout_width="match_parent"android:layout_height="1dp"android:background="@color/gray" /><LinearLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"android:orientation="horizontal"android:paddingBottom="10dp"android:paddingLeft="5dp"android:paddingRight="5dp"android:paddingTop="10dp"><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="@string/asterisk"android:textColor="@color/red" /><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="@string/gatehouse"android:textSize="15sp" /><TextViewandroid:layout_width="5dp"android:layout_height="wrap_content" /><EditTextandroid:id="@+id/sp_mlp_template"android:layout_width="0dp"android:layout_height="match_parent"android:layout_weight="1"android:background="@null"android:ems="10"android:inputType=""android:textColor="@color/black"android:textSize="15sp" /></LinearLayout><TextViewandroid:layout_width="match_parent"android:layout_height="1dp"android:background="@color/gray" /><LinearLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"android:orientation="horizontal"android:paddingBottom="10dp"android:paddingLeft="5dp"android:paddingRight="5dp"android:paddingTop="10dp"><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="@string/asterisk"android:textColor="@color/red" /><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="@string/adress"android:textSize="15sp" /><TextViewandroid:layout_width="5dp"android:layout_height="wrap_content" /><EditTextandroid:id="@+id/et_Address_template"android:layout_width="0dp"android:layout_height="wrap_content"android:layout_weight="1"android:background="@null"android:ems="10"android:focusable="true"android:focusableInTouchMode="true"android:hint="@string/roomNU"android:maxLines="1"android:textColor="@color/black"android:textSize="15sp" /></LinearLayout><TextViewandroid:layout_width="match_parent"android:layout_height="1dp"android:background="@color/gray" /><LinearLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"android:orientation="horizontal"android:paddingBottom="10dp"android:paddingLeft="5dp"android:paddingRight="5dp"android:paddingTop="10dp"><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="@string/wordTrack"android:textSize="15sp" /><TextViewandroid:layout_width="5dp"android:layout_height="wrap_content" /><TextViewandroid:id="@+id/tv_house_reg01_zg_template"android:layout_width="0dp"android:layout_height="wrap_content"android:layout_weight="1"android:hint="@string/choose"android:textColor="@color/black"android:textSize="15sp" /></LinearLayout><TextViewandroid:layout_width="match_parent"android:layout_height="1dp"android:background="@color/gray" /><LinearLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"android:orientation="horizontal"android:paddingBottom="10dp"android:paddingLeft="5dp"android:paddingRight="5dp"android:paddingTop="10dp"><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="@string/caseNumber"android:textSize="15sp" /><TextViewandroid:layout_width="5dp"android:layout_height="wrap_content" /><EditTextandroid:id="@+id/et_ah_template"android:layout_width="0dp"android:layout_height="wrap_content"android:layout_weight="1"android:background="@null"android:ems="10"android:maxLines="1"android:textColor="@color/black"android:textSize="15sp"tools:ignore="TextFields" /></LinearLayout><TextViewandroid:layout_width="match_parent"android:layout_height="1dp"android:background="@color/gray" /><LinearLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"android:orientation="horizontal"android:paddingBottom="10dp"android:paddingLeft="5dp"android:paddingRight="5dp"android:paddingTop="10dp"><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="@string/blank"android:textColor="@color/red" /><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="@string/license"android:textSize="15sp" /><TextViewandroid:layout_width="5dp"android:layout_height="wrap_content" /><EditTextandroid:id="@+id/et_hnum_template"android:layout_width="0dp"android:layout_height="wrap_content"android:layout_weight="1"android:background="@null"android:ems="10"android:focusable="true"android:focusableInTouchMode="true"android:inputType="number"android:maxLines="1"android:textColor="@color/black"android:textSize="15sp" /></LinearLayout><TextViewandroid:layout_width="match_parent"android:layout_height="1dp"android:background="@color/gray" /><LinearLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"android:orientation="horizontal"android:paddingBottom="10dp"android:paddingLeft="5dp"android:paddingRight="5dp"android:paddingTop="10dp"><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="@string/asterisk"android:textColor="@color/red" /><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="@string/propertyArea"android:textSize="15sp" /><TextViewandroid:layout_width="5dp"android:layout_height="wrap_content" /><EditTextandroid:id="@+id/et_house_regist_cqmj_template"android:layout_width="0dp"android:layout_height="wrap_content"android:layout_weight="1"android:background="@null"android:ems="10"android:focusable="true"android:focusableInTouchMode="true"android:hint="@string/squareMeter"android:inputType="number"android:maxLines="1"android:textColor="@color/black"android:textSize="15sp" /></LinearLayout></LinearLayout><include layout="@layout/horizontal_divider_10dp" /><LinearLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"android:orientation="vertical"><LinearLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"android:orientation="horizontal"android:paddingBottom="10dp"android:paddingLeft="5dp"android:paddingRight="5dp"android:paddingTop="10dp"><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="@string/asterisk"android:textColor="@color/red" /><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="@string/propertyOwner"android:textSize="15sp" /><TextViewandroid:layout_width="5dp"android:layout_height="wrap_content" /><EditTextandroid:id="@+id/et_name_template"android:layout_width="0dp"android:layout_height="wrap_content"android:layout_weight="1"android:background="@null"android:ems="10"android:focusable="true"android:focusableInTouchMode="true"android:maxLines="1"android:textColor="@color/black"android:textSize="15sp"tools:ignore="TextFields" /></LinearLayout><TextViewandroid:layout_width="match_parent"android:layout_height="1dp"android:background="@color/gray"android:paddingTop="10dp" /><LinearLayoutandroid:id="@+id/layout_hreg01_gjdq"android:layout_width="match_parent"android:layout_height="wrap_content"android:orientation="horizontal"android:paddingBottom="10dp"android:paddingLeft="5dp"android:paddingRight="5dp"android:paddingTop="10dp"><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="@string/asterisk"android:textColor="@color/red" /><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="@string/region"android:textSize="15sp" /><TextViewandroid:layout_width="5dp"android:layout_height="wrap_content" /><TextViewandroid:id="@+id/tv_hreg01_nation_template"android:layout_width="0dp"android:layout_height="match_parent"android:layout_weight="1"android:ems="10"android:hint="@string/choose"android:textColor="@color/black"android:textSize="15sp" /></LinearLayout><TextViewandroid:layout_width="match_parent"android:layout_height="1dp"android:background="@color/gray"android:paddingTop="10dp" /><LinearLayoutandroid:id="@+id/layout_hreg01_zjlx"android:layout_width="match_parent"android:layout_height="wrap_content"android:orientation="horizontal"android:paddingBottom="10dp"android:paddingLeft="5dp"android:paddingRight="5dp"android:paddingTop="10dp"><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="@string/asterisk"android:textColor="@color/red" /><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="@string/typeOfCertificate"android:textSize="15sp" /><TextViewandroid:layout_width="5dp"android:layout_height="wrap_content" /><TextViewandroid:id="@+id/tv_hreg01_zjlx_template"android:layout_width="0dp"android:layout_height="match_parent"android:layout_weight="1"android:ems="10"android:hint="@string/choose"android:textColor="@color/black"android:textSize="15sp" /></LinearLayout><TextViewandroid:layout_width="match_parent"android:layout_height="1dp"android:background="@color/gray"android:paddingTop="10dp" /><LinearLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"android:orientation="horizontal"android:paddingBottom="10dp"android:paddingLeft="5dp"android:paddingRight="5dp"android:paddingTop="10dp"><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="@string/asterisk"android:textColor="@color/red" /><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="@string/IDnumber"android:textSize="15sp" /><TextViewandroid:layout_width="5dp"android:layout_height="wrap_content"tools:ignore="TooManyViews" /><EditTextandroid:id="@+id/et_cardnum_template"android:layout_width="0dp"android:layout_height="wrap_content"android:layout_weight="1"android:background="@null"android:ems="10"android:focusable="true"android:focusableInTouchMode="true"android:inputType="number"android:maxLines="1"android:textColor="@color/black"android:textSize="15sp"tools:ignore="TooManyViews" /></LinearLayout><TextViewandroid:layout_width="match_parent"android:layout_height="1dp"android:background="@color/gray"android:paddingTop="10dp" /><LinearLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"android:orientation="horizontal"android:paddingBottom="10dp"android:paddingLeft="5dp"android:paddingRight="5dp"android:paddingTop="10dp"><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="@string/asterisk"android:textColor="@color/red" /><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="@string/mobilePhone"android:textSize="15sp" /><TextViewandroid:layout_width="5dp"android:layout_height="wrap_content" /><EditTextandroid:id="@+id/et_call_template"android:layout_width="0dp"android:layout_height="wrap_content"android:layout_weight="1"android:background="@null"android:ems="10"android:focusable="true"android:focusableInTouchMode="true"android:inputType="number"android:textColor="@color/black"android:textSize="15sp" /></LinearLayout></LinearLayout><include layout="@layout/horizontal_divider_10dp" /><LinearLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"android:orientation="vertical"><LinearLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"android:focusable="true"android:focusableInTouchMode="true"android:orientation="horizontal"android:paddingBottom="10dp"android:paddingLeft="5dp"android:paddingRight="5dp"android:paddingTop="10dp"><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="@string/asterisk"android:textColor="@color/red" /><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="@string/publishTitle"android:textSize="15sp" /><TextViewandroid:layout_width="5dp"android:layout_height="wrap_content" /><EditTextandroid:id="@+id/et_reg_title"android:layout_width="0dp"android:layout_height="wrap_content"android:layout_weight="1"android:background="@null"android:focusable="true"android:focusableInTouchMode="true"android:maxLength="20"android:textColor="@color/black"android:textSize="15sp"tools:ignore="TextFields" /></LinearLayout><TextViewandroid:layout_width="match_parent"android:layout_height="1dp"android:background="@color/gray"android:paddingTop="10dp" /><LinearLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"android:orientation="horizontal"android:paddingBottom="10dp"android:paddingLeft="5dp"android:paddingRight="5dp"android:paddingTop="10dp"><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="@string/asterisk"android:textColor="@color/red" /><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="@string/propertyAddress"android:textSize="15sp" /><TextViewandroid:layout_width="5dp"android:layout_height="wrap_content" /><EditTextandroid:id="@+id/et_housesaddress"android:layout_width="0dp"android:layout_height="wrap_content"android:layout_weight="1"android:background="@null"android:ems="10"android:focusable="true"android:focusableInTouchMode="true"android:textColor="@color/black"android:textSize="15sp"tools:ignore="TextFields" /></LinearLayout><TextViewandroid:layout_width="match_parent"android:layout_height="1dp"android:background="@color/gray"android:paddingTop="10dp" /><LinearLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"android:orientation="horizontal"android:paddingBottom="10dp"android:paddingLeft="5dp"android:paddingRight="5dp"android:paddingTop="10dp"><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="@string/asterisk"android:textColor="@color/red" /><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="@string/use"android:textSize="15sp" /><TextViewandroid:layout_width="5dp"android:layout_height="wrap_content" /><TextViewandroid:id="@+id/sp_fwyt"android:layout_width="0dp"android:layout_height="wrap_content"android:layout_weight="1"android:hint="@string/choose"android:textColor="@color/black"android:textSize="15sp" /></LinearLayout><TextViewandroid:layout_width="match_parent"android:layout_height="1dp"android:background="@color/gray"android:paddingTop="10dp" /><LinearLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"android:orientation="horizontal"android:paddingBottom="10dp"android:paddingLeft="5dp"android:paddingRight="5dp"android:paddingTop="10dp"><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="@string/asterisk"android:textColor="@color/red" /><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="@string/toward"android:textSize="15sp" /><TextViewandroid:layout_width="5dp"android:layout_height="wrap_content" /><TextViewandroid:id="@+id/et_oritation"android:layout_width="0dp"android:layout_height="wrap_content"android:layout_weight="1"android:hint="@string/choose"android:textColor="@color/black"android:textSize="15sp" /></LinearLayout><TextViewandroid:layout_width="match_parent"android:layout_height="1dp"android:background="@color/gray"android:paddingTop="10dp" /><LinearLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"android:orientation="horizontal"android:paddingBottom="10dp"android:paddingLeft="5dp"android:paddingRight="5dp"android:paddingTop="10dp"><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="@string/asterisk"android:textColor="@color/red" /><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="@string/buildingProperties"android:textSize="15sp" /><TextViewandroid:layout_width="5dp"android:layout_height="wrap_content" /><TextViewandroid:id="@+id/et_house_info"android:layout_width="0dp"android:layout_height="wrap_content"android:layout_weight="1"android:hint="@string/choose"android:textColor="@color/black"android:textSize="15sp" /></LinearLayout><TextViewandroid:layout_width="match_parent"android:layout_height="1dp"android:background="@color/gray"android:paddingTop="10dp" /><LinearLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"android:orientation="horizontal"android:paddingBottom="10dp"android:paddingLeft="5dp"android:paddingRight="5dp"android:paddingTop="10dp"><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="@string/asterisk"android:textColor="@color/red" /><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="@string/totalFloors"android:textSize="15sp" /><TextViewandroid:layout_width="5dp"android:layout_height="wrap_content" /><TextViewandroid:id="@+id/et_house_gylc"android:layout_width="0dp"android:layout_height="wrap_content"android:layout_weight="1"android:ems="10"android:hint="@string/choose"android:textColor="@color/black"android:textSize="15sp" /></LinearLayout><TextViewandroid:layout_width="match_parent"android:layout_height="1dp"android:background="@color/gray"android:paddingTop="10dp" /><LinearLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"android:orientation="horizontal"android:paddingBottom="10dp"android:paddingLeft="5dp"android:paddingRight="5dp"android:paddingTop="10dp"><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="@string/asterisk"android:textColor="@color/red" /><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="@string/fllor"android:textSize="15sp" /><TextViewandroid:layout_width="5dp"android:layout_height="wrap_content" /><TextViewandroid:id="@+id/et_storey"android:layout_width="0dp"android:layout_height="wrap_content"android:layout_weight="1"android:ems="10"android:hint="@string/choose"android:textColor="@color/black"android:textSize="15sp" /></LinearLayout><TextViewandroid:layout_width="match_parent"android:layout_height="1dp"android:background="@color/gray"android:paddingTop="10dp" /><LinearLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"android:orientation="horizontal"android:paddingBottom="10dp"android:paddingLeft="5dp"android:paddingRight="5dp"android:paddingTop="10dp"><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="@string/asterisk"android:textColor="@color/red" /><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="@string/decoration"android:textSize="15sp" /><TextViewandroid:layout_width="5dp"android:layout_height="wrap_content" /><TextViewandroid:id="@+id/et_fixinfo"android:layout_width="0dp"android:layout_height="wrap_content"android:layout_weight="1"android:ems="10"android:hint="@string/choose"android:textColor="@color/black"android:textSize="15sp" /></LinearLayout><TextViewandroid:layout_width="match_parent"android:layout_height="1dp"android:background="@color/gray"android:paddingTop="10dp" /><LinearLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"android:orientation="horizontal"android:paddingBottom="10dp"android:paddingLeft="5dp"android:paddingRight="5dp"android:paddingTop="10dp"><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="@string/asterisk"android:textColor="@color/red" /><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="@string/rentalArea"android:textSize="15sp" /><TextViewandroid:layout_width="5dp"android:layout_height="wrap_content" /><EditTextandroid:id="@+id/et_acreage"android:layout_width="0dp"android:layout_height="wrap_content"android:layout_weight="1"android:background="@null"android:ems="10"android:focusable="true"android:focusableInTouchMode="true"android:hint="@string/meter"android:inputType="number"android:maxLines="1"android:textColor="@color/black"android:textSize="15sp" /></LinearLayout><TextViewandroid:layout_width="match_parent"android:layout_height="1dp"android:background="@color/gray"android:paddingTop="10dp" /><LinearLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"android:orientation="horizontal"android:paddingBottom="10dp"android:paddingLeft="5dp"android:paddingRight="5dp"android:paddingTop="10dp"><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="@string/asterisk"android:textColor="@color/red" /><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="@string/HUxing"android:textSize="15sp" /><TextViewandroid:layout_width="5dp"android:layout_height="wrap_content" /><TextViewandroid:id="@+id/et_shi"android:layout_width="0dp"android:layout_height="wrap_content"android:layout_weight="1"android:ems="10"android:hint="@string/choose"android:textColor="@color/black"android:textSize="15sp" /></LinearLayout></LinearLayout><include layout="@layout/horizontal_divider_10dp" /><LinearLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"android:orientation="horizontal"android:paddingBottom="10dp"android:paddingLeft="5dp"android:paddingRight="5dp"android:paddingTop="10dp"><EditTextandroid:id="@+id/et_describe"android:layout_width="match_parent"android:layout_height="wrap_content"android:layout_gravity="center_vertical"android:background="@drawable/shape_gray_square_bg"android:gravity="top"android:hint="@string/description"android:lines="5"android:maxLength="200"android:textSize="13sp" /></LinearLayout><include layout="@layout/horizontal_divider_10dp" /><LinearLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"android:orientation="vertical"><LinearLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"android:orientation="horizontal"android:paddingBottom="10dp"android:paddingLeft="5dp"android:paddingRight="5dp"android:paddingTop="10dp"><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="@string/paymentMethod"android:textSize="15sp" /><TextViewandroid:layout_width="5dp"android:layout_height="wrap_content" /><TextViewandroid:id="@+id/et_paymethod"android:layout_width="0dp"android:layout_height="wrap_content"android:layout_weight="1"android:ems="10"android:hint="@string/choose"android:textColor="@color/black"android:textSize="15sp" /></LinearLayout><TextViewandroid:layout_width="match_parent"android:layout_height="1dp"android:background="@color/gray"android:paddingTop="10dp" /><LinearLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"android:orientation="horizontal"android:paddingBottom="10dp"android:paddingLeft="5dp"android:paddingRight="5dp"android:paddingTop="10dp"><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="@string/asterisk"android:textColor="@color/red" /><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="@string/rent"android:textSize="15sp" /><TextViewandroid:layout_width="5dp"android:layout_height="wrap_content" /><EditTextandroid:id="@+id/et_rent"android:layout_width="0dp"android:layout_height="wrap_content"android:layout_weight="1"android:background="@null"android:ems="10"android:inputType="number"android:maxLines="1"android:textColor="@color/black"android:textSize="15sp" /></LinearLayout><TextViewandroid:layout_width="match_parent"android:layout_height="1dp"android:background="@color/gray"android:paddingTop="10dp" /><LinearLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"android:orientation="horizontal"android:paddingBottom="10dp"android:paddingLeft="5dp"android:paddingRight="5dp"android:paddingTop="10dp"><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="@string/leasingMethods"android:textSize="15sp" /><TextViewandroid:layout_width="5dp"android:layout_height="wrap_content" /><TextViewandroid:id="@+id/et_Leasemode"android:layout_width="0dp"android:layout_height="wrap_content"android:layout_weight="1"android:ems="10"android:hint="@string/choose"android:textColor="@color/black"android:textSize="15sp" /></LinearLayout></LinearLayout><include layout="@layout/horizontal_divider_10dp" /><LinearLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"android:orientation="vertical"><LinearLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"android:orientation="horizontal"android:paddingBottom="10dp"android:paddingLeft="5dp"android:paddingRight="5dp"android:paddingTop="10dp"><TextViewandroid:layout_width="0dp"android:layout_height="wrap_content"android:layout_weight="0.1" /><CheckBoxandroid:id="@+id/shui_reg"android:layout_width="0dp"android:layout_height="30dp"android:layout_weight="1"android:background="@drawable/zf_ck__bg"android:button="@null"android:checked="false"android:gravity="center"android:text="@string/waterl" /><TextViewandroid:layout_width="0dp"android:layout_height="wrap_content"android:layout_weight="0.2" /><CheckBoxandroid:id="@+id/dian_reg"android:layout_width="0dp"android:layout_height="30dp"android:layout_weight="1"android:background="@drawable/zf_ck__bg"android:button="@null"android:checked="false"android:gravity="center"android:text="@string/electricitying" /><TextViewandroid:layout_width="0dp"android:layout_height="wrap_content"android:layout_weight="0.2" /><CheckBoxandroid:id="@+id/lanqi_reg"android:layout_width="0dp"android:layout_height="30dp"android:layout_weight="1"android:background="@drawable/zf_ck__bg"android:button="@null"android:checked="false"android:gravity="center"android:text="@string/heat" /><TextViewandroid:layout_width="0dp"android:layout_height="wrap_content"android:layout_weight="0.2" /><CheckBoxandroid:id="@+id/kuandai_reg"android:layout_width="0dp"android:layout_height="30dp"android:layout_weight="1"android:background="@drawable/zf_ck__bg"android:button="@null"android:checked="false"android:gravity="center"android:text="@string/broadband" /><TextViewandroid:layout_width="0dp"android:layout_height="wrap_content"android:layout_weight="0.1" /></LinearLayout><LinearLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"android:orientation="horizontal"android:paddingBottom="10dp"android:paddingLeft="5dp"android:paddingRight="5dp"android:paddingTop="10dp"><TextViewandroid:layout_width="0dp"android:layout_height="wrap_content"android:layout_weight="0.1" /><CheckBoxandroid:id="@+id/dianti_reg"android:layout_width="0dp"android:layout_height="30dp"android:layout_weight="1"android:background="@drawable/zf_ck__bg"android:button="@null"android:checked="false"android:gravity="center"android:text="@string/elevatoring" /><TextViewandroid:layout_width="0dp"android:layout_height="wrap_content"android:layout_weight="0.2" /><CheckBoxandroid:id="@+id/dianshi_reg"android:layout_width="0dp"android:layout_height="30dp"android:layout_weight="1"android:background="@drawable/zf_ck__bg"android:button="@null"android:checked="false"android:gravity="center"android:text="@string/TV" /><TextViewandroid:layout_width="0dp"android:layout_height="wrap_content"android:layout_weight="0.2" /><CheckBoxandroid:id="@+id/meiqi_reg"android:layout_width="0dp"android:layout_height="30dp"android:layout_weight="1"android:background="@drawable/zf_ck__bg"android:button="@null"android:checked="false"android:gravity="center"android:text="@string/gasing" /><TextViewandroid:layout_width="0dp"android:layout_height="wrap_content"android:layout_weight="0.2" /><CheckBoxandroid:id="@+id/lutai_reg"android:layout_width="0dp"android:layout_height="30dp"android:layout_weight="1"android:background="@drawable/zf_ck__bg"android:button="@null"android:checked="false"android:gravity="center"android:text="@string/terrace" /><TextViewandroid:layout_width="0dp"android:layout_height="wrap_content"android:layout_weight="0.1" /></LinearLayout><LinearLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"android:orientation="horizontal"android:paddingBottom="10dp"android:paddingLeft="5dp"android:paddingRight="5dp"android:paddingTop="10dp"><TextViewandroid:layout_width="0dp"android:layout_height="wrap_content"android:layout_weight="0.1" /><CheckBoxandroid:id="@+id/chewei_reg"android:layout_width="0dp"android:layout_height="30dp"android:layout_weight="1"android:background="@drawable/zf_ck__bg"android:button="@null"android:checked="false"android:gravity="center"android:text="@string/ParkingSpace" /><TextViewandroid:layout_width="0dp"android:layout_height="wrap_content"android:layout_weight="0.2" /><CheckBoxandroid:id="@+id/ccroom_reg"android:layout_width="0dp"android:layout_height="30dp"android:layout_weight="1"android:background="@drawable/zf_ck__bg"android:button="@null"android:checked="false"android:gravity="center"android:text="@string/storageRoom" /><TextViewandroid:layout_width="0dp"android:layout_height="wrap_content"android:layout_weight="0.2" /><TextViewandroid:layout_width="0dp"android:layout_height="wrap_content"android:layout_weight="1" /><TextViewandroid:layout_width="0dp"android:layout_height="30dp"android:layout_weight="0.2" /><TextViewandroid:layout_width="0dp"android:layout_height="wrap_content"android:layout_weight="1" /><TextViewandroid:layout_width="0dp"android:layout_height="wrap_content"android:layout_weight="0.1" /></LinearLayout></LinearLayout><include layout="@layout/horizontal_divider_10dp" /><LinearLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"android:orientation="vertical"><LinearLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"android:orientation="horizontal"android:paddingBottom="10dp"android:paddingLeft="5dp"android:paddingRight="5dp"android:paddingTop="10dp"><TextViewandroid:layout_width="0dp"android:layout_height="wrap_content"android:layout_weight="0.1" /><CheckBoxandroid:id="@+id/chuang_reg"android:layout_width="0dp"android:layout_height="30dp"android:layout_weight="1"android:background="@drawable/zf_ck__bg"android:button="@null"android:checked="false"android:gravity="center"android:text="@string/bed" /><TextViewandroid:layout_width="0dp"android:layout_height="wrap_content"android:layout_weight="0.2" /><CheckBoxandroid:id="@+id/dianhua_reg"android:layout_width="0dp"android:layout_height="30dp"android:layout_weight="1"android:background="@drawable/zf_ck__bg"android:button="@null"android:checked="false"android:gravity="center"android:text="@string/phone" /><TextViewandroid:layout_width="0dp"android:layout_height="wrap_content"android:layout_weight="0.2" /><CheckBoxandroid:id="@+id/kongtiao_reg"android:layout_width="0dp"android:layout_height="30dp"android:layout_weight="1"android:background="@drawable/zf_ck__bg"android:button="@null"android:checked="false"android:gravity="center"android:text="@string/conditioning" /><TextViewandroid:layout_width="0dp"android:layout_height="wrap_content"android:layout_weight="0.2" /><CheckBoxandroid:id="@+id/bingxiang_reg"android:layout_width="0dp"android:layout_height="30dp"android:layout_weight="1"android:background="@drawable/zf_ck__bg"android:button="@null"android:checked="false"android:gravity="center"android:text="@string/refrigerator" /><TextViewandroid:layout_width="0dp"android:layout_height="wrap_content"android:layout_weight="0.1" /></LinearLayout><LinearLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"android:orientation="horizontal"android:paddingBottom="10dp"android:paddingLeft="5dp"android:paddingRight="5dp"android:paddingTop="10dp"><TextViewandroid:layout_width="0dp"android:layout_height="wrap_content"android:layout_weight="0.1" /><CheckBoxandroid:id="@+id/chuju_reg"android:layout_width="0dp"android:layout_height="30dp"android:layout_weight="1"android:background="@drawable/zf_ck__bg"android:button="@null"android:checked="false"android:gravity="center"android:text="@string/kitchenware" /><TextViewandroid:layout_width="0dp"android:layout_height="wrap_content"android:layout_weight="0.2" /><CheckBoxandroid:id="@+id/jiaju_reg"android:layout_width="0dp"android:layout_height="30dp"android:layout_weight="1"android:background="@drawable/zf_ck__bg"android:button="@null"android:checked="false"android:gravity="center"android:text="@string/furniture" /><TextViewandroid:layout_width="0dp"android:layout_height="wrap_content"android:layout_weight="0.2" /><CheckBoxandroid:id="@+id/weibolu_reg"android:layout_width="0dp"android:layout_height="30dp"android:layout_weight="1"android:background="@drawable/zf_ck__bg"android:button="@null"android:checked="false"android:gravity="center"android:text="@string/MicrowaveOven" /><TextViewandroid:layout_width="0dp"android:layout_height="wrap_content"android:layout_weight="0.2" /><CheckBoxandroid:id="@+id/xiyiji_reg"android:layout_width="0dp"android:layout_height="30dp"android:layout_weight="1"android:background="@drawable/zf_ck__bg"android:button="@null"android:checked="false"android:gravity="center"android:text="@string/washingMachine" /><TextViewandroid:layout_width="0dp"android:layout_height="wrap_content"android:layout_weight="0.1" /></LinearLayout><LinearLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"android:orientation="horizontal"android:paddingBottom="10dp"android:paddingLeft="5dp"android:paddingRight="5dp"android:paddingTop="10dp"><TextViewandroid:layout_width="0dp"android:layout_height="wrap_content"android:layout_weight="0.1" /><CheckBoxandroid:id="@+id/reshuiqi_reg"android:layout_width="0dp"android:layout_height="30dp"android:layout_weight="1"android:background="@drawable/zf_ck__bg"android:button="@null"android:checked="false"android:gravity="center"android:text="@string/WaterHeater" /><TextViewandroid:layout_width="0dp"android:layout_height="wrap_content"android:layout_weight="0.2" /><TextViewandroid:layout_width="0dp"android:layout_height="wrap_content"android:layout_weight="1" /><TextViewandroid:layout_width="0dp"android:layout_height="wrap_content"android:layout_weight="0.2" /><TextViewandroid:layout_width="0dp"android:layout_height="wrap_content"android:layout_weight="1" /><TextViewandroid:layout_width="0dp"android:layout_height="wrap_content"android:layout_weight="0.2" /><TextViewandroid:layout_width="0dp"android:layout_height="wrap_content"android:layout_weight="1" /><TextViewandroid:layout_width="0dp"android:layout_height="wrap_content"android:layout_weight="0.1" /></LinearLayout></LinearLayout><include layout="@layout/horizontal_divider_10dp" /><LinearLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"android:paddingLeft="5dp"android:paddingRight="5dp"><Buttonandroid:id="@+id/btn_save_template"android:layout_width="match_parent"android:layout_height="35dp"android:background="@color/main_color"android:text="@string/saveTemplate"android:textColor="@color/white" /></LinearLayout></LinearLayout></ScrollView></LinearLayout>template_activity
package com.cnhct.hechen.activity;import android.content.Intent; import android.content.SharedPreferences; import android.os.Bundle; import android.preference.PreferenceManager; import android.support.v7.app.AppCompatActivity; import android.text.Editable; import android.text.TextWatcher; import android.util.Log; import android.view.Gravity; import android.view.KeyEvent; import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.AutoCompleteTextView; import android.widget.Button; import android.widget.CheckBox; import android.widget.EditText; import android.widget.TextView; import android.widget.Toast;import com.android.volley.AuthFailureError; import com.android.volley.Request; import com.android.volley.RequestQueue; import com.android.volley.Response; import com.android.volley.VolleyError; import com.android.volley.toolbox.StringRequest; import com.android.volley.toolbox.Volley; import com.cnhct.hechen.R; import com.cnhct.hechen.View.SelectPicPopupWindow; import com.cnhct.hechen.View.Titlebar; import com.cnhct.hechen.adapter.GvUpdatePicAdapter; import com.cnhct.hechen.entity.Address; import com.cnhct.hechen.entity.CodeDetail; import com.cnhct.hechen.entity.HouseInfo; import com.cnhct.hechen.utils.CheckIdCard; import com.cnhct.hechen.utils.HttpUtils; import com.cnhct.hechen.utils.PhoneFormatCheckUtils; import com.cnhct.hechen.utils.ProgressHUD; import com.cnhct.hechen.utils.ToastUtil; import com.cnhct.hechen.utils.getJsonUtils; import com.cnhct.hechen.utils.getListUtils; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.JsonSyntaxException; import com.google.gson.reflect.TypeToken;import net.tsz.afinal.FinalHttp; import net.tsz.afinal.http.AjaxCallBack; import net.tsz.afinal.http.AjaxParams;import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.Subscribe; import org.greenrobot.eventbus.ThreadMode;import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map;import butterknife.BindView; import butterknife.ButterKnife; import cc.duduhuo.dialog.smartisan.OptionListDialog; import cc.duduhuo.dialog.smartisan.SmartisanDialog; import cc.duduhuo.dialog.smartisan.WarningDialog; import cc.duduhuo.dialog.smartisan.listener.OnOptionItemSelectListener; import okhttp3.Call; import okhttp3.Callback; import okhttp3.MultipartBody; import okhttp3.OkHttpClient; import okhttp3.RequestBody;/*** 1. ButterKnife 獲取組件* 2. 定義組件對應的變量*/public class template extends AppCompatActivity implements View.OnClickListener{@BindView(R.id.title_bar_template) Titlebar title_bar_template;@BindView(R.id.sp_xzq_template) TextView sp_xzq_template;@BindView(R.id.sp_jd_template) TextView sp_jd_template;@BindView(R.id.auto_tv_house01_template) AutoCompleteTextView auto_tv_house01_template;@BindView(R.id.sp_mlp_template) EditText sp_mlp_template;@BindView(R.id.et_Address_template) EditText et_Address_template;@BindView(R.id.tv_house_reg01_zg_template) TextView tv_house_reg01_zg_template;@BindView(R.id.et_ah_template) EditText et_ah_template;@BindView(R.id.et_hnum_template) EditText et_hnum_template;@BindView(R.id.et_house_regist_cqmj_template) EditText et_house_regist_cqmj_template;@BindView(R.id.et_name_template) EditText et_name_template;@BindView(R.id.tv_hreg01_nation_template) TextView tv_hreg01_nation_template;@BindView(R.id.tv_hreg01_zjlx_template) TextView tv_hreg01_zjlx_template;@BindView(R.id.et_cardnum_template) EditText et_cardnum_template;@BindView(R.id.et_call_template) EditText et_call_template;@BindView(R.id.et_reg_title) EditText et_reg_title;@BindView(R.id.et_housesaddress) EditText et_housesaddress;@BindView(R.id.sp_fwyt) TextView sp_fwyt;@BindView(R.id.et_oritation) TextView et_oritation;@BindView(R.id.et_house_info) TextView et_house_info;@BindView(R.id.et_house_gylc) TextView et_house_gylc;@BindView(R.id.et_storey) TextView et_storey;@BindView(R.id.et_fixinfo) TextView et_fixinfo;@BindView(R.id.et_acreage) EditText et_acreage;@BindView(R.id.et_shi) TextView et_shi;@BindView(R.id.et_describe) EditText et_describe;@BindView(R.id.et_paymethod) TextView et_paymethod;@BindView(R.id.et_rent) EditText et_rent;@BindView(R.id.et_Leasemode) TextView et_Leasemode;@BindView(R.id.shui_reg) CheckBox shui_reg;@BindView(R.id.dian_reg) CheckBox dian_reg;@BindView(R.id.lanqi_reg) CheckBox lanqi_reg;@BindView(R.id.kuandai_reg) CheckBox kuandai_reg;@BindView(R.id.dianti_reg) CheckBox dianti_reg;@BindView(R.id.dianshi_reg) CheckBox dianshi_reg;@BindView(R.id.meiqi_reg) CheckBox meiqi_reg;@BindView(R.id.lutai_reg) CheckBox lutai_reg;@BindView(R.id.chewei_reg) CheckBox chewei_reg;@BindView(R.id.ccroom_reg) CheckBox ccroom_reg;@BindView(R.id.chuang_reg) CheckBox chuang_reg;@BindView(R.id.dianhua_reg) CheckBox dianhua_reg;@BindView(R.id.kongtiao_reg) CheckBox kongtiao_reg;@BindView(R.id.bingxiang_reg) CheckBox bingxiang_reg;@BindView(R.id.chuju_reg) CheckBox chuju_reg;@BindView(R.id.jiaju_reg) CheckBox jiaju_reg;@BindView(R.id.weibolu_reg) CheckBox weibolu_reg;@BindView(R.id.xiyiji_reg) CheckBox xiyiji_reg;@BindView(R.id.reshuiqi_reg) CheckBox reshuiqi_reg;@BindView(R.id.btn_save_template) Button btn_save_template;private List<String> xzq_list;private String code;private List<Address> list_jz;private List<String> mList_jz;private String jzCode;private RequestQueue queue;private ProgressHUD mProgressHUD;private List<Address> list_jlx;private List<String> mList_jlx;private String jlxCode;private List<CodeDetail> listCodeDetail;private List<CodeDetail> listCodeDetailZg;private List<String> mListNation;private List<String> mListCode;private String nationCode;private List<String> mListZgName;private List<String> mListZgCode;private String zgCode;private List<String> cardtype_list;private List<String> mlistZjlxCode;private List<String> mListLdxz;private List<String> mListFwyt;private List<String> mListGylc;private List<String> mListOritation;private List<String> mListFixInfo;private List<String> mListPayMethod;private List<String> mListLeaseMode;private String gylc;private String shi;private String ting;private String chu;private String wei;SelectPicPopupWindow menuWindow;//廳室選擇器private String HZQ = "天河區"; //行政區名稱private String JZ; //街鎮名稱private String JLX; //街路巷名稱private String MLP; //門樓牌private String XZ; //詳址private String ZG; //字軌private String AH; //案號private String CQZH ;//產權證號private String CQMJ ;//產權面積private double areaValue = 1.0;private String YZXM ;//業主姓名private String GJDQ ;//國籍地區private String ZJLX ;//證件類型private String SFZH ;//身份證號private String YZDH ; //業主電話private String FBBT ;//發布標題private String LPDZ ;//樓盤地址private String FWYT ;//房屋用途private String CX ;//朝向private String LDXZ ;//樓棟性質private String ZLC ;//總樓層private String floor; //所屬樓層private String ZXCD; //裝修程度private String CZMJ ;//出租面積private String HXS ; //戶型(室)private String FYMS; //房源描述private String ZJZFFS; //租金支付方式private String ZJ; //租金private String ZLFS ;//租賃方式private String PZS ;//配置水private String PZD ;//配置電private String PZNQ ;//配置暖氣private String PZKD ;//配置寬帶private String PZDT ;//配置電梯private String PZDS ;//配置電視private String PZMQ ;//配置煤氣private String PZLTHY ;//配置露臺花園private String PZCWCK ;//配置車位車庫private String PZCCSDXS ;//配置儲藏室地下室private String PZC ;//配置床private String PZDH ;//配置電話private String PZKT ;//配置空調private String PZBX ;//配置冰箱private String PZCJ ;//配置廚具private String PZJJ ;//配置家具private String PZWBL ;//配置微波爐private String PZXYJ ;//配置洗衣機private String PZRSQ ;//配置熱水器private HouseInfo houseInfo;private String userId;private SharedPreferences pref;private GvUpdatePicAdapter adapter_old;private String path;private Button buttonSubmit;private String type;private double latitude, longitude;@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.activity_template);Log.i("執行","這里");ButterKnife.bind(this);EventBus.getDefault().register(this);houseInfo = new HouseInfo();initEvent();queue = Volley.newRequestQueue(this);mProgressHUD = ProgressHUD.show(template.this, "請稍等", true, true, null);mProgressHUD.dismiss();initData();queryZg(); //請求字軌selectNationalityArea(); //選擇國籍地區pref = PreferenceManager.getDefaultSharedPreferences(this);userId = pref.getString("userId", "");type = pref.getString("type", "");Log.i("userId"+userId,"type"+type);}private void initEvent(){//標題欄title_bar_template.setOnButtonClickListener(new Titlebar.OnButtonClickListener() {@Overridepublic void onLeftClick() {//返回模版列表final WarningDialog dialog = SmartisanDialog.createWarningDialog(template.this);dialog.setTitle("您信息尚未填寫完整,確定退出嗎").setConfirmText("退出").show();dialog.setOnConfirmListener(new WarningDialog.OnConfirmListener() {@Overridepublic void onConfirm() {//EventBus.getDefault().post("FLAG_FINISH_ALL");Intent intent = new Intent(template.this,TemplateListActivity.class);startActivity(intent);finish();dialog.dismiss();}});}@Overridepublic void onRightClick() {//首頁Intent intent = new Intent(template.this, home.class);startActivity(intent);finish();}});sp_xzq_template.setOnClickListener(this); //選擇行政區sp_jd_template.setOnClickListener(this); //街道auto_tv_house01_template.setOnClickListener(this); //查詢關鍵字tv_hreg01_nation_template.setOnClickListener(this); //國籍地區tv_hreg01_zjlx_template.setOnClickListener(this); //證件類型sp_fwyt.setOnClickListener(this); //房屋用途et_oritation.setOnClickListener(this); //朝向et_house_info.setOnClickListener(this); //樓棟性質et_house_gylc.setOnClickListener(this); //總樓層et_storey.setOnClickListener(this); //所屬樓層et_fixinfo.setOnClickListener(this); //裝修程度et_shi.setOnClickListener(this); //戶型et_paymethod.setOnClickListener(this); //支付方式et_Leasemode.setOnClickListener(this); //租賃方式btn_save_template.setOnClickListener(this); //保存}//得到所有選擇了的cb的值public void getCbData() {if (shui_reg.isChecked()) {houseInfo.setPZS(1 + "");}if (dian_reg.isChecked()) {houseInfo.setPZD(1 + "");}if (lanqi_reg.isChecked()) {houseInfo.setPZNQ(1);}if (kuandai_reg.isChecked()) {houseInfo.setPZKD(1);}if (dianti_reg.isChecked()) {houseInfo.setPZDT(1 + "");}if (dianshi_reg.isChecked()) {houseInfo.setPZDS(1);}if (meiqi_reg.isChecked()) {houseInfo.setPZMQ(1);}if (lutai_reg.isChecked()) {houseInfo.setPZLTHY(1 + "");}if (chewei_reg.isChecked()) {houseInfo.setPZCWCK(1 + "");}if (ccroom_reg.isChecked()) {houseInfo.setPZCCSDXS(1 + "");}if (chuang_reg.isChecked()) {houseInfo.setPZC(1);}if (dianhua_reg.isChecked()) {houseInfo.setPZDH(1 + "");}if (kongtiao_reg.isChecked()) {houseInfo.setPZKT(1);}if (bingxiang_reg.isChecked()) {houseInfo.setPZBX(1);}if (chuju_reg.isChecked()) {houseInfo.setPZCJ(1 + "");}if (jiaju_reg.isChecked()) {houseInfo.setPZJJ(1);}if (weibolu_reg.isChecked()) {houseInfo.setPZWBL(1);}if (xiyiji_reg.isChecked()) {houseInfo.setPZXYJ(1);}if (reshuiqi_reg.isChecked()) {houseInfo.setPZXYJ(1);}Log.d("test", "===============" + houseInfo.getPZXYJ() + "=========");}private void initData() {mListGylc = new ArrayList<>();for (int i = 1; i < 100; i++) {mListGylc.add(i + "");}cardtype_list = getListUtils.getListZjlx();mlistZjlxCode = new ArrayList<>();mlistZjlxCode.add("01");mlistZjlxCode.add("02");mlistZjlxCode.add("03");mlistZjlxCode.add("05");mlistZjlxCode.add("04");mlistZjlxCode.add("06");mlistZjlxCode.add("11");mlistZjlxCode.add("12");mlistZjlxCode.add("13");mlistZjlxCode.add("14");mlistZjlxCode.add("15");mListFwyt = new ArrayList<>();mListFwyt.add("住宅");mListFwyt.add("商業");mListFwyt.add("辦公");mListFwyt.add("倉庫");mListFwyt.add("其他");mListFwyt.add("工廠");mListLdxz = new ArrayList<>();mListLdxz.add("電梯房");mListLdxz.add("樓梯房");mListOritation = new ArrayList<>();mListOritation.add("東");mListOritation.add("南");mListOritation.add("西");mListOritation.add("北");mListOritation.add("東南");mListOritation.add("西南");mListOritation.add("東北");mListOritation.add("西北");mListOritation.add("東西");mListOritation.add("南北");mListOritation.add("不知朝向");mListFixInfo = new ArrayList<>();mListFixInfo.add("豪華裝修");mListFixInfo.add("精裝修");mListFixInfo.add("中等裝修");mListFixInfo.add("簡裝修");mListFixInfo.add("毛坯");mListFixInfo.add("普通裝修");mListPayMethod = new ArrayList<>();mListPayMethod.add("押3付1");mListPayMethod.add("押2付1");mListPayMethod.add("押1付1");mListPayMethod.add("押1付2");mListPayMethod.add("年付不押");mListPayMethod.add("半年付不押");mListPayMethod.add("面議");mListLeaseMode = new ArrayList<>();mListLeaseMode.add("合租");mListLeaseMode.add("整租");}@Overridepublic void onClick(View view){switch (view.getId()){case R.id.sp_xzq_template:selectAdministrative();break;case R.id.sp_jd_template:break;case R.id.auto_tv_house01_template:break;case R.id.tv_hreg01_nation_template:break;case R.id.tv_hreg01_zjlx_template:selectDocumentType(); //選擇證件類型break;case R.id.sp_fwyt:selectHousingPurposes(); //房屋用途break;case R.id.et_oritation:selectToward(); //選擇朝向break;case R.id.et_house_info:selectBuildingProperties(); //樓棟性質break;case R.id.et_house_gylc:selectBuildFloor(); //樓棟樓層break;case R.id.et_storey:selectFloor(); //所屬樓層break;case R.id.et_fixinfo:selectDegreeOfDecoration(); //裝修程度break;case R.id.et_shi:selectHuxing(); //戶型break;case R.id.btn_save_template:Log.i("btn_save_template","onclick");JudgeUserInputData(); //對數據進行判斷break;case R.id.et_paymethod:selectPaymentMethod(); //選擇支付方式break;case R.id.et_Leasemode:selectLeasingMethod(); //選擇租賃方式break;}}/*** 選擇行政區*/private void selectAdministrative(){xzq_list = getListUtils.getXZQWithNoTitle();final OptionListDialog dialog = SmartisanDialog.createOptionListDialog(template.this);dialog.setTitle("請選擇行政區").setOptionList(xzq_list).setItemGravity(Gravity.CENTER) // Item是居左、居中還是居右.setLastColor(0xFF40B64A) // 上次選擇的選項顯示的顏色,用于區分.show();dialog.setOnOptionItemSelectListener(new OnOptionItemSelectListener() {@Overridepublic void onSelect(int position, CharSequence option) {HZQ = xzq_list.get(position);sp_xzq_template.setText(HZQ);Map<String, String> map = new HashMap<String, String>();map.put("海珠區", "440105");map.put("天河區", "440106");map.put("白云區", "440111");map.put("黃埔區", "440112");map.put("番禺區", "440113");map.put("花都區", "440114");map.put("南沙區", "440115");map.put("從化區", "440117");map.put("荔灣區", "440103");map.put("越秀區", "440104");map.put("增城區", "440118");code = map.get(HZQ);if (HZQ != null) {queryPostJZ();auto_tv_house01_template.addTextChangedListener(new TextWatcher() {@Overridepublic void beforeTextChanged(CharSequence s, int start, int count, int after) {}@Overridepublic void onTextChanged(CharSequence s, int start, int before, int count) {String text = auto_tv_house01_template.getText().toString().trim();queryPostJLX(text);}@Overridepublic void afterTextChanged(Editable s) {String text = auto_tv_house01_template.getText().toString();queryPostJLX(text);}});}dialog.dismiss();}});}/*** 發送網絡請求街鎮,Post 行政區代碼過去*/private void queryPostJZ() {AjaxParams params = new AjaxParams();params.put("code", code);FinalHttp http = new FinalHttp();http.get(HttpUtils.ADDRESS_URL_JZ, params, new AjaxCallBack<Object>() {@Overridepublic void onLoading(long count, long current) {}@Overridepublic void onSuccess(Object o) {if (o != null) {String json = o.toString();System.out.println("---" + json);try {Gson gson = new Gson();list_jz = gson.fromJson(json, new TypeToken<List<Address>>() {}.getType());if (list_jz.size() > 0 && list_jz != null) {mList_jz = new ArrayList<>();for (int i = 0; i < list_jz.size(); i++) {mList_jz.add(list_jz.get(i).getName());}}} catch (JsonSyntaxException e) {e.printStackTrace();}sp_jd_template.setOnClickListener(new View.OnClickListener() {@Overridepublic void onClick(View v) {final OptionListDialog dialog = SmartisanDialog.createOptionListDialog(template.this);dialog.setTitle("請選擇街道").setOptionList(mList_jz).setItemGravity(Gravity.CENTER).setLastColor(0xFF40B64A).show();dialog.setOnOptionItemSelectListener(new OnOptionItemSelectListener() {@Overridepublic void onSelect(int position, CharSequence option) {JZ = mList_jz.get(position);jzCode = list_jz.get(position).getCode();sp_jd_template.setText(JZ);dialog.dismiss();}});}});}}@Overridepublic void onFailure(Throwable t, int errorNo, String strMsg) {}});}/*** 發送網絡請求街路巷,Post 街路巷的輸入值* @param text*/private void queryPostJLX(final String text) {final Response.Listener<String> listener = new Response.Listener<String>() {public void onResponse(String json) {mProgressHUD.dismiss();if (json != null) {try {Gson gson = new Gson();list_jlx = gson.fromJson(json, new TypeToken<List<Address>>() {}.getType());//街路巷集合(包括名稱和編碼)if (list_jlx != null) {if (list_jlx.size() > 0 && list_jlx != null) {mList_jlx = new ArrayList<>();//街路巷的名稱集合for (int i = 0; i < list_jlx.size(); i++) {mList_jlx.add(list_jlx.get(i).getName());}ArrayAdapter<String> adapter = new ArrayAdapter<String>(template.this,android.R.layout.simple_dropdown_item_1line,mList_jlx);auto_tv_house01_template.setThreshold(1);//從第一個字符開始auto_tv_house01_template.setAdapter(adapter);adapter.notifyDataSetChanged();auto_tv_house01_template.setOnItemClickListener(new AdapterView.OnItemClickListener() {@Overridepublic void onItemClick(AdapterView<?> parent, View view, int position, long id) {JLX = auto_tv_house01_template.getText().toString();if (!JLX.equals("")) {int p = 0;for (int i = 0; i < mList_jlx.size(); i++) {if (JLX.equals(mList_jlx.get(i))) {p = i;}}if (list_jlx != null && list_jlx.size() != 0) {jlxCode = list_jlx.get(p).getCode();//從服務器獲得的集合list_jlxmProgressHUD.show();}}}});}}} catch (JsonSyntaxException e) {e.printStackTrace();}} else {ToastUtil.ToastDemo(template.this, "暫無信息");}}};Response.ErrorListener errlistener = new Response.ErrorListener() {public void onErrorResponse(VolleyError error) {}};Request request = new StringRequest(Request.Method.POST, HttpUtils.URL_JLX_NEW, listener, errlistener) {@Overrideprotected Map<String, String> getParams() throws AuthFailureError {Map map = new HashMap();map.put("code", code);//行政區的codemap.put("key", text);//發送輸入框的值return map;}};queue.add(request);queue.start();}/*** 選擇國籍地區*/private void selectNationalityArea(){String json = getJsonUtils.getJson(this, "country.txt");Gson gson = new Gson();listCodeDetail = gson.fromJson(json, new TypeToken<List<CodeDetail>>() {}.getType());mListNation = new ArrayList<>();mListCode = new ArrayList<>();for (int i = 0; i < listCodeDetail.size(); i++) {mListNation.add(listCodeDetail.get(i).getNAME());//國籍地區名稱mListCode.add(listCodeDetail.get(i).getCODE());//國籍地區代碼}tv_hreg01_nation_template.setOnClickListener(new View.OnClickListener() {@Overridepublic void onClick(View v) {final OptionListDialog dialog = SmartisanDialog.createOptionListDialog(template.this);dialog.setTitle("請選擇國籍").setOptionList(mListNation).setItemGravity(Gravity.CENTER) // Item是居左、居中還是居右.setLastColor(0xFF40B64A) // 上次選擇的選項顯示的顏色,用于區分.show();dialog.setOnOptionItemSelectListener(new OnOptionItemSelectListener() {@Overridepublic void onSelect(int position, CharSequence option) {tv_hreg01_nation_template.setText(mListNation.get(position));//國家的codenationCode = mListCode.get(position);dialog.dismiss();}});}});}//請求字軌private void queryZg() {final RequestQueue queue3 = Volley.newRequestQueue(template.this);final Response.Listener<String> listener = new Response.Listener<String>() {public void onResponse(String json) {Gson gson = new Gson();listCodeDetailZg = gson.fromJson(json, new TypeToken<List<CodeDetail>>() {}.getType());mListZgName = new ArrayList<>();mListZgCode = new ArrayList<>();for (int i = 0; i < listCodeDetailZg.size(); i++) {mListZgName.add(listCodeDetailZg.get(i).getNAME());//字軌名稱mListZgCode.add(listCodeDetailZg.get(i).getCODE());//字軌代碼}tv_house_reg01_zg_template.setOnClickListener(new View.OnClickListener() {@Overridepublic void onClick(View v) {final OptionListDialog dialog = SmartisanDialog.createOptionListDialog(template.this);dialog.setTitle("請選擇字軌").setOptionList(mListZgName).setItemGravity(Gravity.CENTER).setLastColor(0xFF40B64A).show();dialog.setOnOptionItemSelectListener(new OnOptionItemSelectListener() {@Overridepublic void onSelect(int position, CharSequence option) {tv_house_reg01_zg_template.setText(mListZgName.get(position));//字軌CodezgCode = mListZgCode.get(position);dialog.dismiss();}});}});}};Response.ErrorListener errlistener = new Response.ErrorListener() {public void onErrorResponse(VolleyError error) {}};Request request = new StringRequest(Request.Method.POST, HttpUtils.URL_GETZG, listener, errlistener) {@Overrideprotected Map<String, String> getParams() throws AuthFailureError {Map map = new HashMap();return map;}};queue3.add(request);queue3.start();}/*** 選擇證件類型*/private void selectDocumentType(){final OptionListDialog dialog = SmartisanDialog.createOptionListDialog(template.this);dialog.setTitle("請選擇證件類型").setOptionList(cardtype_list).setItemGravity(Gravity.CENTER) // Item是居左、居中還是居右.setLastColor(0xFF40B64A) // 上次選擇的選項顯示的顏色,用于區分.show();dialog.setOnOptionItemSelectListener(new OnOptionItemSelectListener() {@Overridepublic void onSelect(int position, CharSequence option) {tv_hreg01_zjlx_template.setText(cardtype_list.get(position));ZJLX = mlistZjlxCode.get(position);dialog.dismiss();}});}/*** 選擇房屋用途*/private void selectHousingPurposes(){final OptionListDialog dialog = SmartisanDialog.createOptionListDialog(template.this);dialog.setTitle("請選擇房屋用途").setOptionList(mListFwyt).setItemGravity(Gravity.CENTER) // Item是居左、居中還是居右.setLastColor(0xFF40B64A) // 上次選擇的選項顯示的顏色,用于區分.show();dialog.setOnOptionItemSelectListener(new OnOptionItemSelectListener() {@Overridepublic void onSelect(int position, CharSequence option) {sp_fwyt.setText(mListFwyt.get(position));switch (position) {case 0:FWYT = "01";break;case 1:FWYT = "11";break;case 2:FWYT = "12";break;case 3:FWYT = "13";break;case 4:FWYT = "14";break;case 5:FWYT = "20";break;}dialog.dismiss();}});}/*** 選擇朝向*/private void selectToward(){final OptionListDialog dialog = SmartisanDialog.createOptionListDialog(template.this);dialog.setTitle("請選擇朝向").setOptionList(mListOritation).setItemGravity(Gravity.CENTER).setLastColor(0xFF40B64A).show();dialog.setOnOptionItemSelectListener(new OnOptionItemSelectListener() {@Overridepublic void onSelect(int position, CharSequence option) {et_oritation.setText(mListOritation.get(position));switch (position) {case 0:CX = "1";break;case 1:CX = "3";break;case 2:CX = "2";break;case 3:CX = "4";break;case 4:CX = "5";break;case 5:CX = "6";break;case 6:CX = "7";break;case 7:CX = "8";break;case 8:CX = "9";break;case 9:CX = "10";break;case 10:CX = "11";break;}dialog.dismiss();}});}/*** 選擇樓棟性質*/private void selectBuildingProperties(){final OptionListDialog dialog = SmartisanDialog.createOptionListDialog(template.this);dialog.setTitle("請選擇樓棟性質").setOptionList(mListLdxz).setItemGravity(Gravity.CENTER).setLastColor(0xFF40B64A).show();dialog.setOnOptionItemSelectListener(new OnOptionItemSelectListener() {@Overridepublic void onSelect(int position, CharSequence option) {et_house_info.setText(mListLdxz.get(position));switch (position) {case 0:LDXZ = "01";break;case 1:LDXZ = "02";break;}dialog.dismiss();}});}/*** 選擇總樓層數*/private void selectBuildFloor(){final OptionListDialog dialog = SmartisanDialog.createOptionListDialog(template.this);dialog.setTitle("請選擇總樓層").setOptionList(mListGylc).setItemGravity(Gravity.CENTER).setLastColor(0xFF40B64A).show();dialog.setOnOptionItemSelectListener(new OnOptionItemSelectListener() {@Overridepublic void onSelect(int position, CharSequence option) {et_house_gylc.setText(mListGylc.get(position));gylc = mListGylc.get(position);dialog.dismiss();}});}/*** 選擇所屬樓層*/private void selectFloor(){final OptionListDialog dialog = SmartisanDialog.createOptionListDialog(template.this);dialog.setTitle("請選擇所在樓層").setOptionList(mListGylc).setItemGravity(Gravity.CENTER).setLastColor(0xFF40B64A).show();dialog.setOnOptionItemSelectListener(new OnOptionItemSelectListener() {@Overridepublic void onSelect(int position, CharSequence option) {et_storey.setText(mListGylc.get(position));floor = mListGylc.get(position);dialog.dismiss();}});}/*** 選擇裝修程度*/private void selectDegreeOfDecoration(){final OptionListDialog dialog = SmartisanDialog.createOptionListDialog(template.this);dialog.setTitle("請選擇裝修程度").setOptionList(mListFixInfo).setItemGravity(Gravity.CENTER).setLastColor(0xFF40B64A).show();dialog.setOnOptionItemSelectListener(new OnOptionItemSelectListener() {@Overridepublic void onSelect(int position, CharSequence option) {et_fixinfo.setText(mListFixInfo.get(position));switch (position) {case 0:ZXCD = "6";break;case 1:ZXCD = "4";break;case 2:ZXCD = "3";break;case 3:ZXCD = "5";break;case 4:ZXCD = "1";break;case 5:ZXCD = "2";break;}dialog.dismiss();}});}/*** 選擇戶型*/private void selectHuxing(){//實例化SelectPicPopupWindowmenuWindow = new SelectPicPopupWindow(template.this, itemsOnClick);//顯示窗口menuWindow.showAtLocation(template.this.findViewById(R.id.linear_page), Gravity.BOTTOM|Gravity.CENTER_HORIZONTAL, 0, 0);}//獲得eventbus的通知后,重新刷新數據@Subscribe(threadMode = ThreadMode.MAIN)public void updateEventBus(String message) {if (message.equals("FLAG_FINISH_ALL")) {template.this.finish();}else {if (message != null) {et_shi.setText(message);shi = message.substring(0,1);ting = message.substring(2,3);chu = message.substring(4,5);wei = message.substring(6,7);}}}//為彈出窗口實現監聽類private View.OnClickListener itemsOnClick = new View.OnClickListener(){public void onClick(View v) {menuWindow.dismiss();switch (v.getId()) {case R.id.t_picker:break;case R.id.s_picker:break;case R.id.c_picker:break;case R.id.w_picker:break;default:break;}}};/*** 選擇支付方式*/private void selectPaymentMethod(){final OptionListDialog dialog = SmartisanDialog.createOptionListDialog(template.this);dialog.setTitle("請選擇支付方式").setOptionList(mListPayMethod).setItemGravity(Gravity.CENTER).setLastColor(0xFF40B64A).show();dialog.setOnOptionItemSelectListener(new OnOptionItemSelectListener() {@Overridepublic void onSelect(int position, CharSequence option) {et_paymethod.setText(mListPayMethod.get(position));switch (position) {case 0:ZJZFFS = "1";break;case 1:ZJZFFS = "2";break;case 2:ZJZFFS = "3";break;case 3:ZJZFFS = "4";break;case 4:ZJZFFS = "5";break;case 5:ZJZFFS = "6";break;case 6:ZJZFFS = "7";break;default:ZJZFFS = "";break;}dialog.dismiss();}});}/*** 租賃方式*/private void selectLeasingMethod(){final OptionListDialog dialog = SmartisanDialog.createOptionListDialog(template.this);dialog.setTitle("請選擇租賃方式").setOptionList(mListLeaseMode).setItemGravity(Gravity.CENTER).setLastColor(0xFF40B64A).show();dialog.setOnOptionItemSelectListener(new OnOptionItemSelectListener() {@Overridepublic void onSelect(int position, CharSequence option) {et_Leasemode.setText(mListLeaseMode.get(position));switch (position) {case 0:ZLFS = "02";break;case 1:ZLFS = "01";break;}dialog.dismiss();}});}public void getData(){Log.i("TAG","getData");HZQ = sp_xzq_template.getText().toString();JZ = sp_jd_template.getText().toString();JLX = auto_tv_house01_template.getText().toString();MLP = sp_mlp_template.getText().toString();XZ = et_Address_template.getText().toString();ZG = tv_house_reg01_zg_template.getText().toString();AH = et_ah_template.getText().toString();CQZH = et_hnum_template.getText().toString();CQMJ = et_house_regist_cqmj_template.getText().toString();Log.i("TAG","getData"+HZQ+JZ+MLP+XZ+ZG+AH+CQZH+CQMJ);YZXM = et_name_template.getText().toString();GJDQ = tv_hreg01_nation_template.getText().toString();ZJLX = tv_hreg01_zjlx_template.getText().toString();SFZH = et_cardnum_template.getText().toString();YZDH = et_call_template.getText().toString();Log.i("TAG","getData"+YZXM+GJDQ+ZJLX+SFZH+YZDH);FBBT = et_reg_title.getText().toString();LPDZ = et_housesaddress.getText().toString();FWYT = sp_fwyt.getText().toString();CX = et_oritation.getText().toString();LDXZ = et_house_info.getText().toString();ZLC = et_house_gylc.getText().toString();floor = et_storey.getText().toString();ZXCD = et_fixinfo.getText().toString();CZMJ = et_acreage.getText().toString();HXS = et_shi.getText().toString();Log.i("TAG","getData"+FBBT+LPDZ+FWYT+CX+LDXZ+ZLC+floor+PZLTHY+ZXCD+HXS);FYMS = et_describe.getText().toString();ZJZFFS = et_paymethod.getText().toString();ZJ = et_rent.getText().toString();ZLFS = et_Leasemode.getText().toString();Log.i("TAG","getData"+FYMS+ZJZFFS+ZJ+ZLFS);PZS = shui_reg.getText().toString();PZD = dian_reg.getText().toString();PZNQ =lanqi_reg.getText().toString();PZKD = kuandai_reg.getText().toString();PZDT = dianti_reg.getText().toString();PZDS = dianshi_reg.getText().toString();PZMQ = meiqi_reg.getText().toString();PZLTHY = lutai_reg.getText().toString();PZCWCK = chewei_reg.getText().toString();PZCCSDXS = ccroom_reg.getText().toString();Log.i("TAG","getData"+PZS+PZD+PZNQ+PZKD+PZDT+PZDS+PZMQ+PZLTHY+PZCWCK+PZCCSDXS);PZC = chuang_reg.getText().toString();PZDH = dianhua_reg.getText().toString();PZKT = kongtiao_reg.getText().toString();PZBX = bingxiang_reg.getText().toString();PZCJ = chuju_reg.getText().toString();PZJJ = jiaju_reg.getText().toString();PZWBL = weibolu_reg.getText().toString();PZXYJ = xiyiji_reg.getText().toString();PZRSQ = reshuiqi_reg.getText().toString();Log.i("TAG","getData"+PZC+PZDH+PZKT+PZKT+PZBX+PZCJ+PZJJ+PZWBL+PZXYJ+PZRSQ);}private void JudgeUserInputData(){getData();getCbData();if (isNotEmpty(HZQ) && isNotEmpty(ZJ) && isNotEmpty(ZLC) && isNotEmpty(JLX) && isNotEmpty(MLP) && isNotEmpty(XZ) && isNotEmpty(FBBT) && isNotEmpty(YZDH)){houseInfo.setUSERID(userId);houseInfo.setSJLY(type);Log.i("JudgeUserInputData","JudgeUserInputData"+HZQ+JZ+MLP+XZ+ZG+AH+CQZH+CQMJ);Log.i("JudgeUserInputData","JudgeUserInputData"+PZC+PZDH+PZKT+PZKT+PZBX+PZCJ+PZJJ+PZWBL+PZXYJ+PZRSQ);houseInfo.setHZQ(HZQ); //行政區houseInfo.setJZ(JZ); //街鎮houseInfo.setJLX(JLX); //街道houseInfo.setMLP(MLP);//門樓牌houseInfo.setXZ(XZ);//詳細地址houseInfo.setZG(ZG);//字軌houseInfo.setAH(AH);//案號houseInfo.setCQZH(CQZH);//產權證號houseInfo.setCQMJ(Double.valueOf(CQMJ));//產權面積houseInfo.setYZXM(YZXM); //產權人姓名houseInfo.setGJDQ(GJDQ);//國籍地區houseInfo.setZJLX(ZJLX); //證件類型houseInfo.setSFZH(SFZH); //證件號碼houseInfo.setYZDH(Long.valueOf(YZDH)); //手機號碼houseInfo.setFBBT(FBBT); //標題houseInfo.setLPDZ(LPDZ); //樓盤地址houseInfo.setFWYT(FWYT); //房屋用途houseInfo.setCX(CX); //朝向houseInfo.setLDXZ(LDXZ); //樓棟性質houseInfo.setZLC(Integer.valueOf(ZLC)); //樓層總數houseInfo.setZXCD(ZXCD);//裝修程度houseInfo.setCZMJ(Double.valueOf(CZMJ)); //租住面積//houseInfo.setHXS(); //戶型houseInfo.setHXT(Integer.valueOf(ting)); //廳houseInfo.setHXS(Integer.valueOf(shi)); //室houseInfo.setHXC(Integer.valueOf(chu)); //廚houseInfo.setHXW(Integer.valueOf(wei)); //衛houseInfo.setJZ(ZJ); //租金houseInfo.setFYMS(FYMS); //房源描述houseInfo.setZJZFFS(ZJZFFS); //支付方式houseInfo.setZLFS(ZLFS);//租賃方式AnalysisIntoJson(); //將houseInfo解析成json數據,發送到后臺//StartAction(); //保存模版后,返回模版列表}else{if (isEmpty(HZQ)) {ToastUtil.ToastDemo(template.this, "請選擇行政區");return;}if (isEmpty(JZ)) {ToastUtil.ToastDemo(template.this, "請選擇街道");return;}if (isEmpty(JLX)) {ToastUtil.ToastDemo(template.this, "請選擇街路巷");return;}if (isEmpty(MLP)) {ToastUtil.ToastDemo(template.this, "請填寫門樓牌");return;}if (isEmpty(XZ)) {ToastUtil.ToastDemo(template.this, "請填寫詳細地址");return;}if (isEmpty(CQMJ)) {ToastUtil.ToastDemo(template.this, "請填寫產權面積");return;}if (isEmpty(YZXM)) {ToastUtil.ToastDemo(template.this, "請填寫產權人姓名");return;}if (nationCode == null) {ToastUtil.ToastDemo(template.this, "請選擇國籍地區");return;}if (isEmpty(ZJLX)) {ToastUtil.ToastDemo(template.this, "請選擇證件類型");return;}if (isEmpty(SFZH)) {ToastUtil.ToastDemo(template.this, "請填寫證件號碼");return;}if ( isEmpty(YZDH)) {ToastUtil.ToastDemo(template.this, "請填寫移動手機號碼");return;}if (isEmpty(FBBT)) {ToastUtil.ToastDemo(template.this, "請填寫發布標題");return;}if (isEmpty(LPDZ)) {ToastUtil.ToastDemo(template.this, "請填寫樓盤地址");return;}if (isEmpty(FWYT)) {ToastUtil.ToastDemo(template.this, "請填寫房屋用途");return;}if (isEmpty(CX)) {ToastUtil.ToastDemo(template.this, "請填寫朝向");return;}if (isEmpty(LDXZ)) {ToastUtil.ToastDemo(template.this, "請填寫樓棟性質");return;}if (isEmpty(ZLC)) {ToastUtil.ToastDemo(template.this, "請填寫共有樓層");return;}if (isEmpty(floor)) {ToastUtil.ToastDemo(template.this, "請填寫所屬樓層");return;}if (isEmpty(ZXCD)) {ToastUtil.ToastDemo(template.this, "請填寫裝修程度");return;}if (isEmpty(CZMJ)) {ToastUtil.ToastDemo(template.this, "請填寫出租面積");return;}if (isEmpty(HXS)) {ToastUtil.ToastDemo(template.this, "請填寫戶型");return;}if (isEmpty(ZJ)) {ToastUtil.ToastDemo(template.this, "請填寫租金");return;}if (!PhoneFormatCheckUtils.isPhoneLegal(SFZH)) {ToastUtil.ToastDemo(template.this, "請填寫正確的移動手機");return;}if (ZJ.equals("01")) {if (!CheckIdCard.isValidatedAllIdcard(SFZH)) {ToastUtil.ToastDemo(template.this, "請填寫正確的身份證號");return;}}}}/*** 將houseInfo解析成json數據,發送到后臺*/private void AnalysisIntoJson(){mProgressHUD = ProgressHUD.show(template.this, "請稍等", false, false, null);MultipartBody.Builder mbody = new MultipartBody.Builder().setType(MultipartBody.FORM);Gson gson = new GsonBuilder().setDateFormat("yyyy-MM-dd").create();String json = gson.toJson(houseInfo);mbody.addFormDataPart("house", json);System.out.println("房屋的json===" + json);RequestBody requestBody = mbody.build();okhttp3.Request request = new okhttp3.Request.Builder().header("Authorization", "Client-ID " + "...").url(HttpUtils.TEMPLATE_URL).post(requestBody).build();new OkHttpClient().newCall(request).enqueue(new Callback() {@Overridepublic void onFailure(Call call, IOException e) {mProgressHUD.dismiss();}@Overridepublic void onResponse(Call call, okhttp3.Response response) throws IOException {mProgressHUD.dismiss();runOnUiThread(new Runnable() {@Overridepublic void run() {Toast.makeText(template.this,"新增一個模板!",Toast.LENGTH_SHORT).show();}});Intent intent = new Intent(template.this, TemplateListActivity.class);startActivity(intent);EventBus.getDefault().post("FLAG_FINISH_ALL");finish();}});}/*** 保存模版后,返回模版列表*/private void StartAction(){Intent intent = new Intent(template.this, TemplateListActivity.class);intent.putExtra("houseInfo", houseInfo);startActivity(intent);}/*** is not null* @param s* @return*/private boolean isNotEmpty(String s) {if (s != null && !s.equals("") || s.length() > 0) {return true;}else {return false;}}private boolean isEmpty(String s) {if (isNotEmpty(s)) {return false;}else {return true;}}/*** 監聽返回鍵* @param keyCode 鍵* @param event 事件* @return*/@Overridepublic boolean onKeyDown(int keyCode, KeyEvent event) {if (keyCode == KeyEvent.KEYCODE_BACK) {final WarningDialog dialog = SmartisanDialog.createWarningDialog(template.this);dialog.setTitle("您信息尚未填寫完整,確定退出嗎?").setConfirmText("退出").show();dialog.setOnConfirmListener(new WarningDialog.OnConfirmListener() {@Overridepublic void onConfirm() {Intent intent = new Intent(template.this,TemplateListActivity.class);startActivity(intent);finish();dialog.dismiss();}});}return super.onKeyDown(keyCode, event);}@Overrideprotected void onDestroy() {super.onDestroy();EventBus.getDefault().unregister(this);}}轉載于:https://www.cnblogs.com/chenxiaoyan/p/7909857.html
總結
以上是生活随笔為你收集整理的android - 房源登记模版的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 基本存款账户编号怎么查_基本存款账户编号
- 下一篇: 超好用的云盘资源搜索网站