コード例 #1
0
ファイル: OkapiClientTest.java プロジェクト: sababys/cgeo
 public static void testShortDescription() {
   final String geoCode = "OC10C06";
   final Geocache cache = OkapiClient.getCache(geoCode);
   assert cache != null; // eclipse null analysis
   assertThat(cache.getShortDescription())
       .isEqualTo("Nur in der fünften Jahreszeit kann er sprechen");
 }
コード例 #2
0
ファイル: OkapiClientTest.java プロジェクト: sababys/cgeo
 public static void testGetAllLogs() {
   final String geoCode = "OC10CB8";
   final Geocache cache = OkapiClient.getCache(geoCode);
   final int defaultLogCount = 10;
   assert cache != null; // eclipse null analysis
   assertThat(cache.getLogs().size()).isGreaterThan(defaultLogCount);
 }
コード例 #3
0
ファイル: OkapiClientTest.java プロジェクト: sababys/cgeo
  public static void testOCWillAttendLogs() {
    final String geoCode = "OC6465";

    removeCacheCompletely(geoCode);
    final Geocache cache = OkapiClient.getCache(geoCode);
    assertThat(cache).as("Cache from OKAPI").isNotNull();
    assert cache != null; // eclipse null analysis
    assertThat(cache.getLogCounts().get(LogType.WILL_ATTEND)).isGreaterThan(0);
  }
コード例 #4
0
ファイル: OkapiClientTest.java プロジェクト: sababys/cgeo
 public static void testOCSearchMustWorkWithoutOAuthAccessTokens() {
   final String geoCode = "OC1234";
   final Geocache cache = OkapiClient.getCache(geoCode);
   assertThat(cache)
       .overridingErrorMessage(
           "You must have a valid OKAPI key installed for running this test (but you do not need to set credentials in the app).")
       .isNotNull();
   assert cache != null; // eclipse null analysis
   assertThat(cache.getName()).isEqualTo("Wupper-Schein");
 }
コード例 #5
0
ファイル: LogCacheActivity.java プロジェクト: pstorch/cgeo
 private void setDefaultValues() {
   date = Calendar.getInstance();
   rating = GCVote.NO_RATING;
   typeSelected = cache.getDefaultLogType();
   // it this is an attended event log, use the event date by default instead of the current date
   if (cache.isEventCache()
       && CalendarUtils.isPastEvent(cache)
       && typeSelected == LogType.ATTENDED) {
     date.setTime(cache.getHiddenDate());
   }
   text = null;
   image = Image.NONE;
 }
コード例 #6
0
ファイル: OkapiClientTest.java プロジェクト: sababys/cgeo
  public static void testOCCacheWithWaypoints() {
    final String geoCode = "OCDDD2";
    removeCacheCompletely(geoCode);
    Geocache cache = OkapiClient.getCache(geoCode);
    assertThat(cache).as("Cache from OKAPI").isNotNull();
    // cache should be stored to DB (to listID 0) when loaded above
    cache = DataStore.loadCache(geoCode, LoadFlags.LOAD_ALL_DB_ONLY);
    assert cache != null;
    assertThat(cache).isNotNull();
    assertThat(cache.getWaypoints()).hasSize(3);

    // load again
    cache.refreshSynchronous(null);
    assertThat(cache.getWaypoints()).hasSize(3);
  }
コード例 #7
0
  private void addWaypoints(final SubMenu subMenu) {
    subMenu.clear();
    for (final Waypoint waypoint : geocache.getWaypoints()) {
      if (waypoint.getCoords() != null) {
        subMenu
            .add(Menu.NONE, waypoint.getId(), Menu.NONE, waypoint.getName())
            .setOnMenuItemClickListener(
                new OnMenuItemClickListener() {

                  @Override
                  public boolean onMenuItemClick(final MenuItem item) {
                    callback.onWaypointSelected(waypoint);
                    return true;
                  }
                });
      }
    }
    subMenu
        .add(Menu.NONE, Menu.NONE, Menu.NONE, getContext().getString(R.string.cache))
        .setOnMenuItemClickListener(
            new OnMenuItemClickListener() {

              @Override
              public boolean onMenuItemClick(final MenuItem item) {
                callback.onGeocacheSelected(geocache);
                return true;
              }
            });
  }
