quran_android icon indicating copy to clipboard operation
quran_android copied to clipboard

[feat] share ayah as audio

Open DoozyDoz opened this issue 2 years ago • 16 comments

This is an attempt to address issue #1731

Screenshot

Screenshot_20220705_183433_com quran labs androidquran debug

Addressed

  • Added option to share audio ayah after its been highlighted.
  • Share ayat from different surah as single audio file.
  • Changed the "share ayah text" icon.

Not Addressed

  • Asking users to download audio files in case they are missing.
  • There is no functionality to add isthaatha before non-beginner ayat
  • When sharing audio to WhatsApp it sometimes fails.
  • Code is poorly written and I welcome any advice

DoozyDoz avatar Jul 05 '22 15:07 DoozyDoz

OLD: app-madani-debug.apk (signature: V1, V2)
NEW: app-madani-debug.apk (signature: V1, V2)

          │            compressed             │           uncompressed            
          ├───────────┬───────────┬───────────┼───────────┬───────────┬───────────
 APK      │ old       │ new       │ diff      │ old       │ new       │ diff      
──────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────
      dex │   7.3 MiB │   7.3 MiB │  +8.8 KiB │  17.9 MiB │    18 MiB │ +17.3 KiB 
     arsc │   1.7 MiB │   1.7 MiB │    +756 B │   1.7 MiB │   1.7 MiB │    +756 B 
 manifest │   5.5 KiB │   5.5 KiB │     +56 B │  26.6 KiB │  26.7 KiB │    +112 B 
      res │   1.1 MiB │   1.1 MiB │  +1.1 KiB │   1.3 MiB │   1.3 MiB │  +1.9 KiB 
    asset │ 404.2 KiB │ 404.2 KiB │       0 B │ 678.6 KiB │ 678.6 KiB │       0 B 
    other │ 166.5 KiB │ 166.6 KiB │    +141 B │ 330.1 KiB │ 330.5 KiB │    +386 B 
──────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────
    total │  10.7 MiB │  10.7 MiB │ +10.9 KiB │    22 MiB │    22 MiB │ +20.4 KiB 


github-actions[bot] avatar Jul 05 '22 16:07 github-actions[bot]

Notes on the icons:

  1. I would prefer a speaker icon for sharing audio instead of an icon mostly used to represent music. For example: https://unicode-table.com/en/1F56A/
  2. I think we might try to be creative here and use an icon with Arabic letters or a document. The "T" is fine but is probably only relevant to those who know English and perhaps few other languages.

