mirror of
https://github.com/SimpleMobileTools/Simple-Contacts.git
synced 2025-02-17 03:51:03 +01:00
add menu items for importing/exporting vcf files
This commit is contained in:
parent
68b9c4f5d2
commit
82d10f8b18
@ -10,6 +10,7 @@ import android.support.v4.view.ViewPager
|
||||
import android.support.v7.widget.SearchView
|
||||
import android.view.Menu
|
||||
import android.view.MenuItem
|
||||
import com.simplemobiletools.commons.dialogs.FilePickerDialog
|
||||
import com.simplemobiletools.commons.extensions.*
|
||||
import com.simplemobiletools.commons.helpers.*
|
||||
import com.simplemobiletools.contacts.BuildConfig
|
||||
@ -130,6 +131,8 @@ class MainActivity : SimpleActivity(), RefreshContactsListener {
|
||||
when (item.itemId) {
|
||||
R.id.sort -> showSortingDialog()
|
||||
R.id.filter -> showFilterDialog()
|
||||
R.id.import_contacts -> tryImportContacts()
|
||||
R.id.export_contacts -> tryExportContacts()
|
||||
R.id.settings -> startActivity(Intent(applicationContext, SettingsActivity::class.java))
|
||||
R.id.about -> launchAbout()
|
||||
else -> return super.onOptionsItemSelected(item)
|
||||
@ -245,6 +248,34 @@ class MainActivity : SimpleActivity(), RefreshContactsListener {
|
||||
}
|
||||
}
|
||||
|
||||
private fun tryImportContacts() {
|
||||
handlePermission(PERMISSION_READ_STORAGE) {
|
||||
if (it) {
|
||||
importContacts()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun importContacts() {
|
||||
FilePickerDialog(this) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private fun tryExportContacts() {
|
||||
handlePermission(PERMISSION_WRITE_STORAGE) {
|
||||
if (it) {
|
||||
exportContacts()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun exportContacts() {
|
||||
FilePickerDialog(this, pickFile = false, showFAB = true) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private fun launchAbout() {
|
||||
startAboutActivity(R.string.app_name, LICENSE_KOTLIN or LICENSE_MULTISELECT or LICENSE_JODA or LICENSE_GLIDE, BuildConfig.VERSION_NAME)
|
||||
}
|
||||
|
@ -17,6 +17,14 @@
|
||||
android:icon="@drawable/ic_filter"
|
||||
android:title="@string/filter"
|
||||
app:showAsAction="ifRoom"/>
|
||||
<item
|
||||
android:id="@+id/import_contacts"
|
||||
android:title="@string/import_contacts_from_vcf"
|
||||
app:showAsAction="never"/>
|
||||
<item
|
||||
android:id="@+id/export_contacts"
|
||||
android:title="@string/export_contacts_to_vcf"
|
||||
app:showAsAction="never"/>
|
||||
<item
|
||||
android:id="@+id/settings"
|
||||
android:title="@string/settings"
|
||||
|
@ -56,8 +56,8 @@
|
||||
<!-- Export / Import -->
|
||||
<string name="import_contacts">Kontakte importieren</string>
|
||||
<string name="export_contacts">Kontakte exportieren</string>
|
||||
<string name="import_contacts_from_ics">Kontakte aus .vcf Datei importieren</string>
|
||||
<string name="export_contacts_to_ics">Kontakte in .vcf Datei exportieren</string>
|
||||
<string name="import_contacts_from_vcf">Kontakte aus .vcf Datei importieren</string>
|
||||
<string name="export_contacts_to_vcf">Kontakte in .vcf Datei exportieren</string>
|
||||
<string name="target_contact_source">Zielkontaktquelle</string>
|
||||
<string name="include_contact_sources">Kontaktquellen einschließen</string>
|
||||
<string name="filename_without_vcf">Dateiname (ohne .vcf)</string>
|
||||
|
@ -56,8 +56,8 @@
|
||||
<!-- Export / Import -->
|
||||
<string name="import_contacts">Import contacts</string>
|
||||
<string name="export_contacts">Export contacts</string>
|
||||
<string name="import_contacts_from_ics">Import contacts from a .vcf file</string>
|
||||
<string name="export_contacts_to_ics">Export contacts to a .vcf file</string>
|
||||
<string name="import_contacts_from_vcf">Import contacts from a .vcf file</string>
|
||||
<string name="export_contacts_to_vcf">Export contacts to a .vcf file</string>
|
||||
<string name="target_contact_source">Target contact source</string>
|
||||
<string name="include_contact_sources">Include contact sources</string>
|
||||
<string name="filename_without_vcf">Filename (without .vcf)</string>
|
||||
|
@ -56,8 +56,8 @@
|
||||
<!-- Export / Import -->
|
||||
<string name="import_contacts">Import contacts</string>
|
||||
<string name="export_contacts">Export contacts</string>
|
||||
<string name="import_contacts_from_ics">Import contacts from a .vcf file</string>
|
||||
<string name="export_contacts_to_ics">Export contacts to a .vcf file</string>
|
||||
<string name="import_contacts_from_vcf">Import contacts from a .vcf file</string>
|
||||
<string name="export_contacts_to_vcf">Export contacts to a .vcf file</string>
|
||||
<string name="target_contact_source">Target contact source</string>
|
||||
<string name="include_contact_sources">Include contact sources</string>
|
||||
<string name="filename_without_vcf">Filename (without .vcf)</string>
|
||||
|
@ -56,8 +56,8 @@
|
||||
<!-- Export / Import -->
|
||||
<string name="import_contacts">Import contacts</string>
|
||||
<string name="export_contacts">Export contacts</string>
|
||||
<string name="import_contacts_from_ics">Import contacts from a .vcf file</string>
|
||||
<string name="export_contacts_to_ics">Export contacts to a .vcf file</string>
|
||||
<string name="import_contacts_from_vcf">Import contacts from a .vcf file</string>
|
||||
<string name="export_contacts_to_vcf">Export contacts to a .vcf file</string>
|
||||
<string name="target_contact_source">Target contact source</string>
|
||||
<string name="include_contact_sources">Include contact sources</string>
|
||||
<string name="filename_without_vcf">Filename (without .vcf)</string>
|
||||
|
@ -56,8 +56,8 @@
|
||||
<!-- Export / Import -->
|
||||
<string name="import_contacts">Importovať kontakty</string>
|
||||
<string name="export_contacts">Exportovať kontakty</string>
|
||||
<string name="import_contacts_from_ics">Importovať kontakty zo súboru .vcf</string>
|
||||
<string name="export_contacts_to_ics">Exportovať kontakty do súboru .vcf</string>
|
||||
<string name="import_contacts_from_vcf">Importovať kontakty z .vcf súboru</string>
|
||||
<string name="export_contacts_to_vcf">Exportovať kontakty do .vcf súboru</string>
|
||||
<string name="target_contact_source">Cieľový zdroj kontaktov</string>
|
||||
<string name="include_contact_sources">Zahrnúť zdroje kontaktov</string>
|
||||
<string name="filename_without_vcf">Názov súboru (bez .vcf)</string>
|
||||
|
@ -56,8 +56,8 @@
|
||||
<!-- Export / Import -->
|
||||
<string name="import_contacts">Import contacts</string>
|
||||
<string name="export_contacts">Export contacts</string>
|
||||
<string name="import_contacts_from_ics">Import contacts from a .vcf file</string>
|
||||
<string name="export_contacts_to_ics">Export contacts to a .vcf file</string>
|
||||
<string name="import_contacts_from_vcf">Import contacts from a .vcf file</string>
|
||||
<string name="export_contacts_to_vcf">Export contacts to a .vcf file</string>
|
||||
<string name="target_contact_source">Target contact source</string>
|
||||
<string name="include_contact_sources">Include contact sources</string>
|
||||
<string name="filename_without_vcf">Filename (without .vcf)</string>
|
||||
|
Loading…
x
Reference in New Issue
Block a user