diff --git a/.travis.yml b/.travis.yml index a4a76e479..6c122a360 100755 --- a/.travis.yml +++ b/.travis.yml @@ -44,6 +44,7 @@ cache: - "$HOME/android/.gradle/caches/" - "$HOME/android/.gradle/wrapper/" - "$HOME/.android/build-cache" + - "${TRAVIS_BUILD_DIR}/cache" before_install: - mkdir "$ANDROID_HOME/licenses" || true @@ -67,22 +68,21 @@ licenses: - 'google-gdk-license-.+' before_script: - - ./scripts/download_open_cv.sh + - ./scripts/setup_opencv.sh - echo "Starting AVD" - echo no | android create avd --force -n test -t android-22 --abi armeabi-v7a - emulator -avd test -no-audio -no-window & - android-wait-for-emulator - adb shell input keyevent 82 & + - bash scripts/prep-key.sh script: - ./gradlew spotlessCheck - - ./scripts/copy_opencv.sh - ./gradlew build - ./gradlew build connectedAndroidTest jacocoTestReport --stacktrace after_success: - bash <(curl -s https://codecov.io/bash) - - bash scripts/prep-key.sh - bash scripts/update-apk.sh notifications: diff --git a/Gemfile b/Gemfile index b16dd3fbc..afdd5c57f 100644 --- a/Gemfile +++ b/Gemfile @@ -2,3 +2,6 @@ source "https://rubygems.org" gem "danger" + + +gem "fastlane" \ No newline at end of file diff --git a/README.md b/README.md index c67827aac..26e6d50df 100755 --- a/README.md +++ b/README.md @@ -14,12 +14,12 @@ ## Screenshots

- - - - - - + + + + + +

@@ -108,6 +108,7 @@ Before you begin, you should have already downloaded the Android Studio SDK and - Copy all the files from *"OpenCV-android-sdk/sdk/native/3rdparty"* to *"phimpme-android/app/src/main/3rdparty"* (create directory if it doesn't exist) - Copy all the files from *"OpenCV-android-sdk/sdk/native/libs"* to *"phimpme-android/app/src/main/jniLibs"* (create directory if it doesn't exist) - Copy all the files from *"OpenCV-android-sdk/sdk/native/jni/include"* to *"phimpme-android/app/src/main/jni/include"* (create directory if it doesn't exist) + - Copy all the files from *"OpenCV-android-sdk/sdk/native/jni/staticlibs"* to *"phimpme-android/app/src/main/staticlibs"* (create directory if it doesn't exist) - Now build your project. If your build fails then try deleting these build directories *"phimpme-android/app/.externalNativeBuild"* and *"phimpme-android/app/build"*, if they exist and run the build again. 7. If build error still persist, try replacing ndk with ndk version 18b from [ndk-archives](https://developer.android.com/ndk/downloads/older_releases) . Once all build errors have been resolved, you should be all set to build the app and test it. @@ -128,102 +129,5 @@ Before you begin, you should have already downloaded the Android Studio SDK and ## License -This project is currently licensed under the GNU General Public License v3. A copy of [LICENSE](LICENSE.md) is to be present along with the source code. To obtain the software under a different license, please contact [FOSSASIA](http://fossasia.org/). - -## Maintainers -The project is maintained by -- Hon Nguyen ([@vanhonit](https://github.com/vanhonit)) -- Mario Behling ([@mariobehling](http://github.com/mariobehling)) - -## Developers - - - - - - - - - - - - - - - - -
-

- -

-
- Anant Prasad -
-

- - - -

-
-

- -

-
- Mohit Manuja -
-

- - - -

-
-

- -

-
- Pawan Pal -
-

- - - -

-
-

- -

-
- Subhankar Shah -
- -

- - - -

-
-

- -

-
- Vinay Sajjanapu -
-

- - - -

-
-

- -

-
- Saurav Vishal -
- -

- - - -

-
+This project is currently licensed under the GNU General Public License v3. A copy of [LICENSE](LICENSE.md) is to be present along with the source code. To obtain the software under a different license, please contact [FOSSASIA](https://fossasia.org/). + diff --git a/app/build.gradle b/app/build.gradle index 0c102c7e2..6efe16b81 100755 --- a/app/build.gradle +++ b/app/build.gradle @@ -14,11 +14,14 @@ plugins { apply plugin: 'com.android.application' apply plugin: 'jacoco-android' apply plugin: 'realm-android' +apply plugin: "com.github.b3er.local.properties" def keystorePropertiesFile = rootProject.file("sample_keystore.properties") def keystoreProperties = new Properties() +def LOCAL_KEY_PRESENT = project.hasProperty('SIGNING_KEY_FILE') && rootProject.file(SIGNING_KEY_FILE).exists() + keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) android { @@ -29,8 +32,8 @@ android { applicationId "org.fossasia.phimpme" minSdkVersion 21 targetSdkVersion 28 - versionCode 11 - versionName '1.8.0' + versionCode 12 + versionName '1.9.0' multiDexEnabled true testInstrumentationRunner 'android.support.test.runner.AndroidJUnitRunner' vectorDrawables.useSupportLibrary = true @@ -42,12 +45,31 @@ android { renderscriptSupportModeEnabled true } + signingConfigs { + if (TRAVIS_BUILD) { + release { + storeFile KEYSTORE_FILE + storePassword System.getenv("STORE_PASS") + keyAlias System.getenv("ALIAS") + keyPassword System.getenv("KEY_PASS") + } + } else if (LOCAL_KEY_PRESENT) { + release { + storeFile rootProject.file(SIGNING_KEY_FILE) + storePassword STORE_PASS + keyAlias ALIAS + keyPassword KEY_PASS + } + } + } + buildTypes { release { minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' - + if (LOCAL_KEY_PRESENT || TRAVIS_BUILD) + signingConfig signingConfigs.release } debug { testCoverageEnabled false @@ -166,10 +188,13 @@ dependencies { implementation 'com.github.shchurov:horizontalwheelview:0.9.5' implementation 'com.nostra13.universalimageloader:universal-image-loader:1.9.4' + //photoview + implementation 'com.github.chrisbanes:PhotoView:1.2.6' + //twitter implementation "com.twitter.sdk.android:twitter:$rootProject.twitterVersion" - implementation files('libs/twitter4j-core-3.0.5.jar') - implementation files('libs/twitter4j-media-support-3.0.5.jar') + implementation "org.twitter4j:twitter4j-core:3.0.5" + implementation "org.twitter4j:twitter4j-media-support:3.0.5" //cloud rail implementation 'com.cloudrail:cloudrail-si-android:2.20.1' @@ -181,14 +206,14 @@ dependencies { debugImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.1' releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.1' - //flickr - implementation files('libs/flickrj-android-2.1.0.jar') - //tumblr implementation('com.tumblr:jumblr:0.0.11') { exclude module: 'scribe' } + //flickr + implementation "com.googlecode.flickrj-android:flickrj-android:2.1.0" + //realm implementation 'com.uphyca:stetho_realm:2.0.0' @@ -203,10 +228,7 @@ dependencies { implementation project(':openCV') //pdk - implementation project(':pdk') - - //photoview - implementation project(':photoview') + implementation 'com.github.forkerknights:android-pdk:1.2b' //compressor implementation 'id.zelory:compressor:2.1.0' diff --git a/app/google-services.json b/app/google-services.json deleted file mode 100644 index 1b9e10718..000000000 --- a/app/google-services.json +++ /dev/null @@ -1,55 +0,0 @@ -{ - "project_info": { - "project_number": "694124204509", - "firebase_url": "https://fir-phimpme.firebaseio.com", - "project_id": "firebase-phimpme", - "storage_bucket": "firebase-phimpme.appspot.com" - }, - "client": [ - { - "client_info": { - "mobilesdk_app_id": "1:694124204509:android:02701b34429f0096", - "android_client_info": { - "package_name": "org.fossasia.phimpme" - } - }, - "oauth_client": [ - { - "client_id": "694124204509-omjd2gbfr3ne8ofvrbthdemi07ud1ohv.apps.googleusercontent.com", - "client_type": 3 - }, - { - "client_id": "694124204509-19313ehknt0dg0v2vt5rtoe970dfvfu2.apps.googleusercontent.com", - "client_type": 1, - "android_info": { - "package_name": "org.fossasia.phimpme", - "certificate_hash": "025178b10eb0141fd7ff9e4e38901fae68626c4d" - } - } - ], - "api_key": [ - { - "current_key": "AIzaSyAtp1-1MlW68dUKowAbz9mMrwT_yIo4q_E" - } - ], - "services": { - "analytics_service": { - "status": 1 - }, - "appinvite_service": { - "status": 2, - "other_platform_oauth_client": [ - { - "client_id": "694124204509-ccfm6f9777v6hb2houu8446dllilmrga.apps.googleusercontent.com", - "client_type": 3 - } - ] - }, - "ads_service": { - "status": 2 - } - } - } - ], - "configuration_version": "1" -} \ No newline at end of file diff --git a/app/gradle/wrapper/gradle-wrapper.jar b/app/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index 13372aef5..000000000 Binary files a/app/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/app/gradle/wrapper/gradle-wrapper.properties b/app/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index 04e285f34..000000000 --- a/app/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,6 +0,0 @@ -#Mon Dec 28 10:00:20 PST 2015 -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 diff --git a/app/gradlew b/app/gradlew deleted file mode 100644 index 9d82f7891..000000000 --- a/app/gradlew +++ /dev/null @@ -1,160 +0,0 @@ -#!/usr/bin/env bash - -############################################################################## -## -## Gradle start up script for UN*X -## -############################################################################## - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" - -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn ( ) { - echo "$*" -} - -die ( ) { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; -esac - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - -# Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=$((i+1)) - done - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac -fi - -# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules -function splitJvmOpts() { - JVM_OPTS=("$@") -} -eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS -JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" - -exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/app/gradlew.bat b/app/gradlew.bat deleted file mode 100644 index 8a0b282aa..000000000 --- a/app/gradlew.bat +++ /dev/null @@ -1,90 +0,0 @@ -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:init -@rem Get command-line arguments, handling Windowz variants - -if not "%OS%" == "Windows_NT" goto win9xME_args -if "%@eval[2+2]" == "4" goto 4NT_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* -goto execute - -:4NT_args -@rem Get arguments from the 4NT Shell from JP Software -set CMD_LINE_ARGS=%$ - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/app/src/main/java/org/fossasia/phimpme/MyApplication.java b/app/src/main/java/org/fossasia/phimpme/MyApplication.java index 14276dd1e..a2669ac17 100644 --- a/app/src/main/java/org/fossasia/phimpme/MyApplication.java +++ b/app/src/main/java/org/fossasia/phimpme/MyApplication.java @@ -89,12 +89,4 @@ protected void attachBaseContext(Context base) { public HandlingAlbums getAlbums() { return albums; } - - public void setAlbums(HandlingAlbums albums) { - this.albums = albums; - } - - public void updateAlbums() { - albums.loadAlbums(getApplicationContext()); - } } diff --git a/app/src/main/java/org/fossasia/phimpme/base/BasePresenter.java b/app/src/main/java/org/fossasia/phimpme/base/BasePresenter.java index d299da8eb..982578b5e 100644 --- a/app/src/main/java/org/fossasia/phimpme/base/BasePresenter.java +++ b/app/src/main/java/org/fossasia/phimpme/base/BasePresenter.java @@ -29,27 +29,7 @@ public void attachView(T mvpView) { mMvpView = mvpView; } - @Override - public void detachView() { - mMvpView = null; - } - - public boolean isViewAttached() { - return mMvpView != null; - } - public T getMvpView() { return mMvpView; } - - public void checkViewAttached() { - if (!isViewAttached()) throw new MvpViewNotAttachedException(); - } - - public static class MvpViewNotAttachedException extends RuntimeException { - public MvpViewNotAttachedException() { - super( - "Please call Presenter.attachView(MvpView) before" + " requesting data to the Presenter"); - } - } } diff --git a/app/src/main/java/org/fossasia/phimpme/base/Presenter.java b/app/src/main/java/org/fossasia/phimpme/base/Presenter.java index 4af97631d..7ac8b88fe 100644 --- a/app/src/main/java/org/fossasia/phimpme/base/Presenter.java +++ b/app/src/main/java/org/fossasia/phimpme/base/Presenter.java @@ -22,6 +22,4 @@ public interface Presenter { void attachView(V mvpView); - - void detachView(); } diff --git a/app/src/main/java/org/fossasia/phimpme/data/local/FavouriteImagesModel.java b/app/src/main/java/org/fossasia/phimpme/data/local/FavouriteImagesModel.java index d14c93bf0..d73d680c1 100644 --- a/app/src/main/java/org/fossasia/phimpme/data/local/FavouriteImagesModel.java +++ b/app/src/main/java/org/fossasia/phimpme/data/local/FavouriteImagesModel.java @@ -11,11 +11,6 @@ public class FavouriteImagesModel extends RealmObject { public FavouriteImagesModel() {} - public FavouriteImagesModel(String path, String description) { - this.path = path; - this.description = description; - } - public void setPath(String path) { this.path = path; } diff --git a/app/src/main/java/org/fossasia/phimpme/data/local/TrashBinRealmModel.java b/app/src/main/java/org/fossasia/phimpme/data/local/TrashBinRealmModel.java index b509611f6..997e343fc 100644 --- a/app/src/main/java/org/fossasia/phimpme/data/local/TrashBinRealmModel.java +++ b/app/src/main/java/org/fossasia/phimpme/data/local/TrashBinRealmModel.java @@ -13,17 +13,6 @@ public class TrashBinRealmModel extends RealmObject { public TrashBinRealmModel() {} - public TrashBinRealmModel(String oldpath, String newpath, String datetime, String timeperiod) { - this.oldpath = oldpath; - this.trashbinpath = newpath; - this.datetime = datetime; - this.timeperiod = timeperiod; - } - - public void setTrashbinpath(String trashbinpath) { - this.trashbinpath = trashbinpath; - } - public String getTrashbinpath() { return trashbinpath; } @@ -47,8 +36,4 @@ public String getOldpath() { public void setTimeperiod(String timeperiod) { this.timeperiod = timeperiod; } - - public String getTimeperiod() { - return timeperiod; - } } diff --git a/app/src/main/java/org/fossasia/phimpme/gallery/activities/LFMainActivity.java b/app/src/main/java/org/fossasia/phimpme/gallery/activities/LFMainActivity.java index 8c4901aae..5397ee834 100644 --- a/app/src/main/java/org/fossasia/phimpme/gallery/activities/LFMainActivity.java +++ b/app/src/main/java/org/fossasia/phimpme/gallery/activities/LFMainActivity.java @@ -8,6 +8,8 @@ import android.animation.Animator; import android.annotation.TargetApi; +import android.app.Dialog; +import android.app.ProgressDialog; import android.content.ContentResolver; import android.content.ContentUris; import android.content.Context; @@ -2042,13 +2044,23 @@ class DeletePhotos extends AsyncTask { private boolean succ = false; private int imagesUnfav = 0; + private Dialog dialog; @Override protected void onPreExecute() { + dialog = getLoadingDialog(context, "Deleting", false); + dialog.show(); swipeRefreshLayout.setRefreshing(true); super.onPreExecute(); } + private Dialog getLoadingDialog(Context context, String title, boolean canCancel) { + ProgressDialog dialog = new ProgressDialog(context); + dialog.setCancelable(canCancel); + dialog.setMessage(title); + return dialog; + } + @Override protected Boolean doInBackground(String... arg0) { // if in album mode, delete selected albums @@ -2190,6 +2202,7 @@ public void execute(Realm realm) { @Override protected void onPostExecute(Boolean result) { + dialog.dismiss(); if (result) { // in albumsMode, the selected albums have been deleted. if (albumsMode) { @@ -4503,6 +4516,7 @@ private class CopyPhotos extends AsyncTask { // private Snackbar snackbar; private ArrayList temp; private Boolean moveAction, copyAction, success; + private Dialog dialog; CopyPhotos(String path, Boolean moveAction, Boolean copyAction, LFMainActivity reference) { this.path = path; @@ -4513,11 +4527,20 @@ private class CopyPhotos extends AsyncTask { @Override protected void onPreExecute() { + dialog = getLoadingDialog(context, "Copying photos", false); + dialog.show(); LFMainActivity asyncActivityRef = reference.get(); asyncActivityRef.swipeRefreshLayout.setRefreshing(true); super.onPreExecute(); } + private Dialog getLoadingDialog(Context context, String title, boolean canCancel) { + ProgressDialog dialog = new ProgressDialog(context); + dialog.setCancelable(canCancel); + dialog.setMessage(title); + return dialog; + } + @Override protected Boolean doInBackground(String... arg0) { temp = storeTemporaryphotos(path); @@ -4535,6 +4558,7 @@ protected Boolean doInBackground(String... arg0) { @Override protected void onPostExecute(Boolean result) { + dialog.dismiss(); LFMainActivity asyncActivityRef = reference.get(); if (result) { if (!asyncActivityRef.all_photos) { diff --git a/app/src/main/java/org/fossasia/phimpme/gallery/util/Measure.java b/app/src/main/java/org/fossasia/phimpme/gallery/util/Measure.java index 388d3c48e..b94dd3c66 100644 --- a/app/src/main/java/org/fossasia/phimpme/gallery/util/Measure.java +++ b/app/src/main/java/org/fossasia/phimpme/gallery/util/Measure.java @@ -24,10 +24,6 @@ public static int getStatusBarHeight(Resources r) { return 0; } - public static int getNavBarHeight(Context ct) { - return getNavigationBarSize(ct).y; - } - public static Point getNavigationBarSize(Context context) { Point appUsableSize = getAppUsableScreenSize(context); Point realScreenSize = getRealScreenSize(context); diff --git a/app/src/main/java/org/fossasia/phimpme/gallery/util/PermissionUtils.java b/app/src/main/java/org/fossasia/phimpme/gallery/util/PermissionUtils.java index 41e06b27d..d146c664a 100644 --- a/app/src/main/java/org/fossasia/phimpme/gallery/util/PermissionUtils.java +++ b/app/src/main/java/org/fossasia/phimpme/gallery/util/PermissionUtils.java @@ -11,15 +11,6 @@ /** Created by dnld on 01/04/16. */ public final class PermissionUtils { - public static boolean checkPermissions(Context context, String... permissions) { - for (String permission : permissions) { - if (!checkPermission(context, permission)) { - return false; - } - } - return true; - } - private static boolean checkPermission(Context context, String permission) { return ContextCompat.checkSelfPermission(context, permission) == PackageManager.PERMISSION_GRANTED; diff --git a/app/src/main/java/org/fossasia/phimpme/gallery/util/ThemeHelper.java b/app/src/main/java/org/fossasia/phimpme/gallery/util/ThemeHelper.java index 2cea87225..c318eb370 100644 --- a/app/src/main/java/org/fossasia/phimpme/gallery/util/ThemeHelper.java +++ b/app/src/main/java/org/fossasia/phimpme/gallery/util/ThemeHelper.java @@ -243,18 +243,6 @@ public Drawable getPlaceHolder() { return null; } - public static Drawable getPlaceHolder(Context context) { - switch (getBaseTheme(context)) { - case DARK_THEME: - return ContextCompat.getDrawable(context, R.drawable.ic_empty); - case AMOLED_THEME: - return ContextCompat.getDrawable(context, R.drawable.ic_empty_amoled); - case LIGHT_THEME: - return ContextCompat.getDrawable(context, R.drawable.ic_empty_white); - } - return null; - } - public int getDialogStyle() { int style; switch (getBaseTheme()) { diff --git a/app/src/main/java/org/fossasia/phimpme/share/SharingActivity.java b/app/src/main/java/org/fossasia/phimpme/share/SharingActivity.java index d1d38fc69..2185049c4 100644 --- a/app/src/main/java/org/fossasia/phimpme/share/SharingActivity.java +++ b/app/src/main/java/org/fossasia/phimpme/share/SharingActivity.java @@ -736,7 +736,7 @@ protected void onPostExecute(Void aVoid) { } } - private class UploadToOneDrive extends AsyncTask { + /*private class UploadToOneDrive extends AsyncTask { Boolean success; @Override @@ -783,7 +783,7 @@ protected void onPostExecute(Void aVoid) { sendResult(FAIL); } } - } + }*/ @Override public void onBackPressed() { diff --git a/app/src/main/java/org/fossasia/phimpme/trashbin/TrashBinActivity.java b/app/src/main/java/org/fossasia/phimpme/trashbin/TrashBinActivity.java index 2d628e256..b4b8d0d33 100644 --- a/app/src/main/java/org/fossasia/phimpme/trashbin/TrashBinActivity.java +++ b/app/src/main/java/org/fossasia/phimpme/trashbin/TrashBinActivity.java @@ -2,6 +2,8 @@ import static org.fossasia.phimpme.utilities.ActivitySwitchHelper.context; +import android.app.Dialog; +import android.app.ProgressDialog; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; @@ -174,17 +176,6 @@ public void execute(Realm realm) { return list; } - private ArrayList getTrashObjectsLast() { - ArrayList list = new ArrayList<>(); - for (int i = 0; i < trashBinRealmModelRealmQuery.count(); i++) { - list.add( - trashBinRealmModelRealmQuery - .findAll() - .get((int) (trashBinRealmModelRealmQuery.count() - i - 1))); - } - return list; - } - private ArrayList loaduploaddata() { ArrayList data = new ArrayList<>(); ArrayList binRealmModelArrayList = getTrashObjects(); @@ -280,13 +271,23 @@ public void onDelete(final int position) { class DeleteAll extends AsyncTask { private final Boolean[] deleted = {false}; + private Dialog dialog; @Override protected void onPreExecute() { + dialog = getLoadingDialog(context, "Deleting all photos", false); + dialog.show(); swipeRefreshLayout.setRefreshing(true); super.onPreExecute(); } + private Dialog getLoadingDialog(Context context, String title, boolean canCancel) { + ProgressDialog dialog = new ProgressDialog(context); + dialog.setCancelable(canCancel); + dialog.setMessage(title); + return dialog; + } + @Override protected Void doInBackground(Void... voids) { Realm realm = Realm.getDefaultInstance(); @@ -310,6 +311,7 @@ public void execute(Realm realm) { protected void onPostExecute(Void aVoid) { swipeRefreshLayout.setRefreshing(false); super.onPostExecute(aVoid); + dialog.dismiss(); if (deleted[0] && trashBinRealmModelRealmQuery.count() == 0) { swipeRefreshLayout.setEnabled(false); emptyView.setVisibility(View.VISIBLE); @@ -325,10 +327,13 @@ protected void onPostExecute(Void aVoid) { class RestoreAll extends AsyncTask { private int count = 0, originalCount = 0; + private Dialog dialog; @Override protected void onPreExecute() { super.onPreExecute(); + dialog = getLoadingDialog(context, "Restoring", false); + dialog.show(); swipeRefreshLayout.setRefreshing(true); } @@ -350,9 +355,17 @@ protected Void doInBackground(Void... voids) { return null; } + private Dialog getLoadingDialog(Context context, String title, boolean canCancel) { + ProgressDialog dialog = new ProgressDialog(context); + dialog.setCancelable(canCancel); + dialog.setMessage(title); + return dialog; + } + @Override protected void onPostExecute(Void aVoid) { super.onPostExecute(aVoid); + dialog.dismiss(); swipeRefreshLayout.setRefreshing(false); trashBinAdapter.setResults(getTrashObjects()); if (trashBinRealmModelRealmQuery.count() == 0) { diff --git a/app/src/main/java/org/fossasia/phimpme/trashbin/TrashBinAdapter.java b/app/src/main/java/org/fossasia/phimpme/trashbin/TrashBinAdapter.java index 052fee267..0d800c8f6 100644 --- a/app/src/main/java/org/fossasia/phimpme/trashbin/TrashBinAdapter.java +++ b/app/src/main/java/org/fossasia/phimpme/trashbin/TrashBinAdapter.java @@ -6,13 +6,13 @@ import android.media.MediaScannerConnection; import android.net.Uri; import android.os.Environment; -import android.support.v7.util.DiffUtil; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; +import android.widget.LinearLayout; import android.widget.PopupMenu; import android.widget.TextView; import butterknife.BindView; @@ -27,11 +27,11 @@ import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; -import java.util.List; import org.fossasia.phimpme.R; import org.fossasia.phimpme.data.local.TrashBinRealmModel; import org.fossasia.phimpme.gallery.util.ContentHelper; import org.fossasia.phimpme.gallery.util.StringUtils; +import org.fossasia.phimpme.gallery.util.ThemeHelper; import org.fossasia.phimpme.utilities.BasicCallBack; public class TrashBinAdapter extends RecyclerView.Adapter { @@ -40,10 +40,12 @@ public class TrashBinAdapter extends RecyclerView.Adapter list, BasicCallBack basicCallBack) { trashItemsList = list; this.basicCallBack = basicCallBack; + theme = new ThemeHelper(context); } public interface OnDeleteClickListener { @@ -113,6 +115,12 @@ public boolean onMenuItemClick(MenuItem menuItem) { menu.show(); } }); + holder.popupMenuButton.setTextColor(theme.getTextColor()); + holder.date.setTextColor(theme.getTextColor()); + holder.deleteDate.setTextColor(theme.getTextColor()); + holder.deleteTime.setTextColor(theme.getTextColor()); + holder.time.setTextColor(theme.getTextColor()); + holder.deleteDetails.setBackgroundColor(theme.getBackgroundColor()); } } @@ -203,14 +211,6 @@ private boolean deletePermanent(TrashBinRealmModel trashBinRealmModel) { return succ; } - public void updateTrashListItems(List trashList) { - final TrashDiffCallback diffCallback = new TrashDiffCallback(this.trashItemsList, trashList); - final DiffUtil.DiffResult diffResult = DiffUtil.calculateDiff(diffCallback); - this.trashItemsList.clear(); - this.trashItemsList.addAll(trashList); - diffResult.dispatchUpdatesTo(this); - } - public void setResults(ArrayList trashItemsList) { this.trashItemsList = trashItemsList; notifyDataSetChanged(); @@ -239,6 +239,15 @@ public static class ViewHolder extends RecyclerView.ViewHolder { @BindView(R.id.textViewOptions) public TextView popupMenuButton; + @BindView(R.id.date) + public TextView date; + + @BindView(R.id.time) + public TextView time; + + @BindView(R.id.delete_details) + public LinearLayout deleteDetails; + public ViewHolder(View itemView) { super(itemView); ButterKnife.bind(this, itemView); diff --git a/app/src/main/java/org/fossasia/phimpme/trashbin/TrashDiffCallback.java b/app/src/main/java/org/fossasia/phimpme/trashbin/TrashDiffCallback.java deleted file mode 100644 index 2da68d17d..000000000 --- a/app/src/main/java/org/fossasia/phimpme/trashbin/TrashDiffCallback.java +++ /dev/null @@ -1,41 +0,0 @@ -package org.fossasia.phimpme.trashbin; - -import android.support.v7.util.DiffUtil; -import java.util.List; -import org.fossasia.phimpme.data.local.TrashBinRealmModel; - -public class TrashDiffCallback extends DiffUtil.Callback { - - private final List oldTrashList; - private final List newTrashList; - - public TrashDiffCallback( - List oldTrashList, List newTrashList) { - this.oldTrashList = oldTrashList; - this.newTrashList = newTrashList; - } - - @Override - public int getOldListSize() { - return oldTrashList.size(); - } - - @Override - public int getNewListSize() { - return newTrashList.size(); - } - - @Override - public boolean areItemsTheSame(int oldItemPosition, int newItemPosition) { - return oldTrashList.get(oldItemPosition).getTrashbinpath() - == newTrashList.get(newItemPosition).getTrashbinpath(); - } - - @Override - public boolean areContentsTheSame(int oldItemPosition, int newItemPosition) { - final TrashBinRealmModel oldEmployee = oldTrashList.get(oldItemPosition); - final TrashBinRealmModel newEmployee = newTrashList.get(newItemPosition); - - return oldEmployee.getTrashbinpath().equals(newEmployee.getTrashbinpath()); - } -} diff --git a/app/src/main/java/org/fossasia/phimpme/uploadhistory/UploadHistoryAdapter.java b/app/src/main/java/org/fossasia/phimpme/uploadhistory/UploadHistoryAdapter.java index e2373a49e..3a20be6ea 100644 --- a/app/src/main/java/org/fossasia/phimpme/uploadhistory/UploadHistoryAdapter.java +++ b/app/src/main/java/org/fossasia/phimpme/uploadhistory/UploadHistoryAdapter.java @@ -5,12 +5,12 @@ import android.net.Uri; import android.support.v4.content.ContextCompat; -import android.support.v7.util.DiffUtil; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; +import android.widget.LinearLayout; import android.widget.TextView; import butterknife.BindView; import butterknife.ButterKnife; @@ -22,9 +22,9 @@ import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; -import java.util.List; import org.fossasia.phimpme.R; import org.fossasia.phimpme.data.local.UploadHistoryRealmModel; +import org.fossasia.phimpme.gallery.util.ThemeHelper; /** Created by pa1pal on 17/08/17. */ public class UploadHistoryAdapter extends RecyclerView.Adapter { @@ -33,9 +33,11 @@ public class UploadHistoryAdapter extends RecyclerView.Adapter uploadList) { - final UploadHisDiffCallback diffCallback = - new UploadHisDiffCallback(this.realmResult, uploadList); - final DiffUtil.DiffResult diffResult = DiffUtil.calculateDiff(diffCallback); - this.realmResult.clear(); - this.realmResult.addAll(uploadList); - diffResult.dispatchUpdatesTo(this); - } - public void setResults(ArrayList realmResult) { this.realmResult = realmResult; notifyDataSetChanged(); @@ -136,6 +136,15 @@ public static class ViewHolder extends RecyclerView.ViewHolder { @BindView(R.id.account_image_share) ImageView accountImageShare; + @BindView(R.id.upload_data) + LinearLayout uploadData; + + @BindView(R.id.time) + TextView time; + + @BindView(R.id.date) + TextView date; + public ViewHolder(View itemView) { super(itemView); ButterKnife.bind(this, itemView); diff --git a/app/src/main/java/org/fossasia/phimpme/utilities/SnackBarHandler.java b/app/src/main/java/org/fossasia/phimpme/utilities/SnackBarHandler.java index ce0b8590e..d5759afda 100644 --- a/app/src/main/java/org/fossasia/phimpme/utilities/SnackBarHandler.java +++ b/app/src/main/java/org/fossasia/phimpme/utilities/SnackBarHandler.java @@ -77,20 +77,7 @@ public static Snackbar show(View view, int res) { return show(view, ActivitySwitchHelper.getContext().getResources().getString(res)); } - public static void showWithBottomMargin(View view, int res, int duration, int bottomMargin) { - showWithBottomMargin( - view, - ActivitySwitchHelper.getContext().getResources().getString(res), - bottomMargin, - duration); - } - public static Snackbar showWithBottomMargin(View view, String text, int bottomMargin) { return showWithBottomMargin(view, text, bottomMargin, Snackbar.LENGTH_LONG); } - - public static void showWithBottomMargin(View view, int res, int bottomMargin) { - showWithBottomMargin( - view, ActivitySwitchHelper.getContext().getResources().getString(res), bottomMargin); - } } diff --git a/app/src/main/java/org/fossasia/phimpme/utilities/Utils.java b/app/src/main/java/org/fossasia/phimpme/utilities/Utils.java index e6a8e9092..370b4288d 100644 --- a/app/src/main/java/org/fossasia/phimpme/utilities/Utils.java +++ b/app/src/main/java/org/fossasia/phimpme/utilities/Utils.java @@ -17,14 +17,11 @@ import android.graphics.BitmapFactory; import android.net.ConnectivityManager; import android.net.NetworkInfo; -import android.net.Uri; -import android.provider.MediaStore; import android.speech.RecognizerIntent; import android.support.annotation.NonNull; import android.support.design.widget.Snackbar; import android.util.Base64; import android.view.View; -import android.webkit.MimeTypeMap; import io.realm.Realm; import io.realm.RealmQuery; import io.realm.RealmResults; @@ -141,24 +138,6 @@ public static ArrayList getSharableAccountsList() { return list; } - public static Uri getImageUri(Context inContext, String imagePath) { - Bitmap inImage = getBitmapFromPath(imagePath); - ByteArrayOutputStream bytes = new ByteArrayOutputStream(); - inImage.compress(Bitmap.CompressFormat.JPEG, 100, bytes); - String path = - MediaStore.Images.Media.insertImage(inContext.getContentResolver(), inImage, "Title", null); - return Uri.parse(path); - } - - public static String getMimeType(String url) { - String type = null; - String extension = MimeTypeMap.getFileExtensionFromUrl(url); - if (extension != null) { - type = MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension); - } - return type; - } - public static boolean checkNetwork(Context context, @NonNull View view) { if (isInternetOn(context)) { return true; diff --git a/app/src/main/jni/filters.cpp b/app/src/main/jni/filters.cpp index adf45cf95..777b40a93 100644 --- a/app/src/main/jni/filters.cpp +++ b/app/src/main/jni/filters.cpp @@ -717,72 +717,4 @@ void applyWhiteYellowTint(cv::Mat &src, cv::Mat &dst, int val) { } } -void applyOilPaintingEffect(cv::Mat &src,cv::Mat &dst, int val){ - register int x, y; - cvtColor(src, src, CV_BGRA2BGR); - dst = Mat::zeros(src.size(), src.type()); - - int height = src.rows; - int width = src.cols; - int brushSize = val/13; - int levels = 20; - - int* countIntensity = new int[levels]; - int* redAverage = new int[levels]; - int* greenAverage = new int[levels]; - int* blueAverage = new int[levels]; - - for (y = brushSize; y < height - brushSize; y++) { - for (x = brushSize; x < width - brushSize; x++) { - for(int i = 0; i < levels; i++) - { - countIntensity[i] = 0; - redAverage[i] = 0; - greenAverage[i] = 0; - blueAverage[i] = 0; - } - - for(int j = -brushSize; j <= brushSize; j++) - { - for(int i = -brushSize; i <= brushSize; i++) - { - double b = src.at(y+j, x+i)[0]; - double g = src.at(y+j, x+i)[1]; - double r = src.at(y+j, x+i)[2]; - - int nCurIntensity = ( ( ( r + g + b ) / 3.0 ) * levels ) / 255; - int tmp = nCurIntensity; - countIntensity[tmp]++; - - blueAverage[tmp] = blueAverage[tmp] + b; - greenAverage[tmp] = greenAverage[tmp] + g; - redAverage[tmp] = redAverage[tmp] + r; - } - } - - int curMax = 0; - int maxIndex = 0; - for( int i = 0; i < levels; i++ ) - { - if( countIntensity[i] > curMax ) - { - curMax = countIntensity[i]; - maxIndex = i; - } - } - - double tmpB = blueAverage[maxIndex] / curMax; - double tmpG = greenAverage[maxIndex] / curMax; - double tmpR = redAverage[maxIndex] / curMax; - Vec3b pixelColor(tmpB,tmpG,tmpR); - dst.at(y,x) = pixelColor; - - } - } - delete[] (redAverage); - delete[] (blueAverage); - delete[] (greenAverage); - delete[] (countIntensity); -} - } diff --git a/app/src/main/jni/filters.h b/app/src/main/jni/filters.h index 802e16504..c94680e19 100644 --- a/app/src/main/jni/filters.h +++ b/app/src/main/jni/filters.h @@ -132,5 +132,4 @@ void applyPencilSketch(cv::Mat &src, cv::Mat &dst, int val); void applyRedBlueEffect(cv::Mat &src, cv::Mat &dst, int val); void applyRedGreenFilter(cv::Mat &src, cv::Mat &dst, int val); void applyWhiteYellowTint(cv::Mat &src, cv::Mat &dst, int val); -void applyOilPaintingEffect(cv::Mat &src, cv::Mat &dst, int val); } \ No newline at end of file diff --git a/app/src/main/jni/main_processing.cpp b/app/src/main/jni/main_processing.cpp index e448948af..482362949 100644 --- a/app/src/main/jni/main_processing.cpp +++ b/app/src/main/jni/main_processing.cpp @@ -95,9 +95,6 @@ extern "C" { case 24: applyWhiteYellowTint(src, dst, val); break; - case 25: - applyOilPaintingEffect(src, dst, val); - break; default: int lowThreshold = val; diff --git a/app/src/main/res/layout/trashbin_item_view.xml b/app/src/main/res/layout/trashbin_item_view.xml index 32415ebd6..38e5f8b14 100644 --- a/app/src/main/res/layout/trashbin_item_view.xml +++ b/app/src/main/res/layout/trashbin_item_view.xml @@ -1,103 +1,107 @@ - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + android:layout_gravity="center" + android:layout_margin="@dimen/very_small_margin" + android:foreground="@drawable/ripple" + app:cardCornerRadius="@dimen/size_7" + app:cardElevation="@dimen/size_3" + app:cardMaxElevation="@dimen/size_3"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/upload_history_item_view.xml b/app/src/main/res/layout/upload_history_item_view.xml index a6437a3ec..f5be96bb6 100644 --- a/app/src/main/res/layout/upload_history_item_view.xml +++ b/app/src/main/res/layout/upload_history_item_view.xml @@ -1,20 +1,19 @@ + xmlns:app="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="vertical"> + app:cardCornerRadius="@dimen/size_7" + app:cardElevation="@dimen/size_3" + app:cardMaxElevation="@dimen/size_3"> + android:scaleType="centerCrop" /> - + + android:textStyle="bold" /> + android:textSize="@dimen/sub_medium_text" /> - + + android:textStyle="bold" /> + android:textSize="@dimen/sub_medium_text" /> @@ -85,12 +89,12 @@ android:id="@+id/account_image_share" android:layout_width="@dimen/size_30dp" android:layout_height="@dimen/size_30dp" - android:layout_gravity="center" - app:srcCompat="@drawable/ic_launcher_vector" android:layout_below="@+id/upload_image" android:layout_alignParentEnd="true" + android:layout_gravity="center" + android:layout_marginTop="@dimen/margin_14dp" android:layout_marginEnd="@dimen/alternate_margin" - android:layout_marginTop="@dimen/margin_14dp"/> + app:srcCompat="@drawable/ic_launcher_vector" /> diff --git a/app/src/main/res/values/arrays.xml b/app/src/main/res/values/arrays.xml index e17e70078..672d933b9 100644 --- a/app/src/main/res/values/arrays.xml +++ b/app/src/main/res/values/arrays.xml @@ -689,7 +689,6 @@ Violet Tone Yellow Enhance Navajo Enhance - Oil Painting diff --git a/build.gradle b/build.gradle index 3490138ab..bf7c0c0d7 100755 --- a/build.gradle +++ b/build.gradle @@ -11,13 +11,16 @@ buildscript { url 'https://maven.google.com/' name 'Google' } + + maven { + url "https://plugins.gradle.org/m2/" + } } dependencies { - classpath 'com.android.tools.build:gradle:3.4.1' + classpath 'com.android.tools.build:gradle:3.4.2' classpath 'com.dicedmelon.gradle:jacoco-android:0.1.4' classpath "io.realm:realm-gradle-plugin:$realm_version" - - + classpath "gradle.plugin.com.github.b3er.local.properties:local-properties-plugin:1.1" } } @@ -33,6 +36,11 @@ allprojects { name 'Google' } } + + ext { + KEYSTORE_FILE = rootProject.file('scripts/key.jks') + TRAVIS_BUILD = System.getenv("TRAVIS") == "true" && KEYSTORE_FILE.exists() + } } ext { diff --git a/fastlane/Appfile b/fastlane/Appfile new file mode 100644 index 000000000..b58e8506f --- /dev/null +++ b/fastlane/Appfile @@ -0,0 +1,2 @@ +json_key_file("./scripts/fastlane.json") # Path to the json secret file - Follow https://docs.fastlane.tools/actions/supply/#setup to get one +package_name("org.fossasia.phimpme") # e.g. com.krausefx.app diff --git a/fastlane/Fastfile b/fastlane/Fastfile new file mode 100644 index 000000000..19c557cc6 --- /dev/null +++ b/fastlane/Fastfile @@ -0,0 +1,38 @@ +# This file contains the fastlane.tools configuration +# You can find the documentation at https://docs.fastlane.tools +# +# For a list of all available actions, check out +# +# https://docs.fastlane.tools/actions +# +# For a list of all available plugins, check out +# +# https://docs.fastlane.tools/plugins/available-plugins +# + +# Uncomment the line if you want fastlane to automatically update itself +# update_fastlane + +default_platform(:android) + +platform :android do + desc "Runs all the tests" + lane :test do + gradle(task: "test") + end + + desc "Submit a new Beta Build to Crashlytics Beta" + lane :beta do + gradle(task: "clean assembleRelease") + crashlytics + + # sh "your_script.sh" + # You can also use other beta testing services here + end + + desc "Deploy a new version to the Google Play" + lane :deploy do + gradle(task: "clean assembleRelease") + upload_to_play_store + end +end diff --git a/fastlane/metadata/android/en-US/changelogs/1.txt b/fastlane/metadata/android/en-US/changelogs/1.txt new file mode 100644 index 000000000..054d5920e --- /dev/null +++ b/fastlane/metadata/android/en-US/changelogs/1.txt @@ -0,0 +1 @@ +First alpha release \ No newline at end of file diff --git a/fastlane/metadata/android/en-US/changelogs/11.txt b/fastlane/metadata/android/en-US/changelogs/11.txt new file mode 100644 index 000000000..1c2104d02 --- /dev/null +++ b/fastlane/metadata/android/en-US/changelogs/11.txt @@ -0,0 +1 @@ +Major enhancements and bug fixes \ No newline at end of file diff --git a/fastlane/metadata/android/en-US/changelogs/2.txt b/fastlane/metadata/android/en-US/changelogs/2.txt new file mode 100644 index 000000000..054d5920e --- /dev/null +++ b/fastlane/metadata/android/en-US/changelogs/2.txt @@ -0,0 +1 @@ +First alpha release \ No newline at end of file diff --git a/fastlane/metadata/android/en-US/changelogs/3.txt b/fastlane/metadata/android/en-US/changelogs/3.txt new file mode 100644 index 000000000..054d5920e --- /dev/null +++ b/fastlane/metadata/android/en-US/changelogs/3.txt @@ -0,0 +1 @@ +First alpha release \ No newline at end of file diff --git a/fastlane/metadata/android/en-US/changelogs/4.txt b/fastlane/metadata/android/en-US/changelogs/4.txt new file mode 100644 index 000000000..054d5920e --- /dev/null +++ b/fastlane/metadata/android/en-US/changelogs/4.txt @@ -0,0 +1 @@ +First alpha release \ No newline at end of file diff --git a/fastlane/metadata/android/en-US/changelogs/5.txt b/fastlane/metadata/android/en-US/changelogs/5.txt new file mode 100644 index 000000000..6083863c9 --- /dev/null +++ b/fastlane/metadata/android/en-US/changelogs/5.txt @@ -0,0 +1,4 @@ +Major Bug Fixes. +Share to whatsapp working +Editing optimized +Camera feature enhanced \ No newline at end of file diff --git a/fastlane/metadata/android/en-US/changelogs/6.txt b/fastlane/metadata/android/en-US/changelogs/6.txt new file mode 100644 index 000000000..7874ef627 --- /dev/null +++ b/fastlane/metadata/android/en-US/changelogs/6.txt @@ -0,0 +1,2 @@ +Fast loading of images in Share Activity +Upload history feature added \ No newline at end of file diff --git a/fastlane/metadata/android/en-US/changelogs/7.txt b/fastlane/metadata/android/en-US/changelogs/7.txt new file mode 100644 index 000000000..f28dd6f6c --- /dev/null +++ b/fastlane/metadata/android/en-US/changelogs/7.txt @@ -0,0 +1,5 @@ +Bug fixes and improvements. +Feature to maintain a favorite collection of images. +Option to print photos. +Playing a slideshow of images. +New features in the Edit image functionality. \ No newline at end of file diff --git a/fastlane/metadata/android/en-US/changelogs/8.txt b/fastlane/metadata/android/en-US/changelogs/8.txt new file mode 100644 index 000000000..4d82c6936 --- /dev/null +++ b/fastlane/metadata/android/en-US/changelogs/8.txt @@ -0,0 +1,5 @@ +- Bug Fixes and improvements. +- Feature to compress pictures in size and dimensions. +- Trash Bin to keep track of the deleted items. +- Option to restore deleted images. +- Option to add a security question of choice to be used for the case of forgot password. \ No newline at end of file diff --git a/fastlane/metadata/android/en-US/changelogs/9.txt b/fastlane/metadata/android/en-US/changelogs/9.txt new file mode 100644 index 000000000..5afd857c0 --- /dev/null +++ b/fastlane/metadata/android/en-US/changelogs/9.txt @@ -0,0 +1 @@ +Bug Fixes and Improvements \ No newline at end of file diff --git a/fastlane/metadata/android/en-US/full_description.txt b/fastlane/metadata/android/en-US/full_description.txt new file mode 100644 index 000000000..4d82d4d76 --- /dev/null +++ b/fastlane/metadata/android/en-US/full_description.txt @@ -0,0 +1,32 @@ +Do you have many different apps in your Android Phone for clicking images, editing and sharing, that don't respect your privacy? Now clean your phone. Phimpme is here with all the features efficiently packaged into a single Free and Open Source application. + +Capture your moments with the app camera using all kinds of advanced functionalities, auto, and manual camera controls to click your perfect shot in one go and share it with the world. + +Phimp.me comes with tons of features while it respects your privacy. We don't store any of your data. Experts are able to evaluate the Open Source code of the application independently. + +Features: + +★Click images ★ Edit images ★ Share ★ + +1. You can use your voice actions to invoke Camera, Just say "Ok Google click a picture". You can also select front and rear camera based on voice. + +2. Browse the local gallery inside the app with folder and all photos mode. Copy, move to images, add description the images. + +3. Edit images with various advanced filters, optimized performance using OpenCV library. + +4. Enhance contrast, hue, saturation, temperature, tint, and sharpness of the image. + +5. Crop and rotate feature from Transform section. + +6. Apply different stickers of facial, express, objects, comments, wishes, emojis, hashtag + +7. You can also write anything on images in your handwriting. + +8. To fast the process, the user can use the undo and redo features present in the editor. + +9. Finally, you can share the image to the world using many connected social accounts and cloud storage services. + +Website: http://Phimp.me +Want to contribute: https://github.com/fossasia/phimpme-android/ + +Please write us your suggestions and feedback to make this app wonderful. We appreciate your suggestions & feedbacks and will surely consider them for the future updates. \ No newline at end of file diff --git a/fastlane/metadata/android/en-US/images/icon.png b/fastlane/metadata/android/en-US/images/icon.png new file mode 100644 index 000000000..75956f95b Binary files /dev/null and b/fastlane/metadata/android/en-US/images/icon.png differ diff --git a/docs/images/ss_1.png b/fastlane/metadata/android/en-US/images/phoneScreenshots/ss_1.png similarity index 100% rename from docs/images/ss_1.png rename to fastlane/metadata/android/en-US/images/phoneScreenshots/ss_1.png diff --git a/docs/images/ss_2.png b/fastlane/metadata/android/en-US/images/phoneScreenshots/ss_2.png similarity index 100% rename from docs/images/ss_2.png rename to fastlane/metadata/android/en-US/images/phoneScreenshots/ss_2.png diff --git a/docs/images/ss_3.png b/fastlane/metadata/android/en-US/images/phoneScreenshots/ss_3.png similarity index 100% rename from docs/images/ss_3.png rename to fastlane/metadata/android/en-US/images/phoneScreenshots/ss_3.png diff --git a/docs/images/ss_4.png b/fastlane/metadata/android/en-US/images/phoneScreenshots/ss_4.png similarity index 100% rename from docs/images/ss_4.png rename to fastlane/metadata/android/en-US/images/phoneScreenshots/ss_4.png diff --git a/docs/images/ss_5.png b/fastlane/metadata/android/en-US/images/phoneScreenshots/ss_5.png similarity index 100% rename from docs/images/ss_5.png rename to fastlane/metadata/android/en-US/images/phoneScreenshots/ss_5.png diff --git a/docs/images/ss_6.png b/fastlane/metadata/android/en-US/images/phoneScreenshots/ss_6.png similarity index 100% rename from docs/images/ss_6.png rename to fastlane/metadata/android/en-US/images/phoneScreenshots/ss_6.png diff --git a/fastlane/metadata/android/en-US/short_description.txt b/fastlane/metadata/android/en-US/short_description.txt new file mode 100644 index 000000000..b0fdea219 --- /dev/null +++ b/fastlane/metadata/android/en-US/short_description.txt @@ -0,0 +1 @@ +Open Source image app to capture, edit and to share your moments with the world. \ No newline at end of file diff --git a/fastlane/metadata/android/en-US/title.txt b/fastlane/metadata/android/en-US/title.txt new file mode 100644 index 000000000..ac382c2e5 --- /dev/null +++ b/fastlane/metadata/android/en-US/title.txt @@ -0,0 +1 @@ +Phimp.me \ No newline at end of file diff --git a/fastlane/metadata/android/en-US/video.txt b/fastlane/metadata/android/en-US/video.txt new file mode 100644 index 000000000..e69de29bb diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 13372aef5..87b738cbd 100755 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index cc8b08ea7..c4486d47d 100755 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,5 @@ -#Fri May 31 20:35:04 IST 2019 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip diff --git a/gradlew b/gradlew index 9d82f7891..af6708ff2 100755 --- a/gradlew +++ b/gradlew @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/usr/bin/env sh ############################################################################## ## @@ -6,20 +6,38 @@ ## ############################################################################## -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null APP_NAME="Gradle" APP_BASE_NAME=`basename "$0"` +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m"' + # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD="maximum" -warn ( ) { +warn () { echo "$*" } -die ( ) { +die () { echo echo "$*" echo @@ -30,6 +48,7 @@ die ( ) { cygwin=false msys=false darwin=false +nonstop=false case "`uname`" in CYGWIN* ) cygwin=true @@ -40,26 +59,11 @@ case "`uname`" in MINGW* ) msys=true ;; + NONSTOP* ) + nonstop=true + ;; esac -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null - CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar # Determine the Java command to use to start the JVM. @@ -85,7 +89,7 @@ location of your Java installation." fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then MAX_FD_LIMIT=`ulimit -H -n` if [ $? -eq 0 ] ; then if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then @@ -150,11 +154,19 @@ if $cygwin ; then esac fi -# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules -function splitJvmOpts() { - JVM_OPTS=("$@") +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " } -eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS -JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" +APP_ARGS=$(save "$@") + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then + cd "$(dirname "$0")" +fi -exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" +exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat index aec99730b..0f8d5937c 100755 --- a/gradlew.bat +++ b/gradlew.bat @@ -8,14 +8,14 @@ @rem Set local scope for the variables with windows NT shell if "%OS%"=="Windows_NT" setlocal -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= - set DIRNAME=%~dp0 if "%DIRNAME%" == "" set DIRNAME=. set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" + @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome @@ -46,10 +46,9 @@ echo location of your Java installation. goto fail :init -@rem Get command-line arguments, handling Windowz variants +@rem Get command-line arguments, handling Windows variants if not "%OS%" == "Windows_NT" goto win9xME_args -if "%@eval[2+2]" == "4" goto 4NT_args :win9xME_args @rem Slurp the command line arguments. @@ -60,11 +59,6 @@ set _SKIP=2 if "x%~1" == "x" goto execute set CMD_LINE_ARGS=%* -goto execute - -:4NT_args -@rem Get arguments from the 4NT Shell from JP Software -set CMD_LINE_ARGS=%$ :execute @rem Setup the command line diff --git a/scripts/.gitignore b/scripts/.gitignore new file mode 100644 index 000000000..82a8e11c0 --- /dev/null +++ b/scripts/.gitignore @@ -0,0 +1,3 @@ +*.json +*.jks + diff --git a/scripts/copy_opencv.sh b/scripts/copy_opencv.sh deleted file mode 100755 index fd45ebee5..000000000 --- a/scripts/copy_opencv.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env bash -mkdir app/src/main/3rdparty -mkdir app/src/main/jniLibs -mkdir app/src/main/staticlibs -mkdir app/src/main/jni/include - -mv $HOME/openCV/opencv/sdk/native/3rdparty/* app/src/main/3rdparty -mv $HOME/openCV/opencv/sdk/native/libs/* app/src/main/jniLibs -mv $HOME/openCV/opencv/sdk/native/staticlibs/* app/src/main/staticlibs -mv $HOME/openCV/opencv/sdk/native/jni/include/* app/src/main/jni/include diff --git a/scripts/download_open_cv.sh b/scripts/download_open_cv.sh deleted file mode 100755 index 98410e68a..000000000 --- a/scripts/download_open_cv.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env bash -mkdir $HOME/openCV/ -cd $HOME/openCV -wget https://github.com/opencv/opencv/releases/download/4.0.1/opencv-4.0.1-android-sdk.zip - -sudo apt-get -qq update -sudo apt-get install -y unzip -ls -unzip opencv-4.0.1-android-sdk.zip -ls -# Rename folder name to opencv -mv OpenCV-android-sdk opencv -ls - -cd .. -ls -#ls -#mkdir app/src/main/3rdparty -#mkdir app/src/main/jniLibs -# -#mv $HOME/opencv/sdk/native/3rdparty/* app/src/main/3rdparty -#mv $HOME/opencv/sdk/native/libs/* app/src/main/jniLibs diff --git a/scripts/prep-key.sh b/scripts/prep-key.sh index 1b62348b9..dff82b7b8 100755 --- a/scripts/prep-key.sh +++ b/scripts/prep-key.sh @@ -1,9 +1,10 @@ #!/bin/sh set -e -export DEPLOY_BRANCH=${DEPLOY_BRANCH:-master} +export DEPLOY_BRANCH=${DEPLOY_BRANCH:-development} +export PUBLISH_BRANCH=${PUBLISH_BRANCH:-master} -if [ "$TRAVIS_PULL_REQUEST" != "false" -o "$TRAVIS_REPO_SLUG" != "fossasia/phimpme-android" -o "$TRAVIS_BRANCH" != "$DEPLOY_BRANCH" ]; then +if [ "$TRAVIS_PULL_REQUEST" != "false" -o "$TRAVIS_REPO_SLUG" != "fossasia/phimpme-android" ] || ! [ "$TRAVIS_BRANCH" == "$DEPLOY_BRANCH" -o "$TRAVIS_BRANCH" == "$PUBLISH_BRANCH" ]; then echo "We decrypt key only for pushes to the master branch and not PRs. So, skip." exit 0 fi diff --git a/scripts/setup_opencv.sh b/scripts/setup_opencv.sh new file mode 100755 index 000000000..e01d39c89 --- /dev/null +++ b/scripts/setup_opencv.sh @@ -0,0 +1,17 @@ +opencv_version="4.0.1" +opencv_sdk_zip="cache/opencv-android-sdk.zip" +download_url="https://github.com/opencv/opencv/releases/download/${opencv_version}/opencv-${opencv_version}-android-sdk.zip" +mkdir -p cache/ +wget ${download_url} -c -O cache/opencv-android-sdk.zip + +unzip -qqo ${opencv_sdk_zip} + +mkdir app/src/main/3rdparty +mkdir app/src/main/jniLibs +mkdir app/src/main/staticlibs +mkdir app/src/main/jni/include + +mv OpenCV-android-sdk/sdk/native/3rdparty/* app/src/main/3rdparty +mv OpenCV-android-sdk/sdk/native/libs/* app/src/main/jniLibs +mv OpenCV-android-sdk/sdk/native/staticlibs/* app/src/main/staticlibs +mv OpenCV-android-sdk/sdk/native/jni/include/* app/src/main/jni/include diff --git a/scripts/update-apk.sh b/scripts/update-apk.sh index 13494fdb1..5bc35771f 100644 --- a/scripts/update-apk.sh +++ b/scripts/update-apk.sh @@ -12,6 +12,7 @@ if [ "$TRAVIS_PULL_REQUEST" != "false" -o "$TRAVIS_REPO_SLUG" != "fossasia/phimp exit 0 fi +./gradlew bundleRelease git clone --quiet --branch=apk https://fossasia:$GITHUB_API_KEY@github.com/fossasia/phimpme-android apk > /dev/null cd apk @@ -19,37 +20,29 @@ cd apk if [[ "$TRAVIS_BRANCH" == "$PUBLISH_BRANCH" ]]; then /bin/rm -f * else - /bin/rm -f phimpme-dev-*.apk + /bin/rm -f phimpme-dev-* fi -\cp -r ../app/build/outputs/apk/*/**.apk . +find ../app/build/outputs -type f -name '*.apk' -exec cp -v {} . \; +find ../app/build/outputs -type f -name '*.aab' -exec cp -v {} . \; -# Signing Apps +for file in app*; do + if [ "$TRAVIS_BRANCH" == "$PUBLISH_BRANCH" ]; then + if [[ ${file} =~ ".aab" ]]; then + mv $file phimpme-master-${file} + else + mv $file phimpme-master-${file:4} + fi -if [ "$TRAVIS_BRANCH" == "$PUBLISH_BRANCH" ]; then - echo "Push to master branch detected, signing the app..." - cp app-release-unsigned.apk app-release-unaligned.apk - jarsigner -tsa http://timestamp.comodoca.com/rfc3161 -sigalg SHA1withRSA -digestalg SHA1 -keystore ../scripts/key.jks -storepass $STORE_PASS -keypass $KEY_PASS app-release-unaligned.apk $ALIAS - ${ANDROID_HOME}/build-tools/${ANDROID_BUILD_TOOLS_VERSION}/zipalign -p 4 app-release-unaligned.apk app-release.apk -fi - -if [ "$TRAVIS_BRANCH" == "$PUBLISH_BRANCH" ]; then - for file in app*; do - if [[ $file = "phimpme"* ]]; then - continue - fi - mv $file phimpme-master-${file%%} - done -fi + elif [ "$TRAVIS_BRANCH" == "$DEPLOY_BRANCH" ]; then + if [[ ${file} =~ ".aab" ]]; then + mv $file phimpme-dev-${file} + else + mv $file phimpme-dev-${file:4} + fi -if [ "$TRAVIS_BRANCH" == "$DEPLOY_BRANCH" ]; then - for file in app*; do - if [[ $file = "phimpme"* ]]; then - continue - fi - mv $file phimpme-dev-${file%%} - done -fi + fi +done # Create a new branch that will contain only latest apk git checkout --orphan temporary @@ -72,5 +65,6 @@ if [ "$TRAVIS_BRANCH" != "$PUBLISH_BRANCH" ]; then exit 0 fi +cd .. gem install fastlane -fastlane supply --apk phimpme-master-app-release.apk --track alpha --json_key ../scripts/fastlane.json --package_name $PACKAGE_NAME +fastlane supply --aab ./apk/phimpme-master-app.aab --skip_upload_apk true --track alpha --json_key ./scripts/fastlane.json --package_name $PACKAGE_NAME \ No newline at end of file diff --git a/settings.gradle b/settings.gradle index 52aca4845..1770035d5 100755 --- a/settings.gradle +++ b/settings.gradle @@ -1 +1 @@ -include ':app', ':photoview', ':pdk', ':openCV' +include ':app', ':openCV'