コード例 #8
0
ファイル: GCVoteRatingBarUtil.java プロジェクト: sababys/cgeo
  public static void initializeRatingBar(
      @NonNull final Geocache cache,
      final View parentView,
      @Nullable final OnRatingChangeListener changeListener) {
    if (GCVote.isVotingPossible(cache)) {
      final RatingBar ratingBar = ButterKnife.findById(parentView, R.id.gcvoteRating);
      final TextView label = ButterKnife.findById(parentView, R.id.gcvoteLabel);
      ratingBar.setVisibility(View.VISIBLE);
      label.setVisibility(View.VISIBLE);
      ratingBar.setOnRatingBarChangeListener(
          new OnRatingBarChangeListener() {

            @Override
            public void onRatingChanged(
                final RatingBar ratingBar, final float stars, final boolean fromUser) {
              // 0.5 is not a valid rating, therefore we must limit
              final float rating = GCVote.isValidRating(stars) ? stars : 0;
              if (rating < stars) {
                ratingBar.setRating(rating);
              }
              label.setText(GCVote.getDescription(rating));
              if (changeListener != null) {
                changeListener.onRatingChanged(rating);
              }
            }
          });
      ratingBar.setRating(cache.getMyVote());
    }
  }
コード例 #9
0
ファイル: LogCacheActivity.java プロジェクト: pstorch/cgeo
 private void updateLogPasswordBox(final LogType type) {
   if (type == LogType.FOUND_IT && cache.isLogPasswordRequired()) {
     logPasswordBox.setVisibility(View.VISIBLE);
   } else {
     logPasswordBox.setVisibility(View.GONE);
   }
 }
コード例 #10
0
 private static boolean hasTargets(final Geocache cache) {
   for (final Waypoint waypoint : cache.getWaypoints()) {
     if (waypoint.getCoords() != null) {
       return true;
     }
   }
   return false;
 }
コード例 #11
0
ファイル: OkapiClientTest.java プロジェクト: sababys/cgeo
 public static void testGetOCCache() {
   final String geoCode = "OU0331";
   Geocache cache = OkapiClient.getCache(geoCode);
   assertThat(cache).as("Cache from OKAPI").isNotNull();
   assert cache != null; // eclipse null analysis
   assertThat(cache.getGeocode()).isEqualTo(geoCode);
   assertThat(cache.getName()).isEqualTo("Oshkosh Municipal Tank");
   assertThat(cache.isDetailed()).isTrue();
   // cache should be stored to DB (to listID 0) when loaded above
   cache = DataStore.loadCache(geoCode, LoadFlags.LOAD_ALL_DB_ONLY);
   assert cache != null;
   assertThat(cache).isNotNull();
   assertThat(cache.getGeocode()).isEqualTo(geoCode);
   assertThat(cache.getName()).isEqualTo("Oshkosh Municipal Tank");
   assertThat(cache.isDetailed()).isTrue();
   assertThat(cache.getOwnerDisplayName()).isNotEmpty();
   assertThat(cache.getOwnerUserId()).isEqualTo(cache.getOwnerDisplayName());
 }
コード例 #12
0
ファイル: LogCacheActivity.java プロジェクト: pstorch/cgeo
 @Override
 public boolean onCreateOptionsMenu(final Menu menu) {
   super.onCreateOptionsMenu(menu);
   menu.findItem(R.id.menu_image).setVisible(cache.supportsLogImages());
   menu.findItem(R.id.save).setVisible(true);
   menu.findItem(R.id.clear).setVisible(true);
   presentShowcase();
   return true;
 }
