przypisano pola do pól tekstu w notatce, dodano funkcję wyświetlania daty

This commit is contained in:
Naiki00 2021-02-15 19:21:26 +01:00
parent 16b8ce646a
commit 99bf648dc7

View File

@ -2,24 +2,42 @@ package com.example.notatkon;
import android.os.Bundle; import android.os.Bundle;
import android.view.View; import android.view.View;
import android.widget.EditText;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
public class CreateNote extends AppCompatActivity { public class CreateNote extends AppCompatActivity {
private EditText noteTitle, noteSubtitle, inputNote;
private TextView textDataTime;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.create_note); setContentView(R.layout.create_note);
ImageView imageBack = findViewById(R.id.back); ImageView imageBack = findViewById(R.id.back);
imageBack.setOnClickListener(new View.OnClickListener() { imageBack.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
onBackPressed(); onBackPressed();
} }
}); });
noteTitle = findViewById(R.id.noteTitle);
noteSubtitle = findViewById(R.id.noteSubtitle);
inputNote = findViewById(R.id.inputNote);
textDataTime = findViewById(R.id.textDateTime);
textDataTime.setText(
new SimpleDateFormat("EEEE, dd MM yyyy HH:mm", Locale.getDefault())
.format(new Date())
);
} }
} }