QR画像を生成するフラグメントへの画像遷移を追加しました

This commit is contained in:
it232115 2024-01-12 11:31:27 +09:00
parent 18636c661c
commit 1a33e070b5
2 changed files with 23 additions and 4 deletions

View File

@ -34,7 +34,6 @@
<category android:name="android.intent.category.LAUNCHER" /> <category android:name="android.intent.category.LAUNCHER" />
</intent-filter> </intent-filter>
</activity> </activity>
<activity android:name=".UrlPageActivity" />
</application> </application>
</manifest> </manifest>

View File

@ -1,7 +1,12 @@
package com.example.childguard; package com.example.childguard;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Color; import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.os.Bundle; import android.os.Bundle;
@ -9,15 +14,22 @@ import androidx.core.content.res.ResourcesCompat;
import androidx.fragment.app.Fragment; import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager; import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction; import androidx.fragment.app.FragmentTransaction;
import androidx.print.PrintHelper;
import android.util.AndroidRuntimeException;
import android.util.Log; import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.Button; import android.widget.Button;
import android.widget.FrameLayout; import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.WriterException;
import com.journeyapps.barcodescanner.BarcodeEncoder;
/** /**
* A simple {@link Fragment} subclass. * A simple {@link Fragment} subclass.
* Use the {@link HomeFragment#newInstance} factory method to * Use the {@link HomeFragment#newInstance} factory method to
@ -69,12 +81,20 @@ public class HomeFragment extends Fragment {
public View onCreateView(LayoutInflater inflater, ViewGroup container, public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) { Bundle savedInstanceState) {
// Inflate the layout for this fragment // Inflate the layout for this fragment
//bluetooth設定ボタンの処理
View view=inflater.inflate(R.layout.fragment_home,container,false); View view=inflater.inflate(R.layout.fragment_home,container,false);
MainActivity activity = (MainActivity) getActivity(); MainActivity activity = (MainActivity) getActivity();
//QRコード印刷の処理
Button bt1=view.findViewById(R.id.Bluetooth_setup); Button bt1=view.findViewById(R.id.QRprinting);
bt1.setOnClickListener(new View.OnClickListener() { bt1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
replaceFragment(new QrPrintFragment());
}
});
//bluetooth設定ボタンの処理
Button bt2=view.findViewById(R.id.Bluetooth_setup);
bt2.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
replaceFragment(new bluetooth_setupFragment()); replaceFragment(new bluetooth_setupFragment());