Compare commits
	
		
			7 Commits
		
	
	
		
			5
			...
			8f5bd9a76a
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 8f5bd9a76a | |||
| ae7474effd | |||
| 959573a4e9 | |||
| 9645510759 | |||
| 0dd5485080 | |||
| 1f3745d294 | |||
| 25c5df5688 | 
@@ -1,2 +1,3 @@
 | 
				
			|||||||
# android-45-minute-rule
 | 
					# android-45-minute-rule
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Provide a list of alarm suggestions based on a bedtime and tiredness rating.
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,15 +1,14 @@
 | 
				
			|||||||
apply plugin: 'com.android.application'
 | 
					apply plugin: 'com.android.application'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
android {
 | 
					android {
 | 
				
			||||||
    compileSdkVersion 28
 | 
					    compileSdkVersion 36
 | 
				
			||||||
    buildToolsVersion '28.0.3'
 | 
					    namespace "com.hyperling.apps.the45minuterule"
 | 
				
			||||||
 | 
					 | 
				
			||||||
    defaultConfig {
 | 
					    defaultConfig {
 | 
				
			||||||
        applicationId "com.hyperling.apps.the45minuterule"
 | 
					        applicationId "com.hyperling.apps.the45minuterule"
 | 
				
			||||||
        minSdkVersion 15
 | 
					        minSdkVersion 14
 | 
				
			||||||
        targetSdkVersion 28
 | 
					        targetSdkVersion 36
 | 
				
			||||||
        versionCode 7
 | 
					        versionCode 8
 | 
				
			||||||
        versionName "1.06"
 | 
					        versionName "1.07"
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    buildTypes {
 | 
					    buildTypes {
 | 
				
			||||||
        release {
 | 
					        release {
 | 
				
			||||||
@@ -24,6 +23,4 @@ dependencies {
 | 
				
			|||||||
    implementation fileTree(dir: 'libs', include: ['*.jar'])
 | 
					    implementation fileTree(dir: 'libs', include: ['*.jar'])
 | 
				
			||||||
    testImplementation 'junit:junit:4.12'
 | 
					    testImplementation 'junit:junit:4.12'
 | 
				
			||||||
    implementation group: 'com.android.support', name: 'appcompat-v7', version: '28.0.0'
 | 
					    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'
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,13 +0,0 @@
 | 
				
			|||||||
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);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -17,13 +17,9 @@
 | 
				
			|||||||
        android:theme="@style/AppTheme"
 | 
					        android:theme="@style/AppTheme"
 | 
				
			||||||
        android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize">
 | 
					        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
 | 
					        <activity
 | 
				
			||||||
            android:name=".MainActivity"
 | 
					            android:name=".MainActivity"
 | 
				
			||||||
 | 
					            android:exported="true"
 | 
				
			||||||
            android:label="@string/app_name">
 | 
					            android:label="@string/app_name">
 | 
				
			||||||
            <intent-filter>
 | 
					            <intent-filter>
 | 
				
			||||||
                <action android:name="android.intent.action.MAIN" />
 | 
					                <action android:name="android.intent.action.MAIN" />
 | 
				
			||||||
@@ -31,10 +27,6 @@
 | 
				
			|||||||
                <category android:name="android.intent.category.LAUNCHER" />
 | 
					                <category android:name="android.intent.category.LAUNCHER" />
 | 
				
			||||||
            </intent-filter>
 | 
					            </intent-filter>
 | 
				
			||||||
        </activity>
 | 
					        </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"/>
 | 
					        <activity android:name=".Tips"/>
 | 
				
			||||||
    </application>
 | 
					    </application>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,8 +1,5 @@
 | 
				
			|||||||
package com.hyperling.apps.the45minuterule;
 | 
					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.Dialog;
 | 
				
			||||||
import android.app.TimePickerDialog;
 | 
					import android.app.TimePickerDialog;
 | 
				
			||||||
import android.content.Intent;
 | 
					import android.content.Intent;
 | 
				
			||||||
@@ -150,35 +147,12 @@ public class MainActivity extends AppCompatActivity {
 | 
				
			|||||||
        });
 | 
					        });
 | 
				
			||||||
        ////////////////////////////////////////////////////////////////////////////////////////////
 | 
					        ////////////////////////////////////////////////////////////////////////////////////////////
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
        ////////////////////////////////////////////////////////////////////////////////////////////
 | 
					 | 
				
			||||||
        // 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
 | 
					    @Override
 | 
				
			||||||
    public boolean onCreateOptionsMenu(Menu menu) {
 | 
					    public boolean onCreateOptionsMenu(Menu menu) {
 | 
				
			||||||
        // Inflate the menu; this adds items to the action bar if it is present.
 | 
					        // Inflate the menu; this adds items to the action bar if it is present.
 | 
				
			||||||
        getMenuInflater().inflate(R.menu.menu_main, menu);
 | 
					        getMenuInflater().inflate(R.menu.menu_main, menu);
 | 
				
			||||||
 | 
					 | 
				
			||||||
        MenuItem checkForNewArticles = menu.findItem(R.id.action_enable_ads);
 | 
					 | 
				
			||||||
        checkForNewArticles.setChecked(adsEnabled);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        return true;
 | 
					        return true;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -194,30 +168,6 @@ public class MainActivity extends AppCompatActivity {
 | 
				
			|||||||
            return false;
 | 
					            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) {
 | 
					        if (id == R.id.action_settings) {
 | 
				
			||||||
            Toast.makeText(this, "I can't do that, Jim", Toast.LENGTH_SHORT).show();
 | 
					            Toast.makeText(this, "I can't do that, Jim", Toast.LENGTH_SHORT).show();
 | 
				
			||||||
            return false;
 | 
					            return false;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -7,23 +7,14 @@
 | 
				
			|||||||
    android:paddingLeft="@dimen/activity_horizontal_margin"
 | 
					    android:paddingLeft="@dimen/activity_horizontal_margin"
 | 
				
			||||||
    android:paddingRight="@dimen/activity_horizontal_margin"
 | 
					    android:paddingRight="@dimen/activity_horizontal_margin"
 | 
				
			||||||
    android:paddingTop="@dimen/activity_vertical_margin"
 | 
					    android:paddingTop="@dimen/activity_vertical_margin"
 | 
				
			||||||
 | 
					    android:layout_marginTop="?android:actionBarSize"
 | 
				
			||||||
    tools:context="com.hyperling.apps.the45minuterule.MainActivity">
 | 
					    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
 | 
					    <ScrollView
 | 
				
			||||||
        android:layout_width="match_parent"
 | 
					        android:layout_width="match_parent"
 | 
				
			||||||
        android:layout_height="wrap_content"
 | 
					        android:layout_height="wrap_content"
 | 
				
			||||||
        android:layout_alignParentTop="true"
 | 
					        android:layout_alignParentTop="true"
 | 
				
			||||||
        android:layout_above="@id/adView"
 | 
					        android:layout_alignParentBottom="true"
 | 
				
			||||||
        android:layout_centerHorizontal="true"
 | 
					        android:layout_centerHorizontal="true"
 | 
				
			||||||
        android:id="@+id/scrollView">
 | 
					        android:id="@+id/scrollView">
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -7,6 +7,7 @@
 | 
				
			|||||||
    android:paddingLeft="@dimen/activity_horizontal_margin"
 | 
					    android:paddingLeft="@dimen/activity_horizontal_margin"
 | 
				
			||||||
    android:paddingRight="@dimen/activity_horizontal_margin"
 | 
					    android:paddingRight="@dimen/activity_horizontal_margin"
 | 
				
			||||||
    android:paddingTop="@dimen/activity_vertical_margin"
 | 
					    android:paddingTop="@dimen/activity_vertical_margin"
 | 
				
			||||||
 | 
					    android:layout_marginTop="?android:actionBarSize"
 | 
				
			||||||
    tools:context="com.hyperling.apps.the45minuterule.Tips">
 | 
					    tools:context="com.hyperling.apps.the45minuterule.Tips">
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <TextView
 | 
					    <TextView
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -9,13 +9,6 @@
 | 
				
			|||||||
        android:title="@string/action_tips"
 | 
					        android:title="@string/action_tips"
 | 
				
			||||||
        app:showAsAction="never" />
 | 
					        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
 | 
					    <item
 | 
				
			||||||
        android:id="@+id/action_about"
 | 
					        android:id="@+id/action_about"
 | 
				
			||||||
        android:orderInCategory="200"
 | 
					        android:orderInCategory="200"
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,15 +0,0 @@
 | 
				
			|||||||
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);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
							
								
								
									
										13
									
								
								build.gradle
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								build.gradle
									
									
									
									
									
								
							@@ -2,11 +2,18 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
buildscript {
 | 
					buildscript {
 | 
				
			||||||
    repositories {
 | 
					    repositories {
 | 
				
			||||||
        jcenter()
 | 
					        mavenCentral()
 | 
				
			||||||
 | 
					        maven {
 | 
				
			||||||
 | 
					            url 'https://jitpack.io'
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
        google()
 | 
					        google()
 | 
				
			||||||
 | 
					        maven {
 | 
				
			||||||
 | 
					            url 'https://maven.google.com/'
 | 
				
			||||||
 | 
					            name 'Google'
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    dependencies {
 | 
					    dependencies {
 | 
				
			||||||
        classpath 'com.android.tools.build:gradle:3.2.1'
 | 
					        classpath 'com.android.tools.build:gradle:8.11.1'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // NOTE: Do not place your application dependencies here; they belong
 | 
					        // NOTE: Do not place your application dependencies here; they belong
 | 
				
			||||||
        // in the individual module build.gradle files
 | 
					        // in the individual module build.gradle files
 | 
				
			||||||
@@ -15,7 +22,7 @@ buildscript {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
allprojects {
 | 
					allprojects {
 | 
				
			||||||
    repositories {
 | 
					    repositories {
 | 
				
			||||||
        jcenter()
 | 
					        mavenCentral()
 | 
				
			||||||
        google()
 | 
					        google()
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -16,3 +16,6 @@
 | 
				
			|||||||
# This option should only be used with decoupled projects. More details, visit
 | 
					# 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
 | 
					# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
 | 
				
			||||||
# org.gradle.parallel=true
 | 
					# org.gradle.parallel=true
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Allow switch statements on R.id values.
 | 
				
			||||||
 | 
					android.nonFinalResIds=false
 | 
				
			||||||
							
								
								
									
										2
									
								
								gradle/wrapper/gradle-wrapper.properties
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								gradle/wrapper/gradle-wrapper.properties
									
									
									
									
										vendored
									
									
								
							@@ -1,6 +1,6 @@
 | 
				
			|||||||
#Sat Jan 12 07:07:15 CST 2019
 | 
					#Sat Jan 12 07:07:15 CST 2019
 | 
				
			||||||
distributionBase=GRADLE_USER_HOME
 | 
					distributionBase=GRADLE_USER_HOME
 | 
				
			||||||
distributionPath=wrapper/dists
 | 
					distributionPath=wrapper/dists
 | 
				
			||||||
 | 
					distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
 | 
				
			||||||
zipStoreBase=GRADLE_USER_HOME
 | 
					zipStoreBase=GRADLE_USER_HOME
 | 
				
			||||||
zipStorePath=wrapper/dists
 | 
					zipStorePath=wrapper/dists
 | 
				
			||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
 | 
					 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user