-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add allow-mock-accuracy
for non-default geopoint
and geoshape
/geotrace
#4857
Merged
Merged
Changes from all commits
Commits
Show all changes
44 commits
Select commit
Hold shift + click to select a range
2ae0ef9
Push previousState down to subclasses as it's use is differnet in dif…
seadowg 58cab49
Remove extra permission check from geo activities
seadowg 1278d90
Remove unneeded super class
seadowg 51fe955
Separate GeoPointMapActivity from CollectAbstractActivity
seadowg 98ed778
Decouple GeoPointMapActivity from MapPreferencesFragment
seadowg 0931da8
Extract interface for creating map fragments
seadowg 9066129
Move maps interfaces to geo module
seadowg 394e48c
Move activity extras constants to geo package
seadowg 01b9714
Move GeoPointMapActivity to geo package
seadowg bd5b19b
Fix test imports
seadowg 2a99e73
use fake MapFragment to test GeoPointMapActivity instead of real frag…
seadowg 9882f67
Move to using ActivityScenario in GeoPointMapActivityTest
seadowg 76a28b1
Move GeoPointMapActivityTest to geo module
seadowg f0eade7
Add pass-through setter for retain mock accuracy
seadowg c0eac92
Support retaining mock accuracy in GeoPointMapActivity
seadowg 83d136c
Use same location sanitizer code for mapbox as everything else
seadowg 542949f
Support retaining mock accuracy in MapboxMapFragment
seadowg 5aa42ef
Add note to dagger setup
seadowg b9f73da
Remove dependency on CollectAbstractActivity from GeoPolyActivity
seadowg f27c4dd
Move dialog fragment helpers to androidshared
seadowg 8384454
Move GeoPolySettingsDialogFragment to geo module
seadowg 0e531be
Move GeoPolyActivity to geo module
seadowg 0cf4c5b
Revise GeoPolyActivityTest to focus on LocationTracker rather than Lo…
seadowg de63d19
Use ActivityScenario for GeoPolyActivityTest
seadowg e3a6892
Move GeoPolyActivityTest to geo module
seadowg 4456584
Send retain mock accuracy when starting GeoPolyActivity
seadowg 5eddf8d
Support retain mock accuracy in GeoPolyActivity
seadowg cf8e9f7
Correct test name
seadowg 1ac2d6e
Extract shared test fake
seadowg e1523ee
Optimize imports
seadowg 5a242f9
Make sure test won't pass incorrectly
seadowg 75b99e8
Move PermissionsChecker and rearrange packages in androidshared
seadowg 95d83a4
Add permission checks back into geo Activity objects
seadowg 9d5abb3
Grant permissions in tests
seadowg 4484c53
Extract helper for returning single values from external app/activity
seadowg 8532d95
Use external app helper to pull value out in tests
seadowg 75254a8
Deprecate ANSWER_KEY constant
seadowg 23d7b58
Add comment to ExternalAppUtils
seadowg f4ff908
Remove unused pro guard file
seadowg fa33b62
Remove unused desugaring
seadowg 0004a36
Use singelton MapProvider instead of new one each time
seadowg 4019f19
Don't inject dependency module dependencies in application object
seadowg 3cc60f1
Add note about MapProvider needing to be a singleton
seadowg f0298d7
Optimize imports
seadowg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
androidshared/src/main/java/org/odk/collect/androidshared/system/ContextUtils.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package org.odk.collect.androidshared.system | ||
|
||
import android.content.Context | ||
import android.util.TypedValue | ||
import androidx.annotation.AttrRes | ||
|
||
object ContextUtils { | ||
|
||
@JvmStatic | ||
fun getThemeAttributeValue(context: Context, @AttrRes resId: Int): Int { | ||
val outValue = TypedValue() | ||
context.theme.resolveAttribute(resId, outValue, true) | ||
return outValue.data | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...androidshared/utils/ExternalFilesUtils.kt → ...ndroidshared/system/ExternalFilesUtils.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...droid/permissions/PermissionsChecker.java → ...roidshared/system/PermissionsChecker.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
82 changes: 82 additions & 0 deletions
82
androidshared/src/main/java/org/odk/collect/androidshared/ui/DialogFragmentUtils.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
package org.odk.collect.androidshared.ui | ||
|
||
import android.os.Bundle | ||
import androidx.fragment.app.DialogFragment | ||
import androidx.fragment.app.FragmentManager | ||
import timber.log.Timber | ||
|
||
object DialogFragmentUtils { | ||
|
||
@JvmStatic | ||
fun <T : DialogFragment> showIfNotShowing( | ||
dialogClass: Class<T>, | ||
fragmentManager: FragmentManager | ||
) { | ||
showIfNotShowing(dialogClass, null, fragmentManager) | ||
} | ||
|
||
@JvmStatic | ||
fun <T : DialogFragment> showIfNotShowing( | ||
dialogClass: Class<T>, | ||
args: Bundle?, | ||
fragmentManager: FragmentManager | ||
) { | ||
showIfNotShowing(createNewInstance(dialogClass, args), dialogClass, fragmentManager) | ||
} | ||
|
||
@JvmStatic | ||
fun <T : DialogFragment> showIfNotShowing( | ||
newDialog: T, | ||
dialogClass: Class<T>, | ||
fragmentManager: FragmentManager | ||
) { | ||
if (fragmentManager.isStateSaved) { | ||
return | ||
} | ||
val tag = dialogClass.name | ||
val existingDialog = fragmentManager.findFragmentByTag(tag) as T? | ||
if (existingDialog == null) { | ||
newDialog.show(fragmentManager.beginTransaction(), tag) | ||
|
||
// We need to execute this transaction. Otherwise a follow up call to this method | ||
// could happen before the Fragment exists in the Fragment Manager and so the | ||
// call to findFragmentByTag would return null and result in second dialog being show. | ||
try { | ||
fragmentManager.executePendingTransactions() | ||
} catch (e: IllegalStateException) { | ||
Timber.w(e) | ||
} | ||
} | ||
} | ||
|
||
@JvmStatic | ||
fun dismissDialog(dialogClazz: Class<*>, fragmentManager: FragmentManager) { | ||
val existingDialog = fragmentManager.findFragmentByTag(dialogClazz.name) as DialogFragment? | ||
if (existingDialog != null) { | ||
existingDialog.dismissAllowingStateLoss() | ||
|
||
// We need to execute this transaction. Otherwise a next attempt to display a dialog | ||
// could happen before the Fragment is dismissed in Fragment Manager and so the | ||
// call to findFragmentByTag would return something (not null) and as a result the | ||
// next dialog won't be displayed. | ||
try { | ||
fragmentManager.executePendingTransactions() | ||
} catch (e: IllegalStateException) { | ||
Timber.w(e) | ||
} | ||
} | ||
} | ||
|
||
private fun <T : DialogFragment> createNewInstance(dialogClass: Class<T>, args: Bundle?): T { | ||
return try { | ||
val instance = dialogClass.newInstance() | ||
instance.arguments = args | ||
instance | ||
} catch (e: IllegalAccessException) { | ||
// These would mean we have a non zero arg constructor for a Fragment | ||
throw RuntimeException(e) | ||
} catch (e: InstantiationException) { | ||
throw RuntimeException(e) | ||
} | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...collect/androidshared/utils/ToastUtils.kt → ...dk/collect/androidshared/ui/ToastUtils.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 0 additions & 41 deletions
41
collect_app/src/main/java/org/odk/collect/android/activities/BaseGeoMapActivity.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is it for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's need so that the build tools now which
android:theme
to use. Otherwise, there is a conflict between thegeo
and thecollect_app
manifests.