Skip to content
This repository has been archived by the owner on Sep 1, 2022. It is now read-only.

Commit

Permalink
Merge branch 'release/1.3.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
Amab committed Jul 17, 2016
2 parents 4d52aba + e1631c8 commit 249d0b7
Show file tree
Hide file tree
Showing 139 changed files with 2,044 additions and 5,038 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ import-summary.txt
local.properties
/SWADroid/SWADroid-SWADroid.iml
/SWADroid.iml
app/lint.xml
app/lint.xml
/SWADroid/google-services.json
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ Copyright (C) 2010, Juan Miguel Boyero Corral

[![Copyright and License](https://img.shields.io/badge/license-LGPLv3-green.svg?style=flat)](http://www.gnu.org/licenses/lgpl.html) SWADroid uses [Android DataFrameWork](http://code.google.com/p/androiddataframework/) library developed by [Javier Pérez Pacheco](http://www.javielinux.com/quiensoy.php) and licensed under [LGPLv3](http://www.gnu.org/licenses/lgpl.html).

[![Copyright and License](https://img.shields.io/badge/license-MIT-green.svg?style=flat)](http://www.opensource.org/licenses/mit-license.php) SWADroid uses [ksoap2-android](http://code.google.com/p/ksoap2-android) library developed by [Manfred Moser](https://github.com/mosabua) and licensed under [MIT](http://www.opensource.org/licenses/mit-license.php).
[![Copyright and License](https://img.shields.io/badge/license-MIT-green.svg?style=flat)](http://www.opensource.org/licenses/mit-license.php) SWADroid uses [ksoap2-android](https://github.com/simpligility/ksoap2-android) library developed by [Manfred Moser](https://github.com/mosabua) and licensed under [MIT](http://www.opensource.org/licenses/mit-license.php).

[![Copyright and License](https://img.shields.io/badge/license-Apache%202-green.svg?style=flat)](http://www.apache.org/licenses/LICENSE-2.0) SWADroid uses [ZXing](http://code.google.com/p/zxing/) library developed by [Sean Owen](https://github.com/srowen) and licensed under [Apache License 2.0](http://www.apache.org/licenses/LICENSE-2.0).
[![Copyright and License](https://img.shields.io/badge/license-Apache%202-green.svg?style=flat)](http://www.apache.org/licenses/LICENSE-2.0) SWADroid uses [ZXing Android Embedded](https://github.com/journeyapps/zxing-android-embedded) library developed by [journeyapps](https://github.com/journeyapps) and licensed under [Apache License 2.0](http://www.apache.org/licenses/LICENSE-2.0).

[![Copyright and License](https://img.shields.io/badge/license-Apache%202-green.svg?style=flat)](http://www.apache.org/licenses/LICENSE-2.0) SWADroid uses [Universal Image Loader](https://github.com/nostra13/Android-Universal-Image-Loader) library developed by [Sergey Tarasevich](https://github.com/nostra13) and licensed under [Apache License 2.0](http://www.apache.org/licenses/LICENSE-2.0).

Expand Down
2 changes: 1 addition & 1 deletion SWADroid.iml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.gradle" />
</content>
<orderEntry type="jdk" jdkName="Android API 3 Platform" jdkType="Android SDK" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
27 changes: 17 additions & 10 deletions SWADroid/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,21 @@ ext {
}

android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
compileSdkVersion 24
buildToolsVersion "24"

dexOptions {
maxProcessCount=2
javaMaxHeapSize "2g"
}

defaultConfig {
applicationId "es.ugr.swad.swadroid"
versionCode gitVersionCode
versionName gitVersionName

minSdkVersion 9
targetSdkVersion 23
targetSdkVersion 24

android.applicationVariants.all { variant ->
def appName
Expand Down Expand Up @@ -50,11 +56,12 @@ android {
}

dependencies {
compile 'com.android.support:support-v4:latest.release'
compile 'com.android.support:appcompat-v7:latest.release'
compile 'com.google.android.gms:play-services-analytics:latest.release'
compile 'com.google.code.ksoap2-android:ksoap2-android:latest.release'
compile 'commons-io:commons-io:latest.release'
compile 'com.nostra13.universalimageloader:universal-image-loader:latest.release'
compile 'com.google.zxing:core:2.1'
compile 'com.android.support:support-v4:24.0.0'
compile 'com.android.support:appcompat-v7:24.0.0'
compile 'com.google.android.gms:play-services-analytics:9.2.1'
compile 'com.google.code.ksoap2-android:ksoap2-android:3.6.1'
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'
}
56 changes: 41 additions & 15 deletions SWADroid/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.MANAGE_ACCOUNTS" />
<uses-permission android:name="android.permission.AUTHENTICATE_ACCOUNTS" />
<uses-permission android:name="android.permission.USE_CREDENTIALS" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" android:maxSdkVersion="22"/>
<uses-permission android:name="android.permission.MANAGE_ACCOUNTS" android:maxSdkVersion="22"/>
<uses-permission android:name="android.permission.AUTHENTICATE_ACCOUNTS" android:maxSdkVersion="22"/>
<uses-permission android:name="android.permission.USE_CREDENTIALS" android:maxSdkVersion="22" />
<uses-permission android:name="android.permission.READ_SYNC_SETTINGS" />
<uses-permission android:name="android.permission.WRITE_SYNC_SETTINGS" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
Expand Down Expand Up @@ -101,20 +101,14 @@
android:theme="@style/Theme.AppCompat.Translucent" >
</activity>
<activity
android:name=".modules.groups.Groups"
android:name=".modules.rollcall.ContinuousCaptureActivity"
android:label="@string/rollcallModuleLabel"
android:theme="@style/Theme.AppCompat.Translucent" >
android:theme="@style/Theme.AppCompat.Translucent">
</activity>
<activity
android:name="com.google.zxing.client.android.CaptureActivity"
android:screenOrientation="landscape"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
android:windowSoftInputMode="stateAlwaysHidden" >
<intent-filter>
<action android:name="es.ugr.swad.swadroid.android.SCAN" />

<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
android:name=".modules.groups.Groups"
android:label="@string/myGroupsModuleLabel"
android:theme="@style/Theme.AppCompat.Translucent" >
</activity>
<activity
android:name=".modules.courses.Courses"
Expand Down Expand Up @@ -328,6 +322,38 @@
android:name="android.content.SyncAdapter"
android:resource="@xml/sync_notifications" />
</service>
<!-- Optionally, register AnalyticsReceiver and AnalyticsService to support background
dispatching on non-Google Play devices -->
<receiver android:name="com.google.android.gms.analytics.AnalyticsReceiver"
android:enabled="true">
<intent-filter>
<action android:name="com.google.android.gms.analytics.ANALYTICS_DISPATCH" />
</intent-filter>
</receiver>
<service android:name="com.google.android.gms.analytics.AnalyticsService"
android:enabled="true"
android:exported="false"/>

<!-- Optionally, register CampaignTrackingReceiver and CampaignTrackingService to enable
installation campaign reporting -->
<receiver android:name="com.google.android.gms.analytics.CampaignTrackingReceiver"
android:exported="true">
<intent-filter>
<action android:name="com.android.vending.INSTALL_REFERRER" />
</intent-filter>
</receiver>
<service android:name="com.google.android.gms.analytics.CampaignTrackingService" />

<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="es.ugr.swad.swadroid.fileprovider"
android:exported="false"
android:grantUriPermissions="true">

<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_paths" />
</provider>
</application>

</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public class DataFramework {

private int mOpenInstances = 0;

private ArrayList<Table> mTables = new ArrayList<Table>();
private ArrayList<Table> mTables = new ArrayList<>();

private DataFrameworkCore mCore;

Expand Down Expand Up @@ -210,7 +210,7 @@ public ArrayList<Entity> getEntityList(String table, String where, String orderb
String[] fields = getTable(table).getFieldsToArray();
Cursor c = getCursor(table, fields, where, null, null, null, orderby, limit);

ArrayList<Entity> aux = new ArrayList<Entity>();
ArrayList<Entity> aux = new ArrayList<>();

c.moveToFirst();
while (!c.isAfterLast()) {
Expand Down
119 changes: 58 additions & 61 deletions SWADroid/src/main/java/com/android/dataframework/Entity.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,15 @@
import java.io.IOException;
import java.io.StringReader;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map.Entry;

public class Entity {

private String mTable;
private long mId = -1;
private long mForceId = -1;
protected HashMap<String, Object> mAttributes = new HashMap<String, Object>();
protected HashMap<String, Object> mMultilanguagesAttributes = new HashMap<String, Object>();
protected HashMap<String, Object> mAttributes = new HashMap<>();
protected HashMap<String, Object> mMultilanguagesAttributes = new HashMap<>();

/**
* Devuelve el siguiente _id
Expand Down Expand Up @@ -104,7 +103,7 @@ public String getTable() {
* @return true si es una actualizacion
*/
public boolean isUpdate() {
return (mId < 0)?false:true;
return mId >= 0;
}

/**
Expand All @@ -113,7 +112,7 @@ public boolean isUpdate() {
* @return true si es una nuevo registro
*/
public boolean isInsert() {
return (mId < 0)?true:false;
return (mId < 0);
}

/**
Expand Down Expand Up @@ -162,8 +161,7 @@ public String getString(String name)
*/
public int getDrawableIdentifier(String name)
{
int id = DataFramework.getInstance().getContext().getResources().getIdentifier(DataFramework.getInstance().getPackage() + ":drawable/"+getValue(name).toString(), null, null);
return id;
return DataFramework.getInstance().getContext().getResources().getIdentifier(DataFramework.getInstance().getPackage() + ":drawable/"+getValue(name).toString(), null, null);
}

/**
Expand All @@ -190,8 +188,7 @@ public BitmapDrawable getBitmapDrawable(String name)
{
int id = DataFramework.getInstance().getContext().getResources().getIdentifier(DataFramework.getInstance().getPackage() + ":drawable/"+getValue(name).toString(), null, null);
java.io.InputStream is = DataFramework.getInstance().getContext().getResources().openRawResource(id);
BitmapDrawable bmd = new BitmapDrawable(BitmapFactory.decodeStream(is));
return bmd;
return new BitmapDrawable(BitmapFactory.decodeStream(is));
}

/**
Expand Down Expand Up @@ -276,19 +273,18 @@ public String toString()
{
String[] arString = DataFramework.getInstance().getTable(mTable).getToString().split("%");
String out = "";
for (int i=0; i<arString.length; i++) {
if (isAttribute(arString[i]))
{
Field f = getTableObject().getField(arString[i]);
if (f.getType().equals("foreign-key")){
out += getEntity(arString[i]).toString();
}else{
out += getString(arString[i]);
for (String anArString : arString) {
if (isAttribute(anArString)) {
Field f = getTableObject().getField(anArString);
if (f.getType().equals("foreign-key")) {
out += getEntity(anArString).toString();
} else {
out += getString(anArString);
}
} else if (arString[i].equals(DataFramework.KEY_ID)) {
} else if (anArString.equals(DataFramework.KEY_ID)) {
out += mId;
} else {
out += arString[i];
out += anArString;
}
}
return out;
Expand Down Expand Up @@ -384,30 +380,38 @@ protected void loadData(Cursor c)
HashMap<String, Object> attribs = mAttributes; // Para reducir el acceso al heap.
Object[] attributeNames = attribs.keySet().toArray();
int attributeCount = attributeNames.length;

for (int i = 0; i < attributeCount; i++)
{
String attributeName = attributeNames[i].toString();

for (Object attributeName1 : attributeNames) {
String attributeName = attributeName1.toString();

Field f = getTableObject().getField(attributeName);

int indexField;
if (f.getType().equals("multilanguage")) {
indexField = c.getColumnIndexOrThrow(attributeName + "_" + DataFramework.getInstance().getCurrentLanguage());
} else {
indexField = c.getColumnIndexOrThrow(attributeName);
}

if (f.getType().equals("text") || f.getType().equals("multilanguage") || f.getType().equals("string-identifier") || f.getType().equals("drawable-identifier")){
attribs.put(attributeName, c.getString(indexField));
}else if (f.getType().equals("int")){
attribs.put(attributeName, c.getLong(indexField));
}else if (f.getType().equals("foreign-key")){
attribs.put(attributeName, c.getLong(indexField));
}else if (f.getType().equals("real")){
attribs.put(attributeName, c.getDouble(indexField));
}else{
attribs.put(attributeName, c.getString(indexField));

int indexField;
if (f.getType().equals("multilanguage")) {
indexField = c.getColumnIndexOrThrow(attributeName + "_" + DataFramework.getInstance().getCurrentLanguage());
} else {
indexField = c.getColumnIndexOrThrow(attributeName);
}

switch (f.getType()) {
case "text":
case "multilanguage":
case "string-identifier":
case "drawable-identifier":
attribs.put(attributeName, c.getString(indexField));
break;
case "int":
attribs.put(attributeName, c.getLong(indexField));
break;
case "foreign-key":
attribs.put(attributeName, c.getLong(indexField));
break;
case "real":
attribs.put(attributeName, c.getDouble(indexField));
break;
default:
attribs.put(attributeName, c.getString(indexField));
break;
}
}
}
Expand Down Expand Up @@ -585,11 +589,9 @@ public boolean save() {
}
}
}

Iterator<Entry<String, Object>> it = mMultilanguagesAttributes.entrySet().iterator();
while (it.hasNext()) {
Entry<String, Object> e = (Entry<String, Object>)it.next();
args.put(e.getKey().toString(), e.getValue().toString());

for (Entry<String, Object> e : mMultilanguagesAttributes.entrySet()) {
args.put(e.getKey(), e.getValue().toString());
}

if (isInsert()) {
Expand Down Expand Up @@ -636,15 +638,13 @@ private String getXml()

String result = "<entity>\n";
result += "<attribute name=\"_id\" value=\"" + mId + "\"/>\n";

for (int i = 0; i < attributeCount; i++)
{
if (!isNull(attributeNames[i].toString()))
{
result += "<attribute name=\"" + attributeNames[i].toString() + "\"" +
" value=\"" + getValue(attributeNames[i].toString()).toString() + "\"/>\n";
}
}

for (Object attributeName : attributeNames) {
if (!isNull(attributeName.toString())) {
result += "<attribute name=\"" + attributeName.toString() + "\"" +
" value=\"" + getValue(attributeName.toString()).toString() + "\"/>\n";
}
}

result += "</entity>\n";
return result;
Expand All @@ -659,7 +659,7 @@ public void loadFromXml(String xml)
try {

XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
XmlPullParser x = (XmlPullParser)factory.newPullParser();
XmlPullParser x = factory.newPullParser();
x.setInput(new StringReader(xml));

int eventType = x.getEventType();
Expand All @@ -682,14 +682,11 @@ public void loadFromXml(String xml)

eventType = x.next();
}
} catch (XmlPullParserException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
} catch (XmlPullParserException | IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -456,11 +456,7 @@ public class EntityIterator implements Iterator<Entity> {
@Override
public boolean hasNext()
{
if (mCursor.isLast() || mCursor.isAfterLast()){
return false;
}else{
return true;
}
return !(mCursor.isLast() || mCursor.isAfterLast());
}

@Override
Expand Down
Loading

0 comments on commit 249d0b7

Please sign in to comment.