From 3a7b28e330726598db96989a142c65957053fabf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=82=8D=E3=82=80=E3=81=AD=E3=81=93?= <66072112+r-ca@users.noreply.github.com> Date: Thu, 21 Dec 2023 12:34:46 +0900 Subject: [PATCH] =?UTF-8?q?Revert=20"WIP=20=E7=B5=90=E6=9E=9C=E3=82=92?= =?UTF-8?q?=E3=83=97=E3=83=AC=E3=83=93=E3=83=A5=E3=83=BC=E3=81=99=E3=82=8B?= =?UTF-8?q?=E3=83=AD=E3=82=B8=E3=83=83=E3=82=AF=E5=AE=9F=E8=A3=85"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit b3dcaefedef2e60584ae1aa8b027af7ded2f3471. --- .../ScannerDataManagerStubFragment.java | 72 +------------------ 1 file changed, 2 insertions(+), 70 deletions(-) diff --git a/component/scanner/src/main/java/one/nem/lacerta/component/scanner/ScannerDataManagerStubFragment.java b/component/scanner/src/main/java/one/nem/lacerta/component/scanner/ScannerDataManagerStubFragment.java index 17f09277..fc11c575 100644 --- a/component/scanner/src/main/java/one/nem/lacerta/component/scanner/ScannerDataManagerStubFragment.java +++ b/component/scanner/src/main/java/one/nem/lacerta/component/scanner/ScannerDataManagerStubFragment.java @@ -8,15 +8,12 @@ import android.os.Bundle; import androidx.activity.result.ActivityResultLauncher; import androidx.activity.result.contract.ActivityResultContracts; import androidx.fragment.app.Fragment; -import androidx.recyclerview.widget.RecyclerView; import android.provider.MediaStore; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; -import android.widget.ImageView; -import android.widget.TextView; import java.util.ArrayList; @@ -28,7 +25,7 @@ import java.util.ArrayList; public class ScannerDataManagerStubFragment extends Fragment { // Results - private ArrayList results = new ArrayList<>(); + private ArrayList results = new ArrayList<>(); private final ActivityResultLauncher cameraLauncher = registerForActivityResult( new ActivityResultContracts.StartActivityForResult(), result -> { @@ -36,8 +33,7 @@ public class ScannerDataManagerStubFragment extends Fragment { Intent data = result.getData(); Bundle extras = data.getExtras(); Bitmap imageBitmap = (Bitmap) extras.get("data"); - // TODO-rca: エラーハンドリング - results.add(new CapturedData("Placeholder", Integer.toString(imageBitmap.getHeight()), Integer.toString(imageBitmap.getWidth()), "Placeholder", imageBitmap)); + results.add(imageBitmap); } } ); @@ -81,68 +77,4 @@ public class ScannerDataManagerStubFragment extends Fragment { } }); } - - @Override - public void onResume() { - super.onResume(); - Log.d("ScannerDataManagerStubFragment", "onResume"); - - - } - - public void updateResults() { - Log.d("ScannerDataManagerStubFragment", "updateResults"); - - // TODO-rca: エラーハンドリング - RecyclerView recyclerView = getView().findViewById(R.id.result_recycler_view); - - recyclerView.setLayoutManager(new androidx.recyclerview.widget.LinearLayoutManager(getContext())); - recyclerView.setAdapter(new ResultAdapter(this.results)); - - - } - - public class ResultAdapter extends RecyclerView.Adapter { - private final ArrayList results; - - public ResultAdapter(ArrayList results) { - this.results = results; - } - - @Override - public ResultAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { - View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_item_scanner_component_manager_stub, parent, false); - return new ResultAdapter.ViewHolder(view); - } - - @Override - public void onBindViewHolder(ResultAdapter.ViewHolder holder, int position) { - CapturedData result = results.get(position); - holder.textViewPath.setText(result.getPath()); - holder.textViewResolutionHeight.setText(result.getResolutionHeight()); - holder.textViewResolutionWidth.setText(result.getResolutionWidth()); - holder.imageView.setImageBitmap(result.getBitmap()); - } - - @Override - public int getItemCount() { - return results.size(); - } - - public class ViewHolder extends RecyclerView.ViewHolder { - - public TextView textViewPath; - public TextView textViewResolutionHeight; - public TextView textViewResolutionWidth; - public ImageView imageView; - - public ViewHolder(View view) { - super(view); - textViewPath = view.findViewById(R.id.textViewPath); - textViewResolutionHeight = view.findViewById(R.id.textViewResHeight); - textViewResolutionWidth = view.findViewById(R.id.textViewResWidth); - imageView = view.findViewById(R.id.imageViewResult); - } - } - } } \ No newline at end of file