-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
266 additions
and
172 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
187 changes: 148 additions & 39 deletions
187
app/src/main/java/com/example/firstapp/FirstFragment.java
Large diffs are not rendered by default.
Oops, something went wrong.
45 changes: 45 additions & 0 deletions
45
app/src/main/java/com/example/firstapp/MainMenuFragment.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package com.example.firstapp; | ||
|
||
import android.os.Bundle; | ||
import android.view.LayoutInflater; | ||
import android.view.View; | ||
import android.view.ViewGroup; | ||
import android.widget.TextView; | ||
|
||
import androidx.annotation.NonNull; | ||
import androidx.fragment.app.Fragment; | ||
import androidx.navigation.fragment.NavHostFragment; | ||
|
||
import com.example.firstapp.databinding.FragmentMainMenuBinding; | ||
|
||
import java.util.Random; | ||
|
||
public class MainMenuFragment extends Fragment { | ||
|
||
private FragmentMainMenuBinding binding; | ||
|
||
@Override | ||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { | ||
binding = FragmentMainMenuBinding.inflate(inflater, container, false); | ||
return binding.getRoot(); | ||
} | ||
|
||
public void onViewCreated(@NonNull View view, Bundle savedInstanceState) { | ||
super.onViewCreated(view, savedInstanceState); | ||
|
||
view.findViewById(R.id.quiz_button).setOnClickListener(new View.OnClickListener() { | ||
@Override | ||
public void onClick(View view) { | ||
NavHostFragment.findNavController(MainMenuFragment.this) | ||
.navigate(R.id.action_MainMenuFragment_to_FirstFragment); | ||
} | ||
}); | ||
} | ||
|
||
@Override | ||
public void onDestroyView() { | ||
super.onDestroyView(); | ||
binding = null; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 0 additions & 56 deletions
56
app/src/main/java/com/example/firstapp/SecondFragment.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:background="@color/screenBackground2" | ||
tools:context=".MainMenuFragment"> | ||
|
||
<Button | ||
android:id="@+id/quiz_button" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:text="@string/start_quiz" | ||
app:layout_constraintBottom_toBottomOf="parent" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toTopOf="parent" /> | ||
|
||
</androidx.constraintlayout.widget.ConstraintLayout> |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,17 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<resources> | ||
<string name="app_name">首个应用</string> | ||
<string name="app_name">内存通道</string> | ||
<string name="action_settings">设置</string> | ||
<string name="first_fragment_label">第一个片段</string> | ||
<string name="second_fragment_label">第二个片段</string> | ||
<string name="previous">以前的</string> | ||
<string name="quiz_label">测验</string> | ||
<string name="main_menu_fragment_label">主菜单</string> | ||
<string name="hello_first_fragment">0</string> | ||
<string name="random_heading">这是一个介于 0 和</string> | ||
<string name="first_choice_text">第一</string> | ||
<string name="second_choice_text">第二</string> | ||
<string name="third_choice_text">第三</string> | ||
<string name="fourth_choice_text">第四</string> | ||
<string name="answered_correctly">%1$d</string> | ||
<string name="answered_all_questions">回答了所有问题</string> | ||
<string name="answered_all_questions">您回答了所有问题</string> | ||
<string name="loading">加载请稍候</string> | ||
<string name="start_quiz">开始测验</string> | ||
<string name="back_to_menu">返回菜单</string> | ||
</resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,17 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<resources> | ||
<string name="app_name">首個應用</string> | ||
<string name="app_name">內存通道</string> | ||
<string name="action_settings">設置</string> | ||
<string name="first_fragment_label">第一個片段</string> | ||
<string name="second_fragment_label">第二個片段</string> | ||
<string name="previous">以前的</string> | ||
<string name="quiz_label">測驗</string> | ||
<string name="main_menu_fragment_label">主菜單</string> | ||
<string name="hello_first_fragment">0</string> | ||
<string name="random_heading">這是一個介於 0 和</string> | ||
<string name="first_choice_text">第一</string> | ||
<string name="second_choice_text">第二</string> | ||
<string name="third_choice_text">第三</string> | ||
<string name="fourth_choice_text">第四</string> | ||
<string name="answered_correctly">%1$d</string> | ||
<string name="answered_all_questions">回答了所有問題</string> | ||
<string name="answered_all_questions">您回答了所有問題</string> | ||
<string name="loading">加載請稍候</string> | ||
<string name="start_quiz">開始測驗</string> | ||
<string name="back_to_menu">返回菜單</string> | ||
</resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,17 @@ | ||
<resources> | ||
<string name="app_name">FirstApp</string> | ||
<string name="app_name">Memory Lane</string> | ||
<string name="action_settings">Settings</string> | ||
<!-- Strings used for fragments for navigation --> | ||
<string name="first_fragment_label">First Fragment</string> | ||
<string name="second_fragment_label">Second Fragment</string> | ||
<string name="previous">Previous</string> | ||
|
||
<string name="quiz_label">Quiz</string> | ||
<string name="main_menu_fragment_label">Main Menu</string> | ||
<string name="hello_first_fragment">0</string> | ||
<string name="random_heading">Here is a random number between 0 and %d.</string> | ||
<string name="first_choice_text">First</string> | ||
<string name="second_choice_text">Second</string> | ||
<string name="third_choice_text">Third</string> | ||
<string name="fourth_choice_text">Fourth</string> | ||
<string name="answered_correctly">%1$d</string> | ||
<string name="answered_all_questions">Answered all questions</string> | ||
<string name="loading">Loading... Please Wait</string> | ||
<string name="back_to_menu">Back to Menu</string> | ||
<string name="start_quiz">Start Quiz</string> | ||
</resources> |