レイアウト編集, 処理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 { public class ScannerManagerFragment extends Fragment {
// TODO: Rename parameter arguments, choose names that match private static final boolean DEFAULT_SINGLE_PAGE = false;
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER private boolean singlePage;
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;
public ScannerManagerFragment() { public ScannerManagerFragment() {
// Required empty public constructor // Required empty public constructor
} }
/** public static ScannerManagerFragment newInstance(boolean singlePage) {
* 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) {
ScannerManagerFragment fragment = new ScannerManagerFragment(); ScannerManagerFragment fragment = new ScannerManagerFragment();
Bundle args = new Bundle(); Bundle args = new Bundle();
args.putString(ARG_PARAM1, param1); args.putBoolean("singlePage", singlePage);
args.putString(ARG_PARAM2, param2);
fragment.setArguments(args); fragment.setArguments(args);
return fragment; return fragment;
} }
@ -50,8 +34,7 @@ public class ScannerManagerFragment extends Fragment {
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
if (getArguments() != null) { if (getArguments() != null) {
mParam1 = getArguments().getString(ARG_PARAM1); singlePage = getArguments().getBoolean("singlePage", DEFAULT_SINGLE_PAGE);
mParam2 = getArguments().getString(ARG_PARAM2);
} }
} }
@ -61,4 +44,13 @@ public class ScannerManagerFragment extends Fragment {
// Inflate the layout for this fragment // Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_scanner_manager, container, false); 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"?> <?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" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
tools:context=".ScannerManagerFragment"> tools:context=".ScannerManagerFragment">
<!-- TODO: Update blank fragment layout --> <Button
<TextView android:id="@+id/button_start_scan"
android:layout_width="match_parent" android:layout_width="0dp"
android:layout_height="match_parent" android:layout_height="wrap_content"
android:text="@string/hello_blank_fragment" /> android:text="Button"
app:layout_constraintEnd_toEndOf="parent"
</FrameLayout> app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>