Skip to content
This repository has been archived by the owner on Dec 3, 2021. It is now read-only.

Commit

Permalink
fix: Export menu
Browse files Browse the repository at this point in the history
Update README.
close #65
  • Loading branch information
aoudiamoncef committed May 6, 2018
1 parent 816440c commit f8c14d1
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 7 deletions.
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ Supported sensors:
## Screenshots
| | | |
|:-------------------------:|:-------------------------:|:-------------------------:|
|<img width="1604" alt="screenshot_20180228-172821__01" src="https://user-images.githubusercontent.com/22281426/36799845-59b7ca92-1cae-11e8-85e2-c64cd483b50e.jpg">|<img width="1604" alt="screenshot_20180228-172912__01" src="https://user-images.githubusercontent.com/22281426/36799840-5953c380-1cae-11e8-9334-0e53292e21a4.jpg">|<img width="1604" alt="screenshot_20180227-212536__01" src="https://user-images.githubusercontent.com/22281426/36799844-599a20fa-1cae-11e8-9dd9-62b4f698cf37.jpg">|

<img width="1604" alt="screenshot_20180227-190110__01" src="https://user-images.githubusercontent.com/22281426/36799842-59791252-1cae-11e8-8254-044ce7f8dd7c.jpg">
|<img width="1604" alt="screenshot_01" src="fastlane/metadata/android/en-US/images/phoneScreenshots/1.png">|<img width="1604" alt="screenshot_02" src="fastlane/metadata/android/en-US/images/phoneScreenshots/2.png">|<img width="1604" alt="screenshot_03" src="fastlane/metadata/android/en-US/images/phoneScreenshots/3.png">|<img


## Libraries used
Expand Down
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ android {
minSdkVersion 21
targetSdkVersion 27

versionCode 18
versionName "2.4.1"
versionCode 19
versionName "2.4.2"

testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
javaCompileOptions {
Expand Down
4 changes: 4 additions & 0 deletions app/src/main/java/science/apolline/utils/CheckUtility.kt
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,10 @@ object CheckUtility : AnkoLogger {
return ContextCompat.checkSelfPermission(context, Manifest.permission.READ_PHONE_STATE) == PackageManager.PERMISSION_GRANTED
}

fun checkWriteToExternalStoragePermissionPermission(context: Context): Boolean {
return ContextCompat.checkSelfPermission(context, Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED
}

fun canGetLocation(context: Context): Boolean {
var gpsEnabled = false
var networkEnabled = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ import science.apolline.utils.DataExport.exportToJson
import science.apolline.utils.HourAxisValueFormatter
import science.apolline.root.RootFragment
import science.apolline.service.database.SensorDao
import science.apolline.utils.CheckUtility
import science.apolline.viewModel.SensorViewModel


Expand Down Expand Up @@ -76,7 +77,6 @@ class ChartFragment : RootFragment(), OnChartValueSelectedListener, FragmentLife

// Preferences.
mPrefs = PreferenceManager.getDefaultSharedPreferences(activity!!.applicationContext)
//mPrefs = this.getSharedPreferences( IDENTIFIER, Context.MODE_PRIVATE)

}

Expand All @@ -89,30 +89,36 @@ class ChartFragment : RootFragment(), OnChartValueSelectedListener, FragmentLife
super.onViewCreated(view, savedInstanceState)
mDisposable = CompositeDisposable()

floating_action_menu_json.setOnClickListener {

floating_action_menu_json.setOnClickListener {
mIsWriteToExternalStoragePermissionGranted = CheckUtility.checkWriteToExternalStoragePermissionPermission (activity!!.applicationContext)
if (!mIsWriteToExternalStoragePermissionGranted) {
info("test false")
checkWriteToExternalStoragePermission(mRequestWriteToExternalStoragePermission)
} else {
info("test true")
exportToJson(activity!!.application, mSensorDao)
}

}
floating_action_menu_csv_multi.setOnClickListener {
mIsWriteToExternalStoragePermissionGranted = CheckUtility.checkWriteToExternalStoragePermissionPermission (activity!!.applicationContext)
if (!mIsWriteToExternalStoragePermissionGranted) {
checkWriteToExternalStoragePermission(mRequestWriteToExternalStoragePermission)
} else {
exportToCsv(activity!!.application, mSensorDao, true)
}
}
floating_action_menu_csv.setOnClickListener {
mIsWriteToExternalStoragePermissionGranted = CheckUtility.checkWriteToExternalStoragePermissionPermission (activity!!.applicationContext)
if (!mIsWriteToExternalStoragePermissionGranted) {
checkWriteToExternalStoragePermission(mRequestWriteToExternalStoragePermission)
} else {
exportToCsv(activity!!.application, mSensorDao, false)
}
}
floating_action_menu_share.setOnClickListener {
mIsWriteToExternalStoragePermissionGranted = CheckUtility.checkWriteToExternalStoragePermissionPermission (activity!!.applicationContext)
if (!mIsWriteToExternalStoragePermissionGranted) {
checkWriteToExternalStoragePermission(mRequestWriteToExternalStoragePermission)
} else {
Expand Down Expand Up @@ -361,6 +367,7 @@ class ChartFragment : RootFragment(), OnChartValueSelectedListener, FragmentLife
}
noButton {}
}.show()

}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import science.apolline.utils.DataExport.exportToCsv
import science.apolline.utils.DataExport.exportToJson
import science.apolline.root.RootFragment
import science.apolline.service.database.SensorDao
import science.apolline.utils.CheckUtility
import science.apolline.viewModel.SensorViewModel
import kotlin.math.roundToLong

Expand Down Expand Up @@ -65,6 +66,8 @@ class IOIOFragment : RootFragment(), FragmentLifecycle, AnkoLogger {
super.onViewCreated(view, savedInstanceState)
mDisposable = CompositeDisposable()

mIsWriteToExternalStoragePermissionGranted = CheckUtility.checkWriteToExternalStoragePermissionPermission (activity!!.applicationContext)

floating_action_menu_json.setOnClickListener {

if (!mIsWriteToExternalStoragePermissionGranted) {
Expand Down Expand Up @@ -213,6 +216,7 @@ class IOIOFragment : RootFragment(), FragmentLifecycle, AnkoLogger {

private fun checkWriteToExternalStoragePermission(request: PermissionRequest) {

info("check permission")
request.detachAllListeners()
request.send()
request.listeners {
Expand Down
3 changes: 3 additions & 0 deletions fastlane/metadata/android/en-US/changelogs/19.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- Fix progressive runtime permissions request.
- Fix export menu behaviours.
- Fix some bugs.
3 changes: 3 additions & 0 deletions fastlane/metadata/android/fr-FR/changelogs/19.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- Correction de la demande progressive de permissions.
- Correction des fonctions du menu d'exportation.
- Correction de quelques bugs.

0 comments on commit f8c14d1

Please sign in to comment.