Skip to content
This repository has been archived by the owner on Aug 21, 2018. It is now read-only.

Commit

Permalink
Maxi course resources (#97)
Browse files Browse the repository at this point in the history
  • Loading branch information
leomaxi authored Sep 25, 2017
1 parent b379dca commit 4d85467
Show file tree
Hide file tree
Showing 23 changed files with 1,732 additions and 14 deletions.
127 changes: 127 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
language: android
sudo: required
jdk: oraclejdk8

before_cache:

- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock

- rm -fr $HOME/.gradle/caches/*/plugin-resolution/

cache:

directories:

- $HOME/.gradle/caches/

- $HOME/.gradle/wrapper/

env:

global:

- ANDROID_API=24

- EMULATOR_API=21

- ANDROID_BUILD_TOOLS=25.0.2

- ANDROID_ABI=armeabi-v7a

- ANDROID_TAG=google_apis

- ADB_INSTALL_TIMEOUT=5 # minutes
#- secure: "kYQFW12wY9zzMNqtor4sTeE4k/877t0igpS/AaPon7MNr+ebqEkeg9z6L1sE+81bopDX+0K62AxO4mKVxOiGGGVU5JS1ZFWg/BhPyKCThm1tUzXCBs5s8AxWU9s9MudfTHgPLwsOhvpKogivA0ZXt5iEFrkv57A51qZFMQ0Irl8iAaMiwjzv+FRT26jCCBCKB5jlRwocwOB7wEujlUN289i5y9o/wcWhBmA5YY7y64hdlZEs/bmF7RXXFpsRzmpvcm9rbnffBfSgDXAmnM1U7S9BLNgxtEoXraXlVlejnkti8+7aBmAqbQTto69eLPJlnGZ917BQLuhPqdapMNvLOwGP/CUVkzAMYsIndQafJsleRTYIRTlH2I+/ZMmaCZVUE4dxO97j1Nrbbksqb5zTzxKVJjgF5FpgZoa8KZeKh5TvFzWP5ZON53UcKM34J2D9juV6iNt34yffYq5OPkCblDHPiL9SbK01fGYlgVhdO9w9O/D+ybdsPC32syHnQgNQTH7GZlIJdJzamv9dN4zB/Hqk3LlECMHXWdYxCP/2EnEIFWO9P0TPw+Fb2B0t7hi/8ksvd7O2PaK3JL9i39prR4ZGeNkrJ3EmmM4dOV8CVZpTLrx+FshHgEszkmkn/nuiMrEqdz/4LK0fRsPLXkr9RFd2HJGrW6ng/lPYkVBT60w="
#- secure: "0Pm10LgXvYeSTGpK6QD3+BCMQv2C5OrBubk67im9R1r9HnxBViyGihZrnOzOdUDnP/j3VwCiuRmWBjmXVmG3c1K+vSpba14H3G9FFKQAwaXcKx3fsMVrXc2NFINjwL8tjKYWAQOPrXC2c1GDQiPOYgWP0YNK17UkAX0nRDZ7nCXZRvlG9xV+TF7lHKgsg7Twjp9hvXZaPJYnGPSyuko6JkBtuGstdptaO7OjfaRCrotiWT848Q/KzOQdVAzTmxMARInMRMXEP+XFkzEh7MKCx1rfz6xVvnA4iTEK8XHmk+/iqpTMFRHr2TpfT0QAF/+4hBpnJ6460ySqybUYd5kgJap+v+lL6w3s8o6gISR6m7YltqelwDeku51ZmgDtOPVmsfJIAd+XQ0SwD0gYd8r//wnNPKssGoGgDqp56g9lVlhzo9ZAkRk2PZh+o8G6vZpARIPnG2a/ENx8tC4QqoiGoR4swrgqDtqU6eruB0dfoNkkr+RiNTKsfJPs4ktQ31dF/qRJW/uLHSPWWrzonn2TE2+wf4pq1lYXadGfl+GhMcuXxTaWP9mEviS2BliGwVHQ8hn2yI40dXfIjZ0yZJPujQfRW/9tbAuKPGFdUm8RcglOpHOdNczMnodq0WfkbIVi/ohYEWmlK8LLvrhafNsevy+gP+c2Fqxw5mI3WnY/T1o="

android:

components:

- tools

- platform-tools

- build-tools-$ANDROID_BUILD_TOOLS

- android-$ANDROID_API

- android-$EMULATOR_API_LEVEL

- extra-google-m2repository

- extra-android-m2repository # for design library

- addon-google_apis-google-19 # google play services

- sys-img-armeabi-v7a-addon-google_apis-google-$ANDROID_API_LEVEL

- sys-img-armeabi-v7a-addon-google_apis-google-$EMULATOR_API_LEVEL

licenses:

- android-sdk-preview-license-.+

- android-sdk-license-.+

- google-gdk-license-.+

before_install:

#- openssl aes-256-cbc -K $encrypted_c0801aa05af4_key -iv $encrypted_c0801aa05af4_iv -in example_keystore.jks.enc -out example_keystore.jks -d
- mkdir "$ANDROID_HOME/licenses" || true

- echo -e "\n8933bad161af4178b1185d1a37fbf41ea5269c55" > "$ANDROID_HOME/licenses/android-sdk-license"
- echo -e "\n84831b9409646a918e30573bab4c9c91346d8abd" > "$ANDROID_HOME/licenses/android-sdk-preview-license"

- chmod +x gradlew
- ./gradlew dependencies || true

before_script:

#- echo no | android create avd --force -n test -t android-24 --abi google_apis/armeabi-v7a
- echo no | android create avd --force -n test -t "android-24" --abi $ANDROID_ABI --tag $ANDROID_TAG

- emulator -avd test -no-skin -no-audio -no-window &

- android-wait-for-emulator

- adb shell input keyevent 82 &

script:

- "./gradlew clean build connectedCheck -PdisablePreDex --stacktrace"

before_deploy:

- cp $TRAVIS_BUILD_DIR/example_keystore.jks $HOME

- cd app/build/outputs/apk/

- jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore $HOME/example_keystore.jks -storepass $storepass -keypass $keypass app-release-unsigned.apk ExampleKeystoreAlias


# Verification

- jarsigner -verify app-release-unsigned.apk

- "${ANDROID_HOME}/build-tools/24.0.2/zipalign -v 4 app-release-unsigned.apk TakeHomeAPK.apk"

deploy:

provider: releases

file: TakeHomeAPK.apk
skip_cleanup: true

on:

repo: harmittaa/travis-example-android

tags: true

jdk: oraclejdk8

api_key:

secure: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCZNi10cLA+B5aMjF3IZ3cDPEa4pcF08uVpkqrscsUADrt62YFnMoyBcH3Kv7Yf2L/7P6hUndbMJ3heh/yRdJ8npYE64AA1k4aBzD6MbivbtWJk8aK12ddEqSiFqVCc1oAb0MDfMk/fBFV43JijS6+UuZYqUfUzYyaNe+Obd91hrtjHxyYTeaWa7cG7Sg2KE8dKriSkKCxcPToDWovnbbU+5S7Z4dj0UiTcah+1VWNCkDyoGaocGjx9TxzEBo4LNn2TGTODp6+knuOaklllXZvuf6iozyRb7LROXMH//8DnmxRIs7I3C8strQH6dBQEXfB6QpoqyshTLhxYlfMSLaQ/ [email protected]"
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.net.wifi.WifiManager;
import android.os.AsyncTask;
import android.os.Build;
Expand All @@ -16,6 +18,7 @@
import android.support.v4.content.ContextCompat;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AlertDialog;
import android.util.DisplayMetrics;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
Expand Down Expand Up @@ -65,6 +68,7 @@
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;

Expand Down Expand Up @@ -464,7 +468,17 @@ public void sendfeedbackToServer(ProgressDialog feedbackDialog) {


}

public void setLocale(String lang) {
Locale myLocale = new Locale(lang);
Resources res = getResources();
DisplayMetrics dm = res.getDisplayMetrics();
Configuration conf = res.getConfiguration();
conf.locale = myLocale;
res.updateConfiguration(conf, dm);
Intent refresh = new Intent(this, FullscreenLogin.class);
startActivity(refresh);
finish();
}
////////
private void TestConnectionToServer(String textURL) {
mDialog = new ProgressDialog(context);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,17 +278,26 @@ public void createCourseResourceDoc(String manualResId, String manualResTitle, S
AndroidContext androidContext = new AndroidContext(context);
Manager manager = new Manager(androidContext, Manager.DEFAULT_OPTIONS);
database = manager.getDatabase("offline_course_resources");
Map<String, Object> properties = new HashMap<>();
properties.put("title", manualResTitle);
properties.put("openWith", manualResopenWith);
properties.put("localfile", "yes");
// properties.put("resourceType", manualResType);
Document document = database.getDocument(manualResId);
try {
document.putProperties(properties);
} catch (CouchbaseLiteException e) {
Log.e("MyCouch", "Cannot save document", e);
}

///Document doc = database.getExistingDocument(manualResId);
//Map<String, Object> existing_properties = doc.getProperties();
//if(existing_properties == null){
Log.e(TAG, "File does not exist");
Map<String, Object> properties = new HashMap<>();
properties.put("title", manualResTitle);
properties.put("openWith", manualResopenWith);
properties.put("localfile", "yes");
// properties.put("resourceType", manualResType);
Document document = database.getDocument(manualResId);
try {
document.putProperties(properties);
} catch (CouchbaseLiteException e) {
Log.e(TAG, "Cannot save document", e);
}
// }else{
// Log.e("MyCouch", "File already exist");
// }

} catch (Exception e) {
e.printStackTrace();
}
Expand Down Expand Up @@ -447,6 +456,7 @@ public void run() {
});
}
} else {
Log.e(TAG, "Doesn't contain resource");
//// HTML Resources not supported
/*Log.e("MyCouch", "-- HTML NOT PART OF DOWNLOADS ");
htmlResourceList.add(OneByOneResID);
Expand All @@ -465,7 +475,6 @@ public void run() {
}
} catch (Exception e) {
Log.e(TAG, "Download this resource error " + e.getMessage());

mListener.onCourseDownloadingProgress(OneByOneResTitle,"Please Wait","Downloading item");
mDialog.dismiss();
alertDialogOkay("Error downloading file, check connection and try again");
Expand Down
87 changes: 87 additions & 0 deletions app/src/main/res/app/src/main/res/values-af-rZA/strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
<?xml version="1.0" encoding="utf-8"?>
<!--Generated by crowdin.com-->
<resources>
<string name="app_name">PLANET</string>
<string name="action_syncUrl">Sync Server Url</string>
<string name="action_syncNow">Sync Device</string>
<string name="action_settings">Settings</string>
<string name="action_profile">Profile</string>
<string name="action_help">Help</string>
<string name="action_about">About</string>
<string name="section_format">Hello World from section: %1$d</string>
<string name="title_activity_login">Take-Home</string>
<!-- Related to First Time Dialog -->
<string name="fst_welcome">Take Home</string>
<string name="fst_instruction">It appears your device hasn\'t yet been linked to the BeLL network.
If you know your BeLL server\'s url, please enter it bellow or contact your coach / group leader for assistance</string>
<string name="fst_syncurl">BeLL Server Url</string>
<string name="fst_proceed">Save and Proceed</string>
<!-- Bottom Bar Menu related to Dashboard -->
<string name="bbtext_Achievments">Achievements</string>
<string name="bbtext_MyLibrary">myLibrary</string>
<string name="bbtext_Courses">Courses Progress</string>
<string name="bbtext_Meetups">myMeetups</string>
<!-- Strings related to Fragment 0 / Achievements -->
<string name="frg1_Visits">Visits</string>
<string name="frg1_OpenedRes">Opened Resources</string>
<!-- Strings related to Change Sync URL -->
<string name="syncURL_label">Sync server url</string>
<string name="syncURL_saveButton">Save changes</string>
<!-- Strings Sync URL -->
<string name="sync_LastSyncDate">Last sync date</string>
<string name="sync_Headen">Synchronize device with server</string>
<string name="sync_NowPush">Push Changes</string>
<string name="sync_NowPull">Pull Changes</string>
<string name="sync_EraseOldData">Wipe Clean</string>
<string name="sync_Resources">Sync Materials</string>
<!-- Strings related to login -->
<string name="prompt_username">Username</string>
<string name="prompt_password">Password (optional)</string>
<string name="action_sign_in">Sign in</string>
<string name="action_sign_in_short">Sign-in</string>
<string name="error_incorrect_password">This password is incorrect</string>
<string name="error_field_required">This field is required</string>
<string name="permission_rationale">\"Contacts permissions are needed for providing email completions.\"
</string>
<string name="title_activity_sync_device">Sync Device</string>
<string name="title_activity_new_sync">First Time Configuration</string>
<string name="sync_NowPullOnly">Synchronize With Server</string>
<string name="sync_CloseWindow">Close</string>
<string name="sync_DownloadResPersons">Download Resources</string>
<string name="open_course">Open Course</string>
<string name="title_activity_course">Course</string>
<string name="bbtext_MyTutors">My Tutors</string>
<string name="bbtext_Home">My Home</string>
<string name="txtLibrary">Library</string>
<string name="txtCourses">Courses</string>
<string name="txtMeetups">Meetups</string>
<string name="txtLogout">Logout</string>
<string name="txtSettings">Settings</string>
<string name="txtFeedback">Feedback</string>
<string name="txtMember_Login">Member Login</string>
<string name="txtWelcome">Welcome</string>
<string name="txtDemo">Demo Mode</string>
<string name="txtLogin">Login</string>
<string name="txt_Password">Password</string>
<string name="title_activity_test">test</string>
<string name="btnSetup">Setup</string>
<string name="fst_material_offline">This material is not on this device (offline). Do you want to open it online or download into this device.</string>
<string name="txtDownload">Download this</string>
<string name="txtOpenOnline">Open Online</string>
<string name="txtDownladAll">Download All</string>
<string name="multi_download">Multiple material download</string>
<string name="single_download">Single material download</string>
<string name="single_down_json_dis">JSON Replication Disabled</string>
<string name="single_down_file_streaming">FILE STREAMING DISABLED</string>
<string name="check_updates">Update</string>
<string name="txtBecomeMember">Become a member</string>
<string name="language">Language</string>
<string name="title_activity_home">Home</string>
<string name="dummy_button">Dummy Button</string>
<string name="dummy_content">DUMMY\nCONTENT</string>
<string name="title_activity_user__dashboard">User_Dashboard</string>
<string name="bbtext_MyCourses">myCourses</string>
<string name="bbtext_MyTeams">myTeams</string>
<!-- TODO: Remove or change this placeholder text -->
<string name="hello_blank_fragment">Hello blank fragment</string>
</resources>
Loading

0 comments on commit 4d85467

Please sign in to comment.