Skip to content
Open
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
12 changes: 6 additions & 6 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@ plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
id 'kotlin-android'
id 'kotlin-android-extensions'

id 'com.google.gms.google-services'
id 'com.google.firebase.crashlytics'
}

android {
compileSdk 33
compileSdk 36

defaultConfig {
applicationId 'app.screenreader'
minSdk 24
targetSdk 33
targetSdk 36
versionCode 9
versionName '1.1.0'
}
Expand All @@ -29,11 +29,11 @@ android {
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = '1.8'
jvmTarget = '17'
}
namespace 'app.screenreader'
}
Expand Down
24 changes: 24 additions & 0 deletions app/src/main/java/app/screenreader/extensions/_Context.kt
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
package app.screenreader.extensions

import android.annotation.SuppressLint
import android.app.Activity
import android.content.BroadcastReceiver
import android.content.Context
import android.content.IntentFilter
import android.net.Uri
import android.os.Build
import android.os.Build.VERSION.SDK_INT
import android.os.LocaleList
import android.text.SpannableString
import android.text.Spanned
Expand Down Expand Up @@ -164,4 +169,23 @@ fun Context.openWebsite(uri: Uri) {
.build()

intent.launchUrl(this, uri)
}

@SuppressLint("UnspecifiedRegisterReceiverFlag")
fun Context.registerBroadcastReceiver(
broadcastReceiver: BroadcastReceiver,
intentFilter: IntentFilter?,
exported: Boolean = true,
) {

when {
SDK_INT >= Build.VERSION_CODES.TIRAMISU -> {
val exportedFlag =
if (exported) Context.RECEIVER_EXPORTED else Context.RECEIVER_NOT_EXPORTED

registerReceiver(broadcastReceiver, intentFilter, exportedFlag)
}

else -> registerReceiver(broadcastReceiver, intentFilter)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,15 @@ package app.screenreader.tabs.actions
import android.accessibilityservice.AccessibilityServiceInfo
import android.content.Intent
import android.text.SpannableString
import android.widget.ScrollView
import app.screenreader.R
import app.screenreader.extensions.doGetAction
import app.screenreader.extensions.identifier
import app.screenreader.extensions.showDialog
import app.screenreader.helpers.Accessibility
import app.screenreader.helpers.Events
import app.screenreader.model.Action
import app.screenreader.views.actions.ActionViewCallback
import app.screenreader.widgets.ToolbarActivity
import kotlinx.android.synthetic.main.activity_action.*

/**
* Created by Jan Jaap de Groot on 16/11/2020
Expand All @@ -22,6 +21,7 @@ class ActionActivity: ToolbarActivity(), ActionViewCallback {

private val startTime = System.currentTimeMillis()

private val scrollView get() = findViewById<ScrollView>(R.id.scrollView)
private val action: Action by lazy {
intent.doGetAction() ?: Action.SELECT
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import android.util.Log
import android.view.Menu
import android.view.MenuItem
import android.view.View
import android.widget.FrameLayout
import androidx.appcompat.app.AlertDialog
import app.screenreader.R
import app.screenreader.extensions.*
Expand All @@ -20,7 +21,6 @@ import app.screenreader.services.ScreenReaderService
import app.screenreader.views.gestures.GestureView
import app.screenreader.views.gestures.GestureViewCallback
import app.screenreader.widgets.ToolbarActivity
import kotlinx.android.synthetic.main.activity_gesture.*
import java.util.*
import kotlin.concurrent.schedule

Expand Down Expand Up @@ -51,6 +51,12 @@ class GestureActivity: ToolbarActivity(), GestureViewCallback {
private var errorCount = 0
private var finished = false

private val container get() = findViewById<FrameLayout>(R.id.container)
private val titleTextView get() = findViewById<android.widget.TextView>(R.id.titleTextView)
private val descriptionTextView get() = findViewById<android.widget.TextView>(R.id.descriptionTextView)
private val gestureImageView get() = findViewById<android.widget.ImageView>(R.id.gestureImageView)
private val feedbackTextView get() = findViewById<android.widget.TextView>(R.id.feedbackTextView)

private val isPracticing: Boolean
get() = gestures.isNotEmpty()

Expand Down Expand Up @@ -102,7 +108,7 @@ class GestureActivity: ToolbarActivity(), GestureViewCallback {
// Listen to events from ScreenReaderService
val filter = IntentFilter()
filter.addAction(Constants.SERVICE_ACTION)
registerReceiver(receiver, filter)
registerBroadcastReceiver(receiver, filter)
}

override fun onCreateOptionsMenu(menu: Menu?): Boolean {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import android.content.ClipboardManager
import android.content.Context
import app.screenreader.R
import app.screenreader.model.Action
import kotlinx.android.synthetic.main.action_copy.view.*
import app.screenreader.views.TrainingField

/**
* Created by Jan Jaap de Groot on 23/11/2020
Expand All @@ -24,7 +24,7 @@ class CopyActionView(context: Context): ActionView(
if (clip.itemCount > 0) {
val text = clip.getItemAt(0).text

if (trainingField.text.toString().contains(text, false)) {
if (findViewById<TrainingField>(R.id.trainingField).text.toString().contains(text, false)) {
correct()
} else {
incorrect(R.string.action_copy_incorrect)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ package app.screenreader.views.actions

import android.content.Context
import androidx.core.widget.addTextChangedListener
import kotlinx.android.synthetic.main.action_paste.view.*
import app.screenreader.R
import app.screenreader.model.Action
import app.screenreader.views.TrainingField

/**
* Created by Jan Jaap de Groot on 23/11/2020
Expand All @@ -17,7 +17,7 @@ class PasteActionView(context: Context) : ActionView(
) {

init {
trainingField.addTextChangedListener(beforeTextChanged = { _, _, _, after ->
findViewById<TrainingField>(R.id.trainingField).addTextChangedListener(beforeTextChanged = { _, _, _, after ->
if (after > 1) {
correct()
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package app.screenreader.views.actions

import android.content.Context
import kotlinx.android.synthetic.main.action_selection.view.*
import app.screenreader.R
import app.screenreader.model.Action
import app.screenreader.views.TrainingField
Expand All @@ -17,7 +16,7 @@ class SelectionActionView(context: Context) : ActionView(
), TrainingField.OnSelectionChangedListener {

init {
trainingField.callback = this
findViewById<TrainingField>(R.id.trainingField).callback = this
}

override fun onSelectionChanged(start: Int, end: Int) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ open class SwipeGestureView(
private val THRESHOLD = 15
private var path = arrayListOf<Direction>()

override fun onScroll(e1: MotionEvent, e2: MotionEvent, distanceX: Float, distanceY: Float): Boolean {
override fun onScroll(e1: MotionEvent?, e2: MotionEvent, distanceX: Float, distanceY: Float): Boolean {
Log.d(TAG, "onScroll, distanceX: $distanceX, distanceY: $distanceY")

// Determine direction
Expand Down Expand Up @@ -127,7 +127,7 @@ open class SwipeGestureView(
return super.onScroll(e1, e2, distanceX, distanceY)
}

override fun onFling(e1: MotionEvent, e2: MotionEvent, velocityX: Float, velocityY: Float): Boolean {
override fun onFling(e1: MotionEvent?, e2: MotionEvent, velocityX: Float, velocityY: Float): Boolean {
Log.d(TAG, "onFling, velocityX: $velocityX, velocityY: $velocityY")

if (path.isNotEmpty()) {
Expand Down
7 changes: 4 additions & 3 deletions app/src/main/java/app/screenreader/widgets/ListFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ package app.screenreader.widgets
import android.os.Bundle
import android.view.View
import androidx.recyclerview.widget.DividerItemDecoration
import androidx.recyclerview.widget.RecyclerView
import app.screenreader.R
import com.hannesdorfmann.adapterdelegates4.ListDelegationAdapter
import kotlinx.android.synthetic.main.view_list.*

abstract class ListFragment: BaseFragment() {

private val recyclerView get() = view?.findViewById<RecyclerView>(R.id.recyclerView)
override fun getLayoutId(): Int {
return R.layout.view_list
}
Expand All @@ -22,10 +23,10 @@ abstract class ListFragment: BaseFragment() {
super.onViewCreated(view, savedInstanceState)

adapter.items = items
recyclerView.adapter = adapter
recyclerView?.adapter = adapter

if (decoration) {
recyclerView.addItemDecoration(DividerItemDecoration(requireContext(), DividerItemDecoration.VERTICAL))
recyclerView?.addItemDecoration(DividerItemDecoration(requireContext(), DividerItemDecoration.VERTICAL))
}
}
}
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id 'com.android.application' version '8.1.1' apply false
id 'com.android.library' version '8.1.1' apply false
id 'com.android.application' version '8.13.0' apply false
id 'com.android.library' version '8.13.0' apply false
id 'org.jetbrains.kotlin.android' version '1.7.10' apply false
id 'com.google.gms.google-services' version '4.3.15' apply false
id 'com.google.firebase.crashlytics' version '2.9.9' apply false
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
7 changes: 4 additions & 3 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#Wed Feb 16 13:49:22 CET 2022
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading