Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .idea/dictionaries/Lu_Ying.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

42 changes: 42 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions .idea/inspectionProfiles/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 8 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
# ICS4U Personal Coding Project

## Objective
State the objective of the project
## PCP Learning Log
Complete a learning log entry whenever you work on acquiring skills for this project. This could be:

## Technical Requirements
### Knowledge
### Hardware
### Required Software
- exploring documentation online (wikis, other github pages, package libraries)
- reviewing technical books
- online interactive tutorials (i.e Codecademy)
- watching educational youtube videos
- reviewing documentation around development environment setup

## Install and Set Up
Outline the steps required to install and run your project

## Usage
Outline anything the user needs to know to use your application
https://docs.google.com/a/ycdsbk12.ca/forms/d/135YiNzNhBMmPK3avR3NajFtbc7VtXma4-zLXcpYa7DI/viewform

1 change: 1 addition & 0 deletions app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
26 changes: 26 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 23
buildToolsVersion "23.0.3"

defaultConfig {
applicationId "com.app.bonnie.bliss_countdown"
minSdkVersion 10
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.4.0'
}
17 changes: 17 additions & 0 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in C:\Users\Lu Ying\.AndroidStudio2.1/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 *;
#}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.app.bonnie.bliss_countdown;

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);
}
}
38 changes: 38 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.app.bonnie.bliss_countdown">

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".HomeScreen">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".YoutubeSongs"
/>
<activity
android:name=".PlayRiver"
/>
<activity
android:name=".PlaySongs"
/>
<activity
android:name=".PlayBeloved"
/>
<activity
android:name=".PlayRain"
/>
<activity
android:name=".Countdown"
/>
</application>

</manifest>
108 changes: 108 additions & 0 deletions app/src/main/java/com/app/bonnie/bliss_countdown/Countdown.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
package com.app.bonnie.bliss_countdown;

// import useful android items
import android.os.Handler;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;


public class Countdown extends AppCompatActivity {

// reference variables from elsewhere in the program
public TextView show_days, show_hours, show_minutes, show_seconds, done_pic;
public Handler handler;
protected Runnable runnable;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.countdown_screen);

// set needed variables for later use
show_days = (TextView) findViewById(R.id.show_days);
show_hours = (TextView) findViewById(R.id.show_hours);
show_minutes = (TextView) findViewById(R.id.show_minutes);
show_seconds = (TextView) findViewById(R.id.show_seconds);
done_pic = (TextView) findViewById(R.id.done_pic);

//call countdown
countDownStart();
}

public void countDownStart() {

// create an instance of Handler and Runnable
handler = new Handler();
runnable = new Runnable() {
@Override
public void run() {
// keep running method/countdown
handler.postDelayed(this, 1000);
try {
// create new instance of a simple date
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd", Locale.CANADA);

// set date summer starts
Date futureDate = dateFormat.parse("2016-06-30");

// get current date
Date currentDate = new Date();

// calculate the number of days, hours, minutes, seconds until summer
if (!currentDate.after(futureDate)) {
long diff = futureDate.getTime() - currentDate.getTime();

//convert the difference in dates to days
long days = diff / (24 * 60 * 60 * 1000);
diff -= days * (24 * 60 * 60 * 1000);

//convert the difference in dates to hours
long hours = diff / (60 * 60 * 1000);
diff -= hours * (60 * 60 * 1000);

//convert the difference in dates to minutes
long minutes = diff / (60 * 1000);
diff -= minutes * (60 * 1000);

//convert the difference in dates to seconds
long seconds = diff / 1000;

// display the days, hours, minutes, seconds on screen
show_days.setText(String.valueOf(days));
show_hours.setText(String.valueOf(hours));
show_minutes.setText(String.valueOf(minutes));
show_seconds.setText(String.valueOf(seconds));



} else {

// if summer is already here (June 30th has passed) display that on screen
textViewGone();
done_pic.setVisibility(View.VISIBLE);


}
} catch (Exception e) {
e.printStackTrace();
}
}
};
handler.postDelayed(runnable, 1000);
}
public void textViewGone() {
// if summer is here, do not show the boxes meant to display days, hours, minutes, seconds
findViewById(R.id.LinearLayout10).setVisibility(View.GONE);
findViewById(R.id.LinearLayout11).setVisibility(View.GONE);
findViewById(R.id.LinearLayout12).setVisibility(View.GONE);
findViewById(R.id.LinearLayout13).setVisibility(View.GONE);
findViewById(R.id.days_left).setVisibility(View.GONE);
findViewById(R.id.bottom_line).setVisibility(View.GONE);
findViewById(R.id.top_line).setVisibility(View.GONE);
}
}
48 changes: 48 additions & 0 deletions app/src/main/java/com/app/bonnie/bliss_countdown/HomeScreen.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package com.app.bonnie.bliss_countdown;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;

public class HomeScreen extends AppCompatActivity {

public android.widget.Button countdown_button, youtube_button,soothing_songs;

public void init() {
countdown_button = (Button) findViewById(R.id.countdown_button);
youtube_button = (Button) findViewById(R.id.youtube_button);
soothing_songs = (Button) findViewById(R.id.soothing_songs);

countdown_button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent open_countdown = new Intent(HomeScreen.this, Countdown.class);
startActivity(open_countdown);
}
});

youtube_button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent open_youtube = new Intent(HomeScreen.this, YoutubeSongs.class);
startActivity(open_youtube);
}
});

soothing_songs.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent open_piano = new Intent(HomeScreen.this, PlaySongs.class);
startActivity(open_piano);
}
});
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.home_screen);
init();
}
}
30 changes: 30 additions & 0 deletions app/src/main/java/com/app/bonnie/bliss_countdown/PlayBeloved.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package com.app.bonnie.bliss_countdown;

import android.media.MediaPlayer;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;

public class PlayBeloved extends AppCompatActivity {

MediaPlayer mySound;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.nature_screen);
mySound = MediaPlayer.create(this,R.raw.beloved);
}

public void playNature(View view) {
mySound.start();
}

public void pauseNature(View view) {
mySound.pause();
}

public void stopNature(View view) {
mySound.stop();
}
}
Loading