Ejemplo n.º 1
0
 // TODO: Need to handle rotation
 private void initWorkerPager() {
   mWorkerPagerAdapter = new WorkerPagerAdapter(mFragmentManager);
   createWorkerPages(WorkingData.getInstance(mContext).getFactories().get(0).workers);
   initWorkerPagerIndicator();
   mWorkerPagerAdapter.setWorkerPages(mWorkerPageList);
   mWorkerPager.setAdapter(mWorkerPagerAdapter);
   mWorkerPager.setOnPageChangeListener(this);
 }
Ejemplo n.º 2
0
  private void setFactorySpinnerDatas() {
    mFactorySpinnerData.clear();
    for (Factory factory : WorkingData.getInstance(mContext).getFactories()) {
      mFactorySpinnerData.add(factory);
    }

    mFactorySpinnerAdapter.notifyDataSetChanged();
  }
Ejemplo n.º 3
0
  private void setVendorSpinnerDatas() {
    mVendorSpinnerData.clear();
    mVendorSpinnerData.add(
        new Vendor("", getResources().getString(R.string.case_spinner_all_vendors)));
    mVendorSpinnerData.addAll(WorkingData.getInstance(mContext).getVendors());

    mVendorSpinnerAdapter.notifyDataSetChanged();
  }
Ejemplo n.º 4
0
  private void initCaseView() {
    mCaseAdapter = new CaseAdapter(mContext, WorkingData.getInstance(mContext).getCases().get(0));
    mCaseOnTouchListener = new CaseOnTouchListener(mContext, mCaseView);
    mCaseLayoutManager = new LinearLayoutManager(mContext);

    mCaseView.setLayoutManager(mCaseLayoutManager);
    mCaseView.addItemDecoration(new CaseCardDecoration(mContext));
    mCaseView.setOnTouchListener(mCaseOnTouchListener);
    mCaseView.setAdapter(mCaseAdapter);
  }
Ejemplo n.º 5
0
  private void showViews() {
    initVendorSpinner();
    initCaseSpinner();
    initFactorySpinner();

    setVendorSpinnerDatas();
    setCaseSpinnerDatas(WorkingData.getInstance(mContext).getCases());
    setFactorySpinnerDatas();

    initCaseView();
    initWorkerPager();

    Utils.replaceProgressBarWhenLoadingFinished(mContext, mMainView, mProgressBar);
  }
Ejemplo n.º 6
0
  public static String getWorkerWipEquipmentName(Context context, Worker worker) {
    String result = context.getString(R.string.no_equipment);

    if (worker.hasWipTask()) {
      Equipment wipEquipment =
          WorkingData.getInstance(context).getEquipmentById(worker.getWipTask().equipmentId);

      if (wipEquipment != null) {
        result = wipEquipment.name;
      }
    }

    return result;
  }
Ejemplo n.º 7
0
  @Override
  public void updateData() {
    int vendorSpinnerSelectedPos = mVendorSpinner.getSelectedItemPosition();

    setVendorSpinnerDatas();
    setCaseSpinnerDatas(
        vendorSpinnerSelectedPos == Spinner.INVALID_POSITION || vendorSpinnerSelectedPos == 0
            ? WorkingData.getInstance(mContext).getCases()
            : mVendorSpinnerData.get(mVendorSpinner.getSelectedItemPosition()).getCases());
    setFactorySpinnerDatas();

    mCaseAdapter.notifyDataSetChanged();
    for (WorkerFragment workerFragment : mWorkerPageList) {
      workerFragment.notifyDataSetChanged();
    }
  }
Ejemplo n.º 8
0
 @Override
 public void onStop() {
   super.onStop();
   WorkingData.getInstance(mContext).removeDataObserver(this);
 }
Ejemplo n.º 9
0
 @Override
 public void onStart() {
   super.onStart();
   WorkingData.getInstance(mContext).registerDataObserver(this);
   updateData();
 }