コード例 #1
0
        @Override
        public void handleMessage(Message msg) {
          switch (msg.what) {
            case 1:
              {
                // Broadcast to all clients the new value.
                final int N = mCallbacks.beginBroadcast();
                for (int i = 0; i < N; i++) {
                  try {
                    final Location loc = (Location) msg.obj;
                    Ut.dd("mCallbacks.getBroadcastItem(i).newPointWrited");
                    mCallbacks
                        .getBroadcastItem(i)
                        .newPointWrited(loc.getLatitude(), loc.getLongitude());
                  } catch (RemoteException e) {
                    // The RemoteCallbackList will take care of removing
                    // the dead object for us.
                    Ut.dd("RemoteException: The RemoteCallbackList will take care of removing");
                  }
                }
                mCallbacks.finishBroadcast();

                // sendMessageDelayed(obtainMessage(1), 1*1000);
              }
              break;
            default:
              super.handleMessage(msg);
          }
        }
コード例 #2
0
 public synchronized void Commit() {
   final LinkedHashMap<String, Bitmap> tmp = this.mHardCachedTiles;
   this.mHardCachedTiles = this.mHardCachedTiles2;
   this.mHardCachedTiles2 = tmp;
   this.mHardCachedTiles2.clear();
   Ut.w("mHardCachedTiles size = " + this.mHardCachedTiles.size());
 }
コード例 #3
0
 public synchronized Bitmap getMapTile(final String aTileURLString) {
   final Bitmap bmpHard = this.mHardCachedTiles.get(aTileURLString);
   if (bmpHard != null) {
     if (!bmpHard.isRecycled()) {
       this.mHardCachedTiles2.put(aTileURLString, bmpHard);
       return bmpHard;
     }
   }
   final SoftReference<Bitmap> ref = this.mCachedTiles.get(aTileURLString);
   if (ref == null) return null;
   final Bitmap bmp = ref.get();
   if (bmp == null) {
     Ut.w("EMPTY SoftReference");
     this.mCachedTiles.remove(ref);
   } else if (bmp.isRecycled()) {
     this.mCachedTiles.remove(ref);
   }
   this.mHardCachedTiles2.put(aTileURLString, bmp);
   return bmp;
 }
コード例 #4
0
  @Override
  public void onCreate() {
    super.onCreate();

    final File folder = Ut.getRMapsMainDir(this, "data");
    if (folder.canRead()) {
      try {
        db =
            new DatabaseHelper(this, folder.getAbsolutePath() + "/writedtrack.db")
                .getWritableDatabase();
      } catch (Exception e) {
        db = null;
      }
    }
    ;

    if (db == null) {
      Toast.makeText(
              this,
              getString(R.string.message_cantstarttrackwriter) + " " + folder.getAbsolutePath(),
              Toast.LENGTH_LONG)
          .show();
      this.stopSelf();
      return;
    }
    ;

    mNM = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);

    mLocationListener = new SampleLocationListener();
    final SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(this);
    mLocationListener.Init(
        Integer.parseInt(pref.getString("pref_trackwriter_mintime", "2000")),
        Integer.parseInt(pref.getString("pref_trackwriter_mindistance", "10")));
    final int minTime = 1000;
    final int minDistance = 1;
    getLocationManager().requestLocationUpdates(GPS, minTime, minDistance, this.mLocationListener);

    showNotification();
    // mHandler.sendEmptyMessage(1) ;
  }
コード例 #5
0
 public synchronized void putTile(final String aTileURLString, final Bitmap aTile) {
   this.mCachedTiles.put(aTileURLString, new SoftReference<Bitmap>(aTile));
   this.mHardCachedTiles2.put(aTileURLString, aTile);
   Ut.w("OpenStreetMapTileCache size = " + this.mCachedTiles.size());
 }
コード例 #6
0
 public void Init(int mintime, int mindistance) {
   mMinTime = mintime;
   mMinDistance = mindistance;
   Ut.dd("mintime=" + mintime + " mindistance=" + mindistance);
 }