コード例 #1
0
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // Inflate the layout containing a title and body text.
    ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.estadistica_view, container, false);

    int idEstadistica = this.mPageNumber;

    // Titulo y descripcion de estadistica
    TextView tituloEstadistica = (TextView) rootView.findViewById(R.id.TxtTituloEstadistica);
    TextView descEstadistica = (TextView) rootView.findViewById(R.id.TxtDescEstadistica);

    tituloEstadistica.setText(RelacionEstadisticas.getRelacion().get(idEstadistica).getTitulo());
    descEstadistica.setText(RelacionEstadisticas.getRelacion().get(idEstadistica).getDescripcion());

    rootView.addView(
        new EstadisticaViewLayout(Utilidades.getAppContext())
            .getView(RelacionEstadisticas.getRelacion().get(idEstadistica)));
    // }
    // catch (Exception e)
    // {
    //	Toast.makeText(Utilidades.getAppContext(), "error: " + e.getLocalizedMessage(),
    // Toast.LENGTH_LONG).show();
    //	Log.e("ERROR", e.getLocalizedMessage());
    // }
    // Set the title view to show the page number.
    /*((TextView) rootView.findViewById(android.R.id.text1)).setText(
    getString(R.string.title_template_step, mPageNumber + 1));*/

    return rootView;
  }
コード例 #2
0
  protected View getSectionHeaderView(String sectionHeader, View convertView, ViewGroup parent) {
    TextView result = (TextView) convertView;

    if (result == null) {
      result = (TextView) inflater.inflate(R.layout.com_facebook_picker_list_section_header, null);
    }

    result.setText(sectionHeader);

    return result;
  }
コード例 #3
0
    public View getView(int position, View convertView, ViewGroup parent) {
      final View view =
          (convertView != null)
              ? convertView
              : LayoutInflater.from(parent.getContext())
                  .inflate(R.layout.bookmark_item, parent, false);
      final ImageView imageView = (ImageView) view.findViewById(R.id.bookmark_item_icon);
      final TextView textView = (TextView) view.findViewById(R.id.bookmark_item_text);
      final TextView bookTitleView = (TextView) view.findViewById(R.id.bookmark_item_booktitle);

      final Bookmark bookmark = getItem(position);
      if (bookmark == null) {
        imageView.setVisibility(View.VISIBLE);
        imageView.setImageResource(R.drawable.ic_list_plus);
        textView.setText(ZLResource.resource("bookmarksView").getResource("new").getValue());
        bookTitleView.setVisibility(View.GONE);
      } else {
        imageView.setVisibility(View.GONE);
        textView.setText(bookmark.getText());
        if (myCurrentBook) {
          bookTitleView.setVisibility(View.GONE);
        } else {
          bookTitleView.setVisibility(View.VISIBLE);
          bookTitleView.setText(bookmark.getBookTitle());
        }
      }
      return view;
    }
コード例 #4
0
ファイル: GpsMainActivity.java プロジェクト: pari-m/gpslogger
  public void onFileName(String newFileName) {
    if (newFileName == null || newFileName.length() <= 0) {
      return;
    }

    TextView txtFilename = (TextView) findViewById(R.id.txtFileName);

    if (AppSettings.shouldLogToGpx() || AppSettings.shouldLogToKml()) {

      txtFilename.setText(
          getString(R.string.summary_current_filename_format, Session.getCurrentFileName()));
    } else {
      txtFilename.setText("");
    }
  }
コード例 #5
0
 private void setPickerFragmentSettingsFromBundle(Bundle inState) {
   // We do this in a separate non-overridable method so it is safe to call from the constructor.
   if (inState != null) {
     showPictures = inState.getBoolean(SHOW_PICTURES_BUNDLE_KEY, showPictures);
     String extraFieldsString = inState.getString(EXTRA_FIELDS_BUNDLE_KEY);
     if (extraFieldsString != null) {
       String[] strings = extraFieldsString.split(",");
       setExtraFields(Arrays.asList(strings));
     }
     showTitleBar = inState.getBoolean(SHOW_TITLE_BAR_BUNDLE_KEY, showTitleBar);
     String titleTextString = inState.getString(TITLE_TEXT_BUNDLE_KEY);
     if (titleTextString != null) {
       titleText = titleTextString;
       if (titleTextView != null) {
         titleTextView.setText(titleText);
       }
     }
     String doneButtonTextString = inState.getString(DONE_BUTTON_TEXT_BUNDLE_KEY);
     if (doneButtonTextString != null) {
       doneButtonText = doneButtonTextString;
       if (doneButton != null) {
         doneButton.setText(doneButtonText);
       }
     }
   }
 }
