コード例 #1
0
        @Override
        public void handleMessage(final Message msg) {
          try {
            if (waypoint == null) {
              Log.d("No waypoint loaded to edit. id= " + waypointId);
              waypointId = -1;
            } else {
              geocode = waypoint.getGeocode();
              prefix = waypoint.getPrefix();
              lookup = waypoint.getLookup();
              own = waypoint.isUserDefined();

              if (initViews) {
                visitedCheckBox.setChecked(waypoint.isVisited());
                if (waypoint.getCoords() != null) {
                  buttonLat.setText(
                      waypoint.getCoords().format(GeopointFormatter.Format.LAT_DECMINUTE));
                  buttonLon.setText(
                      waypoint.getCoords().format(GeopointFormatter.Format.LON_DECMINUTE));
                }
                waypointName.setText(
                    Html.fromHtml(StringUtils.trimToEmpty(waypoint.getName())).toString());
                Dialogs.moveCursorToEnd(waypointName);
                if (TextUtils.containsHtml(waypoint.getNote())) {
                  note.setText(
                      Html.fromHtml(StringUtils.trimToEmpty(waypoint.getNote())).toString());
                } else {
                  note.setText(StringUtils.trimToEmpty(waypoint.getNote()));
                }
                Dialogs.moveCursorToEnd(note);
              }
              new AsyncTask<Void, Void, Geocache>() {
                @Override
                protected Geocache doInBackground(final Void... params) {
                  return DataStore.loadCache(geocode, LoadFlags.LOAD_CACHE_ONLY);
                }

                @Override
                protected void onPostExecute(final Geocache cache) {
                  setCoordsModificationVisibility(ConnectorFactory.getConnector(geocode), cache);
                }
              }.execute();
            }

            if (own) {
              initializeWaypointTypeSelector();
            }
          } catch (final RuntimeException e) {
            Log.e("EditWaypointActivity.loadWaypointHandler", e);
          } finally {
            if (waitDialog != null) {
              waitDialog.dismiss();
              waitDialog = null;
            }
          }
        }
コード例 #2
0
ファイル: MainActivity.java プロジェクト: happyhugo/cgeo
 private void checkShowChangelog() {
   final long lastChecksum = Settings.getLastChangelogChecksum();
   final long checksum =
       TextUtils.checksum(
           getString(R.string.changelog_master) + getString(R.string.changelog_release));
   Settings.setLastChangelogChecksum(checksum);
   // don't show change log after new install...
   if (lastChecksum > 0 && lastChecksum != checksum) {
     AboutActivity.showChangeLog(this);
   }
 }