@Override
    public View getView(int position, View convertView, ViewGroup parent) {
      ViewHolder holder;

      if (convertView == null) {
        // inflate item layout
        LayoutInflater inflater =
            (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        convertView = inflater.inflate(R.layout.item_exercise, parent, false);

        // initialize view holder
        holder = new ViewHolder();
        holder.thumbnail = (ImageView) convertView.findViewById(R.id.thumbnail);
        holder.description = (TextView) convertView.findViewById(R.id.description);
        holder.description.setTypeface(AndroidUtils.robotoRegular(getContext()));
        holder.minsValue = (TextView) convertView.findViewById(R.id.mins_value);
        holder.repsValue = (TextView) convertView.findViewById(R.id.reps_value);
        holder.setsValue = (TextView) convertView.findViewById(R.id.sets_value);
        convertView.setTag(holder);
      } else {
        // recycle view
        holder = (ViewHolder) convertView.getTag();
      }

      // update item view
      Exercise listItem = getItem(position);
      holder.description.setText(listItem.getDescription());
      holder.minsValue.setText(Utils.zeroPaddedNumber(listItem.getMinutes(), 2));
      holder.repsValue.setText(Utils.zeroPaddedNumber(listItem.getRepetitions(), 2));
      holder.setsValue.setText(Utils.zeroPaddedNumber(listItem.getSets(), 2));

      return convertView;
    }
示例#2
0
  public void setUpHeader(View header) {
    Typeface robotoBold = AndroidUtils.robotoBold(this.context);
    TextView patientID = (TextView) header.findViewById(R.id.menu_patient_id);
    TextView patientIDSubtitle = (TextView) header.findViewById(R.id.menu_subtitle_patient_id);
    TextView nextVisit = (TextView) header.findViewById(R.id.menu_next_visit);
    TextView nextVisitSubtitle = (TextView) header.findViewById(R.id.menu_subtitle_next_visit);
    TextView week = (TextView) header.findViewById(R.id.menu_week);
    TextView weekSubtitle = (TextView) header.findViewById(R.id.menu_subtitle_week);

    patientID.setText(DataManager.getCurrentPatient().getUserID());
    patientID.setTypeface(robotoBold);
    patientIDSubtitle.setText(context.getResources().getString(R.string.patient_id_subtitle));

    // set localized date for next visit
    Locale locale = context.getResources().getConfiguration().locale;
    Date nextDate = DataManager.getCurrentPatient().getDateOfNextVisit();
    nextVisit.setText(Utils.localizedDateWithoutYear(nextDate, locale));
    nextVisit.setTypeface(robotoBold);

    nextVisitSubtitle.setText(context.getResources().getString(R.string.next_visit_subtitle));
    week.setText(
        "Visit "
            + DataManager.getCurrentPatient().getVisitsUsed()
            + "/"
            + DataManager.getCurrentPatient().getVisitsTotal());
    week.setTypeface(robotoBold);
    weekSubtitle.setText(context.getResources().getString(R.string.week_subtitle));
  }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_exercise, container, false);

    // set custom typeface on header text
    Typeface robotoRegular = AndroidUtils.robotoRegular(getActivity());
    TextView routineName = (TextView) view.findViewById(R.id.routine_name);
    routineName.setTypeface(robotoRegular);
    TextView routineDirections = (TextView) view.findViewById(R.id.routine_directions);
    routineDirections.setTypeface(robotoRegular);

    return view;
  }
示例#4
0
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    View row;
    if (convertView == null) {
      LayoutInflater menuInflator =
          (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
      row = menuInflator.inflate(R.layout.menu_row, parent, false);
    } else {
      row = convertView;
    }

    TextView rowText = (TextView) row.findViewById(R.id.row_text);
    rowText.setText(menuItemsTitles[position]);
    rowText.setTypeface(AndroidUtils.robotoRegular(context));

    return row;
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_login);

    Configuration configuration =
        new Configuration.Builder(this)
            .withAPIKey(APP_KEY)
            .withMode(Mode.QA)
            .withReportOnShakeEnabled(true)
            .build();

    Apphance.startNewSession(LoginActivity.this, configuration);

    fitClient = HealthDataRetriever.getClient(this);
    if (!fitClient.isConnected()) {
      fitClient.connect();
    }

    mPatientText = (EditText) findViewById(R.id.patient_id);
    mPasswordText = (EditText) findViewById(R.id.password);
    Button loginButton = (Button) findViewById(R.id.login_button);
    TextView loginTitle = (TextView) findViewById(R.id.login_title);

    mProgressDialog = AndroidUtils.circularProgressDialog(this);

    // set custom type faces for necessary views
    Typeface robotoThin = AndroidUtils.robotoThin(this);
    Typeface robotoBold = AndroidUtils.robotoBold(this);
    mPatientText.setTypeface(robotoThin);
    mPasswordText.setTypeface(robotoThin);
    loginButton.setTypeface(robotoThin);
    loginTitle.setTypeface(robotoBold);

    // route soft keyboard login completion to submitLogin listener
    mPasswordText.setOnEditorActionListener(
        new TextView.OnEditorActionListener() {
          @Override
          public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            boolean handled = false;
            if (actionId == EditorInfo.IME_ACTION_DONE) {
              submitLogin(v);
              handled = true;
            }
            return handled;
          }
        });

    // connect to WL and register challenge handler for authentication
    WLClient wlClient = WLClient.createInstance(this);
    wlClient.connect(
        new WLResponseListener() {
          @Override
          public void onSuccess(WLResponse wlResponse) {
            Log.i(TAG, "Connected to Worklight!");
          }

          @Override
          public void onFailure(WLFailResponse wlFailResponse) {
            Log.i(TAG, "Could not connect to Worklight!");
          }
        },
        WLProcedureCaller.defaultOptions());
    wlClient.registerChallengeHandler(new ReadyAppsChallengeHandler(this, "SingleStepAuthRealm"));
  }