コード例 #6
0
  /* Scan the files in the new directory, and store them in the filelist.
   * Update the UI by refreshing the list adapter.
   */
  private void loadDirectory(String newdirectory) {
    if (newdirectory.equals("../")) {
      try {
        directory = new File(directory).getParent();
      } catch (Exception e) {
      }
    } else {
      directory = newdirectory;
    }
    SharedPreferences.Editor editor = getPreferences(0).edit();
    editor.putString("lastBrowsedDirectory", directory);
    editor.commit();
    directoryView.setText(directory);

    filelist = new ArrayList<FileUri>();
    ArrayList<FileUri> sortedDirs = new ArrayList<FileUri>();
    ArrayList<FileUri> sortedFiles = new ArrayList<FileUri>();
    if (!newdirectory.equals(rootdir)) {
      String parentDirectory = new File(directory).getParent() + "/";
      Uri uri = Uri.parse("file://" + parentDirectory);
      sortedDirs.add(new FileUri(uri, parentDirectory));
    }
    try {
      File dir = new File(directory);
      File[] files = dir.listFiles();
      if (files != null) {
        for (File file : files) {
          if (file == null) {
            continue;
          }
          String filename = file.getName();
          if (file.isDirectory()) {
            Uri uri = Uri.parse("file://" + file.getAbsolutePath() + "/");
            FileUri fileuri = new FileUri(uri, uri.getPath());
            sortedDirs.add(fileuri);
          } else if (filename.endsWith(".mid")
              || filename.endsWith(".MID")
              || filename.endsWith(".midi")
              || filename.endsWith(".MIDI")) {

            Uri uri = Uri.parse("file://" + file.getAbsolutePath());
            FileUri fileuri = new FileUri(uri, uri.getLastPathSegment());
            sortedFiles.add(fileuri);
          }
        }
      }
    } catch (Exception e) {
    }

    if (sortedDirs.size() > 0) {
      Collections.sort(sortedDirs, sortedDirs.get(0));
    }
    if (sortedFiles.size() > 0) {
      Collections.sort(sortedFiles, sortedFiles.get(0));
    }
    filelist.addAll(sortedDirs);
    filelist.addAll(sortedFiles);
    adapter = new IconArrayAdapter<FileUri>(this, android.R.layout.simple_list_item_1, filelist);
    this.setListAdapter(adapter);
  }
コード例 #7
0
  /** Called when the activity is first created */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    Log.d(TAG, "LoaderActivity created");
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.content);

    // Instantiate custom adapter
    mAdapter = new LoaderAdapter();

    // Handle listview and assign adapter
    mListView = (ListView) findViewById(R.id.content_list_view);
    mListView.setAdapter(mAdapter);
    mListView.setVisibility(View.GONE);
    mListView.setOnItemLongClickListener(
        new AdapterView.OnItemLongClickListener() {
          public boolean onItemLongClick(AdapterView parent, View view, int position, long id) {
            selectItem(position);
            return true;
          }
        });

    mStatusLabel = (TextView) findViewById(R.id.content_status_label);
    mStatusLabel.setVisibility(View.VISIBLE);

    String userHash = NavigineApp.Settings.getString("user_hash", "");
    if (userHash.length() == 0) showUserHashDialog();
    else refreshMapList();
  }
コード例 #8
0
ファイル: GpuSGX540.java プロジェクト: kshark27/Kernel-Tuner
  @Override
  public void onCreate(Bundle savedInstanceState) {
    c = this;
    preferences = PreferenceManager.getDefaultSharedPreferences(c);

    super.onCreate(savedInstanceState);

    setContentView(R.layout.gpu_sgx540);

    gpuCurrent = readFile(Constants.GPU_SGX540);
    seekGpu = (SeekBar) findViewById(R.id.seek_gpu);

    gpu = Arrays.asList(153, 307, 384);
    seekBar(gpu.size() - 1, gpu.indexOf(gpuCurrent));

    /*else{
    seekGpu.setEnabled(false);
    seekIva.setEnabled(false);
    TextView ns = (TextView)findViewById(R.id.not_supported);
    ns.setVisibility(View.VISIBLE);
    }*/
    preferences = PreferenceManager.getDefaultSharedPreferences(getBaseContext());

    curGpuTxt = (TextView) findViewById(R.id.current_gpu);
    maxGpuTxt = (TextView) findViewById(R.id.max_gpu);
    minGpuTxt = (TextView) findViewById(R.id.min_gpu);

    mhz = getResources().getString(R.string.mhz);
    current = getResources().getString(R.string.current);
    max = getResources().getString(R.string._max);
    min = getResources().getString(R.string._min);
    curGpuTxt.setText(current + ": " + (gpuCurrent) + mhz);
    maxGpuTxt.setText(max + ": " + gpu.get(2) + mhz);
    minGpuTxt.setText(min + ": " + gpu.get(0) + mhz);

    Button cancel = (Button) findViewById(R.id.cancel);
    cancel.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View arg0) {
            finish();
          }
        });
  }
コード例 #9
0
ファイル: Main.java プロジェクト: wbersaty/AndroidDev
  @Override
  public boolean onChildClick(
      ExpandableListView parent, View v, int groupPosition, int childPosition, long id) {
    // TODO Auto-generated method stub
    String s = "選擇:群組" + groupPosition + ", 選項" + childPosition + ", ID" + id;
    mTxtResult.setText(s);

    return super.onChildClick(parent, v, groupPosition, childPosition, id);
  }
コード例 #10
0
        @Override
        public void handleResponse(BackendlessCollection<SearchMatchesResult> response) {
          for (SearchMatchesResult geoPoint : response.getCurrentPage()) {

            if (geoPoint.getGeoPoint().equals(targetUserGeoPoint)) {
              travelMatchCount = geoPoint.getMatches();
              if (travelMatchCount <= 1) travelMatchCount = travelMatchCount * 100;
              travelMatchValue.setText(String.valueOf(round(travelMatchCount, 2)));
              travelProgressBar.setProgress((int) round(travelMatchCount, 2));
              travel = true;
            }
          }

          if (music == true && food == true && hobbies == true && travel == true) {
            summMatch =
                (foodMatchCount + musicMatchCount + hobbiesMatchCount + travelMatchCount) / 4;
            matchPercentField.setText(String.valueOf(round(summMatch, 2)));
            progressDialog.cancel();
          }
        }
