@Override
 protected boolean shouldAbort() {
   boolean abort = device.isInitialized();
   if (abort) {
     LOG.info("Aborting device initialization, because already initialized: " + device);
   }
   return abort;
 }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    mLocale = getResources().getConfiguration().locale;

    View rootView = inflater.inflate(R.layout.fragment_sleepchart, container, false);

    GBDevice device = ((ChartsHost) getHost()).getDevice();
    if (device != null) {
      // TODO: eek, this is device specific!
      mTargetSteps = MiBandCoordinator.getFitnessGoal(device.getAddress());
    }

    mWeekStepsChart = (BarLineChartBase) rootView.findViewById(R.id.sleepchart);
    mTodayStepsChart = (PieChart) rootView.findViewById(R.id.sleepchart_pie_light_deep);

    setupWeekStepsChart();
    setupTodayStepsChart();

    // refresh immediately instead of use refreshIfVisible(), for perceived performance
    refresh();

    return rootView;
  }
Esempio n. 3
0
 @Override
 public boolean isGenerallyCompatibleWith(GBDevice device) {
   String hwVersion = device.getHardwareVersion();
   return MiBandConst.MI_1.equals(hwVersion);
 }