Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion collect_app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@ the specific language governing permissions and limitations under the License.
android:name="org.odk.collect.draw.DrawActivity"
android:theme="@style/Theme.Collect"
tools:replace="android:theme"
android:screenOrientation="landscape" />
android:screenOrientation="landscape"
android:resizeableActivity="false"/>
<activity android:name=".activities.InstanceChooserList" />
<activity
android:name=".formlists.blankformlist.BlankFormListActivity"
Expand Down
11 changes: 7 additions & 4 deletions draw/src/main/java/org/odk/collect/draw/DrawView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,10 @@ class DrawView(context: Context, attrs: AttributeSet?) : View(context, attrs) {

override fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int) {
super.onSizeChanged(w, h, oldw, oldh)
resetImage(w, h)

if (!::bitmap.isInitialized) {
resetImage(w, h)
}
}

override fun onDraw(canvas: Canvas) {
Expand Down Expand Up @@ -168,14 +171,14 @@ class DrawView(context: Context, attrs: AttributeSet?) : View(context, attrs) {
paint.color = originalColor
}

private fun resetImage(w: Int, h: Int) {
private fun resetImage(width: Int, height: Int) {
val backgroundBitmapFile = File(imagePath)
if (backgroundBitmapFile.exists()) {
bitmap = ImageFileUtils.getBitmapScaledToDisplay(backgroundBitmapFile, h, w, true)!!
bitmap = ImageFileUtils.getBitmapScaledToDisplay(backgroundBitmapFile, height, width, true)!!
.copy(Bitmap.Config.ARGB_8888, true)
canvas = Canvas(bitmap)
} else {
bitmap = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888)
bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888)
canvas = Canvas(bitmap)
canvas.drawColor(Color.WHITE)
if (isSignature) {
Expand Down