コード例 #11
0
  private void updateLoader() {
    if (NavigineApp.Navigation == null) return;

    // Log.d(TAG, String.format(Locale.ENGLISH, "Update loader: %d", mLoader));

    long timeNow = DateTimeUtils.currentTimeMillis();
    if (mLoader < 0) return;

    int status = LocationLoader.checkLocationLoader(mLoader);
    if (status < 100) {
      if ((Math.abs(timeNow - mLoaderTime) > LOADER_TIMEOUT / 3 && status == 0)
          || (Math.abs(timeNow - mLoaderTime) > LOADER_TIMEOUT)) {
        mListView.setVisibility(View.GONE);
        mStatusLabel.setVisibility(View.VISIBLE);
        mStatusLabel.setText("Loading timeout!\nPlease, check your internet connection!");
        Log.d(TAG, String.format(Locale.ENGLISH, "Load stopped on timeout!"));
        LocationLoader.stopLocationLoader(mLoader);
        mLoader = -1;
      } else {
        mListView.setVisibility(View.GONE);
        mStatusLabel.setVisibility(View.VISIBLE);
        mStatusLabel.setText(String.format(Locale.ENGLISH, "Loading content (%d%%)", status));
      }
    } else {
      Log.d(TAG, String.format(Locale.ENGLISH, "Load finished with result: %d", status));
      LocationLoader.stopLocationLoader(mLoader);
      mLoader = -1;

      if (status == 100) {
        parseMapsXml();
        if (mInfoList.isEmpty()) {
          mListView.setVisibility(View.GONE);
          mStatusLabel.setVisibility(View.VISIBLE);
          mStatusLabel.setText("No locations available");
        } else {
          mListView.setVisibility(View.VISIBLE);
          mStatusLabel.setVisibility(View.GONE);
        }
      } else {
        mListView.setVisibility(View.GONE);
        mStatusLabel.setVisibility(View.VISIBLE);
        mStatusLabel.setText("Error loading!\nPlease, check your ID!");
      }
    }
  }
コード例 #12
0
 @Override
 protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
   if (requestCode == FILECHOOSER_RESULTCODE) { // found this from StackOverflow
     if (null == mUploadMessage) return;
     Uri result = intent == null || resultCode != RESULT_OK ? null : intent.getData();
     mUploadMessage.onReceiveValue(result);
     mUploadMessage = null;
   } else {
     // -----------I wrote this code below this line----------------------------------
     jpegData = intent.getExtras().getByteArray("image");
     Bitmap img = BitmapFactory.decodeByteArray(jpegData, 0, jpegData.length);
     Drawable d = new BitmapDrawable(img);
     profilePicture.setBackground(d);
   }
 }
コード例 #13
0
  @SuppressWarnings("deprecation")
  private void inflateTitleBar(ViewGroup view) {
    ViewStub stub = (ViewStub) view.findViewById(R.id.com_facebook_picker_title_bar_stub);
    if (stub != null) {
      View titleBar = stub.inflate();

      final RelativeLayout.LayoutParams layoutParams =
          new RelativeLayout.LayoutParams(
              RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT);
      layoutParams.addRule(RelativeLayout.BELOW, R.id.com_facebook_picker_title_bar);
      listView.setLayoutParams(layoutParams);

      if (titleBarBackground != null) {
        titleBar.setBackgroundDrawable(titleBarBackground);
      }

      doneButton = (Button) view.findViewById(R.id.com_facebook_picker_done_button);
      if (doneButton != null) {
        doneButton.setOnClickListener(
            new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                logAppEvents(true);
                appEventsLogged = true;

                if (onDoneButtonClickedListener != null) {
                  onDoneButtonClickedListener.onDoneButtonClicked(PickerFragment.this);
                }
              }
            });

        if (getDoneButtonText() != null) {
          doneButton.setText(getDoneButtonText());
        }

        if (doneButtonBackground != null) {
          doneButton.setBackgroundDrawable(doneButtonBackground);
        }
      }

      titleTextView = (TextView) view.findViewById(R.id.com_facebook_picker_title);
      if (titleTextView != null) {
        if (getTitleText() != null) {
          titleTextView.setText(getTitleText());
        }
      }
    }
  }
コード例 #14
0
  protected void populateGraphObjectView(View view, T graphObject) {
    String id = getIdOfGraphObject(graphObject);
    view.setTag(id);

    CharSequence title = getTitleOfGraphObject(graphObject);
    TextView titleView = (TextView) view.findViewById(R.id.com_facebook_picker_title);
    if (titleView != null) {
      titleView.setText(title, TextView.BufferType.SPANNABLE);
    }

    CharSequence subtitle = getSubTitleOfGraphObject(graphObject);
    TextView subtitleView = (TextView) view.findViewById(R.id.picker_subtitle);
    if (subtitleView != null) {
      if (subtitle != null) {
        subtitleView.setText(subtitle, TextView.BufferType.SPANNABLE);
        subtitleView.setVisibility(View.VISIBLE);
      } else {
        subtitleView.setVisibility(View.GONE);
      }
    }

    if (getShowCheckbox()) {
      CheckBox checkBox = (CheckBox) view.findViewById(R.id.com_facebook_picker_checkbox);
      updateCheckboxState(checkBox, isGraphObjectSelected(id));
    }

    if (getShowPicture()) {
      URI pictureURI = getPictureUriOfGraphObject(graphObject);

      if (pictureURI != null) {
        ImageView profilePic = (ImageView) view.findViewById(R.id.com_facebook_picker_image);

        // See if we have already pre-fetched this; if not, download it.
        if (prefetchedPictureCache.containsKey(id)) {
          ImageResponse response = prefetchedPictureCache.get(id);
          profilePic.setImageBitmap(response.getBitmap());
          profilePic.setTag(response.getRequest().getImageUri());
        } else {
          downloadProfilePicture(id, pictureURI, profilePic);
        }
      }
    }
  }
