use Commons for sharing events

This commit is contained in:
tibbi 2017-10-30 18:09:50 +01:00
parent 00dd6844ea
commit 120c844405
25 changed files with 15 additions and 47 deletions

View File

@ -44,7 +44,7 @@ ext {
}
dependencies {
compile 'com.simplemobiletools:commons:2.34.2'
compile 'com.simplemobiletools:commons:2.34.3'
compile 'joda-time:joda-time:2.9.1'
compile 'com.facebook.stetho:stetho:1.4.1'
compile 'com.bignerdranch.android:recyclerview-multiselect:0.2'

View File

@ -148,12 +148,12 @@
<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="com.simplemobiletools.calendar.fileprovider"
android:authorities="${applicationId}.provider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/filepaths"/>
android:resource="@xml/provider_paths"/>
</provider>
</application>
</manifest>

View File

@ -1,11 +1,12 @@
package com.simplemobiletools.calendar.extensions
import android.app.Activity
import android.content.Intent
import android.support.v4.content.FileProvider
import com.simplemobiletools.calendar.BuildConfig
import com.simplemobiletools.calendar.R
import com.simplemobiletools.calendar.activities.SimpleActivity
import com.simplemobiletools.calendar.helpers.IcsExporter
import com.simplemobiletools.commons.extensions.getFilePublicUri
import com.simplemobiletools.commons.extensions.shareUri
import com.simplemobiletools.commons.extensions.toast
import java.io.File
@ -19,21 +20,8 @@ fun SimpleActivity.shareEvents(ids: List<Int>) {
val events = dbHelper.getEventsWithIds(ids)
IcsExporter().exportEvents(this, file, events) {
if (it == IcsExporter.ExportResult.EXPORT_OK) {
val uri = FileProvider.getUriForFile(this, "com.simplemobiletools.calendar.fileprovider", file)
val shareTitle = resources.getString(R.string.share_via)
Intent().apply {
action = Intent.ACTION_SEND
addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
setDataAndType(uri, contentResolver.getType(uri))
putExtra(Intent.EXTRA_STREAM, uri)
type = "text/calendar"
if (resolveActivity(packageManager) != null) {
startActivity(Intent.createChooser(this, shareTitle))
} else {
toast(R.string.no_app_for_ics)
}
}
val uri = getFilePublicUri(file, BuildConfig.APPLICATION_ID)
shareUri(uri, BuildConfig.APPLICATION_ID)
}
}
}

View File

@ -11,7 +11,6 @@
<string name="add_some_events">Gallout a rit ouzhpennañ reoù gant an afell \"Mui\" en traoñ.</string>
<string name="details">Munudoù</string>
<string name="go_to_today">Mont da hiziv</string>
<string name="no_app_for_ics">N\'eus bet kavet arload ebet gouest da verañ restroù .ics</string>
<string name="snooze">Daleañ</string>
<!-- Widget titles -->

View File

@ -11,7 +11,6 @@
<string name="add_some_events">Přidejte událost tlačítkem Plus dole.</string>
<string name="details">Detaily</string>
<string name="go_to_today">Přejít na dnešek</string>
<string name="no_app_for_ics">Žádná aplikace schopná pracovat s příponami .ics nebyla nalezena</string>
<string name="snooze">Snooze</string>
<!-- Widget titles -->

View File

@ -11,7 +11,6 @@
<string name="add_some_events">Du kannst neue Termine mit dem Plus Button unten rechts erstellen.</string>
<string name="details">Details</string>
<string name="go_to_today">Gehe zu Heute</string>
<string name="no_app_for_ics">Keine Applikation kann .ics Dateien handhaben</string>
<string name="snooze">Snooze</string>
<!-- Widget titles -->

View File

@ -11,7 +11,6 @@
<string name="add_some_events">Puede añadir algunos con el botón Más en la parte inferior.</string>
<string name="details">Detalles</string>
<string name="go_to_today">Ir al día de hoy</string>
<string name="no_app_for_ics">No se ha encontrado ninguna aplicación capaz de manejar archivos .ics</string>
<string name="snooze">Snooze</string>
<!-- Widget titles -->

View File

@ -11,7 +11,6 @@
<string name="add_some_events">Vous pouvez ajouter des événements avec le bouton + en bas.</string>
<string name="details">Détails</string>
<string name="go_to_today">Aller à aujourd\'hui</string>
<string name="no_app_for_ics">Aucune app capable de manipuler des fichier .ics n\'a été trouvée</string>
<string name="snooze">Snooze</string>
<!-- Titres des widgets -->

View File

@ -11,7 +11,6 @@
<string name="add_some_events">You can add some with the Plus button at the bottom.</string>
<string name="details">विवरण</string>
<string name="go_to_today">Go to today</string>
<string name="no_app_for_ics">No app capable of handling .ics files has been found</string>
<string name="snooze">Snooze</string>
<!-- Widget titles -->

View File

@ -11,7 +11,6 @@
<string name="add_some_events">You can add some with the Plus button at the bottom.</string>
<string name="details">Részletek</string>
<string name="go_to_today">Go to today</string>
<string name="no_app_for_ics">No app capable of handling .ics files has been found</string>
<string name="snooze">Snooze</string>
<!-- Widget titles -->

View File

@ -11,7 +11,6 @@
<string name="add_some_events">You can add some with the Plus button at the bottom.</string>
<string name="details">Dettagli</string>
<string name="go_to_today">Go to today</string>
<string name="no_app_for_ics">Nessuna applicazione trovata capace di gestire l\'estensione .ics</string>
<string name="snooze">Snooze</string>
<!-- Widget titles -->

View File

@ -11,7 +11,6 @@
<string name="add_some_events">ניתן להוסיף אירועים בעזרת כפתור הפלוס למטה.</string>
<string name="details">פרטים</string>
<string name="go_to_today">Go to today</string>
<string name="no_app_for_ics">No app capable of handling .ics files has been found</string>
<string name="snooze">Snooze</string>
<!-- Widget titles -->

View File

@ -11,7 +11,6 @@
<string name="add_some_events">You can add some with the Plus button at the bottom.</string>
<string name="details">詳細</string>
<string name="go_to_today">Go to today</string>
<string name="no_app_for_ics">No app capable of handling .ics files has been found</string>
<string name="snooze">Snooze</string>
<!-- Widget titles -->

View File

@ -11,7 +11,6 @@
<string name="add_some_events">아래의 더하기 버튼을 눌러 추가할 수 있습니다.</string>
<string name="details">상세</string>
<string name="go_to_today">오늘로 이동</string>
<string name="no_app_for_ics">.ics 파일을 찾을 수 있는 앱이 없습니다.</string>
<string name="snooze">스누즈</string>
<!-- Widget titles -->

View File

@ -11,7 +11,6 @@
<string name="add_some_events">Gebruik de plus-knop om iets te plannen.</string>
<string name="details">Details</string>
<string name="go_to_today">Naar vandaag</string>
<string name="no_app_for_ics">Geen app gevonden waarmee .ics-bestanden kunnen worden geopend</string>
<string name="snooze">Uitstellen</string>
<!-- Widget titles -->
@ -296,4 +295,4 @@
Haven't found some strings? There's more at
https://github.com/SimpleMobileTools/Simple-Commons/tree/master/commons/src/main/res
-->
</resources>
</resources>

View File

@ -11,7 +11,6 @@
<string name="add_some_events">Możesz je dodawać za pomocą przycisku \"+\" na dole.</string>
<string name="details">Szczegóły</string>
<string name="go_to_today">Przejdź do dnia dzisiejszego</string>
<string name="no_app_for_ics">Nie znalazłem aplikacji obsługującej pliki .ics</string>
<string name="snooze">Drzemka</string>
<!-- Widget titles -->

View File

@ -11,7 +11,6 @@
<string name="add_some_events">Pode-se adicionar um evento através do botão existente na base da tela.</string>
<string name="details">Detalhes</string>
<string name="go_to_today">Ir para hoje</string>
<string name="no_app_for_ics">No app capable of handling .ics files has been found</string>
<string name="snooze">Snooze</string>
<!-- Widget titles -->

View File

@ -11,7 +11,6 @@
<string name="add_some_events">Pode adicionar um evento através do botão existente na base do ecrã.</string>
<string name="details">Detalhes</string>
<string name="go_to_today">Ir para hoje</string>
<string name="no_app_for_ics">Não possui uma aplicação capaz de ler ficheiros .ics</string>
<string name="snooze">Snooze</string>
<!-- Widget titles -->

View File

@ -11,7 +11,6 @@
<string name="add_some_events">Вы можете их добавить, нажав на кнопку с плюсом внизу.</string>
<string name="details">Подробности</string>
<string name="go_to_today">Сегодня</string>
<string name="no_app_for_ics">Не найдено приложение для просмотра файлов .ics</string>
<string name="snooze">Отложить</string>
<!-- Widget titles -->

View File

@ -11,7 +11,6 @@
<string name="add_some_events">Viete ich pridať pomocou tlačidla Plus v pravom dolnom rohu.</string>
<string name="details">Detaily</string>
<string name="go_to_today">Prejsť na dnešok</string>
<string name="no_app_for_ics">Nenašla sa žiadna aplikácia schopná spracovania .ics súboru</string>
<string name="snooze">Odložiť</string>
<!-- Widget titles -->

View File

@ -11,7 +11,6 @@
<string name="add_some_events">Du kan lägga till händelser via plus-knappen som du ser längst ner.</string>
<string name="details">Detaljer</string>
<string name="go_to_today">Gå till idag</string>
<string name="no_app_for_ics">Ingen app som kan hantera .ics-filer har hittats</string>
<string name="snooze">Snooza</string>
<!-- Widget titles -->

View File

@ -11,7 +11,6 @@
<string name="add_some_events">Artı düğmesinin alt kısmında bazılarını ekleyebilirsiniz.</string>
<string name="details">Ayrıntı</string>
<string name="go_to_today">Bugüne git</string>
<string name="no_app_for_ics">ics dosyalarını işleme yeteneğinde hiçbir uygulama bulunamadı</string>
<string name="snooze">Snooze</string>
<!-- Widget titles -->

View File

@ -11,7 +11,6 @@
<string name="add_some_events">You can add some with the Plus button at the bottom.</string>
<string name="details">Details</string>
<string name="go_to_today">Go to today</string>
<string name="no_app_for_ics">No app capable of handling .ics files has been found</string>
<string name="snooze">Snooze</string>
<!-- Widget titles -->

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<paths>
<cache-path
name="shared_events"
path="events/"/>
</paths>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<paths>
<external-path name="external_files" path="."/>
<cache-path name="shared_events" path="events/"/>
<root-path name="external_files" path="/storage/" />
</paths>