mirror of
https://github.com/nextcloud/android.git
synced 2024-11-26 23:28:42 +03:00
open vcf works again
Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
This commit is contained in:
parent
372e478bfd
commit
75c8359781
4 changed files with 71 additions and 6 deletions
Binary file not shown.
After Width: | Height: | Size: 13 KiB |
Binary file not shown.
After Width: | Height: | Size: 7.5 KiB |
|
@ -0,0 +1,65 @@
|
|||
/*
|
||||
*
|
||||
* Nextcloud Android client application
|
||||
*
|
||||
* @author Tobias Kaminsky
|
||||
* Copyright (C) 2020 Tobias Kaminsky
|
||||
* Copyright (C) 2020 Nextcloud GmbH
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.owncloud.android.ui.activity
|
||||
|
||||
import android.content.Intent
|
||||
import androidx.test.espresso.intent.rule.IntentsTestRule
|
||||
import com.owncloud.android.AbstractIT
|
||||
import com.owncloud.android.datamodel.OCFile
|
||||
import com.owncloud.android.utils.ScreenshotTest
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
|
||||
class ContactsPreferenceActivityIT : AbstractIT() {
|
||||
@get:Rule
|
||||
var activityRule = IntentsTestRule(ContactsPreferenceActivity::class.java, true, false)
|
||||
|
||||
@Test
|
||||
@ScreenshotTest
|
||||
fun openVCF() {
|
||||
val file = getFile("vcard.vcf")
|
||||
val vcfFile = OCFile("/contacts.vcf")
|
||||
vcfFile.storagePath = file.absolutePath
|
||||
|
||||
assertTrue(vcfFile.isDown)
|
||||
|
||||
val intent = Intent()
|
||||
intent.putExtra(ContactsPreferenceActivity.EXTRA_FILE, vcfFile)
|
||||
intent.putExtra(ContactsPreferenceActivity.EXTRA_USER, user)
|
||||
val sut = activityRule.launchActivity(intent)
|
||||
|
||||
shortSleep()
|
||||
|
||||
screenshot(sut)
|
||||
}
|
||||
|
||||
@Test
|
||||
@ScreenshotTest
|
||||
fun openContactsPreference() {
|
||||
val sut = activityRule.launchActivity(null)
|
||||
|
||||
shortSleep()
|
||||
|
||||
screenshot(sut)
|
||||
}
|
||||
}
|
|
@ -45,8 +45,8 @@ import androidx.fragment.app.FragmentTransaction;
|
|||
*/
|
||||
public class ContactsPreferenceActivity extends FileActivity implements FileFragment.ContainerActivity {
|
||||
public static final String TAG = ContactsPreferenceActivity.class.getSimpleName();
|
||||
private static final String EXTRA_FILE = "FILE";
|
||||
private static final String EXTRA_USER = "USER";
|
||||
protected static final String EXTRA_FILE = "FILE";
|
||||
protected static final String EXTRA_USER = "USER";
|
||||
/**
|
||||
* Warning: default for this extra is different between this activity and {@link ContactsBackupFragment}
|
||||
*/
|
||||
|
@ -103,13 +103,13 @@ public class ContactsPreferenceActivity extends FileActivity implements FileFrag
|
|||
Intent intent = getIntent();
|
||||
if (savedInstanceState == null) {
|
||||
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
|
||||
if (intent == null || intent.getParcelableExtra(ContactListFragment.FILE_NAME) == null ||
|
||||
intent.getParcelableExtra(ContactListFragment.USER) == null) {
|
||||
if (intent == null || intent.getParcelableExtra(EXTRA_FILE) == null ||
|
||||
intent.getParcelableExtra(EXTRA_USER) == null) {
|
||||
ContactsBackupFragment fragment = ContactsBackupFragment.create(showSidebar);
|
||||
transaction.add(R.id.frame_container, fragment);
|
||||
} else {
|
||||
OCFile file = intent.getParcelableExtra(ContactListFragment.FILE_NAME);
|
||||
User user = intent.getParcelableExtra(ContactListFragment.USER);
|
||||
OCFile file = intent.getParcelableExtra(EXTRA_FILE);
|
||||
User user = intent.getParcelableExtra(EXTRA_USER);
|
||||
ContactListFragment contactListFragment = ContactListFragment.newInstance(file, user);
|
||||
transaction.add(R.id.frame_container, contactListFragment);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue