Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
android_20250623
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Patryk Czarnik
android_20250623
Commits
ec1add1f
Commit
ec1add1f
authored
Jun 24, 2025
by
Patryk Czarnik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Dodatkowe pole oraz licznik w Rozmowa
parent
9e4f3253
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
3 deletions
+40
-3
Rozmowa.java
Projekt3/app/src/main/java/com/example/projekt3/Rozmowa.java
+15
-0
activity_rozmowa.xml
Projekt3/app/src/main/res/layout/activity_rozmowa.xml
+25
-3
No files found.
Projekt3/app/src/main/java/com/example/projekt3/Rozmowa.java
View file @
ec1add1f
...
@@ -13,6 +13,12 @@ import androidx.core.view.ViewCompat;
...
@@ -13,6 +13,12 @@ import androidx.core.view.ViewCompat;
import
androidx.core.view.WindowInsetsCompat
;
import
androidx.core.view.WindowInsetsCompat
;
public
class
Rozmowa
extends
AppCompatActivity
{
public
class
Rozmowa
extends
AppCompatActivity
{
{
// "blok inicjalizacyjny - ten kod wykona się za każdym razem,
// gdy tworzony będzie obiekt klasy Rozmowa
Log
.
d
(
TAG
,
"tworzenie obiektu"
);
}
private
int
licznik
=
0
;
private
static
final
String
TAG
=
"Rozmowa"
;
private
static
final
String
TAG
=
"Rozmowa"
;
...
@@ -26,9 +32,17 @@ public class Rozmowa extends AppCompatActivity {
...
@@ -26,9 +32,17 @@ public class Rozmowa extends AppCompatActivity {
public
void
gadaj
(
View
view
)
{
public
void
gadaj
(
View
view
)
{
Log
.
d
(
TAG
,
"gadaj: "
);
Log
.
d
(
TAG
,
"gadaj: "
);
EditText
editText_Imie
=
findViewById
(
R
.
id
.
editText_Imie
);
EditText
editText_Imie
=
findViewById
(
R
.
id
.
editText_Imie
);
EditText
editText_Miasto
=
findViewById
(
R
.
id
.
editText_Miasto
);
TextView
textView_Pozdrowienie
=
findViewById
(
R
.
id
.
textView_Pozdrowienie
);
TextView
textView_Pozdrowienie
=
findViewById
(
R
.
id
.
textView_Pozdrowienie
);
String
imie
=
editText_Imie
.
getText
().
toString
();
String
imie
=
editText_Imie
.
getText
().
toString
();
String
miasto
=
editText_Miasto
.
getText
().
toString
();
// Uwaga wydajnociowa - jeśli operacji + += na tekście byłoby więcej (szczególnie - gdyby w pętli)
// to byłoby to mało wydajne - zamiast tego używa się StringBuilder lub od Java 8 metody join lub Collectors.joining
String
powitanie
=
"Witaj "
+
imie
;
String
powitanie
=
"Witaj "
+
imie
;
if
(!
miasto
.
isBlank
())
{
powitanie
+=
" z miasta "
+
miasto
;
}
powitanie
+=
" ("
+
++
licznik
+
")"
;
textView_Pozdrowienie
.
setText
(
powitanie
);
textView_Pozdrowienie
.
setText
(
powitanie
);
}
}
}
}
\ No newline at end of file
Projekt3/app/src/main/res/layout/activity_rozmowa.xml
View file @
ec1add1f
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
android:id=
"@+id/textView_Imie"
android:id=
"@+id/textView_Imie"
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"
16
dp"
android:layout_marginTop=
"
48
dp"
android:text=
"Jak masz na imię?"
android:text=
"Jak masz na imię?"
android:textSize=
"20sp"
android:textSize=
"20sp"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
...
@@ -25,11 +25,33 @@
...
@@ -25,11 +25,33 @@
android:layout_marginTop=
"16dp"
android:layout_marginTop=
"16dp"
android:ems=
"10"
android:ems=
"10"
android:inputType=
"text"
android:inputType=
"text"
android:text=
"Name"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/textView_Imie"
/>
app:layout_constraintTop_toBottomOf=
"@+id/textView_Imie"
/>
<TextView
android:id=
"@+id/textView_Miasto"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"48dp"
android:text=
"Z jakiego miasta jesteś?"
android:textSize=
"20sp"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/editText_Imie"
/>
<EditText
android:id=
"@+id/editText_Miasto"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"16dp"
android:ems=
"10"
android:inputType=
"text"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/textView_Miasto"
/>
<Button
<Button
android:id=
"@+id/button_Rozmowa"
android:id=
"@+id/button_Rozmowa"
android:layout_width=
"160dp"
android:layout_width=
"160dp"
...
@@ -51,7 +73,7 @@
...
@@ -51,7 +73,7 @@
android:layout_marginStart=
"24dp"
android:layout_marginStart=
"24dp"
android:layout_marginEnd=
"24dp"
android:layout_marginEnd=
"24dp"
android:layout_marginBottom=
"48dp"
android:layout_marginBottom=
"48dp"
android:text=
"
TextView
"
android:text=
"
Hej
"
android:textAlignment=
"center"
android:textAlignment=
"center"
android:textSize=
"20sp"
android:textSize=
"20sp"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintBottom_toBottomOf=
"parent"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment