レイアウト編集, 処理init

This commit is contained in:
ろむねこ 2024-01-15 14:36:10 +09:00
parent dbb737d896
commit 75c0700144
No known key found for this signature in database
GPG Key ID: FA1F39A1BA37D168
2 changed files with 25 additions and 30 deletions

View File

@ -15,33 +15,17 @@ import android.view.ViewGroup;
*/
public class ScannerManagerFragment extends Fragment {
// TODO: Rename parameter arguments, choose names that match
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
private static final String ARG_PARAM1 = "param1";
private static final String ARG_PARAM2 = "param2";
// TODO: Rename and change types of parameters
private String mParam1;
private String mParam2;
private static final boolean DEFAULT_SINGLE_PAGE = false;
private boolean singlePage;
public ScannerManagerFragment() {
// Required empty public constructor
}
/**
* Use this factory method to create a new instance of
* this fragment using the provided parameters.
*
* @param param1 Parameter 1.
* @param param2 Parameter 2.
* @return A new instance of fragment ScannerManagerFragment.
*/
// TODO: Rename and change types and number of parameters
public static ScannerManagerFragment newInstance(String param1, String param2) {
public static ScannerManagerFragment newInstance(boolean singlePage) {
ScannerManagerFragment fragment = new ScannerManagerFragment();
Bundle args = new Bundle();
args.putString(ARG_PARAM1, param1);
args.putString(ARG_PARAM2, param2);
args.putBoolean("singlePage", singlePage);
fragment.setArguments(args);
return fragment;
}
@ -50,8 +34,7 @@ public class ScannerManagerFragment extends Fragment {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getArguments() != null) {
mParam1 = getArguments().getString(ARG_PARAM1);
mParam2 = getArguments().getString(ARG_PARAM2);
singlePage = getArguments().getBoolean("singlePage", DEFAULT_SINGLE_PAGE);
}
}
@ -61,4 +44,13 @@ public class ScannerManagerFragment extends Fragment {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_scanner_manager, container, false);
}
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
view.findViewById(R.id.button_start_scan).setOnClickListener(v -> {
});
}
}

View File

@ -1,14 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
<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"
tools:context=".ScannerManagerFragment">
<!-- TODO: Update blank fragment layout -->
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="@string/hello_blank_fragment" />
</FrameLayout>
<Button
android:id="@+id/button_start_scan"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="Button"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>