|
@ -17,7 +17,7 @@
|
|||
android:allowBackup="true"
|
||||
android:dataExtractionRules="@xml/data_extraction_rules"
|
||||
android:fullBackupContent="@xml/backup_rules"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:icon="@mipmap/ic_launcher_temp_round"
|
||||
android:name=".LacertaApplication"
|
||||
android:label="@string/app_name"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
|
|
BIN
app/src/main/ic_launcher_temp-playstore.png
Normal file
After Width: | Height: | Size: 6.2 KiB |
|
@ -6,6 +6,7 @@ import android.util.Log;
|
|||
import com.google.android.material.color.DynamicColors;
|
||||
|
||||
import dagger.hilt.android.HiltAndroidApp;
|
||||
import one.nem.lacerta.utils.FeatureSwitch;
|
||||
|
||||
@HiltAndroidApp
|
||||
public class LacertaApplication extends Application {
|
||||
|
@ -15,7 +16,11 @@ public class LacertaApplication extends Application {
|
|||
|
||||
if (DynamicColors.isDynamicColorAvailable()) {
|
||||
Log.d("DynamicColors", "DynamicColors is available. Applying to activities...");
|
||||
DynamicColors.applyToActivitiesIfAvailable(this);
|
||||
if (FeatureSwitch.Meta.disableDynamicColor) {
|
||||
Log.d("DynamicColors", "DynamicColors is disabled by FeatureSwitch.");
|
||||
} else {
|
||||
DynamicColors.applyToActivitiesIfAvailable(this);
|
||||
}
|
||||
} else {
|
||||
Log.d("DynamicColors", "DynamicColors is not available.");
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package one.nem.lacerta;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
@ -11,6 +12,7 @@ import androidx.navigation.fragment.NavHostFragment;
|
|||
import androidx.navigation.ui.NavigationUI;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
|
@ -85,6 +87,21 @@ public class MainActivity extends AppCompatActivity implements FragmentNavigatio
|
|||
});
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
|
||||
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
||||
if (requestCode == 1) {
|
||||
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
|
||||
Toast.makeText(this, "Permission granted", Toast.LENGTH_SHORT).show();
|
||||
} else {
|
||||
Toast.makeText(this, "Permission denied", Toast.LENGTH_SHORT).show();
|
||||
Toast.makeText(this, "カメラの権限は必須です.", Toast.LENGTH_LONG).show();
|
||||
finish(); // Exit app
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void initializeApp() {
|
||||
Log.d("Init", "Initializing app");
|
||||
// Set feature switch override to default value
|
||||
|
|
15
app/src/main/res/drawable/ic_launcher_temp_foreground.xml
Normal file
|
@ -0,0 +1,15 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24"
|
||||
android:tint="#5F4769">
|
||||
<group android:scaleX="0.377"
|
||||
android:scaleY="0.377"
|
||||
android:translateX="7.476"
|
||||
android:translateY="7.476">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M7,3H4v3H2V1h5V3zM22,6V1h-5v2h3v3H22zM7,21H4v-3H2v5h5V21zM20,18v3h-3v2h5v-5H20zM19,18c0,1.1 -0.9,2 -2,2H7c-1.1,0 -2,-0.9 -2,-2V6c0,-1.1 0.9,-2 2,-2h10c1.1,0 2,0.9 2,2V18zM15,8H9v2h6V8zM15,11H9v2h6V11zM15,14H9v2h6V14z"/>
|
||||
</group>
|
||||
</vector>
|
5
app/src/main/res/mipmap-anydpi-v26/ic_launcher_temp.xml
Normal file
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@color/ic_launcher_temp_background"/>
|
||||
<foreground android:drawable="@drawable/ic_launcher_temp_foreground"/>
|
||||
</adaptive-icon>
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@color/ic_launcher_temp_background"/>
|
||||
<foreground android:drawable="@drawable/ic_launcher_temp_foreground"/>
|
||||
</adaptive-icon>
|
BIN
app/src/main/res/mipmap-hdpi/ic_launcher_temp.webp
Normal file
After Width: | Height: | Size: 768 B |
BIN
app/src/main/res/mipmap-hdpi/ic_launcher_temp_round.webp
Normal file
After Width: | Height: | Size: 2.3 KiB |
BIN
app/src/main/res/mipmap-mdpi/ic_launcher_temp.webp
Normal file
After Width: | Height: | Size: 630 B |
BIN
app/src/main/res/mipmap-mdpi/ic_launcher_temp_round.webp
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
app/src/main/res/mipmap-xhdpi/ic_launcher_temp.webp
Normal file
After Width: | Height: | Size: 1004 B |
BIN
app/src/main/res/mipmap-xhdpi/ic_launcher_temp_round.webp
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher_temp.webp
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher_temp_round.webp
Normal file
After Width: | Height: | Size: 4.8 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher_temp.webp
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher_temp_round.webp
Normal file
After Width: | Height: | Size: 6.9 KiB |
4
app/src/main/res/values/ic_launcher_temp_background.xml
Normal file
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="ic_launcher_temp_background">#A386EB</color>
|
||||
</resources>
|
|
@ -1,6 +1,8 @@
|
|||
package one.nem.lacerta.component.scanner;
|
||||
|
||||
import android.Manifest;
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.os.Bundle;
|
||||
|
@ -11,6 +13,8 @@ import android.widget.Toast;
|
|||
|
||||
import androidx.activity.EdgeToEdge;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.core.app.ActivityCompat;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.core.graphics.Insets;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.core.view.WindowInsetsCompat;
|
||||
|
@ -92,6 +96,14 @@ public class ScannerManagerActivity extends AppCompatActivity {
|
|||
return insets;
|
||||
});
|
||||
|
||||
|
||||
|
||||
if (ContextCompat.checkSelfPermission(this, Manifest.permission.CAMERA)
|
||||
!= PackageManager.PERMISSION_GRANTED) {
|
||||
ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.CAMERA}, 1); // TODO-rca: リクエストコードを定数にする
|
||||
}
|
||||
|
||||
|
||||
MaterialToolbar toolbar = findViewById(R.id.top_toolbar);
|
||||
setSupportActionBar(toolbar);
|
||||
Objects.requireNonNull(getSupportActionBar()).setDisplayHomeAsUpEnabled(true);
|
||||
|
@ -116,11 +128,12 @@ public class ScannerManagerActivity extends AppCompatActivity {
|
|||
Toast.makeText(this, "保存処理", Toast.LENGTH_SHORT).show();
|
||||
saveNewDocument();
|
||||
return true;
|
||||
} else if (item.getItemId() == R.id.action_insert_exist) {
|
||||
// 既存ドキュメントに挿入
|
||||
Toast.makeText(this, "Work in progress", Toast.LENGTH_SHORT).show();
|
||||
insertToExistDocument();
|
||||
return true;
|
||||
// }
|
||||
// else if (item.getItemId() == R.id.action_insert_exist) {
|
||||
// // 既存ドキュメントに挿入
|
||||
// Toast.makeText(this, "Work in progress", Toast.LENGTH_SHORT).show();
|
||||
// insertToExistDocument();
|
||||
// return true;
|
||||
} else if (item.getItemId() == android.R.id.home) {
|
||||
finish();
|
||||
return true;
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
android:icon="@drawable/save_24px"
|
||||
android:title="Save"
|
||||
app:showAsAction="ifRoom"/>
|
||||
<item
|
||||
android:id="@+id/action_insert_exist"
|
||||
android:icon="@drawable/ic_baseline_add_24"
|
||||
android:title="Save"
|
||||
app:showAsAction="ifRoom"/>
|
||||
<!-- <item-->
|
||||
<!-- android:id="@+id/action_insert_exist"-->
|
||||
<!-- android:icon="@drawable/description_24px"-->
|
||||
<!-- android:title="Insert"-->
|
||||
<!-- app:showAsAction="ifRoom"/>-->
|
||||
</menu>
|
|
@ -4,6 +4,8 @@ public class FeatureSwitch {
|
|||
|
||||
public static class Meta {
|
||||
public static boolean canOverrideSwitch = false;
|
||||
|
||||
public static boolean disableDynamicColor = false;
|
||||
}
|
||||
|
||||
public static class RecyclerView {
|
||||
|
|