Merge branch 'release/1.6.0'
1
.gitignore
vendored
|
@ -56,3 +56,4 @@ lint/outputs/
|
|||
lint/tmp/
|
||||
# lint/reports/
|
||||
/SWADroid/src/debug/
|
||||
/SWADroid/release/
|
||||
|
|
64
.travis.yml
|
@ -1,53 +1,51 @@
|
|||
sudo: false
|
||||
os: linux
|
||||
dist: xenial
|
||||
language: android
|
||||
jdk: oraclejdk8
|
||||
env:
|
||||
global:
|
||||
- ANDROID_API=29
|
||||
- ANDROID_BUILD_TOOLS=29.0.2
|
||||
- secure: eY3bGKw4jZ+HHkkMBZHiL2dhcz+RJYHib0WC77SSVHLJcCg63pBvs420i4rjNQHycMs+PhRSlR79jdglDTm8svphhRjSts6VMkHDxObwJIyLF8vAZ0PfjhqfOXO+4+Fx6pRIjwM7cBMOQrDfSimJHRB+z/f2AJfUIsaMSlltGVya7nmrLY/fO4dtl4wPnejslj3mhnBAxr+a2Or978RwI2TMpxBovHZKFT/46wJTcMzKXGdXU64M8nmQmpcKHeIKIBiR4g+A2tahC+Us4tFxxoTDd3R+IAzj7Gvjd5JuMlYmQ3quRv2M08u9OJNiT14LpDXy19fZKdw/QNHg3S8JVis8kJDkv6z4HyZXTIBgISZpCZZti04GP29Lj+1f4ISRFc6uxankDuRgfX8ucsxoEPJVq3PfJlpTdP7wjlQtEGv0HF/3MNNyruNbLHFiCgHOANwEOX44INtw6XylPEftmw4y4ptntFG3VXyV1Zi+732Qe4b2QNTbvLPrsmkCRKzo59vKKAzBBhvYvFVITcWbySqdx9/n1H25SRL2Q96nPGQSQyBF6obzzFcjMKkknPle1PXvAfb171964cdIK6/zo9rh/ZCL3+gAKZibmGWvbeztWYl5ON8B8x8mgLO/qgPIotY+aqwmsY06pKrqi6adYZacMF+UgtbLJlhnird6ugk=
|
||||
- secure: EmcSyXk/5pEJhbRX9DSFzhQGYvGaYdxjDuQwmLuxUGitGpFQZbWexTAK/l0LLcIRsiSmucY7KJgOpL7I6odh2kVUZedarj8/5K1P69ljDDB7bfG8jyOLZvHJ1JTZRuKvUnT846zQwQWTnLXF9N4LaQ86FVqSW2bGHqptIivEjDEVh78V3g4PDsbX5aQ5LjTlSn7bezu9chpVS0fnRlqjAa6U2kUwUt+DDaSHEOs35Z89jT7JoonGFrMsyA7S26CQhOBYE3w76AllIea+MWzPJX3V364ZIzPBnQAkCz02oVI3n+LHZkzUCYHkY8DXWXNy6+/sulFa6L1v6bt8DzF1vwJ+nTNVqmqSDYBe2s1qAUZ+4o8l/THMndxC11LjbbEExG4ekBRFvRsOOf0pBps3Yr4ry27gaj4+9Ap2JCKKOQwm0izh48AJiy0Y8pzIzTO5wB5B7a4czLJmzaNWkPVXw4lKg2ldJ4sd6EBqUZqG2vRmN6VwHb8gHFNaQTH3feBRhYTpkv1wWUuhvclNn5yoZzcSxMT/b8d89e5DahoBYMW48c6jb5wL/EoY3bHp3mjtnTW8oIIjyZK8FjYX+8IqeEoue8bDDqNUN71xmRvp+0CX1iXnfgUeDWnYhXHTewOlJu6i509wGrZPxYjgwAdnpfTyGXPq7Vin9CkNHMw9fbA=
|
||||
- secure: WS7Jgz0L0aMEZmg4/HxPb9nO7oER9z23n8n508UVQ0DyKL92UPhfVol7+Cob8zuO5SJl5TPOh58gd/C0Prq8t5q3mwlDA9buhnb1uef7pwZOFzQOF0o8RuPSpxLgu8tFlDooWrG9oxZObXwh84TXGX7zgoiWr9Y318qsQSHCiv9Ue9kgJxkjk9wVanJws7zHWAevfFzyoEvqtkDTqNie4RJbMEOdeX+TyUpc77Si2UpAC23Mpl8q+qZr32cgxk3MzSdhJk2C3Vz5MS6LBZ7ynyv+em+/vz2RBlFLetrcknHY8lgE060itWcns6Pj/8tv2SQbJptVFToXbfay/EVleApojHG4w5DFDzQt8a3Az0lBnqOxv3BiAPRcr49/A08qXAKh30p6YBiSvVd8zK+MZoMoj2dDQhdXb72nv0yHZmzkiaQEOGnsBD4Gt3epn/KoJke3W0ffBZOfJNScACW0Gta2XLImZsekb4sjfOF84HrISSMiXunlLpgtcC4C3Pn9VV/6+uciIMqMFDYkJMe2gyRNA2vSyZ61n/ioTLOHYzhYHjZUXB4MOlonYTiFuF4HmVVHO2J9CpOdFFP7hrkWK3HzvcQm9k8dxUkuKDoOlRb+CSlrEZO24V+TaY2DDr1bcitA77VJp90Cz2RpLC3tvSvThgY2VNk+OEbeSrP5DNA=
|
||||
- ANDROID_API=30
|
||||
- ANDROID_BUILD_TOOLS=30.0.3
|
||||
- secure: eY3bGKw4jZ+HHkkMBZHiL2dhcz+RJYHib0WC77SSVHLJcCg63pBvs420i4rjNQHycMs+PhRSlR79jdglDTm8svphhRjSts6VMkHDxObwJIyLF8vAZ0PfjhqfOXO+4+Fx6pRIjwM7cBMOQrDfSimJHRB+z/f2AJfUIsaMSlltGVya7nmrLY/fO4dtl4wPnejslj3mhnBAxr+a2Or978RwI2TMpxBovHZKFT/46wJTcMzKXGdXU64M8nmQmpcKHeIKIBiR4g+A2tahC+Us4tFxxoTDd3R+IAzj7Gvjd5JuMlYmQ3quRv2M08u9OJNiT14LpDXy19fZKdw/QNHg3S8JVis8kJDkv6z4HyZXTIBgISZpCZZti04GP29Lj+1f4ISRFc6uxankDuRgfX8ucsxoEPJVq3PfJlpTdP7wjlQtEGv0HF/3MNNyruNbLHFiCgHOANwEOX44INtw6XylPEftmw4y4ptntFG3VXyV1Zi+732Qe4b2QNTbvLPrsmkCRKzo59vKKAzBBhvYvFVITcWbySqdx9/n1H25SRL2Q96nPGQSQyBF6obzzFcjMKkknPle1PXvAfb171964cdIK6/zo9rh/ZCL3+gAKZibmGWvbeztWYl5ON8B8x8mgLO/qgPIotY+aqwmsY06pKrqi6adYZacMF+UgtbLJlhnird6ugk=
|
||||
- secure: EmcSyXk/5pEJhbRX9DSFzhQGYvGaYdxjDuQwmLuxUGitGpFQZbWexTAK/l0LLcIRsiSmucY7KJgOpL7I6odh2kVUZedarj8/5K1P69ljDDB7bfG8jyOLZvHJ1JTZRuKvUnT846zQwQWTnLXF9N4LaQ86FVqSW2bGHqptIivEjDEVh78V3g4PDsbX5aQ5LjTlSn7bezu9chpVS0fnRlqjAa6U2kUwUt+DDaSHEOs35Z89jT7JoonGFrMsyA7S26CQhOBYE3w76AllIea+MWzPJX3V364ZIzPBnQAkCz02oVI3n+LHZkzUCYHkY8DXWXNy6+/sulFa6L1v6bt8DzF1vwJ+nTNVqmqSDYBe2s1qAUZ+4o8l/THMndxC11LjbbEExG4ekBRFvRsOOf0pBps3Yr4ry27gaj4+9Ap2JCKKOQwm0izh48AJiy0Y8pzIzTO5wB5B7a4czLJmzaNWkPVXw4lKg2ldJ4sd6EBqUZqG2vRmN6VwHb8gHFNaQTH3feBRhYTpkv1wWUuhvclNn5yoZzcSxMT/b8d89e5DahoBYMW48c6jb5wL/EoY3bHp3mjtnTW8oIIjyZK8FjYX+8IqeEoue8bDDqNUN71xmRvp+0CX1iXnfgUeDWnYhXHTewOlJu6i509wGrZPxYjgwAdnpfTyGXPq7Vin9CkNHMw9fbA=
|
||||
- secure: WS7Jgz0L0aMEZmg4/HxPb9nO7oER9z23n8n508UVQ0DyKL92UPhfVol7+Cob8zuO5SJl5TPOh58gd/C0Prq8t5q3mwlDA9buhnb1uef7pwZOFzQOF0o8RuPSpxLgu8tFlDooWrG9oxZObXwh84TXGX7zgoiWr9Y318qsQSHCiv9Ue9kgJxkjk9wVanJws7zHWAevfFzyoEvqtkDTqNie4RJbMEOdeX+TyUpc77Si2UpAC23Mpl8q+qZr32cgxk3MzSdhJk2C3Vz5MS6LBZ7ynyv+em+/vz2RBlFLetrcknHY8lgE060itWcns6Pj/8tv2SQbJptVFToXbfay/EVleApojHG4w5DFDzQt8a3Az0lBnqOxv3BiAPRcr49/A08qXAKh30p6YBiSvVd8zK+MZoMoj2dDQhdXb72nv0yHZmzkiaQEOGnsBD4Gt3epn/KoJke3W0ffBZOfJNScACW0Gta2XLImZsekb4sjfOF84HrISSMiXunlLpgtcC4C3Pn9VV/6+uciIMqMFDYkJMe2gyRNA2vSyZ61n/ioTLOHYzhYHjZUXB4MOlonYTiFuF4HmVVHO2J9CpOdFFP7hrkWK3HzvcQm9k8dxUkuKDoOlRb+CSlrEZO24V+TaY2DDr1bcitA77VJp90Cz2RpLC3tvSvThgY2VNk+OEbeSrP5DNA=
|
||||
before_cache:
|
||||
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
|
||||
- rm -rf $HOME/.gradle/caches/*/plugin-resolution/
|
||||
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
|
||||
- rm -rf $HOME/.gradle/caches/*/plugin-resolution/
|
||||
cache:
|
||||
directories:
|
||||
- "$HOME/.gradle/caches/"
|
||||
- "$HOME/.gradle/wrapper/"
|
||||
- "$HOME/.android/build-cache"
|
||||
- "$HOME/.gradle/caches/"
|
||||
- "$HOME/.gradle/wrapper/"
|
||||
- "$HOME/.android/build-cache"
|
||||
before_install:
|
||||
- openssl aes-256-cbc -K $encrypted_b7f76037f2f7_key -iv $encrypted_b7f76037f2f7_iv
|
||||
-in $TRAVIS_BUILD_DIR/SWADroid/src/prod/google-services.json.enc -out $TRAVIS_BUILD_DIR/SWADroid/src/prod/google-services.json
|
||||
-d
|
||||
- yes | sdkmanager "build-tools;${ANDROID_BUILD_TOOLS}"
|
||||
- yes | sdkmanager "platform-tools"
|
||||
- yes | sdkmanager "tools"
|
||||
- yes | sdkmanager "platforms;android-${ANDROID_API}"
|
||||
- yes | sdkmanager "extras;android;m2repository"
|
||||
- yes | sdkmanager --list
|
||||
- chmod +x gradlew
|
||||
- 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then bash ./.travis/run_on_non_pull_requests.sh; fi'
|
||||
- yes | sdkmanager "build-tools;${ANDROID_BUILD_TOOLS}"
|
||||
- yes | sdkmanager "platform-tools"
|
||||
- yes | sdkmanager "tools"
|
||||
- yes | sdkmanager "platforms;android-${ANDROID_API}"
|
||||
- yes | sdkmanager "extras;android;m2repository"
|
||||
- yes | sdkmanager --list
|
||||
- chmod +x gradlew
|
||||
script:
|
||||
- "./gradlew clean test build connectedCheck -Pbuild=prod"
|
||||
- "./gradlew clean test build connectedCheck -Pbuild=prod"
|
||||
after_failure: cat $TRAVIS_BUILD_DIR/SWADroid/build/reports/lint-results.xml
|
||||
before_deploy:
|
||||
- openssl aes-256-cbc -K $encrypted_855ad244b8b2_key -iv $encrypted_855ad244b8b2_iv
|
||||
-in keystore.jks.enc -out keystore.jks -d
|
||||
- cd SWADroid/build/outputs/apk/release
|
||||
- jarsigner -sigalg SHA1withRSA -digestalg SHA1 -keystore ${TRAVIS_BUILD_DIR}/keystore.jks
|
||||
-storepass $storepass -keypass $keypass SWADroid-release-unsigned.apk amab
|
||||
- jarsigner -verify SWADroid-release-unsigned.apk
|
||||
- "${ANDROID_HOME}/build-tools/${ANDROID_BUILD_TOOLS}/zipalign -p 4 SWADroid-release-unsigned.apk
|
||||
- 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then bash ./.travis/run_on_before_deploy.sh; fi'
|
||||
- cd $TRAVIS_BUILD_DIR/SWADroid/build/outputs/apk/release
|
||||
- jarsigner -sigalg SHA1withRSA -digestalg SHA1 -keystore ${TRAVIS_BUILD_DIR}/keystore.jks
|
||||
-storepass $storepass -keypass $keypass SWADroid-release-unsigned.apk amab
|
||||
- jarsigner -verify SWADroid-release-unsigned.apk
|
||||
- "${ANDROID_HOME}/build-tools/${ANDROID_BUILD_TOOLS}/zipalign -p 4 SWADroid-release-unsigned.apk
|
||||
SWADroid-release.apk"
|
||||
deploy:
|
||||
provider: releases
|
||||
api_key:
|
||||
token:
|
||||
secure: ePphqb/bHjJC1wwlVfw3DNOZtluX7B/3G8a8uWDkDIBpKHqCykpnXUNmgnWEO9iQ+GUmSdkAHn+z9tKv+MAdBRgSw2Xfc8sEsj6lsWUjJxHk7/eQOdzE0FC8y8WjrKHpwbFEJAi03YId/0ruIBltMzCWyylxMTAXonrL9yAvGn9EL5m1y1Fap58XNUmDwnP+4yoTfTuXOOJrmppFGUKlR22xhI6j/zvVW1LeyA7kpp42X/76rgnSS78Fj4s/O8kN0aa6c9PM38rWg1TqgBRRuV+2PMWmZn3EfjdzBl2d+D5pJ+gPS9e+gSWpKtTkatZ+CKwSBvQSpNE6K7B1FSCSR+Gy9FtnnH0BMyeP71kMFDgU+zagZjuQZnVgRAIDYdaquNq52EwcStXV5LrqpzNpkgAfrNOSVfLZWS1eEkGy6q8WqpvBO8OcnseaiaNl4VNNRZn1e7FziDZHkA/SCr3aLOVYp4FkVK7Z+yiH2EbLJ5SeKuPWv7pEbBmNR7lzsZGZ0Rt6FmVN3yuA1/4oIN0zgdSwNEoqYGRXqG0bNeghwjLPCkpMJ3W8h82fblX40hk/f3bB3aGN9BX/oBa06MEFTSxUtp4pwfhRQVe0/13+oR2G6yei+fuGJSsil6FmaOB0jNoMvtMLI0IhQ47AflRW4QfAHnO+lbfP8ZmWdLgBidk=
|
||||
file: "$TRAVIS_BUILD_DIR/SWADroid/build/outputs/apk/release/SWADroid-release.apk"
|
||||
skip_cleanup: true
|
||||
cleanup: false
|
||||
name: SWADroid $TRAVIS_TAG
|
||||
body: Automated release from Travis CI.
|
||||
target_commitsh: "$TRAVIS_COMMIT"
|
||||
release_notes: Automated release from Travis CI.
|
||||
target_commitish: "$TRAVIS_COMMIT"
|
||||
on:
|
||||
tags: true
|
||||
repo: Amab/SWADroid
|
||||
|
|
2
.travis/run_on_before_deploy.sh
Normal file
|
@ -0,0 +1,2 @@
|
|||
#!/bin/bash
|
||||
openssl aes-256-cbc -K "$encrypted_855ad244b8b2_key" -iv "$encrypted_855ad244b8b2_iv" -in keystore.jks.enc -out keystore.jks -d
|
2
.travis/run_on_non_pull_requests.sh
Normal file
|
@ -0,0 +1,2 @@
|
|||
#!/bin/bash
|
||||
openssl aes-256-cbc -K "$encrypted_b7f76037f2f7_key" -iv "$encrypted_b7f76037f2f7_iv" -in "$TRAVIS_BUILD_DIR/SWADroid/src/prod/google-services.json.enc" -out "$TRAVIS_BUILD_DIR/SWADroid/src/prod/google-services.json" -d
|
12
README.md
|
@ -18,7 +18,6 @@ CI Status
|
|||
[![Releases](https://img.shields.io/github/release/Amab/SWADroid.svg)](https://github.com/Amab/SWADroid/releases/latest)
|
||||
[![Dependabot Status](https://api.dependabot.com/badges/status?host=github&repo=Amab/SWADroid)](https://dependabot.com)
|
||||
[![libraries.io](https://img.shields.io/librariesio/github/Amab/SWADroid.svg)](https://libraries.io/github/Amab/SWADroid)
|
||||
[![codecov](https://codecov.io/gh/Amab/SWADroid/branch/develop/graph/badge.svg)](https://codecov.io/gh/Amab/SWADroid)
|
||||
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/41ded03ee87d4ceaaafc976a7529bcf3)](https://www.codacy.com/manual/Amab/SWADroid?utm_source=github.com&utm_medium=referral&utm_content=Amab/SWADroid&utm_campaign=Badge_Grade)
|
||||
|
||||
Copyright and License
|
||||
|
@ -54,6 +53,7 @@ Contributors
|
|||
- [José Antonio Guerrero Avilés](http://www.linkedin.com/in/antonioguerreroaviles)
|
||||
- [Alejandro Alcalde](http://elbauldelprogramador.com/)
|
||||
- [Rubén Martín Hidalgo](https://github.com/romilgildo)
|
||||
- [Javier Bueno López](https://github.com/JaviBL8)
|
||||
|
||||
Contributing
|
||||
------------
|
||||
|
@ -61,3 +61,13 @@ Contributing
|
|||
SWADroid is an open source project. I encourage contributions.
|
||||
|
||||
The Github team has also been kind enough to write up some great [documentation](https://help.github.com/articles/about-pull-requests/) on working with pull requests.
|
||||
|
||||
### Notice
|
||||
|
||||
Requests to the SWAD web service require an API key. This API key has not been uploaded to the repository for security reasons.
|
||||
|
||||
The `keystore.properties` file must be created in the root of the project, at the same level as this `README.md` file, with the following format:
|
||||
|
||||
`SWAD_APP_KEY=ExampleAPIKey`
|
||||
|
||||
If you want to collaborate with the SWADroid project you can request the API key by sending a request to [Contact Support](mailto:swadroid.gmail.com).
|
||||
|
|
|
@ -44,8 +44,13 @@ if (build_param != "prod") {
|
|||
}
|
||||
|
||||
android {
|
||||
compileSdkVersion "android-29"
|
||||
buildToolsVersion '29.0.2'
|
||||
compileSdkVersion "android-30"
|
||||
buildToolsVersion '30.0.3'
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
dexOptions {
|
||||
maxProcessCount=2
|
||||
|
@ -62,7 +67,7 @@ android {
|
|||
versionName gitVersionName
|
||||
|
||||
minSdkVersion 24
|
||||
targetSdkVersion 29
|
||||
targetSdkVersion 30
|
||||
|
||||
testApplicationId "es.ugr.swad.swadroid.test"
|
||||
testInstrumentationRunner "android.test.InstrumentationTestRunner"
|
||||
|
@ -80,12 +85,14 @@ android {
|
|||
|
||||
dependencies {
|
||||
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
||||
implementation 'androidx.appcompat:appcompat:1.1.0'
|
||||
implementation 'androidx.appcompat:appcompat:1.2.0'
|
||||
implementation 'com.google.code.ksoap2-android:ksoap2-android:3.6.4'
|
||||
implementation 'commons-io:commons-io:2.6'
|
||||
implementation 'commons-io:commons-io:2.8.0'
|
||||
implementation 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
|
||||
implementation 'com.journeyapps:zxing-android-embedded:4.0.2@aar'
|
||||
implementation 'com.google.zxing:core:3.4.0'
|
||||
implementation 'com.journeyapps:zxing-android-embedded:4.1.0@aar'
|
||||
implementation 'com.google.zxing:core:3.4.1'
|
||||
implementation 'com.google.code.gson:gson:2.8.6'
|
||||
implementation 'com.google.firebase:firebase-core:17.2.1'
|
||||
}
|
||||
implementation 'com.google.android.material:material:1.2.1'
|
||||
implementation platform('com.google.firebase:firebase-bom:26.1.1')
|
||||
implementation 'com.google.firebase:firebase-analytics'
|
||||
}
|
||||
|
|
|
@ -1,48 +1,53 @@
|
|||
{
|
||||
"project_info": {
|
||||
"project_number": "",
|
||||
"project_id": ""
|
||||
"project_number": "398995989132",
|
||||
"firebase_url": "https://swadroid-1190.firebaseio.com",
|
||||
"project_id": "swadroid-1190",
|
||||
"storage_bucket": "swadroid-1190.appspot.com"
|
||||
},
|
||||
"client": [
|
||||
{
|
||||
"client_info": {
|
||||
"mobilesdk_app_id": "1:123456789012:android:1234567890123456",
|
||||
"mobilesdk_app_id": "1:398995989132:android:cf9fabf2a9cd64da",
|
||||
"android_client_info": {
|
||||
"package_name": "es.ugr.swad.swadroid"
|
||||
}
|
||||
},
|
||||
"oauth_client": [
|
||||
{
|
||||
"client_id": "",
|
||||
"client_type": 3
|
||||
},
|
||||
{
|
||||
"client_id": "",
|
||||
"client_id": "398995989132-23hrn3d7s4unrfftra30hekdtvrk1pdv.apps.googleusercontent.com",
|
||||
"client_type": 1,
|
||||
"android_info": {
|
||||
"package_name": "es.ugr.swad.swadroid",
|
||||
"certificate_hash": ""
|
||||
"certificate_hash": "11890c064b1d34fe0e6486e214439c9aa1083a70"
|
||||
}
|
||||
},
|
||||
{
|
||||
"client_id": "398995989132-olrnp4ilkdh8ggh54ruj65rocacs2pgc.apps.googleusercontent.com",
|
||||
"client_type": 1,
|
||||
"android_info": {
|
||||
"package_name": "es.ugr.swad.swadroid",
|
||||
"certificate_hash": "17c4f28f7db5404990ebfcf626b582cc8e8b54de"
|
||||
}
|
||||
},
|
||||
{
|
||||
"client_id": "398995989132-os2h8neftvc80bq785s4bqj4osmanc7l.apps.googleusercontent.com",
|
||||
"client_type": 3
|
||||
}
|
||||
],
|
||||
"api_key": [
|
||||
{
|
||||
"current_key": ""
|
||||
"current_key": "AIzaSyCyEiJ-L6CrIsiF99OUXi4UvQV2TzCVNMA"
|
||||
}
|
||||
],
|
||||
"services": {
|
||||
"analytics_service": {
|
||||
"status": 2,
|
||||
"analytics_property": {
|
||||
"tracking_id": ""
|
||||
}
|
||||
},
|
||||
"appinvite_service": {
|
||||
"status": 1,
|
||||
"other_platform_oauth_client": []
|
||||
},
|
||||
"ads_service": {
|
||||
"status": 1
|
||||
"other_platform_oauth_client": [
|
||||
{
|
||||
"client_id": "398995989132-os2h8neftvc80bq785s4bqj4osmanc7l.apps.googleusercontent.com",
|
||||
"client_type": 3
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
package="es.ugr.swad.swadroid"
|
||||
android:installLocation="auto" >
|
||||
|
||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
||||
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.GET_ACCOUNTS" android:maxSdkVersion="22"/>
|
||||
|
@ -14,6 +17,7 @@
|
|||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.CAMERA" />
|
||||
<uses-permission android:name="android.permission.VIBRATE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||
|
||||
<uses-feature
|
||||
android:name="android.hardware.touchscreen"
|
||||
|
@ -239,6 +243,46 @@
|
|||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value="es.ugr.swad.swadroid.SWADMain" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".modules.indoorlocation.IndoorLocation"
|
||||
android:theme="@style/Theme.AppCompat.Light"
|
||||
android:parentActivityName="es.ugr.swad.swadroid.SWADMain" >
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value="es.ugr.swad.swadroid.SWADMain" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".modules.indoorlocation.GetLocation"
|
||||
android:theme="@style/Theme.AppCompat.Translucent"
|
||||
android:parentActivityName="es.ugr.swad.swadroid.SWADMain" >
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value="es.ugr.swad.swadroid.SWADMain" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".modules.indoorlocation.GetLastLocation"
|
||||
android:theme="@style/Theme.AppCompat.Translucent"
|
||||
android:parentActivityName="es.ugr.swad.swadroid.SWADMain" >
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value="es.ugr.swad.swadroid.SWADMain" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".modules.indoorlocation.SendCurrentLocation"
|
||||
android:theme="@style/Theme.AppCompat.Translucent"
|
||||
android:parentActivityName="es.ugr.swad.swadroid.SWADMain" >
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value="es.ugr.swad.swadroid.SWADMain" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".modules.indoorlocation.GetAvailableRoles"
|
||||
android:theme="@style/Theme.AppCompat.Translucent"
|
||||
android:parentActivityName="es.ugr.swad.swadroid.SWADMain" >
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value="es.ugr.swad.swadroid.SWADMain" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name="es.ugr.swad.swadroid.modules.information.Information"
|
||||
android:configChanges="orientation|screenSize"
|
||||
|
|
|
@ -231,6 +231,30 @@ public class Constants {
|
|||
* Request code for search users
|
||||
*/
|
||||
public static final int SEARCH_USERS_REQUEST_CODE = 40;
|
||||
/**
|
||||
* Request code for Manage Location
|
||||
*/
|
||||
public static final int MANAGE_LOCATION = 41;
|
||||
/**
|
||||
* Request code for Find User
|
||||
*/
|
||||
public static final int FIND_USER = 42;
|
||||
/**
|
||||
* Request code for Get Location
|
||||
*/
|
||||
public static final int GET_LOCATION = 43;
|
||||
/**
|
||||
* Request code for Get Last Location
|
||||
*/
|
||||
public static final int GET_LAST_LOCATION = 44;
|
||||
/**
|
||||
* Request code for Send Current Location
|
||||
*/
|
||||
public static final int SEND_CURRENT_LOCATION = 45;
|
||||
/**
|
||||
* Request code for Get Available Roles
|
||||
*/
|
||||
public static final int GET_AVAILABLE_ROLES = 46;
|
||||
/**
|
||||
* Request code for CAMERA permission
|
||||
*/
|
||||
|
@ -239,6 +263,10 @@ public class Constants {
|
|||
* Request code for WRITE_EXTERNAL_STORAGE permission
|
||||
*/
|
||||
public static final int PERMISSIONS_REQUEST_WRITE_EXTERNAL_STORAGE = 101;
|
||||
/**
|
||||
* Request code for PERMISSION_MULTIPLE permissions
|
||||
*/
|
||||
public static final int PERMISSION_MULTIPLE = 102;
|
||||
/**
|
||||
* Prefix tag name for Logcat
|
||||
*/
|
||||
|
@ -324,7 +352,7 @@ public class Constants {
|
|||
*/
|
||||
public static final String DIRECTORY_SWADROID = "SWADroid";
|
||||
public static final String DOWNLOADS_PATH =
|
||||
Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator + DIRECTORY_SWADROID;
|
||||
Environment.DIRECTORY_DOWNLOADS + File.separator + DIRECTORY_SWADROID;
|
||||
|
||||
/**
|
||||
* Username template for messages
|
||||
|
|
|
@ -60,6 +60,7 @@ import es.ugr.swad.swadroid.modules.courses.Courses;
|
|||
import es.ugr.swad.swadroid.modules.downloads.DownloadsManager;
|
||||
import es.ugr.swad.swadroid.modules.groups.MyGroupsManager;
|
||||
import es.ugr.swad.swadroid.modules.information.Information;
|
||||
import es.ugr.swad.swadroid.modules.indoorlocation.IndoorLocation;
|
||||
import es.ugr.swad.swadroid.modules.login.Login;
|
||||
import es.ugr.swad.swadroid.modules.login.LoginActivity;
|
||||
import es.ugr.swad.swadroid.modules.messages.Messages;
|
||||
|
@ -580,6 +581,8 @@ public class SWADMain extends MenuExpandableListActivity {
|
|||
mUsersData.add(getMenuItem(R.string.myGroupsModuleLabel, R.string.fa_sitemap));
|
||||
//Generate QR code
|
||||
mUsersData.add(getMenuItem(R.string.generateQRModuleLabel, R.string.fa_qrcode));
|
||||
//Manage location
|
||||
mUsersData.add(getMenuItem(R.string.manageLocation, R.string.fa_map_marker));
|
||||
|
||||
//Messages category
|
||||
//Notifications
|
||||
|
@ -685,6 +688,9 @@ public class SWADMain extends MenuExpandableListActivity {
|
|||
} else if (keyword.equals(getString(R.string.generateQRModuleLabel))) {
|
||||
activity = new Intent(ctx, GenerateQR.class);
|
||||
startActivityForResult(activity, Constants.GENERATE_QR_REQUEST_CODE);
|
||||
} else if (keyword.equals(getString(R.string.manageLocation))) {
|
||||
activity = new Intent(ctx, IndoorLocation.class);
|
||||
startActivityForResult(activity, Constants.MANAGE_LOCATION);
|
||||
} else if (keyword.equals(getString(R.string.documentsDownloadModuleLabel))) {
|
||||
activity = new Intent(ctx, DownloadsManager.class);
|
||||
activity.putExtra("downloadsAreaCode", Constants.DOCUMENTS_AREA_CODE);
|
||||
|
|
|
@ -465,6 +465,7 @@ public class DataBaseHelper {
|
|||
crypto.decrypt(ent.getString("surname2Recipient")),
|
||||
crypto.decrypt(ent.getString("firstnameRecipient")),
|
||||
crypto.decrypt(ent.getString("photoRecipient")),
|
||||
ent.getInt("userCode"),
|
||||
false,
|
||||
ent.getDouble("score"));
|
||||
break;
|
||||
|
|
|
@ -54,6 +54,10 @@ public class FrequentUser extends Model implements Serializable{
|
|||
* Full path where user's picture is stored.
|
||||
*/
|
||||
private String userPhoto;
|
||||
/**
|
||||
* Unique identifier for each user.
|
||||
*/
|
||||
private int userCode;
|
||||
/**
|
||||
* Is a receiver?.
|
||||
*/
|
||||
|
@ -72,16 +76,18 @@ public class FrequentUser extends Model implements Serializable{
|
|||
* @param userSurname2 User last surname.
|
||||
* @param userFirstname User name.
|
||||
* @param userPhoto Full path where user's picture is stored.
|
||||
* @param userCode User code.
|
||||
* @param selectedCheckbox Is a receiver?.
|
||||
* @param score Score of frequent recipient
|
||||
*/
|
||||
public FrequentUser(String idUser, String userNickname, String userSurname1, String userSurname2, String userFirstname, String userPhoto, boolean selectedCheckbox, double score) {
|
||||
public FrequentUser(String idUser, String userNickname, String userSurname1, String userSurname2, String userFirstname, String userPhoto, int userCode, boolean selectedCheckbox, double score) {
|
||||
this.idUser = idUser;
|
||||
this.userNickname = userNickname;
|
||||
this.userSurname1 = userSurname1;
|
||||
this.userSurname2 = userSurname2;
|
||||
this.userFirstname = userFirstname;
|
||||
this.userPhoto = userPhoto;
|
||||
this.userCode = userCode;
|
||||
this.selectedCheckbox = selectedCheckbox;
|
||||
this.score = score;
|
||||
}
|
||||
|
@ -194,6 +200,24 @@ public class FrequentUser extends Model implements Serializable{
|
|||
this.userPhoto = userPhoto;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets userCode.
|
||||
*
|
||||
* @return the userPhoto
|
||||
*/
|
||||
public int getUserCode() {
|
||||
return userCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets userCode.
|
||||
*
|
||||
* @param userCode
|
||||
*/
|
||||
public void setUserCode(int userCode) {
|
||||
this.userCode = userCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get if checkbox is selected.
|
||||
*
|
||||
|
|
371
SWADroid/src/main/java/es/ugr/swad/swadroid/model/Location.java
Normal file
|
@ -0,0 +1,371 @@
|
|||
package es.ugr.swad.swadroid.model;
|
||||
|
||||
import org.ksoap2.serialization.PropertyInfo;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Hashtable;
|
||||
|
||||
public class Location extends Model implements Serializable {
|
||||
|
||||
protected int institutionCode;
|
||||
|
||||
protected String institutionShortName;
|
||||
|
||||
protected String institutionFullName;
|
||||
|
||||
protected int centerCode;
|
||||
|
||||
protected String centerShortName;
|
||||
|
||||
protected String centerFullName;
|
||||
|
||||
protected int buildingCode;
|
||||
|
||||
protected String buildingShortName;
|
||||
|
||||
protected String buildingFullName;
|
||||
|
||||
protected int floor;
|
||||
|
||||
protected int roomCode;
|
||||
|
||||
protected String roomShortName;
|
||||
|
||||
protected String roomFullName;
|
||||
|
||||
protected static final PropertyInfo PI_id = new PropertyInfo();
|
||||
protected static final PropertyInfo PI_institutionCode = new PropertyInfo();
|
||||
protected static final PropertyInfo PI_institutionShortName = new PropertyInfo();
|
||||
protected static final PropertyInfo PI_institutionFullName = new PropertyInfo();
|
||||
protected static final PropertyInfo PI_centerCode = new PropertyInfo();
|
||||
protected static final PropertyInfo PI_centerShortName = new PropertyInfo();
|
||||
protected static final PropertyInfo PI_centerFullName = new PropertyInfo();
|
||||
protected static final PropertyInfo PI_buildingCode = new PropertyInfo();
|
||||
protected static final PropertyInfo PI_buildingShortName = new PropertyInfo();
|
||||
protected static final PropertyInfo PI_buildingFullName = new PropertyInfo();
|
||||
protected static final PropertyInfo PI_floor = new PropertyInfo();
|
||||
protected static final PropertyInfo PI_roomCode = new PropertyInfo();
|
||||
protected static final PropertyInfo PI_roomShortName = new PropertyInfo();
|
||||
protected static final PropertyInfo PI_roomFullName = new PropertyInfo();
|
||||
protected static PropertyInfo[] PI_PROP_ARRAY =
|
||||
{
|
||||
PI_id,
|
||||
PI_institutionCode,
|
||||
PI_institutionShortName,
|
||||
PI_institutionFullName,
|
||||
PI_centerCode,
|
||||
PI_centerShortName,
|
||||
PI_centerFullName,
|
||||
PI_buildingCode,
|
||||
PI_buildingShortName,
|
||||
PI_buildingFullName,
|
||||
PI_floor,
|
||||
PI_roomCode,
|
||||
PI_roomShortName,
|
||||
PI_roomFullName
|
||||
};
|
||||
|
||||
public Location(int institutionCode, String institutionShortName, String institutionFullName, int centerCode, String centerShortName, String centerFullName, int buildingCode, String buildingShortName, String buildingFullName, int floor, int roomCode, String roomShortName, String roomFullName) {
|
||||
this.institutionCode = institutionCode;
|
||||
this.institutionShortName = institutionShortName;
|
||||
this.institutionFullName = institutionFullName;
|
||||
this.centerCode = centerCode;
|
||||
this.centerShortName = centerShortName;
|
||||
this.centerFullName = centerFullName;
|
||||
this.buildingCode = buildingCode;
|
||||
this.buildingShortName = buildingShortName;
|
||||
this.buildingFullName = buildingFullName;
|
||||
this.floor = floor;
|
||||
this.roomCode = roomCode;
|
||||
this.roomShortName = roomShortName;
|
||||
this.roomFullName = roomFullName;
|
||||
}
|
||||
|
||||
public int getInstitutionCode() {
|
||||
return institutionCode;
|
||||
}
|
||||
|
||||
public void setInstitutionCode(int institutionCode) {
|
||||
this.institutionCode = institutionCode;
|
||||
}
|
||||
|
||||
public String getInstitutionShortName() {
|
||||
return institutionShortName;
|
||||
}
|
||||
|
||||
public void setInstitutionShortName(String institutionShortName) {
|
||||
this.institutionShortName = institutionShortName;
|
||||
}
|
||||
|
||||
public String getInstitutionFullName() {
|
||||
return institutionFullName;
|
||||
}
|
||||
|
||||
public void setInstitutionFullName(String institutionFullName) {
|
||||
this.institutionFullName = institutionFullName;
|
||||
}
|
||||
|
||||
public int getCenterCode() {
|
||||
return centerCode;
|
||||
}
|
||||
|
||||
public void setCenterCode(int centerCode) {
|
||||
this.centerCode = centerCode;
|
||||
}
|
||||
|
||||
public String getCenterShortName() {
|
||||
return centerShortName;
|
||||
}
|
||||
|
||||
public void setCenterShortName(String centerShortName) {
|
||||
this.centerShortName = centerShortName;
|
||||
}
|
||||
|
||||
public String getCenterFullName() {
|
||||
return centerFullName;
|
||||
}
|
||||
|
||||
public void setCenterFullName(String centerFullName) {
|
||||
this.centerFullName = centerFullName;
|
||||
}
|
||||
|
||||
public int getBuildingCode() {
|
||||
return buildingCode;
|
||||
}
|
||||
|
||||
public void setBuildingCode(int buildingCode) {
|
||||
this.buildingCode = buildingCode;
|
||||
}
|
||||
|
||||
public String getBuildingShortName() {
|
||||
return buildingShortName;
|
||||
}
|
||||
|
||||
public void setBuildingShortName(String buildingShortName) {
|
||||
this.buildingShortName = buildingShortName;
|
||||
}
|
||||
|
||||
public String getBuildingFullName() {
|
||||
return buildingFullName;
|
||||
}
|
||||
|
||||
public void setBuildingFullName(String buildingFullName) {
|
||||
this.buildingFullName = buildingFullName;
|
||||
}
|
||||
|
||||
public int getFloor() {
|
||||
return floor;
|
||||
}
|
||||
|
||||
public void setFloor(int floor) {
|
||||
this.floor = floor;
|
||||
}
|
||||
|
||||
public int getRoomCode() {
|
||||
return roomCode;
|
||||
}
|
||||
|
||||
public void setRoomCode(int roomCode) {
|
||||
this.roomCode = roomCode;
|
||||
}
|
||||
|
||||
public String getRoomShortName() {
|
||||
return roomShortName;
|
||||
}
|
||||
|
||||
public void setRoomShortName(String roomShortName) {
|
||||
this.roomShortName = roomShortName;
|
||||
}
|
||||
|
||||
public String getRoomFullName() {
|
||||
return roomFullName;
|
||||
}
|
||||
|
||||
public void setRoomFullName(String roomFullName) {
|
||||
this.roomFullName = roomFullName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getProperty(int param) {
|
||||
Object object = null;
|
||||
switch (param) {
|
||||
case 0:
|
||||
object = this.getId();
|
||||
break;
|
||||
case 1:
|
||||
object = institutionCode;
|
||||
break;
|
||||
case 2:
|
||||
object = institutionShortName;
|
||||
break;
|
||||
case 3:
|
||||
object = institutionFullName;
|
||||
break;
|
||||
case 4:
|
||||
object = centerCode;
|
||||
break;
|
||||
case 5:
|
||||
object = centerShortName;
|
||||
break;
|
||||
case 6:
|
||||
object = centerFullName;
|
||||
break;
|
||||
case 7:
|
||||
object = buildingCode;
|
||||
break;
|
||||
case 8:
|
||||
object = buildingShortName;
|
||||
break;
|
||||
case 9:
|
||||
object = buildingFullName;
|
||||
break;
|
||||
case 10:
|
||||
object = floor;
|
||||
break;
|
||||
case 11:
|
||||
object = roomCode;
|
||||
break;
|
||||
case 12:
|
||||
object = roomShortName;
|
||||
break;
|
||||
case 13:
|
||||
object = roomFullName;
|
||||
break;
|
||||
}
|
||||
return object;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPropertyCount() {
|
||||
return PI_PROP_ARRAY.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setProperty(int param, Object obj) {
|
||||
switch (param) {
|
||||
case 0:
|
||||
this.setId((Long) obj);
|
||||
break;
|
||||
case 1:
|
||||
institutionCode = (Integer) obj;
|
||||
break;
|
||||
case 2:
|
||||
institutionShortName = (String) obj;
|
||||
break;
|
||||
case 3:
|
||||
institutionFullName = (String) obj;
|
||||
break;
|
||||
case 4:
|
||||
centerCode = (Integer) obj;
|
||||
break;
|
||||
case 5:
|
||||
centerShortName = (String) obj;
|
||||
break;
|
||||
case 6:
|
||||
centerFullName = (String) obj;
|
||||
break;
|
||||
case 7:
|
||||
buildingCode = (Integer) obj;
|
||||
break;
|
||||
case 8:
|
||||
buildingShortName = (String) obj;
|
||||
break;
|
||||
case 9:
|
||||
buildingFullName = (String) obj;
|
||||
break;
|
||||
case 10:
|
||||
floor = (Integer) obj;
|
||||
break;
|
||||
case 11:
|
||||
roomCode = (Integer) obj;
|
||||
break;
|
||||
case 12:
|
||||
roomShortName = (String) obj;
|
||||
break;
|
||||
case 13:
|
||||
roomFullName = (String) obj;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getPropertyInfo(int param, Hashtable properties, PropertyInfo propertyInfo) {
|
||||
switch (param) {
|
||||
case 0:
|
||||
propertyInfo.type = PropertyInfo.LONG_CLASS;
|
||||
propertyInfo.name = "id";
|
||||
break;
|
||||
case 1:
|
||||
propertyInfo.type = PropertyInfo.INTEGER_CLASS;
|
||||
propertyInfo.name = "institutionCode";
|
||||
break;
|
||||
case 2:
|
||||
propertyInfo.type = PropertyInfo.STRING_CLASS;
|
||||
propertyInfo.name = "institutionShortName";
|
||||
break;
|
||||
case 3:
|
||||
propertyInfo.type = PropertyInfo.STRING_CLASS;
|
||||
propertyInfo.name = "institutionFullName";
|
||||
break;
|
||||
case 4:
|
||||
propertyInfo.type = PropertyInfo.INTEGER_CLASS;
|
||||
propertyInfo.name = "centerCode";
|
||||
break;
|
||||
case 5:
|
||||
propertyInfo.type = PropertyInfo.STRING_CLASS;
|
||||
propertyInfo.name = "centerShortName";
|
||||
break;
|
||||
case 6:
|
||||
propertyInfo.type = PropertyInfo.STRING_CLASS;
|
||||
propertyInfo.name = "centerFullName";
|
||||
break;
|
||||
case 7:
|
||||
propertyInfo.type = PropertyInfo.INTEGER_CLASS;
|
||||
propertyInfo.name = "buildingCode";
|
||||
break;
|
||||
case 8:
|
||||
propertyInfo.type = PropertyInfo.STRING_CLASS;
|
||||
propertyInfo.name = "buildingShortName";
|
||||
break;
|
||||
case 9:
|
||||
propertyInfo.type = PropertyInfo.STRING_CLASS;
|
||||
propertyInfo.name = "buildingFullName";
|
||||
break;
|
||||
case 10:
|
||||
propertyInfo.type = PropertyInfo.INTEGER_CLASS;
|
||||
propertyInfo.name = "floor";
|
||||
break;
|
||||
case 11:
|
||||
propertyInfo.type = PropertyInfo.INTEGER_CLASS;
|
||||
propertyInfo.name = "roomCode";
|
||||
break;
|
||||
case 12:
|
||||
propertyInfo.type = PropertyInfo.STRING_CLASS;
|
||||
propertyInfo.name = "roomShortName";
|
||||
break;
|
||||
case 13:
|
||||
propertyInfo.type = PropertyInfo.STRING_CLASS;
|
||||
propertyInfo.name = "roomFullName";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Location{" +
|
||||
"institutionCode=" + institutionCode +
|
||||
", institutionShortName='" + institutionShortName + '\'' +
|
||||
", institutionFullName='" + institutionFullName + '\'' +
|
||||
", centerCode=" + centerCode +
|
||||
", centerShortName='" + centerShortName + '\'' +
|
||||
", centerFullName='" + centerFullName + '\'' +
|
||||
", buildingCode=" + buildingCode +
|
||||
", buildingShortName='" + buildingShortName + '\'' +
|
||||
", buildingFullName='" + buildingFullName + '\'' +
|
||||
", floor=" + floor +
|
||||
", roomCode=" + roomCode +
|
||||
", roomShortName='" + roomShortName + '\'' +
|
||||
", roomFullName='" + roomFullName + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
|
@ -0,0 +1,79 @@
|
|||
package es.ugr.swad.swadroid.model;
|
||||
|
||||
import org.ksoap2.serialization.PropertyInfo;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Hashtable;
|
||||
|
||||
public class LocationTimeStamp extends Location implements Serializable {
|
||||
|
||||
private int checkInTime;
|
||||
|
||||
public LocationTimeStamp(int institutionCode, String institutionShortName, String institutionFullName, int centerCode, String centerShortName, String centerFullName, int buildingCode, String buildingShortName, String buildingFullName, int floor, int roomCode, String roomShortName, String roomFullName, int checkInTime) {
|
||||
super(institutionCode, institutionShortName, institutionFullName, centerCode, centerShortName, centerFullName, buildingCode, buildingShortName, buildingFullName, floor, roomCode, roomShortName, roomFullName);
|
||||
this.checkInTime = checkInTime;
|
||||
}
|
||||
|
||||
public int getCheckInTime() {
|
||||
return checkInTime;
|
||||
}
|
||||
|
||||
public void setCheckInTime(int checkInTime) {
|
||||
this.checkInTime = checkInTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getProperty(int param) {
|
||||
Object object;
|
||||
if (param == 14) {
|
||||
object = checkInTime;
|
||||
} else {
|
||||
object = super.getProperty(param);
|
||||
}
|
||||
return object;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPropertyCount() {
|
||||
return PI_PROP_ARRAY.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setProperty(int param, Object obj) {
|
||||
if (param == 14) {
|
||||
checkInTime = (int) obj;
|
||||
} else {
|
||||
super.setProperty(param, obj);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getPropertyInfo(int param, Hashtable properties, PropertyInfo propertyInfo) {
|
||||
if (param == 14) {
|
||||
propertyInfo.type = PropertyInfo.INTEGER_CLASS;
|
||||
propertyInfo.name = "checkInTime";
|
||||
} else {
|
||||
super.getPropertyInfo(param, properties, propertyInfo);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "LocationTimeStamp{" +
|
||||
"institutionCode=" + institutionCode +
|
||||
", institutionShortName='" + institutionShortName + '\'' +
|
||||
", institutionFullName='" + institutionFullName + '\'' +
|
||||
", centerCode=" + centerCode +
|
||||
", centerShortName='" + centerShortName + '\'' +
|
||||
", centerFullName='" + centerFullName + '\'' +
|
||||
", buildingCode=" + buildingCode +
|
||||
", buildingShortName='" + buildingShortName + '\'' +
|
||||
", buildingFullName='" + buildingFullName + '\'' +
|
||||
", floor=" + floor +
|
||||
", roomCode=" + roomCode +
|
||||
", roomShortName='" + roomShortName + '\'' +
|
||||
", roomFullName='" + roomFullName + '\'' +
|
||||
", checkInTime'" + checkInTime + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
76
SWADroid/src/main/java/es/ugr/swad/swadroid/model/Roles.java
Normal file
|
@ -0,0 +1,76 @@
|
|||
package es.ugr.swad.swadroid.model;
|
||||
|
||||
import org.ksoap2.serialization.PropertyInfo;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Hashtable;
|
||||
|
||||
public class Roles extends Model implements Serializable {
|
||||
|
||||
private int rol;
|
||||
|
||||
protected static final PropertyInfo PI_id = new PropertyInfo();
|
||||
protected static final PropertyInfo PI_roles = new PropertyInfo();
|
||||
protected static PropertyInfo[] PI_PROP_ARRAY =
|
||||
{
|
||||
PI_id,
|
||||
PI_roles
|
||||
};
|
||||
|
||||
public Roles(int rol) {
|
||||
this.rol = rol;
|
||||
}
|
||||
|
||||
public int getRol() {
|
||||
return rol;
|
||||
}
|
||||
|
||||
public void setRol(int rol) {
|
||||
this.rol = rol;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getProperty(int param) {
|
||||
Object object = null;
|
||||
switch (param) {
|
||||
case 0:
|
||||
object = this.getId();
|
||||
break;
|
||||
case 1:
|
||||
object = rol;
|
||||
break;
|
||||
}
|
||||
return object;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPropertyCount() {
|
||||
return PI_PROP_ARRAY.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setProperty(int param, Object obj) {
|
||||
switch (param) {
|
||||
case 0:
|
||||
this.setId((Long) obj);
|
||||
break;
|
||||
case 1:
|
||||
rol = (int) obj;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getPropertyInfo(int param, Hashtable properties, PropertyInfo propertyInfo) {
|
||||
switch (param) {
|
||||
case 0:
|
||||
propertyInfo.type = PropertyInfo.LONG_CLASS;
|
||||
propertyInfo.name = "id";
|
||||
break;
|
||||
case 1:
|
||||
propertyInfo.type = PropertyInfo.INTEGER_CLASS;
|
||||
propertyInfo.name = "roles";
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -50,6 +50,10 @@ public class UserFilter extends Model implements Serializable{
|
|||
* Full path where user's picture is stored.
|
||||
*/
|
||||
private String userPhoto;
|
||||
/**
|
||||
* Unique identifier for each user
|
||||
*/
|
||||
private int userCode;
|
||||
/**
|
||||
* Is a receiver?.
|
||||
*/
|
||||
|
@ -57,20 +61,21 @@ public class UserFilter extends Model implements Serializable{
|
|||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param userNickname User identifier.
|
||||
* @param userSurname1 User first surname.
|
||||
* @param userSurname2 User last surname.
|
||||
* @param userFirstname User name.
|
||||
* @param userPhoto Full path where user's picture is stored.
|
||||
* @param userCode Unique identifier for each user
|
||||
* @param selectedCheckbox Is a receiver?.
|
||||
*/
|
||||
public UserFilter(String userNickname, String userSurname1, String userSurname2, String userFirstname, String userPhoto, boolean selectedCheckbox){
|
||||
public UserFilter(String userNickname, String userSurname1, String userSurname2, String userFirstname, String userPhoto, int userCode, boolean selectedCheckbox){
|
||||
this.userNickname = userNickname;
|
||||
this.userSurname1 = userSurname1;
|
||||
this.userSurname2 = userSurname2;
|
||||
this.userFirstname = userFirstname;
|
||||
this.userPhoto = userPhoto;
|
||||
this.userCode = userCode;
|
||||
this.selectedCheckbox = selectedCheckbox;
|
||||
}
|
||||
|
||||
|
@ -164,6 +169,24 @@ public class UserFilter extends Model implements Serializable{
|
|||
this.userPhoto = userPhoto;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets users code.
|
||||
*
|
||||
* @return the userCode
|
||||
*/
|
||||
public int getUserCode() {
|
||||
return userCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets user code.
|
||||
*
|
||||
* @param userCode the userCode to set
|
||||
*/
|
||||
public void setUserCode(int userCode) {
|
||||
this.userCode = userCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get if checkbox is selected.
|
||||
*
|
||||
|
|
|
@ -21,20 +21,15 @@ package es.ugr.swad.swadroid.modules.downloads;
|
|||
import android.annotation.TargetApi;
|
||||
import android.app.DownloadManager;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.ResolveInfo;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Environment;
|
||||
import android.util.Log;
|
||||
import android.widget.Toast;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import es.ugr.swad.swadroid.Constants;
|
||||
import es.ugr.swad.swadroid.utils.Utils;
|
||||
|
||||
/**
|
||||
* Class for manage file downloads
|
||||
|
@ -60,58 +55,26 @@ public class DownloadFactory {
|
|||
String description) {
|
||||
|
||||
Uri uri = Uri.parse(url);
|
||||
DownloadManager managerHoneycomb;
|
||||
DownloadManager.Request requestHoneycomb;
|
||||
es.ugr.swad.swadroid.modules.downloads.DownloadManager managerGingerbread;
|
||||
es.ugr.swad.swadroid.modules.downloads.DownloadManager.Request requestGingerbread;
|
||||
|
||||
//Create destination directory if not exists
|
||||
File downloadDirectory = new File(Constants.DOWNLOADS_PATH);
|
||||
if (!downloadDirectory.exists()){
|
||||
if(downloadDirectory.mkdir()) {
|
||||
Log.i(TAG, "Created directory " + Constants.DOWNLOADS_PATH);
|
||||
} else {
|
||||
Log.e(TAG, "Error creating directory " + Constants.DOWNLOADS_PATH);
|
||||
Toast.makeText(context, "Error creating directory " + Constants.DOWNLOADS_PATH, Toast.LENGTH_LONG).show();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
DownloadManager manager;
|
||||
DownloadManager.Request request;
|
||||
|
||||
managerHoneycomb = (DownloadManager) context.getSystemService(Context.DOWNLOAD_SERVICE);
|
||||
requestHoneycomb = new DownloadManager.Request(uri);
|
||||
manager = (DownloadManager) context.getSystemService(Context.DOWNLOAD_SERVICE);
|
||||
request = new DownloadManager.Request(uri);
|
||||
|
||||
requestHoneycomb.setDescription(title);
|
||||
requestHoneycomb.setTitle(description);
|
||||
requestHoneycomb.setDestinationInExternalPublicDir(Constants.DIRECTORY_SWADROID, fileName);
|
||||
request.setDescription(title);
|
||||
request.setTitle(description);
|
||||
request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, Constants.DIRECTORY_SWADROID + File.separator + fileName);
|
||||
|
||||
//DownloadManager HONEYCOMB
|
||||
Log.i(TAG, "Downloading file " + fileName + " with DownloadManager >= HONEYCOMB");
|
||||
Log.i(TAG, "Downloading file " + fileName);
|
||||
|
||||
requestHoneycomb.allowScanningByMediaScanner();
|
||||
requestHoneycomb.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
|
||||
request.allowScanningByMediaScanner();
|
||||
request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
|
||||
|
||||
managerHoneycomb.enqueue(requestHoneycomb);
|
||||
manager.enqueue(request);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param context used to check the device version and DownloadManager information
|
||||
* @return true if the download manager is available
|
||||
*/
|
||||
public static boolean isDownloadManagerAvailable(Context context) {
|
||||
try {
|
||||
Intent intent = new Intent(Intent.ACTION_MAIN);
|
||||
intent.addCategory(Intent.CATEGORY_LAUNCHER);
|
||||
intent.setClassName("com.android.providers.downloads.ui", "com.android.providers.downloads.ui.DownloadList");
|
||||
List<ResolveInfo> list = context.getPackageManager().queryIntentActivities(intent,
|
||||
PackageManager.MATCH_DEFAULT_ONLY);
|
||||
return list.size() > 0;
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to show file size in bytes in a human readable way
|
||||
* http://stackoverflow.com/questions/3758606/how-to-convert-byte-size-into-human-readable-format-in-java
|
||||
|
|
|
@ -0,0 +1,82 @@
|
|||
package es.ugr.swad.swadroid.modules.indoorlocation;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
|
||||
import org.ksoap2.serialization.SoapObject;
|
||||
|
||||
import es.ugr.swad.swadroid.Constants;
|
||||
import es.ugr.swad.swadroid.model.Roles;
|
||||
import es.ugr.swad.swadroid.modules.Module;
|
||||
import es.ugr.swad.swadroid.modules.courses.Courses;
|
||||
import es.ugr.swad.swadroid.modules.login.Login;
|
||||
import es.ugr.swad.swadroid.webservices.SOAPClient;
|
||||
|
||||
public class GetAvailableRoles extends Module {
|
||||
|
||||
private Roles roles;
|
||||
|
||||
/**
|
||||
* Messages tag name for Logcat
|
||||
*/
|
||||
private static final String TAG = Constants.APP_TAG + " GetAvailableRoles";
|
||||
|
||||
@Override
|
||||
protected void runConnection() {
|
||||
super.runConnection();
|
||||
if (!isConnected) {
|
||||
setResult(RESULT_CANCELED);
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see android.app.Activity#onCreate()
|
||||
*/
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setMETHOD_NAME("getAvailableRoles");
|
||||
getSupportActionBar().hide();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see android.app.Activity#onStart()
|
||||
*/
|
||||
@Override
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
connect();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void requestService() throws Exception {
|
||||
createRequest(SOAPClient.CLIENT_TYPE);
|
||||
addParam("wsKey", Login.getLoggedUser().getWsKey());
|
||||
addParam("courseCode", Courses.getSelectedCourseCode());
|
||||
sendRequest(Roles.class, true);
|
||||
|
||||
if (result!=null) {
|
||||
int rol = Integer.parseInt(((SoapObject) result).getProperty("roles").toString());
|
||||
roles = new Roles(rol);
|
||||
}
|
||||
Intent intent = new Intent();
|
||||
intent.putExtra("roles", roles);
|
||||
setResult(RESULT_OK, intent);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void connect() {
|
||||
startConnection();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void postConnect() {
|
||||
finish();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onError() {
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,103 @@
|
|||
package es.ugr.swad.swadroid.modules.indoorlocation;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
|
||||
import org.ksoap2.serialization.SoapObject;
|
||||
|
||||
import es.ugr.swad.swadroid.Constants;
|
||||
import es.ugr.swad.swadroid.model.LocationTimeStamp;
|
||||
import es.ugr.swad.swadroid.modules.Module;
|
||||
import es.ugr.swad.swadroid.modules.login.Login;
|
||||
import es.ugr.swad.swadroid.webservices.SOAPClient;
|
||||
|
||||
|
||||
public class GetLastLocation extends Module {
|
||||
|
||||
private int userCode;
|
||||
private LocationTimeStamp locationTimeStamp;
|
||||
/**
|
||||
* Messages tag name for Logcat
|
||||
*/
|
||||
private static final String TAG = Constants.APP_TAG + " GetLastLocation";
|
||||
|
||||
@Override
|
||||
protected void runConnection() {
|
||||
super.runConnection();
|
||||
if (!isConnected) {
|
||||
setResult(RESULT_CANCELED);
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see android.app.Activity#onCreate()
|
||||
*/
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setMETHOD_NAME("getLastLocation");
|
||||
getSupportActionBar().hide();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see android.app.Activity#onStart()
|
||||
*/
|
||||
@Override
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
userCode = getIntent().getIntExtra("userCode", -1);
|
||||
connect();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void requestService() throws Exception {
|
||||
createRequest(SOAPClient.CLIENT_TYPE);
|
||||
addParam("wsKey", Login.getLoggedUser().getWsKey());
|
||||
addParam("userCode", userCode);
|
||||
sendRequest(LocationTimeStamp.class, true);
|
||||
|
||||
if (result!=null) {
|
||||
SoapObject soap = (SoapObject) result;
|
||||
SoapObject properties = (SoapObject)soap.getProperty(0);
|
||||
|
||||
int institutionCode = Integer.parseInt(properties.getProperty("institutionCode").toString());
|
||||
String institutionShortName = properties.getProperty("institutionShortName").toString();
|
||||
String institutionFullName = properties.getProperty("institutionFullName").toString();
|
||||
int centerCode = Integer.parseInt(properties.getProperty("centerCode").toString());
|
||||
String centerShortName = properties.getProperty("centerShortName").toString();
|
||||
String centerFullName = properties.getProperty("centerFullName").toString();
|
||||
int buildingCode = Integer.parseInt(properties.getProperty("buildingCode").toString());
|
||||
String buildingShortName = properties.getProperty("buildingShortName").toString();
|
||||
String buildingFullName = properties.getProperty("buildingFullName").toString();
|
||||
int floor = Integer.parseInt(properties.getProperty("floor").toString());
|
||||
int roomCode = Integer.parseInt(properties.getProperty("roomCode").toString());
|
||||
String roomShortName = properties.getProperty("roomShortName").toString();
|
||||
String roomFullName = properties.getProperty("roomFullName").toString();
|
||||
int checkInTime = Integer.parseInt(soap.getProperty(1).toString());
|
||||
|
||||
locationTimeStamp = new LocationTimeStamp(institutionCode, institutionShortName, institutionFullName,
|
||||
centerCode, centerShortName, centerFullName, buildingCode, buildingShortName, buildingFullName,
|
||||
floor, roomCode, roomShortName, roomFullName, checkInTime);
|
||||
}
|
||||
Intent intent = new Intent();
|
||||
intent.putExtra("locationTimeStamp", locationTimeStamp);
|
||||
setResult(RESULT_OK, intent);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void connect() {
|
||||
startConnection();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void postConnect() {
|
||||
finish();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onError() {
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,120 @@
|
|||
package es.ugr.swad.swadroid.modules.indoorlocation;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
|
||||
import org.ksoap2.serialization.SoapObject;
|
||||
|
||||
import es.ugr.swad.swadroid.Constants;
|
||||
import es.ugr.swad.swadroid.model.Location;
|
||||
import es.ugr.swad.swadroid.modules.Module;
|
||||
import es.ugr.swad.swadroid.modules.login.Login;
|
||||
import es.ugr.swad.swadroid.webservices.SOAPClient;
|
||||
|
||||
public class GetLocation extends Module {
|
||||
/**
|
||||
* Physical address of AP
|
||||
*/
|
||||
private String mac;
|
||||
/**
|
||||
* Distance to AP
|
||||
*/
|
||||
private double distance;
|
||||
/**
|
||||
* Default distance
|
||||
*/
|
||||
private final double defaultDistance = 500;
|
||||
/**
|
||||
* Location related to mac
|
||||
*/
|
||||
private Location location;
|
||||
/**
|
||||
* Messages tag name for Logcat
|
||||
*/
|
||||
private static final String TAG = Constants.APP_TAG + " GetLocation";
|
||||
|
||||
@Override
|
||||
protected void runConnection() {
|
||||
super.runConnection();
|
||||
if (!isConnected) {
|
||||
setResult(RESULT_CANCELED);
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see android.app.Activity#onCreate()
|
||||
*/
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setMETHOD_NAME("getLocation");
|
||||
getSupportActionBar().hide();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see android.app.Activity#onStart()
|
||||
*/
|
||||
@Override
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
mac = getIntent().getStringExtra("mac");
|
||||
distance = getIntent().getDoubleExtra("distance", defaultDistance);
|
||||
connect();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void requestService() throws Exception {
|
||||
createRequest(SOAPClient.CLIENT_TYPE);
|
||||
addParam("wsKey", Login.getLoggedUser().getWsKey());
|
||||
addParam("MAC", mac);
|
||||
sendRequest(Location.class, true);
|
||||
|
||||
if (result != null) {
|
||||
SoapObject soap = (SoapObject) result;
|
||||
soap = (SoapObject)soap.getProperty(0);
|
||||
|
||||
int roomCode = Integer.parseInt(soap.getProperty("roomCode").toString());
|
||||
|
||||
if (roomCode != -1) {
|
||||
int institutionCode = Integer.parseInt(soap.getProperty("institutionCode").toString());
|
||||
String institutionShortName = soap.getProperty("institutionShortName").toString();
|
||||
String institutionFullName = soap.getProperty("institutionShortName").toString();
|
||||
int centerCode = Integer.parseInt(soap.getProperty("centerCode").toString());
|
||||
String centerShortName = soap.getProperty("centerShortName").toString();
|
||||
String centerFullName = soap.getProperty("centerFullName").toString();
|
||||
int buildingCode = Integer.parseInt(soap.getProperty("buildingCode").toString());
|
||||
String buildingShortName = soap.getProperty("buildingShortName").toString();
|
||||
String buildingFullName = soap.getProperty("buildingFullName").toString();
|
||||
int floor = Integer.parseInt(soap.getProperty("floor").toString());
|
||||
String roomShortName = soap.getProperty("roomShortName").toString();
|
||||
String roomFullName = soap.getProperty("roomFullName").toString();
|
||||
|
||||
location = new Location(institutionCode, institutionShortName, institutionFullName,
|
||||
centerCode, centerShortName, centerFullName, buildingCode, buildingShortName, buildingFullName,
|
||||
floor, roomCode, roomShortName, roomFullName);
|
||||
} else {
|
||||
location = null;
|
||||
}
|
||||
}
|
||||
Intent intent = new Intent();
|
||||
intent.putExtra("location", location);
|
||||
intent.putExtra("distance", distance);
|
||||
setResult(RESULT_OK, intent);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void connect() {
|
||||
startConnection();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void postConnect() {
|
||||
finish();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onError() {
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,354 @@
|
|||
package es.ugr.swad.swadroid.modules.indoorlocation;
|
||||
|
||||
import android.Manifest;
|
||||
import android.app.Activity;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.ClipData;
|
||||
import android.content.ClipboardManager;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.net.wifi.ScanResult;
|
||||
import android.net.wifi.WifiManager;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Parcelable;
|
||||
import android.util.Log;
|
||||
import android.util.Pair;
|
||||
import android.view.View;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.RequiresApi;
|
||||
import androidx.core.app.ActivityCompat;
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import es.ugr.swad.swadroid.Constants;
|
||||
import es.ugr.swad.swadroid.R;
|
||||
import es.ugr.swad.swadroid.gui.MenuActivity;
|
||||
import es.ugr.swad.swadroid.model.Location;
|
||||
import es.ugr.swad.swadroid.model.LocationTimeStamp;
|
||||
import es.ugr.swad.swadroid.model.Roles;
|
||||
import es.ugr.swad.swadroid.model.UserFilter;
|
||||
import es.ugr.swad.swadroid.modules.messages.SearchUsers;
|
||||
import es.ugr.swad.swadroid.preferences.Preferences;
|
||||
|
||||
public class IndoorLocation extends MenuActivity {
|
||||
|
||||
private static final String TAG = Constants.APP_TAG + " IndoorLocation";
|
||||
|
||||
private final List<String> locationHistory = new ArrayList<>();
|
||||
|
||||
private final List<Pair<ScanResult, Integer>> availableNetworks = new ArrayList<>();
|
||||
|
||||
private final double FREE_SPACE_PATH_LOSS_CONSTANT = 27.55;
|
||||
|
||||
private ListView history;
|
||||
|
||||
private ArrayAdapter<String> locationHistoryAdapter;
|
||||
|
||||
private WifiManager wifiManager;
|
||||
|
||||
private ArrayList<Parcelable> arrayReceivers = new ArrayList<>();
|
||||
|
||||
private ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
|
||||
|
||||
private TextView textView;
|
||||
|
||||
private boolean showMac = false;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.indoor_location);
|
||||
|
||||
setTitle(R.string.manageLocation);
|
||||
Objects.requireNonNull(getSupportActionBar()).setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
textView = findViewById(R.id.location_history);
|
||||
|
||||
history = findViewById(R.id.location_history_data);
|
||||
wifiManager = (WifiManager) getApplicationContext().getSystemService(Context.WIFI_SERVICE);
|
||||
|
||||
assert wifiManager != null;
|
||||
if (!wifiManager.isWifiEnabled()) {
|
||||
Toast.makeText(this, "Wifi is disabled ... You need to enable it", Toast.LENGTH_LONG).show();
|
||||
}
|
||||
|
||||
locationHistory.add(getResources().getString(R.string.lostLocation));
|
||||
locationHistoryAdapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, locationHistory);
|
||||
history.setAdapter(locationHistoryAdapter);
|
||||
|
||||
history.setOnItemClickListener((adapterView, view, i, l) -> {
|
||||
ClipboardManager clipboard = (ClipboardManager)
|
||||
getSystemService(Context.CLIPBOARD_SERVICE);
|
||||
ClipData clip = ClipData.newPlainText("macAddress", availableNetworks.get(0).first.BSSID);
|
||||
clipboard.setPrimaryClip(clip);
|
||||
});
|
||||
}
|
||||
|
||||
private void init() {
|
||||
Intent getAvailableRoles = new Intent(getApplicationContext(), GetAvailableRoles.class);
|
||||
startActivityForResult(getAvailableRoles, Constants.GET_AVAILABLE_ROLES);
|
||||
|
||||
FloatingActionButton findUser = findViewById(R.id.find_user);
|
||||
findUser.setOnClickListener(view -> {
|
||||
stopScheduler();
|
||||
Intent intent = new Intent(getApplicationContext(), SearchUsers.class);
|
||||
intent.putExtra("receivers", arrayReceivers);
|
||||
startActivityForResult(intent, Constants.SEARCH_USERS_REQUEST_CODE);
|
||||
});
|
||||
|
||||
history = findViewById(R.id.location_history_data);
|
||||
|
||||
FloatingActionButton updateLocation = findViewById(R.id.user_location);
|
||||
updateLocation.setOnClickListener(v -> {
|
||||
stopScheduler();
|
||||
if(Preferences.getShareLocation()) {
|
||||
textView.setText(getString(R.string.lastLocation));
|
||||
|
||||
int syncTime = Integer.parseInt(Preferences.getSyncLocationTime());
|
||||
Runnable wifiScanner = this::scanWifi;
|
||||
try {
|
||||
scheduler.scheduleAtFixedRate(wifiScanner,0, syncTime, TimeUnit.MINUTES);
|
||||
} catch (IllegalArgumentException e) {
|
||||
Log.e(TAG, e.getMessage(), e);
|
||||
}
|
||||
} else {
|
||||
Toast.makeText(getApplicationContext(), getResources().getString(R.string.locationDisabled), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
});
|
||||
|
||||
FloatingActionButton findMac = findViewById(R.id.find_mac);
|
||||
findMac.setOnClickListener(v -> {
|
||||
showMac = true;
|
||||
scanWifi();
|
||||
});
|
||||
}
|
||||
|
||||
private void stopScheduler() {
|
||||
scheduler.shutdownNow();
|
||||
scheduler = Executors.newScheduledThreadPool(1);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
||||
requestMarshmallowPermissions();
|
||||
} else {
|
||||
requestSimplePermissions();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void requestSimplePermissions() {
|
||||
if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION)
|
||||
!= PackageManager.PERMISSION_GRANTED ||
|
||||
ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_WIFI_STATE)
|
||||
!= PackageManager.PERMISSION_GRANTED ||
|
||||
ContextCompat.checkSelfPermission(this, Manifest.permission.CHANGE_WIFI_STATE)
|
||||
!= PackageManager.PERMISSION_GRANTED){
|
||||
ActivityCompat.requestPermissions(this,
|
||||
new String[]{Manifest.permission.ACCESS_FINE_LOCATION,
|
||||
Manifest.permission.ACCESS_WIFI_STATE,
|
||||
Manifest.permission.CHANGE_WIFI_STATE}, Constants.PERMISSION_MULTIPLE);
|
||||
} else {
|
||||
init();
|
||||
}
|
||||
}
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.Q)
|
||||
private void requestMarshmallowPermissions() {
|
||||
if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION)
|
||||
!= PackageManager.PERMISSION_GRANTED ||
|
||||
ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_WIFI_STATE)
|
||||
!= PackageManager.PERMISSION_GRANTED ||
|
||||
ContextCompat.checkSelfPermission(this, Manifest.permission.CHANGE_WIFI_STATE)
|
||||
!= PackageManager.PERMISSION_GRANTED ||
|
||||
ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_BACKGROUND_LOCATION)
|
||||
!= PackageManager.PERMISSION_GRANTED){
|
||||
ActivityCompat.requestPermissions(this,
|
||||
new String[]{Manifest.permission.ACCESS_FINE_LOCATION,
|
||||
Manifest.permission.ACCESS_WIFI_STATE,
|
||||
Manifest.permission.CHANGE_WIFI_STATE,
|
||||
Manifest.permission.ACCESS_BACKGROUND_LOCATION}, Constants.PERMISSION_MULTIPLE);
|
||||
} else {
|
||||
init();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
|
||||
if (data != null) {
|
||||
switch (requestCode) {
|
||||
case Constants.SEARCH_USERS_REQUEST_CODE:
|
||||
arrayReceivers = data.getParcelableArrayListExtra("receivers");
|
||||
if (arrayReceivers != null && !arrayReceivers.isEmpty()) {
|
||||
locationHistory.clear();
|
||||
locationHistoryAdapter.notifyDataSetChanged();
|
||||
UserFilter user = ((UserFilter)arrayReceivers.get(0));
|
||||
String userText = getResources().getString(R.string.userLocation) + " " + user.getUserFirstname() + " "
|
||||
+ user.getUserSurname1();
|
||||
textView.setText(userText);
|
||||
Intent getLastLocation = new Intent(getApplicationContext(), GetLastLocation.class);
|
||||
getLastLocation.putExtra("userCode", user.getUserCode());
|
||||
startActivityForResult(getLastLocation, Constants.GET_LAST_LOCATION);
|
||||
}
|
||||
break;
|
||||
case Constants.GET_LOCATION:
|
||||
Location location = (Location) data.getSerializableExtra("location");
|
||||
if (location != null) {
|
||||
double distance = (double) data.getSerializableExtra("distance");
|
||||
locationHistory.add(
|
||||
getBasicInformation(location) +
|
||||
getResources().getString(R.string.distance) + ": " + distance + " m");
|
||||
locationHistoryAdapter.notifyDataSetChanged();
|
||||
Intent sendCurrentLocation = new Intent(getApplicationContext(), SendCurrentLocation.class);
|
||||
sendCurrentLocation.putExtra("roomCode", location.getRoomCode());
|
||||
startActivityForResult(sendCurrentLocation, Constants.SEND_CURRENT_LOCATION);
|
||||
} else {
|
||||
if (availableNetworks.isEmpty()) {
|
||||
stopScheduler();
|
||||
Log.d(TAG, "No more available networks");
|
||||
} else {
|
||||
Intent getLocation = new Intent(this.getApplicationContext(), GetLocation.class);
|
||||
getLocation.putExtra("mac", availableNetworks.get(0).first.BSSID.replace(":",""));
|
||||
availableNetworks.remove(0);
|
||||
startActivityForResult(getLocation, Constants.GET_LOCATION);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case Constants.GET_LAST_LOCATION:
|
||||
LocationTimeStamp locationTimeStamp = (LocationTimeStamp) data.getSerializableExtra("locationTimeStamp");
|
||||
if (locationTimeStamp != null && locationTimeStamp.getRoomCode() != -1) {
|
||||
Date checkIn = new Date((long)locationTimeStamp.getCheckInTime()*1000);
|
||||
SimpleDateFormat ft = new SimpleDateFormat ("hh:mm a", Locale.getDefault());
|
||||
locationHistory.clear();
|
||||
locationHistory.add(
|
||||
getBasicInformation(locationTimeStamp) +
|
||||
getResources().getString(R.string.checkIn) + ": "+ ft.format(checkIn));
|
||||
locationHistoryAdapter.notifyDataSetChanged();
|
||||
} else {
|
||||
if (locationHistory.isEmpty()) {
|
||||
locationHistory.add(getResources().getString(R.string.lostLocation));
|
||||
locationHistoryAdapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case Constants.SEND_CURRENT_LOCATION:
|
||||
if ((boolean) data.getSerializableExtra("success"))
|
||||
Log.d(TAG, "Current location sent");
|
||||
break;
|
||||
case Constants.GET_AVAILABLE_ROLES:
|
||||
int rol = ((Roles) Objects.requireNonNull(data.getSerializableExtra("roles"))).getRol();
|
||||
int bitEnabled = Integer.toBinaryString(rol).length();
|
||||
|
||||
FloatingActionButton findMac = findViewById(R.id.find_mac);
|
||||
if (bitEnabled >= 7 ){
|
||||
findMac.setVisibility(View.VISIBLE);
|
||||
}else{
|
||||
findMac.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
}
|
||||
}
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
}
|
||||
|
||||
private void scanWifi() {
|
||||
Log.i(TAG, "SCANNING WIFI");
|
||||
registerReceiver(wifiReceiver, new IntentFilter(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION));
|
||||
wifiManager.startScan();
|
||||
}
|
||||
|
||||
private final BroadcastReceiver wifiReceiver = new BroadcastReceiver() {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
List<ScanResult> results = wifiManager.getScanResults();
|
||||
unregisterReceiver(this);
|
||||
if (!results.isEmpty()) {
|
||||
for (ScanResult scanResult : results) {
|
||||
int distance = (int) calculateDistance(scanResult.level, scanResult.frequency);
|
||||
availableNetworks.add(new Pair<>(scanResult, distance));
|
||||
}
|
||||
availableNetworks.sort((n1, n2) -> n1.second - n2.second);
|
||||
scanFinished();
|
||||
}
|
||||
}
|
||||
|
||||
private void scanFinished() {
|
||||
if (!showMac){
|
||||
Intent getLocation = new Intent(getApplicationContext(), GetLocation.class);
|
||||
getLocation.putExtra("mac", availableNetworks.get(0).first.BSSID.replace(":",""));
|
||||
getLocation.putExtra("distance", availableNetworks.get(0).second.doubleValue());
|
||||
startActivityForResult(getLocation, Constants.GET_LOCATION);
|
||||
} else {
|
||||
showMac = false;
|
||||
locationHistory.clear();
|
||||
locationHistory.add(availableNetworks.get(0).first.SSID + " - " + availableNetworks.get(0).first.BSSID + " - " + availableNetworks.get(0).second + "m" );
|
||||
locationHistoryAdapter.notifyDataSetChanged();
|
||||
textView.setText(getString(R.string.nearestLocation));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private double calculateDistance(double levelInDb, double freqInMHz) {
|
||||
double exp = (FREE_SPACE_PATH_LOSS_CONSTANT - (20 * Math.log10(freqInMHz)) + Math.abs(levelInDb)) / 20.0;
|
||||
return Math.pow(10.0, exp);
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
|
||||
switch (requestCode) {
|
||||
case Constants.PERMISSION_MULTIPLE: {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
||||
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED
|
||||
&& grantResults[1] == PackageManager.PERMISSION_GRANTED
|
||||
&& grantResults[2] == PackageManager.PERMISSION_GRANTED
|
||||
&& grantResults[3] == PackageManager.PERMISSION_GRANTED) {
|
||||
init();
|
||||
} else {
|
||||
setResult(Activity.RESULT_CANCELED);
|
||||
finish();
|
||||
}
|
||||
} else {
|
||||
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED
|
||||
&& grantResults[1] == PackageManager.PERMISSION_GRANTED
|
||||
&& grantResults[2] == PackageManager.PERMISSION_GRANTED) {
|
||||
init();
|
||||
} else {
|
||||
setResult(Activity.RESULT_CANCELED);
|
||||
finish();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private String getBasicInformation(Location location) {
|
||||
return getResources().getString(R.string.institution) + ": " + location.getInstitutionShortName() + "\n" +
|
||||
getResources().getString(R.string.center) + ": " + location.getCenterFullName() + "\n" +
|
||||
getResources().getString(R.string.building) + ": " + location.getBuildingFullName() + "\n" +
|
||||
getResources().getString(R.string.floor) + ": " + location.getFloor() + "\n" +
|
||||
getResources().getString(R.string.room) + ": " + location.getFloor() + "\n";
|
||||
}
|
||||
}
|
|
@ -0,0 +1,86 @@
|
|||
package es.ugr.swad.swadroid.modules.indoorlocation;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
|
||||
import org.ksoap2.serialization.SoapObject;
|
||||
|
||||
import es.ugr.swad.swadroid.Constants;
|
||||
import es.ugr.swad.swadroid.modules.Module;
|
||||
import es.ugr.swad.swadroid.modules.login.Login;
|
||||
import es.ugr.swad.swadroid.webservices.SOAPClient;
|
||||
|
||||
public class SendCurrentLocation extends Module {
|
||||
/**
|
||||
* Messages tag name for Logcat
|
||||
*/
|
||||
private static final String TAG = Constants.APP_TAG + " SendCurrentLocation";
|
||||
/**
|
||||
* Room code
|
||||
*/
|
||||
private Integer roomCode;
|
||||
|
||||
@Override
|
||||
protected void runConnection() {
|
||||
super.runConnection();
|
||||
if (!isConnected) {
|
||||
setResult(RESULT_CANCELED);
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see android.app.Activity#onCreate()
|
||||
*/
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setMETHOD_NAME("sendMyLocation");
|
||||
getSupportActionBar().hide();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see android.app.Activity#onStart()
|
||||
*/
|
||||
@Override
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
roomCode = getIntent().getIntExtra("roomCode", -1);
|
||||
connect();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void requestService() throws Exception {
|
||||
boolean success = false;
|
||||
createRequest(SOAPClient.CLIENT_TYPE);
|
||||
addParam("wsKey", Login.getLoggedUser().getWsKey());
|
||||
addParam("roomCode", roomCode);
|
||||
sendRequest(Boolean.class, true);
|
||||
|
||||
if (result != null) {
|
||||
SoapObject soap = (SoapObject) result;
|
||||
success = Integer.parseInt(soap.getProperty("success").toString()) != 0;
|
||||
}
|
||||
|
||||
Intent intent = new Intent();
|
||||
intent.putExtra("success", success);
|
||||
setResult(Activity.RESULT_OK, intent);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void connect() {
|
||||
startConnection();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void postConnect() {
|
||||
finish();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onError() {
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -353,7 +353,7 @@ public class Messages extends Module {
|
|||
}
|
||||
|
||||
for(int i=0; i < arrayReceivers.size(); i++){
|
||||
frequentsList.add(new FrequentUser(userLogged, arrayReceivers.get(i).getUserNickname(), arrayReceivers.get(i).getUserSurname1(), arrayReceivers.get(i).getUserSurname2(), arrayReceivers.get(i).getUserFirstname(), arrayReceivers.get(i).getUserPhoto(), false, INITIAL_SCORE));
|
||||
frequentsList.add(new FrequentUser(userLogged, arrayReceivers.get(i).getUserNickname(), arrayReceivers.get(i).getUserSurname1(), arrayReceivers.get(i).getUserSurname2(), arrayReceivers.get(i).getUserFirstname(), arrayReceivers.get(i).getUserPhoto(), arrayReceivers.get(i).getUserCode(), false, INITIAL_SCORE));
|
||||
Log.d(TAG, "frequent user '" + arrayReceivers.get(i).getUserNickname() + "' added = " + INITIAL_SCORE + " (sender = '" + userLogged + "')");
|
||||
}
|
||||
|
||||
|
|
|
@ -142,7 +142,9 @@ public class SearchUsers extends Module implements SearchView.OnQueryTextListene
|
|||
frequentUsers = new FrequentUsersList();
|
||||
arrayReceivers = (ArrayList) getIntent().getSerializableExtra("receivers");
|
||||
//save the old receivers
|
||||
oldReceivers = (ArrayList) arrayReceivers.clone();
|
||||
if (arrayReceivers != null) {
|
||||
oldReceivers = (ArrayList) arrayReceivers.clone();
|
||||
}
|
||||
|
||||
search = "";
|
||||
|
||||
|
@ -181,9 +183,10 @@ public class SearchUsers extends Module implements SearchView.OnQueryTextListene
|
|||
String surname2 = frequentsList.get(i).getUserSurname2();
|
||||
String firstname = frequentsList.get(i).getUserFirstname();
|
||||
String userPhoto = frequentsList.get(i).getUserPhoto();
|
||||
int userCode = frequentsList.get(i).getUserCode();
|
||||
boolean selected = frequentsList.get(i).getCheckbox();
|
||||
Double score = frequentsList.get(i).getScore();
|
||||
frequentUsers.saveUser(new FrequentUser(idUser, nickname, surname1, surname2, firstname, userPhoto, selected, score));
|
||||
frequentUsers.saveUser(new FrequentUser(idUser, nickname, surname1, surname2, firstname, userPhoto, userCode, selected, score));
|
||||
}
|
||||
|
||||
updateCheckboxesFrequentUsers();
|
||||
|
@ -360,6 +363,7 @@ public class SearchUsers extends Module implements SearchView.OnQueryTextListene
|
|||
String surname2 = pii.getPrimitiveProperty("userSurname2").toString();
|
||||
String firstname = pii.getPrimitiveProperty("userFirstname").toString();
|
||||
String userPhoto = pii.getPrimitiveProperty("userPhoto").toString();
|
||||
int userCode = Integer.parseInt(pii.getPrimitiveProperty("userCode").toString());
|
||||
|
||||
boolean selected = false;
|
||||
for(int j=0; j<arrayReceivers.size(); j++){
|
||||
|
@ -369,7 +373,7 @@ public class SearchUsers extends Module implements SearchView.OnQueryTextListene
|
|||
}
|
||||
}
|
||||
|
||||
usersFilter.saveUser(new UserFilter(nickname, surname1, surname2, firstname, userPhoto, selected));
|
||||
usersFilter.saveUser(new UserFilter(nickname, surname1, surname2, firstname, userPhoto, userCode, selected));
|
||||
}
|
||||
}
|
||||
numUsers = usersFilter.getUsers().size();
|
||||
|
@ -451,7 +455,7 @@ public class SearchUsers extends Module implements SearchView.OnQueryTextListene
|
|||
else{
|
||||
checkbox.setChecked(true);
|
||||
FrequentUser currentFrequent = frequentUsers.getUsers().get(position);
|
||||
arrayReceivers.add(new UserFilter(currentFrequent.getUserNickname(), currentFrequent.getUserSurname1(), currentFrequent.getUserSurname2(), currentFrequent.getUserFirstname(), currentFrequent.getUserPhoto(), currentFrequent.getCheckbox()));
|
||||
arrayReceivers.add(new UserFilter(currentFrequent.getUserNickname(), currentFrequent.getUserSurname1(), currentFrequent.getUserSurname2(), currentFrequent.getUserFirstname(), currentFrequent.getUserPhoto(), currentFrequent.getUserCode(), currentFrequent.getCheckbox()));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -540,4 +544,4 @@ public class SearchUsers extends Module implements SearchView.OnQueryTextListene
|
|||
AlertDialog alert = builder.create();
|
||||
alert.show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -157,7 +157,14 @@ public class Preferences {
|
|||
* Indicates if there are changes on preferences
|
||||
*/
|
||||
private static boolean preferencesChanged = false;
|
||||
|
||||
/**
|
||||
* Synchronization time preference for location
|
||||
*/
|
||||
public static final String SYNCLOCATIONTIMEPREF = "prefSyncLocationTime";
|
||||
/*
|
||||
* Sharing location preference
|
||||
*/
|
||||
public static String SHARELOCATION = "prefShareLocation";
|
||||
/**
|
||||
* Gets application preferences
|
||||
* @param ctx Application context
|
||||
|
@ -465,4 +472,43 @@ public class Preferences {
|
|||
public static void setPreferencesChanged(boolean newState) {
|
||||
preferencesChanged = newState;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the synchronization time
|
||||
*
|
||||
* @return The synchronization time
|
||||
*/
|
||||
public static String getSyncLocationTime() {
|
||||
return prefs.getString(SYNCLOCATIONTIMEPREF, "1");
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the synchronization time for location
|
||||
*
|
||||
* @param syncLocationTime The synchronization time for location
|
||||
*/
|
||||
public static void setSyncLocationTime(String syncLocationTime) {
|
||||
editor = editor.putString(SYNCLOCATIONTIMEPREF, syncLocationTime);
|
||||
editor.commit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets sharing location preference
|
||||
*
|
||||
* @return share location preference
|
||||
*/
|
||||
public static boolean getShareLocation() {
|
||||
return prefs.getBoolean(SHARELOCATION, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the SHARELOCATION preference
|
||||
*
|
||||
* @param shareLocation The preference for sharing location
|
||||
*/
|
||||
public static void setShareLocation(boolean shareLocation) {
|
||||
editor = editor.putBoolean(SHARELOCATION, shareLocation);
|
||||
editor.commit();
|
||||
}
|
||||
|
||||
}
|
|
@ -136,7 +136,11 @@ public class PreferencesActivity extends PreferenceActivity implements OnPrefere
|
|||
* User password preference changed flag
|
||||
*/
|
||||
private boolean userPasswordPrefChanged = false;
|
||||
|
||||
/**
|
||||
* Synchronization time preference for location
|
||||
*/
|
||||
private static Preference syncTimeLocationPref;
|
||||
|
||||
/**
|
||||
* Shows an error message.
|
||||
*
|
||||
|
@ -189,6 +193,7 @@ public class PreferencesActivity extends PreferenceActivity implements OnPrefere
|
|||
privacyPolicyPref = findPreference(Preferences.PRIVACYPOLICYPREF);
|
||||
syncTimePref = findPreference(Preferences.SYNCTIMEPREF);
|
||||
syncEnablePref = (CheckBoxPreference) findPreference(Preferences.SYNCENABLEPREF);
|
||||
syncTimeLocationPref = findPreference(Preferences.SYNCLOCATIONTIMEPREF);
|
||||
|
||||
ratePref.setOnPreferenceChangeListener(this);
|
||||
twitterPref.setOnPreferenceChangeListener(this);
|
||||
|
@ -200,7 +205,8 @@ public class PreferencesActivity extends PreferenceActivity implements OnPrefere
|
|||
privacyPolicyPref.setOnPreferenceChangeListener(this);
|
||||
syncEnablePref.setOnPreferenceChangeListener(this);
|
||||
syncTimePref.setOnPreferenceChangeListener(this);
|
||||
|
||||
syncTimeLocationPref.setOnPreferenceChangeListener(this);
|
||||
|
||||
logOutPref.setOnPreferenceClickListener(new OnPreferenceClickListener() {
|
||||
|
||||
@Override
|
||||
|
@ -378,7 +384,7 @@ public class PreferencesActivity extends PreferenceActivity implements OnPrefere
|
|||
Preferences.setSyncEnabled(syncEnabled);
|
||||
syncEnablePref.setChecked(syncEnabled);
|
||||
syncPrefsChanged = true;
|
||||
} else if(Preferences.SYNCTIMEPREF.equals(key)) {
|
||||
} else if(Preferences.SYNCTIMEPREF.equals(key)) {
|
||||
String syncTime = (String) newValue;
|
||||
long lastSyncTime = Preferences.getLastSyncTime();
|
||||
|
||||
|
@ -404,6 +410,16 @@ public class PreferencesActivity extends PreferenceActivity implements OnPrefere
|
|||
|
||||
syncTimePref.setSummary(prefSyncTimeEntry);
|
||||
syncPrefsChanged = true;
|
||||
} else if(Preferences.SYNCLOCATIONTIMEPREF.equals(key)) {
|
||||
String syncLocationTime = (String) newValue;
|
||||
|
||||
List<String> prefSyncTimeValues = Arrays.asList(getResources().getStringArray(R.array.prefSyncLocationTimeValues));
|
||||
List<String> prefSyncTimeEntries = Arrays.asList(getResources().getStringArray(R.array.prefSyncLocationTimeEntries));
|
||||
int prefSyncTimeIndex = prefSyncTimeValues.indexOf(syncLocationTime);
|
||||
String prefSyncTimeEntry = prefSyncTimeEntries.get(prefSyncTimeIndex);
|
||||
Preferences.setSyncLocationTime(syncLocationTime);
|
||||
syncTimeLocationPref.setSummary(prefSyncTimeEntry);
|
||||
syncPrefsChanged = true;
|
||||
}
|
||||
|
||||
return returnValue;
|
||||
|
|
After Width: | Height: | Size: 801 B |
After Width: | Height: | Size: 901 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 2.4 KiB |
After Width: | Height: | Size: 835 B |
After Width: | Height: | Size: 935 B |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 1.6 KiB |
BIN
SWADroid/src/main/res/drawable-hdpi/ic_sync_black_18dp.png
Normal file
After Width: | Height: | Size: 711 B |
BIN
SWADroid/src/main/res/drawable-hdpi/ic_sync_black_24dp.png
Normal file
After Width: | Height: | Size: 770 B |
BIN
SWADroid/src/main/res/drawable-hdpi/ic_sync_black_36dp.png
Normal file
After Width: | Height: | Size: 985 B |
BIN
SWADroid/src/main/res/drawable-hdpi/ic_sync_black_48dp.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
SWADroid/src/main/res/drawable-hdpi/ic_sync_grey600_18dp.png
Normal file
After Width: | Height: | Size: 1002 B |
BIN
SWADroid/src/main/res/drawable-hdpi/ic_sync_grey600_24dp.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
SWADroid/src/main/res/drawable-hdpi/ic_sync_grey600_36dp.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
SWADroid/src/main/res/drawable-hdpi/ic_sync_grey600_48dp.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
SWADroid/src/main/res/drawable-hdpi/ic_sync_white_18dp.png
Normal file
After Width: | Height: | Size: 716 B |
BIN
SWADroid/src/main/res/drawable-hdpi/ic_sync_white_24dp.png
Normal file
After Width: | Height: | Size: 781 B |
BIN
SWADroid/src/main/res/drawable-hdpi/ic_sync_white_36dp.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
SWADroid/src/main/res/drawable-hdpi/ic_sync_white_48dp.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 901 B |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 2.4 KiB |
After Width: | Height: | Size: 3.0 KiB |
After Width: | Height: | Size: 935 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 2.1 KiB |
BIN
SWADroid/src/main/res/drawable-xhdpi/ic_sync_black_18dp.png
Normal file
After Width: | Height: | Size: 770 B |
BIN
SWADroid/src/main/res/drawable-xhdpi/ic_sync_black_24dp.png
Normal file
After Width: | Height: | Size: 933 B |
BIN
SWADroid/src/main/res/drawable-xhdpi/ic_sync_black_36dp.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
SWADroid/src/main/res/drawable-xhdpi/ic_sync_black_48dp.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
SWADroid/src/main/res/drawable-xhdpi/ic_sync_grey600_18dp.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
SWADroid/src/main/res/drawable-xhdpi/ic_sync_grey600_24dp.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
SWADroid/src/main/res/drawable-xhdpi/ic_sync_grey600_36dp.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
SWADroid/src/main/res/drawable-xhdpi/ic_sync_grey600_48dp.png
Normal file
After Width: | Height: | Size: 2.4 KiB |
BIN
SWADroid/src/main/res/drawable-xhdpi/ic_sync_white_18dp.png
Normal file
After Width: | Height: | Size: 781 B |
BIN
SWADroid/src/main/res/drawable-xhdpi/ic_sync_white_24dp.png
Normal file
After Width: | Height: | Size: 946 B |
BIN
SWADroid/src/main/res/drawable-xhdpi/ic_sync_white_36dp.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
SWADroid/src/main/res/drawable-xhdpi/ic_sync_white_48dp.png
Normal file
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 2.9 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 2.4 KiB |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 4.6 KiB |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 2.4 KiB |
After Width: | Height: | Size: 3.2 KiB |
BIN
SWADroid/src/main/res/drawable-xxhdpi/ic_sync_black_18dp.png
Normal file
After Width: | Height: | Size: 985 B |
BIN
SWADroid/src/main/res/drawable-xxhdpi/ic_sync_black_24dp.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
SWADroid/src/main/res/drawable-xxhdpi/ic_sync_black_36dp.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
SWADroid/src/main/res/drawable-xxhdpi/ic_sync_black_48dp.png
Normal file
After Width: | Height: | Size: 2.4 KiB |
BIN
SWADroid/src/main/res/drawable-xxhdpi/ic_sync_grey600_18dp.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
SWADroid/src/main/res/drawable-xxhdpi/ic_sync_grey600_24dp.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
SWADroid/src/main/res/drawable-xxhdpi/ic_sync_grey600_36dp.png
Normal file
After Width: | Height: | Size: 2.7 KiB |
BIN
SWADroid/src/main/res/drawable-xxhdpi/ic_sync_grey600_48dp.png
Normal file
After Width: | Height: | Size: 3.5 KiB |
BIN
SWADroid/src/main/res/drawable-xxhdpi/ic_sync_white_18dp.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
SWADroid/src/main/res/drawable-xxhdpi/ic_sync_white_24dp.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
SWADroid/src/main/res/drawable-xxhdpi/ic_sync_white_36dp.png
Normal file
After Width: | Height: | Size: 1.9 KiB |
BIN
SWADroid/src/main/res/drawable-xxhdpi/ic_sync_white_48dp.png
Normal file
After Width: | Height: | Size: 2.5 KiB |
|
@ -0,0 +1,8 @@
|
|||
<!-- drawable/account-search-outline.xml -->
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:height="24dp"
|
||||
android:width="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path android:fillColor="#000" android:pathData="M10,13C9.65,13.59 9.36,14.24 9.19,14.93C6.5,15.16 3.9,16.42 3.9,17V18.1H9.2C9.37,18.78 9.65,19.42 10,20H2V17C2,14.34 7.33,13 10,13M10,4A4,4 0 0,1 14,8C14,8.91 13.69,9.75 13.18,10.43C12.32,10.75 11.55,11.26 10.91,11.9L10,12A4,4 0 0,1 6,8A4,4 0 0,1 10,4M10,5.9A2.1,2.1 0 0,0 7.9,8A2.1,2.1 0 0,0 10,10.1A2.1,2.1 0 0,0 12.1,8A2.1,2.1 0 0,0 10,5.9M15.5,12C18,12 20,14 20,16.5C20,17.38 19.75,18.21 19.31,18.9L22.39,22L21,23.39L17.88,20.32C17.19,20.75 16.37,21 15.5,21C13,21 11,19 11,16.5C11,14 13,12 15.5,12M15.5,14A2.5,2.5 0 0,0 13,16.5A2.5,2.5 0 0,0 15.5,19A2.5,2.5 0 0,0 18,16.5A2.5,2.5 0 0,0 15.5,14Z" />
|
||||
</vector>
|
|
@ -0,0 +1,9 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M12,2C8.14,2 5,5.14 5,9c0,5.25 7,13 7,13s7,-7.75 7,-13c0,-3.86 -3.14,-7 -7,-7zM12,4c1.1,0 2,0.9 2,2 0,1.11 -0.9,2 -2,2s-2,-0.89 -2,-2c0,-1.1 0.9,-2 2,-2zM12,14c-1.67,0 -3.14,-0.85 -4,-2.15 0.02,-1.32 2.67,-2.05 4,-2.05s3.98,0.73 4,2.05c-0.86,1.3 -2.33,2.15 -4,2.15z"/>
|
||||
</vector>
|