예제 #1
0
  private void selectTrackableAction(final View view) {
    final int realViewId = view.getId();
    final Builder alert = new AlertDialog.Builder(this);
    final TrackableLog trackableLog = actionButtons.get(realViewId);
    alert.setTitle(trackableLog.name);
    final List<LogTypeTrackable> tbLogTypeValues =
        LogTypeTrackable.getLogTypeTrackableForLogCache();
    final String[] tbLogTypes = getTBLogTypes(tbLogTypeValues);
    alert.setItems(
        tbLogTypes,
        new OnClickListener() {

          @Override
          public void onClick(final DialogInterface dialog, final int position) {
            final LogTypeTrackable logType = tbLogTypeValues.get(position);
            trackableLog.action = logType;
            Log.i(
                "Trackable "
                    + trackableLog.trackCode
                    + " ("
                    + trackableLog.name
                    + ") has new action: #"
                    + logType);
            updateTrackablesList();
            dialog.dismiss();
          }
        });
    alert.create().show();
  }
예제 #2
0
  private void selectAllTrackablesAction() {
    final Builder alert = new AlertDialog.Builder(this);
    alert.setTitle(res.getString(R.string.log_tb_changeall));

    final List<LogTypeTrackable> tbLogTypeValues =
        LogTypeTrackable.getLogTypeTrackableForLogCache();
    final String[] tbLogTypes = getTBLogTypes(tbLogTypeValues);
    alert.setItems(
        tbLogTypes,
        new OnClickListener() {

          @Override
          public void onClick(final DialogInterface dialog, final int position) {
            final LogTypeTrackable logType = tbLogTypeValues.get(position);
            for (final TrackableLog tb : trackables) {
              tb.action = logType;
              Log.i("Trackable " + tb.trackCode + " (" + tb.name + ") has new action: #" + logType);
            }
            updateTrackablesList();
            dialog.dismiss();
          }
        });
    alert.create().show();
  }