Merge branch 'release/1.5.3'
This commit is contained in:
commit
1159e29216
|
@ -6,8 +6,8 @@ android:
|
|||
- tools
|
||||
- tools
|
||||
- platform-tools
|
||||
- build-tools-25.0.2
|
||||
- android-25
|
||||
- build-tools-26.0.0
|
||||
- android-26
|
||||
- extra-android-m2repository
|
||||
- extra-android-support
|
||||
- extra-google-m2repository
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
<content url="file://$MODULE_DIR$">
|
||||
<excludeFolder url="file://$MODULE_DIR$/.gradle" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="jdk" jdkName="1.8" jdkType="JavaSDK" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
|
@ -9,8 +9,8 @@ ext {
|
|||
}
|
||||
|
||||
android {
|
||||
compileSdkVersion 25
|
||||
buildToolsVersion "25.0.2"
|
||||
compileSdkVersion 26
|
||||
buildToolsVersion "26.0.2"
|
||||
|
||||
dexOptions {
|
||||
maxProcessCount=2
|
||||
|
@ -26,8 +26,8 @@ android {
|
|||
versionCode gitVersionCode
|
||||
versionName gitVersionName
|
||||
|
||||
minSdkVersion 9
|
||||
targetSdkVersion 25
|
||||
minSdkVersion 14
|
||||
targetSdkVersion 26
|
||||
|
||||
android.applicationVariants.all { variant ->
|
||||
def appName
|
||||
|
@ -77,13 +77,13 @@ def getBuildConfigField(String property){
|
|||
}
|
||||
|
||||
dependencies {
|
||||
compile 'com.android.support:support-v4:25.1.1'
|
||||
compile 'com.android.support:appcompat-v7:25.1.1'
|
||||
compile 'com.google.android.gms:play-services-analytics:10.0.1'
|
||||
compile 'com.android.support:support-v4:26.0.0'
|
||||
compile 'com.android.support:appcompat-v7:26.0.0'
|
||||
compile 'com.google.android.gms:play-services-analytics:11.0.4'
|
||||
compile 'com.google.code.ksoap2-android:ksoap2-android:3.6.2'
|
||||
compile 'commons-io:commons-io:2.5'
|
||||
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
|
||||
compile 'com.journeyapps:zxing-android-embedded:3.2.0@aar'
|
||||
compile 'com.google.zxing:core:3.2.1'
|
||||
compile 'com.google.code.gson:gson:2.7'
|
||||
compile 'com.journeyapps:zxing-android-embedded:3.5.0@aar'
|
||||
compile 'com.google.zxing:core:3.3.0'
|
||||
compile 'com.google.code.gson:gson:2.8.1'
|
||||
}
|
|
@ -24,7 +24,6 @@ import android.app.AlertDialog;
|
|||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.database.Cursor;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
@ -71,7 +70,6 @@ import es.ugr.swad.swadroid.modules.qr.GenerateQR;
|
|||
import es.ugr.swad.swadroid.modules.rollcall.Rollcall;
|
||||
import es.ugr.swad.swadroid.modules.tests.Tests;
|
||||
import es.ugr.swad.swadroid.preferences.Preferences;
|
||||
import es.ugr.swad.swadroid.ssl.SecureConnection;
|
||||
import es.ugr.swad.swadroid.sync.AccountAuthenticator;
|
||||
import es.ugr.swad.swadroid.sync.SyncUtils;
|
||||
import es.ugr.swad.swadroid.utils.DateTimeUtils;
|
||||
|
@ -170,23 +168,6 @@ public class SWADMain extends MenuExpandableListActivity {
|
|||
initializeMainViews();
|
||||
|
||||
try {
|
||||
|
||||
//Initialize HTTPS connections
|
||||
/*
|
||||
* SSL root certificates for SWAD are not included by default on Gingerbread and older
|
||||
* If Android API < 11 (HONEYCOMB) add SSL certificates manually
|
||||
*/
|
||||
if(Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
|
||||
/*
|
||||
SSL connection
|
||||
*/
|
||||
SecureConnection conn = new SecureConnection();
|
||||
conn.initSecureConnection();
|
||||
Log.i(TAG, "Android API < 11 (HONEYCOMB). Adding SSL certificates manually");
|
||||
} else {
|
||||
Log.i(TAG, "Android API >= 11 (HONEYCOMB). Using SSL built-in certificates");
|
||||
}
|
||||
|
||||
//Check if this is the first run after an install or upgrade
|
||||
lastVersion = Preferences.getLastVersion();
|
||||
currentVersion = getPackageManager().getPackageInfo(getPackageName(), 0).versionCode;
|
||||
|
@ -702,29 +683,17 @@ public class SWADMain extends MenuExpandableListActivity {
|
|||
activity = new Intent(ctx, GenerateQR.class);
|
||||
startActivityForResult(activity, Constants.GENERATE_QR_REQUEST_CODE);
|
||||
} else if (keyword.equals(getString(R.string.documentsDownloadModuleLabel))) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
|
||||
activity = new Intent(ctx, DownloadsManager.class);
|
||||
activity.putExtra("downloadsAreaCode", Constants.DOCUMENTS_AREA_CODE);
|
||||
startActivityForResult(activity, Constants.DOWNLOADSMANAGER_REQUEST_CODE);
|
||||
} else {
|
||||
Toast.makeText(ctx, R.string.functionHoneycombMsg, Toast.LENGTH_LONG).show();
|
||||
}
|
||||
activity = new Intent(ctx, DownloadsManager.class);
|
||||
activity.putExtra("downloadsAreaCode", Constants.DOCUMENTS_AREA_CODE);
|
||||
startActivityForResult(activity, Constants.DOWNLOADSMANAGER_REQUEST_CODE);
|
||||
} else if (keyword.equals(getString(R.string.sharedsDownloadModuleLabel))) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
|
||||
activity = new Intent(ctx, DownloadsManager.class);
|
||||
activity.putExtra("downloadsAreaCode", Constants.SHARE_AREA_CODE);
|
||||
startActivityForResult(activity, Constants.DOWNLOADSMANAGER_REQUEST_CODE);
|
||||
} else {
|
||||
Toast.makeText(ctx, R.string.functionHoneycombMsg, Toast.LENGTH_LONG).show();
|
||||
}
|
||||
activity = new Intent(ctx, DownloadsManager.class);
|
||||
activity.putExtra("downloadsAreaCode", Constants.SHARE_AREA_CODE);
|
||||
startActivityForResult(activity, Constants.DOWNLOADSMANAGER_REQUEST_CODE);
|
||||
} else if (keyword.equals(getString(R.string.marksModuleLabel))) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
|
||||
activity = new Intent(ctx, DownloadsManager.class);
|
||||
activity.putExtra("downloadsAreaCode", Constants.MARKS_AREA_CODE);
|
||||
startActivityForResult(activity, Constants.DOWNLOADSMANAGER_REQUEST_CODE);
|
||||
} else {
|
||||
Toast.makeText(ctx, R.string.functionHoneycombMsg, Toast.LENGTH_LONG).show();
|
||||
}
|
||||
activity = new Intent(ctx, DownloadsManager.class);
|
||||
activity.putExtra("downloadsAreaCode", Constants.MARKS_AREA_CODE);
|
||||
startActivityForResult(activity, Constants.DOWNLOADSMANAGER_REQUEST_CODE);
|
||||
} else if (keyword.equals(getString(R.string.myGroupsModuleLabel))) {
|
||||
activity = new Intent(ctx, MyGroupsManager.class);
|
||||
activity.putExtra("courseCode", Courses.getSelectedCourseCode());
|
||||
|
|
|
@ -26,7 +26,9 @@ import android.content.Context;
|
|||
import android.graphics.BitmapFactory;
|
||||
import android.support.v4.app.NotificationCompat;
|
||||
|
||||
import es.ugr.swad.swadroid.preferences.Preferences;
|
||||
import es.ugr.swad.swadroid.utils.NotificationUtils;
|
||||
|
||||
import static es.ugr.swad.swadroid.utils.NotificationUtils.SWADROID_CHANNEL_ID;
|
||||
|
||||
/**
|
||||
* Class for create notification alerts.
|
||||
|
@ -35,12 +37,12 @@ import es.ugr.swad.swadroid.preferences.Preferences;
|
|||
*/
|
||||
public class AlertNotificationFactory {
|
||||
public static NotificationCompat.Builder createAlertNotificationBuilder(Context context, String contentTitle, String contentText,
|
||||
String ticker, PendingIntent pendingIntent, int smallIcon, int largeIcon, boolean alertSignals,
|
||||
String ticker, PendingIntent pendingIntent, int smallIcon, int largeIcon,
|
||||
boolean autocancel, boolean ongoing, boolean onlyAlertOnce) {
|
||||
|
||||
int flags = 0;
|
||||
|
||||
NotificationCompat.Builder notifBuilder = new NotificationCompat.Builder(context)
|
||||
NotificationCompat.Builder notifBuilder = new NotificationCompat.Builder(context, SWADROID_CHANNEL_ID)
|
||||
.setAutoCancel(autocancel)
|
||||
.setSmallIcon(smallIcon)
|
||||
.setLargeIcon(BitmapFactory.decodeResource(context.getResources(), largeIcon))
|
||||
|
@ -58,21 +60,9 @@ public class AlertNotificationFactory {
|
|||
}
|
||||
|
||||
//Add sound, vibration and lights
|
||||
if(alertSignals) {
|
||||
if(Preferences.isNotifSoundEnabled()) {
|
||||
flags |= Notification.DEFAULT_SOUND;
|
||||
} else {
|
||||
notifBuilder.setSound(null);
|
||||
}
|
||||
|
||||
if(Preferences.isNotifVibrateEnabled()) {
|
||||
flags |= Notification.DEFAULT_VIBRATE;
|
||||
}
|
||||
|
||||
if(Preferences.isNotifLightsEnabled()) {
|
||||
flags |= Notification.DEFAULT_LIGHTS;
|
||||
}
|
||||
}
|
||||
flags |= Notification.DEFAULT_SOUND;
|
||||
flags |= Notification.DEFAULT_VIBRATE;
|
||||
flags |= Notification.DEFAULT_LIGHTS;
|
||||
|
||||
notifBuilder.setDefaults(flags);
|
||||
|
||||
|
@ -80,17 +70,16 @@ public class AlertNotificationFactory {
|
|||
}
|
||||
|
||||
public static NotificationCompat.Builder createProgressNotificationBuilder(Context context, String contentTitle, String contentText,
|
||||
String ticker, PendingIntent pendingIntent, int smallIcon, int largeIcon, boolean alertSignals,
|
||||
String ticker, PendingIntent pendingIntent, int smallIcon, int largeIcon,
|
||||
boolean autocancel, boolean ongoing, boolean onlyAlertOnce, int maxProgress, int progress, boolean indeterminate) {
|
||||
|
||||
NotificationCompat.Builder notifBuilder = createAlertNotificationBuilder(context,
|
||||
NotificationCompat.Builder notifBuilder = createAlertNotificationBuilder(context,
|
||||
contentTitle,
|
||||
contentText,
|
||||
ticker,
|
||||
pendingIntent,
|
||||
smallIcon,
|
||||
largeIcon,
|
||||
alertSignals,
|
||||
largeIcon,
|
||||
autocancel,
|
||||
ongoing,
|
||||
onlyAlertOnce);
|
||||
|
@ -101,7 +90,7 @@ public class AlertNotificationFactory {
|
|||
}
|
||||
|
||||
public static Notification createAlertNotification(Context context, String contentTitle, String contentText,
|
||||
String ticker, PendingIntent pendingIntent, int smallIcon, int largeIcon, boolean alertSignals,
|
||||
String ticker, PendingIntent pendingIntent, int smallIcon, int largeIcon,
|
||||
boolean autocancel, boolean ongoing, boolean onlyAlertOnce) {
|
||||
|
||||
NotificationCompat.Builder notifBuilder = createAlertNotificationBuilder(context,
|
||||
|
@ -110,8 +99,7 @@ public class AlertNotificationFactory {
|
|||
ticker,
|
||||
pendingIntent,
|
||||
smallIcon,
|
||||
largeIcon,
|
||||
alertSignals,
|
||||
largeIcon,
|
||||
autocancel,
|
||||
ongoing,
|
||||
onlyAlertOnce);
|
||||
|
@ -121,7 +109,7 @@ public class AlertNotificationFactory {
|
|||
}
|
||||
|
||||
public static Notification createProgressNotification(Context context, String contentTitle, String contentText,
|
||||
String ticker, PendingIntent pendingIntent, int smallIcon, int largeIcon, boolean alertSignals,
|
||||
String ticker, PendingIntent pendingIntent, int smallIcon, int largeIcon,
|
||||
boolean autocancel, boolean ongoing, boolean onlyAlertOnce, int maxProgress, int progress, boolean indeterminate) {
|
||||
|
||||
NotificationCompat.Builder notifBuilder = createProgressNotificationBuilder(context,
|
||||
|
@ -130,8 +118,7 @@ public class AlertNotificationFactory {
|
|||
ticker,
|
||||
pendingIntent,
|
||||
smallIcon,
|
||||
largeIcon,
|
||||
alertSignals,
|
||||
largeIcon,
|
||||
autocancel,
|
||||
ongoing,
|
||||
onlyAlertOnce,
|
||||
|
@ -143,10 +130,17 @@ public class AlertNotificationFactory {
|
|||
return notifBuilder.build();
|
||||
}
|
||||
|
||||
public static void showAlertNotification(Context context, Notification notif, int notifId) {
|
||||
//Obtain a reference to the notification service
|
||||
NotificationManager notifManager =
|
||||
(NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
public static void showAlertNotification(Context context, Notification notif, int notifId) {
|
||||
NotificationManager notifManager;
|
||||
|
||||
//Obtain a reference to the notification service
|
||||
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
|
||||
NotificationUtils mNotificationUtils = new NotificationUtils(context);
|
||||
notifManager = mNotificationUtils.getManager();
|
||||
} else {
|
||||
notifManager =
|
||||
(NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
}
|
||||
|
||||
//Send alert
|
||||
notifManager.notify(notifId, notif);
|
||||
|
|
|
@ -206,12 +206,8 @@ public class DialogFactory {
|
|||
.setCancelable(cancelable)
|
||||
.setPositiveButton(acceptLabel, positiveListener)
|
||||
.setNegativeButton(cancelLabel, negativeListener);
|
||||
|
||||
if(android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) {
|
||||
alertDialogBuilder.setIconAttribute(android.R.attr.alertDialogIcon);
|
||||
} else {
|
||||
alertDialogBuilder.setIcon(R.drawable.ic_dialog_alert);
|
||||
}
|
||||
|
||||
alertDialogBuilder.setIconAttribute(android.R.attr.alertDialogIcon);
|
||||
|
||||
if(messageId != -1) {
|
||||
alertDialogBuilder.setMessage(messageId);
|
||||
|
@ -257,12 +253,8 @@ public class DialogFactory {
|
|||
.setTitle(R.string.title_error_dialog)
|
||||
.setMessage(message)
|
||||
.setNeutralButton(R.string.close_dialog, onClickListener);
|
||||
|
||||
if(android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) {
|
||||
alertDialogBuilder.setIconAttribute(android.R.attr.alertDialogIcon);
|
||||
} else {
|
||||
alertDialogBuilder.setIcon(R.drawable.ic_dialog_alert);
|
||||
}
|
||||
|
||||
alertDialogBuilder.setIconAttribute(android.R.attr.alertDialogIcon);
|
||||
|
||||
if (ex != null) {
|
||||
Log.e(tag, ex.getMessage(), ex);
|
||||
|
|
|
@ -44,39 +44,29 @@ public class ProgressScreen {
|
|||
*/
|
||||
@TargetApi(Build.VERSION_CODES.HONEYCOMB_MR2)
|
||||
public void show() {
|
||||
// On Honeycomb MR2 we have the ViewPropertyAnimator APIs, which allow
|
||||
// for very easy animations. If available, use these APIs to fade-in
|
||||
// the progress spinner.
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) {
|
||||
int shortAnimTime = context.getResources().getInteger(android.R.integer.config_shortAnimTime);
|
||||
int shortAnimTime = context.getResources().getInteger(android.R.integer.config_shortAnimTime);
|
||||
|
||||
progressView.setVisibility(View.VISIBLE);
|
||||
progressView.animate()
|
||||
.setDuration(shortAnimTime)
|
||||
.alpha(1)
|
||||
.setListener(new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
progressView.setVisibility(View.VISIBLE);
|
||||
}
|
||||
});
|
||||
progressView.setVisibility(View.VISIBLE);
|
||||
progressView.animate()
|
||||
.setDuration(shortAnimTime)
|
||||
.alpha(1)
|
||||
.setListener(new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
progressView.setVisibility(View.VISIBLE);
|
||||
}
|
||||
});
|
||||
|
||||
activityView.setVisibility(View.VISIBLE);
|
||||
activityView.animate()
|
||||
.setDuration(shortAnimTime)
|
||||
.alpha(0)
|
||||
.setListener(new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
activityView.setVisibility(View.GONE);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// The ViewPropertyAnimator APIs are not available, so simply show
|
||||
// and hide the relevant UI components.
|
||||
progressView.setVisibility(View.VISIBLE);
|
||||
activityView.setVisibility(View.GONE);
|
||||
}
|
||||
activityView.setVisibility(View.VISIBLE);
|
||||
activityView.animate()
|
||||
.setDuration(shortAnimTime)
|
||||
.alpha(0)
|
||||
.setListener(new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
activityView.setVisibility(View.GONE);
|
||||
}
|
||||
});
|
||||
|
||||
this.showing = true;
|
||||
}
|
||||
|
@ -86,39 +76,29 @@ public class ProgressScreen {
|
|||
*/
|
||||
@TargetApi(Build.VERSION_CODES.HONEYCOMB_MR2)
|
||||
public void hide() {
|
||||
// On Honeycomb MR2 we have the ViewPropertyAnimator APIs, which allow
|
||||
// for very easy animations. If available, use these APIs to fade-in
|
||||
// the progress spinner.
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) {
|
||||
int shortAnimTime = context.getResources().getInteger(android.R.integer.config_shortAnimTime);
|
||||
int shortAnimTime = context.getResources().getInteger(android.R.integer.config_shortAnimTime);
|
||||
|
||||
progressView.setVisibility(View.VISIBLE);
|
||||
progressView.animate()
|
||||
.setDuration(shortAnimTime)
|
||||
.alpha(0)
|
||||
.setListener(new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
progressView.setVisibility(View.GONE);
|
||||
}
|
||||
});
|
||||
progressView.setVisibility(View.VISIBLE);
|
||||
progressView.animate()
|
||||
.setDuration(shortAnimTime)
|
||||
.alpha(0)
|
||||
.setListener(new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
progressView.setVisibility(View.GONE);
|
||||
}
|
||||
});
|
||||
|
||||
activityView.setVisibility(View.VISIBLE);
|
||||
activityView.animate()
|
||||
.setDuration(shortAnimTime)
|
||||
.alpha(1)
|
||||
.setListener(new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
activityView.setVisibility(View.VISIBLE);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// The ViewPropertyAnimator APIs are not available, so simply show
|
||||
// and hide the relevant UI components.
|
||||
progressView.setVisibility(View.GONE);
|
||||
activityView.setVisibility(View.VISIBLE);
|
||||
}
|
||||
activityView.setVisibility(View.VISIBLE);
|
||||
activityView.animate()
|
||||
.setDuration(shortAnimTime)
|
||||
.alpha(1)
|
||||
.setListener(new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
activityView.setVisibility(View.VISIBLE);
|
||||
}
|
||||
});
|
||||
|
||||
this.showing = false;
|
||||
}
|
||||
|
|
|
@ -75,9 +75,7 @@ public class CreateAccountActivity extends AppCompatActivity implements AdapterV
|
|||
|
||||
setContentView(R.layout.create_account_activity);
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
}
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
serversList = Arrays.asList(getResources().getStringArray(R.array.servers_array));
|
||||
|
||||
|
|
|
@ -76,40 +76,21 @@ public class DownloadFactory {
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if((Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) && !Utils.isHTTPUrl(url)) {
|
||||
//DownloadManager GINGERBREAD (HTTPS support)
|
||||
Log.i(TAG, "Downloading file " + fileName + " with custom DownloadManager GINGERBREAD (HTTPS support)");
|
||||
|
||||
managerGingerbread = new es.ugr.swad.swadroid.modules.downloads.DownloadManager(context.getContentResolver(), "es.ugr.swad.swadroid.modules.downloads");
|
||||
requestGingerbread = new es.ugr.swad.swadroid.modules.downloads.DownloadManager.Request(uri);
|
||||
|
||||
requestGingerbread.setDescription(title);
|
||||
requestGingerbread.setTitle(description);
|
||||
requestGingerbread.setDestinationInExternalPublicDir(Constants.DIRECTORY_SWADROID, fileName);
|
||||
|
||||
managerGingerbread.enqueue(requestGingerbread);
|
||||
} else {
|
||||
managerHoneycomb = (DownloadManager) context.getSystemService(Context.DOWNLOAD_SERVICE);
|
||||
requestHoneycomb = new DownloadManager.Request(uri);
|
||||
|
||||
requestHoneycomb.setDescription(title);
|
||||
requestHoneycomb.setTitle(description);
|
||||
requestHoneycomb.setDestinationInExternalPublicDir(Constants.DIRECTORY_SWADROID, fileName);
|
||||
managerHoneycomb = (DownloadManager) context.getSystemService(Context.DOWNLOAD_SERVICE);
|
||||
requestHoneycomb = new DownloadManager.Request(uri);
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
|
||||
//DownloadManager HONEYCOMB
|
||||
Log.i(TAG, "Downloading file " + fileName + " with DownloadManager >= HONEYCOMB");
|
||||
|
||||
requestHoneycomb.allowScanningByMediaScanner();
|
||||
requestHoneycomb.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
|
||||
} else {
|
||||
//DownloadManager GINGERBREAD (HTTP)
|
||||
Log.i(TAG, "Downloading file " + fileName + " with DownloadManager GINGERBREAD (HTTP)");
|
||||
}
|
||||
|
||||
managerHoneycomb.enqueue(requestHoneycomb);
|
||||
}
|
||||
requestHoneycomb.setDescription(title);
|
||||
requestHoneycomb.setTitle(description);
|
||||
requestHoneycomb.setDestinationInExternalPublicDir(Constants.DIRECTORY_SWADROID, fileName);
|
||||
|
||||
//DownloadManager HONEYCOMB
|
||||
Log.i(TAG, "Downloading file " + fileName + " with DownloadManager >= HONEYCOMB");
|
||||
|
||||
requestHoneycomb.allowScanningByMediaScanner();
|
||||
requestHoneycomb.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
|
||||
|
||||
managerHoneycomb.enqueue(requestHoneycomb);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -120,9 +101,6 @@ public class DownloadFactory {
|
|||
*/
|
||||
public static boolean isDownloadManagerAvailable(Context context) {
|
||||
try {
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.GINGERBREAD) {
|
||||
return false;
|
||||
}
|
||||
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");
|
||||
|
|
|
@ -806,9 +806,7 @@ public class DownloadsManager extends MenuActivity {
|
|||
*/
|
||||
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
|
||||
private void setupActionBar() {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
}
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
switch (downloadsAreaCode) {
|
||||
case Constants.DOCUMENTS_AREA_CODE:
|
||||
|
|
|
@ -23,7 +23,6 @@ import android.app.AlertDialog;
|
|||
import android.content.DialogInterface;
|
||||
import android.content.DialogInterface.OnClickListener;
|
||||
import android.content.Intent;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.util.LongSparseArray;
|
||||
import android.view.Menu;
|
||||
|
@ -132,9 +131,7 @@ public class MyGroupsManager extends MenuExpandableListActivity {
|
|||
|
||||
getSupportActionBar().setSubtitle(Courses.getSelectedCourseShortName());
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
}
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
|
||||
package es.ugr.swad.swadroid.modules.information;
|
||||
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.webkit.WebView;
|
||||
|
@ -19,9 +18,9 @@ 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;
|
||||
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.modules.Module;
|
||||
import es.ugr.swad.swadroid.webservices.SOAPClient;
|
||||
/**
|
||||
* Module for get course info
|
||||
|
@ -72,9 +71,7 @@ public class Information extends Module {
|
|||
|
||||
getSupportActionBar().setSubtitle(Courses.getSelectedCourseShortName());
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
}
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
switch (requestCode) {
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
|
||||
package es.ugr.swad.swadroid.modules.marks;
|
||||
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.webkit.WebView;
|
||||
|
||||
|
@ -41,9 +40,7 @@ public class Marks extends MenuActivity {
|
|||
|
||||
getSupportActionBar().setSubtitle(Courses.getSelectedCourseShortName());
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
}
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
setTitle(R.string.marksModuleLabel);
|
||||
}
|
||||
|
|
|
@ -21,7 +21,6 @@ package es.ugr.swad.swadroid.modules.messages;
|
|||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Paint;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.util.Log;
|
||||
|
@ -36,11 +35,15 @@ import android.widget.ImageView;
|
|||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.nostra13.universalimageloader.core.ImageLoader;
|
||||
|
||||
import org.ksoap2.serialization.SoapObject;
|
||||
|
||||
import java.util.ArrayList;
|
||||
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;
|
||||
|
@ -173,9 +176,7 @@ public class Messages extends Module {
|
|||
setContentView(R.layout.messages_screen);
|
||||
setTitle(R.string.messagesModuleLabel);
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
}
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
subjEditText = (EditText) findViewById(R.id.message_subject_text);
|
||||
bodyEditText = (EditText) findViewById(R.id.message_body_text);
|
||||
|
|
|
@ -275,9 +275,7 @@ public class Notifications extends Module implements
|
|||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.expandablelist_items_pulltorefresh);
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
}
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
this.findViewById(R.id.groupSpinner).setVisibility(View.GONE);
|
||||
|
||||
|
@ -511,7 +509,6 @@ public class Notifications extends Module implements
|
|||
R.drawable.ic_launcher_swadroid_notif,
|
||||
R.drawable.ic_launcher_swadroid,
|
||||
true,
|
||||
true,
|
||||
false,
|
||||
false);
|
||||
|
||||
|
|
|
@ -454,19 +454,6 @@ public class NotificationsSyncAdapterService extends Service {
|
|||
startIntent.setAction(START_SYNC);
|
||||
context.sendBroadcast(startIntent);
|
||||
|
||||
//Initialize HTTPS connections
|
||||
/*
|
||||
* Terena root certificate is not included by default on Gingerbread and older
|
||||
* If Android API < 11 (HONEYCOMB) add Terena certificate manually
|
||||
*/
|
||||
if(Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
|
||||
conn = new SecureConnection();
|
||||
conn.initSecureConnection();
|
||||
Log.i(TAG, "Android API < 11 (HONEYCOMB). Adding Terena certificate manually");
|
||||
} else {
|
||||
Log.i(TAG, "Android API >= 11 (HONEYCOMB). Using Terena built-in certificate");
|
||||
}
|
||||
|
||||
//If last login time > Global.RELOGIN_TIME, force login
|
||||
if (Login.isLogged() &&
|
||||
((System.currentTimeMillis() - Login.getLastLoginTime()) > Login.RELOGIN_TIME)) {
|
||||
|
@ -491,7 +478,6 @@ public class NotificationsSyncAdapterService extends Service {
|
|||
R.drawable.ic_launcher_swadroid_notif,
|
||||
R.drawable.ic_launcher_swadroid,
|
||||
true,
|
||||
true,
|
||||
false,
|
||||
false);
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@ package es.ugr.swad.swadroid.modules.qr;
|
|||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Bitmap;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.Toast;
|
||||
|
@ -54,9 +53,7 @@ public class GenerateQR extends MenuActivity {
|
|||
|
||||
setTitle(R.string.generateQRModuleLabel);
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
}
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
barcodeEncoder = new BarcodeEncoder();
|
||||
}
|
||||
|
|
|
@ -171,9 +171,7 @@ public class Rollcall extends MenuExpandableListActivity implements
|
|||
|
||||
getSupportActionBar().setSubtitle(Courses.getSelectedCourseShortName());
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
}
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
|
|
@ -142,9 +142,7 @@ public class UsersActivity extends MenuExpandableListActivity implements
|
|||
|
||||
getSupportActionBar().setSubtitle(Courses.getSelectedCourseShortName());
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
}
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
eventCode = this.getIntent().getIntExtra("attendanceEventCode", 0);
|
||||
hasRearCam = getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA);
|
||||
|
|
|
@ -146,12 +146,8 @@ public class UsersCursorAdapter extends CursorAdapter {
|
|||
|
||||
//Refresh ListView
|
||||
dbCursor = dbHelper.getUsersEventCursor(eventCode);
|
||||
if (android.os.Build.VERSION.SDK_INT > android.os.Build.VERSION_CODES.GINGERBREAD) {
|
||||
oldCursor = swapCursor(dbCursor);
|
||||
oldCursor.close();
|
||||
} else {
|
||||
changeCursor(dbCursor);
|
||||
}
|
||||
oldCursor = swapCursor(dbCursor);
|
||||
oldCursor.close();
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
});
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
package es.ugr.swad.swadroid.modules.tests;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.AdapterView;
|
||||
|
@ -89,9 +88,7 @@ public class Tests extends MenuActivity implements OnItemClickListener {
|
|||
|
||||
getSupportActionBar().setSubtitle(Courses.getSelectedCourseShortName());
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
}
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -124,17 +124,10 @@ public class TestsMake extends MenuActivity {
|
|||
|
||||
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
|
||||
private void setNumQuestions() {
|
||||
if(android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) {
|
||||
android.widget.NumberPicker numberPicker =
|
||||
(android.widget.NumberPicker) findViewById(R.id.testNumQuestionsNumberPicker);
|
||||
|
||||
numQuestions = numberPicker.getValue();
|
||||
} else {
|
||||
es.ugr.swad.swadroid.gui.widget.NumberPicker numberPickerOld =
|
||||
(es.ugr.swad.swadroid.gui.widget.NumberPicker) findViewById(R.id.testNumQuestionsNumberPickerOld);
|
||||
|
||||
numQuestions = numberPickerOld.getCurrent();
|
||||
}
|
||||
android.widget.NumberPicker numberPicker =
|
||||
(android.widget.NumberPicker) findViewById(R.id.testNumQuestionsNumberPicker);
|
||||
|
||||
numQuestions = numberPicker.getValue();
|
||||
|
||||
if (isDebuggable) {
|
||||
Log.d(TAG, "numQuestions=" + numQuestions);
|
||||
|
@ -152,22 +145,13 @@ public class TestsMake extends MenuActivity {
|
|||
|
||||
setLayout(R.layout.tests_num_questions);
|
||||
|
||||
if(android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) {
|
||||
android.widget.NumberPicker numberPicker =
|
||||
(android.widget.NumberPicker) findViewById(R.id.testNumQuestionsNumberPicker);
|
||||
|
||||
numberPicker.setMaxValue(test.getMax());
|
||||
numberPicker.setMinValue(test.getMin());
|
||||
numberPicker.setValue(test.getDef());
|
||||
numberPicker.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
es.ugr.swad.swadroid.gui.widget.NumberPicker numberPickerOld =
|
||||
(es.ugr.swad.swadroid.gui.widget.NumberPicker) findViewById(R.id.testNumQuestionsNumberPickerOld);
|
||||
|
||||
numberPickerOld.setRange(test.getMin(), test.getMax());
|
||||
numberPickerOld.setCurrent(test.getDef());
|
||||
numberPickerOld.setVisibility(View.VISIBLE);
|
||||
}
|
||||
android.widget.NumberPicker numberPicker =
|
||||
(android.widget.NumberPicker) findViewById(R.id.testNumQuestionsNumberPicker);
|
||||
|
||||
numberPicker.setMaxValue(test.getMax());
|
||||
numberPicker.setMinValue(test.getMin());
|
||||
numberPicker.setValue(test.getDef());
|
||||
numberPicker.setVisibility(View.VISIBLE);
|
||||
|
||||
SWADroidTracker.sendScreenView(getApplicationContext(), TAG + " NumQuestions");
|
||||
}
|
||||
|
@ -757,9 +741,7 @@ public class TestsMake extends MenuActivity {
|
|||
|
||||
getSupportActionBar().setSubtitle(Courses.getSelectedCourseShortName());
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
}
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
tagsAnswersTypeItemClickListener = new OnItemClickListener() {
|
||||
public void onItemClick(AdapterView<?> parent, View v, int position,
|
||||
|
|
|
@ -138,18 +138,6 @@ public class Preferences {
|
|||
* Last synchronization time preference name
|
||||
*/
|
||||
public static final String LASTSYNCTIMEPREF = "lastSyncTimeLimit";
|
||||
/**
|
||||
* Notifications sound enable preference name
|
||||
*/
|
||||
public static final String NOTIFSOUNDENABLEPREF = "prefNotifSoundEnable";
|
||||
/**
|
||||
* Notifications vibrate enable preference name
|
||||
*/
|
||||
public static final String NOTIFVIBRATEENABLEPREF = "prefNotifVibrateEnable";
|
||||
/**
|
||||
* Notifications lights enable preference name
|
||||
*/
|
||||
public static final String NOTIFLIGHTSENABLEPREF = "prefNotifLightsEnable";
|
||||
/**
|
||||
* Changelog preference name
|
||||
*/
|
||||
|
@ -176,21 +164,12 @@ public class Preferences {
|
|||
* @param ctx Application context
|
||||
*/
|
||||
private static void getPreferences(Context ctx) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
|
||||
/*
|
||||
* If Android API >= 11 (HONEYCOMB) enable access to SharedPreferences from all processes
|
||||
* of the application
|
||||
*/
|
||||
prefs = ctx.getSharedPreferences(PREFS_NAME, Context.MODE_MULTI_PROCESS);
|
||||
Log.i(TAG, "Android API >= 11 (HONEYCOMB). Enabling MODE_MULTI_PROCESS explicitly");
|
||||
} else {
|
||||
/*
|
||||
* If Android API < 11 (HONEYCOMB) access is enabled by default
|
||||
* MODE_MULTI_PROCESS is not defined
|
||||
*/
|
||||
prefs = ctx.getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE);
|
||||
Log.i(TAG, "Android API < 11 (HONEYCOMB). MODE_MULTI_PROCESS is not defined and enabled by default");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -377,68 +356,6 @@ public class Preferences {
|
|||
editor.commit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the sound is enabled for notification alerts
|
||||
*
|
||||
* @return true if the sound is enabled for notification alerts
|
||||
* false otherwise
|
||||
*/
|
||||
public static boolean isNotifSoundEnabled() {
|
||||
return prefs.getBoolean(NOTIFSOUNDENABLEPREF, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Enables or disables the sound for notification alerts
|
||||
*
|
||||
* @param notifSoundEnabled true if the sound is enabled for notification alerts
|
||||
* false otherwise
|
||||
*/
|
||||
public static void setNotifSoundEnabled(boolean notifSoundEnabled) {
|
||||
editor = editor.putBoolean(NOTIFSOUNDENABLEPREF, notifSoundEnabled);
|
||||
editor.commit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the vibration is enabled for notification alerts
|
||||
*
|
||||
* @return true if the vibration is enabled for notification alerts
|
||||
* false otherwise
|
||||
*/
|
||||
public static boolean isNotifVibrateEnabled() {
|
||||
return prefs.getBoolean(NOTIFVIBRATEENABLEPREF, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Enables or disables the vibration for notification alerts
|
||||
*
|
||||
* @param notifVibrateEnabled the notifVibrateEnabled to set
|
||||
*/
|
||||
public static void setNotifVibrateEnabled(boolean notifVibrateEnabled) {
|
||||
editor = editor.putBoolean(NOTIFVIBRATEENABLEPREF, notifVibrateEnabled);
|
||||
editor.commit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the lights are enabled for notification alerts
|
||||
*
|
||||
* @return true if the lights are enabled for notification alerts
|
||||
* false otherwise
|
||||
*/
|
||||
public static boolean isNotifLightsEnabled() {
|
||||
return prefs.getBoolean(NOTIFLIGHTSENABLEPREF, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Enables or disables the lights for notification alerts
|
||||
*
|
||||
* @param notifLightsEnabled true if the lights are enabled for notification alerts
|
||||
* false otherwise
|
||||
*/
|
||||
public static void setNotifLightsEnabled(boolean notifLightsEnabled) {
|
||||
editor = editor.putBoolean(NOTIFLIGHTSENABLEPREF, notifLightsEnabled);
|
||||
editor.commit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the login data
|
||||
*
|
||||
|
|
|
@ -33,7 +33,10 @@ 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 java.security.NoSuchAlgorithmException;
|
||||
|
@ -45,11 +48,11 @@ 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.LoginInfo;
|
||||
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;
|
||||
|
||||
/**
|
||||
|
@ -114,18 +117,6 @@ public class PreferencesActivity extends PreferenceActivity implements OnPrefere
|
|||
* Synchronization enable preference
|
||||
*/
|
||||
private static CheckBoxPreference syncEnablePref;
|
||||
/**
|
||||
* Notifications sound enable preference
|
||||
*/
|
||||
private static CheckBoxPreference notifSoundEnablePref;
|
||||
/**
|
||||
* Notifications vibrate enable preference
|
||||
*/
|
||||
private static CheckBoxPreference notifVibrateEnablePref;
|
||||
/**
|
||||
* Notifications lights enable preference
|
||||
*/
|
||||
private static CheckBoxPreference notifLightsEnablePref;
|
||||
/**
|
||||
* Application debuggable flag
|
||||
*/
|
||||
|
@ -202,9 +193,6 @@ public class PreferencesActivity extends PreferenceActivity implements OnPrefere
|
|||
privacyPolicyPref = findPreference(Preferences.PRIVACYPOLICYPREF);
|
||||
syncTimePref = findPreference(Preferences.SYNCTIMEPREF);
|
||||
syncEnablePref = (CheckBoxPreference) findPreference(Preferences.SYNCENABLEPREF);
|
||||
notifSoundEnablePref = (CheckBoxPreference) findPreference(Preferences.NOTIFSOUNDENABLEPREF);
|
||||
notifVibrateEnablePref = (CheckBoxPreference) findPreference(Preferences.NOTIFVIBRATEENABLEPREF);
|
||||
notifLightsEnablePref = (CheckBoxPreference) findPreference(Preferences.NOTIFLIGHTSENABLEPREF);
|
||||
|
||||
ratePref.setOnPreferenceChangeListener(this);
|
||||
twitterPref.setOnPreferenceChangeListener(this);
|
||||
|
@ -216,9 +204,6 @@ public class PreferencesActivity extends PreferenceActivity implements OnPrefere
|
|||
privacyPolicyPref.setOnPreferenceChangeListener(this);
|
||||
syncEnablePref.setOnPreferenceChangeListener(this);
|
||||
syncTimePref.setOnPreferenceChangeListener(this);
|
||||
notifSoundEnablePref.setOnPreferenceChangeListener(this);
|
||||
notifVibrateEnablePref.setOnPreferenceChangeListener(this);
|
||||
notifLightsEnablePref.setOnPreferenceChangeListener(this);
|
||||
|
||||
logOutPref.setOnPreferenceClickListener(new OnPreferenceClickListener() {
|
||||
|
||||
|
@ -417,18 +402,6 @@ public class PreferencesActivity extends PreferenceActivity implements OnPrefere
|
|||
|
||||
syncTimePref.setSummary(prefSyncTimeEntry);
|
||||
syncPrefsChanged = true;
|
||||
} else if(Preferences.NOTIFSOUNDENABLEPREF.equals(key)) {
|
||||
boolean notifSoundEnabled = (Boolean) newValue;
|
||||
Preferences.setNotifSoundEnabled(notifSoundEnabled);
|
||||
notifSoundEnablePref.setChecked(notifSoundEnabled);
|
||||
} else if(Preferences.NOTIFVIBRATEENABLEPREF.equals(key)) {
|
||||
boolean notifVibrateEnabled = (Boolean) newValue;
|
||||
Preferences.setNotifVibrateEnabled(notifVibrateEnabled);
|
||||
notifVibrateEnablePref.setChecked(notifVibrateEnabled);
|
||||
} else if(Preferences.NOTIFLIGHTSENABLEPREF.equals(key)) {
|
||||
boolean notifLightsEnabled = (Boolean) newValue;
|
||||
Preferences.setNotifLightsEnabled(notifLightsEnabled);
|
||||
notifLightsEnablePref.setChecked(notifLightsEnabled);
|
||||
}
|
||||
|
||||
return returnValue;
|
||||
|
|
|
@ -20,12 +20,9 @@ package es.ugr.swad.swadroid.sync;
|
|||
|
||||
import android.accounts.Account;
|
||||
import android.accounts.AccountManager;
|
||||
import android.app.AlarmManager;
|
||||
import android.app.PendingIntent;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.os.SystemClock;
|
||||
import android.util.Log;
|
||||
|
||||
import es.ugr.swad.swadroid.Constants;
|
||||
|
@ -42,87 +39,58 @@ public class SyncUtils {
|
|||
private static final String TAG = Constants.APP_TAG + " SyncUtils";
|
||||
|
||||
public static void addPeriodicSync(String authority, Bundle extras, long frequency, Context context) {
|
||||
long pollFrequencyMsec = frequency * 60000;
|
||||
AccountManager am = AccountManager.get(context);
|
||||
Account[] accounts = am.getAccountsByType(Constants.ACCOUNT_TYPE);
|
||||
|
||||
if (android.os.Build.VERSION.SDK_INT < 8) {
|
||||
AlarmManager manager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
|
||||
Log.d(TAG, "[addPeriodicSync] Number of accounts with type " + Constants.ACCOUNT_TYPE + " = " + accounts.length);
|
||||
for (Account a : accounts) {
|
||||
ContentResolver.setSyncAutomatically(a, Constants.AUTHORITY, true);
|
||||
ContentResolver.addPeriodicSync(a, authority, extras, frequency * 60);
|
||||
|
||||
int type = AlarmManager.ELAPSED_REALTIME_WAKEUP;
|
||||
long triggerAtTime = SystemClock.elapsedRealtime() + pollFrequencyMsec;
|
||||
PendingIntent operation = PeriodicSyncReceiver.createPendingIntent(context, authority, extras);
|
||||
|
||||
manager.setInexactRepeating(type, triggerAtTime, pollFrequencyMsec, operation);
|
||||
|
||||
Log.i(TAG, "Added periodic alarm with pollFrequency=" + pollFrequencyMsec);
|
||||
} else {
|
||||
AccountManager am = AccountManager.get(context);
|
||||
Account[] accounts = am.getAccountsByType(Constants.ACCOUNT_TYPE);
|
||||
|
||||
Log.d(TAG, "[addPeriodicSync] Number of accounts with type " + Constants.ACCOUNT_TYPE + " = " + accounts.length);
|
||||
for (Account a : accounts) {
|
||||
ContentResolver.setSyncAutomatically(a, Constants.AUTHORITY, true);
|
||||
ContentResolver.addPeriodicSync(a, authority, extras, frequency * 60);
|
||||
|
||||
Log.i(TAG, "Added periodic synchronization with pollFrequency=" + (frequency * 60)
|
||||
+ " for account " + a.toString());
|
||||
}
|
||||
Log.i(TAG, "Added periodic synchronization with pollFrequency=" + (frequency * 60)
|
||||
+ " for account " + a.toString());
|
||||
}
|
||||
}
|
||||
|
||||
public static void removePeriodicSync(String authority, Bundle extras, Context context) {
|
||||
if (android.os.Build.VERSION.SDK_INT < 8) {
|
||||
AlarmManager manager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
|
||||
PendingIntent operation = PeriodicSyncReceiver.createPendingIntent(context, authority, extras);
|
||||
manager.cancel(operation);
|
||||
|
||||
Log.i(TAG, "Removed periodic alarm");
|
||||
} else {
|
||||
AccountManager am = AccountManager.get(context);
|
||||
Account[] accounts = am.getAccountsByType(Constants.ACCOUNT_TYPE);
|
||||
AccountManager am = AccountManager.get(context);
|
||||
Account[] accounts = am.getAccountsByType(Constants.ACCOUNT_TYPE);
|
||||
|
||||
Log.d(TAG, "[removePeriodicSync] Number of accounts with type " + Constants.ACCOUNT_TYPE + " = " + accounts.length);
|
||||
for (Account a : accounts) {
|
||||
ContentResolver.setSyncAutomatically(a, Constants.AUTHORITY, false);
|
||||
ContentResolver.removePeriodicSync(a, authority, extras);
|
||||
|
||||
Log.i(TAG, "Removed periodic synchronization for account " + a.toString());
|
||||
}
|
||||
}
|
||||
Log.d(TAG, "[removePeriodicSync] Number of accounts with type " + Constants.ACCOUNT_TYPE + " = " + accounts.length);
|
||||
for (Account a : accounts) {
|
||||
ContentResolver.setSyncAutomatically(a, Constants.AUTHORITY, false);
|
||||
ContentResolver.removePeriodicSync(a, authority, extras);
|
||||
|
||||
Log.i(TAG, "Removed periodic synchronization for account " + a.toString());
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isSyncAutomatically(Context context) {
|
||||
boolean isSyncAutomatically = true;
|
||||
|
||||
if (android.os.Build.VERSION.SDK_INT >= 8) {
|
||||
AccountManager am = AccountManager.get(context);
|
||||
Account[] accounts = am.getAccountsByType(Constants.ACCOUNT_TYPE);
|
||||
|
||||
Log.d(TAG, "[isSyncAutomatically] Number of accounts with type " + Constants.ACCOUNT_TYPE + " = " + accounts.length);
|
||||
for (Account a : accounts) {
|
||||
if (!ContentResolver.getMasterSyncAutomatically()
|
||||
|| !ContentResolver.getSyncAutomatically(a, Constants.AUTHORITY)) {
|
||||
isSyncAutomatically = false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
isSyncAutomatically = false;
|
||||
Log.e(TAG, "Operation isSyncAutomatically is not supported by build version " + android.os.Build.VERSION.SDK_INT);
|
||||
}
|
||||
|
||||
AccountManager am = AccountManager.get(context);
|
||||
Account[] accounts = am.getAccountsByType(Constants.ACCOUNT_TYPE);
|
||||
|
||||
Log.d(TAG, "[isSyncAutomatically] Number of accounts with type " + Constants.ACCOUNT_TYPE + " = " + accounts.length);
|
||||
for (Account a : accounts) {
|
||||
if (!ContentResolver.getMasterSyncAutomatically()
|
||||
|| !ContentResolver.getSyncAutomatically(a, Constants.AUTHORITY)) {
|
||||
isSyncAutomatically = false;
|
||||
}
|
||||
}
|
||||
|
||||
return isSyncAutomatically;
|
||||
}
|
||||
|
||||
public static boolean isPeriodicSynced(Context context) {
|
||||
boolean isPeriodicSynced = false;
|
||||
|
||||
if (android.os.Build.VERSION.SDK_INT >= 8) {
|
||||
AccountManager am = AccountManager.get(context);
|
||||
Account[] accounts = am.getAccountsByType(Constants.ACCOUNT_TYPE);
|
||||
|
||||
isPeriodicSynced = (accounts.length > 0);
|
||||
|
||||
Log.d(TAG, "[isPeriodicSynced] Number of accounts with type " + Constants.ACCOUNT_TYPE + " = " + accounts.length);
|
||||
}
|
||||
AccountManager am = AccountManager.get(context);
|
||||
Account[] accounts = am.getAccountsByType(Constants.ACCOUNT_TYPE);
|
||||
|
||||
isPeriodicSynced = (accounts.length > 0);
|
||||
|
||||
Log.d(TAG, "[isPeriodicSynced] Number of accounts with type " + Constants.ACCOUNT_TYPE + " = " + accounts.length);
|
||||
|
||||
return isPeriodicSynced;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,53 @@
|
|||
package es.ugr.swad.swadroid.utils;
|
||||
|
||||
/**
|
||||
* Class for manage Android Oreo notifications
|
||||
*
|
||||
* @author Juan Miguel Boyero Corral <juanmi1982@gmail.com>
|
||||
*/
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.app.Notification;
|
||||
import android.app.NotificationChannel;
|
||||
import android.app.NotificationManager;
|
||||
import android.content.Context;
|
||||
import android.content.ContextWrapper;
|
||||
import android.graphics.Color;
|
||||
import android.os.Build;
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.O)
|
||||
public class NotificationUtils extends ContextWrapper {
|
||||
|
||||
private NotificationManager mManager;
|
||||
public static final String SWADROID_CHANNEL_ID = "es.ugr.swad.swadroid.SWADROID";
|
||||
public static final String SWADROID_CHANNEL_NAME = "SWADROID CHANNEL";
|
||||
|
||||
public NotificationUtils(Context base) {
|
||||
super(base);
|
||||
createChannels();
|
||||
}
|
||||
|
||||
public void createChannels() {
|
||||
|
||||
// create SWADroid channel
|
||||
NotificationChannel androidChannel = new NotificationChannel(SWADROID_CHANNEL_ID,
|
||||
SWADROID_CHANNEL_NAME, NotificationManager.IMPORTANCE_DEFAULT);
|
||||
// Sets whether notifications posted to this channel should display notification lights
|
||||
androidChannel.enableLights(true);
|
||||
// Sets whether notification posted to this channel should vibrate.
|
||||
androidChannel.enableVibration(true);
|
||||
// Sets the notification light color for notifications posted to this channel
|
||||
androidChannel.setLightColor(Color.GREEN);
|
||||
// Sets whether notifications posted to this channel appear on the lockscreen or not
|
||||
androidChannel.setLockscreenVisibility(Notification.VISIBILITY_PUBLIC);
|
||||
|
||||
getManager().createNotificationChannel(androidChannel);
|
||||
}
|
||||
|
||||
public NotificationManager getManager() {
|
||||
if (mManager == null) {
|
||||
mManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
}
|
||||
return mManager;
|
||||
}
|
||||
}
|
|
@ -1,35 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/background"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/testNumQuestionsContent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/testNumQuestionsText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="20dip"
|
||||
android:layout_marginTop="20dip"
|
||||
android:gravity="center"
|
||||
android:text="@string/testNumQuestionsMsg"
|
||||
android:textColor="@color/foreground1"
|
||||
android:textSize="20sp" />
|
||||
|
||||
<NumberPicker
|
||||
android:id="@+id/testNumQuestionsNumberPicker"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/testNumQuestionsText"
|
||||
android:layout_centerInParent="true"
|
||||
android:visibility="gone"
|
||||
android:width="100dip" />
|
||||
</RelativeLayout>
|
||||
|
||||
</RelativeLayout>
|
|
@ -22,15 +22,14 @@
|
|||
android:textColor="@color/foreground1"
|
||||
android:textSize="20sp" />
|
||||
|
||||
<es.ugr.swad.swadroid.gui.widget.NumberPicker
|
||||
android:id="@+id/testNumQuestionsNumberPickerOld"
|
||||
<NumberPicker
|
||||
android:id="@+id/testNumQuestionsNumberPicker"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/testNumQuestionsText"
|
||||
android:layout_centerInParent="true"
|
||||
android:gravity="center"
|
||||
android:textSize="30sp"
|
||||
android:visibility="gone" />
|
||||
android:visibility="gone"
|
||||
android:width="100dip" />
|
||||
</RelativeLayout>
|
||||
|
||||
</RelativeLayout>
|
|
@ -14,6 +14,13 @@
|
|||
</style>
|
||||
</head>
|
||||
|
||||
<body bgcolor="white">
|
||||
<h4>1.5.3 (2017-10-25)</h4>
|
||||
<ul>
|
||||
<lh class="new">[NOVEDADES]</lh>
|
||||
<li type="disc">Añadida compatibilidad con el sistema de notificaciones de Android Oreo</li>
|
||||
</ul>
|
||||
|
||||
<body bgcolor="white">
|
||||
<h4>1.5.2 (2017-02-12)</h4>
|
||||
<ul>
|
||||
|
|
|
@ -14,6 +14,13 @@
|
|||
</style>
|
||||
</head>
|
||||
|
||||
<body bgcolor="white">
|
||||
<h4>1.5.3 (2017-10-25)</h4>
|
||||
<ul>
|
||||
<lh class="new">[NEW]</lh>
|
||||
<li type="disc">Added compatibility for Android Oreo notifications system</li>
|
||||
</ul>
|
||||
|
||||
<body bgcolor="white">
|
||||
<h4>1.5.2 (2017-02-12)</h4>
|
||||
<ul>
|
||||
|
|
|
@ -25,23 +25,6 @@
|
|||
android:summary="@string/prefSyncTimeSummary"
|
||||
android:title="@string/prefSyncTimeTitle" />
|
||||
</PreferenceCategory>
|
||||
<PreferenceCategory android:title="@string/prefCatNotifTitle" >
|
||||
<CheckBoxPreference
|
||||
android:defaultValue="true"
|
||||
android:key="@string/prefNotifSoundKey"
|
||||
android:summary="@string/prefNotifSoundSummary"
|
||||
android:title="@string/prefNotifSoundTitle" />
|
||||
<CheckBoxPreference
|
||||
android:defaultValue="true"
|
||||
android:key="@string/prefNotifVibrateKey"
|
||||
android:summary="@string/prefNotifVibrateSummary"
|
||||
android:title="@string/prefNotifVibrateTitle" />
|
||||
<CheckBoxPreference
|
||||
android:defaultValue="true"
|
||||
android:key="@string/prefNotifLightsKey"
|
||||
android:summary="@string/prefNotifLightsSummary"
|
||||
android:title="@string/prefNotifLightsTitle" />
|
||||
</PreferenceCategory>
|
||||
<PreferenceCategory android:title="@string/about_preferences" >
|
||||
<Preference
|
||||
android:defaultValue=""
|
||||
|
|
|
@ -4,8 +4,8 @@ buildscript {
|
|||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:2.2.3'
|
||||
classpath 'org.ajoberstar:grgit:1.7.0'
|
||||
classpath 'com.android.tools.build:gradle:2.3.3'
|
||||
classpath 'org.ajoberstar:grgit:1.8.0'
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -13,5 +13,6 @@ allprojects {
|
|||
repositories {
|
||||
jcenter()
|
||||
maven { url 'https://oss.sonatype.org/content/repositories/ksoap2-android-releases' }
|
||||
maven { url 'https://maven.google.com' }
|
||||
}
|
||||
}
|
||||
|
|
4
gradle/wrapper/gradle-wrapper.properties
vendored
4
gradle/wrapper/gradle-wrapper.properties
vendored
|
@ -1,6 +1,6 @@
|
|||
#Wed Aug 17 10:01:56 CEST 2016
|
||||
#Fri Mar 03 17:05:52 CET 2017
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
|
||||
|
|
Loading…
Reference in New Issue
Block a user