コード例 #1
0
  void displaySong(String bookName, Song song) {
    song_container.setVisibility(song != null ? View.VISIBLE : View.GONE);
    no_song_data_container.setVisibility(song != null ? View.GONE : View.VISIBLE);

    if (song != null) {
      bChangeBook.setText(bookName);
      bChangeCode.setText(song.code);

      // construct rendition of scripture references
      String scripture_references = renderScriptureReferences(PROTOCOL, song.scriptureReferences);
      templateCustomVars.putString("scripture_references", scripture_references); // $NON-NLS-1$

      FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
      ft.replace(
          R.id.song_container,
          SongFragment.create(song, "templates/song.html", templateCustomVars)); // $NON-NLS-1$
      ft.commitAllowingStateLoss();

      currentBookName = bookName;
      currentSong = song;

      { // save latest viewed song TODO optimize using new preferences fw
        Preferences.setString(Prefkey.song_last_bookName, bookName);
        Preferences.setString(Prefkey.song_last_code, song.code);
      }
    }
  }
コード例 #2
0
ファイル: U.java プロジェクト: James-RDW/androidbible
 /**
  * The reason we use an installation id instead of just the simpleToken for sync to identify
  * originating device, is so that the GCM messages does not contain simpleToken, which is
  * sensitive.
  */
 public static synchronized String getInstallationId() {
   String res = Preferences.getString(Prefkey.installation_id, null);
   if (res == null) {
     res = "i1:" + UUID.randomUUID().toString();
     Preferences.setString(Prefkey.installation_id, res);
   }
   return res;
 }