コード例 #13
0
ファイル: LogCacheActivity.java プロジェクト: pstorch/cgeo
  private void saveLog(final boolean force) {
    final String log = currentLogText();

    // Do not erase the saved log if the user has removed all the characters
    // without using "Clear". This may be a manipulation mistake, and erasing
    // again will be easy using "Clear" while retyping the text may not be.
    if (force || (StringUtils.isNotEmpty(log) && !StringUtils.equals(log, text))) {
      cache.logOffline(this, log, date, typeSelected);
      Settings.setLastCacheLog(log);
    }
    text = log;
  }
コード例 #14
0
  public static void testDownloadStaticMaps() {
    final double lat = 52.354176d;
    final double lon = 9.745685d;
    String geocode = "GCTEST1";

    boolean backupStore = Settings.isStoreOfflineMaps();
    boolean backupStoreWP = Settings.isStoreOfflineWpMaps();
    TestSettings.setStoreOfflineMaps(true);
    TestSettings.setStoreOfflineWpMaps(true);
    try {
      Geopoint gp = new Geopoint(lat + 0.25d, lon + 0.25d);
      Geocache cache = new Geocache();
      cache.setGeocode(geocode);
      cache.setCoords(gp);
      cache.setCacheId(String.valueOf(1));

      Waypoint theFinal = new Waypoint("Final", WaypointType.FINAL, false);
      Geopoint finalGp = new Geopoint(lat + 0.25d + 1, lon + 0.25d + 1);
      theFinal.setCoords(finalGp);
      theFinal.setId(1);
      cache.addOrChangeWaypoint(theFinal, false);

      Waypoint trailhead = new Waypoint("Trail head", WaypointType.TRAILHEAD, false);
      Geopoint trailheadGp = new Geopoint(lat + 0.25d + 2, lon + 0.25d + 2);
      trailhead.setCoords(trailheadGp);
      trailhead.setId(2);
      cache.addOrChangeWaypoint(trailhead, false);

      // make sure we don't have stale downloads
      deleteCacheDirectory(geocode);
      assertThat(StaticMapsProvider.hasStaticMap(cache)).isFalse();
      assertThat(StaticMapsProvider.hasStaticMapForWaypoint(geocode, theFinal)).isFalse();
      assertThat(StaticMapsProvider.hasStaticMapForWaypoint(geocode, trailhead)).isFalse();

      // download
      StaticMapsProvider.downloadMaps(cache).await();

      try {
        Thread.sleep(10000);
      } catch (InterruptedException e) {
        fail();
      }

      // check download
      assertThat(StaticMapsProvider.hasStaticMap(cache)).isTrue();
      assertThat(StaticMapsProvider.hasStaticMapForWaypoint(geocode, theFinal)).isTrue();
      assertThat(StaticMapsProvider.hasStaticMapForWaypoint(geocode, trailhead)).isTrue();

      // waypoint static maps hashcode dependent
      trailhead.setCoords(new Geopoint(lat + 0.24d + 2, lon + 0.25d + 2));
      assertThat(StaticMapsProvider.hasStaticMapForWaypoint(geocode, trailhead)).isFalse();
    } finally {
      TestSettings.setStoreOfflineWpMaps(backupStoreWP);
      TestSettings.setStoreOfflineMaps(backupStore);
      deleteCacheDirectory(geocode);
    }
  }
コード例 #15
0
ファイル: InternalMapNew.java プロジェクト: GodfatherThe/cgeo
 @Override
 public void navigate(@NonNull final Activity activity, @NonNull final Geocache cache) {
   NewMap.startActivityGeoCode(activity, cache.getGeocode());
 }
コード例 #16
0
ファイル: TypeFilter.java プロジェクト: GodfatherThe/cgeo
 @Override
 public boolean accepts(@NonNull final Geocache cache) {
   return cacheType == cache.getType();
 }
