Compare commits
130 Commits
Author | SHA1 | Date | |
---|---|---|---|
4a0c59bf54 | |||
f0634fc548 | |||
3dbcddcb85 | |||
ba50285216 | |||
39ee2fbe17 | |||
37a4fec61a | |||
7fd1c70481 | |||
fa97455c24 | |||
7f1d9f05c9 | |||
48532fa7de | |||
82f311a5d3 | |||
3931cb1208 | |||
3f443bb3d2 | |||
e33acdeb8d | |||
9dbab7d50a | |||
f6b98f6be3 | |||
8045b2d885 | |||
|
b3ea153c37 | ||
d939b86c21 | |||
84719af512 | |||
119475c840 | |||
e983322337 | |||
a02858ab78 | |||
fb2db21dc6 | |||
8ca8eaa2d0 | |||
87622cd05e | |||
f1e989cbed | |||
11c63dd248 | |||
43ce80cc90 | |||
e2b40cf370 | |||
1afa9ed982 | |||
facc5d477d | |||
acb19c5da6 | |||
b396a35d57 | |||
eb3c77c559 | |||
4b1fb9a739 | |||
09bd807d5b | |||
|
9ca7d27d6c | ||
|
3f6b9930ff | ||
|
c0b6af767d | ||
|
20ce0b34cf | ||
|
d6a2d30fe8 | ||
e9a0f6fa6f | |||
29efcd13b6 | |||
7e2c51d649 | |||
f9766b65ea | |||
|
c272ffc372 | ||
|
fc2a29b7f0 | ||
|
37f3db5598 | ||
|
94375b0015 | ||
|
f188ece738 | ||
|
12508c4221 | ||
81027f03f4 | |||
|
a5c70a9c34 | ||
9c39e8b6a5 | |||
97f9343fc7 | |||
|
7f63a9f45c | ||
|
d8de30e77f | ||
5ad3fa39cf | |||
|
133b4e4fd5 | ||
|
99d5356284 | ||
c36d8ab78a | |||
|
05bb042fac | ||
9566f9d91f | |||
|
362dd1c745 | ||
|
d8e504693f | ||
|
42700b02bb | ||
9bea2552da | |||
|
639b799a59 | ||
eafe49e6a1 | |||
54b0deac84 | |||
|
dd4f177205 | ||
370c58d0f4 | |||
|
9d2cd5e0a0 | ||
|
f428e3d029 | ||
d91440ae77 | |||
84671377ec | |||
|
847c74f22b | ||
|
7a544afede | ||
|
d8c101c326 | ||
5b1cdc068e | |||
|
8299d021f1 | ||
d5e5284340 | |||
b7964f42c8 | |||
0fc0c9e42e | |||
a53efc52bc | |||
cfdbecb0aa | |||
0126888e10 | |||
b0e6017169 | |||
a48ce0df57 | |||
f8b0d99011 | |||
|
c365299c18 | ||
|
15587d7717 | ||
4b0fd37702 | |||
37901a00c4 | |||
|
43e95486f3 | ||
588afa9b11 | |||
d927ee059d | |||
fb35c63781 | |||
22d1fcd515 | |||
cdb3b4eab1 | |||
43ff17b45a | |||
a90f540b0f | |||
c98bef5721 | |||
27fd02949c | |||
f493255aa0 | |||
80552ce4f3 | |||
4bee25297c | |||
ea01cc5057 | |||
2cb2d05c34 | |||
8d04106149 | |||
1709868480 | |||
b641f7de4d | |||
0ac9e32363 | |||
5da9b7ac24 | |||
0859220101 | |||
61ef72b0c6 | |||
949c2028d7 | |||
c6eb60efa5 | |||
926ea7ed69 | |||
76e8de86c7 | |||
de989a3819 | |||
dc4a6835a7 | |||
a635003381 | |||
28328df06d | |||
b5d53af477 | |||
69f2c34531 | |||
b1b84cd26d | |||
7ededb89c2 | |||
|
7412ef3485 |
46
.github/CODE_OF_CONDUCT.md
vendored
Normal file
|
@ -0,0 +1,46 @@
|
|||
# Contributor Covenant Code of Conduct
|
||||
|
||||
## Our Pledge
|
||||
|
||||
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
|
||||
|
||||
## Our Standards
|
||||
|
||||
Examples of behavior that contributes to creating a positive environment include:
|
||||
|
||||
* Using welcoming and inclusive language
|
||||
* Being respectful of differing viewpoints and experiences
|
||||
* Gracefully accepting constructive criticism
|
||||
* Focusing on what is best for the community
|
||||
* Showing empathy towards other community members
|
||||
|
||||
Examples of unacceptable behavior by participants include:
|
||||
|
||||
* The use of sexualized language or imagery and unwelcome sexual attention or advances
|
||||
* Trolling, insulting/derogatory comments, and personal or political attacks
|
||||
* Public or private harassment
|
||||
* Publishing others' private information, such as a physical or electronic address, without explicit permission
|
||||
* Other conduct which could reasonably be considered inappropriate in a professional setting
|
||||
|
||||
## Our Responsibilities
|
||||
|
||||
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
|
||||
|
||||
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
|
||||
|
||||
## Scope
|
||||
|
||||
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
|
||||
|
||||
## Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at swadroid@gmail.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
|
||||
|
||||
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
|
||||
|
||||
## Attribution
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
|
||||
|
||||
[homepage]: http://contributor-covenant.org
|
||||
[version]: http://contributor-covenant.org/version/1/4/
|
13
.github/CONTRIBUTING.md
vendored
Normal file
|
@ -0,0 +1,13 @@
|
|||
## Contributing to SWADroid
|
||||
|
||||
*Before opening a pull request*, consider:
|
||||
|
||||
- Is the change important and ready enough to ask the community to spend time reviewing?
|
||||
- Have you searched for existing, related GitHub issues and pull requests?
|
||||
- Is the change being proposed clearly explained and motivated?
|
||||
|
||||
When you contribute code, you affirm that the contribution is your original work and that you
|
||||
license the work to the project under the project's open source license. Whether or not you
|
||||
state this explicitly, by submitting any copyrighted material via pull request, email, or
|
||||
other means you agree to license the material under the project's open source license and
|
||||
warrant that you have the legal authority to do so.
|
35
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
|
@ -0,0 +1,35 @@
|
|||
---
|
||||
name: Bug report
|
||||
about: Create a report to help us improve
|
||||
|
||||
---
|
||||
|
||||
**Describe the bug**
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
**To Reproduce**
|
||||
Steps to reproduce the behavior:
|
||||
1. Go to '...'
|
||||
2. Click on '....'
|
||||
3. Scroll down to '....'
|
||||
4. See error
|
||||
|
||||
**Expected behavior**
|
||||
A clear and concise description of what you expected to happen.
|
||||
|
||||
**Screenshots**
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
|
||||
**Desktop (please complete the following information):**
|
||||
- OS: [e.g. iOS]
|
||||
- Browser [e.g. chrome, safari]
|
||||
- Version [e.g. 22]
|
||||
|
||||
**Smartphone (please complete the following information):**
|
||||
- Device: [e.g. iPhone6]
|
||||
- OS: [e.g. iOS8.1]
|
||||
- Browser [e.g. stock browser, safari]
|
||||
- Version [e.g. 22]
|
||||
|
||||
**Additional context**
|
||||
Add any other context about the problem here.
|
17
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
|
@ -0,0 +1,17 @@
|
|||
---
|
||||
name: Feature request
|
||||
about: Suggest an idea for this project
|
||||
|
||||
---
|
||||
|
||||
**Is your feature request related to a problem? Please describe.**
|
||||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||
|
||||
**Describe the solution you'd like**
|
||||
A clear and concise description of what you want to happen.
|
||||
|
||||
**Describe alternatives you've considered**
|
||||
A clear and concise description of any alternative solutions or features you've considered.
|
||||
|
||||
**Additional context**
|
||||
Add any other context or screenshots about the feature request here.
|
10
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
|
@ -0,0 +1,10 @@
|
|||
## What changes were proposed in this pull request?
|
||||
|
||||
(Please fill in changes proposed in this fix)
|
||||
|
||||
## How was this patch tested?
|
||||
|
||||
(Please explain how this patch was tested. E.g. unit tests, integration tests, manual tests)
|
||||
(If this patch involves UI changes, please attach a screenshot; otherwise, remove this)
|
||||
|
||||
Please review https://github.com/Amab/SWADroid/blob/develop/CONTRIBUTING.md before opening a pull request.
|
65
.gitignore
vendored
|
@ -1,10 +1,59 @@
|
|||
.idea
|
||||
.gradle
|
||||
build
|
||||
import-summary.txt
|
||||
# Built application files
|
||||
*.apk
|
||||
*.ap_
|
||||
*.aab
|
||||
|
||||
# Files for the ART/Dalvik VM
|
||||
*.dex
|
||||
|
||||
# Java class files
|
||||
*.class
|
||||
|
||||
# Generated files
|
||||
bin/
|
||||
gen/
|
||||
out/
|
||||
|
||||
# Gradle files
|
||||
.gradle/
|
||||
build/
|
||||
|
||||
# Local configuration file (sdk path, etc)
|
||||
local.properties
|
||||
/SWADroid/SWADroid-SWADroid.iml
|
||||
/SWADroid.iml
|
||||
app/lint.xml
|
||||
/SWADroid/google-services.json
|
||||
keystore.properties
|
||||
|
||||
# Proguard folder generated by Eclipse
|
||||
proguard/
|
||||
|
||||
# Log Files
|
||||
*.log
|
||||
|
||||
# Android Studio Navigation editor temp files
|
||||
.navigation/
|
||||
|
||||
# Android Studio captures folder
|
||||
captures/
|
||||
|
||||
# IntelliJ
|
||||
*.iml
|
||||
.idea/
|
||||
|
||||
# Keystore files
|
||||
# Uncomment the following lines if you do not want to check your keystore files in.
|
||||
*.jks
|
||||
*.keystore
|
||||
|
||||
# External native build folder generated in Android Studio 2.2 and later
|
||||
.externalNativeBuild
|
||||
|
||||
# Google Services (e.g. APIs or Firebase)
|
||||
# google-services.json
|
||||
|
||||
# lint
|
||||
lint/intermediates/
|
||||
lint/generated/
|
||||
lint/outputs/
|
||||
lint/tmp/
|
||||
# lint/reports/
|
||||
/SWADroid/src/debug/
|
||||
/SWADroid/release/
|
||||
|
|
68
.travis.yml
|
@ -1,19 +1,53 @@
|
|||
os: linux
|
||||
dist: xenial
|
||||
language: android
|
||||
jdk:
|
||||
- oraclejdk8
|
||||
android:
|
||||
components:
|
||||
- tools
|
||||
- tools
|
||||
- platform-tools
|
||||
- build-tools-27.0.3
|
||||
- android-27
|
||||
- extra-android-m2repository
|
||||
- extra-android-support
|
||||
- extra-google-m2repository
|
||||
- extra-google-google_play_services
|
||||
script:
|
||||
- "./gradlew build connectedCheck"
|
||||
jdk: oraclejdk8
|
||||
env:
|
||||
global:
|
||||
- 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/
|
||||
cache:
|
||||
directories:
|
||||
- "$HOME/.gradle/caches/"
|
||||
- "$HOME/.gradle/wrapper/"
|
||||
- "$HOME/.android/build-cache"
|
||||
before_install:
|
||||
- chmod +x gradlew
|
||||
- yes | sdkmanager "platforms;android-27"
|
||||
- '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"
|
||||
after_failure: cat $TRAVIS_BUILD_DIR/SWADroid/build/reports/lint-results.xml
|
||||
before_deploy:
|
||||
- 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then bash ./.travis/run_on_before_deploy.sh; fi'
|
||||
- "cd $TRAVIS_BUILD_DIR/SWADroid/build/outputs/apk/prod"
|
||||
- "${ANDROID_HOME}/build-tools/${ANDROID_BUILD_TOOLS}/apksigner sign --ks ${TRAVIS_BUILD_DIR}/keystore.jks --ks-pass pass:$storepass --key-pass pass:$keypass --out SWADroid-release.apk SWADroid-prod-unsigned.apk"
|
||||
- "${ANDROID_HOME}/build-tools/${ANDROID_BUILD_TOOLS}/apksigner verify SWADroid-release.apk"
|
||||
deploy:
|
||||
provider: releases
|
||||
token:
|
||||
secure: "IzDdPlY0KyCF1TUdUUeYYU/vBCNmJpxZ/w3B7QeVd1BhyL947jiyJpdEckJhMB7z4MWt5IHRGOXU2pYGxoJC86ES/33Acn91eo22FuaeRmIwjxL9yczae5KmakrSUA8iDjubfjLeWRy/MXAIGJ9qAuLOreAe/xGEoAILCxlJMjANw0AuJG+dBabBc2pt67bjaJO4WNFCkfDK9AC8XGJPXlwWB4L1IDwPQLBWEVRyhf3Ac1Om0lzf7kF240xCcR/cmLqOXArU8iRr3n30HaRQOBibCMjnds7etA+Fs1HiyB8B5gqMXpUM02hI35R9GHOrgqO/+N5lNMdDveLjLhwjPXrkIoWrzI/QifXxnnpa/bCqo4knjy7B8CGAZ5Z3w9Hq/zN2YAkLUIMyl9z1b2LzN9pzAh5SrtuRCBJKUfB7I/qv+wEVj8vrFrZDnMuQntAfBtKu6bD0L/lupkKD31L1i3G9bG3vSaaGauQGqi2/ORyPtLVhgH7LQI7gMzghi2DP1BhgrJCUHK4O7dky0klr0spfEiOLKhZQhzVosjXySh2CLzo/pqkCzWCjr6ozvzyc2VTxh5EvheJvw1gxl5eGlTDzCIu4U9ebQ5X5jXm7uec2c9tn9IYxBjASC7ay9x6UuM7khdbqg4RQ0JLo/6032ZIkxuloZMGF8P1jzHHCtko="
|
||||
file: "$TRAVIS_BUILD_DIR/SWADroid/build/outputs/apk/prod/SWADroid-release.apk"
|
||||
cleanup: false
|
||||
skip_cleanup: true
|
||||
name: SWADroid $TRAVIS_TAG
|
||||
release_notes: Automated release from Travis CI.
|
||||
target_commitish: "$TRAVIS_COMMIT"
|
||||
on:
|
||||
tags: true
|
||||
repo: Amab/SWADroid
|
||||
branch: master
|
||||
notifications:
|
||||
slack:
|
||||
secure: FDRqQsWyWvSg3uXYV1jtxh209yYdE9wqMRx2Jmf9ivRMowSDqAfLaOD8hlAjD/DnBCBhVpSkOzT4+treByU1qpLXcWBpewl1GukK3jD6AoqD4Xtmp3xOAJsG1BvqeYp48Q95lZFgZ8WxV2IXO4/rAi3GcCDKVYGs3fEEwk/aVEfFDyHE7oT+mruZqrFHbwcPbObTucJWjFLu+VdCSdJ6HTN/gm/04TVg5ox0fqeyxqyAxW3QOEu/2EUOZ78ijrab7+Cn32KluoTlTDJY0+iSszYQll08+g2LsJruyzqWJzp8y0jZMs23e63ge16WrnzCHknTFIUXNG8/OVwCb2gsBA+RIchqEWLiKuOPtkSTZoMCqulDPYVOdGBJbv1CdJW4TKNmnLfsA9EMHlcv+50zcz7rq9115i4qPsous0gKw8Bc+tSL3S28YP81J8UmvTeQjAPgC7iQIeXHNvPpM62hP2v/sK9BUhmsfrFopeQGPVY5vLKXvAF+dJHuyUNK1T17iVyxa55D9Et6QeHqLsHgLKUx22RW128a0FuaFwD1EIKNuj0q+Fn8DNcXtyHoKVdGCD/K3nbDPwx+IsIvHTJfPwDL/cX8eXj+ggK32nuJVQwXLDMloz3xFKe+wO19/7kMzyKQD4Brq4xX2qQ3fiE5uRj6BIxJ2q8wuey3uuJMPVA=
|
||||
|
|
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
|
27
README.md
|
@ -5,18 +5,20 @@ Android client for e-learning platform [![SWADroid](https://openswad.org/logo/sw
|
|||
|
||||
[![SWADroid](http://developer.android.com/images/brand/en_generic_rgb_wo_45.png)](https://play.google.com/store/apps/details?id=es.ugr.swad.swadroid)
|
||||
|
||||
- Code: `git clone https://github.com/Amab/SWADroid.git`
|
||||
- Issue tracker: https://github.com/Amab/SWADroid/issues
|
||||
|
||||
[![SWADroid](http://upload.wikimedia.org/wikipedia/commons/c/c8/Farm-Fresh_twitter_1.png)](http://twitter.com/SWADroid)[![SWADroid](http://upload.wikimedia.org/wikipedia/commons/4/4d/Farm-Fresh_facebook.png)](https://www.facebook.com/SWADroid)[![SWADroid](http://upload.wikimedia.org/wikipedia/commons/b/ba/Google_plus_32.png)](https://plus.google.com/115615684349730524355/posts)[![SWADroid](https://upload.wikimedia.org/wikipedia/commons/thumb/5/5c/Telegram_Messenger.png/35px-Telegram_Messenger.png?uselang=es)](https://telegram.me/swadroid)[![SWADroid](https://s.w.org/about/images/logos/wordpress-logo-32-blue.png)](http://swadroid.wordpress.com)
|
||||
[![SWADroid](http://upload.wikimedia.org/wikipedia/commons/c/c8/Farm-Fresh_twitter_1.png)](http://twitter.com/SWADroid)[![SWADroid](http://upload.wikimedia.org/wikipedia/commons/4/4d/Farm-Fresh_facebook.png)](https://www.facebook.com/SWADroid)[![SWADroid](https://upload.wikimedia.org/wikipedia/commons/thumb/5/5c/Telegram_Messenger.png/35px-Telegram_Messenger.png?uselang=es)](https://telegram.me/swadroid)[![SWADroid](https://s.w.org/about/images/logos/wordpress-logo-32-blue.png)](http://swadroid.wordpress.com)
|
||||
|
||||
CI Status
|
||||
---------
|
||||
|
||||
|Branch|CI status|
|
||||
|------|---------|
|
||||
|develop|[![Build Status](https://travis-ci.org/Amab/SWADroid.svg?branch=develop)](https://travis-ci.org/Amab/SWADroid)|
|
||||
|master|[![Build Status](https://travis-ci.org/Amab/SWADroid.svg?branch=master)](https://travis-ci.org/Amab/SWADroid)|
|
||||
|develop|[![Build Status](https://travis-ci.com/Amab/SWADroid.svg?branch=develop)](https://travis-ci.com/Amab/SWADroid)|
|
||||
|master|[![Build Status](https://travis-ci.com/Amab/SWADroid.svg?branch=master)](https://travis-ci.com/Amab/SWADroid)|
|
||||
|
||||
[![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)
|
||||
[![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
|
||||
---------------------
|
||||
|
@ -51,10 +53,21 @@ 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
|
||||
------------
|
||||
|
||||
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. Contributions should be performed on [topic branches](http://progit.org/book/ch3-4.html) in your personal forks - just issue your pull requests from there.
|
||||
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).
|
||||
|
|
19
SWADroid.iml
|
@ -1,19 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module external.linked.project.id="SWADroid" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" external.system.module.group="" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
|
||||
<component name="FacetManager">
|
||||
<facet type="java-gradle" name="Java-Gradle">
|
||||
<configuration>
|
||||
<option name="BUILD_FOLDER_PATH" value="$MODULE_DIR$/build" />
|
||||
<option name="BUILDABLE" value="false" />
|
||||
</configuration>
|
||||
</facet>
|
||||
</component>
|
||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<excludeFolder url="file://$MODULE_DIR$/.gradle" />
|
||||
</content>
|
||||
<orderEntry type="jdk" jdkName="1.8" jdkType="JavaSDK" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
|
@ -1,16 +1,56 @@
|
|||
apply plugin: 'com.android.application'
|
||||
apply plugin: 'com.google.gms.google-services'
|
||||
|
||||
import org.ajoberstar.grgit.Grgit
|
||||
|
||||
ext {
|
||||
git = org.ajoberstar.grgit.Grgit.open()
|
||||
git = Grgit.open()
|
||||
gitVersionCode = git.tag.list().size()
|
||||
gitVersionName = "${git.describe()}"
|
||||
}
|
||||
|
||||
travisBuild = System.getenv("TRAVIS") == "true"
|
||||
//return a BuildConfigField from a properties file.
|
||||
def static getBuildConfigField(String property){
|
||||
def travisBuild = System.getenv("TRAVIS") == "true"
|
||||
def value
|
||||
|
||||
if(travisBuild) {
|
||||
value = "\"" + System.getenv(property) + "\""
|
||||
} else {
|
||||
Properties properties = new Properties()
|
||||
properties.load(new FileInputStream("keystore.properties"))
|
||||
value = "\"" + properties.getProperty(property) + "\""
|
||||
}
|
||||
|
||||
return value
|
||||
}
|
||||
|
||||
def build_param = "${build}"
|
||||
|
||||
if (build_param != "prod") {
|
||||
//exclude development build
|
||||
android.variantFilter { variant ->
|
||||
if (variant.buildType.name == 'prod') {
|
||||
variant.setIgnore(true)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//exclude all except development build
|
||||
android.variantFilter { variant ->
|
||||
if (variant.buildType.name != 'prod') {
|
||||
variant.setIgnore(true)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
android {
|
||||
compileSdkVersion 27
|
||||
buildToolsVersion "27.0.3"
|
||||
compileSdkVersion "android-30"
|
||||
buildToolsVersion '30.0.3'
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
dexOptions {
|
||||
maxProcessCount=2
|
||||
|
@ -26,62 +66,34 @@ android {
|
|||
versionCode gitVersionCode
|
||||
versionName gitVersionName
|
||||
|
||||
minSdkVersion 14
|
||||
targetSdkVersion 27
|
||||
|
||||
android.applicationVariants.all { variant ->
|
||||
def appName
|
||||
//Check if an applicationName property is supplied; if not use the name of the parent project.
|
||||
if (project.hasProperty("applicationName")) {
|
||||
appName = applicationName
|
||||
} else {
|
||||
appName = parent.name
|
||||
}
|
||||
|
||||
variant.outputs.all { output ->
|
||||
outputFileName = "${appName}-${output.baseName}-${variant.versionName}.apk"
|
||||
}
|
||||
}
|
||||
minSdkVersion 24
|
||||
targetSdkVersion 30
|
||||
|
||||
testApplicationId "es.ugr.swad.swadroid.test"
|
||||
testInstrumentationRunner "android.test.InstrumentationTestRunner"
|
||||
|
||||
buildConfigField "String", "SWAD_APP_KEY", getBuildConfigField("SWAD_APP_KEY")
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
debug {
|
||||
versionNameSuffix '-DEBUG'
|
||||
}
|
||||
|
||||
buildTypes.each {
|
||||
it.buildConfigField "String", "SWAD_APP_KEY", getBuildConfigField("SWAD_APP_KEY")
|
||||
it.buildConfigField "String", "ANALYTICS_API_KEY", getBuildConfigField("ANALYTICS_API_KEY")
|
||||
prod {
|
||||
minifyEnabled true
|
||||
zipAlignEnabled true
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//return a BuildConfigField from a properties file.
|
||||
def getBuildConfigField(String property){
|
||||
def value
|
||||
|
||||
if(travisBuild) {
|
||||
value = "\"" + System.getenv(property) + "\""
|
||||
} else {
|
||||
Properties properties = new Properties()
|
||||
properties.load(new FileInputStream("keystore.properties"))
|
||||
value = "\"" + properties.getProperty(property) + "\""
|
||||
}
|
||||
|
||||
return value
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile 'com.android.support:support-v4:27.0.2'
|
||||
compile 'com.android.support:appcompat-v7:27.0.2'
|
||||
compile 'com.google.android.gms:play-services-analytics:11.8.0'
|
||||
compile 'com.google.code.ksoap2-android:ksoap2-android:3.6.2'
|
||||
compile 'commons-io:commons-io:2.6'
|
||||
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
|
||||
compile 'com.journeyapps:zxing-android-embedded:3.5.0@aar'
|
||||
compile 'com.google.zxing:core:3.3.1'
|
||||
compile 'com.google.code.gson:gson:2.8.2'
|
||||
}
|
||||
implementation 'androidx.legacy:legacy-support-v4:1.0.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.8.0'
|
||||
implementation 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
|
||||
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.android.material:material:1.2.1'
|
||||
implementation platform('com.google.firebase:firebase-bom:26.2.0')
|
||||
implementation 'com.google.firebase:firebase-analytics'
|
||||
}
|
||||
|
|
56
SWADroid/google-services.json
Normal file
|
@ -0,0 +1,56 @@
|
|||
{
|
||||
"project_info": {
|
||||
"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:398995989132:android:cf9fabf2a9cd64da",
|
||||
"android_client_info": {
|
||||
"package_name": "es.ugr.swad.swadroid"
|
||||
}
|
||||
},
|
||||
"oauth_client": [
|
||||
{
|
||||
"client_id": "398995989132-23hrn3d7s4unrfftra30hekdtvrk1pdv.apps.googleusercontent.com",
|
||||
"client_type": 1,
|
||||
"android_info": {
|
||||
"package_name": "es.ugr.swad.swadroid",
|
||||
"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": "AIzaSyCyEiJ-L6CrIsiF99OUXi4UvQV2TzCVNMA"
|
||||
}
|
||||
],
|
||||
"services": {
|
||||
"appinvite_service": {
|
||||
"other_platform_oauth_client": [
|
||||
{
|
||||
"client_id": "398995989132-os2h8neftvc80bq785s4bqj4osmanc7l.apps.googleusercontent.com",
|
||||
"client_type": 3
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"configuration_version": "1"
|
||||
}
|
|
@ -3,6 +3,10 @@
|
|||
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.ACCESS_FINE_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"/>
|
||||
|
@ -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"
|
||||
|
@ -342,7 +386,7 @@
|
|||
<service android:name="com.google.android.gms.analytics.CampaignTrackingService" />
|
||||
|
||||
<provider
|
||||
android:name="android.support.v4.content.FileProvider"
|
||||
android:name="androidx.core.content.FileProvider"
|
||||
android:authorities="es.ugr.swad.swadroid.fileprovider"
|
||||
android:exported="false"
|
||||
android:grantUriPermissions="true">
|
||||
|
|
|
@ -28,8 +28,4 @@ public class Config {
|
|||
* SWAD application key
|
||||
*/
|
||||
public static final String SWAD_APP_KEY = BuildConfig.SWAD_APP_KEY;
|
||||
/**
|
||||
* Google Analytics application key
|
||||
*/
|
||||
public static final String ANALYTICS_API_KEY = BuildConfig.ANALYTICS_API_KEY;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -49,7 +49,6 @@ import java.util.HashMap;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import es.ugr.swad.swadroid.analytics.SWADroidTracker;
|
||||
import es.ugr.swad.swadroid.database.DataBaseHelper;
|
||||
import es.ugr.swad.swadroid.gui.DialogFactory;
|
||||
import es.ugr.swad.swadroid.gui.MenuExpandableListActivity;
|
||||
|
@ -61,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;
|
||||
|
@ -159,8 +159,6 @@ public class SWADMain extends MenuExpandableListActivity {
|
|||
public void onCreate(Bundle icicle) {
|
||||
int lastVersion, currentVersion;
|
||||
|
||||
SWADroidTracker.initTracker(getApplicationContext());
|
||||
|
||||
//Initialize screen
|
||||
super.onCreate(icicle);
|
||||
|
||||
|
@ -181,6 +179,7 @@ public class SWADMain extends MenuExpandableListActivity {
|
|||
|
||||
//If this is an upgrade, show upgrade dialog
|
||||
} else if (lastVersion < currentVersion) {
|
||||
//showUpgradeDialog(this);
|
||||
upgradeApp(lastVersion, currentVersion);
|
||||
}
|
||||
|
||||
|
@ -188,7 +187,7 @@ public class SWADMain extends MenuExpandableListActivity {
|
|||
|
||||
currentRole = -1;
|
||||
} catch (Exception ex) {
|
||||
error(ex.getMessage(), ex, true);
|
||||
error(ex.getMessage(), ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -227,8 +226,6 @@ public class SWADMain extends MenuExpandableListActivity {
|
|||
createSpinnerAdapter();
|
||||
createMenu();
|
||||
}
|
||||
|
||||
SWADroidTracker.sendScreenView(getApplicationContext(), TAG);
|
||||
}
|
||||
|
||||
private void showBirthdayMessage() {
|
||||
|
@ -244,6 +241,8 @@ public class SWADMain extends MenuExpandableListActivity {
|
|||
* @param currentVersion Current version of application
|
||||
*/
|
||||
private void firstRun(int currentVersion) {
|
||||
Log.i(TAG, "Running application for first time. Setting current version to " + currentVersion);
|
||||
|
||||
Intent activity = new Intent(this, AccountAuthenticator.class);
|
||||
|
||||
//Configure automatic synchronization
|
||||
|
@ -254,6 +253,8 @@ public class SWADMain extends MenuExpandableListActivity {
|
|||
firstRun = true;
|
||||
|
||||
Preferences.initializeSelectedCourse();
|
||||
|
||||
Log.i(TAG, "First initialization completed successfully");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -262,7 +263,8 @@ public class SWADMain extends MenuExpandableListActivity {
|
|||
* @param currentVersion Version to which the application is updated
|
||||
*/
|
||||
private void upgradeApp(int lastVersion, int currentVersion) throws NoSuchAlgorithmException {
|
||||
showUpgradeDialog(this);
|
||||
Log.i(TAG, "Upgrading application from version " + lastVersion + " to version " + currentVersion);
|
||||
|
||||
dbHelper.upgradeDB();
|
||||
|
||||
if(lastVersion < 52) {
|
||||
|
@ -285,6 +287,8 @@ public class SWADMain extends MenuExpandableListActivity {
|
|||
}
|
||||
|
||||
Preferences.setLastVersion(currentVersion);
|
||||
|
||||
Log.i(TAG, "Application upgraded from version " + lastVersion + " to version " + currentVersion);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -577,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
|
||||
|
@ -682,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);
|
||||
|
|
|
@ -1,175 +0,0 @@
|
|||
/*
|
||||
*
|
||||
* * This file is part of SWADroid.
|
||||
* *
|
||||
* * Copyright (C) 2010 Juan Miguel Boyero Corral <juanmi1982@gmail.com>
|
||||
* *
|
||||
* * SWADroid is free software: you can redistribute it and/or modify
|
||||
* * it under the terms of the GNU General Public License as published by
|
||||
* * the Free Software Foundation, either version 3 of the License, or
|
||||
* * (at your option) any later version.
|
||||
* *
|
||||
* * SWADroid is distributed in the hope that it will be useful,
|
||||
* * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* * GNU General Public License for more details.
|
||||
* *
|
||||
* * You should have received a copy of the GNU General Public License
|
||||
* * along with SWADroid. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
package es.ugr.swad.swadroid.analytics;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
import com.google.android.gms.analytics.ExceptionReporter;
|
||||
import com.google.android.gms.analytics.GoogleAnalytics;
|
||||
import com.google.android.gms.analytics.HitBuilders;
|
||||
import com.google.android.gms.analytics.StandardExceptionParser;
|
||||
import com.google.android.gms.analytics.Tracker;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import es.ugr.swad.swadroid.Config;
|
||||
import es.ugr.swad.swadroid.Constants;
|
||||
|
||||
/**
|
||||
* Tracker for Google Play
|
||||
*
|
||||
* @author Juan Miguel Boyero Corral <juanmi1982@gmail.com>
|
||||
*/
|
||||
public class SWADroidTracker {
|
||||
/**
|
||||
* SWADroidTracker tag name for Logcat
|
||||
*/
|
||||
private static final String TAG = Constants.APP_TAG + " SWADroidTracker";
|
||||
/**
|
||||
* Enum used to identify the tracker that needs to be used for tracking.
|
||||
*
|
||||
* A single tracker is usually enough for most purposes. In case you do need multiple trackers,
|
||||
* storing them all in Application object helps ensure that they are created only once per
|
||||
* application instance.
|
||||
*/
|
||||
public enum TrackerName {
|
||||
APP_TRACKER, // Tracker used only in this app.
|
||||
GLOBAL_TRACKER, // Tracker used by all the apps from a company. eg: roll-up tracking.
|
||||
ECOMMERCE_TRACKER, // Tracker used by all ecommerce transactions from a company.
|
||||
}
|
||||
|
||||
private static HashMap<TrackerName, Tracker> mTrackers = new HashMap<>();
|
||||
|
||||
private static boolean isTrackerEnabled() {
|
||||
return (!Config.ANALYTICS_API_KEY.isEmpty());
|
||||
}
|
||||
|
||||
private static synchronized Tracker getTracker(Context context) {
|
||||
if (!mTrackers.containsKey(TrackerName.APP_TRACKER)) {
|
||||
|
||||
GoogleAnalytics analytics = GoogleAnalytics.getInstance(context);
|
||||
Tracker t = analytics.newTracker(Config.ANALYTICS_API_KEY);
|
||||
t.enableExceptionReporting(true);
|
||||
t.enableAutoActivityTracking(true);
|
||||
mTrackers.put(TrackerName.APP_TRACKER, t);
|
||||
|
||||
}
|
||||
return mTrackers.get(TrackerName.APP_TRACKER);
|
||||
}
|
||||
|
||||
public static void initTracker(Context context) {
|
||||
// Initialize a tracker using a Google Analytics property ID.
|
||||
if(isTrackerEnabled()) {
|
||||
GoogleAnalytics.getInstance(context).newTracker(Config.ANALYTICS_API_KEY);
|
||||
|
||||
ExceptionReporter exceptionHandler =
|
||||
new ExceptionReporter(
|
||||
getTracker(context),
|
||||
Thread.getDefaultUncaughtExceptionHandler(),
|
||||
context);
|
||||
|
||||
StandardExceptionParser exceptionParser =
|
||||
new StandardExceptionParser(context, null) {
|
||||
@Override
|
||||
public String getDescription(String threadName, Throwable t) {
|
||||
return "{" + threadName + "} " + Log.getStackTraceString(t);
|
||||
}
|
||||
};
|
||||
|
||||
exceptionHandler.setExceptionParser(exceptionParser);
|
||||
|
||||
// Make myHandler the new default uncaught exception handler.
|
||||
Thread.setDefaultUncaughtExceptionHandler(exceptionHandler);
|
||||
|
||||
Log.i(TAG, "Google Play Services available. SWADroidTracker enabled");
|
||||
} else {
|
||||
Log.w(TAG, "Google Play Services not available. SWADroidTracker disabled");
|
||||
}
|
||||
}
|
||||
|
||||
public static void sendScreenView(Context context, String path) {
|
||||
if(isTrackerEnabled()) {
|
||||
// Get tracker.
|
||||
Tracker t = getTracker(context);
|
||||
|
||||
// Set screen name.
|
||||
// Where path is a String representing the screen name.
|
||||
t.setScreenName(path);
|
||||
|
||||
// Send a screen view.
|
||||
t.send(new HitBuilders.ScreenViewBuilder().build());
|
||||
|
||||
Log.i(TAG, "ScreenView sent for screen " + path);
|
||||
}
|
||||
}
|
||||
|
||||
public static void sendScreenView(Context context, String path, String category, String action, String label) {
|
||||
if(isTrackerEnabled()) {
|
||||
// Get tracker.
|
||||
Tracker t = getTracker(context);
|
||||
|
||||
// Set screen name.
|
||||
// Where path is a String representing the screen name.
|
||||
t.setScreenName(path);
|
||||
|
||||
// Send a screen view.
|
||||
t.send(new HitBuilders.ScreenViewBuilder().build());
|
||||
|
||||
// This event will also be sent with &cd=Home%20Screen.
|
||||
// Build and send an Event.
|
||||
t.send(new HitBuilders.EventBuilder()
|
||||
.setCategory(category)
|
||||
.setAction(action)
|
||||
.setLabel(label)
|
||||
.build());
|
||||
|
||||
// Clear the screen name field when we're done.
|
||||
t.setScreenName(null);
|
||||
|
||||
Log.i(TAG, "ScreenView sent for screen " + path);
|
||||
}
|
||||
}
|
||||
|
||||
public static void sendException(Context context, Exception e, boolean fatal) {
|
||||
if(isTrackerEnabled()) {
|
||||
// Get tracker.
|
||||
Tracker t = getTracker(context);
|
||||
|
||||
StandardExceptionParser exceptionParser =
|
||||
new StandardExceptionParser(context, null) {
|
||||
@Override
|
||||
public String getDescription(String threadName, Throwable t) {
|
||||
return "{" + threadName + "} " + Log.getStackTraceString(t);
|
||||
}
|
||||
};
|
||||
|
||||
t.send(new HitBuilders.ExceptionBuilder()
|
||||
.setDescription(exceptionParser.getDescription(Thread.currentThread().getName(), e))
|
||||
.setFatal(fatal)
|
||||
.build()
|
||||
);
|
||||
|
||||
Log.e(TAG, e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
<html>
|
||||
<head>
|
||||
</head>
|
||||
<body>
|
||||
Analytics package.
|
||||
</body>
|
||||
</html>
|
|
@ -38,7 +38,6 @@ import java.util.Collection;
|
|||
import java.util.List;
|
||||
|
||||
import es.ugr.swad.swadroid.Constants;
|
||||
import es.ugr.swad.swadroid.analytics.SWADroidTracker;
|
||||
import es.ugr.swad.swadroid.model.Course;
|
||||
import es.ugr.swad.swadroid.model.Event;
|
||||
import es.ugr.swad.swadroid.model.FrequentUser;
|
||||
|
@ -417,8 +416,7 @@ public class DataBaseHelper {
|
|||
null, //userBirthday
|
||||
ent.getInt("userRole"));
|
||||
} catch (ParseException e) {
|
||||
//Send exception details to Google Analytics
|
||||
SWADroidTracker.sendException(mCtx, e, false);
|
||||
Log.e(TAG, e.getMessage(), e);
|
||||
}
|
||||
break;
|
||||
case DataBaseHelper.DB_TABLE_USERS_ATTENDANCES:
|
||||
|
@ -467,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;
|
||||
|
@ -618,8 +617,7 @@ public class DataBaseHelper {
|
|||
null,
|
||||
ent.getInt("userRole"));
|
||||
} catch (ParseException e) {
|
||||
//Send exception details to Google Analytics
|
||||
SWADroidTracker.sendException(mCtx, e, false);
|
||||
Log.e(TAG, e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2315,7 +2313,6 @@ public class DataBaseHelper {
|
|||
* Delete all tables from database
|
||||
*/
|
||||
public void clearDB() {
|
||||
SWADroidTracker.sendScreenView(mCtx, TAG + " clearDB");
|
||||
db.deleteTables();
|
||||
Log.i(TAG, "All tables deleted");
|
||||
}
|
||||
|
@ -2324,7 +2321,7 @@ public class DataBaseHelper {
|
|||
* Clean data of all tables from database. Removes users photos from external storage
|
||||
*/
|
||||
public void cleanTables() {
|
||||
SWADroidTracker.sendScreenView(mCtx, TAG + " cleanTables");
|
||||
Log.i(TAG, "Emptying all tables");
|
||||
|
||||
db.emptyTables();
|
||||
compactDB();
|
||||
|
@ -2340,8 +2337,7 @@ public class DataBaseHelper {
|
|||
try {
|
||||
wait();
|
||||
} catch (InterruptedException e) {
|
||||
//Send exception details to Google Analytics
|
||||
SWADroidTracker.sendException(mCtx, e, false);
|
||||
Log.e(TAG, e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2365,8 +2361,8 @@ public class DataBaseHelper {
|
|||
|
||||
notifyAll();
|
||||
} else {
|
||||
//Send exception details to Google Analytics
|
||||
SWADroidTracker.sendException(mCtx, new DataBaseHelperException("No active transactions"), false);
|
||||
Exception e = new DataBaseHelperException("No active transactions");
|
||||
Log.e(TAG, e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2378,6 +2374,7 @@ public class DataBaseHelper {
|
|||
* Compact the database
|
||||
*/
|
||||
private void compactDB() {
|
||||
Log.i(TAG, "Compacting database");
|
||||
db.getDB().execSQL("VACUUM;");
|
||||
Log.i(TAG, "Database compacted");
|
||||
}
|
||||
|
@ -2396,6 +2393,9 @@ public class DataBaseHelper {
|
|||
*/
|
||||
public void upgradeDB() {
|
||||
int dbVersion = db.getDB().getVersion();
|
||||
|
||||
Log.i(TAG, "Upgrading database");
|
||||
|
||||
/*
|
||||
* Modify database keeping data:
|
||||
* 1. Create temporary table __DB_TABLE_GROUPS (with the new model)
|
||||
|
|
|
@ -24,7 +24,7 @@ import android.app.NotificationManager;
|
|||
import android.app.PendingIntent;
|
||||
import android.content.Context;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.support.v4.app.NotificationCompat;
|
||||
import androidx.core.app.NotificationCompat;
|
||||
|
||||
import es.ugr.swad.swadroid.utils.NotificationUtils;
|
||||
|
||||
|
|
|
@ -19,7 +19,6 @@ import org.apache.commons.io.IOUtils;
|
|||
import java.io.InputStream;
|
||||
|
||||
import es.ugr.swad.swadroid.R;
|
||||
import es.ugr.swad.swadroid.analytics.SWADroidTracker;
|
||||
|
||||
/**
|
||||
* Class for create dialogs.
|
||||
|
@ -238,8 +237,6 @@ public class DialogFactory {
|
|||
* @param tag Module tag
|
||||
* @param message Error message string
|
||||
* @param ex Exception thrown
|
||||
* @param sendException true if the error report has to be sent
|
||||
* false otherwise
|
||||
* @param isDebuggable true if the application is debuggable (develop mode). Activates Logcat messages
|
||||
* false otherwise
|
||||
* @param onClickListener ClickListener associated to the neutral button
|
||||
|
@ -247,7 +244,7 @@ public class DialogFactory {
|
|||
*/
|
||||
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
|
||||
public static AlertDialog createErrorDialog(Context context, String tag, String message, Exception ex,
|
||||
boolean sendException, boolean isDebuggable, DialogInterface.OnClickListener onClickListener) {
|
||||
boolean isDebuggable, DialogInterface.OnClickListener onClickListener) {
|
||||
|
||||
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(context)
|
||||
.setTitle(R.string.title_error_dialog)
|
||||
|
@ -258,11 +255,6 @@ public class DialogFactory {
|
|||
|
||||
if (ex != null) {
|
||||
Log.e(tag, ex.getMessage(), ex);
|
||||
|
||||
// Send exception details to Google Analytics
|
||||
if (!isDebuggable && sendException) {
|
||||
SWADroidTracker.sendException(context, ex, false);
|
||||
}
|
||||
}
|
||||
|
||||
return alertDialogBuilder.create();
|
||||
|
|
|
@ -26,7 +26,7 @@ import android.content.Intent;
|
|||
import android.content.pm.ApplicationInfo;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import android.util.Log;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
|
@ -138,14 +138,14 @@ public class MenuActivity extends AppCompatActivity {
|
|||
*
|
||||
* @param message Error message to show.
|
||||
*/
|
||||
protected void error(String message, Exception ex, boolean sendException) {
|
||||
protected void error(String message, Exception ex) {
|
||||
DialogInterface.OnClickListener onClickListener = new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
finish();
|
||||
}
|
||||
};
|
||||
|
||||
AlertDialog errorDialog = DialogFactory.createErrorDialog(this, TAG, message, ex, sendException,
|
||||
AlertDialog errorDialog = DialogFactory.createErrorDialog(this, TAG, message, ex,
|
||||
isDebuggable, onClickListener);
|
||||
|
||||
errorDialog.show();
|
||||
|
@ -208,7 +208,7 @@ public class MenuActivity extends AppCompatActivity {
|
|||
getPackageName(), 0);
|
||||
isDebuggable = (ApplicationInfo.FLAG_DEBUGGABLE != 0);
|
||||
} catch (Exception ex) {
|
||||
error(ex.getMessage(), ex, true);
|
||||
error(ex.getMessage(), ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -232,7 +232,7 @@ public class MenuActivity extends AppCompatActivity {
|
|||
try {
|
||||
dbHelper = new DataBaseHelper(this);
|
||||
} catch (Exception ex) {
|
||||
error(ex.getMessage(), ex, true);
|
||||
error(ex.getMessage(), ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ import android.content.Intent;
|
|||
import android.content.pm.ApplicationInfo;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import android.util.Log;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
|
@ -145,14 +145,14 @@ public class MenuExpandableListActivity extends AppCompatActivity {
|
|||
*
|
||||
* @param message Error message to show.
|
||||
*/
|
||||
protected void error(String message, Exception ex, boolean sendException) {
|
||||
protected void error(String message, Exception ex) {
|
||||
DialogInterface.OnClickListener onClickListener = new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
finish();
|
||||
}
|
||||
};
|
||||
|
||||
AlertDialog errorDialog = DialogFactory.createErrorDialog(this, TAG, message, ex, sendException,
|
||||
AlertDialog errorDialog = DialogFactory.createErrorDialog(this, TAG, message, ex,
|
||||
isDebuggable, onClickListener);
|
||||
|
||||
errorDialog.show();
|
||||
|
@ -224,7 +224,7 @@ public class MenuExpandableListActivity extends AppCompatActivity {
|
|||
isDebuggable = (ApplicationInfo.FLAG_DEBUGGABLE != 0);
|
||||
isSWADMain = this instanceof SWADMain;
|
||||
} catch (Exception ex) {
|
||||
error(ex.getMessage(), ex, true);
|
||||
error(ex.getMessage(), ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -248,7 +248,7 @@ public class MenuExpandableListActivity extends AppCompatActivity {
|
|||
try {
|
||||
dbHelper = new DataBaseHelper(this);
|
||||
} catch (Exception ex) {
|
||||
error(ex.getMessage(), ex, true);
|
||||
error(ex.getMessage(), ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ import android.animation.ValueAnimator;
|
|||
import android.annotation.TargetApi;
|
||||
import android.graphics.Rect;
|
||||
import android.os.Build;
|
||||
import android.support.v4.widget.SwipeRefreshLayout;
|
||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.VelocityTracker;
|
||||
import android.view.View;
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
|
|
|
@ -29,6 +29,8 @@ import android.os.Bundle;
|
|||
import android.util.Log;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.google.firebase.analytics.FirebaseAnalytics;
|
||||
|
||||
import org.ksoap2.SoapFault;
|
||||
import org.ksoap2.transport.HttpResponseException;
|
||||
import org.kxml2.kdom.Element;
|
||||
|
@ -63,6 +65,10 @@ public abstract class Module extends MenuActivity {
|
|||
* Class Module's tag name for Logcat
|
||||
*/
|
||||
private static final String TAG = Constants.APP_TAG + " Module";
|
||||
/**
|
||||
* Obtain Firebase Analytics instance
|
||||
*/
|
||||
protected FirebaseAnalytics mFirebaseAnalytics = FirebaseAnalytics.getInstance(this);
|
||||
/**
|
||||
* Async Task for background jobs
|
||||
*/
|
||||
|
@ -332,7 +338,6 @@ public abstract class Module extends MenuActivity {
|
|||
protected void onPostExecute(Void unused) {
|
||||
String errorMsg;
|
||||
int httpStatusCode;
|
||||
boolean sendException = true;
|
||||
|
||||
if (e != null) {
|
||||
/**
|
||||
|
@ -345,11 +350,9 @@ public abstract class Module extends MenuActivity {
|
|||
switch (es.faultstring) {
|
||||
case "Bad log in":
|
||||
errorMsg = getString(R.string.errorBadLoginMsg);
|
||||
sendException = false;
|
||||
break;
|
||||
case "Bad web service key":
|
||||
errorMsg = getString(R.string.errorBadLoginMsg);
|
||||
sendException = false;
|
||||
|
||||
// Force logout and reset password (this will show again
|
||||
// the login screen)
|
||||
|
@ -365,7 +368,6 @@ public abstract class Module extends MenuActivity {
|
|||
}
|
||||
} else if ((e.getClass() == TimeoutException.class) || (e.getClass() == SocketTimeoutException.class)) {
|
||||
errorMsg = getString(R.string.errorTimeoutMsg);
|
||||
sendException = false;
|
||||
} else if ((e.getClass() == CertificateException.class) || (e .getClass() == SSLException.class)) {
|
||||
errorMsg = getString(R.string.errorServerCertificateMsg);
|
||||
} else if (e.getClass() == HttpResponseException.class) {
|
||||
|
@ -378,7 +380,6 @@ public abstract class Module extends MenuActivity {
|
|||
break;
|
||||
|
||||
case 503: errorMsg = getString(R.string.errorServiceUnavailableMsg);
|
||||
sendException = false;
|
||||
break;
|
||||
|
||||
default: errorMsg = e.getMessage();
|
||||
|
@ -396,7 +397,7 @@ public abstract class Module extends MenuActivity {
|
|||
}
|
||||
|
||||
// Request finalized with errors
|
||||
error(errorMsg, e, sendException);
|
||||
error(errorMsg, e);
|
||||
setResult(RESULT_CANCELED);
|
||||
|
||||
// Launch database rollback
|
||||
|
|
|
@ -21,6 +21,8 @@ package es.ugr.swad.swadroid.modules.account;
|
|||
|
||||
import android.os.Bundle;
|
||||
|
||||
import com.google.firebase.analytics.FirebaseAnalytics;
|
||||
|
||||
import org.ksoap2.SoapFault;
|
||||
import org.ksoap2.serialization.SoapObject;
|
||||
|
||||
|
@ -122,6 +124,10 @@ public class CreateAccount extends Module {
|
|||
|
||||
//Request finalized without errors
|
||||
setResult(RESULT_OK);
|
||||
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString(FirebaseAnalytics.Param.METHOD, "requestService");
|
||||
mFirebaseAnalytics.logEvent(FirebaseAnalytics.Event.SIGN_UP, bundle);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
|
|
@ -22,7 +22,7 @@ import android.content.Intent;
|
|||
import android.graphics.Color;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.KeyEvent;
|
||||
|
@ -44,7 +44,6 @@ import es.ugr.swad.swadroid.Constants;
|
|||
import es.ugr.swad.swadroid.gui.ProgressScreen;
|
||||
import es.ugr.swad.swadroid.preferences.Preferences;
|
||||
import es.ugr.swad.swadroid.R;
|
||||
import es.ugr.swad.swadroid.analytics.SWADroidTracker;
|
||||
import es.ugr.swad.swadroid.gui.DialogFactory;
|
||||
import es.ugr.swad.swadroid.utils.Utils;
|
||||
|
||||
|
@ -196,8 +195,6 @@ public class CreateAccountActivity extends AppCompatActivity implements AdapterV
|
|||
* Creates a new account
|
||||
*/
|
||||
private void createAccount() {
|
||||
SWADroidTracker.sendScreenView(getApplicationContext(), "SWADroid CreateAccount");
|
||||
|
||||
Intent intent;
|
||||
|
||||
// Values for text field at the time of the create account attempt.
|
||||
|
@ -317,7 +314,7 @@ public class CreateAccountActivity extends AppCompatActivity implements AdapterV
|
|||
}
|
||||
|
||||
errorDialog = DialogFactory.createErrorDialog(this, TAG,
|
||||
errorMsg, null, false, false, new DialogInterface.OnClickListener() {
|
||||
errorMsg, null, false, new DialogInterface.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
|
|
|
@ -31,7 +31,6 @@ import java.util.List;
|
|||
import java.util.Vector;
|
||||
|
||||
import es.ugr.swad.swadroid.Constants;
|
||||
import es.ugr.swad.swadroid.analytics.SWADroidTracker;
|
||||
import es.ugr.swad.swadroid.database.DataBaseHelper;
|
||||
import es.ugr.swad.swadroid.model.Course;
|
||||
import es.ugr.swad.swadroid.model.Model;
|
||||
|
@ -90,8 +89,6 @@ public class Courses extends Module {
|
|||
@Override
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
|
||||
SWADroidTracker.sendScreenView(getApplicationContext(), TAG);
|
||||
|
||||
runConnection();
|
||||
}
|
||||
|
@ -210,12 +207,7 @@ public class Courses extends Module {
|
|||
try {
|
||||
dbHelper.emptyTable(DataBaseHelper.DB_TABLE_COURSES);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
||||
//Send exception details to Google Analytics
|
||||
if (!isDebuggable) {
|
||||
SWADroidTracker.sendException(context, e, false);
|
||||
}
|
||||
Log.e(TAG, e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -19,13 +19,16 @@
|
|||
package es.ugr.swad.swadroid.modules.downloads;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.NamedNodeMap;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
import org.xml.sax.InputSource;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.StringReader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
|
@ -33,8 +36,9 @@ import java.util.List;
|
|||
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
|
||||
import es.ugr.swad.swadroid.analytics.SWADroidTracker;
|
||||
import es.ugr.swad.swadroid.Constants;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -60,6 +64,11 @@ public class DirectoryNavigator {
|
|||
*/
|
||||
private Context mContext;
|
||||
|
||||
/**
|
||||
* Downloads tag name for Logcat
|
||||
*/
|
||||
private static final String TAG = Constants.APP_TAG + " DirectoryNavigator";
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
|
@ -278,9 +287,8 @@ public class DirectoryNavigator {
|
|||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
//Send exception details to Google Analytics
|
||||
SWADroidTracker.sendException(mContext, e, false);
|
||||
} catch (ParserConfigurationException | IOException | SAXException ex) {
|
||||
Log.e(TAG, ex.getMessage(), ex);
|
||||
}
|
||||
|
||||
//If we don't find the entire path, we throw an exception.
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -31,10 +31,10 @@ import android.graphics.Typeface;
|
|||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v4.app.ActivityCompat;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v4.content.FileProvider;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.core.app.ActivityCompat;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.core.content.FileProvider;
|
||||
import android.util.Log;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
|
@ -56,7 +56,6 @@ import java.util.List;
|
|||
|
||||
import es.ugr.swad.swadroid.Constants;
|
||||
import es.ugr.swad.swadroid.R;
|
||||
import es.ugr.swad.swadroid.analytics.SWADroidTracker;
|
||||
import es.ugr.swad.swadroid.gui.FontManager;
|
||||
import es.ugr.swad.swadroid.gui.MenuActivity;
|
||||
import es.ugr.swad.swadroid.gui.ProgressScreen;
|
||||
|
@ -190,7 +189,6 @@ public class DownloadsManager extends MenuActivity {
|
|||
@Override
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
SWADroidTracker.sendScreenView(getApplicationContext(), TAG);
|
||||
|
||||
// check Android 6 permission
|
||||
if (ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE)
|
||||
|
|
|
@ -27,7 +27,6 @@ import java.net.URL;
|
|||
|
||||
import es.ugr.swad.swadroid.Constants;
|
||||
import es.ugr.swad.swadroid.R;
|
||||
import es.ugr.swad.swadroid.analytics.SWADroidTracker;
|
||||
|
||||
/**
|
||||
* Download the file located at the given URL, save it to a file.
|
||||
|
@ -72,9 +71,6 @@ public class FileDownloaderAsyncTask extends AsyncTask<String, Integer, Boolean>
|
|||
} catch (MalformedURLException e) {
|
||||
Log.e(TAG, "Incorrect URL", e);
|
||||
|
||||
//Send exception details to Google Analytics
|
||||
SWADroidTracker.sendException(mContext, e, false);
|
||||
|
||||
downloadSuccess = false;
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,6 @@ import java.util.Vector;
|
|||
|
||||
import es.ugr.swad.swadroid.Constants;
|
||||
import es.ugr.swad.swadroid.R;
|
||||
import es.ugr.swad.swadroid.analytics.SWADroidTracker;
|
||||
import es.ugr.swad.swadroid.model.Group;
|
||||
import es.ugr.swad.swadroid.modules.login.Login;
|
||||
import es.ugr.swad.swadroid.modules.Module;
|
||||
|
@ -73,14 +72,12 @@ public class GetFile extends Module {
|
|||
@Override
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
|
||||
SWADroidTracker.sendScreenView(getApplicationContext(), TAG);
|
||||
|
||||
try {
|
||||
runConnection();
|
||||
} catch (Exception e) {
|
||||
String errorMsg = getString(R.string.errorServerResponseMsg);
|
||||
error(errorMsg, e, true);
|
||||
error(errorMsg, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -21,8 +21,8 @@ package es.ugr.swad.swadroid.modules.groups;
|
|||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Typeface;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v4.util.LongSparseArray;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.collection.LongSparseArray;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
|
@ -198,16 +198,16 @@ public class EnrollmentExpandableListAdapter extends BaseExpandableListAdapter {
|
|||
if (multiple == 0 && role != Constants.TEACHER_TYPE_CODE) { //single inscriptions:
|
||||
holder.checkBox.setVisibility(View.GONE);
|
||||
holder.radioButton.setVisibility(View.VISIBLE);
|
||||
holder.radioButton.setText(groupName);
|
||||
|
||||
} else { //multiple inscriptions :
|
||||
|
||||
holder.checkBox.setVisibility(View.VISIBLE);
|
||||
holder.radioButton.setVisibility(View.GONE);
|
||||
holder.checkBox.setText(groupName);
|
||||
holder.checkBox.setChecked(member != 0);
|
||||
}
|
||||
|
||||
holder.radioButton.setText(groupName);
|
||||
holder.checkBox.setChecked(member != 0);
|
||||
|
||||
holder.nStudentText.setText(context.getString(R.string.numStudent) + ": " + String.valueOf(students));
|
||||
|
||||
if (maxStudents != -1) {
|
||||
|
|
|
@ -13,7 +13,6 @@ import java.util.Vector;
|
|||
|
||||
import es.ugr.swad.swadroid.Constants;
|
||||
import es.ugr.swad.swadroid.R;
|
||||
import es.ugr.swad.swadroid.analytics.SWADroidTracker;
|
||||
import es.ugr.swad.swadroid.database.DataBaseHelper;
|
||||
import es.ugr.swad.swadroid.model.GroupType;
|
||||
import es.ugr.swad.swadroid.model.Model;
|
||||
|
@ -59,14 +58,12 @@ public class GroupTypes extends Module {
|
|||
@Override
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
|
||||
SWADroidTracker.sendScreenView(getApplicationContext(), TAG);
|
||||
|
||||
try {
|
||||
runConnection();
|
||||
} catch (Exception e) {
|
||||
String errorMsg = getString(R.string.errorServerResponseMsg);
|
||||
error(errorMsg, e, true);
|
||||
error(errorMsg, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,6 @@ import java.util.Vector;
|
|||
|
||||
import es.ugr.swad.swadroid.Constants;
|
||||
import es.ugr.swad.swadroid.R;
|
||||
import es.ugr.swad.swadroid.analytics.SWADroidTracker;
|
||||
import es.ugr.swad.swadroid.database.DataBaseHelper;
|
||||
import es.ugr.swad.swadroid.model.Group;
|
||||
import es.ugr.swad.swadroid.model.Model;
|
||||
|
@ -79,14 +78,12 @@ public class Groups extends Module {
|
|||
@Override
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
|
||||
SWADroidTracker.sendScreenView(getApplicationContext(), TAG);
|
||||
|
||||
try {
|
||||
runConnection();
|
||||
} catch (Exception e) {
|
||||
String errorMsg = getString(R.string.errorServerResponseMsg);
|
||||
error(errorMsg, e, true);
|
||||
error(errorMsg, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ import android.content.DialogInterface;
|
|||
import android.content.DialogInterface.OnClickListener;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.util.LongSparseArray;
|
||||
import androidx.collection.LongSparseArray;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
|
@ -35,7 +35,6 @@ import java.util.List;
|
|||
|
||||
import es.ugr.swad.swadroid.Constants;
|
||||
import es.ugr.swad.swadroid.R;
|
||||
import es.ugr.swad.swadroid.analytics.SWADroidTracker;
|
||||
import es.ugr.swad.swadroid.database.DataBaseHelper;
|
||||
import es.ugr.swad.swadroid.gui.DialogFactory;
|
||||
import es.ugr.swad.swadroid.gui.MenuExpandableListActivity;
|
||||
|
@ -93,8 +92,6 @@ public class MyGroupsManager extends MenuExpandableListActivity {
|
|||
|
||||
showProgressLoading();
|
||||
|
||||
SWADroidTracker.sendScreenView(getApplicationContext(), TAG);
|
||||
|
||||
List<Model> groupTypes = dbHelper.getAllRows(DataBaseHelper.DB_TABLE_GROUP_TYPES, "courseCode = " + courseCode, "groupTypeName");
|
||||
List<Group> groups = dbHelper.getGroups(courseCode);
|
||||
if ((!groupTypes.isEmpty()) && (!groups.isEmpty())) {
|
||||
|
|
|
@ -88,7 +88,7 @@ public class SendMyGroups extends Module {
|
|||
runConnection();
|
||||
} catch (Exception e) {
|
||||
String errorMsg = getString(R.string.errorServerResponseMsg);
|
||||
error(errorMsg, e, true);
|
||||
error(errorMsg, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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() {
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -14,7 +14,6 @@ import org.ksoap2.serialization.SoapObject;
|
|||
|
||||
import es.ugr.swad.swadroid.Constants;
|
||||
import es.ugr.swad.swadroid.R;
|
||||
import es.ugr.swad.swadroid.analytics.SWADroidTracker;
|
||||
import es.ugr.swad.swadroid.gui.ProgressScreen;
|
||||
import es.ugr.swad.swadroid.gui.WebViewFactory;
|
||||
import es.ugr.swad.swadroid.model.User;
|
||||
|
@ -149,12 +148,11 @@ public class Information extends Module {
|
|||
protected void onStart() {
|
||||
super.onStart();
|
||||
|
||||
SWADroidTracker.sendScreenView(getApplicationContext(), TAG + " " + infoTypeToAdd);
|
||||
try {
|
||||
runConnection();
|
||||
} catch (Exception e) {
|
||||
String errorMsg = getString(R.string.errorServerResponseMsg);
|
||||
error(errorMsg, e, true);
|
||||
error(errorMsg, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -22,6 +22,8 @@ package es.ugr.swad.swadroid.modules.login;
|
|||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
|
||||
import com.google.firebase.analytics.FirebaseAnalytics;
|
||||
|
||||
import org.ksoap2.SoapFault;
|
||||
import org.ksoap2.serialization.SoapObject;
|
||||
|
||||
|
@ -173,6 +175,10 @@ public class Login extends Module {
|
|||
|
||||
//Request finalized without errors
|
||||
setResult(RESULT_OK);
|
||||
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString(FirebaseAnalytics.Param.METHOD, "requestService");
|
||||
mFirebaseAnalytics.logEvent(FirebaseAnalytics.Event.LOGIN, bundle);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
|
|
@ -21,7 +21,7 @@ import android.content.DialogInterface;
|
|||
import android.content.Intent;
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import android.text.InputType;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
@ -43,7 +43,6 @@ import java.util.List;
|
|||
|
||||
import es.ugr.swad.swadroid.Constants;
|
||||
import es.ugr.swad.swadroid.R;
|
||||
import es.ugr.swad.swadroid.analytics.SWADroidTracker;
|
||||
import es.ugr.swad.swadroid.gui.DialogFactory;
|
||||
import es.ugr.swad.swadroid.gui.ProgressScreen;
|
||||
import es.ugr.swad.swadroid.modules.account.CreateAccountActivity;
|
||||
|
@ -222,7 +221,6 @@ public class LoginActivity extends AppCompatActivity implements AdapterView.OnIt
|
|||
* are presented and no actual login attempt is made.
|
||||
*/
|
||||
private void attemptLogin() {
|
||||
SWADroidTracker.sendScreenView(getApplicationContext(), "SWADroid Login");
|
||||
|
||||
// Values for ID and password at the time of the login attempt.
|
||||
String idValue;
|
||||
|
@ -353,8 +351,6 @@ public class LoginActivity extends AppCompatActivity implements AdapterView.OnIt
|
|||
}
|
||||
|
||||
private void whyMyPasswordNotWorkDialog() {
|
||||
SWADroidTracker.sendScreenView(getApplicationContext(), "SWADroid WhyMyPasswordNotWork");
|
||||
|
||||
AlertDialog passwordNotWorkDialog =
|
||||
DialogFactory.createNeutralDialog(this,
|
||||
R.layout.dialog_why_password,
|
||||
|
@ -373,8 +369,6 @@ public class LoginActivity extends AppCompatActivity implements AdapterView.OnIt
|
|||
}
|
||||
|
||||
private void recoverPasswordDialog() {
|
||||
SWADroidTracker.sendScreenView(getApplicationContext(), "SWADroid RecoverPassword");
|
||||
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||
|
||||
final EditText user = new EditText(getApplicationContext());
|
||||
|
|
|
@ -26,7 +26,6 @@ import android.util.Log;
|
|||
import org.ksoap2.serialization.SoapObject;
|
||||
|
||||
import es.ugr.swad.swadroid.Constants;
|
||||
import es.ugr.swad.swadroid.analytics.SWADroidTracker;
|
||||
import es.ugr.swad.swadroid.model.User;
|
||||
import es.ugr.swad.swadroid.modules.Module;
|
||||
import es.ugr.swad.swadroid.modules.login.Login;
|
||||
|
@ -73,8 +72,6 @@ public class GetMarks extends Module {
|
|||
protected void onStart() {
|
||||
super.onStart();
|
||||
|
||||
SWADroidTracker.sendScreenView(getApplicationContext(), TAG);
|
||||
|
||||
fileCode = this.getIntent().getLongExtra("fileCode", 0);
|
||||
|
||||
runConnection();
|
||||
|
|
|
@ -11,7 +11,6 @@ import android.webkit.WebView;
|
|||
|
||||
import es.ugr.swad.swadroid.Constants;
|
||||
import es.ugr.swad.swadroid.R;
|
||||
import es.ugr.swad.swadroid.analytics.SWADroidTracker;
|
||||
import es.ugr.swad.swadroid.gui.MenuActivity;
|
||||
import es.ugr.swad.swadroid.gui.WebViewFactory;
|
||||
import es.ugr.swad.swadroid.modules.courses.Courses;
|
||||
|
@ -49,8 +48,6 @@ public class Marks extends MenuActivity {
|
|||
protected void onStart() {
|
||||
super.onStart();
|
||||
|
||||
SWADroidTracker.sendScreenView(getApplicationContext(), TAG);
|
||||
|
||||
String content = this.getIntent().getStringExtra("content");
|
||||
|
||||
content = Utils.fixLinks(content);
|
||||
|
|
|
@ -22,7 +22,7 @@ import android.content.DialogInterface;
|
|||
import android.content.Intent;
|
||||
import android.graphics.Paint;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
|
@ -46,7 +46,6 @@ import java.util.Vector;
|
|||
|
||||
import es.ugr.swad.swadroid.Constants;
|
||||
import es.ugr.swad.swadroid.R;
|
||||
import es.ugr.swad.swadroid.analytics.SWADroidTracker;
|
||||
import es.ugr.swad.swadroid.database.DataBaseHelper;
|
||||
import es.ugr.swad.swadroid.gui.ImageFactory;
|
||||
import es.ugr.swad.swadroid.gui.ProgressScreen;
|
||||
|
@ -231,12 +230,6 @@ public class Messages extends Module {
|
|||
setMETHOD_NAME("sendMessage");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
SWADroidTracker.sendScreenView(getApplicationContext(), TAG);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads user input
|
||||
*/
|
||||
|
@ -360,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 + "')");
|
||||
}
|
||||
|
||||
|
@ -463,7 +456,7 @@ public class Messages extends Module {
|
|||
}
|
||||
} catch (Exception e) {
|
||||
String errorMsg = getString(R.string.errorServerResponseMsg);
|
||||
error(errorMsg, e, true);
|
||||
error(errorMsg, e);
|
||||
}
|
||||
return true;
|
||||
case android.R.id.home:
|
||||
|
|
|
@ -7,9 +7,9 @@ import android.content.res.Configuration;
|
|||
import android.graphics.Typeface;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.view.MenuItemCompat;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.support.v7.widget.SearchView;
|
||||
import androidx.core.view.MenuItemCompat;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.appcompat.widget.SearchView;
|
||||
import android.text.SpannableString;
|
||||
import android.text.style.StyleSpan;
|
||||
import android.util.Log;
|
||||
|
@ -28,7 +28,6 @@ import java.util.List;
|
|||
import java.util.Vector;
|
||||
import es.ugr.swad.swadroid.Constants;
|
||||
import es.ugr.swad.swadroid.R;
|
||||
import es.ugr.swad.swadroid.analytics.SWADroidTracker;
|
||||
import es.ugr.swad.swadroid.database.DataBaseHelper;
|
||||
import es.ugr.swad.swadroid.gui.ProgressScreen;
|
||||
import es.ugr.swad.swadroid.model.FrequentUser;
|
||||
|
@ -143,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 = "";
|
||||
|
||||
|
@ -182,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();
|
||||
|
@ -199,12 +201,6 @@ public class SearchUsers extends Module implements SearchView.OnQueryTextListene
|
|||
setMETHOD_NAME("findUsers");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
SWADroidTracker.sendScreenView(getApplicationContext(), TAG);
|
||||
}
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
|
@ -367,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++){
|
||||
|
@ -376,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();
|
||||
|
@ -458,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()));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -547,4 +544,4 @@ public class SearchUsers extends Module implements SearchView.OnQueryTextListene
|
|||
AlertDialog alert = builder.create();
|
||||
alert.show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,7 +33,6 @@ import android.widget.Toast;
|
|||
|
||||
import es.ugr.swad.swadroid.Constants;
|
||||
import es.ugr.swad.swadroid.R;
|
||||
import es.ugr.swad.swadroid.analytics.SWADroidTracker;
|
||||
import es.ugr.swad.swadroid.gui.DialogFactory;
|
||||
import es.ugr.swad.swadroid.model.User;
|
||||
import es.ugr.swad.swadroid.modules.courses.Courses;
|
||||
|
@ -84,7 +83,7 @@ public class Notices extends Module {
|
|||
}
|
||||
} catch (Exception e) {
|
||||
String errorMsg = getString(R.string.errorServerResponseMsg);
|
||||
error(errorMsg, e, true);
|
||||
error(errorMsg, e);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -189,7 +188,7 @@ public class Notices extends Module {
|
|||
@Override
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
SWADroidTracker.sendScreenView(getApplicationContext(), TAG);
|
||||
|
||||
selectedCourseCode = Courses.getSelectedCourseCode();
|
||||
launchNoticeDialog();
|
||||
}
|
||||
|
|
|
@ -30,7 +30,6 @@ import android.widget.TextView;
|
|||
|
||||
import es.ugr.swad.swadroid.Constants;
|
||||
import es.ugr.swad.swadroid.R;
|
||||
import es.ugr.swad.swadroid.analytics.SWADroidTracker;
|
||||
import es.ugr.swad.swadroid.gui.ImageFactory;
|
||||
import es.ugr.swad.swadroid.gui.MenuActivity;
|
||||
import es.ugr.swad.swadroid.gui.WebViewFactory;
|
||||
|
@ -122,7 +121,6 @@ public class NotificationItem extends MenuActivity {
|
|||
Log.w(TAG, "Not connected: Marking the notification " + notifCode + " as read in SWAD was deferred");
|
||||
}
|
||||
}
|
||||
SWADroidTracker.sendScreenView(getApplicationContext(), TAG);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
|
|
@ -30,7 +30,7 @@ import android.content.Intent;
|
|||
import android.content.IntentFilter;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.widget.SwipeRefreshLayout;
|
||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||
import android.util.Log;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
|
@ -50,7 +50,6 @@ import java.util.Vector;
|
|||
|
||||
import es.ugr.swad.swadroid.Constants;
|
||||
import es.ugr.swad.swadroid.R;
|
||||
import es.ugr.swad.swadroid.analytics.SWADroidTracker;
|
||||
import es.ugr.swad.swadroid.database.DataBaseHelper;
|
||||
import es.ugr.swad.swadroid.gui.AlertNotificationFactory;
|
||||
import es.ugr.swad.swadroid.model.Model;
|
||||
|
@ -341,7 +340,6 @@ public class Notifications extends Module implements
|
|||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
SWADroidTracker.sendScreenView(getApplicationContext(), TAG);
|
||||
|
||||
IntentFilter intentFilter = new IntentFilter();
|
||||
intentFilter.addAction(NotificationsSyncAdapterService.START_SYNC);
|
||||
|
@ -543,7 +541,7 @@ public class Notifications extends Module implements
|
|||
try {
|
||||
dbHelper.emptyTable(DataBaseHelper.DB_TABLE_NOTIFICATIONS);
|
||||
} catch (Exception e) {
|
||||
error(e.getMessage(), e, true);
|
||||
error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -570,7 +568,7 @@ public class Notifications extends Module implements
|
|||
notifCount = intent.getIntExtra("notifCount", 0);
|
||||
errorMessage = intent.getStringExtra("errorMessage");
|
||||
if ((errorMessage != null) && !errorMessage.equals("")) {
|
||||
error(errorMessage, null, true);
|
||||
error(errorMessage, null);
|
||||
} else if (notifCount == 0) {
|
||||
Toast.makeText(context, R.string.NoNotificationsMsg,
|
||||
Toast.LENGTH_LONG).show();
|
||||
|
|
|
@ -20,7 +20,7 @@ package es.ugr.swad.swadroid.modules.notifications;
|
|||
|
||||
import android.app.Activity;
|
||||
import android.graphics.Typeface;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
|
|
@ -24,7 +24,6 @@ import android.util.Log;
|
|||
import org.ksoap2.serialization.SoapPrimitive;
|
||||
|
||||
import es.ugr.swad.swadroid.Constants;
|
||||
import es.ugr.swad.swadroid.analytics.SWADroidTracker;
|
||||
import es.ugr.swad.swadroid.modules.Module;
|
||||
import es.ugr.swad.swadroid.modules.login.Login;
|
||||
import es.ugr.swad.swadroid.utils.Utils;
|
||||
|
@ -53,13 +52,6 @@ public class NotificationsMarkAllAsRead extends Module {
|
|||
getSupportActionBar().hide();
|
||||
runConnection();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
|
||||
SWADroidTracker.sendScreenView(getApplicationContext(), TAG);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see es.ugr.swad.swadroid.modules.Module#requestService()
|
||||
|
|
|
@ -52,7 +52,6 @@ import javax.net.ssl.SSLException;
|
|||
import es.ugr.swad.swadroid.Config;
|
||||
import es.ugr.swad.swadroid.Constants;
|
||||
import es.ugr.swad.swadroid.R;
|
||||
import es.ugr.swad.swadroid.analytics.SWADroidTracker;
|
||||
import es.ugr.swad.swadroid.database.DataBaseHelper;
|
||||
import es.ugr.swad.swadroid.gui.AlertNotificationFactory;
|
||||
import es.ugr.swad.swadroid.model.Model;
|
||||
|
@ -106,7 +105,6 @@ public class NotificationsSyncAdapterService extends Service {
|
|||
|
||||
@Override
|
||||
public void onPerformSync(Account account, Bundle extras, String authority, ContentProviderClient provider, SyncResult syncResult) {
|
||||
boolean sendException = true;
|
||||
int httpStatusCode;
|
||||
|
||||
try {
|
||||
|
@ -121,11 +119,9 @@ public class NotificationsSyncAdapterService extends Service {
|
|||
switch (es.faultstring) {
|
||||
case "Bad log in":
|
||||
errorMessage = mContext.getString(R.string.errorBadLoginMsg);
|
||||
sendException = false;
|
||||
break;
|
||||
case "Bad web service key":
|
||||
errorMessage = mContext.getString(R.string.errorBadLoginMsg);
|
||||
sendException = false;
|
||||
|
||||
// Force logout and reset password (this will show again
|
||||
// the login screen)
|
||||
|
@ -141,7 +137,6 @@ public class NotificationsSyncAdapterService extends Service {
|
|||
}
|
||||
} else if ((e.getClass() == TimeoutException.class) || (e.getClass() == SocketTimeoutException.class)) {
|
||||
errorMessage = mContext.getString(R.string.errorTimeoutMsg);
|
||||
sendException = false;
|
||||
} else if ((e.getClass() == CertificateException.class) || (e .getClass() == SSLException.class)) {
|
||||
errorMessage = mContext.getString(R.string.errorServerCertificateMsg);
|
||||
} else if (e.getClass() == HttpResponseException.class) {
|
||||
|
@ -154,7 +149,6 @@ public class NotificationsSyncAdapterService extends Service {
|
|||
break;
|
||||
|
||||
case 503: errorMessage = mContext.getString(R.string.errorServiceUnavailableMsg);
|
||||
sendException = false;
|
||||
break;
|
||||
|
||||
default: errorMessage = e.getMessage();
|
||||
|
@ -176,12 +170,7 @@ public class NotificationsSyncAdapterService extends Service {
|
|||
dbHelper.endTransaction(false);
|
||||
}
|
||||
|
||||
//Send exception details to Google Analytics
|
||||
if(sendException) {
|
||||
SWADroidTracker.sendException(mContext, e, false);
|
||||
} else {
|
||||
Log.e(TAG, errorMessage, e);
|
||||
}
|
||||
Log.e(TAG, errorMessage, e);
|
||||
|
||||
//Notify synchronization stop
|
||||
Intent stopIntent = new Intent();
|
||||
|
@ -215,9 +204,6 @@ public class NotificationsSyncAdapterService extends Service {
|
|||
webserviceClient = null;
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "Error initializing database and preferences", e);
|
||||
|
||||
//Send exception details to Google Analytics
|
||||
SWADroidTracker.sendException(mCtx, e, false);
|
||||
}
|
||||
|
||||
super.onCreate();
|
||||
|
|
|
@ -18,7 +18,6 @@ import java.util.Map;
|
|||
|
||||
import es.ugr.swad.swadroid.Constants;
|
||||
import es.ugr.swad.swadroid.R;
|
||||
import es.ugr.swad.swadroid.analytics.SWADroidTracker;
|
||||
import es.ugr.swad.swadroid.gui.MenuActivity;
|
||||
import es.ugr.swad.swadroid.modules.login.Login;
|
||||
|
||||
|
@ -65,8 +64,6 @@ public class GenerateQR extends MenuActivity {
|
|||
protected void onStart() {
|
||||
super.onStart();
|
||||
|
||||
SWADroidTracker.sendScreenView(getApplicationContext(), TAG);
|
||||
|
||||
if (!Login.isLogged() || (Login.getLoggedUser() == null)) {
|
||||
Intent activity = new Intent(getApplicationContext(), Login.class);
|
||||
startActivityForResult(activity, Constants.LOGIN_REQUEST_CODE);
|
||||
|
@ -116,7 +113,7 @@ public class GenerateQR extends MenuActivity {
|
|||
qrCode = barcodeEncoder.encodeBitmap(qrContents, BarcodeFormat.QR_CODE, CODE_WIDTH, CODE_HEIGHT, hintMap);
|
||||
qr_image.setImageBitmap(qrCode);
|
||||
} catch (WriterException e) {
|
||||
error(e.getMessage(), e, true);
|
||||
error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ package es.ugr.swad.swadroid.modules.rollcall;
|
|||
import android.media.MediaPlayer;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import android.util.Log;
|
||||
import android.view.Gravity;
|
||||
import android.view.KeyEvent;
|
||||
|
|
|
@ -23,7 +23,7 @@ package es.ugr.swad.swadroid.modules.rollcall;
|
|||
import android.content.Context;
|
||||
import android.database.Cursor;
|
||||
import android.graphics.Typeface;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
|
|
@ -80,7 +80,7 @@ public class EventsDownload extends Module {
|
|||
runConnection();
|
||||
} catch (Exception e) {
|
||||
String errorMsg = getString(R.string.errorServerResponseMsg);
|
||||
error(errorMsg, e, true);
|
||||
error(errorMsg, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ import android.database.Cursor;
|
|||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.support.v4.widget.SwipeRefreshLayout;
|
||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.AbsListView;
|
||||
|
@ -39,7 +39,6 @@ import java.lang.ref.WeakReference;
|
|||
|
||||
import es.ugr.swad.swadroid.Constants;
|
||||
import es.ugr.swad.swadroid.R;
|
||||
import es.ugr.swad.swadroid.analytics.SWADroidTracker;
|
||||
import es.ugr.swad.swadroid.gui.DialogFactory;
|
||||
import es.ugr.swad.swadroid.gui.MenuExpandableListActivity;
|
||||
import es.ugr.swad.swadroid.gui.ProgressScreen;
|
||||
|
@ -51,197 +50,197 @@ import es.ugr.swad.swadroid.modules.courses.Courses;
|
|||
* @author Juan Miguel Boyero Corral <juanmi1982@gmail.com>
|
||||
*/
|
||||
public class Rollcall extends MenuExpandableListActivity implements
|
||||
SwipeRefreshLayout.OnRefreshListener {
|
||||
SwipeRefreshLayout.OnRefreshListener {
|
||||
|
||||
/**
|
||||
* Rollcall tag name for Logcat
|
||||
*/
|
||||
private static final String TAG = Constants.APP_TAG + " Rollcall";
|
||||
/**
|
||||
* ListView of events
|
||||
*/
|
||||
private static ListView lvEvents;
|
||||
/**
|
||||
* Adapter for ListView of events
|
||||
*/
|
||||
private static EventsCursorAdapter adapter;
|
||||
private final RefreshAdapterHandler mHandler = new RefreshAdapterHandler(this);
|
||||
private final Runnable mRunnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
/**
|
||||
* Rollcall tag name for Logcat
|
||||
*/
|
||||
private static final String TAG = Constants.APP_TAG + " Rollcall";
|
||||
/**
|
||||
* ListView of events
|
||||
*/
|
||||
private ListView lvEvents;
|
||||
/**
|
||||
* Adapter for ListView of events
|
||||
*/
|
||||
private static EventsCursorAdapter adapter;
|
||||
private final RefreshAdapterHandler mHandler = new RefreshAdapterHandler(this);
|
||||
private final Runnable mRunnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
/*
|
||||
Database cursor for Adapter of events
|
||||
*/
|
||||
Cursor dbCursor = dbHelper.getEventsCourseCursor(Courses.getSelectedCourseCode());
|
||||
startManagingCursor(dbCursor);
|
||||
Cursor dbCursor = dbHelper.getEventsCourseCursor(Courses.getSelectedCourseCode());
|
||||
startManagingCursor(dbCursor);
|
||||
|
||||
|
||||
/*
|
||||
* If there aren't events to show, hide the events lvEvents
|
||||
* and show the empty events message
|
||||
*/
|
||||
if ((dbCursor == null) || (dbCursor.getCount() == 0)) {
|
||||
Log.d(TAG, "Events list is empty");
|
||||
/*
|
||||
* If there aren't events to show, hide the events lvEvents
|
||||
* and show the empty events message
|
||||
*/
|
||||
if ((dbCursor == null) || (dbCursor.getCount() == 0)) {
|
||||
Log.d(TAG, "Events list is empty");
|
||||
|
||||
emptyEventsTextView.setText(R.string.eventsEmptyListMsg);
|
||||
emptyEventsTextView.setVisibility(View.VISIBLE);
|
||||
emptyEventsTextView.setText(R.string.eventsEmptyListMsg);
|
||||
emptyEventsTextView.setVisibility(View.VISIBLE);
|
||||
|
||||
lvEvents.setVisibility(View.GONE);
|
||||
} else {
|
||||
Log.d(TAG, "Events list is not empty");
|
||||
lvEvents.setVisibility(View.GONE);
|
||||
} else {
|
||||
Log.d(TAG, "Events list is not empty");
|
||||
|
||||
emptyEventsTextView.setVisibility(View.GONE);
|
||||
lvEvents.setVisibility(View.VISIBLE);
|
||||
}
|
||||
emptyEventsTextView.setVisibility(View.GONE);
|
||||
lvEvents.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
adapter = new EventsCursorAdapter(getBaseContext(), dbCursor, dbHelper);
|
||||
lvEvents.setAdapter(adapter);
|
||||
adapter = new EventsCursorAdapter(getBaseContext(), dbCursor, dbHelper);
|
||||
lvEvents.setAdapter(adapter);
|
||||
|
||||
mProgressScreen.hide();
|
||||
}
|
||||
};
|
||||
/**
|
||||
* TextView for the empty events message
|
||||
*/
|
||||
private TextView emptyEventsTextView;
|
||||
/**
|
||||
* Layout with "Pull to refresh" function
|
||||
*/
|
||||
private SwipeRefreshLayout refreshLayout;
|
||||
/**
|
||||
* Progress screen
|
||||
*/
|
||||
private ProgressScreen mProgressScreen;
|
||||
/**
|
||||
* ListView click listener
|
||||
*/
|
||||
private ListView.OnItemClickListener clickListener = new ListView.OnItemClickListener() {
|
||||
mProgressScreen.hide();
|
||||
}
|
||||
};
|
||||
/**
|
||||
* TextView for the empty events message
|
||||
*/
|
||||
private TextView emptyEventsTextView;
|
||||
/**
|
||||
* Layout with "Pull to refresh" function
|
||||
*/
|
||||
private SwipeRefreshLayout refreshLayout;
|
||||
/**
|
||||
* Progress screen
|
||||
*/
|
||||
private ProgressScreen mProgressScreen;
|
||||
/**
|
||||
* ListView click listener
|
||||
*/
|
||||
private ListView.OnItemClickListener clickListener = new ListView.OnItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||
Intent activity = new Intent(getApplicationContext(),
|
||||
UsersActivity.class);
|
||||
activity.putExtra("attendanceEventCode",
|
||||
(int) adapter.getItemId(position));
|
||||
startActivity(activity);
|
||||
}
|
||||
};
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see es.ugr.swad.swadroid.MenuExpandableListActivity#onCreate(android.os.Bundle)
|
||||
*/
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||
Intent activity = new Intent(getApplicationContext(),
|
||||
UsersActivity.class);
|
||||
activity.putExtra("attendanceEventCode",
|
||||
(int) adapter.getItemId(position));
|
||||
startActivity(activity);
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.list_items_pulltorefresh);
|
||||
|
||||
refreshLayout = findViewById(R.id.swipe_container_list);
|
||||
emptyEventsTextView = findViewById(R.id.list_item_title);
|
||||
|
||||
View mProgressScreenView = findViewById(R.id.progress_screen);
|
||||
mProgressScreen = new ProgressScreen(mProgressScreenView, refreshLayout,
|
||||
getString(R.string.loadingMsg), this);
|
||||
|
||||
lvEvents = findViewById(R.id.list_pulltorefresh);
|
||||
|
||||
lvEvents.setOnItemClickListener(clickListener);
|
||||
lvEvents.setOnScrollListener(new AbsListView.OnScrollListener() {
|
||||
@Override
|
||||
public void onScrollStateChanged(AbsListView absListView, int scrollState) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onScroll(AbsListView absListView, int firstVisibleItem,
|
||||
int visibleItemCount, int totalItemCount) {
|
||||
|
||||
boolean enable = true;
|
||||
if ((lvEvents != null) && (lvEvents.getChildCount() > 0)) {
|
||||
// check if the first item of the list is visible
|
||||
boolean firstItemVisible = lvEvents.getFirstVisiblePosition() == 0;
|
||||
// check if the top of the first item is visible
|
||||
boolean topOfFirstItemVisible = lvEvents.getChildAt(0).getTop() == 0;
|
||||
// enabling or disabling the refresh layout
|
||||
enable = firstItemVisible && topOfFirstItemVisible;
|
||||
}
|
||||
refreshLayout.setEnabled(enable);
|
||||
}
|
||||
});
|
||||
|
||||
refreshLayout.setOnRefreshListener(this);
|
||||
setAppearance();
|
||||
|
||||
getSupportActionBar().setSubtitle(Courses.getSelectedCourseShortName());
|
||||
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
}
|
||||
};
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see es.ugr.swad.swadroid.MenuExpandableListActivity#onCreate(android.os.Bundle)
|
||||
*/
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.list_items_pulltorefresh);
|
||||
/* (non-Javadoc)
|
||||
* @see es.ugr.swad.swadroid.MenuExpandableListActivity#Override(android.os.Bundle)
|
||||
*/
|
||||
@Override
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
|
||||
refreshLayout = (SwipeRefreshLayout) findViewById(R.id.swipe_container_list);
|
||||
emptyEventsTextView = (TextView) findViewById(R.id.list_item_title);
|
||||
|
||||
View mProgressScreenView = findViewById(R.id.progress_screen);
|
||||
mProgressScreen = new ProgressScreen(mProgressScreenView, refreshLayout,
|
||||
getString(R.string.loadingMsg), this);
|
||||
|
||||
lvEvents = (ListView) findViewById(R.id.list_pulltorefresh);
|
||||
|
||||
lvEvents.setOnItemClickListener(clickListener);
|
||||
lvEvents.setOnScrollListener(new AbsListView.OnScrollListener() {
|
||||
@Override
|
||||
public void onScrollStateChanged(AbsListView absListView, int scrollState) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onScroll(AbsListView absListView, int firstVisibleItem,
|
||||
int visibleItemCount, int totalItemCount) {
|
||||
|
||||
boolean enable = true;
|
||||
if ((lvEvents != null) && (lvEvents.getChildCount() > 0)) {
|
||||
// check if the first item of the list is visible
|
||||
boolean firstItemVisible = lvEvents.getFirstVisiblePosition() == 0;
|
||||
// check if the top of the first item is visible
|
||||
boolean topOfFirstItemVisible = lvEvents.getChildAt(0).getTop() == 0;
|
||||
// enabling or disabling the refresh layout
|
||||
enable = firstItemVisible && topOfFirstItemVisible;
|
||||
}
|
||||
refreshLayout.setEnabled(enable);
|
||||
}
|
||||
});
|
||||
|
||||
refreshLayout.setOnRefreshListener(this);
|
||||
setAppearance();
|
||||
|
||||
getSupportActionBar().setSubtitle(Courses.getSelectedCourseShortName());
|
||||
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see es.ugr.swad.swadroid.MenuExpandableListActivity#Override(android.os.Bundle)
|
||||
*/
|
||||
@Override
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
SWADroidTracker.sendScreenView(getApplicationContext(), TAG);
|
||||
|
||||
//Refresh ListView of events
|
||||
refreshAdapter();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
|
||||
switch (requestCode) {
|
||||
case Constants.ROLLCALL_EVENTS_DOWNLOAD_REQUEST_CODE:
|
||||
//Refresh ListView of events
|
||||
refreshAdapter();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void refreshAdapter() {
|
||||
mHandler.post(mRunnable);
|
||||
}
|
||||
|
||||
private void refreshEvents() {
|
||||
mProgressScreen.show();
|
||||
Intent activity = new Intent(this, EventsDownload.class);
|
||||
startActivityForResult(activity, Constants.ROLLCALL_EVENTS_DOWNLOAD_REQUEST_CODE);
|
||||
}
|
||||
|
||||
/**
|
||||
* It shows the SwipeRefreshLayout progress
|
||||
*/
|
||||
private void showSwipeProgress() {
|
||||
refreshLayout.setRefreshing(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* It shows the SwipeRefreshLayout progress
|
||||
*/
|
||||
private void hideSwipeProgress() {
|
||||
refreshLayout.setRefreshing(false);
|
||||
}
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
|
||||
private void setAppearance() {
|
||||
refreshLayout.setColorSchemeResources(android.R.color.holo_blue_bright,
|
||||
android.R.color.holo_green_light,
|
||||
android.R.color.holo_orange_light,
|
||||
android.R.color.holo_red_light);
|
||||
}
|
||||
|
||||
private boolean hasPendingEvents() {
|
||||
boolean hasPendingEvents = false;
|
||||
TextView sendingStateTextView;
|
||||
int i = 0;
|
||||
|
||||
if ((lvEvents != null) && (lvEvents.getChildCount() > 0)) {
|
||||
while(!hasPendingEvents && (i<lvEvents.getChildCount())) {
|
||||
sendingStateTextView = (TextView) lvEvents.getChildAt(i).findViewById(R.id.sendingStateTextView);
|
||||
hasPendingEvents = sendingStateTextView.getText().equals(getString(R.string.sendingStatePending));
|
||||
i++;
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
|
||||
switch (requestCode) {
|
||||
case Constants.ROLLCALL_EVENTS_DOWNLOAD_REQUEST_CODE:
|
||||
refreshAdapter();
|
||||
break;
|
||||
}
|
||||
super.onActivityResult(requestCode, resultCode, intent);
|
||||
}
|
||||
|
||||
return hasPendingEvents;
|
||||
}
|
||||
private void refreshAdapter() {
|
||||
mHandler.post(mRunnable);
|
||||
}
|
||||
|
||||
private void refreshEvents() {
|
||||
mProgressScreen.show();
|
||||
Intent activity = new Intent(this, EventsDownload.class);
|
||||
startActivityForResult(activity, Constants.ROLLCALL_EVENTS_DOWNLOAD_REQUEST_CODE);
|
||||
}
|
||||
|
||||
/**
|
||||
* It shows the SwipeRefreshLayout progress
|
||||
*/
|
||||
private void showSwipeProgress() {
|
||||
refreshLayout.setRefreshing(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* It shows the SwipeRefreshLayout progress
|
||||
*/
|
||||
private void hideSwipeProgress() {
|
||||
refreshLayout.setRefreshing(false);
|
||||
}
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
|
||||
private void setAppearance() {
|
||||
refreshLayout.setColorSchemeResources(android.R.color.holo_blue_bright,
|
||||
android.R.color.holo_green_light,
|
||||
android.R.color.holo_orange_light,
|
||||
android.R.color.holo_red_light);
|
||||
}
|
||||
|
||||
private boolean hasPendingEvents() {
|
||||
boolean hasPendingEvents = false;
|
||||
TextView sendingStateTextView;
|
||||
int i = 0;
|
||||
|
||||
if ((lvEvents != null) && (lvEvents.getChildCount() > 0)) {
|
||||
while(!hasPendingEvents && (i<lvEvents.getChildCount())) {
|
||||
sendingStateTextView = lvEvents.getChildAt(i).findViewById(R.id.sendingStateTextView);
|
||||
hasPendingEvents = sendingStateTextView.getText().equals(getString(R.string.sendingStatePending));
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
return hasPendingEvents;
|
||||
}
|
||||
|
||||
private void updateEvents() {
|
||||
showSwipeProgress();
|
||||
|
@ -251,48 +250,48 @@ public class Rollcall extends MenuExpandableListActivity implements
|
|||
hideSwipeProgress();
|
||||
}
|
||||
|
||||
/**
|
||||
* It must be overriden by parent classes if manual swipe is enabled.
|
||||
*/
|
||||
@Override
|
||||
public void onRefresh() {
|
||||
if(!hasPendingEvents()) {
|
||||
updateEvents();
|
||||
} else {
|
||||
AlertDialog cleanEventsDialog = DialogFactory.createWarningDialog(this,
|
||||
-1,
|
||||
R.string.areYouSure,
|
||||
R.string.updatePendingEventsMsg,
|
||||
R.string.yesMsg,
|
||||
R.string.noMsg,
|
||||
true,
|
||||
new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
dialog.cancel();
|
||||
/**
|
||||
* It must be overriden by parent classes if manual swipe is enabled.
|
||||
*/
|
||||
@Override
|
||||
public void onRefresh() {
|
||||
if(!hasPendingEvents()) {
|
||||
updateEvents();
|
||||
} else {
|
||||
AlertDialog cleanEventsDialog = DialogFactory.createWarningDialog(this,
|
||||
-1,
|
||||
R.string.areYouSure,
|
||||
R.string.updatePendingEventsMsg,
|
||||
R.string.yesMsg,
|
||||
R.string.noMsg,
|
||||
true,
|
||||
new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
dialog.cancel();
|
||||
|
||||
updateEvents();
|
||||
}
|
||||
},
|
||||
new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
dialog.cancel();
|
||||
}
|
||||
},
|
||||
null);
|
||||
updateEvents();
|
||||
}
|
||||
},
|
||||
new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
dialog.cancel();
|
||||
}
|
||||
},
|
||||
null);
|
||||
|
||||
cleanEventsDialog.show();
|
||||
cleanEventsDialog.show();
|
||||
}
|
||||
|
||||
hideSwipeProgress();
|
||||
}
|
||||
|
||||
hideSwipeProgress();
|
||||
}
|
||||
private static class RefreshAdapterHandler extends Handler {
|
||||
|
||||
private static class RefreshAdapterHandler extends Handler {
|
||||
private final WeakReference<Rollcall> mActivity;
|
||||
|
||||
private final WeakReference<Rollcall> mActivity;
|
||||
public RefreshAdapterHandler(Rollcall activity) {
|
||||
mActivity = new WeakReference<>(activity);
|
||||
}
|
||||
|
||||
public RefreshAdapterHandler(Rollcall activity) {
|
||||
mActivity = new WeakReference<>(activity);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,10 +31,10 @@ import android.database.Cursor;
|
|||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v4.app.ActivityCompat;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v4.widget.SwipeRefreshLayout;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.core.app.ActivityCompat;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||
import android.util.Log;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
|
@ -49,7 +49,6 @@ import java.util.List;
|
|||
|
||||
import es.ugr.swad.swadroid.Constants;
|
||||
import es.ugr.swad.swadroid.R;
|
||||
import es.ugr.swad.swadroid.analytics.SWADroidTracker;
|
||||
import es.ugr.swad.swadroid.database.DataBaseHelper;
|
||||
import es.ugr.swad.swadroid.gui.DialogFactory;
|
||||
import es.ugr.swad.swadroid.gui.MenuExpandableListActivity;
|
||||
|
@ -75,7 +74,7 @@ public class UsersActivity extends MenuExpandableListActivity implements
|
|||
/**
|
||||
* ListView of users
|
||||
*/
|
||||
private static ListView lvUsers;
|
||||
private ListView lvUsers;
|
||||
/**
|
||||
* Adapter for ListView of users
|
||||
*/
|
||||
|
@ -106,6 +105,16 @@ public class UsersActivity extends MenuExpandableListActivity implements
|
|||
*/
|
||||
private IntentIntegrator integrator;
|
||||
|
||||
/**
|
||||
* Button for send attendances to SWAD
|
||||
*/
|
||||
private MenuItem mSendUsersMenuItem;
|
||||
|
||||
/**
|
||||
* Button for clear all users for an event
|
||||
*/
|
||||
private MenuItem mCleanUsersMenuItem;
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see es.ugr.swad.swadroid.MenuExpandableListActivity#onCreate(android.os.Bundle)
|
||||
*/
|
||||
|
@ -114,14 +123,14 @@ public class UsersActivity extends MenuExpandableListActivity implements
|
|||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.list_items_pulltorefresh);
|
||||
|
||||
refreshLayout = (SwipeRefreshLayout) findViewById(R.id.swipe_container_list);
|
||||
emptyUsersTextView = (TextView) findViewById(R.id.list_item_title);
|
||||
refreshLayout = findViewById(R.id.swipe_container_list);
|
||||
emptyUsersTextView = findViewById(R.id.list_item_title);
|
||||
|
||||
View mProgressScreenView = findViewById(R.id.progress_screen);
|
||||
mProgressScreen = new ProgressScreen(mProgressScreenView, refreshLayout,
|
||||
getString(R.string.loadingMsg), this);
|
||||
|
||||
lvUsers = (ListView) findViewById(R.id.list_pulltorefresh);
|
||||
lvUsers = findViewById(R.id.list_pulltorefresh);
|
||||
|
||||
lvUsers.setOnScrollListener(new AbsListView.OnScrollListener() {
|
||||
@Override
|
||||
|
@ -158,7 +167,6 @@ public class UsersActivity extends MenuExpandableListActivity implements
|
|||
@Override
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
SWADroidTracker.sendScreenView(getApplicationContext(), TAG);
|
||||
|
||||
//Refresh ListView of users
|
||||
refreshAdapter();
|
||||
|
@ -167,6 +175,9 @@ public class UsersActivity extends MenuExpandableListActivity implements
|
|||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
|
||||
refreshAdapter();
|
||||
setActionMenuItemsEnabled(true);
|
||||
|
||||
super.onActivityResult(requestCode, resultCode, intent);
|
||||
}
|
||||
|
||||
private void refreshAdapter() {
|
||||
|
@ -245,39 +256,50 @@ public class UsersActivity extends MenuExpandableListActivity implements
|
|||
*/
|
||||
@Override
|
||||
public void onRefresh() {
|
||||
setActionMenuItemsEnabled(false);
|
||||
showSwipeProgress();
|
||||
|
||||
refreshUsers();
|
||||
|
||||
hideSwipeProgress();
|
||||
setActionMenuItemsEnabled(true);
|
||||
}
|
||||
|
||||
private String getUsersCodes() {
|
||||
String usersCodes = "";
|
||||
StringBuilder usersCodes = new StringBuilder();
|
||||
List<UserAttendance> usersList = dbHelper.getUsersEvent(eventCode);
|
||||
|
||||
//Concatenate the user code of all users checked as present and separate them with commas
|
||||
for(UserAttendance user : usersList) {
|
||||
if(user.isUserPresent()) {
|
||||
usersCodes += user.getId() + ",";
|
||||
usersCodes.append(user.getId()).append(",");
|
||||
}
|
||||
}
|
||||
|
||||
//Remove final comma
|
||||
if(!usersCodes.isEmpty()) {
|
||||
usersCodes = usersCodes.substring(0, usersCodes.length()-1);
|
||||
if(usersCodes.length() > 0) {
|
||||
usersCodes = new StringBuilder(usersCodes.substring(0, usersCodes.length() - 1));
|
||||
}
|
||||
|
||||
return usersCodes;
|
||||
return usersCodes.toString();
|
||||
}
|
||||
|
||||
private void scanQRCode() {
|
||||
integrator.initiateScan();
|
||||
}
|
||||
|
||||
private void setActionMenuItemsEnabled(boolean enabled) {
|
||||
mSendUsersMenuItem.setEnabled(enabled);
|
||||
mCleanUsersMenuItem.setEnabled(enabled);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
getMenuInflater().inflate(R.menu.rollcall_activity_actions, menu);
|
||||
|
||||
mSendUsersMenuItem = menu.findItem(R.id.action_sendMsg);
|
||||
mCleanUsersMenuItem = menu.findItem(R.id.action_cleanUsers);
|
||||
|
||||
return super.onCreateOptionsMenu(menu);
|
||||
}
|
||||
|
||||
|
@ -298,12 +320,14 @@ public class UsersActivity extends MenuExpandableListActivity implements
|
|||
}
|
||||
} else {
|
||||
//If the device has no rear camera available show error message
|
||||
error(getString(R.string.noCameraFound), null, false);
|
||||
error(getString(R.string.noCameraFound), null);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
case R.id.action_sendMsg:
|
||||
setActionMenuItemsEnabled(false);
|
||||
|
||||
String usersCodes = getUsersCodes();
|
||||
|
||||
Intent activity = new Intent(getApplicationContext(),
|
||||
|
@ -320,6 +344,8 @@ public class UsersActivity extends MenuExpandableListActivity implements
|
|||
return true;
|
||||
|
||||
case R.id.action_cleanUsers:
|
||||
setActionMenuItemsEnabled(false);
|
||||
|
||||
AlertDialog cleanDBDialog = DialogFactory.createWarningDialog(this,
|
||||
-1,
|
||||
R.string.areYouSure,
|
||||
|
@ -360,7 +386,7 @@ public class UsersActivity extends MenuExpandableListActivity implements
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onRequestPermissionsResult(int requestCode, @NonNull String permissions[],
|
||||
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions,
|
||||
@NonNull int[] grantResults) {
|
||||
switch (requestCode) {
|
||||
case Constants.PERMISSIONS_REQUEST_CAMERA: {
|
||||
|
|
|
@ -108,7 +108,7 @@ public class UsersCursorAdapter extends CursorAdapter {
|
|||
String userFirstname = crypto.decrypt(cursor.getString(cursor.getColumnIndex("userFirstname")));
|
||||
String userID = crypto.decrypt(cursor.getString(cursor.getColumnIndex("userID")));
|
||||
final long userCode = cursor.getLong(cursor.getColumnIndex("userCode"));
|
||||
String userPhoto = cursor.getString(cursor.getColumnIndex("photoPath"));
|
||||
String userPhoto = crypto.decrypt(cursor.getString(cursor.getColumnIndex("photoPath")));
|
||||
boolean present = Utils.parseIntBool(cursor.getInt(cursor.getColumnIndex("present")));
|
||||
|
||||
// Replace NULL value for strings returned by the webservice with the empty string
|
||||
|
@ -127,10 +127,10 @@ public class UsersCursorAdapter extends CursorAdapter {
|
|||
final ViewHolder holder = (ViewHolder) view.getTag();
|
||||
view.setTag(holder);
|
||||
|
||||
holder.image = (ImageView) view.findViewById(R.id.imageView1);
|
||||
holder.text1 = (TextView) view.findViewById(R.id.TextView1);
|
||||
holder.text2 = (TextView) view.findViewById(R.id.TextView2);
|
||||
holder.checkbox = (CheckBox) view.findViewById(R.id.check);
|
||||
holder.image = view.findViewById(R.id.imageView1);
|
||||
holder.text1 = view.findViewById(R.id.TextView1);
|
||||
holder.text2 = view.findViewById(R.id.TextView2);
|
||||
holder.checkbox = view.findViewById(R.id.check);
|
||||
|
||||
holder.checkbox.setChecked(present);
|
||||
holder.checkbox.setOnClickListener(new View.OnClickListener() {
|
||||
|
@ -152,12 +152,13 @@ public class UsersCursorAdapter extends CursorAdapter {
|
|||
}
|
||||
});
|
||||
|
||||
holder.image.setImageResource(R.drawable.usr_bl);
|
||||
if(userPhoto != null) {
|
||||
ImageFactory.displayImage(loader, crypto.decrypt(userPhoto), holder.image);
|
||||
if((userPhoto != null) && !userPhoto.isEmpty()) {
|
||||
ImageFactory.displayImage(loader, userPhoto, holder.image);
|
||||
} else {
|
||||
holder.image.setImageResource(R.drawable.usr_bl);
|
||||
}
|
||||
|
||||
holder.text1.setText(userSurname1 + " " + userSurname2 + ", " + userFirstname);
|
||||
holder.text1.setText(String.format("%s %s, %s", userSurname1, userSurname2, userFirstname));
|
||||
holder.text2.setText(userID);
|
||||
}
|
||||
|
||||
|
@ -166,10 +167,10 @@ public class UsersCursorAdapter extends CursorAdapter {
|
|||
View view = inflater.inflate(R.layout.users_list_item, parent, false);
|
||||
ViewHolder holder = new ViewHolder();
|
||||
|
||||
holder.image = (ImageView) view.findViewById(R.id.imageView1);
|
||||
holder.text1 = (TextView) view.findViewById(R.id.TextView1);
|
||||
holder.text2 = (TextView) view.findViewById(R.id.TextView2);
|
||||
holder.checkbox = (CheckBox) view.findViewById(R.id.check);
|
||||
holder.image = view.findViewById(R.id.imageView1);
|
||||
holder.text1 = view.findViewById(R.id.TextView1);
|
||||
holder.text2 = view.findViewById(R.id.TextView2);
|
||||
holder.checkbox = view.findViewById(R.id.check);
|
||||
view.setTag(holder);
|
||||
|
||||
return view;
|
||||
|
|
|
@ -81,7 +81,7 @@ public class UsersDownload extends Module {
|
|||
runConnection();
|
||||
} catch (Exception e) {
|
||||
String errorMsg = getString(R.string.errorServerResponseMsg);
|
||||
error(errorMsg, e, true);
|
||||
error(errorMsg, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -122,7 +122,7 @@ public class UsersDownload extends Module {
|
|||
if (userSurname1.equalsIgnoreCase(Constants.NULL_VALUE)) userSurname1 = "";
|
||||
if (userSurname2.equalsIgnoreCase(Constants.NULL_VALUE)) userSurname2 = "";
|
||||
if (userFirstname.equalsIgnoreCase(Constants.NULL_VALUE)) userFirstname = "";
|
||||
if (userPhoto.equalsIgnoreCase(Constants.NULL_VALUE)) userPhoto = null;
|
||||
if (userPhoto.equalsIgnoreCase(Constants.NULL_VALUE)) userPhoto = "";
|
||||
|
||||
//Inserts user data into database
|
||||
dbHelper.insertUser(new User(userCode, null, userID, userNickname, userSurname1, userSurname2,
|
||||
|
@ -153,7 +153,7 @@ public class UsersDownload extends Module {
|
|||
if (numUsers == 0) {
|
||||
Toast.makeText(this, R.string.noUsersAvailableMsg, Toast.LENGTH_LONG).show();
|
||||
} else {
|
||||
String msg = String.valueOf(numUsers) + " " + getResources().getString(R.string.usersUpdated);
|
||||
String msg = numUsers + " " + getResources().getString(R.string.usersUpdated);
|
||||
Toast.makeText(this, msg, Toast.LENGTH_LONG).show();
|
||||
}
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@ public class UsersSend extends Module {
|
|||
runConnection();
|
||||
} catch (Exception e) {
|
||||
String errorMsg = getString(R.string.errorServerResponseMsg);
|
||||
error(errorMsg, e, true);
|
||||
error(errorMsg, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ package es.ugr.swad.swadroid.modules.tests;
|
|||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
|
|
|
@ -30,7 +30,6 @@ import java.util.List;
|
|||
|
||||
import es.ugr.swad.swadroid.Constants;
|
||||
import es.ugr.swad.swadroid.R;
|
||||
import es.ugr.swad.swadroid.analytics.SWADroidTracker;
|
||||
import es.ugr.swad.swadroid.gui.ImageListItem;
|
||||
import es.ugr.swad.swadroid.gui.MenuActivity;
|
||||
import es.ugr.swad.swadroid.gui.ProgressScreen;
|
||||
|
@ -71,8 +70,6 @@ public class Tests extends MenuActivity implements OnItemClickListener {
|
|||
mProgressScreen = new ProgressScreen(mProgressScreenView, mTestsMenuLayoutView,
|
||||
getString(R.string.syncronizingMsg), this);
|
||||
|
||||
SWADroidTracker.sendScreenView(getApplicationContext(), TAG);
|
||||
|
||||
for (int i = 0; i < titles.length; i++) {
|
||||
ImageListItem item = new ImageListItem(images[i], titles[i]);
|
||||
imageListItems.add(item);
|
||||
|
|
|
@ -81,7 +81,7 @@ public class TestsConfigDownload extends Module {
|
|||
runConnection();
|
||||
} catch (Exception e) {
|
||||
String errorMsg = getString(R.string.errorServerResponseMsg);
|
||||
error(errorMsg, e, true);
|
||||
error(errorMsg, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -23,8 +23,8 @@ import android.database.Cursor;
|
|||
import android.graphics.Color;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v4.view.MenuItemCompat;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.core.view.MenuItemCompat;
|
||||
import android.text.InputType;
|
||||
import android.util.Log;
|
||||
import android.util.SparseBooleanArray;
|
||||
|
@ -51,7 +51,6 @@ import java.util.List;
|
|||
|
||||
import es.ugr.swad.swadroid.Constants;
|
||||
import es.ugr.swad.swadroid.R;
|
||||
import es.ugr.swad.swadroid.analytics.SWADroidTracker;
|
||||
import es.ugr.swad.swadroid.database.DataBaseHelper;
|
||||
import es.ugr.swad.swadroid.gui.MenuActivity;
|
||||
import es.ugr.swad.swadroid.gui.WebViewFactory;
|
||||
|
@ -152,8 +151,6 @@ public class TestsMake extends MenuActivity {
|
|||
numberPicker.setMinValue(test.getMin());
|
||||
numberPicker.setValue(test.getDef());
|
||||
numberPicker.setVisibility(View.VISIBLE);
|
||||
|
||||
SWADroidTracker.sendScreenView(getApplicationContext(), TAG + " NumQuestions");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -214,8 +211,6 @@ public class TestsMake extends MenuActivity {
|
|||
checkBoxesList.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
|
||||
checkBoxesList.setOnItemClickListener(tagsAnswersTypeItemClickListener);
|
||||
checkBoxesList.setDividerHeight(0);
|
||||
|
||||
SWADroidTracker.sendScreenView(getApplicationContext(), TAG + " Tags");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -275,8 +270,6 @@ public class TestsMake extends MenuActivity {
|
|||
checkBoxesList.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
|
||||
checkBoxesList.setOnItemClickListener(tagsAnswersTypeItemClickListener);
|
||||
checkBoxesList.setDividerHeight(0);
|
||||
|
||||
SWADroidTracker.sendScreenView(getApplicationContext(), TAG + " AnswerTypes");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -632,8 +625,6 @@ public class TestsMake extends MenuActivity {
|
|||
});
|
||||
|
||||
showQuestion(0);
|
||||
|
||||
SWADroidTracker.sendScreenView(getApplicationContext(), TAG + " Question");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -658,8 +649,6 @@ public class TestsMake extends MenuActivity {
|
|||
//Shows the test
|
||||
showTest();
|
||||
} else {
|
||||
SWADroidTracker.sendScreenView(getApplicationContext(), TAG + " No questions criteria");
|
||||
|
||||
Toast.makeText(this, R.string.testNoQuestionsMeetsSpecifiedCriteriaMsg, Toast.LENGTH_LONG).show();
|
||||
finish();
|
||||
}
|
||||
|
@ -701,8 +690,6 @@ public class TestsMake extends MenuActivity {
|
|||
} else {
|
||||
textView = (TextView) findViewById(R.id.testResultsText);
|
||||
textView.setText(R.string.testNoResultsMsg);
|
||||
|
||||
SWADroidTracker.sendScreenView(getApplicationContext(), TAG + " Feedback " + Test.FEEDBACK_NONE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -794,8 +781,6 @@ public class TestsMake extends MenuActivity {
|
|||
if (test != null) {
|
||||
selectNumQuestions();
|
||||
} else {
|
||||
SWADroidTracker.sendScreenView(getApplicationContext(), TAG + " No questions");
|
||||
|
||||
Toast.makeText(this, R.string.testNoQuestionsCourseMsg, Toast.LENGTH_LONG).show();
|
||||
finish();
|
||||
}
|
||||
|
@ -845,7 +830,6 @@ public class TestsMake extends MenuActivity {
|
|||
return true;
|
||||
case R.id.action_show_details:
|
||||
if (test.getFeedback().equals(Test.FEEDBACK_MIN)) {
|
||||
SWADroidTracker.sendScreenView(getApplicationContext(), TAG + " Feedback " + Test.FEEDBACK_MIN);
|
||||
Toast.makeText(this, R.string.testNoDetailsMsg, Toast.LENGTH_LONG).show();
|
||||
} else {
|
||||
//Show totals button only
|
||||
|
|
|
@ -32,7 +32,6 @@ import java.security.NoSuchAlgorithmException;
|
|||
import java.util.List;
|
||||
|
||||
import es.ugr.swad.swadroid.Constants;
|
||||
import es.ugr.swad.swadroid.analytics.SWADroidTracker;
|
||||
import es.ugr.swad.swadroid.database.DataBaseHelper;
|
||||
import es.ugr.swad.swadroid.model.LoginInfo;
|
||||
import es.ugr.swad.swadroid.modules.courses.Courses;
|
||||
|
@ -158,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
|
||||
|
@ -186,7 +192,6 @@ public class Preferences {
|
|||
dbHelper = new DataBaseHelper(ctx);
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, e.getMessage());
|
||||
SWADroidTracker.sendException(ctx, e, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -467,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();
|
||||
}
|
||||
|
||||
}
|
|
@ -24,7 +24,7 @@ import android.content.Context;
|
|||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.PackageManager.NameNotFoundException;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.preference.CheckBoxPreference;
|
||||
|
@ -33,12 +33,11 @@ import android.preference.Preference.OnPreferenceChangeListener;
|
|||
import android.preference.Preference.OnPreferenceClickListener;
|
||||
import android.preference.PreferenceActivity;
|
||||
import android.preference.PreferenceScreen;
|
||||
import android.provider.Settings;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.google.firebase.analytics.FirebaseAnalytics;
|
||||
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
|
@ -46,13 +45,11 @@ import java.util.List;
|
|||
|
||||
import es.ugr.swad.swadroid.Constants;
|
||||
import es.ugr.swad.swadroid.R;
|
||||
import es.ugr.swad.swadroid.analytics.SWADroidTracker;
|
||||
import es.ugr.swad.swadroid.gui.DialogFactory;
|
||||
import es.ugr.swad.swadroid.modules.login.Login;
|
||||
import es.ugr.swad.swadroid.modules.login.LoginActivity;
|
||||
import es.ugr.swad.swadroid.sync.SyncUtils;
|
||||
import es.ugr.swad.swadroid.utils.Crypto;
|
||||
import es.ugr.swad.swadroid.utils.NotificationUtils;
|
||||
import es.ugr.swad.swadroid.utils.Utils;
|
||||
|
||||
/**
|
||||
|
@ -65,6 +62,10 @@ public class PreferencesActivity extends PreferenceActivity implements OnPrefere
|
|||
* PreferencesActivity tag name for Logcat
|
||||
*/
|
||||
private static final String TAG = Constants.APP_TAG + " PreferencesActivity";
|
||||
/**
|
||||
* Obtain Firebase Analytics instance
|
||||
*/
|
||||
protected FirebaseAnalytics mFirebaseAnalytics = FirebaseAnalytics.getInstance(this);
|
||||
/**
|
||||
* Application context
|
||||
*/
|
||||
|
@ -130,30 +131,29 @@ public class PreferencesActivity extends PreferenceActivity implements OnPrefere
|
|||
* Synchronization preferences changed flag
|
||||
*/
|
||||
private boolean syncPrefsChanged = false;
|
||||
|
||||
/**
|
||||
* SWAD server to use
|
||||
*/
|
||||
//private String mServer;
|
||||
|
||||
/**
|
||||
* User password preference changed flag
|
||||
*/
|
||||
private boolean userPasswordPrefChanged = false;
|
||||
|
||||
/**
|
||||
* Synchronization time preference for location
|
||||
*/
|
||||
private static Preference syncTimeLocationPref;
|
||||
|
||||
/**
|
||||
* Shows an error message.
|
||||
*
|
||||
* @param message Error message to show.
|
||||
*/
|
||||
private void error(String message, Exception ex, boolean sendException) {
|
||||
private void error(String message, Exception ex) {
|
||||
DialogInterface.OnClickListener onClickListener = new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
finish();
|
||||
}
|
||||
};
|
||||
|
||||
AlertDialog errorDialog = DialogFactory.createErrorDialog(this, TAG, message, ex, sendException,
|
||||
AlertDialog errorDialog = DialogFactory.createErrorDialog(this, TAG, message, ex,
|
||||
isDebuggable, onClickListener);
|
||||
|
||||
errorDialog.show();
|
||||
|
@ -178,7 +178,7 @@ public class PreferencesActivity extends PreferenceActivity implements OnPrefere
|
|||
getPackageName(), 0);
|
||||
isDebuggable = (ApplicationInfo.FLAG_DEBUGGABLE != 0);
|
||||
} catch (Exception ex) {
|
||||
error(ex.getMessage(), ex, true);
|
||||
error(ex.getMessage(), ex);
|
||||
}
|
||||
|
||||
logOutPref = findPreference(Preferences.LOGOUTPREF);
|
||||
|
@ -193,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);
|
||||
|
@ -204,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
|
||||
|
@ -304,6 +306,12 @@ public class PreferencesActivity extends PreferenceActivity implements OnPrefere
|
|||
sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, getString(R.string.app_name));
|
||||
sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, getString(R.string.shareBodyMsg));
|
||||
startActivity(Intent.createChooser(sharingIntent, getString(R.string.shareTitle_menu)));
|
||||
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString(FirebaseAnalytics.Param.ITEM_ID, "1");
|
||||
bundle.putString(FirebaseAnalytics.Param.CONTENT_TYPE, "text");
|
||||
mFirebaseAnalytics.logEvent(FirebaseAnalytics.Event.SHARE, bundle);
|
||||
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
@ -319,11 +327,11 @@ public class PreferencesActivity extends PreferenceActivity implements OnPrefere
|
|||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
try {
|
||||
currentVersionPref.setSummary(getPackageManager().getPackageInfo(getPackageName(), 0).versionName);
|
||||
} catch (NameNotFoundException e) {
|
||||
SWADroidTracker.sendException(getApplicationContext(), e, false);
|
||||
} catch (PackageManager.NameNotFoundException ex) {
|
||||
error(ex.getMessage(), ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -369,14 +377,14 @@ public class PreferencesActivity extends PreferenceActivity implements OnPrefere
|
|||
}
|
||||
|
||||
} catch (NoSuchAlgorithmException ex) {
|
||||
error(ex.getMessage(), ex, true);
|
||||
error(ex.getMessage(), ex);
|
||||
}
|
||||
} else if(Preferences.SYNCENABLEPREF.equals(key)) {
|
||||
boolean syncEnabled = (Boolean) newValue;
|
||||
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();
|
||||
|
||||
|
@ -402,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;
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
package es.ugr.swad.swadroid.utils;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
|
@ -34,7 +35,6 @@ import javax.crypto.spec.PBEKeySpec;
|
|||
import javax.crypto.spec.PBEParameterSpec;
|
||||
|
||||
import es.ugr.swad.swadroid.Constants;
|
||||
import es.ugr.swad.swadroid.analytics.SWADroidTracker;
|
||||
|
||||
/**
|
||||
* Cryptographic class for encryption purposes.
|
||||
|
@ -80,8 +80,7 @@ public class Crypto {
|
|||
ecipher.init(Cipher.ENCRYPT_MODE, key, paramSpec);
|
||||
dcipher.init(Cipher.DECRYPT_MODE, key, paramSpec);
|
||||
} catch (Exception e) {
|
||||
//Send exception details to Google Analytics
|
||||
SWADroidTracker.sendException(mContext, e, false);
|
||||
Log.e(TAG, e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -99,8 +98,7 @@ public class Crypto {
|
|||
} catch (Exception e) {
|
||||
rVal = "Error encrypting: " + e.getMessage();
|
||||
|
||||
//Send exception details to Google Analytics
|
||||
SWADroidTracker.sendException(mContext, e, false);
|
||||
Log.e(TAG, e.getMessage());
|
||||
}
|
||||
return rVal;
|
||||
}
|
||||
|
@ -119,8 +117,7 @@ public class Crypto {
|
|||
} catch (Exception e) {
|
||||
rVal = "Error encrypting: " + e.getMessage();
|
||||
|
||||
//Send exception details to Google Analytics
|
||||
SWADroidTracker.sendException(mContext, e, false);
|
||||
Log.e(TAG, e.getMessage());
|
||||
}
|
||||
return rVal;
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
package es.ugr.swad.swadroid.utils;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
import java.security.MessageDigest;
|
||||
import java.security.SecureRandom;
|
||||
|
@ -30,7 +31,6 @@ import javax.crypto.SecretKey;
|
|||
import javax.crypto.spec.SecretKeySpec;
|
||||
|
||||
import es.ugr.swad.swadroid.Constants;
|
||||
import es.ugr.swad.swadroid.analytics.SWADroidTracker;
|
||||
|
||||
/**
|
||||
* Cryptographic class for encryption purposes.
|
||||
|
@ -49,8 +49,7 @@ public class OldCrypto {
|
|||
byte[] result = encrypt(rawKey, cleartext.getBytes("UTF-8"));
|
||||
return Base64.encodeBytes(result);
|
||||
} catch (Exception e) {
|
||||
//Send exception details to Google Analytics
|
||||
SWADroidTracker.sendException(ctx, e, false);
|
||||
Log.e(TAG, e.getMessage());
|
||||
}
|
||||
return "error";
|
||||
}
|
||||
|
@ -62,8 +61,7 @@ public class OldCrypto {
|
|||
byte[] result = decrypt(rawKey, enc);
|
||||
return new String(result, "UTF-8");
|
||||
} catch (Exception e) {
|
||||
//Send exception details to Google Analytics
|
||||
SWADroidTracker.sendException(ctx, e, false);
|
||||
Log.e(TAG, e.getMessage());
|
||||
}
|
||||
return "error";
|
||||
}
|
||||
|
@ -107,8 +105,7 @@ public class OldCrypto {
|
|||
}
|
||||
return hexString.toString();
|
||||
} catch (Exception e) {
|
||||
//Send exception details to Google Analytics
|
||||
SWADroidTracker.sendException(ctx, e, false);
|
||||
Log.e(TAG, e.getMessage());
|
||||
}
|
||||
return "error";
|
||||
}
|
||||
|
|
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 |