-
Notifications
You must be signed in to change notification settings - Fork 106
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #36 from tarek360/fix/travis
fix travis, configure sample app to kotlin
- Loading branch information
Showing
12 changed files
with
110 additions
and
146 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,69 +1,47 @@ | ||
language: android | ||
jdk: oraclejdk8 | ||
sudo: false | ||
|
||
notifications: | ||
email: | ||
- [email protected] | ||
|
||
env: | ||
matrix: | ||
- ANDROID_TARGET=android-19 ANDROID_ABI=armeabi-v7a | ||
global: | ||
- ADB_INSTALL_TIMEOUT=10 #Time out to 10 mins | ||
|
||
before_cache: | ||
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock | ||
|
||
cache: | ||
directories: #Cache all dirs under .gradle folder | ||
- $HOME/.gradle/daemon #Cache daemon logs | ||
- $HOME/.gradle/native #Cache library downloaded from the gradle dependency | ||
- $HOME/.gradle/wrapper #Cache the gradle | ||
|
||
android: | ||
update_sdk: true | ||
components: | ||
- platform-tools | ||
- tools | ||
|
||
# The BuildTools version used by your project | ||
- build-tools-24.0.2 | ||
|
||
# The SDK version used to compile your project | ||
- android-24 | ||
|
||
# Additional components | ||
- extra-google-google_play_services | ||
- extra-google-m2repository | ||
- extra-android-m2repository | ||
|
||
#system images | ||
- sys-img-armeabi-v7a-android-19 | ||
|
||
licenses: | ||
components: | ||
- tools | ||
- platform-tools | ||
- tools | ||
- android-21 | ||
- android-27 | ||
- build-tools-27.0.3 | ||
- android-27 | ||
- addon-google_apis-google-27 | ||
- extra-google-google_play_services | ||
- extra-android-support | ||
- extra-google-m2repository | ||
- extra-android-m2repository | ||
- sys-img-armeabi-v7a-android-27 | ||
- sys-img-armeabi-v7a-android-21 | ||
licenses: | ||
- 'android-sdk-preview-license-52d11cd2' | ||
- 'android-sdk-license-.+' | ||
- 'google-gdk-license-.+' | ||
|
||
before_script: | ||
- chmod +x gradlew #Grand permissions | ||
- android list targets | ||
- echo no | android create avd --force --name test --target $ANDROID_TARGET --abi $ANDROID_ABI #Create AVD for given api | ||
- emulator -avd test -no-skin -no-audio -no-window & #Start emulator | ||
before_cache: | ||
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock | ||
- rm -fr $HOME/.gradle/caches/*/plugin-resolution/ | ||
|
||
script: | ||
- echo "Travis branch is $TRAVIS_BRANCH" | ||
- echo "Travis branch is in pull request $TRAVIS_PULL+REQUEST" | ||
- android-wait-for-emulator | ||
- adb devices #Display list of devices | ||
- adb shell input keyevent 82 & | ||
- ./gradlew connectedCheck -PdisablePreDex --stacktrace | ||
cache: | ||
directories: | ||
- $HOME/.gradle/caches/ | ||
- $HOME/.gradle/wrapper/ | ||
- $HOME/.android/build-cache | ||
|
||
before_install: | ||
- pip install --user codecov #Install codecov | ||
- echo y | android update sdk --no-ui --all --filter sys-img-armeabi-v7a-android-27,sys-img-x86_64-android-27,build-tools-27.0.3 | ||
- yes | sdkmanager "platforms;android-27" | ||
|
||
after_success: | ||
- codecov #Run codecov | ||
|
||
after_failure: "cat $TRAVIS_BUILD_DIR/app/build/outputs/lint-results-debug.xml" | ||
before_script: | ||
- echo "************************ Start Running Unit Tests ************************" | ||
- ./gradlew test --stacktrace | ||
- android list targets | ||
- emulator -list-avds | ||
- echo no | android create avd --force -n test -t android-21 --abi armeabi-v7a | ||
- emulator -avd test -no-skin -no-audio -no-window -netfast -no-boot-anim & | ||
- android-wait-for-emulator | ||
- adb shell input keyevent 82 & |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 0 additions & 69 deletions
69
app/src/main/java/com/tarek360/sample/BaseSampleActivity.java
This file was deleted.
Oops, something went wrong.
50 changes: 50 additions & 0 deletions
50
app/src/main/java/com/tarek360/sample/BaseSampleActivity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package com.tarek360.sample | ||
|
||
import android.graphics.Bitmap | ||
import android.os.Bundle | ||
import android.support.annotation.LayoutRes | ||
import android.support.v7.app.AppCompatActivity | ||
import android.view.View | ||
import butterknife.ButterKnife | ||
import com.tarek360.instacapture.Instacapture | ||
import com.tarek360.instacapture.listener.SimpleScreenCapturingListener | ||
import com.tarek360.sample.uncapturableViews.AlertDialogFragment | ||
import com.tarek360.sample.utility.Utility | ||
import rx.android.schedulers.AndroidSchedulers | ||
|
||
abstract class BaseSampleActivity : AppCompatActivity(), AlertDialogFragment.OnAlertDialogListener { | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
Instacapture.enableLogging(true) | ||
} | ||
|
||
override fun setContentView(@LayoutRes layoutResID: Int) { | ||
super.setContentView(layoutResID) | ||
ButterKnife.bind(this) | ||
} | ||
|
||
protected fun showAlertDialog() { | ||
AlertDialogFragment.newInstance(R.string.dialog_title, R.string.dialog_message) | ||
.show(supportFragmentManager, "dialogFragment") | ||
} | ||
|
||
protected fun captureScreenshot(vararg ignoredViews: View) { | ||
Instacapture.capture(this, object : SimpleScreenCapturingListener() { | ||
override fun onCaptureComplete(bitmap: Bitmap) { | ||
|
||
Utility.getScreenshotFileObservable(this@BaseSampleActivity, bitmap) | ||
.observeOn(AndroidSchedulers.mainThread()) | ||
.subscribe { file -> | ||
startActivity(ShowScreenShotActivity.buildIntent(this@BaseSampleActivity, | ||
file.absolutePath)) | ||
} | ||
} | ||
}, *ignoredViews) | ||
|
||
} | ||
|
||
override fun onPositiveButtonClick() { | ||
captureScreenshot() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#Fri Nov 17 22:15:13 EET 2017 | ||
#Sat Jul 14 17:41:47 ICT 2018 | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters