Merge branch 'release/1.5.6'

This commit is contained in:
Amab 2019-11-05 21:02:32 +01:00
commit 0fc0c9e42e
11 changed files with 296 additions and 247 deletions

View File

@ -4,9 +4,10 @@ jdk: oraclejdk8
env:
global:
- ANDROID_API=29
- ANDROID_BUILD_TOOLS=29.0.0
- ANDROID_BUILD_TOOLS=29.0.2
- secure: eY3bGKw4jZ+HHkkMBZHiL2dhcz+RJYHib0WC77SSVHLJcCg63pBvs420i4rjNQHycMs+PhRSlR79jdglDTm8svphhRjSts6VMkHDxObwJIyLF8vAZ0PfjhqfOXO+4+Fx6pRIjwM7cBMOQrDfSimJHRB+z/f2AJfUIsaMSlltGVya7nmrLY/fO4dtl4wPnejslj3mhnBAxr+a2Or978RwI2TMpxBovHZKFT/46wJTcMzKXGdXU64M8nmQmpcKHeIKIBiR4g+A2tahC+Us4tFxxoTDd3R+IAzj7Gvjd5JuMlYmQ3quRv2M08u9OJNiT14LpDXy19fZKdw/QNHg3S8JVis8kJDkv6z4HyZXTIBgISZpCZZti04GP29Lj+1f4ISRFc6uxankDuRgfX8ucsxoEPJVq3PfJlpTdP7wjlQtEGv0HF/3MNNyruNbLHFiCgHOANwEOX44INtw6XylPEftmw4y4ptntFG3VXyV1Zi+732Qe4b2QNTbvLPrsmkCRKzo59vKKAzBBhvYvFVITcWbySqdx9/n1H25SRL2Q96nPGQSQyBF6obzzFcjMKkknPle1PXvAfb171964cdIK6/zo9rh/ZCL3+gAKZibmGWvbeztWYl5ON8B8x8mgLO/qgPIotY+aqwmsY06pKrqi6adYZacMF+UgtbLJlhnird6ugk=
- secure: EmcSyXk/5pEJhbRX9DSFzhQGYvGaYdxjDuQwmLuxUGitGpFQZbWexTAK/l0LLcIRsiSmucY7KJgOpL7I6odh2kVUZedarj8/5K1P69ljDDB7bfG8jyOLZvHJ1JTZRuKvUnT846zQwQWTnLXF9N4LaQ86FVqSW2bGHqptIivEjDEVh78V3g4PDsbX5aQ5LjTlSn7bezu9chpVS0fnRlqjAa6U2kUwUt+DDaSHEOs35Z89jT7JoonGFrMsyA7S26CQhOBYE3w76AllIea+MWzPJX3V364ZIzPBnQAkCz02oVI3n+LHZkzUCYHkY8DXWXNy6+/sulFa6L1v6bt8DzF1vwJ+nTNVqmqSDYBe2s1qAUZ+4o8l/THMndxC11LjbbEExG4ekBRFvRsOOf0pBps3Yr4ry27gaj4+9Ap2JCKKOQwm0izh48AJiy0Y8pzIzTO5wB5B7a4czLJmzaNWkPVXw4lKg2ldJ4sd6EBqUZqG2vRmN6VwHb8gHFNaQTH3feBRhYTpkv1wWUuhvclNn5yoZzcSxMT/b8d89e5DahoBYMW48c6jb5wL/EoY3bHp3mjtnTW8oIIjyZK8FjYX+8IqeEoue8bDDqNUN71xmRvp+0CX1iXnfgUeDWnYhXHTewOlJu6i509wGrZPxYjgwAdnpfTyGXPq7Vin9CkNHMw9fbA=
- secure: WS7Jgz0L0aMEZmg4/HxPb9nO7oER9z23n8n508UVQ0DyKL92UPhfVol7+Cob8zuO5SJl5TPOh58gd/C0Prq8t5q3mwlDA9buhnb1uef7pwZOFzQOF0o8RuPSpxLgu8tFlDooWrG9oxZObXwh84TXGX7zgoiWr9Y318qsQSHCiv9Ue9kgJxkjk9wVanJws7zHWAevfFzyoEvqtkDTqNie4RJbMEOdeX+TyUpc77Si2UpAC23Mpl8q+qZr32cgxk3MzSdhJk2C3Vz5MS6LBZ7ynyv+em+/vz2RBlFLetrcknHY8lgE060itWcns6Pj/8tv2SQbJptVFToXbfay/EVleApojHG4w5DFDzQt8a3Az0lBnqOxv3BiAPRcr49/A08qXAKh30p6YBiSvVd8zK+MZoMoj2dDQhdXb72nv0yHZmzkiaQEOGnsBD4Gt3epn/KoJke3W0ffBZOfJNScACW0Gta2XLImZsekb4sjfOF84HrISSMiXunlLpgtcC4C3Pn9VV/6+uciIMqMFDYkJMe2gyRNA2vSyZ61n/ioTLOHYzhYHjZUXB4MOlonYTiFuF4HmVVHO2J9CpOdFFP7hrkWK3HzvcQm9k8dxUkuKDoOlRb+CSlrEZO24V+TaY2DDr1bcitA77VJp90Cz2RpLC3tvSvThgY2VNk+OEbeSrP5DNA=
before_cache:
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
- rm -rf $HOME/.gradle/caches/*/plugin-resolution/
@ -17,8 +18,8 @@ cache:
- "$HOME/.android/build-cache"
before_install:
- openssl aes-256-cbc -K $encrypted_b7f76037f2f7_key -iv $encrypted_b7f76037f2f7_iv
-in $TRAVIS_BUILD_DIR/SWADroid/src/prod/google-services.json.enc
-out $TRAVIS_BUILD_DIR/SWADroid/src/prod/google-services.json -d
-in $TRAVIS_BUILD_DIR/SWADroid/src/prod/google-services.json.enc -out $TRAVIS_BUILD_DIR/SWADroid/src/prod/google-services.json
-d
- yes | sdkmanager "build-tools;${ANDROID_BUILD_TOOLS}"
- yes | sdkmanager "platform-tools"
- yes | sdkmanager "tools"

View File

@ -5,15 +5,21 @@ 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)
[![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)
[![codecov](https://codecov.io/gh/Amab/SWADroid/branch/develop/graph/badge.svg)](https://codecov.io/gh/Amab/SWADroid)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/41ded03ee87d4ceaaafc976a7529bcf3)](https://www.codacy.com/manual/Amab/SWADroid?utm_source=github.com&utm_medium=referral&utm_content=Amab/SWADroid&utm_campaign=Badge_Grade)
Copyright and License
---------------------

View File

@ -45,7 +45,7 @@ if (build_param != "prod") {
android {
compileSdkVersion "android-29"
buildToolsVersion '29.0.0'
buildToolsVersion '29.0.2'
dexOptions {
maxProcessCount=2
@ -61,7 +61,7 @@ android {
versionCode gitVersionCode
versionName gitVersionName
minSdkVersion 16
minSdkVersion 24
targetSdkVersion 29
testApplicationId "es.ugr.swad.swadroid.test"
@ -80,12 +80,12 @@ android {
dependencies {
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'com.google.code.ksoap2-android:ksoap2-android:3.6.4'
implementation 'commons-io:commons-io:2.6'
implementation 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
implementation 'com.journeyapps:zxing-android-embedded:3.6.0@aar'
implementation 'com.google.zxing:core:3.3.3'
implementation 'com.google.code.gson:gson:2.8.5'
implementation 'com.google.firebase:firebase-core:17.0.0'
implementation 'com.journeyapps:zxing-android-embedded:4.0.2@aar'
implementation 'com.google.zxing:core:3.4.0'
implementation 'com.google.code.gson:gson:2.8.6'
implementation 'com.google.firebase:firebase-core:17.2.1'
}

View File

@ -50,196 +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();
//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();
@ -249,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);
}
}
}

View File

@ -74,7 +74,7 @@ public class UsersActivity extends MenuExpandableListActivity implements
/**
* ListView of users
*/
private static ListView lvUsers;
private ListView lvUsers;
/**
* Adapter for ListView of users
*/
@ -105,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)
*/
@ -113,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
@ -165,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() {
@ -243,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);
}
@ -302,6 +326,8 @@ public class UsersActivity extends MenuExpandableListActivity implements
return true;
case R.id.action_sendMsg:
setActionMenuItemsEnabled(false);
String usersCodes = getUsersCodes();
Intent activity = new Intent(getApplicationContext(),
@ -318,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,
@ -358,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: {

View File

@ -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;

View File

@ -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();
}

View File

@ -14,6 +14,12 @@
</style>
</head>
<body bgcolor="white">
<h4>1.5.6 (2019-11-05)</h4>
<ul>
<li type="disc"><strong>Pasar lista:</strong> Corregida ejecución simultánea de varios envíos de la lista de asistencia</li>
</ul>
<body bgcolor="white">
<h4>1.5.5 (2019-07-08)</h4>
<ul>

View File

@ -14,6 +14,12 @@
</style>
</head>
<body bgcolor="white">
<h4>1.5.6 (2019-11-05)</h4>
<ul>
<li type="disc"><strong>Rollcall:</strong> Fixed SWADroid allows multiple simultaneous submissions of the attendance list</li>
</ul>
<body bgcolor="white">
<h4>1.5.5 (2019-07-08)</h4>
<ul>

View File

@ -5,9 +5,9 @@ buildscript {
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.1'
classpath 'com.android.tools.build:gradle:3.5.2'
classpath 'org.ajoberstar:grgit:2.1.1'
classpath 'com.google.gms:google-services:4.2.0'
classpath 'com.google.gms:google-services:4.3.2'
}
}

View File

@ -1,6 +1,6 @@
#Fri Apr 19 12:17:14 CEST 2019
#Tue Aug 20 19:44:44 CEST 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.3-all.zip