WIP: migración 2024 sin commitear (AGP 7.0.4, Gradle 7.2, Kotlin 1.5.20, ViewBinding, AdMob 21) + README actualizado
Snapshot antes de migrar a toolchain moderna. Los CRLF vienen del trabajo original en Windows.
This commit is contained in:
1 parent
415a10c1af
commit
8dd05334ec
11 files changed
+371
-303
No files matched your search
@@ -1,21 +1,45 @@
|
|||||||
# Codigo fuente de "Frases de Anime"
|
# Frases de Anime
|
||||||
|
|
||||||
Frases de Anime es una aplicacion para Android en la que todos los días tendrás una nueva frase de una serie Anime o película en tus notificaciones
|
Aplicación Android (Kotlin) que muestra cada día una frase de una serie o película anime en tus notificaciones. Puedes revisar frases de días anteriores, marcarlas como favoritas y compartirlas.
|
||||||
|
|
||||||
Podrás ver frases anteriores, marcar como favoritos, o compartirlas con tus amigos
|
## Características
|
||||||
|
|
||||||
## Requisitos para compilarla
|
- Frase diaria en notificación, a la hora que configures (persistente opcional)
|
||||||
|
- Navegación por días anteriores y vuelta al día actual
|
||||||
|
- Favoritos con pantalla propia
|
||||||
|
- Selección de animes de los que salir frases
|
||||||
|
- Compartir la frase
|
||||||
|
- Anuncio recompensado opcional para cambiar la frase del día
|
||||||
|
|
||||||
Android Studio 3.0+
|
## Compilar
|
||||||
|
|
||||||
Kotlin
|
- JDK 11 (Gradle 7.2 no arranca en JDK 17+)
|
||||||
|
- Android Studio Arctic Fox o superior, o directamente `./gradlew assembleDebug`
|
||||||
|
- compileSdk 31 / minSdk 21 / targetSdk 31
|
||||||
|
|
||||||
Anko (Debería descargarse automáticamente)
|
### Claves de AdMob
|
||||||
|
|
||||||
## Problemas al compilar la aplicación
|
`app/src/main/res/values/admob.xml` está ignorado por git (contiene los IDs reales de AdMob). Sin ese fichero el build falla por recursos inexistentes. Créalo así:
|
||||||
|
|
||||||
La aplicación puede dar problemas de compilación al faltar las claves API de Admob (No subidas porque son propias, evitamos un mal uso de la API). En res/strings.xml hay unas de ejemplo, deberían valer
|
```xml
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<string name="admob_id">ca-app-pub-XXXX~XXXX</string>
|
||||||
|
<string name="admob_videoid">ca-app-pub-XXXX/XXXX</string>
|
||||||
|
<string name="admob_bannerid">ca-app-pub-XXXX/XXXX</string>
|
||||||
|
</resources>
|
||||||
|
```
|
||||||
|
|
||||||
|
## Estructura del código
|
||||||
|
|
||||||
|
| Fichero | Responsabilidad |
|
||||||
|
|---|---|
|
||||||
|
| `MainActivity.kt` | Frase del día, favoritos, compartir, anuncio recompensado |
|
||||||
|
| `AlarmNotif.kt` + `App.kt` (`putAlarm`) | Alarma diaria y notificación |
|
||||||
|
| `SQLiteHelper.kt` + `res/raw/loadsqlfile` | Base de datos de frases (SQL precargado) |
|
||||||
|
| `OptsActivity.kt` | Configuración (hora de notificación, notificación persistente) |
|
||||||
|
| `FavsActivity.kt` / `AnimesSelActivity.kt` / `AboutActivity.kt` | Favoritos, selección de animes, acerca de |
|
||||||
|
|
||||||
## Licencia
|
## Licencia
|
||||||
|
|
||||||
Mire el fichero LICENSE.md para detalles, usamos licencia GPL
|
GPL. Ver `LICENSE.md` para detalles.
|
||||||
+15
-17
@@ -1,17 +1,17 @@
|
|||||||
def anko_version = '0.10.8'
|
def anko_version = '0.10.8'
|
||||||
def kotlin_version = '1.3.41'
|
def kotlin_version = '1.5.20'
|
||||||
ext.kotlin_version = '1.3.41'
|
ext.kotlin_version = '1.5.20'
|
||||||
|
|
||||||
apply plugin: 'com.android.application'
|
apply plugin: 'com.android.application'
|
||||||
apply plugin: 'kotlin-android' // apply kotlin android plugin
|
apply plugin: 'kotlin-android' // apply kotlin android plugin
|
||||||
apply plugin: 'kotlin-android-extensions'
|
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 28
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "com.jkanetwork.st.frasesdeanime"
|
applicationId "com.jkanetwork.st.frasesdeanime"
|
||||||
minSdkVersion 17
|
minSdkVersion 21
|
||||||
targetSdkVersion 28
|
compileSdk 31
|
||||||
|
targetSdkVersion 31
|
||||||
// Sube automáticamente la build en cada compilacion
|
// Sube automáticamente la build en cada compilacion
|
||||||
def versionPropsFile = file('versioncode.count')
|
def versionPropsFile = file('versioncode.count')
|
||||||
def Properties versionProps = new Properties()
|
def Properties versionProps = new Properties()
|
||||||
@@ -31,9 +31,12 @@ android {
|
|||||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
buildFeatures {
|
||||||
|
viewBinding true
|
||||||
|
}
|
||||||
productFlavors {
|
productFlavors {
|
||||||
}
|
}
|
||||||
buildToolsVersion '28.0.3'
|
namespace 'com.jkanetwork.st.frasesdeanime'
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceSets {
|
sourceSets {
|
||||||
@@ -42,12 +45,6 @@ sourceSets {
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation fileTree(include: ['*.jar'], dir: 'libs')
|
implementation fileTree(include: ['*.jar'], dir: 'libs')
|
||||||
/*androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
|
|
||||||
exclude group: 'com.android.support', module: 'support-annotations'
|
|
||||||
})*/
|
|
||||||
//implementation 'com.android.support:appcompat-v7:28.0.0'
|
|
||||||
//implementation 'com.android.support.constraint:constraint-layout:2.0.0-beta2'
|
|
||||||
//implementation 'com.android.support:recyclerview-v7:28.0.0'
|
|
||||||
implementation "org.jetbrains.anko:anko-sqlite:$anko_version"
|
implementation "org.jetbrains.anko:anko-sqlite:$anko_version"
|
||||||
implementation "org.jetbrains.anko:anko-commons:$anko_version"
|
implementation "org.jetbrains.anko:anko-commons:$anko_version"
|
||||||
// Anko Layouts
|
// Anko Layouts
|
||||||
@@ -57,13 +54,14 @@ dependencies {
|
|||||||
// Coroutine listeners for Anko Layouts
|
// Coroutine listeners for Anko Layouts
|
||||||
implementation "org.jetbrains.anko:anko-sdk25-coroutines:$anko_version"
|
implementation "org.jetbrains.anko:anko-sdk25-coroutines:$anko_version"
|
||||||
implementation "org.jetbrains.anko:anko-appcompat-v7-coroutines:$anko_version"
|
implementation "org.jetbrains.anko:anko-appcompat-v7-coroutines:$anko_version"
|
||||||
implementation 'com.github.mirrajabi:kotlin-preferences-extensions:1.0'
|
implementation 'com.github.mirrajabi:kotlin-preferences-extensions:1.0.1'
|
||||||
|
implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
|
||||||
|
|
||||||
implementation 'com.google.android.gms:play-services-ads:18.1.1'
|
implementation 'com.google.android.gms:play-services-ads:21.0.0'
|
||||||
//testImplementation 'junit:junit:4.12'
|
//testImplementation 'junit:junit:4.12'
|
||||||
implementation "org.jetbrains.kotlin:kotlin-stdlib:1.3.41"
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
||||||
}
|
}
|
||||||
|
|
||||||
configurations.all() {
|
configurations.configureEach() {
|
||||||
resolutionStrategy.force "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
resolutionStrategy.force "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
package="com.jkanetwork.st.frasesdeanime">
|
|
||||||
|
|
||||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
||||||
@@ -15,18 +14,18 @@
|
|||||||
android:roundIcon="@mipmap/ic_launcher_round"
|
android:roundIcon="@mipmap/ic_launcher_round"
|
||||||
android:supportsRtl="true"
|
android:supportsRtl="true"
|
||||||
android:theme="@style/AppTheme">
|
android:theme="@style/AppTheme">
|
||||||
<activity android:name=".MainActivity">
|
<activity android:name=".MainActivity" android:exported="true">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
|
||||||
<category android:name="android.intent.category.LAUNCHER" />
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
<activity android:name=".FavsActivity" />
|
<activity android:name=".FavsActivity" android:exported="false"/>
|
||||||
<activity android:name=".AnimesSelActivity" />
|
<activity android:name=".AnimesSelActivity" android:exported="false"/>
|
||||||
<activity android:name=".OptsActivity" />
|
<activity android:name=".OptsActivity" android:exported="false"/>
|
||||||
<activity android:name=".AboutActivity" />
|
<activity android:name=".AboutActivity" android:exported="false"/>
|
||||||
<receiver android:process=":alarm" android:name=".AlarmNotif" android:enabled="true" >
|
<receiver android:process=":alarm" android:name=".AlarmNotif" android:exported="true" android:enabled="true" >
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.BOOT_COMPLETED"/>
|
<action android:name="android.intent.action.BOOT_COMPLETED"/>
|
||||||
<action android:name="com.jkanetwork.st.frasesdeanime.notif" />
|
<action android:name="com.jkanetwork.st.frasesdeanime.notif" />
|
||||||
|
|||||||
@@ -14,30 +14,24 @@ import java.text.DateFormatSymbols
|
|||||||
import androidx.viewpager.widget.ViewPager
|
import androidx.viewpager.widget.ViewPager
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
|
|
||||||
import kotlinx.android.synthetic.main.activity_main.*
|
|
||||||
|
|
||||||
/* Ads */
|
/* Ads */
|
||||||
import com.google.android.gms.ads.AdRequest
|
import com.google.android.gms.ads.AdRequest
|
||||||
import com.google.ads.mediation.admob.AdMobAdapter
|
import com.google.android.gms.ads.rewarded.RewardedAd;
|
||||||
import com.google.android.gms.ads.MobileAds
|
|
||||||
import com.google.android.gms.ads.reward.RewardItem
|
|
||||||
import com.google.android.gms.ads.reward.RewardedVideoAd
|
|
||||||
import com.google.android.gms.ads.reward.RewardedVideoAdListener
|
|
||||||
|
|
||||||
import com.google.android.gms.ads.AdView
|
|
||||||
import android.text.method.ScrollingMovementMethod
|
import android.text.method.ScrollingMovementMethod
|
||||||
|
import com.google.android.gms.ads.LoadAdError
|
||||||
|
import com.google.android.gms.ads.OnUserEarnedRewardListener
|
||||||
|
import com.google.android.gms.ads.rewarded.RewardedAdLoadCallback
|
||||||
|
import com.jkanetwork.st.frasesdeanime.databinding.ActivityMainBinding
|
||||||
|
|
||||||
|
|
||||||
class MainActivity : AppCompatActivity(), RewardedVideoAdListener {
|
|
||||||
|
|
||||||
// Overrides for making it compile ok, it needs all methods
|
class MainActivity : AppCompatActivity() {
|
||||||
override fun onRewardedVideoAdLeftApplication() {}
|
private var rewardedAd: RewardedAd? = null
|
||||||
override fun onRewardedVideoAdClosed() {}
|
|
||||||
override fun onRewardedVideoAdFailedToLoad(errorCode: Int) {}
|
private lateinit var binding: ActivityMainBinding
|
||||||
override fun onRewardedVideoAdLoaded() {}
|
|
||||||
override fun onRewardedVideoAdOpened() {}
|
|
||||||
override fun onRewardedVideoStarted() {}
|
|
||||||
override fun onRewardedVideoCompleted() {}
|
|
||||||
|
|
||||||
/* Prefs, database init and calendar data */
|
/* Prefs, database init and calendar data */
|
||||||
lateinit var P: Prefs
|
lateinit var P: Prefs
|
||||||
@@ -49,12 +43,10 @@ class MainActivity : AppCompatActivity(), RewardedVideoAdListener {
|
|||||||
|
|
||||||
var IDFraseS = -2 /* Error if not changes */
|
var IDFraseS = -2 /* Error if not changes */
|
||||||
|
|
||||||
lateinit var mRewardedVideoAd: RewardedVideoAd
|
|
||||||
lateinit var mAdView : AdView
|
|
||||||
|
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
|
binding = ActivityMainBinding.inflate(layoutInflater)
|
||||||
setContentView(R.layout.activity_main);
|
setContentView(R.layout.activity_main);
|
||||||
|
|
||||||
P = Prefs(applicationContext)
|
P = Prefs(applicationContext)
|
||||||
@@ -63,18 +55,22 @@ class MainActivity : AppCompatActivity(), RewardedVideoAdListener {
|
|||||||
|
|
||||||
/* Ads */
|
/* Ads */
|
||||||
// Initialize the Mobile Ads SDK.
|
// Initialize the Mobile Ads SDK.
|
||||||
MobileAds.initialize(this, this.getString(R.string.admob_id))
|
|
||||||
|
|
||||||
mRewardedVideoAd = MobileAds.getRewardedVideoAdInstance(this)
|
var adRequest = AdRequest.Builder().build()
|
||||||
mRewardedVideoAd.setRewardedVideoAdListener(this);
|
RewardedAd.load(this,this.getString(R.string.admob_id), adRequest, object : RewardedAdLoadCallback() {
|
||||||
|
override fun onAdFailedToLoad(adError: LoadAdError) {
|
||||||
|
rewardedAd = null
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onAdLoaded(ad: RewardedAd) {
|
||||||
|
rewardedAd = ad
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
val extras = Bundle()
|
val extras = Bundle()
|
||||||
|
|
||||||
extras.putString("max_ad_content_rating", "PG") //Non adult ads
|
extras.putString("max_ad_content_rating", "PG") //Non adult ads
|
||||||
|
|
||||||
mAdView = adView
|
|
||||||
val adRequest = AdRequest.Builder().addNetworkExtrasBundle(AdMobAdapter::class.java, extras).build()
|
|
||||||
mAdView.loadAd(adRequest)
|
|
||||||
|
|
||||||
/* Check if first time or not, for welcoming user */
|
/* Check if first time or not, for welcoming user */
|
||||||
if (P.getFirstTime() == true){
|
if (P.getFirstTime() == true){
|
||||||
@@ -106,37 +102,58 @@ class MainActivity : AppCompatActivity(), RewardedVideoAdListener {
|
|||||||
|
|
||||||
|
|
||||||
/* Button listeners */
|
/* Button listeners */
|
||||||
btn_fav.setOnClickListener() {
|
binding.btnFav.setOnClickListener() {
|
||||||
db.setFav(IDFraseS)
|
db.setFav(IDFraseS)
|
||||||
if (db.getFav(IDFraseS) == true) {
|
if (db.getFav(IDFraseS)) {
|
||||||
btn_fav.setBackgroundResource(R.drawable.star_on);
|
binding.btnFav.setBackgroundResource(R.drawable.star_on);
|
||||||
}else{
|
}else{
|
||||||
btn_fav.setBackgroundResource(R.drawable.star_off);
|
binding.btnFav.setBackgroundResource(R.drawable.star_off);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
btn_share.setOnClickListener() {
|
binding.btnShare.setOnClickListener() {
|
||||||
share("${txt_sentence.text} (${txt_anime.text}) \n ${this.getString(R.string.sharefrom)}")
|
share("${binding.txtSentence.text} (${binding.txtAnime.text}) \n ${this.getString(R.string.sharefrom)}")
|
||||||
}
|
}
|
||||||
|
|
||||||
btn_change.setOnClickListener() {
|
binding.btnChange.setOnClickListener() {
|
||||||
if (mRewardedVideoAd.isLoaded() && IDFraseS > 0) {
|
|
||||||
mRewardedVideoAd.show();
|
if (IDFraseS > 0) {
|
||||||
}else if (IDFraseS <= 0) {
|
rewardedAd?.let { ad ->
|
||||||
alert("Aquí no puedes ver una frase aún, no sirve de nada pulsar el botón") {
|
ad.show(this, OnUserEarnedRewardListener { rewardItem ->
|
||||||
positiveButton("Ok") { }
|
// Handle the reward. ANUNCIO VISTO CORRECTAMENTE.
|
||||||
|
alert {
|
||||||
|
customView {
|
||||||
|
linearLayout {
|
||||||
|
imageView {
|
||||||
|
imageResource = R.drawable.gato
|
||||||
|
}.lparams(width = matchParent) {
|
||||||
|
margin = dip(4)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
positiveButton("Cambiar la frase") {
|
||||||
|
/* First remove sentence, then load a new one, and change data */
|
||||||
|
db.delSentence(yearS,monthS, dayS)
|
||||||
|
IDFraseS = db.getIDFrase(yearS,monthS, dayS)
|
||||||
|
changeData()
|
||||||
|
}
|
||||||
}.show()
|
}.show()
|
||||||
}else{
|
})
|
||||||
|
} ?: run {
|
||||||
alert("Aún no hay un anuncio disponible, espere") {
|
alert("Aún no hay un anuncio disponible, espere") {
|
||||||
positiveButton("Ok") { }
|
positiveButton("Ok") { }
|
||||||
}.show()
|
}.show()
|
||||||
preloadAd()
|
}
|
||||||
|
}else{ // if (IDFraseS <= 0) {
|
||||||
|
alert("Aquí no puedes ver una frase aún, no sirve de nada pulsar el botón") {
|
||||||
|
positiveButton("Ok") { }
|
||||||
|
}.show()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//Button for previous day
|
//Button for previous day
|
||||||
btn_prev.setOnClickListener() {
|
binding.btnPrev.setOnClickListener() {
|
||||||
if (dayS == 1){
|
if (dayS == 1){
|
||||||
if (monthS == 1){
|
if (monthS == 1){
|
||||||
monthS=12
|
monthS=12
|
||||||
@@ -158,7 +175,7 @@ class MainActivity : AppCompatActivity(), RewardedVideoAdListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Button of next (day) sentence
|
//Button of next (day) sentence
|
||||||
btn_next.setOnClickListener() {
|
binding.btnNext.setOnClickListener() {
|
||||||
if ((monthS in arrayOf(1, 3, 5,7,8,10) && dayS == 31) || (monthS == 2 && dayS == 28) || (monthS in arrayOf(2,4,6,9,11) && dayS == 30)){
|
if ((monthS in arrayOf(1, 3, 5,7,8,10) && dayS == 31) || (monthS == 2 && dayS == 28) || (monthS in arrayOf(2,4,6,9,11) && dayS == 30)){
|
||||||
monthS += 1
|
monthS += 1
|
||||||
dayS = 1
|
dayS = 1
|
||||||
@@ -171,7 +188,7 @@ class MainActivity : AppCompatActivity(), RewardedVideoAdListener {
|
|||||||
changeData()
|
changeData()
|
||||||
}
|
}
|
||||||
|
|
||||||
btn_today.setOnClickListener(){
|
binding.btnToday.setOnClickListener(){
|
||||||
//Go back to today
|
//Go back to today
|
||||||
dayS = cal.get(Calendar.DAY_OF_MONTH)
|
dayS = cal.get(Calendar.DAY_OF_MONTH)
|
||||||
monthS = cal.get(Calendar.MONTH)+1
|
monthS = cal.get(Calendar.MONTH)+1
|
||||||
@@ -185,9 +202,7 @@ class MainActivity : AppCompatActivity(), RewardedVideoAdListener {
|
|||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
super.onResume()
|
super.onResume()
|
||||||
|
|
||||||
txt_sentence.setMovementMethod(ScrollingMovementMethod()) //Make sentence text scrollable
|
binding.txtSentence.setMovementMethod(ScrollingMovementMethod()) //Make sentence text scrollable
|
||||||
|
|
||||||
preloadAd() //Load (Again) ads
|
|
||||||
|
|
||||||
cal = Calendar.getInstance() //Refresh calendar
|
cal = Calendar.getInstance() //Refresh calendar
|
||||||
//Refresh day
|
//Refresh day
|
||||||
@@ -212,38 +227,18 @@ class MainActivity : AppCompatActivity(), RewardedVideoAdListener {
|
|||||||
*/
|
*/
|
||||||
fun changeData(){
|
fun changeData(){
|
||||||
IDFraseS = db.getIDFrase(yearS,monthS, dayS)
|
IDFraseS = db.getIDFrase(yearS,monthS, dayS)
|
||||||
txt_sentence.setText(db.getSentenceFromIDF(IDFraseS))
|
binding.txtSentence.setText(db.getSentenceFromIDF(IDFraseS))
|
||||||
txt_anime.setText(db.getAnimeFromIDF(IDFraseS))
|
binding.txtAnime.setText(db.getAnimeFromIDF(IDFraseS))
|
||||||
//txt_date.setText("Frase de hoy")
|
//txt_date.setText("Frase de hoy")
|
||||||
txt_date.setText("Frase del $dayS de ${getMonth(monthS)}")
|
binding.txtDate.setText("Frase del $dayS de ${getMonth(monthS)}")
|
||||||
/* Set fav icon */
|
/* Set fav icon */
|
||||||
if (db.getFav(IDFraseS) == true) {
|
if (db.getFav(IDFraseS)) {
|
||||||
btn_fav.setBackgroundResource(R.drawable.star_on);
|
binding.btnFav.setBackgroundResource(R.drawable.star_on);
|
||||||
}else{
|
}else{
|
||||||
btn_fav.setBackgroundResource(R.drawable.star_off);
|
binding.btnFav.setBackgroundResource(R.drawable.star_off);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** This changes sentence of day you are seeing */
|
|
||||||
override fun onRewarded(reward: RewardItem) {
|
|
||||||
alert {
|
|
||||||
customView {
|
|
||||||
linearLayout {
|
|
||||||
imageView {
|
|
||||||
imageResource = R.drawable.gato
|
|
||||||
}.lparams(width = matchParent) {
|
|
||||||
margin = dip(4)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
positiveButton("Cambiar la frase") {
|
|
||||||
/* First remove sentence, then load a new one, and change data */
|
|
||||||
db.delSentence(yearS,monthS, dayS)
|
|
||||||
IDFraseS = db.getIDFrase(yearS,monthS, dayS)
|
|
||||||
changeData()
|
|
||||||
}
|
|
||||||
}.show()
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
override fun onCreateOptionsMenu(menu: Menu?): Boolean {
|
override fun onCreateOptionsMenu(menu: Menu?): Boolean {
|
||||||
@@ -278,16 +273,4 @@ class MainActivity : AppCompatActivity(), RewardedVideoAdListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fun preloadAd() {
|
|
||||||
var Adr = AdRequest.Builder()
|
|
||||||
Adr.addTestDevice("C0119E16F190120A0481C80734939D71")
|
|
||||||
Adr.addTestDevice("4264F289943AD2719C3F0ECB2CD4556A")
|
|
||||||
Adr.addTestDevice("D0CF3543C15E51623C67081FA8B64C2B")
|
|
||||||
|
|
||||||
val extras = Bundle()
|
|
||||||
extras.putString("max_ad_content_rating", "PG") //Non adult ads
|
|
||||||
|
|
||||||
mRewardedVideoAd.loadAd(this.getString(R.string.admob_videoid), Adr.addNetworkExtrasBundle(AdMobAdapter::class.java, extras).build())
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -2,25 +2,26 @@ package com.jkanetwork.st.frasesdeanime
|
|||||||
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import android.content.Context
|
|
||||||
import android.widget.ArrayAdapter
|
import android.widget.ArrayAdapter
|
||||||
import org.jetbrains.anko.*
|
import org.jetbrains.anko.*
|
||||||
import kotlinx.android.synthetic.main.activity_opts.*
|
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import java.util.*
|
import java.util.*
|
||||||
import android.content.BroadcastReceiver
|
import android.content.BroadcastReceiver
|
||||||
|
import com.jkanetwork.st.frasesdeanime.databinding.ActivityOptsBinding
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by kprkpr on 30/08/17.
|
* Created by kprkpr on 30/08/17.
|
||||||
*/
|
*/
|
||||||
class OptsActivity : AppCompatActivity(){
|
class OptsActivity : AppCompatActivity(){
|
||||||
|
|
||||||
|
private lateinit var binding: ActivityOptsBinding
|
||||||
lateinit var P: Prefs
|
lateinit var P: Prefs
|
||||||
|
|
||||||
val cont = this
|
val cont = this
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
|
binding = ActivityOptsBinding.inflate(layoutInflater)
|
||||||
setContentView(R.layout.activity_opts)
|
setContentView(R.layout.activity_opts)
|
||||||
|
|
||||||
P = Prefs(applicationContext)
|
P = Prefs(applicationContext)
|
||||||
@@ -41,37 +42,37 @@ class OptsActivity : AppCompatActivity(){
|
|||||||
hoursAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item)
|
hoursAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item)
|
||||||
minutesAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item)
|
minutesAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item)
|
||||||
|
|
||||||
spinnerHour.adapter = hoursAdapter
|
binding.spinnerHour.adapter = hoursAdapter
|
||||||
spinnerMinute.adapter = minutesAdapter
|
binding.spinnerMinute.adapter = minutesAdapter
|
||||||
|
|
||||||
spinnerHour.setSelection(P.getHour())
|
binding.spinnerHour.setSelection(P.getHour())
|
||||||
spinnerMinute.setSelection(P.getMinute())
|
binding.spinnerMinute.setSelection(P.getMinute())
|
||||||
|
|
||||||
chk_alarm.setChecked(P.getNotifOn())
|
binding.chkAlarm.setChecked(P.getNotifOn())
|
||||||
chk_persistent.setChecked(P.getPersNotifOn())
|
binding.chkPersistent.setChecked(P.getPersNotifOn())
|
||||||
|
|
||||||
setEnabledParts()
|
setEnabledParts()
|
||||||
|
|
||||||
/* Button listeners */
|
/* Button listeners */
|
||||||
chk_alarm.setOnClickListener() {
|
binding.chkAlarm.setOnClickListener() {
|
||||||
setEnabledParts()
|
setEnabledParts()
|
||||||
}
|
}
|
||||||
chk_persistent.setOnClickListener() {
|
binding.chkPersistent.setOnClickListener() {
|
||||||
setEnabledParts()
|
setEnabledParts()
|
||||||
}
|
}
|
||||||
|
|
||||||
btn_SaveNotif.setOnClickListener() {
|
binding.btnSaveNotif.setOnClickListener() {
|
||||||
|
|
||||||
P.setHour(spinnerHour.getSelectedItem().toString().toInt())
|
P.setHour(binding.spinnerHour.getSelectedItem().toString().toInt())
|
||||||
P.setMinute(spinnerMinute.getSelectedItem().toString().toInt())
|
P.setMinute(binding.spinnerMinute.getSelectedItem().toString().toInt())
|
||||||
|
|
||||||
P.setNotifOn(chk_alarm.isChecked())
|
P.setNotifOn(binding.chkAlarm.isChecked())
|
||||||
P.setPersNotifOn(chk_persistent.isChecked())
|
P.setPersNotifOn(binding.chkPersistent.isChecked())
|
||||||
|
|
||||||
val nm = applicationContext.notificationManager
|
val nm = applicationContext.notificationManager
|
||||||
nm.cancel(1); //Canel notif before service going on, for persistent notification problems
|
nm.cancel(1); //Canel notif before service going on, for persistent notification problems
|
||||||
putAlarm(this)
|
putAlarm(this)
|
||||||
if (chk_persistent.isChecked() && chk_alarm.isChecked()) {
|
if (binding.chkPersistent.isChecked() && binding.chkAlarm.isChecked()) {
|
||||||
this.startService(Intent(this, AlarmNotif::class.java))
|
this.startService(Intent(this, AlarmNotif::class.java))
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -80,20 +81,20 @@ class OptsActivity : AppCompatActivity(){
|
|||||||
|
|
||||||
|
|
||||||
fun setEnabledParts() {
|
fun setEnabledParts() {
|
||||||
if (chk_alarm.isChecked()) {
|
if (binding.chkAlarm.isChecked()) {
|
||||||
chk_persistent.setEnabled(true)
|
binding.chkPersistent.setEnabled(true)
|
||||||
/* This other checks is chk_persistent checked dependent */
|
/* This other checks is chk_persistent checked dependent */
|
||||||
if (chk_persistent.isChecked()) {
|
if (binding.chkPersistent.isChecked()) {
|
||||||
spinnerHour.setEnabled(false)
|
binding.spinnerHour.setEnabled(false)
|
||||||
spinnerMinute.setEnabled(false)
|
binding.spinnerMinute.setEnabled(false)
|
||||||
} else {
|
} else {
|
||||||
spinnerHour.setEnabled(true)
|
binding.spinnerHour.setEnabled(true)
|
||||||
spinnerMinute.setEnabled(true)
|
binding.spinnerMinute.setEnabled(true)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
chk_persistent.setEnabled(false)
|
binding.chkPersistent.setEnabled(false)
|
||||||
spinnerHour.setEnabled(false)
|
binding.spinnerHour.setEnabled(false)
|
||||||
spinnerMinute.setEnabled(false)
|
binding.spinnerMinute.setEnabled(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,2 +1,2 @@
|
|||||||
#Tue Aug 13 23:39:50 CEST 2019
|
#Sun Apr 07 19:54:23 CEST 2024
|
||||||
VERSION_CODE=1295
|
VERSION_CODE=1354
|
||||||
+6
-15
@@ -3,26 +3,20 @@
|
|||||||
buildscript {
|
buildscript {
|
||||||
repositories {
|
repositories {
|
||||||
jcenter()
|
jcenter()
|
||||||
|
maven { url 'https://jitpack.io' }
|
||||||
|
mavenCentral()
|
||||||
google()
|
google()
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
//def kotlin_version = '1.3.21'
|
classpath 'com.android.tools.build:gradle:7.0.4'
|
||||||
classpath 'com.android.tools.build:gradle:3.4.2'
|
|
||||||
//classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
|
||||||
//ext.kotlin_version = "$kotlin_version"
|
|
||||||
// NOTE: Do not place your application dependencies here; they belong
|
|
||||||
// in the individual module build.gradle files
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
plugins {
|
plugins {
|
||||||
id 'org.jetbrains.kotlin.jvm' version '1.3.41'
|
id 'org.jetbrains.kotlin.jvm' version '1.5.20'
|
||||||
}
|
}
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
/*dependencies {
|
|
||||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.41"
|
|
||||||
}*/
|
|
||||||
compileKotlin {
|
compileKotlin {
|
||||||
kotlinOptions {
|
kotlinOptions {
|
||||||
jvmTarget = "1.8"
|
jvmTarget = "1.8"
|
||||||
@@ -35,12 +29,9 @@ compileTestKotlin {
|
|||||||
}
|
}
|
||||||
allprojects {
|
allprojects {
|
||||||
repositories {
|
repositories {
|
||||||
jcenter()
|
mavenCentral()
|
||||||
maven { url 'https://jitpack.io' }
|
maven { url 'https://jitpack.io' }
|
||||||
maven {
|
jcenter()
|
||||||
url "https://maven.google.com"
|
|
||||||
}
|
|
||||||
|
|
||||||
google()
|
google()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
BIN
Binary file not shown.
+1
-2
@@ -1,6 +1,5 @@
|
|||||||
#Tue Aug 13 22:31:54 CEST 2019
|
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
|
|
||||||
@@ -1,74 +1,129 @@
|
|||||||
#!/usr/bin/env bash
|
#!/bin/sh
|
||||||
|
|
||||||
|
#
|
||||||
|
# Copyright © 2015-2021 the original authors.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
#
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
##
|
#
|
||||||
## Gradle start up script for UN*X
|
# Gradle start up script for POSIX generated by Gradle.
|
||||||
##
|
#
|
||||||
|
# Important for running:
|
||||||
|
#
|
||||||
|
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
||||||
|
# noncompliant, but you have some other compliant shell such as ksh or
|
||||||
|
# bash, then to run this script, type that shell name before the whole
|
||||||
|
# command line, like:
|
||||||
|
#
|
||||||
|
# ksh Gradle
|
||||||
|
#
|
||||||
|
# Busybox and similar reduced shells will NOT work, because this script
|
||||||
|
# requires all of these POSIX shell features:
|
||||||
|
# * functions;
|
||||||
|
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||||
|
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||||
|
# * compound commands having a testable exit status, especially «case»;
|
||||||
|
# * various built-in commands including «command», «set», and «ulimit».
|
||||||
|
#
|
||||||
|
# Important for patching:
|
||||||
|
#
|
||||||
|
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
||||||
|
# by Bash, Ksh, etc; in particular arrays are avoided.
|
||||||
|
#
|
||||||
|
# The "traditional" practice of packing multiple parameters into a
|
||||||
|
# space-separated string is a well documented source of bugs and security
|
||||||
|
# problems, so this is (mostly) avoided, by progressively accumulating
|
||||||
|
# options in "$@", and eventually passing that to Java.
|
||||||
|
#
|
||||||
|
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
||||||
|
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
||||||
|
# see the in-line comments for details.
|
||||||
|
#
|
||||||
|
# There are tweaks for specific operating systems such as AIX, CygWin,
|
||||||
|
# Darwin, MinGW, and NonStop.
|
||||||
|
#
|
||||||
|
# (3) This script is generated from the Groovy template
|
||||||
|
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||||
|
# within the Gradle project.
|
||||||
|
#
|
||||||
|
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||||
|
#
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
# Attempt to set APP_HOME
|
||||||
DEFAULT_JVM_OPTS=""
|
|
||||||
|
# Resolve links: $0 may be a link
|
||||||
|
app_path=$0
|
||||||
|
|
||||||
|
# Need this for daisy-chained symlinks.
|
||||||
|
while
|
||||||
|
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||||
|
[ -h "$app_path" ]
|
||||||
|
do
|
||||||
|
ls=$( ls -ld "$app_path" )
|
||||||
|
link=${ls#*' -> '}
|
||||||
|
case $link in #(
|
||||||
|
/*) app_path=$link ;; #(
|
||||||
|
*) app_path=$APP_HOME$link ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
||||||
|
|
||||||
APP_NAME="Gradle"
|
APP_NAME="Gradle"
|
||||||
APP_BASE_NAME=`basename "$0"`
|
APP_BASE_NAME=${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" "-Xms64m"'
|
||||||
|
|
||||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
MAX_FD="maximum"
|
MAX_FD=maximum
|
||||||
|
|
||||||
warn ( ) {
|
warn () {
|
||||||
echo "$*"
|
echo "$*"
|
||||||
}
|
} >&2
|
||||||
|
|
||||||
die ( ) {
|
die () {
|
||||||
echo
|
echo
|
||||||
echo "$*"
|
echo "$*"
|
||||||
echo
|
echo
|
||||||
exit 1
|
exit 1
|
||||||
}
|
} >&2
|
||||||
|
|
||||||
# OS specific support (must be 'true' or 'false').
|
# OS specific support (must be 'true' or 'false').
|
||||||
cygwin=false
|
cygwin=false
|
||||||
msys=false
|
msys=false
|
||||||
darwin=false
|
darwin=false
|
||||||
case "`uname`" in
|
nonstop=false
|
||||||
CYGWIN* )
|
case "$( uname )" in #(
|
||||||
cygwin=true
|
CYGWIN* ) cygwin=true ;; #(
|
||||||
;;
|
Darwin* ) darwin=true ;; #(
|
||||||
Darwin* )
|
MSYS* | MINGW* ) msys=true ;; #(
|
||||||
darwin=true
|
NONSTOP* ) nonstop=true ;;
|
||||||
;;
|
|
||||||
MINGW* )
|
|
||||||
msys=true
|
|
||||||
;;
|
|
||||||
esac
|
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
|
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||||
|
|
||||||
|
|
||||||
# Determine the Java command to use to start the JVM.
|
# Determine the Java command to use to start the JVM.
|
||||||
if [ -n "$JAVA_HOME" ] ; then
|
if [ -n "$JAVA_HOME" ] ; then
|
||||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||||
# IBM's JDK on AIX uses strange locations for the executables
|
# IBM's JDK on AIX uses strange locations for the executables
|
||||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
JAVACMD=$JAVA_HOME/jre/sh/java
|
||||||
else
|
else
|
||||||
JAVACMD="$JAVA_HOME/bin/java"
|
JAVACMD=$JAVA_HOME/bin/java
|
||||||
fi
|
fi
|
||||||
if [ ! -x "$JAVACMD" ] ; then
|
if [ ! -x "$JAVACMD" ] ; then
|
||||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||||
@@ -77,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the
|
|||||||
location of your Java installation."
|
location of your Java installation."
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
JAVACMD="java"
|
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.
|
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
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
@@ -85,76 +140,95 @@ location of your Java installation."
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Increase the maximum file descriptors if we can.
|
# Increase the maximum file descriptors if we can.
|
||||||
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
|
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||||
MAX_FD_LIMIT=`ulimit -H -n`
|
case $MAX_FD in #(
|
||||||
if [ $? -eq 0 ] ; then
|
max*)
|
||||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
MAX_FD=$( ulimit -H -n ) ||
|
||||||
MAX_FD="$MAX_FD_LIMIT"
|
warn "Could not query maximum file descriptor limit"
|
||||||
fi
|
esac
|
||||||
ulimit -n $MAX_FD
|
case $MAX_FD in #(
|
||||||
if [ $? -ne 0 ] ; then
|
'' | soft) :;; #(
|
||||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
*)
|
||||||
fi
|
ulimit -n "$MAX_FD" ||
|
||||||
else
|
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||||
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
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
|
# Collect all arguments for the java command, stacking in reverse order:
|
||||||
function splitJvmOpts() {
|
# * args from the command line
|
||||||
JVM_OPTS=("$@")
|
# * the main class name
|
||||||
}
|
# * -classpath
|
||||||
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
|
# * -D...appname settings
|
||||||
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
|
# * --module-path (only if needed)
|
||||||
|
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||||
|
|
||||||
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
|
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||||
|
if "$cygwin" || "$msys" ; then
|
||||||
|
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||||
|
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||||
|
|
||||||
|
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||||
|
|
||||||
|
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||||
|
for arg do
|
||||||
|
if
|
||||||
|
case $arg in #(
|
||||||
|
-*) false ;; # don't mess with options #(
|
||||||
|
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||||
|
[ -e "$t" ] ;; #(
|
||||||
|
*) false ;;
|
||||||
|
esac
|
||||||
|
then
|
||||||
|
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||||
|
fi
|
||||||
|
# Roll the args list around exactly as many times as the number of
|
||||||
|
# args, so each arg winds up back in the position where it started, but
|
||||||
|
# possibly modified.
|
||||||
|
#
|
||||||
|
# NB: a `for` loop captures its iteration list before it begins, so
|
||||||
|
# changing the positional parameters here affects neither the number of
|
||||||
|
# iterations, nor the values presented in `arg`.
|
||||||
|
shift # remove old arg
|
||||||
|
set -- "$@" "$arg" # push replacement arg
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Collect all arguments for the java command;
|
||||||
|
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
||||||
|
# shell script including quotes and variable substitutions, so put them in
|
||||||
|
# double quotes to make sure that they get re-expanded; and
|
||||||
|
# * put everything else in single quotes, so that it's not re-expanded.
|
||||||
|
|
||||||
|
set -- \
|
||||||
|
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||||
|
-classpath "$CLASSPATH" \
|
||||||
|
org.gradle.wrapper.GradleWrapperMain \
|
||||||
|
"$@"
|
||||||
|
|
||||||
|
# Use "xargs" to parse quoted args.
|
||||||
|
#
|
||||||
|
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||||
|
#
|
||||||
|
# In Bash we could simply go:
|
||||||
|
#
|
||||||
|
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
||||||
|
# set -- "${ARGS[@]}" "$@"
|
||||||
|
#
|
||||||
|
# but POSIX shell has neither arrays nor command substitution, so instead we
|
||||||
|
# post-process each arg (as a line of input to sed) to backslash-escape any
|
||||||
|
# character that might be a shell metacharacter, then use eval to reverse
|
||||||
|
# that process (while maintaining the separation between arguments), and wrap
|
||||||
|
# the whole thing up as a single "set" statement.
|
||||||
|
#
|
||||||
|
# This will of course break if any of these variables contains a newline or
|
||||||
|
# an unmatched quote.
|
||||||
|
#
|
||||||
|
|
||||||
|
eval "set -- $(
|
||||||
|
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||||
|
xargs -n1 |
|
||||||
|
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||||
|
tr '\n' ' '
|
||||||
|
)" '"$@"'
|
||||||
|
|
||||||
|
exec "$JAVACMD" "$@"
|
||||||
Vendored
+26
-27
@@ -1,3 +1,19 @@
|
|||||||
|
@rem
|
||||||
|
@rem Copyright 2015 the original author or authors.
|
||||||
|
@rem
|
||||||
|
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
@rem you may not use this file except in compliance with the License.
|
||||||
|
@rem You may obtain a copy of the License at
|
||||||
|
@rem
|
||||||
|
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
@rem
|
||||||
|
@rem Unless required by applicable law or agreed to in writing, software
|
||||||
|
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
@rem See the License for the specific language governing permissions and
|
||||||
|
@rem limitations under the License.
|
||||||
|
@rem
|
||||||
|
|
||||||
@if "%DEBUG%" == "" @echo off
|
@if "%DEBUG%" == "" @echo off
|
||||||
@rem ##########################################################################
|
@rem ##########################################################################
|
||||||
@rem
|
@rem
|
||||||
@@ -8,20 +24,23 @@
|
|||||||
@rem Set local scope for the variables with windows NT shell
|
@rem Set local scope for the variables with windows NT shell
|
||||||
if "%OS%"=="Windows_NT" setlocal
|
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
|
set DIRNAME=%~dp0
|
||||||
if "%DIRNAME%" == "" set DIRNAME=.
|
if "%DIRNAME%" == "" set DIRNAME=.
|
||||||
set APP_BASE_NAME=%~n0
|
set APP_BASE_NAME=%~n0
|
||||||
set APP_HOME=%DIRNAME%
|
set APP_HOME=%DIRNAME%
|
||||||
|
|
||||||
|
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||||
|
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||||
|
|
||||||
|
@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" "-Xms64m"
|
||||||
|
|
||||||
@rem Find java.exe
|
@rem Find java.exe
|
||||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||||
|
|
||||||
set JAVA_EXE=java.exe
|
set JAVA_EXE=java.exe
|
||||||
%JAVA_EXE% -version >NUL 2>&1
|
%JAVA_EXE% -version >NUL 2>&1
|
||||||
if "%ERRORLEVEL%" == "0" goto init
|
if "%ERRORLEVEL%" == "0" goto execute
|
||||||
|
|
||||||
echo.
|
echo.
|
||||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
@@ -35,7 +54,7 @@ goto fail
|
|||||||
set JAVA_HOME=%JAVA_HOME:"=%
|
set JAVA_HOME=%JAVA_HOME:"=%
|
||||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||||
|
|
||||||
if exist "%JAVA_EXE%" goto init
|
if exist "%JAVA_EXE%" goto execute
|
||||||
|
|
||||||
echo.
|
echo.
|
||||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||||
@@ -45,34 +64,14 @@ echo location of your Java installation.
|
|||||||
|
|
||||||
goto fail
|
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
|
:execute
|
||||||
@rem Setup the command line
|
@rem Setup the command line
|
||||||
|
|
||||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||||
|
|
||||||
|
|
||||||
@rem Execute Gradle
|
@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%
|
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||||
|
|
||||||
:end
|
:end
|
||||||
@rem End local scope for the variables with windows NT shell
|
@rem End local scope for the variables with windows NT shell
|
||||||
|
|||||||
Reference in new issue
Block a user