diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 9e3c776e1..ae0682204 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -7,7 +7,16 @@ - + + + + + + + + + + + + + + diff --git a/app/src/main/kotlin/org/wordpress/aztec/demo/MainActivity.kt b/app/src/main/kotlin/org/wordpress/aztec/demo/MainActivity.kt index 3bc4aba4a..afe60fa38 100644 --- a/app/src/main/kotlin/org/wordpress/aztec/demo/MainActivity.kt +++ b/app/src/main/kotlin/org/wordpress/aztec/demo/MainActivity.kt @@ -14,12 +14,14 @@ import android.graphics.drawable.BitmapDrawable import android.graphics.drawable.ColorDrawable import android.graphics.drawable.Drawable import android.net.Uri +import android.os.Build import android.os.Bundle import android.os.Environment import android.os.Handler import android.os.Looper import android.provider.MediaStore import android.util.DisplayMetrics +import android.util.Log import android.view.Gravity import android.view.Menu import android.view.MenuItem @@ -262,6 +264,7 @@ open class MainActivity : AppCompatActivity(), val options = BitmapFactory.Options() options.inDensity = DisplayMetrics.DENSITY_DEFAULT val bitmap = BitmapFactory.decodeFile(mediaPath, options) + Log.d("MediaPath", mediaPath) insertImageAndSimulateUpload(bitmap, mediaPath) } REQUEST_MEDIA_PHOTO -> { @@ -649,10 +652,20 @@ open class MainActivity : AppCompatActivity(), if (PermissionUtils.checkAndRequestCameraAndStoragePermissions(this, MEDIA_CAMERA_PHOTO_PERMISSION_REQUEST_CODE)) { val intent = Intent(MediaStore.ACTION_IMAGE_CAPTURE) - mediaFile = "wp-" + System.currentTimeMillis() + ".jpg" - @Suppress("DEPRECATION") - mediaPath = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM).toString() + - File.separator + "Camera" + File.separator + mediaFile + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { + mediaFile = "wp-" + System.currentTimeMillis() + mediaPath = File.createTempFile( + mediaFile, + ".jpg", + getExternalFilesDir(Environment.DIRECTORY_PICTURES) + ).absolutePath + + } else { + mediaFile = "wp-" + System.currentTimeMillis() + ".jpg" + @Suppress("DEPRECATION") + mediaPath = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM).toString() + + File.separator + "Camera" + File.separator + mediaFile + } intent.putExtra(MediaStore.EXTRA_OUTPUT, FileProvider.getUriForFile(this, BuildConfig.APPLICATION_ID + ".provider", File(mediaPath))) diff --git a/aztec/src/test/kotlin/org/wordpress/aztec/AztecParserTest.kt b/aztec/src/test/kotlin/org/wordpress/aztec/AztecParserTest.kt index 119232809..92fabd94e 100644 --- a/aztec/src/test/kotlin/org/wordpress/aztec/AztecParserTest.kt +++ b/aztec/src/test/kotlin/org/wordpress/aztec/AztecParserTest.kt @@ -2,12 +2,9 @@ package org.wordpress.aztec -import android.test.AndroidTestCase import android.text.SpannableString import android.text.SpannableStringBuilder -import androidx.test.core.app.ApplicationProvider import org.junit.Assert -import org.junit.Before import org.junit.Ignore import org.junit.Test import org.junit.runner.RunWith @@ -18,7 +15,7 @@ import org.robolectric.RuntimeEnvironment * Tests for [AztecParser]. */ @RunWith(ParameterizedRobolectricTestRunner::class) -class AztecParserTest(alignmentRendering: AlignmentRendering) : AndroidTestCase() { +class AztecParserTest(alignmentRendering: AlignmentRendering) { private var mParser = AztecParser(alignmentRendering) private val HTML_BOLD = "Bold

" private val HTML_LIST_ORDERED = "
  1. Ordered
" @@ -96,14 +93,6 @@ class AztecParserTest(alignmentRendering: AlignmentRendering) : AndroidTestCase( } } - /** - * Initialize variables. - */ - @Before - fun init() { - context = ApplicationProvider.getApplicationContext() - } - /** * Parse all text from HTML to span to HTML. If input and output are equal with * the same length and corresponding characters, [AztecParser] is correct. diff --git a/aztec/src/test/kotlin/org/wordpress/aztec/CalypsoFormattingTest.kt b/aztec/src/test/kotlin/org/wordpress/aztec/CalypsoFormattingTest.kt index 7239d5fa7..e1ed730fb 100644 --- a/aztec/src/test/kotlin/org/wordpress/aztec/CalypsoFormattingTest.kt +++ b/aztec/src/test/kotlin/org/wordpress/aztec/CalypsoFormattingTest.kt @@ -2,12 +2,9 @@ package org.wordpress.aztec -import android.test.AndroidTestCase import android.text.SpannableString import android.text.SpannableStringBuilder -import androidx.test.core.app.ApplicationProvider import junit.framework.Assert -import org.junit.Before import org.junit.Test import org.junit.runner.RunWith import org.robolectric.RobolectricTestRunner @@ -15,7 +12,7 @@ import org.robolectric.RuntimeEnvironment import org.wordpress.aztec.source.Format @RunWith(RobolectricTestRunner::class) -class CalypsoFormattingTest : AndroidTestCase() { +class CalypsoFormattingTest { private var parser = AztecParser(AlignmentRendering.SPAN_LEVEL) private val HTML_LINE_BREAKS = "HI





BYE" @@ -97,14 +94,6 @@ class CalypsoFormattingTest : AndroidTestCase() { "
\n" + "" - /** - * Initialize variables. - */ - @Before - fun init() { - context = ApplicationProvider.getApplicationContext() - } - /** * Test the conversion from HTML to visual mode with nested HTML (Calypso format) * diff --git a/aztec/src/test/kotlin/org/wordpress/aztec/CssStyleAttributeTest.kt b/aztec/src/test/kotlin/org/wordpress/aztec/CssStyleAttributeTest.kt index c641cc935..c45e2cffe 100644 --- a/aztec/src/test/kotlin/org/wordpress/aztec/CssStyleAttributeTest.kt +++ b/aztec/src/test/kotlin/org/wordpress/aztec/CssStyleAttributeTest.kt @@ -2,9 +2,7 @@ package org.wordpress.aztec -import android.test.AndroidTestCase import android.text.SpannableString -import androidx.test.core.app.ApplicationProvider import junit.framework.Assert import org.junit.Before import org.junit.Test @@ -17,7 +15,7 @@ import org.wordpress.aztec.spans.AztecStyleBoldSpan @RunWith(RobolectricTestRunner::class) @Config(sdk = [24, 25]) -class CssStyleAttributeTest : AndroidTestCase() { +class CssStyleAttributeTest { private val EMPTY_STYLE_HTML = "bold" private val HTML = "bold" @@ -27,7 +25,6 @@ class CssStyleAttributeTest : AndroidTestCase() { @Before fun init() { - context = ApplicationProvider.getApplicationContext() parser = AztecParser(AlignmentRendering.SPAN_LEVEL) } diff --git a/aztec/src/test/kotlin/org/wordpress/aztec/HtmlAttributeStyleColorTest.kt b/aztec/src/test/kotlin/org/wordpress/aztec/HtmlAttributeStyleColorTest.kt index b43f2cec6..07e4c4c2a 100644 --- a/aztec/src/test/kotlin/org/wordpress/aztec/HtmlAttributeStyleColorTest.kt +++ b/aztec/src/test/kotlin/org/wordpress/aztec/HtmlAttributeStyleColorTest.kt @@ -2,10 +2,8 @@ package org.wordpress.aztec -import android.test.AndroidTestCase import android.text.SpannableString import android.text.style.ForegroundColorSpan -import androidx.test.core.app.ApplicationProvider import junit.framework.Assert import org.junit.Before import org.junit.Test @@ -30,7 +28,7 @@ import org.wordpress.aztec.spans.IAztecAttributedSpan */ @RunWith(RobolectricTestRunner::class) @Config(sdk = [24, 25]) -class HtmlAttributeStyleColorTest : AndroidTestCase() { +class HtmlAttributeStyleColorTest { private val HTML_BOLD_STYLE_COLOR = "Blue" private val HTML_BOLD_STYLE_INVALID = "Blue" @@ -45,7 +43,6 @@ class HtmlAttributeStyleColorTest : AndroidTestCase() { @Before fun init() { - context = ApplicationProvider.getApplicationContext() parser = AztecParser(AlignmentRendering.SPAN_LEVEL) } diff --git a/aztec/src/test/kotlin/org/wordpress/aztec/HtmlFormattingTest.kt b/aztec/src/test/kotlin/org/wordpress/aztec/HtmlFormattingTest.kt index ebe3de5e9..9fd92b9e0 100644 --- a/aztec/src/test/kotlin/org/wordpress/aztec/HtmlFormattingTest.kt +++ b/aztec/src/test/kotlin/org/wordpress/aztec/HtmlFormattingTest.kt @@ -2,11 +2,8 @@ package org.wordpress.aztec -import android.test.AndroidTestCase import android.text.SpannableString -import androidx.test.core.app.ApplicationProvider import junit.framework.Assert -import org.junit.Before import org.junit.Test import org.junit.runner.RunWith import org.robolectric.RobolectricTestRunner @@ -14,7 +11,7 @@ import org.robolectric.RuntimeEnvironment import org.wordpress.aztec.source.Format @RunWith(RobolectricTestRunner::class) -class HtmlFormattingTest : AndroidTestCase() { +class HtmlFormattingTest { private var parser = AztecParser(AlignmentRendering.SPAN_LEVEL) @@ -166,14 +163,6 @@ class HtmlFormattingTest : AndroidTestCase() { private val HTML_NESTED_BOLD_TAGS_HTML_PROCESSING_OUTPUT = "Test post

Our room with a view[/caption] Test end" - /** - * Initialize variables. - */ - @Before - fun init() { - context = ApplicationProvider.getApplicationContext() - } - /** * Test the conversion from HTML to visual mode with nested HTML * diff --git a/build.gradle b/build.gradle index 8c1c07853..bf09f0cef 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ buildscript { maven { url "https://a8c-libs.s3.amazonaws.com/android" } } dependencies { - classpath 'com.automattic.android:configure:0.6.3' + classpath 'com.automattic.android:configure:0.6.5' } } @@ -25,7 +25,7 @@ allprojects { } } google() - jcenter() + mavenCentral() } tasks.withType(KotlinCompile).all { kotlinOptions { @@ -65,7 +65,7 @@ subprojects { ext { minSdkVersion = 24 compileSdkVersion = 33 - targetSdkVersion = 31 + targetSdkVersion = 33 } ext { @@ -77,7 +77,7 @@ ext { robolectricVersion = '4.9' jUnitVersion = '4.12' jSoupVersion = '1.11.3' - wordpressUtilsVersion = 'trunk-1ed207c03d2242b6fc3d74f9e388e9163cbc82a6' + wordpressUtilsVersion = '3.5.0' espressoVersion = '3.0.1' aztecProjectDependency = project.hasProperty("aztecVersion") ? "org.wordpress:aztec:${project.getProperty("aztecVersion")}" : project(":aztec")