Initial source code export
10
.gitignore
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
*.iml
|
||||
.gradle
|
||||
/local.properties
|
||||
/.idea/workspace.xml
|
||||
/.idea/libraries
|
||||
.DS_Store
|
||||
/build
|
||||
/captures
|
||||
.externalNativeBuild
|
||||
app/src/main/res/values/admob.xml
|
||||
22
.idea/compiler.xml
generated
Normal file
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CompilerConfiguration">
|
||||
<resourceExtensions />
|
||||
<wildcardResourcePatterns>
|
||||
<entry name="!?*.java" />
|
||||
<entry name="!?*.form" />
|
||||
<entry name="!?*.class" />
|
||||
<entry name="!?*.groovy" />
|
||||
<entry name="!?*.scala" />
|
||||
<entry name="!?*.flex" />
|
||||
<entry name="!?*.kt" />
|
||||
<entry name="!?*.clj" />
|
||||
<entry name="!?*.aj" />
|
||||
</wildcardResourcePatterns>
|
||||
<annotationProcessing>
|
||||
<profile default="true" name="Default" enabled="false">
|
||||
<processorPath useClasspath="true" />
|
||||
</profile>
|
||||
</annotationProcessing>
|
||||
</component>
|
||||
</project>
|
||||
3
.idea/copyright/profiles_settings.xml
generated
Normal file
@@ -0,0 +1,3 @@
|
||||
<component name="CopyrightManager">
|
||||
<settings default="" />
|
||||
</component>
|
||||
3
.idea/dictionaries/kprkpr.xml
generated
Normal file
@@ -0,0 +1,3 @@
|
||||
<component name="ProjectDictionaryState">
|
||||
<dictionary name="kprkpr" />
|
||||
</component>
|
||||
18
.idea/gradle.xml
generated
Normal file
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="GradleSettings">
|
||||
<option name="linkedExternalProjectsSettings">
|
||||
<GradleProjectSettings>
|
||||
<option name="distributionType" value="DEFAULT_WRAPPED" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
<option name="modules">
|
||||
<set>
|
||||
<option value="$PROJECT_DIR$" />
|
||||
<option value="$PROJECT_DIR$/app" />
|
||||
</set>
|
||||
</option>
|
||||
<option name="resolveModulePerSourceSet" value="false" />
|
||||
</GradleProjectSettings>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
||||
10
.idea/inspectionProfiles/Project_Default.xml
generated
Normal file
@@ -0,0 +1,10 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<profile version="1.0">
|
||||
<option name="myName" value="Project Default" />
|
||||
<inspection_tool class="SpellCheckingInspection" enabled="false" level="TYPO" enabled_by_default="false">
|
||||
<option name="processCode" value="true" />
|
||||
<option name="processLiterals" value="true" />
|
||||
<option name="processComments" value="true" />
|
||||
</inspection_tool>
|
||||
</profile>
|
||||
</component>
|
||||
7
.idea/inspectionProfiles/profiles_settings.xml
generated
Normal file
@@ -0,0 +1,7 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<settings>
|
||||
<option name="PROJECT_PROFILE" value="Project Default" />
|
||||
<option name="USE_PROJECT_PROFILE" value="true" />
|
||||
<version value="1.0" />
|
||||
</settings>
|
||||
</component>
|
||||
46
.idea/misc.xml
generated
Normal file
@@ -0,0 +1,46 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="EntryPointsManager">
|
||||
<entry_points version="2.0" />
|
||||
</component>
|
||||
<component name="NullableNotNullManager">
|
||||
<option name="myDefaultNullable" value="android.support.annotation.Nullable" />
|
||||
<option name="myDefaultNotNull" value="android.support.annotation.NonNull" />
|
||||
<option name="myNullables">
|
||||
<value>
|
||||
<list size="4">
|
||||
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" />
|
||||
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" />
|
||||
<item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.Nullable" />
|
||||
<item index="3" class="java.lang.String" itemvalue="android.support.annotation.Nullable" />
|
||||
</list>
|
||||
</value>
|
||||
</option>
|
||||
<option name="myNotNulls">
|
||||
<value>
|
||||
<list size="4">
|
||||
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" />
|
||||
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" />
|
||||
<item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" />
|
||||
<item index="3" class="java.lang.String" itemvalue="android.support.annotation.NonNull" />
|
||||
</list>
|
||||
</value>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectLevelVcsManager" settingsEditedManually="false">
|
||||
<OptionsSetting value="true" id="Add" />
|
||||
<OptionsSetting value="true" id="Remove" />
|
||||
<OptionsSetting value="true" id="Checkout" />
|
||||
<OptionsSetting value="true" id="Update" />
|
||||
<OptionsSetting value="true" id="Status" />
|
||||
<OptionsSetting value="true" id="Edit" />
|
||||
<ConfirmationsSetting value="0" id="Add" />
|
||||
<ConfirmationsSetting value="0" id="Remove" />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="JDK" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
<component name="ProjectType">
|
||||
<option name="id" value="Android" />
|
||||
</component>
|
||||
</project>
|
||||
9
.idea/modules.xml
generated
Normal file
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/CalendarioDeFrases.iml" filepath="$PROJECT_DIR$/CalendarioDeFrases.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
12
.idea/runConfigurations.xml
generated
Normal file
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="RunConfigurationProducerService">
|
||||
<option name="ignoredProducers">
|
||||
<set>
|
||||
<option value="org.jetbrains.plugins.gradle.execution.test.runner.AllInPackageGradleConfigurationProducer" />
|
||||
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestClassGradleConfigurationProducer" />
|
||||
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestMethodGradleConfigurationProducer" />
|
||||
</set>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
||||
6
.idea/vcs.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
BIN
GPlayLargelogoapp.png
Normal file
|
After Width: | Height: | Size: 46 KiB |
9
LICENSE.md
Normal file
@@ -0,0 +1,9 @@
|
||||
## Licencia GPL
|
||||
|
||||
## Licencias de terceros
|
||||
|
||||
**robotoCalendarView**
|
||||
|
||||
https://github.com/marcohc/roboto-calendar-view
|
||||
|
||||
It has an Apache License 2.0 -> https://github.com/marcohc/roboto-calendar-view/blob/master/LICENSE
|
||||
16
README.md
Normal file
@@ -0,0 +1,16 @@
|
||||
# Codigo fuente de "Calendario De Frases"
|
||||
|
||||
Calendario de frases es una aplicacion para Android en la que todos los días tendrás una nueva frase o refrán en tu lugar de notificaciones
|
||||
|
||||
Con un calendario integrado, podrás ver frases anteriores, marcar como favoritos, o compartirlas con tus amigos
|
||||
|
||||
Descargalo en Google Play: https://play.google.com/store/apps/details?id=com.jkanetwork.st.calendariodefrases
|
||||
|
||||
## Problemas al compilar la aplicación
|
||||
|
||||
La aplicación puede dar problemas de compilación al faltar los 2 strings de la API de Admob (No subidas porque son propias, evitamos un mal uso de la API).
|
||||
Para solucionarlo solo hay que quitar la parte de admob
|
||||
|
||||
## Licencia
|
||||
|
||||
Mire el fichero LICENSE.md para detalles, usamos licencia GPL
|
||||
1
app/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/build
|
||||
BIN
app/app-release.apk
Normal file
25
app/proguard-rules.pro
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# By default, the flags in this file are appended to flags specified
|
||||
# in /mnt/kevinmem/Android/sdkLinux/tools/proguard/proguard-android.txt
|
||||
# You can edit the include path and order by changing the proguardFiles
|
||||
# directive in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# Add any project specific keep options here:
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.jkanetwork.st.calendariodefrases;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.test.InstrumentationRegistry;
|
||||
import android.support.test.runner.AndroidJUnit4;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Instrumentation test, which will execute on an Android device.
|
||||
*
|
||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||
*/
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
public class ExampleInstrumentedTest {
|
||||
@Test
|
||||
public void useAppContext() throws Exception {
|
||||
// Context of the app under test.
|
||||
Context appContext = InstrumentationRegistry.getTargetContext();
|
||||
|
||||
assertEquals("com.jkanetwork.st.unafrasealdia", appContext.getPackageName());
|
||||
}
|
||||
}
|
||||
36
app/src/main/AndroidManifest.xml
Normal file
@@ -0,0 +1,36 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.jkanetwork.st.calendariodefrases">
|
||||
|
||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
||||
<!-- For Admob -->
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/AppTheme">
|
||||
<activity android:name=".MainActivity">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity android:name=".OptsActivity" android:label="Opciones"/>
|
||||
<activity android:name=".FavsActivity" android:label="Favoritos"/>
|
||||
<activity android:name=".AboutOfActivity" android:label="Acerca de"/>
|
||||
<activity android:name=".FirstStartActivity"/>
|
||||
<receiver
|
||||
android:name=".Alarm"
|
||||
android:process=":runalarm" />
|
||||
<service
|
||||
android:name=".NotificationHelper"
|
||||
android:process=":notif"/>
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.jkanetwork.st.calendariodefrases;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.view.View;
|
||||
|
||||
/**
|
||||
* Created by kprkpr on 24/03/17.
|
||||
*/
|
||||
|
||||
public class AboutOfActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_about);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
package com.jkanetwork.st.calendariodefrases;
|
||||
|
||||
import android.app.AlarmManager;
|
||||
import android.app.PendingIntent;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import java.util.Calendar;
|
||||
import android.os.PowerManager;
|
||||
import android.util.Log;
|
||||
|
||||
|
||||
/**
|
||||
* Created by http://stackoverflow.com/questions/4459058/alarm-manager-example
|
||||
* Modified by kprkpr
|
||||
*/
|
||||
|
||||
public class Alarm extends BroadcastReceiver
|
||||
{
|
||||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent)
|
||||
{
|
||||
PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
|
||||
PowerManager.WakeLock wl = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "");
|
||||
wl.acquire();
|
||||
// Make notification appear
|
||||
context.startService(new Intent(context, NotificationHelper.class));
|
||||
|
||||
wl.release();
|
||||
}
|
||||
|
||||
public void putAlarm(Context context){
|
||||
Config conf = new Config(context);
|
||||
|
||||
/* Common vars for alarm config */
|
||||
Intent i = new Intent(context, Alarm.class);
|
||||
AlarmManager alarmMgr = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
|
||||
PendingIntent sender = PendingIntent.getBroadcast(context, 1, i, 0);
|
||||
|
||||
/* Cancel alarm first */
|
||||
alarmMgr.cancel(sender);
|
||||
|
||||
if (conf.getNotifOn() && !conf.getPersistNotifOn()){
|
||||
/* Here set the alarm to one time a day in selected date. Default: 8AM */
|
||||
Calendar time = Calendar.getInstance();
|
||||
/* Shedechule Alarm for tomorrow instead before now if alarm set to before. */
|
||||
if (Calendar.HOUR_OF_DAY > conf.getHour() || (Calendar.HOUR_OF_DAY == conf.getHour() && Calendar.MINUTE > conf.getMinute() )){
|
||||
/* Add a day */
|
||||
time.add(Calendar.DATE, 1);
|
||||
}
|
||||
time.set(Calendar.HOUR_OF_DAY, conf.getHour());
|
||||
time.set(Calendar.MINUTE, conf.getMinute());
|
||||
time.set(Calendar.SECOND, 0);
|
||||
Log.d("Next notification show",String.valueOf(time.getTime()));
|
||||
alarmMgr.setRepeating(AlarmManager.RTC, time.getTimeInMillis(), 1000*3600*24, sender); // Repeat every day
|
||||
}
|
||||
|
||||
if (conf.getNotifOn() && conf.getPersistNotifOn()){
|
||||
/* Here set the alarm to one time a day in selected date. Default: 8AM */
|
||||
Calendar time = Calendar.getInstance();
|
||||
/* Set for 0:00:01 of next day */
|
||||
time.add(Calendar.DATE, 1);
|
||||
time.set(Calendar.HOUR_OF_DAY, 0);
|
||||
time.set(Calendar.MINUTE, 0);
|
||||
time.set(Calendar.SECOND, 1);
|
||||
Log.d("Next notification show",String.valueOf(time.getTime()));
|
||||
alarmMgr.setRepeating(AlarmManager.RTC, time.getTimeInMillis(), 1000*3600*24, sender); // Repeat every day
|
||||
context.startService(new Intent(context, NotificationHelper.class)); /* Auto start service for show notif */
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
package com.jkanetwork.st.calendariodefrases;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
|
||||
/**
|
||||
* Created by kprkpr on 21/03/17.
|
||||
*/
|
||||
|
||||
public class Config {
|
||||
|
||||
private final String SHARED_PREFS_FILE = "Prefs";
|
||||
private final String KEY_HOUR = "Hour";
|
||||
private final String KEY_MINUTE = "Minute";
|
||||
private final String KEY_NOTIFON = "Notify";
|
||||
private final String KEY_PERSISTNOTIFON = "PersistNotify";
|
||||
private final String KEY_FIRSTTIME = "FirstTime";
|
||||
|
||||
private Context emContext;
|
||||
|
||||
|
||||
public Config(Context context){
|
||||
emContext = context;
|
||||
}
|
||||
|
||||
|
||||
private SharedPreferences getSettings(){
|
||||
return emContext.getSharedPreferences(SHARED_PREFS_FILE, 0);
|
||||
}
|
||||
|
||||
public Integer getHour(){
|
||||
return getSettings().getInt(KEY_HOUR, 8);
|
||||
}
|
||||
public Integer getMinute(){
|
||||
return getSettings().getInt(KEY_MINUTE, 0);
|
||||
}
|
||||
public Boolean getNotifOn(){
|
||||
return getSettings().getBoolean(KEY_NOTIFON, true);
|
||||
}
|
||||
public Boolean getPersistNotifOn(){return getSettings().getBoolean(KEY_PERSISTNOTIFON, false);}
|
||||
public Boolean getFirstTime(){return getSettings().getBoolean(KEY_FIRSTTIME, true);}
|
||||
|
||||
|
||||
public void setHour(Integer hour){
|
||||
SharedPreferences.Editor editor = getSettings().edit();
|
||||
editor.putInt(KEY_HOUR, hour );
|
||||
editor.apply();
|
||||
}
|
||||
public void setMinute(Integer minute){
|
||||
SharedPreferences.Editor editor = getSettings().edit();
|
||||
editor.putInt(KEY_MINUTE, minute );
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
public void setNotifOn(Boolean notifon){
|
||||
SharedPreferences.Editor editor = getSettings().edit();
|
||||
editor.putBoolean(KEY_NOTIFON, notifon );
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
public void setPersistNotifOn(Boolean notifon){
|
||||
SharedPreferences.Editor editor = getSettings().edit();
|
||||
editor.putBoolean(KEY_PERSISTNOTIFON, notifon );
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
public void setFirstTime(Boolean notifon){
|
||||
SharedPreferences.Editor editor = getSettings().edit();
|
||||
editor.putBoolean(KEY_FIRSTTIME, notifon );
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,262 @@
|
||||
package com.jkanetwork.st.calendariodefrases;
|
||||
|
||||
import android.content.Context;
|
||||
import android.database.Cursor;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.database.sqlite.SQLiteOpenHelper;
|
||||
import android.util.Log;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.List;
|
||||
|
||||
public class DatabaseHelper extends SQLiteOpenHelper {
|
||||
private static final int DATABASE_VERSION = 7;
|
||||
private static final String DATABASE_NAME = "database.db";
|
||||
private final Context contextdb;
|
||||
|
||||
public DatabaseHelper(Context context) {
|
||||
super(context, DATABASE_NAME, null, DATABASE_VERSION);
|
||||
contextdb = context;
|
||||
}
|
||||
|
||||
/** Return the sentence passing the ID of it */
|
||||
public String getFraseFromID(int IDF){
|
||||
SQLiteDatabase db = this.getWritableDatabase();
|
||||
String sentence;
|
||||
|
||||
if (IDF == 0){return "No hay más frases disponibles...";}
|
||||
else if (IDF == -1){return "No puedes ver aún esta frase";}
|
||||
else if (IDF == -2){return "A ocurrido un error";}
|
||||
else { //If there is a sentence
|
||||
|
||||
try {
|
||||
Cursor c = db.rawQuery("SELECT Frase FROM frases WHERE _id = '" + IDF + "'", null);
|
||||
c.moveToFirst();
|
||||
sentence = c.getString(0);
|
||||
c.close();
|
||||
} catch (Exception e) {
|
||||
Log.e("Database", e.toString());
|
||||
sentence = "Error al buscar la frase";
|
||||
}
|
||||
return sentence;
|
||||
}
|
||||
}
|
||||
|
||||
public String getAutorFromID(int IDF){
|
||||
SQLiteDatabase db = this.getWritableDatabase();
|
||||
String sentence;
|
||||
|
||||
if (IDF <= 0){return "";}
|
||||
else { //If there is a sentence
|
||||
try {
|
||||
Cursor c = db.rawQuery("SELECT Autor FROM autores a WHERE _id=(SELECT AutorID from frases WHERE _id='"+ IDF + "')",null);
|
||||
c.moveToFirst();
|
||||
sentence = c.getString(0);
|
||||
c.close();
|
||||
} catch (Exception e) {
|
||||
Log.e("Database", e.getMessage());
|
||||
sentence = "";
|
||||
}
|
||||
return sentence;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/** Add a sentence as favorite */
|
||||
public void addFav(int IDF){
|
||||
SQLiteDatabase db = this.getWritableDatabase();
|
||||
try{
|
||||
db.execSQL("INSERT INTO frasesFav VALUES('"+IDF+"')");
|
||||
}catch(Exception e){
|
||||
Log.e("Database",e.toString());
|
||||
}
|
||||
}
|
||||
|
||||
/** Del a favorite sentence */
|
||||
public void delFav(int IDF){
|
||||
SQLiteDatabase db = this.getWritableDatabase();
|
||||
try{
|
||||
db.execSQL("DELETE FROM frasesFav WHERE IDFrase='"+IDF+"'");
|
||||
}catch(Exception e){
|
||||
Log.e("Database",e.toString());
|
||||
}
|
||||
}
|
||||
|
||||
/** Returns ID from a day X sentence, if possible */
|
||||
public Integer getIDFraseDay(int year,int month,int dayOfMonth){
|
||||
Calendar cal = Calendar.getInstance();
|
||||
try {
|
||||
Integer ret;
|
||||
SQLiteDatabase db = this.getWritableDatabase();
|
||||
|
||||
/* For ever have two digits month and day */
|
||||
String sYear = Integer.toString(year);
|
||||
String sMonth; /* month selected */
|
||||
String sDay; /* day selected */
|
||||
if (month < 10) {
|
||||
sMonth = "0" + Integer.toString(month);
|
||||
}else{
|
||||
sMonth = Integer.toString(month);
|
||||
}
|
||||
if (dayOfMonth < 10) {
|
||||
sDay = "0" + Integer.toString(dayOfMonth);
|
||||
}else{
|
||||
sDay = Integer.toString(dayOfMonth);
|
||||
}
|
||||
|
||||
/* Same for calendar day */
|
||||
String cYear = Integer.toString(cal.get(Calendar.YEAR));
|
||||
String cMonth; /* Calendar month */
|
||||
String cDay; /* Calendar day */
|
||||
if ((cal.get(Calendar.MONTH)+1) < 10) {
|
||||
cMonth = "0" + Integer.toString(cal.get(Calendar.MONTH)+1);
|
||||
}else{
|
||||
cMonth = Integer.toString(cal.get(Calendar.MONTH)+1);
|
||||
}
|
||||
if (cal.get(Calendar.DAY_OF_MONTH) < 10) {
|
||||
cDay = "0" + Integer.toString(cal.get(Calendar.DAY_OF_MONTH));
|
||||
}else{
|
||||
cDay = Integer.toString(cal.get(Calendar.DAY_OF_MONTH));
|
||||
}
|
||||
|
||||
String diaArg = sYear+sMonth+sDay; //Dia pasado a string yyyymmdd
|
||||
String diaAct = cYear+cMonth+cDay;
|
||||
Cursor query = db.rawQuery("SELECT IDFrase FROM frasesG WHERE Tday = '"+diaArg+"'", null);
|
||||
if(query.getCount() != 0) {
|
||||
query.moveToFirst();
|
||||
ret = query.getInt(0);
|
||||
query.close();
|
||||
return ret;
|
||||
//Else for make sentence if there is today or someday before has a sentence (This is possible if app was installed but not opened)
|
||||
}else if ((Integer.decode(diaArg) < Integer.decode(diaAct) && db.rawQuery("SELECT IDFrase FROM frasesG WHERE Tday < '"+diaArg+"'", null).getCount() > 0) || ( Integer.decode(diaArg).equals(Integer.decode(diaAct)) ) ) {
|
||||
//}else{ //Make sentence all times (DEBUG)
|
||||
try {
|
||||
query = db.rawQuery("SELECT _id FROM frases WHERE _id NOT IN (SELECT IDFrase FROM frasesG) ORDER BY RANDOM() LIMIT 1", null);
|
||||
query.moveToFirst();
|
||||
db.rawQuery("INSERT INTO frasesG (Tday,IDFrase) VALUES('" + diaArg + "','" + query.getString(0) + "')", null).moveToFirst();
|
||||
ret = query.getInt(0);
|
||||
return ret;
|
||||
} catch (Exception e) {
|
||||
return 0; //0 its no more sentences
|
||||
}
|
||||
}else{ //Not today, do not make one
|
||||
return -1; //-1 its day not accesible now
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e("Database",e.toString());
|
||||
return -2; //BUG
|
||||
}
|
||||
}
|
||||
|
||||
/** Returns ID of today's sentence */
|
||||
public Integer getIDFraseHoy(){
|
||||
Calendar cal = Calendar.getInstance();
|
||||
//Month + 1 because Android starts with month=0
|
||||
return getIDFraseDay(cal.get(Calendar.YEAR),cal.get(Calendar.MONTH)+1,cal.get(Calendar.DAY_OF_MONTH));
|
||||
}
|
||||
|
||||
/** Returns an array of favorite IDs */
|
||||
public Integer[] getIDFavs(){
|
||||
SQLiteDatabase db = this.getWritableDatabase();
|
||||
List<Integer> a = new ArrayList<>();
|
||||
|
||||
Cursor c = db.rawQuery("SELECT IDFrase FROM frasesFav",null);
|
||||
|
||||
for (c.moveToFirst(); !c.isAfterLast(); c.moveToNext()){
|
||||
a.add(c.getInt(0));
|
||||
}
|
||||
|
||||
Integer[] Favorites = new Integer[a.size()];
|
||||
a.toArray(Favorites);
|
||||
c.close();
|
||||
return Favorites;
|
||||
}
|
||||
|
||||
/** Returns an array of favorite IDs */
|
||||
public String[] getAllDaysYet(){
|
||||
SQLiteDatabase db = this.getWritableDatabase();
|
||||
List<String> a = new ArrayList<>();
|
||||
|
||||
Cursor c = db.rawQuery("SELECT Tday FROM frasesG",null);
|
||||
|
||||
for (c.moveToFirst(); !c.isAfterLast(); c.moveToNext()){
|
||||
a.add(c.getString(0));
|
||||
}
|
||||
|
||||
String[] Favorites = new String[a.size()];
|
||||
a.toArray(Favorites);
|
||||
c.close();
|
||||
return Favorites;
|
||||
}
|
||||
|
||||
|
||||
/* Here Startup of database. When changes, change number up in class */
|
||||
|
||||
@Override
|
||||
public void onCreate(SQLiteDatabase db) {
|
||||
db.execSQL("CREATE TABLE frases (" +
|
||||
"`_id` INTEGER PRIMARY KEY AUTOINCREMENT," +
|
||||
"`Frase` TEXT NOT NULL UNIQUE," +
|
||||
"`AutorID` INTEGER" +
|
||||
")");
|
||||
db.execSQL("CREATE TABLE autores (" +
|
||||
"`_id` INTEGER PRIMARY KEY AUTOINCREMENT," +
|
||||
"`Autor` TEXT UNIQUE" +
|
||||
")");
|
||||
db.execSQL("CREATE TABLE frasesG (" +
|
||||
"`_id` INTEGER PRIMARY KEY AUTOINCREMENT," +
|
||||
"`Tday` TEXT NOT NULL UNIQUE," +
|
||||
"`IDFrase` INTEGER NOT NULL" +
|
||||
")");
|
||||
db.execSQL("CREATE TABLE frasesFav (" +
|
||||
"`IDFrase` INTEGER NOT NULL UNIQUE" +
|
||||
")");
|
||||
db.execSQL(readSqldata("Frases"));
|
||||
db.execSQL(readSqldata("Autores"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
|
||||
db.execSQL("DROP TABLE frases");
|
||||
db.execSQL("DROP TABLE autores");
|
||||
db.execSQL("CREATE TABLE frases (" +
|
||||
"`_id` INTEGER PRIMARY KEY AUTOINCREMENT," +
|
||||
"`Frase` TEXT NOT NULL UNIQUE," +
|
||||
"`AutorID` INTEGER" +
|
||||
")");
|
||||
db.execSQL("CREATE TABLE autores (" +
|
||||
"`_id` INTEGER PRIMARY KEY AUTOINCREMENT," +
|
||||
"`Autor` TEXT UNIQUE" +
|
||||
")");
|
||||
db.execSQL(readSqldata("Frases"));
|
||||
db.execSQL(readSqldata("Autores"));
|
||||
}
|
||||
|
||||
private String readSqldata(String str){
|
||||
//getting the file
|
||||
InputStream inputStream;
|
||||
if (str.equals("Frases")) {
|
||||
inputStream = contextdb.getResources().openRawResource(R.raw.sqlfrases);
|
||||
}else{
|
||||
inputStream = contextdb.getResources().openRawResource(R.raw.sqlautores);
|
||||
}
|
||||
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
|
||||
try {
|
||||
int i = inputStream.read();
|
||||
while (i != -1) {
|
||||
byteArrayOutputStream.write(i);
|
||||
i = inputStream.read();
|
||||
}
|
||||
inputStream.close();
|
||||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return byteArrayOutputStream.toString();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
package com.jkanetwork.st.calendariodefrases;
|
||||
|
||||
import android.content.ClipData;
|
||||
import android.content.ClipboardManager;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.util.Log;
|
||||
import android.view.ContextMenu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ListView;
|
||||
import android.widget.SimpleAdapter;
|
||||
import android.widget.Toast;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
|
||||
/**
|
||||
* Created by kprkpr on 21/03/17.
|
||||
* Help from: http://androidexample.com/Create_A_Simple_Listview_-_Android_Example/index.php?view=article_discription&aid=65
|
||||
*/
|
||||
|
||||
public class FavsActivity extends AppCompatActivity {
|
||||
DatabaseHelper db = new DatabaseHelper(this);
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_favs);
|
||||
|
||||
final ListView listFavs = (ListView) findViewById(R.id.listSentences);
|
||||
|
||||
// Defined Array values to show in ListView
|
||||
|
||||
//Get IDs of sentences that are favs, and create an array of same length
|
||||
final Integer[] IDFavs = db.getIDFavs();
|
||||
|
||||
final String[] sentences = new String[IDFavs.length];
|
||||
final String[] authorNames = new String[IDFavs.length];
|
||||
//Follow all IDFavs recovering sentence
|
||||
if (IDFavs.length != 0) {
|
||||
for (int x = 0; x <= IDFavs.length - 1; x++) {
|
||||
sentences[x] = db.getFraseFromID(IDFavs[x]);
|
||||
authorNames[x] = db.getAutorFromID(IDFavs[x]);
|
||||
}
|
||||
}
|
||||
|
||||
if (IDFavs.length != 0) {
|
||||
ArrayList<HashMap<String, String>> items = new ArrayList<>();
|
||||
HashMap<String, String> listItem;
|
||||
for (int x = 0; x <= IDFavs.length - 1; x++) {
|
||||
listItem = new HashMap<>();
|
||||
listItem.put("item", sentences[x]);
|
||||
listItem.put("subitem", authorNames[x]);
|
||||
items.add(listItem);
|
||||
}
|
||||
SimpleAdapter adapter = new SimpleAdapter(this, items, android.R.layout.simple_list_item_2, new String[]{"item", "subitem"}, new int[]{android.R.id.text1, android.R.id.text2});
|
||||
listFavs.setAdapter(adapter);
|
||||
}
|
||||
|
||||
/* Register context menu */
|
||||
registerForContextMenu(listFavs);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onCreateContextMenu(ContextMenu menu, View v,
|
||||
ContextMenu.ContextMenuInfo menuInfo) {
|
||||
super.onCreateContextMenu(menu, v, menuInfo);
|
||||
MenuInflater inflater = getMenuInflater();
|
||||
inflater.inflate(R.menu.proverbmenu_del, menu);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onContextItemSelected(MenuItem item) {
|
||||
|
||||
ListView listFavs = (ListView) findViewById(R.id.listSentences);
|
||||
AdapterView.AdapterContextMenuInfo info =
|
||||
(AdapterView.AdapterContextMenuInfo) item.getMenuInfo();
|
||||
@SuppressWarnings("unchecked") /* Because next line has a type change without checking it */
|
||||
HashMap<String, String> obj = (HashMap<String,String>) listFavs.getItemAtPosition(info.position);
|
||||
|
||||
switch (item.getItemId()) {
|
||||
case R.id.copy:
|
||||
ClipboardManager clipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
|
||||
clipboard.setPrimaryClip(ClipData.newPlainText("Sentence", obj.get("item")+this.getString(R.string.sharefrom)));
|
||||
Toast.makeText(getApplicationContext(), "Copiado al portapapeles", Toast.LENGTH_LONG ).show();
|
||||
return true;
|
||||
case R.id.delfav:
|
||||
Integer[] IDFavs = db.getIDFavs();
|
||||
db.delFav(IDFavs[info.position]);
|
||||
/* Restart activity for refresh favs */
|
||||
finish();
|
||||
startActivity(getIntent());
|
||||
return true;
|
||||
case R.id.share:
|
||||
Intent intent = new Intent(Intent.ACTION_SEND);
|
||||
intent.setType("text/plain");
|
||||
intent.putExtra(Intent.EXTRA_TEXT,obj.get("item")+this.getString(R.string.sharefrom));
|
||||
startActivity(Intent.createChooser(intent, "Compartir con"));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.jkanetwork.st.calendariodefrases;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.view.View;
|
||||
|
||||
/**
|
||||
* Created by kprkpr on 24/03/17.
|
||||
*/
|
||||
|
||||
public class FirstStartActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_first);
|
||||
Config conf = new Config(this);
|
||||
conf.setFirstTime(false); /* App opened at least one time */
|
||||
|
||||
(findViewById(R.id.btnStart)).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
Intent newMA= new Intent(FirstStartActivity.this,MainActivity.class);
|
||||
startActivity(newMA);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,256 @@
|
||||
package com.jkanetwork.st.calendariodefrases;
|
||||
|
||||
import android.content.ClipData;
|
||||
import android.content.ClipboardManager;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
import android.view.ContextMenu;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.google.android.gms.ads.AdRequest;
|
||||
import com.google.android.gms.ads.AdView;
|
||||
import com.google.android.gms.ads.MobileAds;
|
||||
import com.marcohc.robotocalendar.RobotoCalendarView.RobotoCalendarListener;
|
||||
import com.marcohc.robotocalendar.RobotoCalendarView;
|
||||
|
||||
import java.text.DateFormatSymbols;
|
||||
import java.util.Calendar;
|
||||
|
||||
|
||||
public class MainActivity extends AppCompatActivity implements RobotoCalendarListener {
|
||||
|
||||
private RobotoCalendarView robotoCalendarView;
|
||||
DatabaseHelper db = new DatabaseHelper(this);
|
||||
Calendar cal = Calendar.getInstance();
|
||||
Integer IDFrase;
|
||||
final Config conf = new Config(this);
|
||||
|
||||
/* Will use when move month back and forth, because library doesnt show the actual month.. */
|
||||
Integer calMonth = cal.get(Calendar.MONTH)+1; //From 1 to 12, and not from 0 to 11
|
||||
Integer calYear = cal.get(Calendar.YEAR);
|
||||
|
||||
/* Texts making all activity used, and valued in onCreate */
|
||||
TextView txtfraseTitle;
|
||||
TextView txtfraseText;
|
||||
TextView txtfraseAutor;
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
MenuInflater inflater = getMenuInflater();
|
||||
inflater.inflate(R.menu.main, menu);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case R.id.favorites:
|
||||
Intent newIF= new Intent(MainActivity.this,FavsActivity.class);
|
||||
startActivity(newIF);
|
||||
return true;
|
||||
case R.id.options:
|
||||
Intent newIO= new Intent(MainActivity.this,OptsActivity.class);
|
||||
startActivity(newIO);
|
||||
return true;
|
||||
case R.id.about:
|
||||
Intent newIA= new Intent(MainActivity.this,AboutOfActivity.class);
|
||||
startActivity(newIA);
|
||||
return true;
|
||||
case R.id.exit:
|
||||
moveTaskToBack(true); /* Returns to "desktop" */
|
||||
default:
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
/* First of all,before loading, see if its the first time using the app */
|
||||
if (conf.getFirstTime()){
|
||||
Intent newFA= new Intent(MainActivity.this,FirstStartActivity.class);
|
||||
startActivity(newFA);
|
||||
}
|
||||
|
||||
setContentView(R.layout.activity_main);
|
||||
txtfraseTitle = (TextView) findViewById(R.id.txt_frasetitle);
|
||||
txtfraseText = (TextView) findViewById(R.id.txt_frasetext);
|
||||
txtfraseAutor = (TextView) findViewById(R.id.txt_fraseautor);
|
||||
|
||||
/* Calendar basic settings */
|
||||
robotoCalendarView = (RobotoCalendarView) findViewById(R.id.calendarPicker);
|
||||
robotoCalendarView.setRobotoCalendarListener(this);
|
||||
robotoCalendarView.setShortWeekDays(false);
|
||||
robotoCalendarView.showDateTitle(true);
|
||||
|
||||
/* Admob ads */
|
||||
MobileAds.initialize(getApplicationContext(), MainActivity.this.getString(R.string.admob_launch_api));
|
||||
AdView mAdView = (AdView) findViewById(R.id.adView);
|
||||
AdRequest adRequest = new AdRequest.Builder().build();
|
||||
mAdView.loadAd(adRequest);
|
||||
|
||||
onResume(); /* Here all that as to be refreshed when app opens from background */
|
||||
|
||||
|
||||
/* Configure alarm */
|
||||
Alarm alarm = new Alarm();
|
||||
alarm.putAlarm(this);
|
||||
|
||||
/* Register context menu */
|
||||
registerForContextMenu(txtfraseText);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume(){
|
||||
super.onResume();
|
||||
/* Refresh calendar */
|
||||
cal = Calendar.getInstance();
|
||||
calMonth = cal.get(Calendar.MONTH)+1; //From 1 to 12, and not from 0 to 11
|
||||
calYear = cal.get(Calendar.YEAR);
|
||||
|
||||
|
||||
//Load today's sentence and set texts
|
||||
IDFrase = db.getIDFraseHoy();
|
||||
|
||||
/* Refresh calendar, after load sentences for checks */
|
||||
robotoCalendarView.updateView();
|
||||
markDates();
|
||||
|
||||
txtfraseText.setText(db.getFraseFromID(IDFrase));
|
||||
txtfraseAutor.setText(db.getAutorFromID(IDFrase));
|
||||
|
||||
|
||||
// ListView Item Click Listener
|
||||
txtfraseText.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View viewIn) {
|
||||
ClipboardManager clipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
|
||||
clipboard.setPrimaryClip(ClipData.newPlainText("Sentence", txtfraseText.getText()+MainActivity.this.getString(R.string.sharefrom)));
|
||||
Toast.makeText(getApplicationContext(), "Copiado al portapapeles", Toast.LENGTH_LONG ).show();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/* Close app on back button */
|
||||
@Override
|
||||
public void onBackPressed()
|
||||
{
|
||||
moveTaskToBack(true);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onCreateContextMenu(ContextMenu menu, View v,
|
||||
ContextMenu.ContextMenuInfo menuInfo) {
|
||||
super.onCreateContextMenu(menu, v, menuInfo);
|
||||
MenuInflater inflater = getMenuInflater();
|
||||
inflater.inflate(R.menu.proverbmenu_add, menu);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onContextItemSelected(MenuItem item) {
|
||||
TextView txtfraseText = (TextView) findViewById(R.id.txt_frasetext);
|
||||
String sentence = txtfraseText.getText().toString();
|
||||
switch (item.getItemId()) {
|
||||
case R.id.copy:
|
||||
ClipboardManager clipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
|
||||
clipboard.setPrimaryClip(ClipData.newPlainText("Sentence", sentence+MainActivity.this.getString(R.string.sharefrom)));
|
||||
Toast.makeText(getApplicationContext(), "Copiado al portapapeles", Toast.LENGTH_LONG ).show();
|
||||
return true;
|
||||
case R.id.addfav:
|
||||
db.addFav(IDFrase);
|
||||
return true;
|
||||
case R.id.share:
|
||||
Intent intent = new Intent(Intent.ACTION_SEND);
|
||||
intent.setType("text/plain");
|
||||
intent.putExtra(Intent.EXTRA_TEXT, sentence+MainActivity.this.getString(R.string.sharefrom));
|
||||
startActivity(Intent.createChooser(intent, "Compartir con"));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onDayClick(Calendar daySelectedCalendar) {
|
||||
Integer month = daySelectedCalendar.get(Calendar.MONTH);
|
||||
Integer day = daySelectedCalendar.get(Calendar.DAY_OF_MONTH);
|
||||
Integer year = daySelectedCalendar.get(Calendar.YEAR);
|
||||
month=month+1; //Now months start with 1 and not 0
|
||||
/* Load sentence */
|
||||
IDFrase = db.getIDFraseDay(year, month, day);
|
||||
String frase = db.getFraseFromID(IDFrase);
|
||||
txtfraseText.setText(frase); //Change text
|
||||
txtfraseAutor.setText(db.getAutorFromID(IDFrase));
|
||||
/* Set Title before sentence */
|
||||
if (year != cal.get(Calendar.YEAR) || month != (cal.get(Calendar.MONTH)+1) || day != cal.get(Calendar.DAY_OF_MONTH)) {
|
||||
txtfraseTitle.setText("Frase del " + day + " de " + getMonth(month)); //Change title
|
||||
}else {
|
||||
txtfraseTitle.setText(R.string.txt_todaysentence); //Change title (today)
|
||||
}
|
||||
//markDates(); TODO El programa borra el día seleccionado al hacerlo
|
||||
}
|
||||
|
||||
/** It returns the month name */
|
||||
public String getMonth(int month) {
|
||||
String str = new DateFormatSymbols().getMonths()[month-1];
|
||||
return str.substring(0, 1).toUpperCase() + str.substring(1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDayLongClick(Calendar daySelectedCalendar) {
|
||||
onDayClick(daySelectedCalendar);
|
||||
}
|
||||
|
||||
public void markDates() {
|
||||
robotoCalendarView.clearCalendar();
|
||||
|
||||
Calendar time = Calendar.getInstance();
|
||||
String[] IDDays = db.getAllDaysYet();
|
||||
if (IDDays.length != 0) {
|
||||
for (int x = 0; x <= IDDays.length - 1; x++) {
|
||||
//Log.d("Date", "String: " + String.valueOf(IDDays[x]));
|
||||
Integer year = Integer.parseInt(IDDays[x].substring(0, 4));
|
||||
Integer month = Integer.parseInt(IDDays[x].substring(4, 6));
|
||||
Integer day = Integer.parseInt(IDDays[x].substring(6, 8));
|
||||
if (year.equals(calYear) && month.equals(calMonth)) {
|
||||
time.set(Calendar.DAY_OF_MONTH, day);
|
||||
time.set(Calendar.MONTH, month-1);
|
||||
//Log.d("Date", "Marking: " + day);
|
||||
robotoCalendarView.markCircleImage1(time);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Overrides for month plus and minus */
|
||||
@Override
|
||||
public void onRightButtonClick() {
|
||||
calMonth += 1;
|
||||
if (calMonth > 12){
|
||||
calMonth = 1;
|
||||
calYear += 1;
|
||||
}
|
||||
markDates();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLeftButtonClick() {
|
||||
calMonth -= 1;
|
||||
if (calMonth < 1){
|
||||
calMonth = 12;
|
||||
calYear -= 1;
|
||||
}
|
||||
markDates();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
package com.jkanetwork.st.calendariodefrases;
|
||||
|
||||
|
||||
|
||||
import android.app.Notification;
|
||||
import android.app.NotificationManager;
|
||||
import android.app.PendingIntent;
|
||||
import android.app.Service;
|
||||
import android.content.Intent;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.os.IBinder;
|
||||
import android.support.v7.app.NotificationCompat;
|
||||
import android.util.Log;
|
||||
|
||||
|
||||
/**
|
||||
* Created by kprkpr on 20/03/17.
|
||||
*/
|
||||
|
||||
public class NotificationHelper extends Service {
|
||||
private static final String TAG = "NotificationHelper";
|
||||
DatabaseHelper db = new DatabaseHelper(this);
|
||||
|
||||
@Override
|
||||
public IBinder onBind(Intent i) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int onStartCommand(final Intent intent, int flags, int startId) {
|
||||
|
||||
new Thread(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
Log.d(TAG, "Service Started");
|
||||
// El servicio se finaliza a sí mismo cuando finaliza su
|
||||
// trabajo.
|
||||
final Config conf = new Config(NotificationHelper.this);
|
||||
try {
|
||||
// Instanciamos e inicializamos nuestro manager.
|
||||
NotificationManager nm = (NotificationManager)getSystemService(NOTIFICATION_SERVICE);
|
||||
nm.cancel(1); /* Cancel first */
|
||||
if (conf.getNotifOn().equals(true)) { /* Only set things if notification is enabled */
|
||||
Intent OpenIntent = new Intent(NotificationHelper.this, MainActivity.class);
|
||||
PendingIntent notifIntent = PendingIntent.getActivity(NotificationHelper.this, 0, OpenIntent, 0);
|
||||
|
||||
CharSequence ticker = "Frase del día";
|
||||
CharSequence contentTitle = "Frase de hoy:";
|
||||
CharSequence contentText = db.getFraseFromID(db.getIDFraseHoy());
|
||||
NotificationCompat.Builder notibuilder = (android.support.v7.app.NotificationCompat.Builder) new NotificationCompat.Builder(NotificationHelper.this)
|
||||
.setContentIntent(notifIntent)
|
||||
.setTicker(ticker)
|
||||
.setContentTitle(contentTitle)
|
||||
.setStyle(new NotificationCompat.BigTextStyle().bigText(contentText)) /* For big texts */
|
||||
.setContentText(contentText) /* For when bigText cant be show */
|
||||
.setLargeIcon(BitmapFactory.decodeResource(NotificationHelper.this.getResources(), R.mipmap.ic_launcher));
|
||||
/* If lollipop, new white icon, if not, grey icon */
|
||||
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP){
|
||||
notibuilder.setSmallIcon(R.drawable.notifwhite);
|
||||
} else{
|
||||
notibuilder.setSmallIcon(R.drawable.notifgris);
|
||||
}
|
||||
|
||||
Notification noti = notibuilder.build();
|
||||
if (conf.getPersistNotifOn().equals(true)) {
|
||||
noti.flags = Notification.FLAG_ONGOING_EVENT;
|
||||
}
|
||||
nm.notify(1, noti);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
}).start();
|
||||
Log.d(TAG, "Service Finished");
|
||||
this.stopSelf();
|
||||
return super.onStartCommand(intent, flags, startId);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,138 @@
|
||||
package com.jkanetwork.st.calendariodefrases;
|
||||
|
||||
import android.app.NotificationManager;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.view.View;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.Button;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.Spinner;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static java.lang.String.valueOf;
|
||||
|
||||
|
||||
/**
|
||||
* Created by kprkpr on 21/03/17.
|
||||
*/
|
||||
|
||||
public class OptsActivity extends AppCompatActivity {
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_opts);
|
||||
final Config conf = new Config(this);
|
||||
/* Do variables of objects */
|
||||
final Spinner spinnerHour = (Spinner) findViewById(R.id.spinnerHour);
|
||||
final Spinner spinnerMinute = (Spinner) findViewById(R.id.spinnerMinute);
|
||||
final CheckBox chkalarm = (CheckBox) findViewById(R.id.chk_alarm);
|
||||
final CheckBox chkpersistent = (CheckBox) findViewById(R.id.chk_persistent);
|
||||
/* Set texts and checks from configs */
|
||||
chkalarm.setChecked(conf.getNotifOn());
|
||||
chkpersistent.setChecked(conf.getPersistNotifOn());
|
||||
|
||||
// Hour and minute elements create
|
||||
|
||||
// Spinner Drop down elements
|
||||
List<Integer> Hours = new ArrayList<>();
|
||||
for (int x = 0; x <= 23; x++) {
|
||||
Hours.add(x);
|
||||
}
|
||||
List<Integer> Minutes = new ArrayList<>();
|
||||
for (int x = 0; x <= 59; x++) {
|
||||
Minutes.add(x);
|
||||
}
|
||||
// Creating adapter for spinner
|
||||
ArrayAdapter<Integer> hourAdapter = new ArrayAdapter<>(this, android.R.layout.simple_spinner_item, Hours);
|
||||
ArrayAdapter<Integer> minuteAdapter = new ArrayAdapter<>(this, android.R.layout.simple_spinner_item, Minutes);
|
||||
// Drop down layout style - list view with radio button
|
||||
hourAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||
minuteAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||
// attaching data adapter to spinner
|
||||
spinnerHour.setAdapter(hourAdapter);
|
||||
spinnerMinute.setAdapter(minuteAdapter);
|
||||
|
||||
spinnerHour.setSelection(conf.getHour());
|
||||
spinnerMinute.setSelection(conf.getMinute());
|
||||
|
||||
|
||||
setEnabledParts();
|
||||
|
||||
/* Disable options if notification is disabled */
|
||||
chkalarm.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
setEnabledParts();
|
||||
}
|
||||
});
|
||||
/* For not set date if persistent is enabled */
|
||||
chkpersistent.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
setEnabledParts();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Button btnsave = (Button) findViewById(R.id.btnSaveNotif);
|
||||
btnsave.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
Integer hourSave, minuteSave;
|
||||
|
||||
hourSave = Integer.decode(String.valueOf(spinnerHour.getSelectedItemPosition()));
|
||||
|
||||
minuteSave = Integer.decode(String.valueOf(spinnerMinute.getSelectedItemPosition()));
|
||||
|
||||
conf.setHour(hourSave);
|
||||
conf.setMinute(minuteSave);
|
||||
//Log.d("EnabledNotif", String.valueOf(chkalarm.isChecked()));
|
||||
/* Enable or disable notification and persistent */
|
||||
conf.setNotifOn(chkalarm.isChecked());
|
||||
conf.setPersistNotifOn(chkpersistent.isChecked());
|
||||
|
||||
/* Cancel notif when save changes first */
|
||||
NotificationManager nm = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
|
||||
nm.cancel(1);
|
||||
|
||||
Alarm alarm = new Alarm();
|
||||
alarm.putAlarm(OptsActivity.this);
|
||||
if (chkpersistent.isChecked() && chkalarm.isChecked()) {
|
||||
OptsActivity.this.startService(new Intent(OptsActivity.this, NotificationHelper.class));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
public void setEnabledParts(){
|
||||
/* I have to set vars again because is out of onCreate */
|
||||
Spinner notifHour = (Spinner) findViewById(R.id.spinnerHour);
|
||||
Spinner notifMinute = (Spinner) findViewById(R.id.spinnerMinute);
|
||||
CheckBox chkalarm = (CheckBox) findViewById(R.id.chk_alarm);
|
||||
CheckBox chkpersistent = (CheckBox) findViewById(R.id.chk_persistent);
|
||||
if (chkalarm.isChecked()){
|
||||
chkpersistent.setEnabled(true);
|
||||
/* This other checks is chkpersistent checked dependent */
|
||||
if (chkpersistent.isChecked()){
|
||||
notifHour.setEnabled(false);
|
||||
notifMinute.setEnabled(false);
|
||||
}else{
|
||||
notifHour.setEnabled(true);
|
||||
notifMinute.setEnabled(true);
|
||||
}
|
||||
}else{
|
||||
chkpersistent.setEnabled(false);
|
||||
notifHour.setEnabled(false);
|
||||
notifMinute.setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
BIN
app/src/main/res/drawable/cerebro.png
Normal file
|
After Width: | Height: | Size: 168 KiB |
BIN
app/src/main/res/drawable/fondo_opts.png
Normal file
|
After Width: | Height: | Size: 83 KiB |
BIN
app/src/main/res/drawable/notifgris.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
app/src/main/res/drawable/notifwhite.png
Normal file
|
After Width: | Height: | Size: 395 B |
17
app/src/main/res/layout/activity_about.xml
Normal file
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/cerebro"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textStart"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="8dp"
|
||||
android:text='Programado por JKA Network.\n\nLicencias\nRoboto Calendar View - Apache 2.0'
|
||||
android:textAlignment="center"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
|
||||
android:textSize="18sp" />
|
||||
</LinearLayout>
|
||||
10
app/src/main/res/layout/activity_favs.xml
Normal file
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical" android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<ListView
|
||||
android:id="@+id/listSentences"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
</LinearLayout>
|
||||
20
app/src/main/res/layout/activity_first.xml
Normal file
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical" android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textStart"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="8dp"
|
||||
android:text='Bienvenidos a Calendario de Frases, donde cada día disfrutarás de una nueva cita celebre o de un nuevo refrán que podrás guardar o compartir con tus amigos.\nAdemás, podrás poner una notificación para que te avise de la frase del día a la hora que quieras, por ejemplo, al desperarte.\nEsperamos que la disfrutes.'
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
|
||||
android:textSize="18sp" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnStart"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Empezar" />
|
||||
</LinearLayout>
|
||||
76
app/src/main/res/layout/activity_main.xml
Normal file
@@ -0,0 +1,76 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
xmlns:ads="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txt_frasetitle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="24dp"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_marginTop="10dp"
|
||||
android:text="@string/txt_todaysentence"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@android:color/black"
|
||||
android:textSize="18sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txt_frasetext"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_below="@+id/txt_frasetitle"
|
||||
android:layout_marginLeft="6dp"
|
||||
android:layout_marginRight="6dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:text="(Aqui la frase)"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@android:color/black"
|
||||
android:textSize="18sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txt_fraseautor"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="20dp"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_below="@+id/txt_frasetext"
|
||||
android:layout_gravity="end"
|
||||
android:layout_marginRight="6dp"
|
||||
android:layout_marginTop="4dp"
|
||||
android:text="(Aqui autor)"
|
||||
android:textAlignment="textEnd"
|
||||
android:textColor="#222" />
|
||||
|
||||
<com.marcohc.robotocalendar.RobotoCalendarView
|
||||
android:id="@+id/calendarPicker"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="310dp"
|
||||
android:layout_below="@+id/txt_fraseautor"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_marginTop="13dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView3"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_below="@+id/calendarPicker"
|
||||
android:text="Selecciona un día para ver frases anteriores" />
|
||||
|
||||
|
||||
<com.google.android.gms.ads.AdView
|
||||
android:id="@+id/adView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="50dp"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
ads:adSize="SMART_BANNER"
|
||||
ads:adUnitId="@string/banner_ad_unit_id" />
|
||||
</RelativeLayout>
|
||||
85
app/src/main/res/layout/activity_opts.xml
Normal file
@@ -0,0 +1,85 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="368dp"
|
||||
android:layout_height="495dp"
|
||||
android:layout_margin="4dp"
|
||||
android:background="@drawable/fondo_opts"
|
||||
android:orientation="vertical">
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/chk_alarm"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="57dp"
|
||||
android:elevation="1dp"
|
||||
android:text="¿Notificar frase diaria?"
|
||||
android:textAlignment="textStart" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/chk_persistent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="57dp"
|
||||
android:text="¿Quieres que sea persistente?"
|
||||
android:textAlignment="textStart" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/layoutWhen"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="48dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="8dp"
|
||||
android:layout_weight="1"
|
||||
android:paddingTop="12dp"
|
||||
android:singleLine="false"
|
||||
android:text="Cuando mostrar:"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@android:color/black"
|
||||
android:textSize="18sp" />
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/spinnerHour"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="48dp"
|
||||
android:layout_weight="1"
|
||||
android:dropDownWidth="80dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtseptime"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="4dp"
|
||||
android:layout_marginRight="4dp"
|
||||
android:layout_weight="0.02"
|
||||
android:elevation="1dp"
|
||||
android:text=":"
|
||||
android:textColor="@android:color/black"
|
||||
android:textSize="18sp" />
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/spinnerMinute"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="48dp"
|
||||
android:layout_weight="1"
|
||||
android:dropDownWidth="80dp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnSaveNotif"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:text="Guardar cambios" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
15
app/src/main/res/menu/main.xml
Normal file
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item
|
||||
android:id="@+id/favorites"
|
||||
android:title="@string/favorites"/>
|
||||
<item
|
||||
android:id="@+id/options"
|
||||
android:title="@string/options"/>
|
||||
<item
|
||||
android:id="@+id/about"
|
||||
android:title="Acerca de"/>
|
||||
<item
|
||||
android:id="@+id/exit"
|
||||
android:title="@string/exit"/>
|
||||
</menu>
|
||||
13
app/src/main/res/menu/proverbmenu_add.xml
Normal file
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item android:id="@+id/copy"
|
||||
android:title="Copiar" />
|
||||
|
||||
<item android:id="@+id/addfav"
|
||||
android:title="Añadir a favoritos" />
|
||||
|
||||
<item android:id="@+id/share"
|
||||
android:title="Compartir" />
|
||||
</menu>
|
||||
13
app/src/main/res/menu/proverbmenu_del.xml
Normal file
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item android:id="@+id/copy"
|
||||
android:title="Copiar" />
|
||||
|
||||
<item android:id="@+id/delfav"
|
||||
android:title="Borrar de los favoritos" />
|
||||
|
||||
<item android:id="@+id/share"
|
||||
android:title="Compartir" />
|
||||
</menu>
|
||||
BIN
app/src/main/res/mipmap-hdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 3.8 KiB |
BIN
app/src/main/res/mipmap-mdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 2.6 KiB |
BIN
app/src/main/res/mipmap-xhdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 5.4 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 8.8 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 13 KiB |
80
app/src/main/res/raw/sqlautores
Normal file
@@ -0,0 +1,80 @@
|
||||
INSERT INTO `autores` VALUES (1,'Jean Cocteau'),
|
||||
(2,'Friedrich Nietzsche'),
|
||||
(3,'Proverbio Alemán'),
|
||||
(4,'Louise L. Hay'),
|
||||
(5,'Yoshinori Noguchi'),
|
||||
(6,'Publilio Siro'),
|
||||
(7,'Isabel de Rumania'),
|
||||
(8,'Franklin, B.'),
|
||||
(9,'Refrán'),
|
||||
(10,'Anaxágoras'),
|
||||
(11,'David Hume'),
|
||||
(12,'Albert Einstein'),
|
||||
(13,'Aristóteles'),
|
||||
(14,'George Bernard Shaw'),
|
||||
(15,'Lutero'),
|
||||
(16,'Pitágoras'),
|
||||
(17,'Andrés Holguín'),
|
||||
(18,'Juvenal'),
|
||||
(19,'Enrique Mariscal'),
|
||||
(20,'Anónimo'),
|
||||
(21,'Nietzsche'),
|
||||
(22,'Bertold Brecht'),
|
||||
(23,'Syro'),
|
||||
(24,'Anónimo inglés'),
|
||||
(25,'Alfred Croiset'),
|
||||
(26,'Epícteto'),
|
||||
(27,'Victor Hugo'),
|
||||
(28,'Steve Jobs'),
|
||||
(29,'Proverbio Africano'),
|
||||
(30,'Goete'),
|
||||
(31,'Publio Sirio'),
|
||||
(32,'Napoleón'),
|
||||
(33,'Espartaco'),
|
||||
(34,'Nicolás Mancini'),
|
||||
(35,'Eclesiastés'),
|
||||
(36,'Torres y Villarroel'),
|
||||
(37,'Luis Rosales'),
|
||||
(38,'Arnold'),
|
||||
(39,'Pedro Salinas'),
|
||||
(40,'Lina Furlan'),
|
||||
(41,'Séneca'),
|
||||
(42,'R. Burton'),
|
||||
(43,'Winston Churchill'),
|
||||
(44,'Stuart Chase'),
|
||||
(45,'Victoria Farnsworth'),
|
||||
(46,'OG Mandino'),
|
||||
(47,'José de J. Quintero'),
|
||||
(48,'Peterson'),
|
||||
(49,'Quevedo'),
|
||||
(50,'Cicerón'),
|
||||
(51,'Jacinto Benavente'),
|
||||
(52,'Henry Fonda'),
|
||||
(53,'Carlyle'),
|
||||
(54,'José Ingenieros'),
|
||||
(55,'Shakespeare'),
|
||||
(56,'David Goldber'),
|
||||
(57,'Ortega y Gasset'),
|
||||
(58,'Miguel Ángel'),
|
||||
(59,'E. Cioran'),
|
||||
(60,'Buda'),
|
||||
(61,'Lord Byron'),
|
||||
(62,'Espronceda'),
|
||||
(63,'Adolf Hitler'),
|
||||
(64,'Mary Lyon'),
|
||||
(65,'Oscar Wilde'),
|
||||
(66,'Frank Lloyd'),
|
||||
(67,'Vincent van Gogh'),
|
||||
(68,'Salvador Dalí'),
|
||||
(69,'Leonardo da Vinci'),
|
||||
(70,'Will Smith'),
|
||||
(71,'Nikita Jrushchov'),
|
||||
(72,'Platón'),
|
||||
(73,'John Maynard Keynes'),
|
||||
(74,'Bertrand Russell'),
|
||||
(75,'Kevyn Aucoin'),
|
||||
(76,'Gandhi'),
|
||||
(77,'Jonny Depp'),
|
||||
(78,'Margaret Thatcher'),
|
||||
(79,'Agatha Christie'),
|
||||
(80,'Mario Benedetti');
|
||||
117
app/src/main/res/raw/sqlfrases
Normal file
@@ -0,0 +1,117 @@
|
||||
INSERT INTO `frases` VALUES (1,'Un vaso medio vacío de vino es también uno medio lleno, pero una mentira a medias de ningún modo es una media verdad.','1'),
|
||||
(2,'A menudo la sensualidad apresura el crecimiento del amor, de modo que la raíz queda débil y es fácil de arrancar.','2'),
|
||||
(3,'Perdonar no es olvidar, y en el perdón sin olvido sobran palabras y falta corazón.','3'),
|
||||
(4,'Cada vez que decimos; «No sé », nos cerramos la puerta de nuestra propia fuente de sabiduría, que es infinita.','4'),
|
||||
(5,'Cuando os disculpáis o dais las gracias, lo ideal es hacerlo sin esperar a que los otros cambien.','5'),
|
||||
(6,'Ningún hombre es feliz a menos que crea serlo.','6'),
|
||||
(7,'La amistad disminuye cuando hay demasiada felicidad de una parte y demasiada desgracia de la otra.','7'),
|
||||
(8,'La pereza hace que todo sea difícil; el trabajo lo vuelve todo fácil.','8'),
|
||||
(9,'A nadie le amarga un dulce.','9'),
|
||||
(10,'Si me engañas una vez, tuya es la culpa; si me engañas dos, es mía.','10'),
|
||||
(11,'Todo el mundo se queja de su mala memoria; nadie de su poco entendimiento.','11'),
|
||||
(12,'Hay una fuerza motriz más poderosa que el vapor, la electricidad y la energía atómica: la voluntad.','12'),
|
||||
(13,'Piensa como piensan los sabios, mas habla como habla la gente sencilla.','13'),
|
||||
(14,'Algunas personas miran al mundo y dicen Porque? Otras miran al mundo y dicen Porque no?.','14'),
|
||||
(15,'Aunque el final del mundo sea mañana, hoy plantaré manzanos en mi huerto.','15'),
|
||||
(16,'Ayuda a tus semejantes a levantar su carga, pero no te consideres obligado a llevársela.','16'),
|
||||
(17,'Cada hombre que haya amado verdaderamente podrá pensar que no ha vivido en vano.','17'),
|
||||
(18,'Confiar en todos es insensato; pero no confiar en nadie es neurótica torpeza.','18'),
|
||||
(19,'A buen hambre, no hay pan duro.','9'),
|
||||
(20,'A lo hecho, pecho.','9'),
|
||||
(21,'Hay que tomarse un tiempo para ver. Necesitamos una pausa para reaccionar, para comprender, una distancia para «darnos cuenta».','19'),
|
||||
(22,'Cuanto más se tiene, más se quiere.','9'),
|
||||
(23,'Date prisa, pero no corras.','9'),
|
||||
(24,'El que pega primero, pega dos veces.','20'),
|
||||
(25,'Los que combaten contra monstruos deben cuidarse de no convertirse en uno. ¿Por qué? Porque cuando miras hacia el abismo, el abismo te devuelve la mirada.','21'),
|
||||
(26,'Cuando Dios creó al Mundo, vio que era bueno. Qué dirá ahora?','14'),
|
||||
(27,'Cuando el delito se multiplica, nadie quiere verlo.','22'),
|
||||
(28,'De noventa enfermedades, cincuenta las produce la culpa y cuarenta la ignorancia.','23'),
|
||||
(29,'El éxito lo obtienen aquellos que están seguros del él.','20'),
|
||||
(30,'El dinero nunca va a la cárcel.','24'),
|
||||
(31,'El enemigo más temible de la democracia es la demagogia.','25'),
|
||||
(32,'El error del anciano es que pretende enjuiciar el hoy con el criterio del ayer.','26'),
|
||||
(33,'Nadie quiere la vaca si regalas la leche.','9'),
|
||||
(34,'El alma tiene ilusiones como el pájaro tiene alas. Eso es la que la sostiene.','27'),
|
||||
(35,'No dejes que el ruido de las opiniones apague tu propia voz interior.','28'),
|
||||
(36,'Si quieres llegar rápido camina solo. Si quieres llegar lejos camina en grupo.','29'),
|
||||
(37,'Ningún mar en calma hizo experto a un marinero.','20'),
|
||||
(38,'La ley es poderosa, pero más poderosa es la necesidad.','30'),
|
||||
(39,'La prudencia suele faltar cuando más se le necesite.','31'),
|
||||
(40,'La realidad tiene límites; la estupidez no.','32'),
|
||||
(41,'Es preferible morir a odiar y temer: es preferible morir dos veces a hacerse odiar y temer.','21'),
|
||||
(42,'Lo que me preocupa no es que me hayas mentido, sino que, de ahora en adelante, ya no podré creer en ti.','21'),
|
||||
(43,'Los espartanos no preguntaban cuántos eran los enemigos, sino dónde estaban.','33'),
|
||||
(44,'Me interesa el futuro porque en él voy a pasar el resto de mi vida.','34'),
|
||||
(45,'Mejor es oír el reproche de un sabio que escuchar las cantinelas de los necios.','35'),
|
||||
(46,'Lo que aprovecha es tener buenas costumbres. Que estas valen más que los buenos parientes.','36'),
|
||||
(47,'Sobre la humildad se fundan todas las demás virtudes y quien carece de humildad no puede vivir cristianamente.','37'),
|
||||
(48,'Sólo aquellos que nada esperan del azar son auténticamente dueños de su destino.','38'),
|
||||
(49,'Verdadera maestra de la vida no hay más que una, la experiencia; y tiene escuela abierta para todos.','39'),
|
||||
(50,'Vida: Breve período que se divide en dos partes; durante la primera se desea que venga la segunda, y durante la segunda se desea que vuelva la primera.','40'),
|
||||
(51,'Viven más contentos aquellos en quienes jamás puso los ojos la fortuna, que los otros de quienes los apartó.','41'),
|
||||
(52,'Una palabra hiere más profundamente que una espada.','42'),
|
||||
(53,'Vivid arduamente, no temáis nada y os sonreirá el triunfo.','43'),
|
||||
(54,'Tu libertad para agitar los brazos termina en donde comienza mi nariz.','44'),
|
||||
(55,'Sólo cuando llegué a ser madre comprendí cuanto se había sacrificado la mía por mí.','45'),
|
||||
(56,'Sólo el gusano está libre de la preocupación de no tropezar.','46'),
|
||||
(57,'Sólo el hombre que alberga en su espíritu la fuerza de la nobleza forja el camino de sus mayores logros.','47'),
|
||||
(58,'Sólo el que ha hecho un buen camino puede esperar su fin con alegría.','48'),
|
||||
(59,'Sólo el que manda con amor es servido con fidelidad.','49'),
|
||||
(60,'Un cuarto sin libros es como un cuerpo sin alma.','50'),
|
||||
(61,'Todos creen que tener talento es cuestión de suerte; nadie piensa que la suerte puede ser cuestión de talento.','51'),
|
||||
(62,'Todos encontrarían su propia vida mucho más interesante si dejaran de compararla con la vida de los demás.','52'),
|
||||
(63,'Tarea delicada la de apaciguar muchedumbres, porque hacer mucho puede ser tan funesto como no hacer nada.','53'),
|
||||
(64,'Los que se quejan de la forma como rebota la pelota, son aquellos que no la saben golpear.','54'),
|
||||
(65,'Los sabios buscan la sabiduría; los necios creen haberla encontrado.','32'),
|
||||
(66,'Fuertes razones, hacen fuertes acciones.','55'),
|
||||
(67,'Generalmente se dice que el primer deber del soldado es morir por su patria. No es así. Su primer deber es procurar que el soldado enemigo muera por la suya.','56'),
|
||||
(68,'De querer ser a creer que se es ya, va la distancia de lo trágico a lo cómico.','57'),
|
||||
(69,'Se pinta con el cerebro, no con las manos.','58'),
|
||||
(70,'Podemos imaginarlo todo, predecirlo todo, salvo hasta dónde podemos hundirnos.','59'),
|
||||
(71,'El odio no se termina con odio, se termina con amor, es la regla eterna','60'),
|
||||
(72,'La duda es el principio de la sabiduría','13'),
|
||||
(73,'Nunca aconsejéis a un hombre que desconfíe de una mujer con la que ya esté casado. Es demasiado tarde para él.','61'),
|
||||
(74,'Hay ladrones a los que no se castiga, pero que roban lo más preciado: el tiempo.','32'),
|
||||
(75,'Y en sueños confunde la muerte, la vida: recuerda y olvida, suspira, respira con hórrido afán.','62'),
|
||||
(76,'El mejor profeta del futuro es el pasado.','61'),
|
||||
(77,'Nunca interrumpas a tu enemigo cuando está cometiendo un error.','32'),
|
||||
(78,'Cuanto más conozco a la gente, más me gusta mi perro.','63'),
|
||||
(79,'No hace falta un gobierno perfecto; se necesita uno que sea práctico.','13'),
|
||||
(80,'Si alguien piensa que no tiene responsabilidades, es que no las ha descubierto.','64'),
|
||||
(81,'Sé tú mismo, el resto de los papeles ya están cogidos.','65'),
|
||||
(82,'Si se vende, es arte.','66'),
|
||||
(83,'El río abre un cauce y luego el cauce esclaviza al río.','57'),
|
||||
(84,'Prefiero morir de pasión que de aburrimiento.','67'),
|
||||
(85,'No tengas miedo de la perfección, nunca la alcanzarás.','68'),
|
||||
(86,'Pobre es el alumno que no supera a su maestro.','69'),
|
||||
(87,'El odio es la demencia del corazón.','61'),
|
||||
(88,'Perdona a tu enemigo. No hay nada que le enfurezca más.','65'),
|
||||
(89,'El placer más noble es el júbilo de comprender.','69'),
|
||||
(90,'Hay tres cosas que no se pueden ocultar por mucho tiempo: El sol, la luna y la verdad.','60'),
|
||||
(91,'El deseo muere automáticamente cuando se logra: fenece al satisfacerse. El amor en cambio, es un eterno insatisfecho.','57'),
|
||||
(92,'Las causas y efectos no pueden descubrirse por la razón, sino por la experiencia.','11'),
|
||||
(93,'Como no fue genial, no tuvo enemigos.','65'),
|
||||
(94,'La gente que no logra conseguir sus sueños suele decirle a los demás que tampoco cumplirán los suyos.','70'),
|
||||
(95,'Los políticos son siempre lo mismo. Prometen construir un puente aunque no haya río.','71'),
|
||||
(96,'No existen más que dos reglas para escribir: tener algo que decir y decirlo.','65'),
|
||||
(97,'Pensar es el diálogo del alma consigo misma.','72'),
|
||||
(98,'Sé lo que hace a un hombre más conservador... No saber nada del presente o nada del pasado.','73'),
|
||||
(99,'Nos moldean nuestros pensamientos. Aquellos con mentes libres de pensamientos egoístas producen alegría cuando hablan o actúan. La felicidad los sigue como una sombra.','60'),
|
||||
(100,'Los científicos se esfuerzan por hacer posible lo imposible. Los políticos por hacer lo posible imposible.','74'),
|
||||
(101,'No hay maquillaje en el mundo que pueda embellecer un corazón feo.','75'),
|
||||
(102,'Vive como si fueras a morir mañana. Aprende a vivir como si fueras a vivir para siempre.','76'),
|
||||
(103,'Los hombres geniales empiezan grandes obras, los hombres trabajadores las terminan.','69'),
|
||||
(104,'Requiere más coraje sufrir que morir.','32'),
|
||||
(105,'La valentía es saber qué es lo que no debemos temer.','72'),
|
||||
(106,'los períodos largos son una guía engañosa para los temas de actualidad. A largo plazo estamos todos muertos.','73'),
|
||||
(107,'La vida bien empleada es larga.','69'),
|
||||
(108,'Para que la herida sane, hay que dejar de tocarla.','20'),
|
||||
(109,'En lo que pensamos nos convertimos.','60'),
|
||||
(110,'Si amas a dos personas al mismo tiempo, elige a la segunda. Porque si realmente amaras a la primera, no te habrías enamorado de la segunda','77'),
|
||||
(111,'La misión de lo políticos no es la de gustar a todo el mundo.','78'),
|
||||
(112,'Mi alma no encuentra escalera al cielo a menos que sea a través de la hermosura de la tierra.','58'),
|
||||
(113,'La amistad es un alma que habita en dos cuerpos, un corazón que habita en dos almas.','13'),
|
||||
(114,'Cuando el hombre cesa de crear, deja de existir.','61'),
|
||||
(115,'Las conversaciones son siempre peligrosas si se tiene algo que ocultar.','79'),
|
||||
(116,'Cuando creíamos que teníamos todas las respuestas, de pronto, cambiaron todas las preguntas.','80'),
|
||||
(117,'Cállate o di algo mejor que el silencio.','16');
|
||||
18
app/src/main/res/values/colors.xml
Normal file
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="colorPrimary">#3F51B5</color>
|
||||
<color name="colorPrimaryDark">#303F9F</color>
|
||||
<color name="colorAccent">#f46283</color>
|
||||
|
||||
<!-- Calendar colors -->
|
||||
<color name="roboto_calendar_background">#340079c4</color> <!-- Transparent -->
|
||||
<color name="roboto_calendar_day_of_the_week_font">#161d20</color>
|
||||
<color name="roboto_calendar_selected_day_font">#FFFFFF</color>
|
||||
<color name="roboto_calendar_selected_day_background">#f46283</color>
|
||||
<color name="roboto_calendar_current_day_ring">#393939</color>
|
||||
<color name="roboto_calendar_day_of_the_month_font">#000000</color>
|
||||
<color name="roboto_calendar_circle_1">#e2015b</color>
|
||||
<color name="roboto_calendar_circle_2">#404040</color>
|
||||
<color name="roboto_calendar_month_font">#3F51B5</color>
|
||||
<color name="roboto_calendar_month_arrow">#3F51B5</color>
|
||||
</resources>
|
||||
16
app/src/main/res/values/dimens.xml
Normal file
@@ -0,0 +1,16 @@
|
||||
<resources>
|
||||
<dimen name="fab_margin">16dp</dimen>
|
||||
|
||||
<!-- Calendar dimens -->
|
||||
<dimen name="roboto_calendar_padding">8dp</dimen>
|
||||
<dimen name="roboto_calendar_month_margin_bottom">8dp</dimen>
|
||||
<dimen name="roboto_calendar_week_margin_bottom">5dp</dimen>
|
||||
<dimen name="roboto_calendar_day_of_the_month_background_size">40dp</dimen>
|
||||
<dimen name="roboto_calendar_circle_size">4dp</dimen>
|
||||
<dimen name="roboto_calendar_ring_size">18dp</dimen>
|
||||
<dimen name="roboto_calendar_month_font">18sp</dimen>
|
||||
<dimen name="roboto_calendar_day_of_week_font">16sp</dimen>
|
||||
<dimen name="roboto_calendar_day_of_the_month_font">16sp</dimen>
|
||||
|
||||
|
||||
</resources>
|
||||
9
app/src/main/res/values/strings.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<resources>
|
||||
<string name="app_name">Calendario de frases</string>
|
||||
<string name="txt_todaysentence">Frase del día</string>
|
||||
<string name="exit">Salir</string>
|
||||
<string name="favorites">Favoritos</string>
|
||||
<string name="options">Opciones</string>
|
||||
<string name="sharefrom"> -A través de Calendario de Frases, consíguela aquí https://goo.gl/m4qzKI -</string>
|
||||
|
||||
</resources>
|
||||
23
app/src/main/res/values/styles.xml
Normal file
@@ -0,0 +1,23 @@
|
||||
<resources>
|
||||
|
||||
<!-- Base application theme. -->
|
||||
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
|
||||
<!-- Customize your theme here. -->
|
||||
<item name="colorPrimary">@color/colorPrimary</item>
|
||||
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
||||
<item name="colorAccent">@color/colorAccent</item>
|
||||
</style>
|
||||
|
||||
<style name="AppTheme.NoActionBar">
|
||||
<item name="windowActionBar">false</item>
|
||||
<item name="windowNoTitle">true</item>
|
||||
</style>
|
||||
|
||||
|
||||
|
||||
|
||||
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
|
||||
|
||||
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
|
||||
|
||||
</resources>
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.jkanetwork.st.calendariodefrases;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Example local unit test, which will execute on the development machine (host).
|
||||
*
|
||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||
*/
|
||||
public class ExampleUnitTest {
|
||||
@Test
|
||||
public void addition_isCorrect() throws Exception {
|
||||
assertEquals(4, 2 + 2);
|
||||
}
|
||||
}
|
||||
2
app/version.count
Normal file
@@ -0,0 +1,2 @@
|
||||
#Sat Jun 03 13:17:36 CEST 2017
|
||||
VERSION_CODE=140
|
||||
26
build.gradle
Normal file
@@ -0,0 +1,26 @@
|
||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:2.3.2'
|
||||
|
||||
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
// in the individual module build.gradle files
|
||||
}
|
||||
}
|
||||
|
||||
allprojects {
|
||||
repositories {
|
||||
jcenter()
|
||||
maven { url 'https://jitpack.io' }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
task clean(type: Delete) {
|
||||
delete rootProject.buildDir
|
||||
}
|
||||
10
createimgs
Normal file
@@ -0,0 +1,10 @@
|
||||
#!/bin/bash
|
||||
## Create the .pngs from a 512x512 img using "convert"
|
||||
img=logo512.png
|
||||
convert $img -resize 192x192 /tmp/a.png && pngcrush -reduce -brute /tmp/a.png app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
|
||||
convert $img -resize 144x144 /tmp/a.png && pngcrush -reduce -brute /tmp/a.png app/src/main/res/mipmap-xxhdpi/ic_launcher.png
|
||||
convert $img -resize 96x96 /tmp/a.png && pngcrush -reduce -brute /tmp/a.png app/src/main/res/mipmap-xhdpi/ic_launcher.png
|
||||
convert $img -resize 72x72 /tmp/a.png && pngcrush -reduce -brute /tmp/a.png app/src/main/res/mipmap-hdpi/ic_launcher.png
|
||||
convert $img -resize 48x48 /tmp/a.png && pngcrush -reduce -brute /tmp/a.png app/src/main/res/mipmap-mdpi/ic_launcher.png
|
||||
|
||||
rm /tmp/a.png
|
||||
17
gradle.properties
Normal file
@@ -0,0 +1,17 @@
|
||||
# Project-wide Gradle settings.
|
||||
|
||||
# IDE (e.g. Android Studio) users:
|
||||
# Gradle settings configured through the IDE *will override*
|
||||
# any settings specified in this file.
|
||||
|
||||
# For more details on how to configure your build environment visit
|
||||
# http://www.gradle.org/docs/current/userguide/build_environment.html
|
||||
|
||||
# Specifies the JVM arguments used for the daemon process.
|
||||
# The setting is particularly useful for tweaking memory settings.
|
||||
org.gradle.jvmargs=-Xmx1536m
|
||||
|
||||
# When configured, Gradle will run in incubating parallel mode.
|
||||
# This option should only be used with decoupled projects. More details, visit
|
||||
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
||||
# org.gradle.parallel=true
|
||||
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
6
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
#Sun Mar 19 01:16:45 CET 2017
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
|
||||
160
gradlew
vendored
Normal file
@@ -0,0 +1,160 @@
|
||||
#!/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 "$@"
|
||||
90
gradlew.bat
vendored
Normal file
@@ -0,0 +1,90 @@
|
||||
@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
|
||||
BIN
logo512.png
Normal file
|
After Width: | Height: | Size: 57 KiB |
BIN
notifwhite.png
Normal file
|
After Width: | Height: | Size: 395 B |
1
settings.gradle
Normal file
@@ -0,0 +1 @@
|
||||
include ':app'
|
||||