Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class OrderActivity extends BaseKaizenActivity implements OnClickListener {
- private List<HashMap<String, String>> listModel;
- private AutoCompleteTextView productTextView;
- private Button addProductButton;
- private AutoCompleteTextView supplierTextView;
- private ListView visibleTable;
- private ListViewAdapter tableAdapter;
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.order);
- final Drawable x = getResources().getDrawable(R.drawable.clear);
- tf = Farsi.GetFarsiFont(this);
- supNameTV = (TextView) findViewById(R.id.supplierNameTV);
- supNameTV.setTypeface(tf);
- supNameTV.setText(Farsi.Convert(supNameTV.getText().toString()));
- proNameTV = (TextView) findViewById(R.id.prodNameTV);
- proNameTV.setTypeface(tf);
- proNameTV.setText(Farsi.Convert(proNameTV.getText().toString()));
- visibleTable = (ListView) findViewById(R.id.listview);
- registerForContextMenu(visibleTable);
- createTableHeader();
- listModel = new ArrayList<HashMap<String, String>>();
- Bundle extras = getIntent().getExtras();
- long customerId = extras.getLong("CUSTOMER_ID");
- customerType = extras.getInt("CUSTOMER_TYPE");
- Log.d("CUSTOMER ID IS = ", " " + customerId+" TYPE "+customerType);
- order = new Order(Long.toString(customerId));
- productTextView = (AutoCompleteTextView) findViewById(R.id.prodName_CB);
- productTextView.setThreshold(0);
- ClearableEditText.createClearableWidget(productTextView, x);
- productTextView.setTypeface(tf);
- supplierTextView = (AutoCompleteTextView) findViewById(R.id.supplierName_CB);
- supplierTextView.setThreshold(0);
- initControls();
- if (BaseKaizenActivity.getStorageManager().getSuppliers().size() == 0) {
- progressDialog = ProgressDialog.show(this, "Loading Supplier list");
- products = getConnection().getProducts();
- BaseKaizenActivity.getStorageManager().setProducts(products);
- loadSuppliers();
- loadProducts();
- }
- else {
- handleSuccess(BaseKaizenActivity.getStorageManager().getSuppliers());
- handleProductSuccess(BaseKaizenActivity.getStorageManager().getAllProducts());
- }
- }
- private void loadSuppliers() {
- Thread thread = new Thread(new Runnable() {
- @Override
- public void run() {
- try {
- List<String> suppliers = BaseKaizenActivity.getStorageManager().getSuppliers();
- Log.d("---", "loaded : Suppliersssssss: " + suppliers.size());
- for (String sup : suppliers) {
- Log.d("---", sup);
- }
- handleSuccess(suppliers);
- }
- catch (Exception exc) {
- Log.d("--- ERROR ---", exc.getMessage());
- handleException(exc.getMessage());
- }
- }
- });
- thread.start();
- }
- private void loadProducts() {
- Thread thread = new Thread(new Runnable() {
- @Override
- public void run() {
- try {
- allProducts = BaseKaizenActivity.getStorageManager().getAllProducts();
- Log.d("---", "loaded : productsssss: " + allProducts.size());
- for (String p : allProducts) {
- Log.d("Pro Name", p);
- }
- handleProductSuccess(allProducts);
- }
- catch (Exception exc) {
- Log.d("--- ERROR ---", exc.getMessage());
- handleException(exc.getMessage());
- }
- }
- });
- thread.start();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement