Skip to content

Commit

Permalink
alarm
Browse files Browse the repository at this point in the history
  • Loading branch information
hussienalrubaye committed Nov 2, 2016
1 parent 259dddd commit fee5bdc
Show file tree
Hide file tree
Showing 37 changed files with 789 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Alaram App/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
*.iml
.gradle
/local.properties
/.idea/workspace.xml
/.idea/libraries
.DS_Store
/build
/captures
.externalNativeBuild
22 changes: 22 additions & 0 deletions Alaram App/.idea/compiler.xml

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

3 changes: 3 additions & 0 deletions Alaram App/.idea/copyright/profiles_settings.xml

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

6 changes: 6 additions & 0 deletions Alaram App/.idea/encodings.xml

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

19 changes: 19 additions & 0 deletions Alaram App/.idea/gradle.xml

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

49 changes: 49 additions & 0 deletions Alaram App/.idea/misc.xml

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

9 changes: 9 additions & 0 deletions Alaram App/.idea/modules.xml

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

12 changes: 12 additions & 0 deletions Alaram App/.idea/runConfigurations.xml

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

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

android {
compileSdkVersion 24
buildToolsVersion "24.0.3"
defaultConfig {
applicationId "com.alrubaye.alaram"
minSdkVersion 15
targetSdkVersion 24
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:24.2.1'
testCompile 'junit:junit:4.12'
compile 'com.frosquivel:magicaltakephoto:1.0'
}
17 changes: 17 additions & 0 deletions Alaram App/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 /Users/hussienalrubaye/Library/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 *;
#}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.alrubaye.alaram;

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

<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<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>

<receiver
android:name=".MyReceiver"
android:enabled="true"
android:exported="false">
<intent-filter>
<action android:name="com.alraby.alam"/>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</receiver>
</application>

</manifest>
32 changes: 32 additions & 0 deletions Alaram App/app/src/main/java/com/alrubaye/alaram/MainActivity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package com.alrubaye.alaram;

import android.app.AlarmManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;

import java.util.Calendar;

public class MainActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
android.app.FragmentManager fm= getFragmentManager();
PopTime popTime=new PopTime();
popTime.show(fm,"Show fragment");
}

void SetTime(int Hour ,int Minute ){


// /save dat
savedata savedata =new savedata(this);
savedata.Alarmset(Hour,Minute);
savedata.SaveData(Hour,Minute);

}
}
28 changes: 28 additions & 0 deletions Alaram App/app/src/main/java/com/alrubaye/alaram/MyReceiver.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package com.alrubaye.alaram;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.widget.Toast;

public class MyReceiver extends BroadcastReceiver {
public MyReceiver() {
}

@Override
public void onReceive(Context context, Intent intent) {

if (intent.getAction().equalsIgnoreCase("com.alraby.alam")){
Bundle b=intent.getExtras();
Toast.makeText(context,b.getString("MyMessage"),Toast.LENGTH_LONG).show();
}
else if (intent.getAction().equalsIgnoreCase("android.intent.action.BOOT_COMPLETED")){
// restart
savedata savedata =new savedata(context);
savedata.LoadData();


}
}
}
46 changes: 46 additions & 0 deletions Alaram App/app/src/main/java/com/alrubaye/alaram/PopTime.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package com.alrubaye.alaram;

/**
* Created by hussienalrubaye on 10/31/16.
*/

import android.app.DialogFragment;
import android.os.Build;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TimePicker;

/**
* Created by hussienalrubaye on 10/9/16.
*/

public class PopTime extends DialogFragment implements View.OnClickListener {

View view;
TimePicker tp;
Button buDome;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState)
{
view=inflater.inflate(R.layout.pop_time,container,false);
tp=(TimePicker)view.findViewById(R.id.tp1);
buDome=(Button)view.findViewById(R.id.buDome);
buDome.setOnClickListener(this);
return view;
}


@Override
public void onClick(View v) {
this.dismiss();
MainActivity ma=(MainActivity)getActivity();
if ((int) Build.VERSION.SDK_INT >= 23)
ma.SetTime(tp.getHour(),tp.getMinute());
else
ma.SetTime(tp.getCurrentHour(),tp.getCurrentMinute());
}
}
Loading

0 comments on commit fee5bdc

Please sign in to comment.