Skip to content

Commit f9fe937

Browse files
authored
Add files via upload
1 parent 6e8a30d commit f9fe937

File tree

2 files changed

+56
-0
lines changed

2 files changed

+56
-0
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package com.example.dhananjay.dailygoals;
2+
3+
import android.app.AlarmManager;
4+
import android.app.NotificationManager;
5+
import android.app.PendingIntent;
6+
import android.content.BroadcastReceiver;
7+
import android.content.Context;
8+
import android.content.Intent;
9+
import android.support.v4.app.NotificationCompat;
10+
import android.widget.EditText;
11+
12+
/**
13+
* Created by kmurali on 25-04-2018.
14+
*/
15+
16+
public class NotificationActivity extends BroadcastReceiver {
17+
@Override
18+
public void onReceive(Context context, Intent intent) {
19+
NotificationManager notificationManager=(NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE);
20+
Intent repeatIntent=new Intent(context,MainActivity.class);
21+
repeatIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
22+
PendingIntent pendingIntent=PendingIntent.getActivity(context,100,repeatIntent,PendingIntent.FLAG_UPDATE_CURRENT);
23+
24+
NotificationCompat.Builder builder=new NotificationCompat.Builder(context)
25+
.setContentIntent(pendingIntent)
26+
.setSmallIcon(R.drawable.tick)
27+
.setContentTitle("Goal Notification")
28+
.setContentText("Time to perform"+"\n"+"task"+"\n"+"Complete your goal")
29+
.setAutoCancel(true);
30+
notificationManager.notify(100,builder.build());
31+
}
32+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package com.example.dhananjay.dailygoals;
2+
3+
import android.os.Bundle;
4+
import android.support.annotation.Nullable;
5+
import android.support.v7.app.AppCompatActivity;
6+
import android.util.DisplayMetrics;
7+
8+
/**
9+
* Created by kmurali on 25-04-2018.
10+
*/
11+
12+
public class PopupActivity extends AppCompatActivity {
13+
14+
@Override
15+
protected void onCreate(@Nullable Bundle savedInstanceState) {
16+
super.onCreate(savedInstanceState);
17+
setContentView(R.layout.activity_popup);
18+
DisplayMetrics dm=new DisplayMetrics();
19+
getWindowManager().getDefaultDisplay().getMetrics(dm);
20+
int width=dm.widthPixels;
21+
int height=dm.heightPixels;
22+
getWindow().setLayout((int)(width*.8),(int)(height*.6));
23+
}
24+
}

0 commit comments

Comments
 (0)