mirror of
https://github.com/lacerta-doc/Lacerta.git
synced 2024-11-26 17:53:14 +00:00
アクティビティ作成
This commit is contained in:
parent
b99efb3336
commit
35b998eebe
|
@ -30,6 +30,8 @@ dependencies {
|
||||||
|
|
||||||
implementation libs.androidx.appcompat
|
implementation libs.androidx.appcompat
|
||||||
implementation libs.com.google.android.material
|
implementation libs.com.google.android.material
|
||||||
|
implementation libs.androidx.activity
|
||||||
|
implementation libs.androidx.constraintlayout
|
||||||
testImplementation libs.junit
|
testImplementation libs.junit
|
||||||
androidTestImplementation libs.androidx.test.ext.junit
|
androidTestImplementation libs.androidx.test.ext.junit
|
||||||
androidTestImplementation libs.androidx.test.espresso.core
|
androidTestImplementation libs.androidx.test.espresso.core
|
||||||
|
|
|
@ -1,4 +1,10 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
|
<application>
|
||||||
|
<activity
|
||||||
|
android:name=".ScannerManagerActivity"
|
||||||
|
android:exported="false" />
|
||||||
|
</application>
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
|
@ -0,0 +1,24 @@
|
||||||
|
package one.nem.lacerta.component.scanner;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
|
||||||
|
import androidx.activity.EdgeToEdge;
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.core.graphics.Insets;
|
||||||
|
import androidx.core.view.ViewCompat;
|
||||||
|
import androidx.core.view.WindowInsetsCompat;
|
||||||
|
|
||||||
|
public class ScannerManagerActivity extends AppCompatActivity {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
EdgeToEdge.enable(this);
|
||||||
|
setContentView(R.layout.activity_scanner_manager);
|
||||||
|
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
|
||||||
|
Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
|
||||||
|
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
|
||||||
|
return insets;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -31,24 +31,7 @@ public class ScannerManagerFragment extends Fragment {
|
||||||
@Inject
|
@Inject
|
||||||
LacertaVcsFactory vcsFactory;
|
LacertaVcsFactory vcsFactory;
|
||||||
|
|
||||||
DocumentScanner documentScanner = new DocumentScanner(
|
DocumentScanner documentScanner;
|
||||||
requireActivity(),
|
|
||||||
(croppedImage) -> {
|
|
||||||
// TODO-rca: 画像を保存する
|
|
||||||
return null;
|
|
||||||
},
|
|
||||||
(error) -> {
|
|
||||||
// TODO-rca: エラー処理
|
|
||||||
return null;
|
|
||||||
},
|
|
||||||
() -> {
|
|
||||||
// TODO-rca: キャンセル処理
|
|
||||||
return null;
|
|
||||||
},
|
|
||||||
null,
|
|
||||||
null,
|
|
||||||
null
|
|
||||||
);
|
|
||||||
|
|
||||||
private static final boolean DEFAULT_SINGLE_PAGE = false;
|
private static final boolean DEFAULT_SINGLE_PAGE = false;
|
||||||
private boolean singlePage;
|
private boolean singlePage;
|
||||||
|
@ -79,6 +62,25 @@ public class ScannerManagerFragment extends Fragment {
|
||||||
if (getArguments() != null) {
|
if (getArguments() != null) {
|
||||||
singlePage = getArguments().getBoolean("singlePage", DEFAULT_SINGLE_PAGE);
|
singlePage = getArguments().getBoolean("singlePage", DEFAULT_SINGLE_PAGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
documentScanner = new DocumentScanner(
|
||||||
|
requireActivity(),
|
||||||
|
(croppedImage) -> {
|
||||||
|
// TODO-rca: 画像を保存する
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
(error) -> {
|
||||||
|
// TODO-rca: エラー処理
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
() -> {
|
||||||
|
// TODO-rca: キャンセル処理
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -87,11 +89,11 @@ public class ScannerManagerFragment extends Fragment {
|
||||||
// Inflate the layout for this fragment
|
// Inflate the layout for this fragment
|
||||||
View view = inflater.inflate(R.layout.fragment_scanner_manager, container, false);
|
View view = inflater.inflate(R.layout.fragment_scanner_manager, container, false);
|
||||||
|
|
||||||
ViewGroup.LayoutParams layoutParams = new ViewGroup.LayoutParams(
|
// ViewGroup.LayoutParams layoutParams = new ViewGroup.LayoutParams(
|
||||||
ViewGroup.LayoutParams.MATCH_PARENT,
|
// ViewGroup.LayoutParams.MATCH_PARENT,
|
||||||
ViewGroup.LayoutParams.MATCH_PARENT
|
// ViewGroup.LayoutParams.MATCH_PARENT
|
||||||
);
|
// );
|
||||||
view.setLayoutParams(layoutParams);
|
// view.setLayoutParams(layoutParams);
|
||||||
|
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
@ -104,7 +106,9 @@ public class ScannerManagerFragment extends Fragment {
|
||||||
logger.debug(TAG, "called");
|
logger.debug(TAG, "called");
|
||||||
|
|
||||||
view.findViewById(R.id.button_start_scan).setOnClickListener(v -> {
|
view.findViewById(R.id.button_start_scan).setOnClickListener(v -> {
|
||||||
|
if (documentScanner != null) {
|
||||||
documentScanner.startScan();
|
documentScanner.startScan();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
<?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:id="@+id/main"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
tools:context=".ScannerManagerActivity">
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
Loading…
Reference in New Issue
Block a user