Add original project.
41
.gitignore
vendored
@ -33,3 +33,44 @@ google-services.json
|
|||||||
# Android Profiling
|
# Android Profiling
|
||||||
*.hprof
|
*.hprof
|
||||||
|
|
||||||
|
## Suggested ^^
|
||||||
|
|
||||||
|
## From TicTacToe project for good measure. vv
|
||||||
|
# Gradle files
|
||||||
|
.gradle/
|
||||||
|
build/
|
||||||
|
|
||||||
|
# Local configuration file (sdk path, etc)
|
||||||
|
local.properties
|
||||||
|
|
||||||
|
# Log/OS Files
|
||||||
|
*.log
|
||||||
|
|
||||||
|
# Android Studio generated files and folders
|
||||||
|
captures/
|
||||||
|
.externalNativeBuild/
|
||||||
|
.cxx/
|
||||||
|
*.apk
|
||||||
|
output.json
|
||||||
|
|
||||||
|
# IntelliJ
|
||||||
|
*.iml
|
||||||
|
.idea/
|
||||||
|
misc.xml
|
||||||
|
deploymentTargetDropDown.xml
|
||||||
|
render.experimental.xml
|
||||||
|
|
||||||
|
# Keystore files
|
||||||
|
*.jks
|
||||||
|
*.keystore
|
||||||
|
|
||||||
|
# Google Services (e.g. APIs or Firebase)
|
||||||
|
google-services.json
|
||||||
|
|
||||||
|
# Android Profiling
|
||||||
|
*.hprof
|
||||||
|
/app/debug/output-metadata.json
|
||||||
|
|
||||||
|
# Ha!
|
||||||
|
keystore/*
|
||||||
|
release
|
||||||
|
1
app/.gitignore
vendored
Executable file
@ -0,0 +1 @@
|
|||||||
|
/build
|
29
app/build.gradle
Executable file
@ -0,0 +1,29 @@
|
|||||||
|
apply plugin: 'com.android.application'
|
||||||
|
|
||||||
|
android {
|
||||||
|
compileSdkVersion 28
|
||||||
|
buildToolsVersion '28.0.3'
|
||||||
|
|
||||||
|
defaultConfig {
|
||||||
|
applicationId "com.hyperling.apps.the45minuterule"
|
||||||
|
minSdkVersion 15
|
||||||
|
targetSdkVersion 28
|
||||||
|
versionCode 7
|
||||||
|
versionName "1.06"
|
||||||
|
}
|
||||||
|
buildTypes {
|
||||||
|
release {
|
||||||
|
minifyEnabled true
|
||||||
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
//compile fileTree(dir: 'libs', include: ['*.jar'])
|
||||||
|
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||||
|
testImplementation 'junit:junit:4.12'
|
||||||
|
implementation group: 'com.android.support', name: 'appcompat-v7', version: '28.0.0'
|
||||||
|
//compile 'com.google.android.gms:play-services-ads:17.1.2'
|
||||||
|
implementation group: 'com.google.android.gms', name: 'play-services-ads', version: '17.1.2'
|
||||||
|
}
|
17
app/proguard-rules.pro
vendored
Executable file
@ -0,0 +1,17 @@
|
|||||||
|
# Add project specific ProGuard rules here.
|
||||||
|
# By default, the flags in this file are appended to flags specified
|
||||||
|
# in /home/ling/WDBlue/Programming/Java/Android/android-sdk/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 *;
|
||||||
|
#}
|
@ -0,0 +1,13 @@
|
|||||||
|
package com.hyperling.apps.the45minuterule;
|
||||||
|
|
||||||
|
import android.app.Application;
|
||||||
|
import android.test.ApplicationTestCase;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
|
||||||
|
*/
|
||||||
|
public class ApplicationTest extends ApplicationTestCase<Application> {
|
||||||
|
public ApplicationTest() {
|
||||||
|
super(Application.class);
|
||||||
|
}
|
||||||
|
}
|
41
app/src/main/AndroidManifest.xml
Executable file
@ -0,0 +1,41 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
package="com.hyperling.apps.the45minuterule">
|
||||||
|
|
||||||
|
<uses-sdk tools:overrideLibrary="com.google.android.gms,com.google.android.gms.ads" />
|
||||||
|
|
||||||
|
<!-- Include required permissions for Google Mobile Ads to run. -->
|
||||||
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
|
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||||
|
|
||||||
|
<application
|
||||||
|
android:allowBackup="true"
|
||||||
|
android:icon="@mipmap/t45mr_icon_003"
|
||||||
|
android:label="@string/app_name"
|
||||||
|
android:supportsRtl="true"
|
||||||
|
android:theme="@style/AppTheme"
|
||||||
|
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize">
|
||||||
|
|
||||||
|
<!-- This meta-data tag is required to use Google Play Services. -->
|
||||||
|
<meta-data
|
||||||
|
android:name="com.google.android.gms.version"
|
||||||
|
android:value="@integer/google_play_services_version" />
|
||||||
|
|
||||||
|
<activity
|
||||||
|
android:name=".MainActivity"
|
||||||
|
android:label="@string/app_name">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
|
||||||
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
|
<!-- Include the AdActivity configChanges and theme. -->
|
||||||
|
<activity
|
||||||
|
android:name="com.google.android.gms.ads.AdActivity"
|
||||||
|
android:theme="@android:style/Theme.Translucent" />
|
||||||
|
<activity android:name=".Tips"/>
|
||||||
|
</application>
|
||||||
|
|
||||||
|
</manifest>
|
483
app/src/main/java/com/hyperling/apps/the45minuterule/MainActivity.java
Executable file
@ -0,0 +1,483 @@
|
|||||||
|
package com.hyperling.apps.the45minuterule;
|
||||||
|
|
||||||
|
import com.google.android.gms.ads.AdRequest;
|
||||||
|
import com.google.android.gms.ads.AdView;
|
||||||
|
|
||||||
|
import android.app.Dialog;
|
||||||
|
import android.app.TimePickerDialog;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
|
import android.content.res.Resources;
|
||||||
|
import android.os.Build;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.support.v7.app.AppCompatActivity;
|
||||||
|
import android.text.format.DateFormat;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.view.Gravity;
|
||||||
|
import android.view.Menu;
|
||||||
|
import android.view.MenuItem;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.RadioButton;
|
||||||
|
import android.widget.RadioGroup;
|
||||||
|
import android.widget.TableLayout;
|
||||||
|
import android.widget.TableRow;
|
||||||
|
import android.widget.TextView;
|
||||||
|
import android.widget.TimePicker;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.Timer;
|
||||||
|
import java.util.TimerTask;
|
||||||
|
|
||||||
|
public class MainActivity extends AppCompatActivity {
|
||||||
|
|
||||||
|
// Primitive
|
||||||
|
boolean debug, alarmSet, adsEnabled;
|
||||||
|
int alarmHour, alarmMinute, currentHour, currentMinute;
|
||||||
|
final int TIME_PICKER_DIALOG = 0;
|
||||||
|
String TAG;
|
||||||
|
|
||||||
|
// Java
|
||||||
|
Timer timer;
|
||||||
|
TimerTask timerTask;
|
||||||
|
|
||||||
|
// Android
|
||||||
|
Resources recs;
|
||||||
|
|
||||||
|
// Shared Preferences
|
||||||
|
private SharedPreferences sharedPreferences;
|
||||||
|
private String keySharedPreferences, keyAdsEnabled;
|
||||||
|
|
||||||
|
// Views
|
||||||
|
Button btnTime;
|
||||||
|
RadioGroup radioGroup;
|
||||||
|
RadioButton rb1, rb2, rb3;
|
||||||
|
TextView digitalClockHeader;
|
||||||
|
TableLayout layClocks;
|
||||||
|
ArrayList<TextView> clocks;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_main);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Set up variables
|
||||||
|
recs = getResources();
|
||||||
|
|
||||||
|
debug = recs.getString(R.string.debug).toLowerCase().equals("true");
|
||||||
|
|
||||||
|
alarmSet = false;
|
||||||
|
|
||||||
|
updateCurrentTime();
|
||||||
|
|
||||||
|
alarmHour = currentHour;
|
||||||
|
alarmMinute = currentMinute;
|
||||||
|
|
||||||
|
// Strings
|
||||||
|
TAG = recs.getString(R.string.TAG);
|
||||||
|
keySharedPreferences = recs.getString(R.string.keySharedPreferences);
|
||||||
|
keyAdsEnabled = recs.getString(R.string.keyAdsEnabled);
|
||||||
|
|
||||||
|
// Shared Preferences
|
||||||
|
sharedPreferences = getSharedPreferences(keySharedPreferences, MODE_PRIVATE);
|
||||||
|
|
||||||
|
adsEnabled = sharedPreferences.getBoolean(keyAdsEnabled, false);
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Get the Views
|
||||||
|
btnTime = (Button) findViewById(R.id.btnTime);
|
||||||
|
|
||||||
|
radioGroup = (RadioGroup) findViewById(R.id.rgTired);
|
||||||
|
|
||||||
|
rb1 = (RadioButton) findViewById(R.id.rb1);
|
||||||
|
rb2 = (RadioButton) findViewById(R.id.rb2);
|
||||||
|
rb3 = (RadioButton) findViewById(R.id.rb3);
|
||||||
|
|
||||||
|
digitalClockHeader = (TextView) findViewById(R.id.tvDigitalClocksHeader);
|
||||||
|
|
||||||
|
layClocks = (TableLayout) findViewById(R.id.layClocks);
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Start manipulating stuff!
|
||||||
|
btnTime.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
// Check if the time is already being shown
|
||||||
|
showDialog(TIME_PICKER_DIALOG);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
rb2.setChecked(true);
|
||||||
|
|
||||||
|
radioGroup.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
if (debug) System.out.println("Radio group was clicked");
|
||||||
|
startCheckTime(false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
rb1.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
if (debug) System.out.println("Radio 1 was clicked");
|
||||||
|
startCheckTime(false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
rb2.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
if (debug) System.out.println("Radio 2 was clicked");
|
||||||
|
startCheckTime(false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
rb3.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
if (debug) System.out.println("Radio 3 was clicked");
|
||||||
|
startCheckTime(false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Finally, load ads >:)
|
||||||
|
if ( adsEnabled) {
|
||||||
|
if (Build.VERSION.SDK_INT >= 9) {
|
||||||
|
// Load an ad into the AdMob banner view.
|
||||||
|
AdView adView = (AdView) findViewById(R.id.adView);
|
||||||
|
AdRequest adRequest = new AdRequest.Builder()
|
||||||
|
.addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
|
||||||
|
.addTestDevice("C6A494DC6E7C9AC29102694D48487084") // Nexus 7
|
||||||
|
.addTestDevice("B8B7561B850A9AB24E0D5B560FC50628") // Moto G
|
||||||
|
.addTestDevice("") // Cappy, even though it doesn't support ads
|
||||||
|
.setRequestAgent("android_studio:ad_template")
|
||||||
|
.build();
|
||||||
|
adView.loadAd(adRequest);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onCreateOptionsMenu(Menu menu) {
|
||||||
|
// Inflate the menu; this adds items to the action bar if it is present.
|
||||||
|
getMenuInflater().inflate(R.menu.menu_main, menu);
|
||||||
|
|
||||||
|
MenuItem checkForNewArticles = menu.findItem(R.id.action_enable_ads);
|
||||||
|
checkForNewArticles.setChecked(adsEnabled);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
|
// Handle action bar item clicks here. The action bar will
|
||||||
|
// automatically handle clicks on the Home/Up button, so long
|
||||||
|
// as you specify a parent activity in AndroidManifest.xml.
|
||||||
|
int id = item.getItemId();
|
||||||
|
|
||||||
|
if (id == R.id.action_tips) {
|
||||||
|
startActivity(new Intent(MainActivity.this, Tips.class));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (id == R.id.action_enable_ads) {
|
||||||
|
if (debug) Log.d(TAG, "MainActivity.onOptionsItemSelected: Before! adsEnabled=" + adsEnabled);
|
||||||
|
adsEnabled = !adsEnabled;
|
||||||
|
if (debug) Log.d(TAG, "MainActivity.onOptionsItemSelected: After! adsEnabled=" + adsEnabled);
|
||||||
|
SharedPreferences.Editor editor = sharedPreferences.edit();
|
||||||
|
editor.putBoolean(keyAdsEnabled, adsEnabled);
|
||||||
|
editor.commit();
|
||||||
|
|
||||||
|
if (adsEnabled){
|
||||||
|
Toast.makeText(this, "Thank you!", Toast.LENGTH_LONG).show();
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
Toast.makeText(this, "Disabled ads", Toast.LENGTH_LONG).show();
|
||||||
|
}
|
||||||
|
|
||||||
|
item.setChecked(adsEnabled);
|
||||||
|
|
||||||
|
Intent intent = new Intent(MainActivity.this, MainActivity.class);
|
||||||
|
startActivity(intent);
|
||||||
|
finish();
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (id == R.id.action_settings) {
|
||||||
|
Toast.makeText(this, "I can't do that, Jim", Toast.LENGTH_SHORT).show();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (id == R.id.action_about) {
|
||||||
|
Toast.makeText(this, "I can't do that, Jim", Toast.LENGTH_SHORT).show();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (id == R.id.action_help) {
|
||||||
|
Toast.makeText(this, "I can't do that, Jim", Toast.LENGTH_SHORT).show();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (id == R.id.action_exit) {
|
||||||
|
finish();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return super.onOptionsItemSelected(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Dialog onCreateDialog(int id){
|
||||||
|
|
||||||
|
switch(id){
|
||||||
|
case TIME_PICKER_DIALOG:
|
||||||
|
if (debug) System.out.println("Showing time picker");
|
||||||
|
|
||||||
|
TimePickerDialog.OnTimeSetListener timeSetListener = new TimePickerDialog.OnTimeSetListener() {
|
||||||
|
@Override
|
||||||
|
public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
|
||||||
|
if (debug) System.out.println("Time chosen is " + getTimeString(hourOfDay, minute));
|
||||||
|
|
||||||
|
alarmHour = hourOfDay;
|
||||||
|
alarmMinute = minute;
|
||||||
|
|
||||||
|
btnTime.setText(getTimeString(alarmHour, alarmMinute));
|
||||||
|
alarmSet = true;
|
||||||
|
startCheckTime(true);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
TimePickerDialog timePickerDialog = new TimePickerDialog(this, timeSetListener, alarmHour, alarmMinute, DateFormat.is24HourFormat(getApplicationContext()));
|
||||||
|
|
||||||
|
return timePickerDialog;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (debug) System.out.println("Returning null, id was " + id);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void calculateTimes(){
|
||||||
|
if (debug) System.out.println("Calculating times");
|
||||||
|
if (alarmHour == currentHour && alarmMinute == currentMinute){
|
||||||
|
if (debug) System.out.println("Alarm time not set");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Get how long we have until the alarm rings
|
||||||
|
int hourDifference, minuteDifference, minutesUntilAlarm, sleepiness;
|
||||||
|
|
||||||
|
hourDifference = alarmHour;
|
||||||
|
minuteDifference = alarmMinute;
|
||||||
|
|
||||||
|
if(alarmMinute < currentMinute){
|
||||||
|
minuteDifference += 60;
|
||||||
|
hourDifference -= 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (alarmHour < currentHour){
|
||||||
|
hourDifference += 24;
|
||||||
|
}
|
||||||
|
|
||||||
|
hourDifference -= currentHour;
|
||||||
|
minuteDifference -= currentMinute;
|
||||||
|
|
||||||
|
minutesUntilAlarm = (60*hourDifference) + minuteDifference;
|
||||||
|
if (debug) System.out.println("Number of minutes until the alarm rings: " + minutesUntilAlarm);
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Get sleepiness of the user
|
||||||
|
switch(radioGroup.getCheckedRadioButtonId()){
|
||||||
|
case R.id.rb1:
|
||||||
|
sleepiness = Integer.parseInt(recs.getString(R.string.rb_opt1_value));
|
||||||
|
break;
|
||||||
|
case R.id.rb2:
|
||||||
|
sleepiness = Integer.parseInt(recs.getString(R.string.rb_opt2_value));
|
||||||
|
break;
|
||||||
|
case R.id.rb3:
|
||||||
|
sleepiness = Integer.parseInt(recs.getString(R.string.rb_opt3_value));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
sleepiness = 0;
|
||||||
|
}
|
||||||
|
if (debug) System.out.println("Sleepiness is " + sleepiness);
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Do math and set the clocks
|
||||||
|
int bedHour, bedMinute, remainder;
|
||||||
|
|
||||||
|
bedHour = currentHour;
|
||||||
|
bedMinute = currentMinute;
|
||||||
|
|
||||||
|
minutesUntilAlarm -= sleepiness;
|
||||||
|
|
||||||
|
clocks = new ArrayList<TextView>();
|
||||||
|
if ((minutesUntilAlarm) > 0){
|
||||||
|
remainder = (minutesUntilAlarm%45);
|
||||||
|
|
||||||
|
if (remainder < 0){
|
||||||
|
remainder += 45;
|
||||||
|
}
|
||||||
|
|
||||||
|
bedMinute += remainder;
|
||||||
|
while (minutesUntilAlarm >= 45) {
|
||||||
|
|
||||||
|
if (bedMinute >= 60) {
|
||||||
|
bedMinute -= 60;
|
||||||
|
bedHour += 1;
|
||||||
|
if (bedHour >= 24) {
|
||||||
|
bedHour -= 24;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TextView newClock = new TextView(this);
|
||||||
|
newClock.setText(getTimeString(bedHour, bedMinute));
|
||||||
|
|
||||||
|
clocks.add(newClock);
|
||||||
|
|
||||||
|
minutesUntilAlarm -= 45;
|
||||||
|
bedMinute += 45;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Lay out the text views
|
||||||
|
TableRow.LayoutParams params = new TableRow.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT, 1);
|
||||||
|
|
||||||
|
int loop = 0;
|
||||||
|
TableRow newRow = new TableRow(this);
|
||||||
|
|
||||||
|
layClocks.removeAllViews();
|
||||||
|
|
||||||
|
if (clocks.size() > 0) {
|
||||||
|
for (TextView clock : clocks) {
|
||||||
|
if (loop % 3 == 0) {
|
||||||
|
newRow = new TableRow(this);
|
||||||
|
layClocks.addView(newRow);
|
||||||
|
}
|
||||||
|
|
||||||
|
params.column = (loop % 3) + 1;
|
||||||
|
|
||||||
|
clock.setLayoutParams(params);
|
||||||
|
clock.setTextSize(18);
|
||||||
|
clock.setGravity(Gravity.CENTER);
|
||||||
|
|
||||||
|
newRow.addView(clock);
|
||||||
|
|
||||||
|
loop++;
|
||||||
|
}
|
||||||
|
|
||||||
|
while (loop % 3 != 0){
|
||||||
|
TextView blankClock = new TextView(this);
|
||||||
|
|
||||||
|
params.column = (loop % 3) + 1;
|
||||||
|
|
||||||
|
blankClock.setLayoutParams(params);
|
||||||
|
blankClock.setText(recs.getString(R.string.blank));
|
||||||
|
blankClock.setTextSize(18);
|
||||||
|
blankClock.setGravity(Gravity.CENTER);
|
||||||
|
|
||||||
|
newRow.addView(blankClock);
|
||||||
|
|
||||||
|
loop++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: Remove temp string
|
||||||
|
String temp = recs.getString(R.string.main_bedtimes_header) + ". Refreshed at " + getTimeString(currentHour, currentMinute);
|
||||||
|
digitalClockHeader.setText(temp);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
digitalClockHeader.setText(recs.getString(R.string.main_bedtimes_header_too_close));
|
||||||
|
}
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void startCheckTime(boolean setTimer){
|
||||||
|
if (debug) System.out.println("Checking time");
|
||||||
|
|
||||||
|
updateCurrentTime();
|
||||||
|
calculateTimes();
|
||||||
|
|
||||||
|
if (setTimer) {
|
||||||
|
timerTask = new TimerTask() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
startCheckTime(true);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
timer = new Timer();
|
||||||
|
|
||||||
|
// TODO: Fix timer
|
||||||
|
//timer.schedule(timerTask, 5000); // Recalculate time every 5 seconds
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateCurrentTime(){
|
||||||
|
Calendar now = Calendar.getInstance();
|
||||||
|
|
||||||
|
currentHour = now.get(Calendar.HOUR_OF_DAY);
|
||||||
|
currentMinute = now.get(Calendar.MINUTE);
|
||||||
|
|
||||||
|
currentMinute = now.get(Calendar.MINUTE);
|
||||||
|
currentHour = now.get(Calendar.HOUR_OF_DAY);
|
||||||
|
if (debug) System.out.println("Current time is " + getTimeString(currentHour, currentMinute));
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getTimeString(int hour, int minute){
|
||||||
|
String time, hours, minutes, meridian;
|
||||||
|
|
||||||
|
if (minute < 10){
|
||||||
|
minutes = "0" + Integer.toString(minute);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
minutes = Integer.toString(minute);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (DateFormat.is24HourFormat(getApplicationContext())){
|
||||||
|
hours = (hour < 10 ? "0"+Integer.toString(hour) : Integer.toString(hour));
|
||||||
|
|
||||||
|
time = hours + ":" + minutes;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (hour > 12){
|
||||||
|
hour -= 12;
|
||||||
|
meridian = "PM";
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
meridian = "AM";
|
||||||
|
}
|
||||||
|
|
||||||
|
hours = (hour == 0 ? "12" : Integer.toString(hour));
|
||||||
|
|
||||||
|
time = hours + ":" + minutes + meridian;
|
||||||
|
}
|
||||||
|
return time;
|
||||||
|
}
|
||||||
|
}
|
44
app/src/main/java/com/hyperling/apps/the45minuterule/Tips.java
Executable file
@ -0,0 +1,44 @@
|
|||||||
|
package com.hyperling.apps.the45minuterule;
|
||||||
|
|
||||||
|
import android.content.res.Resources;
|
||||||
|
import android.graphics.Color;
|
||||||
|
import android.support.v7.app.AppCompatActivity;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
public class Tips extends AppCompatActivity {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_tips);
|
||||||
|
|
||||||
|
Resources recs = getResources();
|
||||||
|
|
||||||
|
String[] tips = recs.getStringArray(R.array.tips_tips_array);
|
||||||
|
|
||||||
|
LinearLayout layout = (LinearLayout) findViewById(R.id.layTipsArray);
|
||||||
|
|
||||||
|
int colorCounter = 0;
|
||||||
|
for (String tip : tips){
|
||||||
|
TextView newTip = new TextView(this);
|
||||||
|
|
||||||
|
newTip.setText(tip);
|
||||||
|
|
||||||
|
newTip.setPadding(8,8,0,4);
|
||||||
|
|
||||||
|
if (colorCounter % 2 == 0){
|
||||||
|
newTip.setTextColor(recs.getColor(R.color.colorAccent));
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
newTip.setTextColor(recs.getColor(R.color.colorPrimaryDark));
|
||||||
|
}
|
||||||
|
|
||||||
|
layout.addView(newTip);
|
||||||
|
|
||||||
|
colorCounter++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
116
app/src/main/res/layout/activity_main.xml
Executable file
@ -0,0 +1,116 @@
|
|||||||
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:ads="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||||
|
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||||
|
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||||
|
android:paddingTop="@dimen/activity_vertical_margin"
|
||||||
|
tools:context="com.hyperling.apps.the45minuterule.MainActivity">
|
||||||
|
|
||||||
|
<!-- view for AdMob Banner Ad -->
|
||||||
|
<com.google.android.gms.ads.AdView
|
||||||
|
android:id="@+id/adView"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentBottom="true"
|
||||||
|
android:layout_centerHorizontal="true"
|
||||||
|
ads:adSize="BANNER"
|
||||||
|
ads:adUnitId="@string/main_banner_ad" />
|
||||||
|
|
||||||
|
<ScrollView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentTop="true"
|
||||||
|
android:layout_above="@id/adView"
|
||||||
|
android:layout_centerHorizontal="true"
|
||||||
|
android:id="@+id/scrollView">
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:id="@+id/innerRelativeLayout">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:layout_alignParentTop="true"
|
||||||
|
android:id="@+id/layTime">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/main_header_choose_time"
|
||||||
|
android:textSize="20sp"
|
||||||
|
android:id="@+id/tvTime"/>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="@android:color/transparent"
|
||||||
|
android:text="@string/main_button_show_time"
|
||||||
|
android:textSize="20sp"
|
||||||
|
android:textAllCaps="false"
|
||||||
|
android:id="@+id/btnTime"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_below="@+id/layTime"
|
||||||
|
android:text="@string/main_rb_header"
|
||||||
|
android:textSize="18sp"
|
||||||
|
android:id="@+id/tvTired"/>
|
||||||
|
|
||||||
|
<RadioGroup
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_below="@+id/tvTired"
|
||||||
|
android:id="@+id/rgTired">
|
||||||
|
|
||||||
|
<RadioButton
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:text="@string/main_rb_opt1"
|
||||||
|
android:textSize="14sp"
|
||||||
|
android:id="@+id/rb1"/>
|
||||||
|
|
||||||
|
<RadioButton
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:text="@string/main_rb_opt2"
|
||||||
|
android:textSize="14sp"
|
||||||
|
android:id="@+id/rb2"/>
|
||||||
|
|
||||||
|
<RadioButton
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:text="@string/main_rb_opt3"
|
||||||
|
android:textSize="14sp"
|
||||||
|
android:id="@+id/rb3"/>
|
||||||
|
|
||||||
|
</RadioGroup>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_below="@id/rgTired"
|
||||||
|
android:paddingTop="8dp"
|
||||||
|
android:text="@string/blank"
|
||||||
|
android:textSize="16sp"
|
||||||
|
android:id="@+id/tvDigitalClocksHeader"/>
|
||||||
|
|
||||||
|
<TableLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_below="@id/tvDigitalClocksHeader"
|
||||||
|
android:id="@+id/layClocks"/>
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
</ScrollView>
|
||||||
|
|
||||||
|
</RelativeLayout>
|
33
app/src/main/res/layout/activity_tips.xml
Executable file
@ -0,0 +1,33 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||||
|
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||||
|
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||||
|
android:paddingTop="@dimen/activity_vertical_margin"
|
||||||
|
tools:context="com.hyperling.apps.the45minuterule.Tips">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentTop="true"
|
||||||
|
android:text="@string/tips_tips_header"
|
||||||
|
android:textSize="20sp"
|
||||||
|
android:id="@+id/txtTipsHeader"/>
|
||||||
|
|
||||||
|
<ScrollView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_below="@+id/txtTipsHeader">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:id="@+id/layTipsArray"/>
|
||||||
|
|
||||||
|
</ScrollView>
|
||||||
|
|
||||||
|
</RelativeLayout>
|
46
app/src/main/res/menu/menu_main.xml
Executable file
@ -0,0 +1,46 @@
|
|||||||
|
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
tools:context="com.hyperling.apps.the45minuterule.MainActivity">
|
||||||
|
|
||||||
|
<item
|
||||||
|
android:id="@+id/action_tips"
|
||||||
|
android:orderInCategory="100"
|
||||||
|
android:title="@string/action_tips"
|
||||||
|
app:showAsAction="never" />
|
||||||
|
|
||||||
|
<item
|
||||||
|
android:id="@+id/action_enable_ads"
|
||||||
|
android:orderInCategory="150"
|
||||||
|
android:title="@string/action_enable_ads"
|
||||||
|
app:showAsAction="never"
|
||||||
|
android:checkable="true" />
|
||||||
|
|
||||||
|
<item
|
||||||
|
android:id="@+id/action_about"
|
||||||
|
android:orderInCategory="200"
|
||||||
|
android:title="@string/action_about"
|
||||||
|
app:showAsAction="never"
|
||||||
|
android:visible="false" />
|
||||||
|
|
||||||
|
<item
|
||||||
|
android:id="@+id/action_settings"
|
||||||
|
android:orderInCategory="300"
|
||||||
|
android:title="@string/action_settings"
|
||||||
|
app:showAsAction="never"
|
||||||
|
android:visible="false" />
|
||||||
|
|
||||||
|
<item
|
||||||
|
android:id="@+id/action_help"
|
||||||
|
android:orderInCategory="400"
|
||||||
|
android:title="@string/action_help"
|
||||||
|
app:showAsAction="never"
|
||||||
|
android:visible="false" />
|
||||||
|
|
||||||
|
<item
|
||||||
|
android:id="@+id/action_exit"
|
||||||
|
android:orderInCategory="500"
|
||||||
|
android:title="@string/action_exit"
|
||||||
|
app:showAsAction="never" />
|
||||||
|
|
||||||
|
</menu>
|
BIN
app/src/main/res/mipmap-hdpi/ic_launcher.png
Executable file
After Width: | Height: | Size: 3.3 KiB |
BIN
app/src/main/res/mipmap-mdpi/ic_launcher.png
Executable file
After Width: | Height: | Size: 2.2 KiB |
BIN
app/src/main/res/mipmap-xhdpi/ic_launcher.png
Executable file
After Width: | Height: | Size: 4.7 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher.png
Executable file
After Width: | Height: | Size: 7.5 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Executable file
After Width: | Height: | Size: 10 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/t45mr_icon_001.png
Executable file
After Width: | Height: | Size: 24 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/t45mr_icon_002.png
Executable file
After Width: | Height: | Size: 47 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/t45mr_icon_003.png
Executable file
After Width: | Height: | Size: 48 KiB |
10
app/src/main/res/values-v21/styles.xml
Executable file
@ -0,0 +1,10 @@
|
|||||||
|
<resources>>
|
||||||
|
|
||||||
|
<style name="AppTheme.NoActionBar">
|
||||||
|
<item name="windowActionBar">false</item>
|
||||||
|
<item name="windowNoTitle">true</item>
|
||||||
|
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
|
||||||
|
<item name="android:statusBarColor">@color/colorAccent</item>
|
||||||
|
<item name="android:navigationBarColor">@color/colorAccent</item>
|
||||||
|
</style>
|
||||||
|
</resources>
|
6
app/src/main/res/values-w820dp/dimens.xml
Executable file
@ -0,0 +1,6 @@
|
|||||||
|
<resources>
|
||||||
|
<!-- Example customization of dimensions originally defined in res/values/dimens.xml
|
||||||
|
(such as screen margins) for screens with more than 820dp of available width. This
|
||||||
|
would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively). -->
|
||||||
|
<dimen name="activity_horizontal_margin">64dp</dimen>
|
||||||
|
</resources>
|
6
app/src/main/res/values/colors.xml
Executable file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<color name="colorPrimary">#FF9900</color>
|
||||||
|
<color name="colorPrimaryDark">#333333</color>
|
||||||
|
<color name="colorAccent">#330066</color>
|
||||||
|
</resources>
|
6
app/src/main/res/values/dimens.xml
Executable file
@ -0,0 +1,6 @@
|
|||||||
|
<resources>
|
||||||
|
<!-- Default screen margins, per the Android Design guidelines. -->
|
||||||
|
<dimen name="activity_horizontal_margin">16dp</dimen>
|
||||||
|
<dimen name="activity_vertical_margin">16dp</dimen>
|
||||||
|
<dimen name="fab_margin">16dp</dimen>
|
||||||
|
</resources>
|
65
app/src/main/res/values/strings.xml
Executable file
@ -0,0 +1,65 @@
|
|||||||
|
<resources>
|
||||||
|
|
||||||
|
<!-- App details -->
|
||||||
|
<string name="app_name">The 45 Minute Rule</string>
|
||||||
|
|
||||||
|
<string name="TAG">com.hyperling.apps.the45minuterule</string>
|
||||||
|
|
||||||
|
<string name="action_tips">Sleep Tips</string>
|
||||||
|
<string name="action_settings">Settings</string>
|
||||||
|
<string name="action_about">About</string>
|
||||||
|
<string name="action_help">Help</string>
|
||||||
|
<string name="action_exit">Exit</string>
|
||||||
|
<string name="action_enable_ads">Enable Ads?</string>
|
||||||
|
|
||||||
|
<!-- TODO: Turn off debug before releases! -->
|
||||||
|
<string name="debug">true</string>
|
||||||
|
|
||||||
|
<string name="blank"> </string>
|
||||||
|
|
||||||
|
<!-- Main Screen -->
|
||||||
|
<string name="main_header_choose_time">Morning alarm time:</string>
|
||||||
|
|
||||||
|
<string name="main_button_show_time">Click me!</string>
|
||||||
|
|
||||||
|
<string name="main_rb_header">How tired are you?</string>
|
||||||
|
|
||||||
|
<string name="main_rb_opt1">Very Tired (Fall asleep in 5 minutes)</string>
|
||||||
|
<string name="rb_opt1_value">5</string>
|
||||||
|
<string name="main_rb_opt2">Tired (Fall asleep in less than 20 minutes)</string>
|
||||||
|
<string name="rb_opt2_value">20</string>
|
||||||
|
<string name="main_rb_opt3">Alert (Hopefully fall asleep in 30 or 40 minutes)</string>
|
||||||
|
<string name="rb_opt3_value">35</string>
|
||||||
|
|
||||||
|
<string name="main_bedtimes_header">Times you could go to bed</string>
|
||||||
|
<string name="main_bedtimes_header_too_close">Alarm is too soon, no valid times to sleep.</string>
|
||||||
|
|
||||||
|
<!-- Shared Preferences -->
|
||||||
|
<string name="keySharedPreferences">t45mr</string>
|
||||||
|
<string name="keyAdsEnabled">AdsEnabled</string>
|
||||||
|
|
||||||
|
<!-- Settings Screen -->
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Tips Screen -->
|
||||||
|
<string name="tips_tips_header">Tips for a good night sleep:</string>
|
||||||
|
|
||||||
|
<string-array name="tips_tips_array">
|
||||||
|
<item>Use a program like f.lux (or Twilight on Android) to reduce screen brightness at night.</item>
|
||||||
|
<item>
|
||||||
|
Eat a high carbohydrate meal for dinner. Carbohydrates help you fall asleep faster and are necessary for your body to repair itself.
|
||||||
|
Dr. Neal Barnard recommends eating two pieces of bread if you can\'t fall asleep.
|
||||||
|
</item>
|
||||||
|
<item>Plan aerobic activity in your daily routine. Twenty minutes of walking can be very effective when done between dinner and bedtime.</item>
|
||||||
|
</string-array>
|
||||||
|
|
||||||
|
<!-- About Screen -->
|
||||||
|
|
||||||
|
|
||||||
|
<!-- -
|
||||||
|
This is an ad unit ID for a banner test ad. Replace with your own banner ad unit id.
|
||||||
|
For more information, see https://support.google.com/admob/answer/3052638
|
||||||
|
<!- -->
|
||||||
|
<string name="main_banner_ad">ca-app-pub-9712416021907617/8586703280</string>
|
||||||
|
<string name="title_activity_blank_test">BlankTest</string>
|
||||||
|
</resources>
|
22
app/src/main/res/values/styles.xml
Executable file
@ -0,0 +1,22 @@
|
|||||||
|
<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>
|
15
app/src/test/java/com/hyperling/apps/the45minuterule/ExampleUnitTest.java
Executable file
@ -0,0 +1,15 @@
|
|||||||
|
package com.hyperling.apps.the45minuterule;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* To work on unit tests, switch the Test Artifact in the Build Variants view.
|
||||||
|
*/
|
||||||
|
public class ExampleUnitTest {
|
||||||
|
@Test
|
||||||
|
public void addition_isCorrect() throws Exception {
|
||||||
|
assertEquals(4, 2 + 2);
|
||||||
|
}
|
||||||
|
}
|
25
build.gradle
Executable file
@ -0,0 +1,25 @@
|
|||||||
|
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||||
|
|
||||||
|
buildscript {
|
||||||
|
repositories {
|
||||||
|
jcenter()
|
||||||
|
google()
|
||||||
|
}
|
||||||
|
dependencies {
|
||||||
|
classpath 'com.android.tools.build:gradle:3.2.1'
|
||||||
|
|
||||||
|
// NOTE: Do not place your application dependencies here; they belong
|
||||||
|
// in the individual module build.gradle files
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
allprojects {
|
||||||
|
repositories {
|
||||||
|
jcenter()
|
||||||
|
google()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
task clean(type: Delete) {
|
||||||
|
delete rootProject.buildDir
|
||||||
|
}
|
18
gradle.properties
Executable file
@ -0,0 +1,18 @@
|
|||||||
|
# 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.
|
||||||
|
# Default value: -Xmx10248m -XX:MaxPermSize=256m
|
||||||
|
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
|
||||||
|
|
||||||
|
# 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
Executable file
6
gradle/wrapper/gradle-wrapper.properties
vendored
Executable file
@ -0,0 +1,6 @@
|
|||||||
|
#Sat Jan 12 07:07:15 CST 2019
|
||||||
|
distributionBase=GRADLE_USER_HOME
|
||||||
|
distributionPath=wrapper/dists
|
||||||
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
zipStorePath=wrapper/dists
|
||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
|
160
gradlew
vendored
Executable 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
Executable 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
media/banner/banner001.xcf
Executable file
BIN
media/banner/banner_001.png
Executable file
After Width: | Height: | Size: 2.1 KiB |
BIN
media/icon/t45mr.png
Executable file
After Width: | Height: | Size: 44 KiB |
BIN
media/icon/t45mr_icon_001.png
Executable file
After Width: | Height: | Size: 24 KiB |
BIN
media/icon/t45mr_icon_001.xcf
Executable file
BIN
media/icon/t45mr_icon_002.png
Executable file
After Width: | Height: | Size: 47 KiB |
BIN
media/icon/t45mr_icon_002.xcf
Executable file
BIN
media/icon/t45mr_icon_003.png
Executable file
After Width: | Height: | Size: 48 KiB |
BIN
media/icon/t45mr_icon_003.xcf
Executable file
BIN
media/icon/t45mr_icon_003_512.png
Executable file
After Width: | Height: | Size: 45 KiB |
BIN
media/screenshots/motoG_01.png
Executable file
After Width: | Height: | Size: 44 KiB |
BIN
media/screenshots/motoG_02.png
Executable file
After Width: | Height: | Size: 52 KiB |
BIN
media/screenshots/motoG_03.png
Executable file
After Width: | Height: | Size: 58 KiB |
BIN
media/screenshots/nexus7_01.png
Executable file
After Width: | Height: | Size: 33 KiB |
BIN
media/screenshots/nexus7_02.png
Executable file
After Width: | Height: | Size: 48 KiB |
BIN
media/screenshots/nexus7_03.png
Executable file
After Width: | Height: | Size: 51 KiB |
1
settings.gradle
Executable file
@ -0,0 +1 @@
|
|||||||
|
include ':app'
|