10 | *
11 | *
12 | * If it isn't found, then the empty string is returned. This stops the gradlew from failing until
13 | * it actually needs those values.
14 | *
15 | * @param keyName The key to look for
16 | * @return The value or the empty string if not found
17 | */
18 | getConfigurationParameter = { keyName ->
19 | return System.getenv(keyName) ?:
20 | rootProject.hasProperty(keyName) ? rootProject.properties[keyName] : ''
21 | }
22 |
23 | /**
24 | * Checks if we're building on CI, false otherwise
25 | *
26 | *
27 | * Test mode is based on the existence of an environmental variable called CI. This is set
28 | * by the CI environment, not us.
29 | *
30 | *
31 | * @return true if we're building on CI, false otherwise
32 | */
33 | buildingOnCi = {
34 | "$System.env.CI" != "null"
35 | }
36 |
37 | isReleaseBuild = {
38 | return rootProject.ext.versionName.contains("SNAPSHOT") == false
39 | }
40 |
41 | useLocalDependency = {
42 | if("$System.env.LOCAL_BUILD" != "null") {
43 | return System.env.LOCAL_BUILD.toBoolean()
44 | }
45 |
46 | return rootProject.ext.buildSettings.localBuild
47 | }
48 | }
--------------------------------------------------------------------------------
/belvedere/src/main/res/values-iw/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | מצלמה
4 | גלריה
5 | כווץ תפריט פעולות צף
6 | הרחב תפריט פעולות צף
7 | יבא קובץ מהגלריה
8 | יבא תמונה מ-Google Photos
9 | הקובץ גדול מדי
10 | ספריית תמונות
11 | לא ידוע
12 | אין הרשאה
13 | יבא תמונה מהמצלמה
14 | בחר את הקובץ %s
15 | בחר את התמונה %s
16 | בטל את הבחירה בקובץ %s
17 | בטל את הבחירה בתמונה %s
18 | סגור את בוחר התמונות
19 | הגדרות
20 | כדי לשלוח קבצים מצורפים עליך לאפשר הרשאות בהגדרות שלך
21 |
--------------------------------------------------------------------------------
/belvedere/src/main/res/values-th/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | กล้อง
4 | แกลเลอรี
5 | ยุบเมนูการดำเนินการแบบลอย
6 | ขยายเมนูการดำเนินการแบบลอย
7 | อิมพอร์ตไฟล์จากแกลเลอรี
8 | อิมพอร์ตภาพจาก Google Photos
9 | ไฟล์ใหญ่เกินไป
10 | คลังภาพ
11 | ไม่ทราบ
12 | สิทธิ์การอนุญาตถูกปฏิเสธ
13 | อิมพอร์ตภาพจากกล้อง
14 | เลือกไฟล์ %s
15 | เลือกภาพ %s
16 | ยกเลิกเลือกไฟล์ %s
17 | ยกเลิกเลือกภาพ %s
18 | ปิดตัวเลือกภาพ
19 | การตั้งค่า
20 | หากต้องการส่งไฟล์แนบ คุณจําเป็นต้องอนุญาตสิทธิ์ในการตั้งค่าของคุณ
21 |
--------------------------------------------------------------------------------
/belvedere/src/main/res/values-ar/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | الكاميرا
4 | المعرض
5 | طيّ قائمة إجراءات عائمة
6 | توسيع قائمة إجراءات عائمة
7 | استيراد ملف من المعرض
8 | استيراد صورة من صور Google
9 | الملف أكبر مما ينبغي
10 | مكتبة الصور
11 | غير معروف
12 | رُفِضت الأذونات
13 | استيراد صورة من الكاميرا
14 | تحديد الملف %s
15 | تحديد الصورة %s
16 | إلغاء تحديد الملف %s
17 | إلغاء تحديد الصورة %s
18 | إغلاق منتقي الصورة
19 | لإرسال المرفقات، سيكون عليك السماح بالأذونات في الإعدادات لديك
20 | إعدادات
21 |
--------------------------------------------------------------------------------
/belvedere/src/main/res/values-vi/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Camera
4 | Thư viện
5 | Thu gọn menu thao tác động
6 | Mở rộng menu thao tác động
7 | Nhập tập tin từ thư viện ảnh
8 | Nhập ảnh từ Google Photos
9 | Tập tin quá lớn
10 | Thư viện ảnh
11 | Không xác định
12 | Đã từ chối các quyền
13 | Nhập ảnh từ camera
14 | Chọn tập tin %s
15 | Chọn ảnh %s
16 | Bỏ chọn tập tin %s
17 | Bỏ chọn ảnh %s
18 | Đóng trình chọn ảnh
19 | Cài đặt
20 | Để gửi tập tin đính kèm, bạn phải cho phép quyền trong cài đặt của bạn.
21 |
--------------------------------------------------------------------------------
/belvedere/src/main/res/values-en-rGB/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Camera
4 | Gallery
5 | Collapse Floating Action Menu
6 | Expand Floating Action Menu
7 | Import file from gallery
8 | Import image from Google Photos
9 | File too large
10 | Photo library
11 | Unknown
12 | Permissions denied
13 | Import image from camera
14 | Select file %s
15 | Select image %s
16 | Unselect file %s
17 | Unselect image %s
18 | Close image picker
19 | To send attachments you need to allow permissions in your settings
20 | Settings
21 |
--------------------------------------------------------------------------------
/belvedere/src/main/res/values-in/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Kamera
4 | Galeri
5 | Tutup Menu Tindakan Layang
6 | Buka Menu Tindakan Layang
7 | Impor file dari galeri
8 | Impor gambar dari Google Photos
9 | File terlalu besar
10 | Perpustakaan foto
11 | Tidak Dikenal
12 | Izin ditolak
13 | Impor gambar dari kamera
14 | Pilih file %s
15 | Pilih gambar %s
16 | Urung pilih file %s
17 | Urung pilih gambar %s
18 | Tutup pemilih gambar
19 | Untuk mengirim lampiran, Anda perlu mengizinkan izin di pengaturan Anda
20 | Pengaturan
21 |
--------------------------------------------------------------------------------
/belvedere/src/main/res/values-nb/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Kamera
4 | Galleri
5 | Skjul flytende handlingsmeny
6 | Vis flytende handlingsmeny
7 | Importer fil fra galleriet
8 | Importer bilde fra Google Foto
9 | Filen er for stor
10 | Bildebibliotek
11 | Ukjent
12 | Har ikke tillatelse
13 | Importer bilde fra kamera
14 | Merk filen %s
15 | Merk bildet %s
16 | Opphev merking av filen %s
17 | Opphev merking av bildet %s
18 | Lukk bildevelger
19 | Innstillinger
20 | Hvis du vil sende vedlegg, må du tillate dette i innstillingene dine
21 |
--------------------------------------------------------------------------------
/belvedere/src/main/res/values-sv/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Kamera
4 | Galleri
5 | Dölj flytande åtgärdsmeny
6 | Visa flytande åtgärdsmeny
7 | Importera fil från galleriet
8 | Importera fil från Google Photos
9 | Filen är för stor
10 | Bildbibliotek
11 | Okänd
12 | Behörighet nekades
13 | Importera bild från kameran
14 | Markera filen %s
15 | Markera bilden %s
16 | Avmarkera filen %s
17 | Avmarkera bilden %s
18 | Stäng bildväljaren
19 | Om du vill skicka bilagor måste du tillåta behörigheter i dina inställningar
20 | Inställningar
21 |
--------------------------------------------------------------------------------
/belvedere-core/src/main/java/zendesk/belvedere/Callback.java:
--------------------------------------------------------------------------------
1 | package zendesk.belvedere;
2 |
3 | import android.app.Activity;
4 | import android.os.Handler;
5 | import android.os.Looper;
6 |
7 | import androidx.fragment.app.Fragment;
8 |
9 | /**
10 | * Simple Callback used to deliver results asynchronously.
11 | *
12 | *
13 | * As always, keep a strong reference to the callback
14 | * in your {@link Activity}/{@link Fragment}. Don't forget
15 | * to call {@link #cancel()} and revoke the reference to this callback
16 | * when your {@link Activity}/{@link Fragment} gets destroyed.
17 | *
52 | *
53 | * @param result The result.
54 | */
55 | public abstract void success(E result);
56 | }
57 |
--------------------------------------------------------------------------------
/belvedere/src/main/res/values-da/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Kamera
4 | Galleri
5 | Skjul flydende handlingsmenu
6 | Vis flydende handlingsmenu
7 | Importér fil fra galleri
8 | Importér billede fra Google Photos
9 | Filen er for stor
10 | Fotobibliotek
11 | Ukendt
12 | Tilladelser nægtet
13 | Importér billede fra kamera
14 | Vælg filen %s
15 | Vælg billedet %s
16 | Fravælg filen %s
17 | Fravælg billedet %s
18 | Luk billedvælger
19 | Hvis du vil sende vedhæftede filer, skal du acceptere tilladelser i dine indstillinger
20 | Indstillinger
21 |
--------------------------------------------------------------------------------
/belvedere/src/main/res/values-hi/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | कैमरा
4 | गैलरी
5 | फ़्लोटिंग क्रियाएं संक्षिप्त करें मेनू
6 | फ़्लोटिंग क्रियाएं विस्तारित करें मेनू
7 | गैलरी से फ़ाइल आयात करें
8 | छवि को Google फ़ोटो से आयात करें
9 | फ़ाइल बहुत बड़ी है
10 | फ़ोटो लाइब्रेरी
11 | अज्ञात
12 | अनुमतियां अस्वीकृत
13 | कैमरा से छवि आयात करें
14 | फ़ाइल %s चुनें
15 | छवि %s चुनें
16 | फ़ाइल %s का चयन रद्द करेंं
17 | छवि %s का चयन रद्द करेंं
18 | छवि पिकर बंद करें
19 | अटैचमेंट भेजने के लिए आपको अपनी सेटिंग में अनुमतियों की अनुमति देनी होगी
20 | सेटिंग्स
21 |
--------------------------------------------------------------------------------
/belvedere/src/main/res/values-ms/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Kamera
4 | Galeri
5 | Kuncupkan Menu Tindakan Terapung
6 | Kembangkan Menu Tindakan Terapung
7 | Import fail daripada galeri
8 | Import imej daripada Google Photos
9 | Fail terlalu besar
10 | Perpustakaan foto
11 | Tak Diketahui
12 | Keizinan dinafikan
13 | Import imej daripada kamera
14 | Pilih fail %s
15 | Pilih imej %s
16 | Nyahpilih fail %s
17 | Nyahpilih imej %s
18 | Tutup pemungut imej
19 | Untuk menghantar lampiran, anda perlu membenarkan keizinan dalam tetapan anda
20 | Tetapan
21 |
--------------------------------------------------------------------------------
/belvedere/src/main/res/values-pl/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Aparat
4 | Galeria
5 | Zwiń przestawne menu czynności
6 | Rozwiń przestawne menu czynności
7 | Importuj plik z galerii
8 | Importuj obraz ze Zdjęć Google
9 | Zbyt duży plik
10 | Biblioteka zdjęć
11 | Nieznany
12 | Odmowa uprawnień
13 | Importuj obraz z aparatu
14 | Zaznacz plik %s
15 | Zaznacz obraz %s
16 | Wyczyść zaznaczenie pliku %s
17 | Wyczyść zaznaczenie obrazu %s
18 | Zamknij wybór obrazów
19 | Aby wysyłać załączniki, musisz przyznać im uprawnienia w ustawieniach
20 | Ustawienia
21 |
--------------------------------------------------------------------------------
/belvedere/src/main/res/values-cs/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Fotoaparát
4 | Galerie
5 | Sbalit plovoucí nabídku akcí
6 | Rozbalit plovoucí nabídku akcí
7 | Importovat soubor z galerie
8 | Importovat obrázek z Fotky Google
9 | Soubor je příliš velký
10 | Knihovna fotek
11 | Neznámá
12 | Oprávnění odepřena
13 | Importovat obrázek z fotoaparátu
14 | Vybrat soubor %s
15 | Vybrat obrázek %s
16 | Zrušit výběr souboru %s
17 | Zrušit výběr obrázku %s
18 | Zavřít výběr obrázků
19 | Nastavení
20 | Chcete-li odesílat přílohy, musíte v nastavení povolit oprávnění
21 |
--------------------------------------------------------------------------------
/belvedere/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Camera
4 | Gallery
5 | Collapse Floating Action Menu
6 | Expand Floating Action Menu
7 | Import file from gallery
8 | Import image from Google Photos
9 | File too large
10 | Photo library
11 | Unknown
12 | Permissions denied
13 | Import image from camera
14 | Select file %s
15 | Select image %s
16 | Unselect file %s
17 | Unselect image %s
18 | Close image picker
19 | Settings
20 | To send attachments you need to allow permissions in your settings
21 |
--------------------------------------------------------------------------------
/belvedere/src/main/res/values-ro/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Cameră
4 | Galerie
5 | Restrângere meniu de acțiuni mobil
6 | Extindere meniu de acțiuni mobil
7 | Import fișier din galerie
8 | Import imagine din Google Photos
9 | Fișier prea mare
10 | Bibliotecă fotografii
11 | Necunoscut
12 | Permisiuni refuzate
13 | Import imagine din cameră
14 | Selectare fișier %s
15 | Selectare imagine %s
16 | Deselectare fișier %s
17 | Deselectare imagine %s
18 | Închidere selector imagini
19 | Setări
20 | Pentru a trimite fișiere atașate, trebuie să acordați permisiuni în setări
21 |
--------------------------------------------------------------------------------
/belvedere/src/main/res/values-fi/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Kamera
4 | Galleria
5 | Sulje irrallinen toimintovalikko
6 | Laajenna irrallinen toimintovalikko
7 | Tuo tiedosto galleriasta
8 | Tuo kuva Google Photos -sovelluksesta
9 | Tiedosto on liian suuri
10 | Valokuvakirjasto
11 | Tuntematon
12 | Käyttöoikeudet estetty
13 | Tuo kuva kamerasta
14 | Valitse tiedosto %s
15 | Valitse kuva %s
16 | Poista valinta tiedostosta %s
17 | Poista valinta kuvasta %s
18 | Sulje kuvan valintatyökalu
19 | Myönnä oikeudet asetuksista, jotta voit lähettää liitetiedostoja
20 | Asetukset
21 |
--------------------------------------------------------------------------------
/belvedere/src/main/res/layout/belvedere_bottom_sheet.xml:
--------------------------------------------------------------------------------
1 |
2 |
12 |
13 |
24 |
25 |
33 |
34 |
--------------------------------------------------------------------------------
/belvedere/src/main/res/values-it/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Fotocamera
4 | Raccolta
5 | Comprimi menu di azioni mobile
6 | Espandi menu di azioni mobile
7 | Importa file da raccolta
8 | Importa immagine da Google Foto
9 | File troppo grande
10 | Libreria foto
11 | Sconosciuto
12 | Autorizzazioni negate
13 | Importa immagine da fotocamera
14 | Seleziona file %s
15 | Seleziona immagine %s
16 | Deseleziona file %s
17 | Deseleziona immagine %s
18 | Chiudi strumento di selezione immagini
19 | Impostazioni
20 | Per inviare allegati devi concedere le autorizzazioni nelle impostazioni
21 |
--------------------------------------------------------------------------------
/belvedere-core/src/main/java/zendesk/belvedere/IntentRegistry.java:
--------------------------------------------------------------------------------
1 | package zendesk.belvedere;
2 |
3 | import android.util.SparseArray;
4 |
5 | class IntentRegistry {
6 |
7 | private final static int START_REQUEST_CODE = 1600;
8 | private final static int END_REQUEST_CODE = 1650;
9 |
10 | private SparseArray pendingIntents;
11 |
12 | IntentRegistry() {
13 | this.pendingIntents = new SparseArray<>();
14 | }
15 |
16 | int reserveSlot() {
17 | final int requestCode;
18 | synchronized (this) {
19 | requestCode = getRequestCode();
20 | pendingIntents.put(requestCode, MediaResult.empty());
21 | }
22 | return requestCode;
23 | }
24 |
25 | void freeSlot(int requestCode) {
26 | synchronized (this) {
27 | pendingIntents.remove(requestCode);
28 | }
29 | }
30 |
31 | void updateRequestCode(int requestCode, MediaResult belvedereResult) {
32 | synchronized (this) {
33 | pendingIntents.put(requestCode, belvedereResult);
34 | }
35 | }
36 |
37 | MediaResult getForRequestCode(int requestCode) {
38 | synchronized (this) {
39 | return pendingIntents.get(requestCode);
40 | }
41 | }
42 |
43 | private int getRequestCode() {
44 | for(int i = START_REQUEST_CODE; i < END_REQUEST_CODE; i++) {
45 | if(pendingIntents.get(i) == null) {
46 | return i;
47 | }
48 | }
49 |
50 | L.d(Belvedere.LOG_TAG, "No slot free. Clearing registry.");
51 | pendingIntents.clear();
52 | return getRequestCode();
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/belvedere/src/main/res/values-pt/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Câmera
4 | Galeria
5 | Recolher menu de ação flutuante
6 | Expandir menu de ação flutuante
7 | Importar arquivo da galeria
8 | Importar imagem do Google Fotos
9 | Arquivo muito grande
10 | Biblioteca de fotos
11 | Desconhecido
12 | Permissões negadas
13 | Importar imagem da câmera
14 | Selecionar arquivo %s
15 | Selecionar imagem %s
16 | Cancelar seleção do arquivo %s
17 | Cancelar seleção da imagem %s
18 | Fechar seletor de imagens
19 | Configurações
20 | Para enviar anexos, você precisa conceder permissões nas suas configurações
21 |
--------------------------------------------------------------------------------
/belvedere/src/main/res/values-de/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Kamera
4 | Galerie
5 | Unverankertes Aktionsmenü reduzieren
6 | Unverankertes Aktionsmenü erweitern
7 | Datei aus Galerie importieren
8 | Bild aus Google Photos importieren
9 | Datei ist zu groß
10 | Fotobibliothek
11 | Unbekannt
12 | Berechtigungen abgelehnt
13 | Bild aus Kamera importieren
14 | Datei %s auswählen
15 | Bild %s auswählen
16 | Auswahl von Datei %s aufheben
17 | Auswahl von Bild %s aufheben
18 | Bildauswahl schließen
19 | Einstellungen
20 | Zum Senden von Anhängen müssen Sie in Ihren Einstellungen Berechtigungen zulassen
21 |
--------------------------------------------------------------------------------
/belvedere/src/main/res/values-nl/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Camera
4 | Galerie
5 | Zwevend actiemenu samenvouwen
6 | Zwevend actiemenu uitvouwen
7 | Bestand importeren vanuit galerie
8 | Afbeelding importeren vanuit Google Foto\'s
9 | Bestand te groot
10 | Fotoverzameling
11 | Onbekend
12 | Machtigingen geweigerd
13 | Afbeelding importeren vanaf camera
14 | Selecteer bestand %s
15 | Selecteer afbeelding %s
16 | Deselecteer bestand %s
17 | Deselecteer afbeelding %s
18 | Afbeeldingenkiezer sluiten
19 | Instellingen
20 | Als u bijlagen wilt verzenden, moet u machtigingen toestaan in uw instellingen
21 |
--------------------------------------------------------------------------------
/belvedere/src/main/res/values-pt-rBR/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Câmera
4 | Galeria
5 | Recolher menu de ação flutuante
6 | Expandir menu de ação flutuante
7 | Importar arquivo da galeria
8 | Importar imagem do Google Fotos
9 | Arquivo muito grande
10 | Biblioteca de fotos
11 | Desconhecido
12 | Permissões negadas
13 | Importar imagem da câmera
14 | Selecionar arquivo %s
15 | Selecionar imagem %s
16 | Cancelar seleção do arquivo %s
17 | Cancelar seleção da imagem %s
18 | Fechar seletor de imagens
19 | Para enviar anexos, você precisa conceder permissões nas suas configurações
20 | Configurações
21 |
--------------------------------------------------------------------------------
/belvedere/src/main/res/values-tr/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Fotoğraf makinesi
4 | Galeri
5 | Hareketli Eylem Menüsünü Daralt
6 | Hareketli Eylem Menüsünü Genişlet
7 | Galeriden içe dosya aktarın
8 | Google Fotoğraflar\'dan içe resim aktarın
9 | Dosya çok büyük
10 | Fotoğraf kitaplığı
11 | Bilinmiyor
12 | İzinler reddedildi
13 | Fotoğraf makinesinden içe resim aktarın
14 | %s adlı dosyayı seçin
15 | %s adlı resmi seçin
16 | %s adlı dosyanın seçimini kaldırın
17 | %s adlı resmin seçimini kaldırın
18 | Resim seçiciyi kapatın
19 | Ekleri göndermek için ayarlarınızda izinlere izin vermeniz gerekir
20 | Ayarlar
21 |
--------------------------------------------------------------------------------
/belvedere/src/main/res/values-hu/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Kamera
4 | Galéria
5 | A lebegő műveleti menü összecsukása
6 | A lebegő műveleti menü kibontása
7 | Fájl importálása a galériából
8 | Kép importálása a Google Fotókból
9 | Túl nagy a fájl
10 | Fotóalbum
11 | Ismeretlen
12 | Engedélyek megtagadva
13 | Kép importálása a kamerából
14 | %s nevű fájl kiválasztása
15 | %s nevű kép kiválasztása
16 | %s nevű fájl kiválasztásának megszüntetése
17 | %s nevű kép kiválasztásának megszüntetése
18 | A képválasztó bezárása
19 | Beállítások
20 | Mellékletek küldéséhez engedélyeket kell engedélyeznie a beállításokban
21 |
--------------------------------------------------------------------------------
/belvedere/src/main/res/values-ru/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Камера
4 | Галерея
5 | Свернуть плавающее меню действий
6 | Развернуть плавающее меню действий
7 | Импортировать файл из галереи
8 | Импортировать изображение из Google Photos
9 | Слишком большой файл
10 | Библиотека фото
11 | Неизвестно
12 | В доступе отказано
13 | Импортировать изображение из камеры
14 | Выбрать файл %s
15 | Выбрать изображение %s
16 | Отменить выбор файла %s
17 | Отменить выбор изображения %s
18 | Закрыть окно выбора изображения
19 | Для отправки прикрепленных файлов необходимо предоставить разрешения в настройках
20 | Настройки
21 |
--------------------------------------------------------------------------------
/belvedere/src/main/res/values-es/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Cámara
4 | Galería
5 | Contraer el menú de acciones flotante
6 | Ampliar el menú de acciones flotante
7 | Importar archivo de la galería
8 | Importar imagen de Google Fotos
9 | El archivo es muy grande
10 | Biblioteca de fotos
11 | Desconocido
12 | Permisos denegados
13 | Importar imagen de la cámara
14 | Seleccionar el archivo %s
15 | Seleccionar la imagen %s
16 | Deseleccionar el archivo %s
17 | Deseleccionar la imagen %s
18 | Cerrar el selector de imagen
19 | Configuración
20 | Para enviar archivos adjuntos es necesario permitir permisos en la configuración
21 |
--------------------------------------------------------------------------------
/belvedere/src/main/res/values-el/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Κάμερα
4 | Συλλογή εικόνων
5 | Σύμπτυξη κινούμενου μενού ενεργειών
6 | Επέκταση κινούμενου μενού ενεργειών
7 | Εισαγωγή αρχείου από τη συλλογή εικόνων
8 | Εισαγωγή εικόνας από τις Φωτογραφίες Google
9 | Το αρχείο είναι πολύ μεγάλο
10 | Βιβλιοθήκη φωτογραφιών
11 | Άγνωστος
12 | Δεν έχει δοθεί άδεια
13 | Εισαγωγή εικόνας από την κάμερα
14 | Επιλογή αρχείου %s
15 | Επιλογή εικόνας %s
16 | Κατάργηση επιλογής αρχείου %s
17 | Κατάργηση επιλογής εικόνας%s
18 | Κλείσιμο εργαλείου επιλογής εικόνας
19 | Για να στείλετε συνημμένα, πρέπει να επιτρέψετε δικαιώματα στις ρυθμίσεις σας
20 | Ρυθμίσεις
21 |
--------------------------------------------------------------------------------
/belvedere/src/main/res/values-bg/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Камера
4 | Галерия
5 | Свиване на плаващото меню „Действие“
6 | Разгъване на плаващото меню „Действие“
7 | Импортиране на файл от галерията
8 | Импортиране на снимки от Google Снимки
9 | Файлът е твърде голям
10 | Библиотека със снимки
11 | Непознат тип файл
12 | Отказани разрешения
13 | Импорт на изображение от камерата
14 | Избиране на файл %s
15 | Избиране на изображение %s
16 | Премахване на избора на файл %s
17 | Премахване на избора на изображение %s
18 | Затваряне на избирача на изображения
19 | Настройки
20 | За да изпращате прикачени файлове, трябва да активирате разрешенията в настройките си
21 |
--------------------------------------------------------------------------------
/belvedere/src/main/res/values-fr/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Appareil photo
4 | Galerie
5 | Réduire le menu Actions flottant
6 | Développer le menu Actions flottant
7 | Importer le fichier à partir de la galerie
8 | Importer l’image à partir de Google Photos
9 | Fichier trop volumineux
10 | Bibliothèque de photos
11 | Inconnu
12 | Permissions refusées
13 | Importer l’image à partir de l’appareil photo
14 | Sélectionner le fichier %s
15 | Sélectionner l’image %s
16 | Désélectionner le fichier %s
17 | Désélectionner l’image %s
18 | Fermer le sélecteur d’image
19 | Paramètres
20 | Pour envoyer des pièces jointes, vous devez autoriser les permissions dans vos paramètres.
21 |
--------------------------------------------------------------------------------
/belvedere/src/main/res/values-fil/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Camera
4 | Gallery
5 | I-collapse ang Floating na Menu ng Pagkilos
6 | I-expand ang Floating na Menu ng Pagkilos
7 | Mag-import ng file mula sa gallery
8 | Mag-import ng larawan mula sa Google Photos
9 | Masyadong malaki ang file
10 | Library ng larawan
11 | Hindi kilala
12 | Tinanggihan ang mga pahintulot
13 | Mag-import ng larawan mula sa camera
14 | Piliin ang file na %s
15 | Piliin ang larawan na %s
16 | I-unselect ang file na %s
17 | I-unselect ang larawan na %s
18 | Isara ang picker ng larawan
19 | Mga Setting
20 | Para magpadala ng mga kalakip, kailangan mong payagan ang mga pahintulot sa iyong mga setting
21 |
--------------------------------------------------------------------------------
/belvedere/src/main/res/values-fr-rCA/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Appareil photo
4 | Galerie
5 | Réduire le menu Actions flottant
6 | Développer le menu Actions flottant
7 | Importer le fichier à partir de la galerie
8 | Importer l’image à partir de Google Photos
9 | Fichier trop volumineux
10 | Bibliothèque de photos
11 | Inconnu
12 | Permissions refusées
13 | Importer l’image à partir de l’appareil photo
14 | Sélectionner le fichier %s
15 | Sélectionner l’image %s
16 | Désélectionner le fichier %s
17 | Désélectionner l’image %s
18 | Fermer le sélecteur d’image
19 | Pour envoyer des pièces jointes, vous devez autoriser les permissions dans vos paramètres.
20 | Paramètres
21 |
--------------------------------------------------------------------------------
/belvedere/src/main/res/values/belvedere_imagestream_styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 350dp
6 | 4dp
7 | 4dp
8 | 2dp
9 | 220dp
10 | 8dp
11 | 0dp
12 | 12dp
13 | 8dp
14 |
15 |
16 | #fff5f5f5
17 | #ffffffff
18 | #89000000
19 | #ffffffff
20 | #17494D
21 | #FFFFFF
22 | #00A656
23 |
24 |
25 | 150
26 | 45
27 | 50
28 | 2
29 |
30 |
31 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/belvedere/src/main/java/zendesk/belvedere/ImageStreamMvp.java:
--------------------------------------------------------------------------------
1 | package zendesk.belvedere;
2 |
3 | import android.view.View.OnClickListener;
4 |
5 | import java.util.List;
6 |
7 | interface ImageStreamMvp {
8 |
9 | interface Model {
10 |
11 | List getLatestImages();
12 |
13 | boolean hasCameraIntent();
14 |
15 | boolean hasDocumentIntent();
16 |
17 | boolean hasGooglePhotosIntent();
18 |
19 | MediaIntent getCameraIntent();
20 |
21 | MediaIntent getDocumentIntent();
22 |
23 | MediaIntent getGooglePhotosIntent();
24 |
25 | List getSelectedMediaResults();
26 |
27 | List addToSelectedItems(MediaResult mediaResult);
28 |
29 | List removeFromSelectedItems(MediaResult mediaResult);
30 |
31 | long getMaxFileSize();
32 |
33 | boolean showFullScreenOnly();
34 |
35 | }
36 |
37 | interface View {
38 |
39 | void initViews(boolean fullScreenOnly);
40 |
41 | void showImageStream(List images, List selectedImages, boolean fullScreenOnly, boolean showCamera, ImageStreamAdapter.Listener listener);
42 |
43 | void showDocumentMenuItem(OnClickListener onClickListener);
44 |
45 | void showGooglePhotosMenuItem(OnClickListener onClickListener);
46 |
47 | void openMediaIntent(MediaIntent mediaIntent, ImageStream imageStream);
48 |
49 | void showToast(int textId);
50 |
51 | void updateToolbarTitle(int selectedImages);
52 |
53 | boolean shouldShowFullScreen();
54 |
55 | void updateFloatingActionButton(int selectedImages);
56 | }
57 |
58 | interface Presenter {
59 |
60 | void init();
61 |
62 | void onImageStreamScrolled(int height, int scrollArea, float scrollPosition);
63 |
64 | void dismiss();
65 |
66 | void sendSelectedImages();
67 | }
68 |
69 | }
70 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: android
2 | dist: trusty
3 | jdk:
4 | - oraclejdk8
5 | before_cache:
6 | - rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
7 | cache:
8 | directories:
9 | - "$HOME/.gradle/caches/"
10 | - "$HOME/.gradle/wrapper/"
11 | android:
12 | components:
13 | - tools
14 | - android-30
15 | - platform-tools
16 | - extra-android-m2repository
17 | licenses:
18 | - android-sdk-license-[0-9a-f]{8}
19 | - android-sdk-preview-license-[0-9a-f]{8}
20 | branches:
21 | only:
22 | - master
23 | env:
24 | global:
25 | # zdOssRepoUsername
26 | - secure: IP1UCgXVbhtDbryYe/AeLbELh3s7oCnGJ9sruJbUCl8ua2tPmLl8s5c0ydpLq1f4FElDeHLXkTn7yUOVwELZd0+CPpjxv0g4SGPh2AnvPEeI/LV3bN14RTg3HqJCtXeDuskY9ApNKxgQ36tCbW+yETjPwSh9ZgND7RTgph3q7T8uqQQ6X8dafVNkL6+CiVyoG3H7fHK0+1EO1/9mZN05YRZzfc1jgbp0Riefl4Gahfy0cFWaPtgo06wx8nKLOGx1UgK2h4IDulDtOM+e/c2JyPn8Z/OrB7qIEcgPzdNi2jN5VDc9+tIiR2AxuLmzRIMl+/CgvuWj93An4MNexGpuaAmZdKsB/MCemRjs6lnNmhz/UYIJ5wcdugmYdMciR5b4LKkkZZG3hzDHTc6ooeCzEtUKGdmMohbYYtDJT1UIpw6W4qQYB9yV5Y8GUJTIk68xTY30c3+ITgWHEf9g++NJV4frbvUWr9zMJ4PXWd7SxhaXGw1rGtUvb8lMB9ssnbxDq+HFsIt9GBOAvXoXAUAeIaRes2D3f+wtWA3k2h5DTJqU9LIHaBtU3oGbeqKMOaCoxwh64MBlD/f+hmaV3kB6Z1QUhYXdWJ+A7ybrl+0QzcfHCJ2Dsj+4fWvIAJ/U9JTfY1ANUy8fFTlegdTwHpOETkqtZH+3yohKfbnuUCSpE0E=
27 | # zdOssRepoPassword
28 | - secure: aUPxQ445lKEHCAAW1HvahabocpwoeH9esFE89agku8DhbrOGnTPswmwaVJu4uPLQEWSpbkwhhBEUgq1aEWdARgd7ovnhG9molGfHocL2yyUOQxLfQq/ZO5aBLN32JtpIR3O92Z3XDAHfqdF3ZEkSOfACoOPiUQPmhIpSg85dVt9TIMVwxVrZ25z6LiEXQw7ePMrN3iYUCtHbPEk7AmrxrR1B62eKf698CfVsO4Ny40mPL2l5kTaVxVVkL1a6q4EDeTCPcgFVsu7TnW1TcS6b0Rdb9UMq/FjmvAby/QW2URhChl6pPTxdFEoJrICyOLP5bk7sDQIqljlUpjrlWAD5VW1Qj1qbyv3QzPHv8l7hAvOaxZtnEQTxOfx6fsZQ/E1ljPCReW/43rrdhDbsChZdg8dZxrc4SAeIH4dspQzZs2ksIV1x4uHRxTeOftdnEt2A8xueyFPey2uNkENtW/Ra/En5cC0hcieFSd8GiCJuFpSl0oln+BhQoh8Hy1RaIM7QDNOfKO1PgtqKgK+FAnVftYHlUbr6IrLlPc2ZeeiLafCY1no/B34RkN2XG0rH2MwRo71UYfASVfD4TpFYjxBAR8lH2u8AxpBVV0E93X6eaPQ7tgV+jOLDW9dw8ecHtwu0POmGOQvjNhxxBtwIF9g7QuQi62yYEfYUYsjY0oZzycQ=
29 | script:
30 | - "./scripts/build.sh"
31 |
--------------------------------------------------------------------------------
/belvedere/build.gradle:
--------------------------------------------------------------------------------
1 |
2 | ext {
3 | artifactId = 'belvedere'
4 | javadocTitle = "Belvedere - ${rootProject.ext.versionName}"
5 | packaging = 'aar'
6 | }
7 |
8 | apply plugin: 'com.android.library'
9 | apply plugin: 'kotlin-android'
10 | apply from: '../scripts/gradle/zendesk-deploy.gradle'
11 | apply from: '../scripts/gradle/gradle-commons.gradle'
12 |
13 | android {
14 | compileSdkVersion rootProject.ext.compileSdkVersion
15 |
16 | defaultConfig {
17 | minSdkVersion rootProject.ext.minSdkVersionUi
18 | targetSdkVersion rootProject.ext.targetSdkVersion
19 | versionCode 1
20 | versionName rootProject.ext.versionName
21 | consumerProguardFiles 'consumer-proguard.pro'
22 |
23 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
24 | }
25 |
26 | lintOptions {
27 | abortOnError false
28 | }
29 |
30 | testOptions {
31 | unitTests.returnDefaultValues = true
32 | }
33 | }
34 |
35 | dependencies {
36 | if (useLocalDependency()) {
37 | api project(':belvedere-core')
38 | } else {
39 | api group: 'com.zendesk.belvedere2', name: 'belvedere-core', version: rootProject.ext.versionName, changing: true
40 | }
41 |
42 | implementation "androidx.annotation:annotation:$annotationVersion"
43 | implementation "androidx.core:core:$androidxCoreVersion"
44 | implementation "androidx.fragment:fragment:$fragmentVersion"
45 | implementation "com.google.android.material:material:$materialVersion"
46 |
47 | implementation "com.squareup.picasso:picasso:$picassoVersion"
48 |
49 | // Unit tests
50 | testImplementation group: 'junit', name: 'junit', version: '4.12'
51 | testImplementation group: 'org.mockito', name: 'mockito-core', version: '2.19.1'
52 | testImplementation group: 'org.jetbrains.kotlin', name: 'kotlin-stdlib', version: rootProject.ext.kotlinVersion
53 | testImplementation group: 'com.google.truth', name: 'truth', version: '0.39'
54 | }
55 |
--------------------------------------------------------------------------------
/belvedere/src/main/res/values/styles_deprecated.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
13 |
14 |
15 |
16 |
22 |
23 |
24 |
25 |
26 |
32 |
33 |
34 |
35 |
36 |
44 |
45 |
46 |
47 |
--------------------------------------------------------------------------------
/scripts/build.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | # common stuff
4 | isPullRequest() {
5 | # Bash treats 0 as non-failure/success and non-zero as failure
6 | [[ "$GITHUB_EVENT_NAME" == "pull_request" ]] && return 0 || return 255
7 | }
8 |
9 | exitOnFailedBuild() {
10 | if [ $? -ne 0 ]; then
11 | exit 1
12 | fi
13 | }
14 |
15 | boxOut(){
16 | local s="$*"
17 | tput setaf 3
18 | echo -e " =${s//?/=}=\n| $(tput setaf 4)$s$(tput setaf 3) |\n =${s//?/=}=\n"
19 | tput sgr 0
20 | }
21 |
22 | acceptLicenses() {
23 | mkdir -p ${ANDROID_HOME}licenses
24 | echo -e "\nd56f5187479451eabf01fb78af6dfcb131a6481e\n24333f8a63b6825ea9c5514f83c2829b004d1fee" > ${ANDROID_HOME}licenses/android-sdk-license
25 | }
26 |
27 | buildBelvedere() {
28 | ./gradlew :belvedere-core:assembleRelease :belvedere:assembleRelease
29 | exitOnFailedBuild
30 | }
31 |
32 | testBelvedere() {
33 | ./gradlew clean :belvedere-core:lintRelease :belvedere:lintRelease :belvedere-core:testRelease :belvedere:testRelease
34 | exitOnFailedBuild
35 | }
36 |
37 | uploadSnapshotSdk() {
38 | export LOCAL_BUILD="false"
39 |
40 | ./gradlew --settings-file scripts/gradle/build-belvedere-core.gradle -Pandroid.useAndroidX=true clean :belvedere-core:uploadArchive
41 | exitOnFailedBuild
42 |
43 | ./gradlew --settings-file scripts/gradle/build-belvedere.gradle -Pandroid.useAndroidX=true clean :belvedere:uploadArchive
44 | exitOnFailedBuild
45 |
46 | buildSampleApp
47 | exitOnFailedBuild
48 |
49 | unset LOCAL_BUILD
50 | }
51 |
52 | # SampleApp specific stuff
53 | buildSampleApp() {
54 | ./gradlew :belvedere-sample:assembleTravis
55 | exitOnFailedBuild
56 | }
57 |
58 | uploadSampleApp() {
59 | ./gradlew :SampleApp:uploadDebugToHockeyApp
60 | exitOnFailedBuild
61 | }
62 |
63 | # Build types
64 | pullRequestBuild() {
65 | export LOCAL_BUILD="true"
66 |
67 | boxOut "Build Belvedere Core SDK"
68 | buildBelvedere
69 |
70 | boxOut "Test Belvedere"
71 | testBelvedere
72 |
73 | boxOut "Build Sample App"
74 | buildSampleApp
75 |
76 | unset LOCAL_BUILD
77 | }
78 |
79 | branchBuild() {
80 | pullRequestBuild
81 |
82 | boxOut "Upload Belvedere Snapshots"
83 | uploadSnapshotSdk
84 | }
85 |
86 | acceptLicenses
87 |
88 | # do the thing
89 | if isPullRequest ; then
90 | boxOut "This is a PR"
91 | pullRequestBuild
92 | else
93 | boxOut "This is not a PR"
94 | branchBuild
95 | fi
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | set DIRNAME=%~dp0
12 | if "%DIRNAME%" == "" set DIRNAME=.
13 | set APP_BASE_NAME=%~n0
14 | set APP_HOME=%DIRNAME%
15 |
16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17 | set DEFAULT_JVM_OPTS=
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windows variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 |
53 | :win9xME_args
54 | @rem Slurp the command line arguments.
55 | set CMD_LINE_ARGS=
56 | set _SKIP=2
57 |
58 | :win9xME_args_slurp
59 | if "x%~1" == "x" goto execute
60 |
61 | set CMD_LINE_ARGS=%*
62 |
63 | :execute
64 | @rem Setup the command line
65 |
66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
67 |
68 | @rem Execute Gradle
69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
70 |
71 | :end
72 | @rem End local scope for the variables with windows NT shell
73 | if "%ERRORLEVEL%"=="0" goto mainEnd
74 |
75 | :fail
76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
77 | rem the _cmd.exe /c_ return code!
78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
79 | exit /b 1
80 |
81 | :mainEnd
82 | if "%OS%"=="Windows_NT" endlocal
83 |
84 | :omega
85 |
--------------------------------------------------------------------------------
/belvedere/src/main/java/zendesk/belvedere/ImageStreamService.java:
--------------------------------------------------------------------------------
1 | package zendesk.belvedere;
2 |
3 | import android.content.Context;
4 | import android.database.Cursor;
5 | import android.net.Uri;
6 | import android.os.Build;
7 | import android.provider.MediaStore;
8 | import android.text.TextUtils;
9 | import android.webkit.MimeTypeMap;
10 |
11 | import java.util.ArrayList;
12 | import java.util.List;
13 |
14 | class ImageStreamService {
15 |
16 | private final Context context;
17 | private final ImageStreamCursorProvider imageStreamCursorProvider;
18 |
19 | ImageStreamService(Context context) {
20 | this.context = context.getApplicationContext();
21 | this.imageStreamCursorProvider = new ImageStreamCursorProvider(context, Build.VERSION.SDK_INT);
22 | }
23 |
24 | List queryRecentImages(int count) {
25 | final List mediaResults = new ArrayList<>();
26 |
27 | final Cursor cursor = imageStreamCursorProvider.getCursor(count);
28 |
29 | try {
30 | if (cursor != null) {
31 | while (cursor.moveToNext()) {
32 | final Uri uri = MediaStore.Files.getContentUri("external",
33 | cursor.getLong(cursor.getColumnIndex(MediaStore.Images.ImageColumns._ID)));
34 |
35 | final long size = cursor.getLong(cursor.getColumnIndex(MediaStore.MediaColumns.SIZE));
36 | final long width = cursor.getLong(cursor.getColumnIndex(MediaStore.MediaColumns.WIDTH));
37 | final long height = cursor.getLong(cursor.getColumnIndex(MediaStore.MediaColumns.HEIGHT));
38 | final String name = cursor.getString(cursor.getColumnIndex(MediaStore.MediaColumns.DISPLAY_NAME));
39 |
40 | String mimeType = "image/jpeg";
41 | if (!TextUtils.isEmpty(name)) {
42 | final int index = name.lastIndexOf(".");
43 | if (index != -1) {
44 | mimeType = MimeTypeMap.getSingleton().getMimeTypeFromExtension(name.substring(index + 1));
45 | }
46 | }
47 |
48 | mediaResults.add(new MediaResult(null, uri, uri, name, mimeType, size, width, height));
49 | }
50 | }
51 | } finally {
52 | if (cursor != null) {
53 | cursor.close();
54 | }
55 | }
56 |
57 | return mediaResults;
58 | }
59 |
60 | boolean isAppAvailable(String packageName) {
61 | return Utils.isAppAvailable(packageName, context);
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/belvedere-sample/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
9 |
10 | #ffefefef
11 |
12 |
15 |
16 |
17 |
18 |
29 |
30 |
39 |
40 |
43 |
44 |
48 |
49 |
50 |
51 |
52 |
--------------------------------------------------------------------------------
/belvedere-core/src/main/java/zendesk/belvedere/PermissionUtil.java:
--------------------------------------------------------------------------------
1 | package zendesk.belvedere;
2 |
3 | import android.content.Context;
4 | import android.content.pm.PackageInfo;
5 | import android.content.pm.PackageManager;
6 |
7 | import androidx.core.content.ContextCompat;
8 |
9 | /**
10 | * Set of helpers around Android-M permissions.
11 | */
12 | class PermissionUtil {
13 |
14 | /**
15 | * Check if the user has granted the specified permission.
16 | *
17 | * @param context A valid application {@link Context}
18 | * @param permissionName Name of the permission
19 | * @return {@code true} if the permission was granted, {@code false} if not
20 | */
21 | static boolean isPermissionGranted(Context context, String permissionName) {
22 | return ContextCompat.checkSelfPermission(context, permissionName) == PackageManager.PERMISSION_GRANTED;
23 | }
24 |
25 | /**
26 | * Check if the user has granted a collection of permissions.
27 | * @param context A valid application {@link Context}
28 | * @param permissions list of permission to be checked
29 | * @return true if all permissions were granted, otherwise false.
30 | */
31 | static boolean isPermissionGranted(Context context, String... permissions) {
32 | if (context != null && permissions != null) {
33 | for (String permission : permissions) {
34 | if (ContextCompat.checkSelfPermission(context, permission) != PackageManager.PERMISSION_GRANTED) {
35 | return false;
36 | }
37 | }
38 | }
39 | return true;
40 | }
41 |
42 | /**
43 | * Internal helper method for checking, if a permission is declared in the
44 | * glorious {@code AndroidManifest.xml}.
45 | *
46 | * @param context A valid application {@link Context}
47 | * @param permissionName Name of the permission
48 | * @return {@code true} if permissions is declared, {@code false} if not
49 | */
50 | static boolean hasPermissionInManifest(Context context, String permissionName) {
51 | final String packageName = context.getPackageName();
52 | try {
53 | final PackageInfo packageInfo = context.getPackageManager()
54 | .getPackageInfo(packageName, PackageManager.GET_PERMISSIONS);
55 | final String[] declaredPermissions = packageInfo.requestedPermissions;
56 | if (declaredPermissions != null && declaredPermissions.length > 0) {
57 | for (String p : declaredPermissions) {
58 | if (p.equals(permissionName)) {
59 | return true;
60 | }
61 | }
62 | }
63 | } catch (Exception e) {
64 | // intentionally empty
65 | }
66 |
67 | return false;
68 | }
69 | }
--------------------------------------------------------------------------------
/docs/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Generated Documentation (Untitled)
7 |
60 |
61 |
72 |
73 |
--------------------------------------------------------------------------------
/belvedere/src/main/res/layout/belvedere_image_stream.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
13 |
14 |
23 |
24 |
36 |
37 |
38 |
39 |
47 |
48 |
54 |
55 |
64 |
65 |
71 |
72 |
73 |
74 |
75 |
--------------------------------------------------------------------------------
/belvedere-core/src/main/java/zendesk/belvedere/BelvedereFileProvider.java:
--------------------------------------------------------------------------------
1 | package zendesk.belvedere;
2 |
3 | import android.database.Cursor;
4 | import android.database.MatrixCursor;
5 | import android.net.Uri;
6 | import android.provider.MediaStore;
7 | import android.util.Log;
8 |
9 | import androidx.annotation.RestrictTo;
10 | import androidx.core.content.FileProvider;
11 |
12 | import java.util.Arrays;
13 |
14 | /**
15 | * Belvedere's own {@link FileProvider}.
16 | *
17 | * Some Apps rely on {@link MediaStore.MediaColumns#DATA}. This custom {@link FileProvider}
18 | * adds a workaround for preventing them to crash.
19 | *
20 | * @see http://stackoverflow.com/a/25020642/4907293
21 | */
22 | @RestrictTo(RestrictTo.Scope.LIBRARY)
23 | public class BelvedereFileProvider extends FileProvider {
24 |
25 | @Override
26 | public Cursor query(final Uri uri, final String[] projection, final String selection,
27 | final String[] selectionArgs, final String sortOrder) {
28 | final Cursor source = super.query(uri, projection, selection, selectionArgs, sortOrder);
29 |
30 | /*
31 | It's not necessary to overwrite
32 | public Cursor query(final Uri uri, final String[] projection, final String selection, final String[]
33 | selectionArgs, final String sortOrder, final CancellationSignal cancellationSignal);
34 | cause it calls this method.
35 |
36 | == What's happening here? ==
37 | Some apps rely on the MediaStore.MediaColumns.DATA column in the cursor. To prevent them
38 | from crashing, we have to copy the initial cursor and add the MediaStore.MediaColumns.DATA
39 | column. The values of this column will always be null, but we assume that they are able
40 | to handle that case.
41 | */
42 |
43 | if(source == null) {
44 | Log.w(Belvedere.LOG_TAG, "Not able to apply workaround, super.query(...) returned null");
45 | return null;
46 | }
47 |
48 | String[] columnNames = source.getColumnNames();
49 | String[] newColumnNames = columnNamesWithData(columnNames);
50 |
51 | final MatrixCursor cursor = new MatrixCursor(newColumnNames, source.getCount());
52 |
53 | source.moveToPosition(-1);
54 | while (source.moveToNext()) {
55 | MatrixCursor.RowBuilder row = cursor.newRow();
56 | for (int i = 0; i < columnNames.length; i++) {
57 | row.add(source.getString(i));
58 | }
59 | }
60 | source.close();
61 |
62 | return cursor;
63 | }
64 |
65 |
66 | private String[] columnNamesWithData(String[] columnNames) {
67 | for (String columnName : columnNames){
68 | if (MediaStore.MediaColumns.DATA.equals(columnName)){
69 | return columnNames;
70 | }
71 | }
72 |
73 | String[] newColumnNames = Arrays.copyOf(columnNames, columnNames.length + 1);
74 | newColumnNames[columnNames.length] = MediaStore.MediaColumns.DATA;
75 | return newColumnNames;
76 | }
77 | }
78 |
--------------------------------------------------------------------------------
/belvedere-sample/src/main/res/layout/chat_activity.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
18 |
19 |
23 |
24 |
31 |
32 |
40 |
41 |
51 |
52 |
60 |
61 |
71 |
72 |
73 |
74 |
75 |
--------------------------------------------------------------------------------
/docs/allclasses-noframe.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | All Classes
7 |
8 |
9 |
10 |
11 |
12 |
118 |
119 |
120 |
121 |
--------------------------------------------------------------------------------
/MobileSDKBelvedere.yml:
--------------------------------------------------------------------------------
1 | title: "MobileSDKBelvedere"
2 | packages:
3 | - MobileSDKBelvedere
4 | - enduser_sdk
5 |
6 | parts:
7 | # Dialog
8 | - translation:
9 | key: "bsdk_belvedere_dialog_gallery"
10 | title: "Label of a button that allows the user to select an image from the image gallery"
11 | value: "Gallery"
12 | - translation:
13 | key: "bsdk_belvedere_dialog_camera"
14 | title: "Label of a button that allows the user to select an image from the image gallery"
15 | value: "Camera"
16 | # Image stream
17 | - translation:
18 | key: "bsdk_belvedere_image_stream_title"
19 | title: "Title, presented at the top of the screen to indicate the title of the screen being shown"
20 | screenshot: "https://zendesk.box.com/s/xul0f82agfhf756q8bzm9pi02i0dlm0w"
21 | value: "Photo library"
22 | - translation:
23 | key: "bsdk_belvedere_image_stream_unknown_app"
24 | title: "Fallback app label, shown to the user if there's no application on the phone that can handle the file"
25 | screenshot: "https://zendesk.box.com/s/hnr1woe4ewrirxvm3d33edrohnvnmham"
26 | value: "Unknown"
27 | - translation:
28 | key: "bsdk_belvedere_image_stream_file_too_large"
29 | title: "Error toast, shown if the user selects a file that is too large."
30 | screenshot: "https://zendesk.box.com/s/uidxae5w6sxp2andunved2exmtazx2dx"
31 | value: "File too large"
32 | - translation:
33 | key: "bsdk_belvedere_permissions_denied"
34 | title: "Error toast, shown if the user hasn't granted the needed system permissions for showing the image picker."
35 | screenshot: "https://zendesk.box.com/s/a8j83m0grw5yol3fhp6qodxqbi2a0wkw"
36 | value: "Permissions denied"
37 | - translation:
38 | key: "bsdk_belvedere_attachment_permissions_rationale"
39 | title: "Message show when the user tries to attach a file and required permissions have been denied"
40 | value: "To send attachments, you need to allow permissions in your settings"
41 | screenshot: "https://drive.google.com/file/d/1ZVWspcIZ4oUwnTz8it9G23ndOf5juUtF/view?usp=sharing"
42 | - translation:
43 | key: "bsdk_belvedere_navigate_to_settings"
44 | title: "Label for settings"
45 | screenshot: "https://drive.google.com/file/d/1ZVWspcIZ4oUwnTz8it9G23ndOf5juUtF/view?usp=sharing"
46 | value: "Settings"
47 | # Image stream - talk back
48 | - translation:
49 | key: "bsdk_belvedere_fam_desc_expand_fam"
50 | title: "Accessibility, talk back. Gets read out when the user selects the collapsed floating action menu button"
51 | value: "Expand Floating Action Menu"
52 | - translation:
53 | key: "bsdk_belvedere_fam_desc_collapse_fam"
54 | title: "Accessibility, talk back. Gets read out when the user selects the expanded floating action menu button"
55 | value: "Collapse Floating Action Menu"
56 | - translation:
57 | key: "bsdk_belvedere_fam_desc_open_gallery"
58 | title: "Accessibility, talk back. Gets read out when the user selects the floating action button for importing an image from the gallery"
59 | value: "Import file from gallery"
60 | - translation:
61 | key: "bsdk_belvedere_fam_desc_open_google_photos"
62 | title: "Accessibility, talk back. Gets read out when the user selects the floating action button for importing an image from google photos"
63 | value: "Import image from Google Photos"
64 | - translation:
65 | key: "bsdk_belvedere_toolbar_desc_collapse"
66 | title: "Accessibility, talk back. Gets read out when the user selects the close button for hiding the image picker"
67 | value: "Close image picker"
68 | - translation:
69 | key: "bsdk_belvedere_stream_item_camera_tile_desc"
70 | title: "Accessibility, talk back. Gets read out when the user selects the tile for importing an image from the camera"
71 | value: "Import image from camera"
72 | - translation:
73 | key: "bsdk_belvedere_stream_item_select_file_desc"
74 | title: "Accessibility, talk back. Gets read out when the user selects an unselected file from the list. %s gets replaced with the file name"
75 | value: "Select file %s"
76 | - translation:
77 | key: "bsdk_belvedere_stream_item_unselect_file_desc"
78 | title: "Accessibility, talk back. Gets read out when the user selects a selected file from the list. %s gets replaced with the file name"
79 | value: "Unselect file %s"
80 | - translation:
81 | key: "bsdk_belvedere_stream_item_select_image_desc"
82 | title: "Accessibility, talk back. Gets read out when the user selects an unselected image from the list. %s gets replaced with the image name"
83 | value: "Select image %s"
84 | - translation:
85 | key: "bsdk_belvedere_stream_item_unselect_image_desc"
86 | title: "Accessibility, talk back. Gets read out when the user selects a selected image from the list. %s gets replaced with the image name"
87 | value: "Unselect image %s"
88 |
--------------------------------------------------------------------------------
/docs/constant-values.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Constant Field Values
7 |
8 |
9 |
10 |
11 |
12 |
22 |
25 |
26 |
21 | * We try to open an {@link InputStream} from an {@link Uri}
22 | * by calling {@link ContentResolver#openInputStream(Uri)}.
23 | * If an {@link InputStream} was successfully opened, the file will
24 | * be copied into the private cache of the app.
25 | *