コード例 #15
0
 @Override
 public View getView(int position, View convertView, ViewGroup parent) {
   View v = convertView;
   if (v == null) {
     LayoutInflater vi =
         (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
     v = vi.inflate(R.layout.row, null);
   }
   Message m = items.get(position);
   // if (m != null) {
   m.createColorFromString(m.from);
   TextView tt = (TextView) v.findViewById(R.id.username);
   TextView bt = (TextView) v.findViewById(R.id.message);
   if (isMonospaced) {
     tt.setTypeface(Typeface.MONOSPACE);
     bt.setTypeface(Typeface.MONOSPACE);
   }
   tt.setText(m.getFrom());
   tt.setTextColor(m.color);
   bt.setText(m.getMessage());
   // }
   return v;
 }
コード例 #16
0
ファイル: GpsMainActivity.java プロジェクト: pari-m/gpslogger
  /**
   * Given a location fix, processes it and displays it in the table on the form.
   *
   * @param loc Location information
   */
  private void DisplayLocationInfo(Location loc) {
    Utilities.LogDebug("GpsMainActivity.DisplayLocationInfo");
    try {

      if (loc == null) {
        return;
      }

      TextView tvLatitude = (TextView) findViewById(R.id.txtLatitude);
      TextView tvLongitude = (TextView) findViewById(R.id.txtLongitude);
      TextView tvDateTime = (TextView) findViewById(R.id.txtDateTimeAndProvider);

      TextView tvAltitude = (TextView) findViewById(R.id.txtAltitude);

      TextView txtSpeed = (TextView) findViewById(R.id.txtSpeed);

      TextView txtSatellites = (TextView) findViewById(R.id.txtSatellites);
      TextView txtDirection = (TextView) findViewById(R.id.txtDirection);
      TextView txtAccuracy = (TextView) findViewById(R.id.txtAccuracy);
      String providerName = loc.getProvider();

      if (providerName.equalsIgnoreCase("gps")) {
        providerName = getString(R.string.providername_gps);
      } else {
        providerName = getString(R.string.providername_celltower);
      }

      tvDateTime.setText(
          new Date(Session.getLatestTimeStamp()).toLocaleString()
              + getString(R.string.providername_using, providerName));
      tvLatitude.setText(String.valueOf(loc.getLatitude()));
      tvLongitude.setText(String.valueOf(loc.getLongitude()));

      if (loc.hasAltitude()) {

        double altitude = loc.getAltitude();

        if (AppSettings.shouldUseImperial()) {
          tvAltitude.setText(
              String.valueOf(Utilities.MetersToFeet(altitude)) + getString(R.string.feet));
        } else {
          tvAltitude.setText(String.valueOf(altitude) + getString(R.string.meters));
        }

      } else {
        tvAltitude.setText(R.string.not_applicable);
      }

      if (loc.hasSpeed()) {

        float speed = loc.getSpeed();
        String unit;
        if (AppSettings.shouldUseImperial()) {
          if (speed > 1.47) {
            speed = speed * 0.6818f;
            unit = getString(R.string.miles_per_hour);

          } else {
            speed = Utilities.MetersToFeet(speed);
            unit = getString(R.string.feet_per_second);
          }
        } else {
          if (speed > 0.277) {
            speed = speed * 3.6f;
            unit = getString(R.string.kilometers_per_hour);
          } else {
            unit = getString(R.string.meters_per_second);
          }
        }

        txtSpeed.setText(String.valueOf(speed) + unit);

      } else {
        txtSpeed.setText(R.string.not_applicable);
      }

      if (loc.hasBearing()) {

        float bearingDegrees = loc.getBearing();
        String direction;

        direction = Utilities.GetBearingDescription(bearingDegrees, getApplicationContext());

        txtDirection.setText(
            direction
                + "("
                + String.valueOf(Math.round(bearingDegrees))
                + getString(R.string.degree_symbol)
                + ")");
      } else {
        txtDirection.setText(R.string.not_applicable);
      }

      if (!Session.isUsingGps()) {
        txtSatellites.setText(R.string.not_applicable);
        Session.setSatelliteCount(0);
      }

      if (loc.hasAccuracy()) {

        float accuracy = loc.getAccuracy();

        if (AppSettings.shouldUseImperial()) {
          txtAccuracy.setText(
              getString(
                  R.string.accuracy_within,
                  String.valueOf(Utilities.MetersToFeet(accuracy)),
                  getString(R.string.feet)));

        } else {
          txtAccuracy.setText(
              getString(
                  R.string.accuracy_within, String.valueOf(accuracy), getString(R.string.meters)));
        }

      } else {
        txtAccuracy.setText(R.string.not_applicable);
      }

    } catch (Exception ex) {
      SetStatus(getString(R.string.error_displaying, ex.getMessage()));
    }
  }
コード例 #17
0
ファイル: GpsMainActivity.java プロジェクト: pari-m/gpslogger
 /**
  * Sets the number of satellites in the satellite row in the table.
  *
  * @param number The number of satellites
  */
 private void SetSatelliteInfo(int number) {
   Session.setSatelliteCount(number);
   TextView txtSatellites = (TextView) findViewById(R.id.txtSatellites);
   txtSatellites.setText(String.valueOf(number));
 }
コード例 #18
0
ファイル: GpsMainActivity.java プロジェクト: pari-m/gpslogger
 /**
  * Sets the message in the top status label.
  *
  * @param message The status message
  */
 private void SetStatus(String message) {
   Utilities.LogDebug("GpsMainActivity.SetStatus: " + message);
   TextView tvStatus = (TextView) findViewById(R.id.textStatus);
   tvStatus.setText(message);
   Utilities.LogInfo(message);
 }
コード例 #19
0
ファイル: GpsMainActivity.java プロジェクト: pari-m/gpslogger
  /** Clears the table, removes all values. */
  public void ClearForm() {

    Utilities.LogDebug("GpsMainActivity.ClearForm");

    TextView tvLatitude = (TextView) findViewById(R.id.txtLatitude);
    TextView tvLongitude = (TextView) findViewById(R.id.txtLongitude);
    TextView tvDateTime = (TextView) findViewById(R.id.txtDateTimeAndProvider);

    TextView tvAltitude = (TextView) findViewById(R.id.txtAltitude);

    TextView txtSpeed = (TextView) findViewById(R.id.txtSpeed);

    TextView txtSatellites = (TextView) findViewById(R.id.txtSatellites);
    TextView txtDirection = (TextView) findViewById(R.id.txtDirection);
    TextView txtAccuracy = (TextView) findViewById(R.id.txtAccuracy);

    tvLatitude.setText("");
    tvLongitude.setText("");
    tvDateTime.setText("");
    tvAltitude.setText("");
    txtSpeed.setText("");
    txtSatellites.setText("");
    txtDirection.setText("");
    txtAccuracy.setText("");
  }
コード例 #20
0
ファイル: GpsMainActivity.java プロジェクト: pari-m/gpslogger
  /** Displays a human readable summary of the preferences chosen by the user on the main form */
  private void ShowPreferencesSummary() {
    Utilities.LogDebug("GpsMainActivity.ShowPreferencesSummary");
    try {
      TextView txtLoggingTo = (TextView) findViewById(R.id.txtLoggingTo);
      TextView txtFrequency = (TextView) findViewById(R.id.txtFrequency);
      TextView txtDistance = (TextView) findViewById(R.id.txtDistance);
      TextView txtAutoEmail = (TextView) findViewById(R.id.txtAutoEmail);

      if (!AppSettings.shouldLogToKml() && !AppSettings.shouldLogToGpx()) {
        txtLoggingTo.setText(R.string.summary_loggingto_screen);

      } else if (AppSettings.shouldLogToGpx() && AppSettings.shouldLogToKml()) {
        txtLoggingTo.setText(R.string.summary_loggingto_both);
      } else {
        txtLoggingTo.setText((AppSettings.shouldLogToGpx() ? "GPX" : "KML"));
      }

      if (AppSettings.getMinimumSeconds() > 0) {
        String descriptiveTime =
            Utilities.GetDescriptiveTimeString(
                AppSettings.getMinimumSeconds(), getApplicationContext());

        txtFrequency.setText(descriptiveTime);
      } else {
        txtFrequency.setText(R.string.summary_freq_max);
      }

      if (AppSettings.getMinimumDistanceInMeters() > 0) {
        if (AppSettings.shouldUseImperial()) {
          int minimumDistanceInFeet =
              Utilities.MetersToFeet(AppSettings.getMinimumDistanceInMeters());
          txtDistance.setText(
              ((minimumDistanceInFeet == 1)
                  ? getString(R.string.foot)
                  : String.valueOf(minimumDistanceInFeet) + getString(R.string.feet)));
        } else {
          txtDistance.setText(
              ((AppSettings.getMinimumDistanceInMeters() == 1)
                  ? getString(R.string.meter)
                  : String.valueOf(AppSettings.getMinimumDistanceInMeters())
                      + getString(R.string.meters)));
        }
      } else {
        txtDistance.setText(R.string.summary_dist_regardless);
      }

      if (AppSettings.isAutoEmailEnabled()) {
        String autoEmailResx;

        if (AppSettings.getAutoEmailDelay() == 0) {
          autoEmailResx = "autoemail_frequency_whenistop";
        } else {

          autoEmailResx =
              "autoemail_frequency_"
                  + String.valueOf(AppSettings.getAutoEmailDelay()).replace(".", "");
        }

        String autoEmailDesc =
            getString(getResources().getIdentifier(autoEmailResx, "string", getPackageName()));

        txtAutoEmail.setText(autoEmailDesc);
      } else {
        TableRow trAutoEmail = (TableRow) findViewById(R.id.trAutoEmail);
        trAutoEmail.setVisibility(View.INVISIBLE);
      }

      onFileName(Session.getCurrentFileName());
    } catch (Exception ex) {
      Utilities.LogError("ShowPreferencesSummary", ex);
    }
  }
コード例 #21
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.matchview);

    progressDialog = UIFactory.getDefaultProgressDialog(this);

    TextView nameField = (TextView) findViewById(R.id.nameField);
    TextView genderField = (TextView) findViewById(R.id.genderField);
    TextView ageField = (TextView) findViewById(R.id.ageField);
    ImageView avatarImage = (ImageView) findViewById(R.id.avatarImage);
    ImageView genderImage = (ImageView) findViewById(R.id.genderImage);
    matchPercentField = (TextView) findViewById(R.id.matchPercents);
    foodMatchValue = (TextView) findViewById(R.id.foodMatchValue);
    foodProgressBar = (ProgressBar) findViewById(R.id.foodProgressBar);
    musicMatchValue = (TextView) findViewById(R.id.musicMatchValue);
    musicProgressBar = (ProgressBar) findViewById(R.id.musicProgressBar);
    hobbiesMatchValue = (TextView) findViewById(R.id.hobbiesMatchValue);
    hobbiesProgressBar = (ProgressBar) findViewById(R.id.hobbiesProgressBar);
    travelMatchValue = (TextView) findViewById(R.id.travelMatchValue);
    travelProgressBar = (ProgressBar) findViewById(R.id.travelProgressBar);

    currentUserGeoPoint =
        (GeoPoint) getIntent().getSerializableExtra(Defaults.CURRENT_USER_GEO_POINT_BUNDLE_TAG);
    targetUserGeoPoint =
        (GeoPoint) getIntent().getSerializableExtra(Defaults.TARGET_USER_GEO_POINT_BUNDLE_TAG);
    triger = getIntent().getStringExtra(Defaults.TRIGER);

    String targetUserEmail = targetUserGeoPoint.getMetadata(BackendlessUser.EMAIL_KEY);
    targetUserName = targetUserGeoPoint.getMetadata(Defaults.NAME_PROPERTY);
    Gender targetUserGender =
        Gender.valueOf(targetUserGeoPoint.getMetadata(Defaults.GENDER_PROPERTY));
    targetUserDeviceRegistrationId =
        targetUserGeoPoint.getMetadata(Defaults.DEVICE_REGISTRATION_ID_PROPERTY);

    Date userBirthDate;
    try {
      userBirthDate =
          Defaults.DEFAULT_DATE_FORMATTER.parse(
              targetUserGeoPoint.getMetadata(Defaults.BIRTH_DATE_PROPERTY));
    } catch (ParseException e) {
      progressDialog.cancel();
      Log.logLine(e);

      return;
    }

    Button actionButton = (Button) findViewById(R.id.actionButton);

    if (!targetUserGeoPoint
            .getMetadata()
            .containsKey(Backendless.UserService.CurrentUser().getEmail())
        || !currentUserGeoPoint.getMetadata().containsKey(targetUserEmail)) {
      actionButton.setText(getResources().getText(R.string.button_match_ping));
      actionButton.setOnClickListener(pingUserListener);
    } else {
      actionButton.setText(getResources().getText(R.string.button_sendmessage));
      actionButton.setOnClickListener(sendMessageListener);
    }

    nameField.setText(targetUserName);
    genderField.setText(targetUserGender.name());

    if (targetUserGender == Gender.male) {
      avatarImage.setImageDrawable(getResources().getDrawable(R.drawable.avatar_default_male));
      genderImage.setImageDrawable(getResources().getDrawable(R.drawable.icon_male));
    } else {
      avatarImage.setImageDrawable(getResources().getDrawable(R.drawable.avatar_default_female));
      genderImage.setImageDrawable(getResources().getDrawable(R.drawable.icon_female));
    }

    ageField.setText(String.valueOf(SimpleMath.getAgeFromDate(userBirthDate)));

    // Food
    Map<String, String> metaDataFood = new HashMap<String, String>();
    metaDataFood.put("Asian", foodName);
    metaDataFood.put("Caribean", foodName);
    metaDataFood.put("Bar food", foodName);
    metaDataFood.put("French", foodName);
    metaDataFood.put("Mediterranean", foodName);
    metaDataFood.put("Greek", foodName);
    metaDataFood.put("Spanish", foodName);
    metaDataFood.put("Mexican", foodName);
    metaDataFood.put("Thai", foodName);
    int maxPoints = 10;
    BackendlessGeoQuery backendlessGeoQuery = new BackendlessGeoQuery(metaDataFood, maxPoints);
    backendlessGeoQuery.setPageSize(50);
    backendlessGeoQuery.setIncludeMeta(true);
    food = false;
    Backendless.Geo.relativeFind(backendlessGeoQuery, gotFoodCallback);
    // Music
    Map<String, String> metaDataMusic = new HashMap<String, String>();
    metaDataMusic.put("Classical", musicName);
    metaDataMusic.put("Jazz", musicName);
    metaDataMusic.put("Hip-hop", musicName);
    metaDataMusic.put("Reggae", musicName);
    metaDataMusic.put("Blues", musicName);
    metaDataMusic.put("Trance", musicName);
    metaDataMusic.put("House", musicName);
    metaDataMusic.put("Rock", musicName);
    metaDataMusic.put("Folk", musicName);
    backendlessGeoQuery = new BackendlessGeoQuery(metaDataMusic, maxPoints);
    backendlessGeoQuery.setPageSize(50);
    backendlessGeoQuery.setIncludeMeta(true);
    music = false;
    Backendless.Geo.relativeFind(backendlessGeoQuery, gotMusicCallback);
    // Hobbies
    Map<String, String> metaDataHobbies = new HashMap<String, String>();
    metaDataHobbies.put("Fishing", hobbiesName);
    metaDataHobbies.put("Diving", hobbiesName);
    metaDataHobbies.put("Rock climbing", hobbiesName);
    metaDataHobbies.put("Hiking", hobbiesName);
    metaDataHobbies.put("Reading", hobbiesName);
    metaDataHobbies.put("Dancing", hobbiesName);
    metaDataHobbies.put("Cooking", hobbiesName);
    metaDataHobbies.put("Surfing", hobbiesName);
    metaDataHobbies.put("Photography", hobbiesName);
    backendlessGeoQuery = new BackendlessGeoQuery(metaDataHobbies, maxPoints);
    backendlessGeoQuery.setPageSize(50);
    backendlessGeoQuery.setIncludeMeta(true);
    hobbies = false;
    Backendless.Geo.relativeFind(backendlessGeoQuery, gotHobbiesCallback);
    // Travel
    Map<String, String> metaDataTravel = new HashMap<String, String>();
    metaDataTravel.put("Cruise", travelName);
    metaDataTravel.put("B&B", travelName);
    metaDataTravel.put("Europe", travelName);
    metaDataTravel.put("Asia", travelName);
    metaDataTravel.put("Caribean", travelName);
    metaDataTravel.put("Mountains", travelName);
    metaDataTravel.put("Whale watching", travelName);
    metaDataTravel.put("Active travel", travelName);
    metaDataTravel.put("Passive travel", travelName);
    backendlessGeoQuery = new BackendlessGeoQuery(metaDataTravel, maxPoints);
    backendlessGeoQuery.setPageSize(50);
    backendlessGeoQuery.setIncludeMeta(true);
    travel = false;
    Backendless.Geo.relativeFind(backendlessGeoQuery, gotTravelCallback);
  }
