public static String getNotificationText() {
   String notificationText = Preferences.getString(REMINDER_TEXT);
   if (TextUtils.isEmpty(notificationText)) {
     notificationText = App.context.getString(R.string.dr_notification_text);
   }
   return notificationText;
 }
Exemple #2
0
 /**
  * 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;
 }
 public static void scheduleAlarm(Context context) {
   String reminder_time = Preferences.getString(REMINDER_TIME);
   setAlarm(context, reminder_time);
 }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_song_view);

    setTitle(R.string.sn_songs_activity_title);

    song_container = V.get(this, R.id.song_container);
    no_song_data_container = V.get(this, R.id.no_song_data_container);
    bChangeBook = V.get(this, R.id.bChangeBook);
    bChangeCode = V.get(this, R.id.bChangeCode);
    bSearch = V.get(this, R.id.bSearch);
    bDownload = V.get(this, R.id.bDownload);

    qaChangeBook = SongBookUtil.getSongBookQuickAction(this, false);
    qaChangeBook.setOnActionItemClickListener(
        SongBookUtil.getOnActionItemConverter(songBookSelected));

    codeKeypad = new SongCodePopup(this);

    bChangeBook.setOnClickListener(bChangeBook_click);
    bChangeCode.setOnClickListener(bChangeCode_click);
    bSearch.setOnClickListener(bSearch_click);
    bDownload.setOnClickListener(bDownload_click);

    // for colors of bg, text, etc
    V.get(this, android.R.id.content).setBackgroundColor(S.applied.backgroundColor);

    templateCustomVars = new Bundle();
    templateCustomVars.putString(
        "background_color",
        String.format("#%06x", S.applied.backgroundColor & 0xffffff)); // $NON-NLS-1$ //$NON-NLS-2$
    templateCustomVars.putString(
        "text_color",
        String.format("#%06x", S.applied.fontColor & 0xffffff)); // $NON-NLS-1$ //$NON-NLS-2$
    templateCustomVars.putString(
        "verse_number_color",
        String.format("#%06x", S.applied.verseNumberColor & 0xffffff)); // $NON-NLS-1$ //$NON-NLS-2$
    templateCustomVars.putString(
        "text_size",
        S.applied.fontSize2dp
            + "px"); // somehow this is automatically scaled to dp. //$NON-NLS-1$ //$NON-NLS-2$
    templateCustomVars.putString(
        "line_spacing_mult", String.valueOf(S.applied.lineSpacingMult)); // $NON-NLS-1$

    {
      String fontName = Preferences.getString(getString(R.string.pref_jenisHuruf_key), null);
      if (FontManager.isCustomFont(fontName)) {
        templateCustomVars.putString(
            "custom_font_loader",
            String.format(
                "@font-face{ font-family: '%s'; src: url('%s'); }",
                fontName, FontManager.getCustomFontUri(fontName))); // $NON-NLS-1$ //$NON-NLS-2$
      } else {
        templateCustomVars.putString("custom_font_loader", ""); // $NON-NLS-1$ //$NON-NLS-2$
      }
      templateCustomVars.putString("text_font", fontName); // $NON-NLS-1$
    }

    { // show latest viewed song
      String bookName =
          Preferences.getString(Prefkey.song_last_bookName, null); // let KJ become the default.
      String code = Preferences.getString(Prefkey.song_last_code, null);

      if (bookName == null || code == null) {
        displaySong(null, null);
      } else {
        displaySong(bookName, S.getSongDb().getSong(bookName, code));
      }
    }
  }