NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

package com.example.muhammet.reminderapp;

import android.app.AlarmManager;
import android.app.DatePickerDialog;
import android.app.PendingIntent;
import android.app.TimePickerDialog;
import android.content.Context;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.DatePicker;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.TimePicker;
import android.widget.Toast;
import android.text.format.DateFormat;//aşşada calebi saniye
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;


import org.w3c.dom.Text;

//import java.text.DateFormat;
import java.text.Format;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.concurrent.TimeUnit;


public class ProfileActivity extends AppCompatActivity implements View.OnClickListener,DatePickerDialog.OnDateSetListener,TimePickerDialog.OnTimeSetListener {

private FirebaseAuth firebaseAuth;
//Calendar c = Calendar.getInstance();
private TextView textViewUserEmail,textViewFinalDate;
private Button buttonLogout,buttonSave,buttonPicker,buttonAlarm;
private DatabaseReference databaseReference;
private EditText editTextTitle,editTextNote;
int day,month,year,hour,minute;
int pickerDay,pickerMonth,pickerYear,pickerHour,pickerMinute;
String dayFinal,monthFinal,yearFinal,hourFinal,minuteFinal;
Calendar c = Calendar.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy");

//long dateLong =dayFinal,monthFinal,yearFinal,hourFinal,minuteFinal;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_profile);

firebaseAuth = FirebaseAuth.getInstance();
if (firebaseAuth.getCurrentUser()==null){
finish();
startActivity(new Intent(this,LoginActivity.class));
}

databaseReference = FirebaseDatabase.getInstance().getReference();
editTextTitle = (EditText) findViewById(R.id.editTextTitle);
editTextNote = (EditText) findViewById(R.id.editTextNote);
textViewFinalDate = (TextView) findViewById(R.id.textViewFinalDate);
buttonSave = (Button) findViewById(R.id.buttonSave);
buttonPicker = (Button) findViewById(R.id.buttonPicker);
buttonAlarm = (Button) findViewById(R.id.buttonAlarm);

buttonPicker.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View view){
year = c.get(Calendar.YEAR);
month= c.get(Calendar.MONTH);
day = c.get(Calendar.DAY_OF_MONTH);
DatePickerDialog datePickerDialog = new DatePickerDialog(ProfileActivity.this,ProfileActivity.this,year,month,day);
datePickerDialog.show();
}
});
FirebaseUser user = firebaseAuth.getCurrentUser();
textViewUserEmail = (TextView) findViewById(R.id.textViewUserEmail);
//Burayı daha sonra kullanıcı adı veya isim olarak değiştir.
textViewUserEmail.setText("Hoşgeldiniz n"+user.getEmail());
textViewUserEmail = (TextView) findViewById(R.id.textViewUserEmail);
buttonLogout = (Button) findViewById(R.id.buttonLogout);
buttonLogout.setOnClickListener(this);
buttonSave.setOnClickListener(this);
}

private void saveUserInformation(){
String name = editTextTitle.getText().toString().trim();
String note = editTextNote.getText().toString().trim();
String fullDate = textViewFinalDate.getText().toString().trim();

UserInformation userInformation = new UserInformation(name,note,fullDate);
FirebaseUser user = firebaseAuth.getCurrentUser();

databaseReference.child(user.getUid()).setValue(userInformation);
Toast.makeText(this,"Notunuz kaydedildi.",Toast.LENGTH_LONG).show();
}
@Override
public void onClick(View view) {
if (view == buttonLogout){
firebaseAuth.signOut();
finish();
startActivity(new Intent(this,LoginActivity.class));
}
if (view == buttonSave){
saveUserInformation();
}
}

@Override
public void onDateSet(DatePicker view, int yearOfKing, int yearOfMonth, int dayOfMonth) {
yearFinal =Integer.toString(yearOfKing);
monthFinal = Integer.toString(yearOfMonth+1);
dayFinal = Integer.toString(dayOfMonth);
pickerYear = yearOfKing;
pickerMonth=yearOfMonth+1;
pickerDay=dayOfMonth;

if(yearOfMonth < 10)
{
monthFinal = "0" + monthFinal;
}

if(dayOfMonth< 10)
{
dayFinal = "0" + dayFinal;
}


hour = c.get(Calendar.HOUR_OF_DAY);
minute=c.get(Calendar.MINUTE);

TimePickerDialog timePickerDialog = new TimePickerDialog(ProfileActivity.this,ProfileActivity.this,hour,minute,DateFormat.is24HourFormat(this
));
timePickerDialog.show();
}

@Override
public void onTimeSet(TimePicker view, int hourOfDay, int hourOfMinute) {

hourFinal = Integer.toString(hourOfDay);
minuteFinal = Integer.toString(hourOfMinute);
pickerHour=hourOfDay;
pickerMinute=hourOfMinute;
textViewFinalDate.setText(dayFinal+"."+monthFinal+"."+yearFinal+" "+hourFinal+":"+minuteFinal+"n"+pickerDay+" "+pickerMonth+" "+pickerYear+" "+pickerHour+" "+pickerMinute);
}

public void AlarmButton(View view) {
Calendar alarmCall = Calendar.getInstance();
alarmCall.setTimeInMillis(System.currentTimeMillis());
alarmCall.set(Calendar.HOUR_OF_DAY, pickerHour);
alarmCall.set(Calendar.MINUTE,pickerMinute);
Intent intent = new Intent(this, AlarmReceiver.class);
PendingIntent pendingIntent = PendingIntent.getBroadcast(this, 1, intent, 0);

AlarmManager alarmManager = (AlarmManager)getSystemService(Context.ALARM_SERVICE);
alarmManager.setInexactRepeating(AlarmManager.RTC_WAKEUP,alarmCall.getTimeInMillis(),AlarmManager.RTC_WAKEUP, pendingIntent);
}
}
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.