コード例 #22
0
    @Override
    public View getView(final int position, View convertView, ViewGroup parent) {
      View view = convertView;
      if (view == null) {
        LayoutInflater inflater =
            (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        view = inflater.inflate(R.layout.content_list_item, null);
      }
      TextView titleTextView = (TextView) view.findViewById(R.id.list_item_title);
      TextView stateTextView = (TextView) view.findViewById(R.id.list_item_state);
      TextView downTextView = (TextView) view.findViewById(R.id.list_item_downbar);
      Button downloadButton = (Button) view.findViewById(R.id.list_item_download_button);
      Button uploadButton = (Button) view.findViewById(R.id.list_item_upload_button);

      LocationInfo info = mInfoList.get(position);
      String titleText = info.title;
      String stateText = "";

      if (titleText.length() > 30) titleText = titleText.substring(0, 28) + "...";

      synchronized (mLoaderMap) {
        if (mLoaderMap.containsKey(info.title)) {
          LoaderState loader = mLoaderMap.get(info.title);
          if (loader.state < 100) stateText = String.format(Locale.ENGLISH, "%d%%", loader.state);
          else if (loader.state == 100) stateText = String.format(Locale.ENGLISH, "Done!");
          else stateText = String.format(Locale.ENGLISH, "Failed!");
        }
      }

      if (info.localVersion < 0) titleText += " (?)";
      else {
        if (info.localModified)
          titleText += String.format(Locale.ENGLISH, " (v. %d+)", info.localVersion);
        else titleText += String.format(Locale.ENGLISH, " (v. %d)", info.localVersion);
      }

      String mapFile = NavigineApp.Settings.getString("map_file", "");
      if (mapFile.equals(info.archiveFile)) {
        titleTextView.setTypeface(null, Typeface.BOLD);
        view.setBackgroundColor(Color.parseColor("#590E0E"));
      } else {
        titleTextView.setTypeface(null, Typeface.NORMAL);
        view.setBackgroundColor(Color.BLACK);
      }

      titleTextView.setText(titleText);
      stateTextView.setText(stateText);

      if (info.localModified) {
        downloadButton.setVisibility(View.GONE);
        uploadButton.setVisibility(View.VISIBLE);
        downTextView.setText("Version is modified. Upload?");
      } else if (info.serverVersion > info.localVersion) {
        downloadButton.setVisibility(View.VISIBLE);
        uploadButton.setVisibility(View.GONE);
        String downText =
            String.format(Locale.ENGLISH, "Version available: %d", info.serverVersion);
        downTextView.setText(downText);
      } else {
        downloadButton.setVisibility(View.INVISIBLE);
        uploadButton.setVisibility(View.GONE);
        downTextView.setText("Version is up to date");
      }

      downloadButton.setOnClickListener(
          new View.OnClickListener() {
            @Override
            public void onClick(View v) {
              startDownload(position);
            }
          });

      uploadButton.setOnClickListener(
          new View.OnClickListener() {
            @Override
            public void onClick(View v) {
              startUpload(position);
            }
          });

      return view;
    }
コード例 #23
0
 @Override
 public BasicElement getElement(final Environment env, final ElementMap item) {
   this.env = env;
   this.elementMaps.push(item);
   final ElementMap elementMap = this.elementMaps.peek();
   final String id = "popup";
   final PopupElement element = new PopupElement();
   element.onCheckOut();
   element.setElementMap(elementMap);
   if (elementMap != null && id != null) {
     elementMap.add(id, element);
   }
   element.setAlign(Alignment9.NORTH_EAST);
   element.setHotSpotPosition(Alignment9.SOUTH_WEST);
   element.setHideOnClick(false);
   element.onAttributesInitialized();
   final StaticLayoutData element2 = new StaticLayoutData();
   element2.onCheckOut();
   element2.setElementMap(elementMap);
   element2.setSize(new Dimension(-2, -2));
   element.addBasicElement(element2);
   element2.onAttributesInitialized();
   element2.onChildrenAdded();
   final Container checkOut = Container.checkOut();
   checkOut.setElementMap(elementMap);
   element.addBasicElement(checkOut);
   checkOut.onAttributesInitialized();
   final StaticLayout element3 = new StaticLayout();
   element3.onCheckOut();
   element3.setAdaptToContentSize(true);
   checkOut.addBasicElement(element3);
   element3.onAttributesInitialized();
   element3.onChildrenAdded();
   final String id2 = "container";
   final Container checkOut2 = Container.checkOut();
   checkOut2.setElementMap(elementMap);
   if (elementMap != null && id2 != null) {
     elementMap.add(id2, checkOut2);
   }
   checkOut2.setStyle("chatBubble");
   checkOut.addBasicElement(checkOut2);
   checkOut2.onAttributesInitialized();
   final StaticLayoutData element4 = new StaticLayoutData();
   element4.onCheckOut();
   element4.setElementMap(elementMap);
   element4.setSize(new Dimension(100.0f, 100.0f));
   checkOut2.addBasicElement(element4);
   element4.onAttributesInitialized();
   element4.onChildrenAdded();
   final DecoratorAppearance appearance = checkOut2.getAppearance();
   appearance.setElementMap(elementMap);
   checkOut2.addBasicElement(appearance);
   appearance.onAttributesInitialized();
   final Margin checkOut3 = Margin.checkOut();
   checkOut3.setElementMap(elementMap);
   checkOut3.setInsets(new Insets(0, 0, 15, 0));
   appearance.addBasicElement(checkOut3);
   checkOut3.onAttributesInitialized();
   checkOut3.onChildrenAdded();
   final Padding element5 = new Padding();
   element5.onCheckOut();
   element5.setElementMap(elementMap);
   element5.setInsets(new Insets(10, 15, 10, 15));
   appearance.addBasicElement(element5);
   element5.onAttributesInitialized();
   element5.onChildrenAdded();
   appearance.onChildrenAdded();
   final TextView element6 = new TextView();
   element6.onCheckOut();
   element6.setElementMap(elementMap);
   element6.setStyle("smallboldMap");
   element6.setMinWidth(1);
   element6.setMaxWidth(200);
   checkOut2.addBasicElement(element6);
   element6.onAttributesInitialized();
   final PropertyElement checkOut4 = PropertyElement.checkOut();
   checkOut4.setElementMap(elementMap);
   checkOut4.setName("mapPopupDescription");
   checkOut4.setAttribute("text");
   element6.addBasicElement(checkOut4);
   checkOut4.onAttributesInitialized();
   checkOut4.onChildrenAdded();
   final PropertyElement checkOut5 = PropertyElement.checkOut();
   checkOut5.setElementMap(elementMap);
   checkOut5.setName("mapPopupIsEditing");
   checkOut5.setAttribute("visible");
   element6.addBasicElement(checkOut5);
   checkOut5.onAttributesInitialized();
   final ConditionResult element7 = new ConditionResult();
   element7.onCheckOut();
   element7.setElementMap(elementMap);
   checkOut5.addBasicElement(element7);
   element7.onAttributesInitialized();
   final FalseCondition element8 = new FalseCondition();
   element8.onCheckOut();
   element8.setElementMap(elementMap);
   element7.addBasicElement(element8);
   element8.onAttributesInitialized();
   element8.onChildrenAdded();
   element7.onChildrenAdded();
   checkOut5.onChildrenAdded();
   element6.onChildrenAdded();
   final String id3 = "textEditor";
   final TextEditor textEditor = new TextEditor();
   textEditor.onCheckOut();
   textEditor.setElementMap(elementMap);
   if (elementMap != null && id3 != null) {
     elementMap.add(id3, textEditor);
   }
   textEditor.setStyle("withoutBorder");
   textEditor.setMaxChars(200);
   textEditor.setMinWidth(200);
   textEditor.setMaxWidth(200);
   final KeyTypedListener onKeyType = new KeyTypedListener();
   onKeyType.setCallBackFunc("wakfu.map:onTextEditorChange");
   textEditor.setOnKeyType(onKeyType);
   final KeyPressedListener onKeyPress = new KeyPressedListener();
   onKeyPress.setCallBackFunc("wakfu.map:onTextEditorKeyPress");
   textEditor.setOnKeyPress(onKeyPress);
   textEditor.setFocusable(true);
   textEditor.setSelectOnFocus(true);
   checkOut2.addBasicElement(textEditor);
   textEditor.onAttributesInitialized();
   final PropertyElement checkOut6 = PropertyElement.checkOut();
   checkOut6.setElementMap(elementMap);
   checkOut6.setName("mapPopupDescription");
   checkOut6.setAttribute("text");
   textEditor.addBasicElement(checkOut6);
   checkOut6.onAttributesInitialized();
   checkOut6.onChildrenAdded();
   final PropertyElement checkOut7 = PropertyElement.checkOut();
   checkOut7.setElementMap(elementMap);
   checkOut7.setName("mapPopupIsEditing");
   checkOut7.setAttribute("visible");
   textEditor.addBasicElement(checkOut7);
   checkOut7.onAttributesInitialized();
   checkOut7.onChildrenAdded();
   final PropertyElement checkOut8 = PropertyElement.checkOut();
   checkOut8.setElementMap(elementMap);
   checkOut8.setName("mapPopupIsEditing");
   checkOut8.setAttribute("focused");
   textEditor.addBasicElement(checkOut8);
   checkOut8.onAttributesInitialized();
   checkOut8.onChildrenAdded();
   textEditor.onChildrenAdded();
   final String id4 = "valid";
   final Button button = new Button();
   button.onCheckOut();
   button.setElementMap(elementMap);
   if (elementMap != null && id4 != null) {
     elementMap.add(id4, button);
   }
   button.setStyle("smallValid");
   final MouseClickedListener onClick = new MouseClickedListener();
   onClick.setCallBackFunc("wakfu.map:applyNote");
   button.setOnClick(onClick);
   checkOut2.addBasicElement(button);
   button.onAttributesInitialized();
   final PropertyElement checkOut9 = PropertyElement.checkOut();
   checkOut9.setElementMap(elementMap);
   checkOut9.setName("mapPopupIsEditing");
   checkOut9.setAttribute("visible");
   button.addBasicElement(checkOut9);
   checkOut9.onAttributesInitialized();
   checkOut9.onChildrenAdded();
   button.onChildrenAdded();
   checkOut2.onChildrenAdded();
   final String id5 = "image";
   final Image image = new Image();
   image.onCheckOut();
   image.setElementMap(elementMap);
   if (elementMap != null && id5 != null) {
     elementMap.add(id5, image);
   }
   image.setStyle("BubbleArrowLeft");
   image.setNonBlocking(true);
   checkOut.addBasicElement(image);
   image.onAttributesInitialized();
   final StaticLayoutData element9 = new StaticLayoutData();
   element9.onCheckOut();
   element9.setElementMap(elementMap);
   element9.setAlign(Alignment17.SOUTH_WEST);
   element9.setSize(new Dimension(-2, -2));
   image.addBasicElement(element9);
   element9.onAttributesInitialized();
   element9.onChildrenAdded();
   image.onChildrenAdded();
   checkOut.onChildrenAdded();
   element.onChildrenAdded();
   return element;
 }