Other notes:

  1. Do you know when sharing to Whatsapp fails? is it when there is no audio downloaded?

  2. Can you give a meaningful name to the shared audio file instead of a random string?

  3. The app crashed when I tried to share all Ayat of Surah 1. I think we can just pass the audio file of the Surah as it is (for gapless)

  4. I think the user should get a prompt saying "You must download the audio file of Surah X" (in case no audio is available). Also, it that case, do not attempt to share (don't show the intent).

جزاكم الله خيرا

benomaire avatar Jul 06 '22 15:07 benomaire

Notes on the icons:

  1. I would prefer a speaker icon for sharing audio instead of an icon mostly used to represent music. For example: https://unicode-table.com/en/1F56A/
  2. I think we might try to be creative here and use an icon with Arabic letters or a document. The "T" is fine but is probably only relevant to those who know English and perhaps few other languages.

Other notes:

  1. Do you know when sharing to Whatsapp fails? is it when there is no audio downloaded?
  2. Can you give a meaningful name to the shared audio file instead of a random string?
  3. The app crashed when I tried to share all Ayat of Surah 1. I think we can just pass the audio file of the Surah as it is (for gapless)
  4. I think the user should get a prompt saying "You must download the audio file of Surah X" (in case no audio is available). Also, it that case, do not attempt to share (don't show the intent).

جزاكم الله خيرا

Thanks you for the advise @benomaire , I shall act accordingly

  • Just updated the Icons they should now look like this: Screenshot_20220707_133311

DoozyDoz avatar Jul 07 '22 10:07 DoozyDoz

OLD: app-madani-debug.apk (signature: V1, V2)
NEW: app-madani-debug.apk (signature: V1, V2)

          │            compressed             │           uncompressed            
          ├───────────┬───────────┬───────────┼───────────┬───────────┬───────────
 APK      │ old       │ new       │ diff      │ old       │ new       │ diff      
──────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────
      dex │   7.3 MiB │   7.3 MiB │  +8.8 KiB │  17.9 MiB │    18 MiB │ +17.3 KiB 
     arsc │   1.7 MiB │   1.7 MiB │  +1.3 KiB │   1.7 MiB │   1.7 MiB │  +1.3 KiB 
 manifest │   5.5 KiB │   5.5 KiB │     +56 B │  26.6 KiB │  26.7 KiB │    +112 B 
      res │   1.1 MiB │   1.1 MiB │ +20.3 KiB │   1.3 MiB │   1.3 MiB │ +19.5 KiB 
    asset │ 404.2 KiB │ 404.2 KiB │       0 B │ 678.6 KiB │ 678.6 KiB │       0 B 
    other │ 166.5 KiB │ 167.3 KiB │    +836 B │ 330.1 KiB │ 332.4 KiB │  +2.3 KiB 
──────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────
    total │  10.7 MiB │  10.7 MiB │ +31.3 KiB │    22 MiB │    22 MiB │ +40.5 KiB 


github-actions[bot] avatar Jul 07 '22 10:07 github-actions[bot]

Notes on the icons:

  1. I would prefer a speaker icon for sharing audio instead of an icon mostly used to represent music. For example: https://unicode-table.com/en/1F56A/
  2. I think we might try to be creative here and use an icon with Arabic letters or a document. The "T" is fine but is probably only relevant to those who know English and perhaps few other languages.

Other notes:

  1. Do you know when sharing to Whatsapp fails? is it when there is no audio downloaded?
  2. Can you give a meaningful name to the shared audio file instead of a random string?
  3. The app crashed when I tried to share all Ayat of Surah 1. I think we can just pass the audio file of the Surah as it is (for gapless)
  4. I think the user should get a prompt saying "You must download the audio file of Surah X" (in case no audio is available). Also, it that case, do not attempt to share (don't show the intent).

جزاكم الله خيرا

I have renamed the audio file name to the pattern [qari_name]_[startsurah]-[startayah]_[endsurah]-[endayah].mp3 eg. minshawi_murattal_113-5_114-2.mp3

DoozyDoz avatar Jul 07 '22 11:07 DoozyDoz

OLD: app-madani-debug.apk (signature: V1, V2)
NEW: app-madani-debug.apk (signature: V1, V2)

          │            compressed             │           uncompressed            
          ├───────────┬───────────┬───────────┼───────────┬───────────┬───────────
 APK      │ old       │ new       │ diff      │ old       │ new       │ diff      
──────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────
      dex │   7.3 MiB │   7.3 MiB │  +9.1 KiB │  17.9 MiB │    18 MiB │ +18.1 KiB 
     arsc │   1.7 MiB │   1.7 MiB │  +1.3 KiB │   1.7 MiB │   1.7 MiB │  +1.3 KiB 
 manifest │   5.5 KiB │   5.5 KiB │     +56 B │  26.6 KiB │  26.7 KiB │    +112 B 
      res │   1.1 MiB │   1.1 MiB │ +20.3 KiB │   1.3 MiB │   1.3 MiB │ +19.5 KiB 
    asset │ 404.2 KiB │ 404.2 KiB │       0 B │ 678.6 KiB │ 678.6 KiB │       0 B 
    other │ 166.5 KiB │ 167.3 KiB │    +841 B │ 330.1 KiB │ 332.4 KiB │  +2.3 KiB 
──────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────
    total │  10.7 MiB │  10.7 MiB │ +31.6 KiB │    22 MiB │    22 MiB │ +41.3 KiB 


github-actions[bot] avatar Jul 07 '22 11:07 github-actions[bot]

Notes on the icons:

  1. I would prefer a speaker icon for sharing audio instead of an icon mostly used to represent music. For example: https://unicode-table.com/en/1F56A/
  2. I think we might try to be creative here and use an icon with Arabic letters or a document. The "T" is fine but is probably only relevant to those who know English and perhaps few other languages.

Other notes:

  1. Do you know when sharing to Whatsapp fails? is it when there is no audio downloaded?
  2. Can you give a meaningful name to the shared audio file instead of a random string?
  3. The app crashed when I tried to share all Ayat of Surah 1. I think we can just pass the audio file of the Surah as it is (for gapless)
  4. I think the user should get a prompt saying "You must download the audio file of Surah X" (in case no audio is available). Also, it that case, do not attempt to share (don't show the intent).

جزاكم الله خيرا

Fixed bullet 3

DoozyDoz avatar Jul 07 '22 12:07 DoozyDoz

OLD: app-madani-debug.apk (signature: V1, V2)
NEW: app-madani-debug.apk (signature: V1, V2)

          │            compressed             │           uncompressed            
          ├───────────┬───────────┬───────────┼───────────┬───────────┬───────────
 APK      │ old       │ new       │ diff      │ old       │ new       │ diff      
──────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────
      dex │   7.3 MiB │   7.3 MiB │  +9.1 KiB │  17.9 MiB │    18 MiB │ +18.1 KiB 
     arsc │   1.7 MiB │   1.7 MiB │  +2.2 KiB │   1.7 MiB │   1.7 MiB │  +2.2 KiB 
 manifest │   5.5 KiB │   5.5 KiB │     +56 B │  26.6 KiB │  26.7 KiB │    +112 B 
      res │   1.1 MiB │   1.1 MiB │ +20.3 KiB │   1.3 MiB │   1.3 MiB │ +19.5 KiB 
    asset │ 404.2 KiB │ 404.2 KiB │       0 B │ 678.6 KiB │ 678.6 KiB │       0 B 
    other │ 166.5 KiB │ 167.3 KiB │    +838 B │ 330.1 KiB │ 332.4 KiB │  +2.3 KiB 
──────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────
    total │  10.7 MiB │  10.7 MiB │ +32.5 KiB │    22 MiB │    22 MiB │ +42.2 KiB 


github-actions[bot] avatar Jul 07 '22 12:07 github-actions[bot]

OLD: app-madani-debug.apk (signature: V1, V2)
NEW: app-madani-debug.apk (signature: V1, V2)

          │            compressed             │           uncompressed            
          ├───────────┬───────────┬───────────┼───────────┬───────────┬───────────
 APK      │ old       │ new       │ diff      │ old       │ new       │ diff      
──────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────
      dex │   7.3 MiB │   7.3 MiB │  +9.1 KiB │  17.9 MiB │    18 MiB │ +18.1 KiB 
     arsc │   1.7 MiB │   1.7 MiB │  +2.2 KiB │   1.7 MiB │   1.7 MiB │  +2.2 KiB 
 manifest │   5.5 KiB │   5.5 KiB │     +56 B │  26.6 KiB │  26.7 KiB │    +112 B 
      res │   1.1 MiB │   1.1 MiB │ +20.3 KiB │   1.3 MiB │   1.3 MiB │ +19.5 KiB 
    asset │ 404.2 KiB │ 404.2 KiB │       0 B │ 678.6 KiB │ 678.6 KiB │       0 B 
    other │ 166.5 KiB │ 167.3 KiB │    +846 B │ 330.1 KiB │ 332.4 KiB │  +2.3 KiB 
──────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────
    total │  10.7 MiB │  10.7 MiB │ +32.5 KiB │    22 MiB │    22 MiB │ +42.2 KiB 


github-actions[bot] avatar Jul 07 '22 12:07 github-actions[bot]

Notes on the icons:

  1. I would prefer a speaker icon for sharing audio instead of an icon mostly used to represent music. For example: https://unicode-table.com/en/1F56A/
  2. I think we might try to be creative here and use an icon with Arabic letters or a document. The "T" is fine but is probably only relevant to those who know English and perhaps few other languages.

Other notes:

  1. Do you know when sharing to Whatsapp fails? is it when there is no audio downloaded?
  2. Can you give a meaningful name to the shared audio file instead of a random string?
  3. The app crashed when I tried to share all Ayat of Surah 1. I think we can just pass the audio file of the Surah as it is (for gapless)
  4. I think the user should get a prompt saying "You must download the audio file of Surah X" (in case no audio is available). Also, it that case, do not attempt to share (don't show the intent).

جزاكم الله خيرا

Issue 4 fixed (I guess)

DoozyDoz avatar Jul 07 '22 13:07 DoozyDoz

OLD: app-madani-debug.apk (signature: V1, V2)
NEW: app-madani-debug.apk (signature: V1, V2)

          │            compressed             │           uncompressed            
          ├───────────┬───────────┬───────────┼───────────┬───────────┬───────────
 APK      │ old       │ new       │ diff      │ old       │ new       │ diff      
──────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────
      dex │   7.3 MiB │   7.3 MiB │  +9.2 KiB │  17.9 MiB │    18 MiB │ +18.3 KiB 
     arsc │   1.7 MiB │   1.7 MiB │  +2.2 KiB │   1.7 MiB │   1.7 MiB │  +2.2 KiB 
 manifest │   5.5 KiB │   5.5 KiB │     +56 B │  26.6 KiB │  26.7 KiB │    +112 B 
      res │   1.1 MiB │   1.1 MiB │ +20.3 KiB │   1.3 MiB │   1.3 MiB │ +19.5 KiB 
    asset │ 404.2 KiB │ 404.2 KiB │       0 B │ 678.6 KiB │ 678.6 KiB │       0 B 
    other │ 166.5 KiB │ 167.3 KiB │    +843 B │ 330.1 KiB │ 332.4 KiB │  +2.3 KiB 
──────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────
    total │  10.7 MiB │  10.7 MiB │ +32.5 KiB │    22 MiB │    22 MiB │ +42.4 KiB 


github-actions[bot] avatar Jul 07 '22 14:07 github-actions[bot]

السلام عليكم ورحمة الله وبركاته jazakumAllah khairan for this - we get lots of requests for similar things so would be great to have this. I didn't review the code in too much detail yet, but wanted to recommend if we may, let's make a new module (under feature, ex feature/audiosharing) and move the relevant code there.

with respect to how we're splitting the mp3 from the mp3, did you try the MediaExtractor and MediaCodec classes? seems like the newest version of RingDroid, where this code is taken from, now uses these APIs instead.

ahmedre avatar Jul 10 '22 13:07 ahmedre

السلام عليكم ورحمة الله وبركاته jazakumAllah khairan for this - we get lots of requests for similar things so would be great to have this. I didn't review the code in too much detail yet, but wanted to recommend if we may, let's make a new module (under feature, ex feature/audiosharing) and move the relevant code there.

with respect to how we're splitting the mp3 from the mp3, did you try the MediaExtractor and MediaCodec classes? seems like the newest version of RingDroid, where this code is taken from, now uses these APIs instead.

وَعَلَيْكُمُ ٱلسَّلَامُ Idd mubarak I will try to create the module as requested insha Allah tommorow, About the ringdroid code, I used ringdroid's latest (2016) sound file class which uses mediacodec and mediaextrator but the lag was high. I thought I was using the code wrongly but I compiled a version of Ringdroid's latest code the app takes a really long time to stage the cuttable mp3 file. So tried different versions of the code and finally landed on the one of 2009 (the original) that was in pure java which did all the necessary operations(precutting and cutting) in milliseconds, the choice was obvious at the point

DoozyDoz avatar Jul 10 '22 17:07 DoozyDoz

OLD: app-madani-debug.apk (signature: V1, V2)
NEW: app-madani-debug.apk (signature: V1, V2)

          │            compressed             │           uncompressed            
          ├───────────┬───────────┬───────────┼───────────┬───────────┬───────────
 APK      │ old       │ new       │ diff      │ old       │ new       │ diff      
──────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────
      dex │   7.3 MiB │   7.3 MiB │  +9.9 KiB │  17.9 MiB │    18 MiB │ +19.7 KiB 
     arsc │   1.7 MiB │   1.7 MiB │  +2.2 KiB │   1.7 MiB │   1.7 MiB │  +2.2 KiB 
 manifest │   5.5 KiB │   5.5 KiB │     +56 B │  26.6 KiB │  26.7 KiB │    +112 B 
      res │   1.1 MiB │   1.1 MiB │ +20.3 KiB │   1.3 MiB │   1.3 MiB │ +19.5 KiB 
    asset │ 404.2 KiB │ 404.2 KiB │       0 B │ 678.6 KiB │ 678.6 KiB │       0 B 
    other │ 166.5 KiB │ 167.3 KiB │    +827 B │ 330.1 KiB │ 332.4 KiB │  +2.3 KiB 
──────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────
    total │  10.7 MiB │  10.7 MiB │ +33.3 KiB │    22 MiB │    22 MiB │ +43.8 KiB 


github-actions[bot] avatar Jul 11 '22 11:07 github-actions[bot]

OLD: app-madani-debug.apk (signature: V1, V2)
NEW: app-madani-debug.apk (signature: V1, V2)

          │            compressed             │           uncompressed            
          ├───────────┬───────────┬───────────┼───────────┬───────────┬───────────
 APK      │ old       │ new       │ diff      │ old       │ new       │ diff      
──────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────
      dex │   7.3 MiB │   7.3 MiB │ +15.7 KiB │    18 MiB │    18 MiB │ +31.7 KiB 
     arsc │   1.7 MiB │   1.7 MiB │  +2.2 KiB │   1.7 MiB │   1.7 MiB │  +2.2 KiB 
 manifest │   5.5 KiB │   5.5 KiB │     +56 B │  26.6 KiB │  26.7 KiB │    +112 B 
      res │   1.1 MiB │   1.1 MiB │ +20.3 KiB │   1.3 MiB │   1.3 MiB │ +19.5 KiB 
    asset │ 404.2 KiB │ 404.2 KiB │       0 B │ 678.6 KiB │ 678.6 KiB │       0 B 
    other │ 166.5 KiB │ 167.3 KiB │    +857 B │ 330.1 KiB │ 332.4 KiB │  +2.3 KiB 
──────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────
    total │  10.7 MiB │  10.7 MiB │ +39.1 KiB │    22 MiB │  22.1 MiB │ +55.8 KiB 


github-actions[bot] avatar Jul 30 '22 08:07 github-actions[bot]

OLD: app-madani-debug.apk (signature: V1, V2)
NEW: app-madani-debug.apk (signature: V1, V2)

          │            compressed             │           uncompressed            
          ├───────────┬───────────┬───────────┼───────────┬───────────┬───────────
 APK      │ old       │ new       │ diff      │ old       │ new       │ diff      
──────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────
      dex │   7.3 MiB │   7.3 MiB │ +15.7 KiB │    18 MiB │    18 MiB │ +31.6 KiB 
     arsc │   1.7 MiB │   1.7 MiB │  +2.2 KiB │   1.7 MiB │   1.7 MiB │  +2.2 KiB 
 manifest │   5.5 KiB │   5.5 KiB │     +56 B │  26.6 KiB │  26.7 KiB │    +112 B 
      res │   1.1 MiB │   1.1 MiB │ +20.3 KiB │   1.3 MiB │   1.3 MiB │ +19.5 KiB 
    asset │ 404.2 KiB │ 404.2 KiB │       0 B │ 678.6 KiB │ 678.6 KiB │       0 B 
    other │ 166.5 KiB │ 167.3 KiB │    +851 B │ 330.1 KiB │ 332.4 KiB │  +2.3 KiB 
──────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────
    total │  10.7 MiB │  10.7 MiB │ +39.1 KiB │    22 MiB │  22.1 MiB │ +55.7 KiB 


github-actions[bot] avatar Jul 30 '22 08:07 github-actions[bot]

hello akhi @ahmedre salam alaikum Can you please find time and review

DoozyDoz avatar Sep 01 '22 08:09 DoozyDoz

JazakumAllah khairan will try to review this weekend in sha' Allah

ahmedre avatar Sep 07 '22 04:09 ahmedre

given the most recent changes to the main branch, some changes need to be made before this can be merged. these changes are in progress and will in sha' Allah update this branch with the changes and try to get this merged in the near future in sha' Allah.

ahmedre avatar Sep 11 '22 12:09 ahmedre

let's continue the discussion in #2072 so I can push updates.

ahmedre avatar Sep 11 '22 19:09 ahmedre