コード例 #17
0
ファイル: GCMap.java プロジェクト: samueltardieu/cgeo
  public static SearchResult searchByGeocodes(final Set<String> geocodes) {
    final SearchResult result = new SearchResult();

    final Set<String> filteredGeocodes = GCConnector.getInstance().handledGeocodes(geocodes);
    if (filteredGeocodes.isEmpty()) {
      return result;
    }
    final String geocodeList = StringUtils.join(filteredGeocodes.toArray(), "|");

    try {
      final Parameters params =
          new Parameters("i", geocodeList, "_", String.valueOf(System.currentTimeMillis()));
      params.add("app", "cgeo");
      final String referer = GCConstants.URL_LIVE_MAP_DETAILS;
      final String data = Tile.requestMapInfo(referer, params, referer).toBlocking().value();

      // Example JSON information
      // {"status":"success",
      //    "data":[{"name":"Mission:
      // Impossible","gc":"GC1234","g":"34c2e609-5246-4f91-9029-d6c02b0f2a82","available":true,"archived":false,"subrOnly":false,"li":false,"fp":"5","difficulty":{"text":3.5,"value":"3_5"},"terrain":{"text":1.0,"value":"1"},"hidden":"7/23/2001","container":{"text":"Regular","value":"regular.gif"},"type":{"text":"Unknown Cache","value":8},"owner":{"text":"Ca$h_Cacher","value":"2db18e69-6877-402a-848d-6362621424f6"}},
      //            {"name":"HP: Hannover -
      // Sahlkamp","gc":"GC2Q97X","g":"a09149ca-00e0-4aa2-b332-db2b4dfb18d2","available":true,"archived":false,"subrOnly":false,"li":false,"fp":"0","difficulty":{"text":1.0,"value":"1"},"terrain":{"text":1.5,"value":"1_5"},"hidden":"5/29/2011","container":{"text":"Small","value":"small.gif"},"type":{"text":"Traditional Cache","value":2},"owner":{"text":"GeoM@n","value":"1deaa69e-6bcc-421d-95a1-7d32b468cb82"}}]
      // }

      final ObjectNode json = (ObjectNode) JsonUtils.reader.readTree(data);
      final String status = json.path("status").asText();
      if (StringUtils.isBlank(status)) {
        throw new ParserException("No status inside JSON");
      }
      if ("success".compareTo(status) != 0) {
        throw new ParserException("Wrong status inside JSON");
      }
      final ArrayNode dataArray = (ArrayNode) json.get("data");
      if (dataArray == null) {
        throw new ParserException("No data inside JSON");
      }

      final List<Geocache> caches = new ArrayList<>();
      for (final JsonNode dataObject : dataArray) {
        final Geocache cache = new Geocache();
        cache.setName(dataObject.path("name").asText());
        cache.setGeocode(dataObject.path("gc").asText());
        cache.setGuid(dataObject.path("g").asText()); // 34c2e609-5246-4f91-9029-d6c02b0f2a82"
        cache.setDisabled(!dataObject.path("available").asBoolean());
        cache.setArchived(dataObject.path("archived").asBoolean());
        cache.setPremiumMembersOnly(dataObject.path("subrOnly").asBoolean());
        // "li" seems to be "false" always
        cache.setFavoritePoints(Integer.parseInt(dataObject.path("fp").asText()));
        cache.setDifficulty(
            Float.parseFloat(dataObject.path("difficulty").path("text").asText())); // 3.5
        cache.setTerrain(Float.parseFloat(dataObject.path("terrain").path("text").asText())); // 1.5
        cache.setHidden(
            GCLogin.parseGcCustomDate(
                dataObject.path("hidden").asText(), "MM/dd/yyyy")); // 7/23/2001
        cache.setSize(
            CacheSize.getById(dataObject.path("container").path("text").asText())); // Regular
        cache.setType(
            CacheType.getByPattern(
                dataObject.path("type").path("text").asText())); // Traditional Cache
        cache.setOwnerDisplayName(dataObject.path("owner").path("text").asText());

        caches.add(cache);
      }
      result.addAndPutInCache(caches);
    } catch (ParserException | ParseException | IOException | NumberFormatException ignored) {
      result.setError(StatusCode.UNKNOWN_ERROR);
    }
    return result;
  }
