@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.cash_sale_set_activity); final ActionBar actionBar = getSupportActionBar(); actionBar.setTitle(R.string.cash_sale); actionBar.setDisplayHomeAsUpEnabled(true); mProgressLayout = (RelativeLayout) findViewById(R.id.progress_layout); mContentLayout = (LinearLayout) findViewById(R.id.content_layout); mShopSp = (Spinner) findViewById(R.id.shop_sp); mWarehouseSp = (Spinner) findViewById(R.id.warehouse_sp); mPriceSp = (Spinner) findViewById(R.id.price_sp); mNotRecordCustomerCheck = (CheckBox) findViewById(R.id.not_record_customer_check); mSearchCustomerBtn = (Button) findViewById(R.id.search_customer_btn); mCustomerInfoLayout = (GridLayout) findViewById(R.id.customer_info_layout); mCustomerNameEdit = (EditText) findViewById(R.id.customer_name_edit); mTelEdit = (EditText) findViewById(R.id.tel_edit); mZipCodeEdit = (EditText) findViewById(R.id.zip_code_edit); mToDistrictAddressBtn = (Button) findViewById(R.id.to_district_address_btn); mToDistrictAddressBtn.setOnClickListener( new OnClickListener() { @Override public void onClick(View arg0) { Intent intent = new Intent(CashSaleSetActivity.this, AddressSelectActivity.class); startActivityForResult(intent, REQUEST_CODE_ADDRESS); } }); mStreetAddressEdit = (EditText) findViewById(R.id.street_address_edit); mEmailEdit = (EditText) findViewById(R.id.email_edit); mNotRecordCustomerCheck.setOnCheckedChangeListener( new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton arg0, boolean isChecked) { showCustomerInfo(!isChecked); } }); mSearchCustomerBtn.setOnClickListener( new OnClickListener() { @Override public void onClick(View arg0) { Intent intent = new Intent(CashSaleSetActivity.this, SearchCustomerActivity.class); startActivityForResult(intent, REQUEST_CODE_CUSTOMER); } }); Util.initSpinner( this, mPriceSp, R.layout.simple_spinner_dropdown_item, CashSaleSpec.getPrices()); final SharedPreferences sharedPref = getSharedPreferences(Globals.getUserPrefsName(), Context.MODE_PRIVATE); int defaultPrice = sharedPref.getInt(PrefKeys.DEFAULT_PRICE, 0); mPriceSp.setSelection(defaultPrice); Globals.setWhichPrice(defaultPrice); mPriceSp.setOnItemSelectedListener( new OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { Globals.setWhichPrice(position); } @Override public void onNothingSelected(AdapterView<?> arg0) {} }); if (Globals.getWhichPrice() == -1) { Globals.setWhichPrice(0); } mOkBtn = (Button) findViewById(R.id.ok_btn); WDTQuery.getinstance().queryShops(this, this); }
@Override protected void onResume() { super.onResume(); mPriceSp.setSelection(Globals.getWhichPrice()); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.fast_in_examine_goods_set_activity); final ActionBar actionBar = getActionBar(); actionBar.setTitle(R.string.fast_in_examine_goods); actionBar.setDisplayHomeAsUpEnabled(true); mProgressLayout = (RelativeLayout) findViewById(R.id.progress_layout); mSupplierSp = (Spinner) findViewById(R.id.supplier_sp); mInWarehouseSp = (Spinner) findViewById(R.id.in_warehouse_sp); mDoPriceSp = (Spinner) findViewById(R.id.do_price_sp); mOkBtn = (Button) findViewById(R.id.ok_btn); Globals.setWhichSupplier(-1); Globals.setWhichWarehouse(-1); Globals.setWhichPrice(-1); mTempSuppliers = null; mWarehouses = null; mSupplierSp.setOnItemSelectedListener( new OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { mWhichSupplier = position; } @Override public void onNothingSelected(AdapterView<?> arg0) {} }); mWhichSupplier = -1 != Globals.getWhichPrice() ? Globals.getWhichSupplier() : 0; mInWarehouseSp.setOnItemSelectedListener( new OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int positioin, long id) { mWhichWarehouse = positioin; } @Override public void onNothingSelected(AdapterView<?> arg0) {} }); mWhichWarehouse = -1 != Globals.getWhichWarehouse() ? Globals.getWhichWarehouse() : 0; ArrayAdapter<String> adapter = new ArrayAdapter<String>( this, R.layout.simple_spinner_dropdown_item, getResources().getStringArray(R.array.prices)); mDoPriceSp.setAdapter(adapter); mWhichPrice = -1 != Globals.getWhichPrice() ? Globals.getWhichPrice() : 0; mDoPriceSp.setSelection(mWhichPrice); mDoPriceSp.setOnItemSelectedListener( new OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { mWhichPrice = position; } @Override public void onNothingSelected(AdapterView<?> arg0) {} }); mSupplierPos = 0; mSuppliers = null; WDTQuery.getinstance().querySupplierCount(this, this); mOkBtn.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { Globals.setWhichSupplier(mWhichSupplier); Globals.setWhichWarehouse(mWhichWarehouse); Globals.setModuleUseWarehouseId(mWarehouses[mWhichWarehouse].warehouseId); Globals.setWhichPrice(mWhichPrice); Globals.setSupplierId(mTempSuppliers[mWhichSupplier].supplierId); Intent intent = new Intent(getBaseContext(), FastInExamineGoodsListActivity.class); intent.putExtra(Extras.SCAN_TYPE, ScanType.TYPE_FAST_IN_EXAMINE_GOODS); startActivity(intent); } }); }