コード例 #18
0
ファイル: GCMap.java プロジェクト: samueltardieu/cgeo
  /**
   * @param data Retrieved data.
   * @return SearchResult. Never null.
   */
  public static SearchResult parseMapJSON(
      final String data, final Tile tile, final Bitmap bitmap, final LivemapStrategy strategy) {
    final SearchResult searchResult = new SearchResult();

    try {

      final LeastRecentlyUsedMap<String, String> nameCache =
          new LeastRecentlyUsedMap.LruCache<>(2000); // JSON id, cache name

      if (StringUtils.isEmpty(data)) {
        throw new ParserException("No page given");
      }

      // Example JSON information
      // {"grid":[....],
      //
      // "keys":["","55_55","55_54","17_25","55_53","17_27","17_26","57_53","57_55","3_62","3_61","57_54","3_60","15_27","15_26","15_25","4_60","4_61","4_62","16_25","16_26","16_27","2_62","2_60","2_61","56_53","56_54","56_55"],
      //  "data":{"55_55":[{"i":"gEaR","n":"Spiel & Sport"}],"55_54":[{"i":"gEaR","n":"Spiel &
      // Sport"}],"17_25":[{"i":"Rkzt","n":"EDSSW:  Rathaus "}],"55_53":[{"i":"gEaR","n":"Spiel &
      // Sport"}],"17_27":[{"i":"Rkzt","n":"EDSSW:  Rathaus "}],"17_26":[{"i":"Rkzt","n":"EDSSW:
      // Rathaus "}],"57_53":[{"i":"gEaR","n":"Spiel & Sport"}],"57_55":[{"i":"gEaR","n":"Spiel &
      // Sport"}],"3_62":[{"i":"gOWz","n":"Baumarktserie - Wer Wo Was
      // -"}],"3_61":[{"i":"gOWz","n":"Baumarktserie - Wer Wo Was
      // -"}],"57_54":[{"i":"gEaR","n":"Spiel & Sport"}],"3_60":[{"i":"gOWz","n":"Baumarktserie -
      // Wer Wo Was -"}],"15_27":[{"i":"Rkzt","n":"EDSSW:  Rathaus
      // "}],"15_26":[{"i":"Rkzt","n":"EDSSW:  Rathaus "}],"15_25":[{"i":"Rkzt","n":"EDSSW:  Rathaus
      // "}],"4_60":[{"i":"gOWz","n":"Baumarktserie - Wer Wo Was
      // -"}],"4_61":[{"i":"gOWz","n":"Baumarktserie - Wer Wo Was
      // -"}],"4_62":[{"i":"gOWz","n":"Baumarktserie - Wer Wo Was
      // -"}],"16_25":[{"i":"Rkzt","n":"EDSSW:  Rathaus "}],"16_26":[{"i":"Rkzt","n":"EDSSW:
      // Rathaus "}],"16_27":[{"i":"Rkzt","n":"EDSSW:  Rathaus
      // "}],"2_62":[{"i":"gOWz","n":"Baumarktserie - Wer Wo Was
      // -"}],"2_60":[{"i":"gOWz","n":"Baumarktserie - Wer Wo Was
      // -"}],"2_61":[{"i":"gOWz","n":"Baumarktserie - Wer Wo Was
      // -"}],"56_53":[{"i":"gEaR","n":"Spiel & Sport"}],"56_54":[{"i":"gEaR","n":"Spiel &
      // Sport"}],"56_55":[{"i":"gEaR","n":"Spiel & Sport"}]}
      //  }

      final ObjectNode json = (ObjectNode) JsonUtils.reader.readTree(data);

      final ArrayNode grid = (ArrayNode) json.get("grid");
      if (grid == null || grid.size() != (UTFGrid.GRID_MAXY + 1)) {
        throw new ParserException("No grid inside JSON");
      }
      final ArrayNode keys = (ArrayNode) json.get("keys");
      if (keys == null) {
        throw new ParserException("No keys inside JSON");
      }
      final ObjectNode dataObject = (ObjectNode) json.get("data");
      if (dataObject == null) {
        throw new ParserException("No data inside JSON");
      }

      // iterate over the data and construct all caches in this tile
      final Map<String, List<UTFGridPosition>> positions = new HashMap<>(); // JSON id as key
      final Map<String, List<UTFGridPosition>> singlePositions = new HashMap<>(); // JSON id as key

      for (final JsonNode rawKey : keys) {
        final String key = rawKey.asText();
        if (StringUtils.isNotBlank(key)) { // index 0 is empty
          final UTFGridPosition pos = UTFGridPosition.fromString(key);
          final ArrayNode dataForKey = (ArrayNode) dataObject.get(key);
          for (final JsonNode cacheInfo : dataForKey) {
            final String id = cacheInfo.get("i").asText();
            nameCache.put(id, cacheInfo.get("n").asText());

            List<UTFGridPosition> listOfPositions = positions.get(id);
            List<UTFGridPosition> singleListOfPositions = singlePositions.get(id);

            if (listOfPositions == null) {
              listOfPositions = new ArrayList<>();
              positions.put(id, listOfPositions);
              singleListOfPositions = new ArrayList<>();
              singlePositions.put(id, singleListOfPositions);
            }

            listOfPositions.add(pos);
            if (dataForKey.size() == 1) {
              singleListOfPositions.add(pos);
            }
          }
        }
      }

      final List<Geocache> caches = new ArrayList<>();
      for (final Entry<String, List<UTFGridPosition>> entry : positions.entrySet()) {
        final String id = entry.getKey();
        final List<UTFGridPosition> pos = entry.getValue();
        final UTFGridPosition xy = UTFGrid.getPositionInGrid(pos);
        final Geocache cache = new Geocache();
        cache.setDetailed(false);
        cache.setReliableLatLon(false);
        cache.setGeocode(id);
        cache.setName(nameCache.get(id));
        cache.setCoords(tile.getCoord(xy), tile.getZoomLevel());
        if (strategy.flags.contains(LivemapStrategy.Flag.PARSE_TILES) && bitmap != null) {
          for (final UTFGridPosition singlePos : singlePositions.get(id)) {
            if (IconDecoder.parseMapPNG(cache, bitmap, singlePos, tile.getZoomLevel())) {
              break; // cache parsed
            }
          }
        } else {
          cache.setType(CacheType.UNKNOWN, tile.getZoomLevel());
        }

        boolean exclude = false;
        if (Settings.isExcludeMyCaches()
            && (cache.isFound() || cache.isOwner())) { // workaround for BM
          exclude = true;
        }
        if (Settings.isExcludeDisabledCaches() && cache.isDisabled()) {
          exclude = true;
        }
        if (!Settings.getCacheType().contains(cache)
            && cache.getType() != CacheType.UNKNOWN) { // workaround for BM
          exclude = true;
        }
        if (!exclude) {
          caches.add(cache);
        }
      }
      searchResult.addAndPutInCache(caches);
      Log.d("Retrieved " + searchResult.getCount() + " caches for tile " + tile.toString());

    } catch (RuntimeException | ParserException | IOException e) {
      Log.e("GCMap.parseMapJSON", e);
    }

    return searchResult;
  }
コード例 #19
0
 @Override
 protected Geocache createTestCache() {
   final Geocache cache = super.createTestCache();
   cache.setType(CacheType.MYSTERY);
   return cache;
 }
コード例 #20
0
 @Override
 protected void doCommand() {
   oldLists = new HashSet<>(cache.getLists());
   DataStore.saveLists(getCaches(), Collections.singleton(getNewListId()));
 }
コード例 #21
0
ファイル: LogCacheActivity.java プロジェクト: pstorch/cgeo
  @Override
  public void onCreate(final Bundle savedInstanceState) {
    onCreate(savedInstanceState, R.layout.logcache_activity);

    // Get parameters from intent and basic cache information from database
    final Bundle extras = getIntent().getExtras();
    if (extras != null) {
      geocode = extras.getString(Intents.EXTRA_GEOCODE);
      if (StringUtils.isBlank(geocode)) {
        final String cacheid = extras.getString(Intents.EXTRA_ID);
        if (StringUtils.isNotBlank(cacheid)) {
          geocode = DataStore.getGeocodeForGuid(cacheid);
        }
      }
    }

    cache = DataStore.loadCache(geocode, LoadFlags.LOAD_CACHE_OR_DB);
    invalidateOptionsMenuCompatible();
    possibleLogTypes = cache.getPossibleLogTypes();

    if (StringUtils.isNotBlank(cache.getName())) {
      setTitle(res.getString(R.string.log_new_log) + ": " + cache.getName());
    } else {
      setTitle(res.getString(R.string.log_new_log) + ": " + cache.getGeocode());
    }

    initializeRatingBar();

    // initialize with default values
    setDefaultValues();

    // Restore previous state
    if (savedInstanceState != null) {
      rating = savedInstanceState.getFloat(SAVED_STATE_RATING);
      typeSelected = LogType.getById(savedInstanceState.getInt(SAVED_STATE_TYPE));
      date.setTimeInMillis(savedInstanceState.getLong(SAVED_STATE_DATE));
      image = savedInstanceState.getParcelable(SAVED_STATE_IMAGE);
      premFavPoints = savedInstanceState.getInt(SAVED_STATE_FAVPOINTS);
    } else {
      // If log had been previously saved, load it now, otherwise initialize signature as needed
      loadLogFromDatabase();
    }
    if (image == null) {
      image = Image.NONE;
    }
    enablePostButton(false);

    final Button typeButton = ButterKnife.findById(this, R.id.type);
    typeButton.setText(typeSelected.getL10n());
    typeButton.setOnClickListener(
        new View.OnClickListener() {

          @Override
          public void onClick(final View view) {
            selectLogType();
          }
        });

    final Button dateButton = ButterKnife.findById(this, R.id.date);
    setDate(date);
    dateButton.setOnClickListener(new DateListener());

    if (StringUtils.isBlank(currentLogText()) && StringUtils.isNotBlank(text)) {
      setLogText();
    }

    tweetCheck.setChecked(true);
    updateTweetBox(typeSelected);
    updateLogPasswordBox(typeSelected);

    loggingManager = cache.getLoggingManager(this);
    loggingManager.init();

    // Load Generic Trackables
    AppObservable.bindActivity(
            this,
            // Obtain the actives connectors
            Observable.from(ConnectorFactory.getLoggableGenericTrackablesConnectors())
                .flatMap(
                    new Func1<TrackableConnector, Observable<TrackableLog>>() {
                      @Override
                      public Observable<TrackableLog> call(
                          final TrackableConnector trackableConnector) {
                        return Observable.defer(
                                new Func0<Observable<TrackableLog>>() {
                                  @Override
                                  public Observable<TrackableLog> call() {
                                    return trackableConnector.trackableLogInventory();
                                  }
                                })
                            .subscribeOn(AndroidRxUtils.networkScheduler);
                      }
                    })
                .toList())
        .subscribe(
            new Action1<List<TrackableLog>>() {
              @Override
              public void call(final List<TrackableLog> trackableLogs) {
                // Store trackables
                trackables.addAll(trackableLogs);
                // Update the UI
                initializeTrackablesAction();
                updateTrackablesList();
              }
            });

    requestKeyboardForLogging();
  }