diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index a5ae62e6..1680ef09 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -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" diff --git a/app/src/main/ic_launcher_temp-playstore.png b/app/src/main/ic_launcher_temp-playstore.png new file mode 100644 index 00000000..f83a7d3a Binary files /dev/null and b/app/src/main/ic_launcher_temp-playstore.png differ diff --git a/app/src/main/java/one/nem/lacerta/LacertaApplication.java b/app/src/main/java/one/nem/lacerta/LacertaApplication.java index 448349b5..78dae9ae 100644 --- a/app/src/main/java/one/nem/lacerta/LacertaApplication.java +++ b/app/src/main/java/one/nem/lacerta/LacertaApplication.java @@ -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."); } diff --git a/app/src/main/java/one/nem/lacerta/MainActivity.java b/app/src/main/java/one/nem/lacerta/MainActivity.java index f74b20a7..d7fac694 100644 --- a/app/src/main/java/one/nem/lacerta/MainActivity.java +++ b/app/src/main/java/one/nem/lacerta/MainActivity.java @@ -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 diff --git a/app/src/main/res/drawable/ic_launcher_temp_foreground.xml b/app/src/main/res/drawable/ic_launcher_temp_foreground.xml new file mode 100644 index 00000000..3cf3c7d5 --- /dev/null +++ b/app/src/main/res/drawable/ic_launcher_temp_foreground.xml @@ -0,0 +1,15 @@ + + + + + diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_temp.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_temp.xml new file mode 100644 index 00000000..08dacb68 --- /dev/null +++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_temp.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_temp_round.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_temp_round.xml new file mode 100644 index 00000000..08dacb68 --- /dev/null +++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_temp_round.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_temp.webp b/app/src/main/res/mipmap-hdpi/ic_launcher_temp.webp new file mode 100644 index 00000000..83854c1d Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher_temp.webp differ diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_temp_round.webp b/app/src/main/res/mipmap-hdpi/ic_launcher_temp_round.webp new file mode 100644 index 00000000..6dbf2e77 Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher_temp_round.webp differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_temp.webp b/app/src/main/res/mipmap-mdpi/ic_launcher_temp.webp new file mode 100644 index 00000000..9b879b55 Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher_temp.webp differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_temp_round.webp b/app/src/main/res/mipmap-mdpi/ic_launcher_temp_round.webp new file mode 100644 index 00000000..dfd24231 Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher_temp_round.webp differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_temp.webp b/app/src/main/res/mipmap-xhdpi/ic_launcher_temp.webp new file mode 100644 index 00000000..b4efa44e Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher_temp.webp differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_temp_round.webp b/app/src/main/res/mipmap-xhdpi/ic_launcher_temp_round.webp new file mode 100644 index 00000000..bcb26698 Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher_temp_round.webp differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher_temp.webp b/app/src/main/res/mipmap-xxhdpi/ic_launcher_temp.webp new file mode 100644 index 00000000..ccd89e0a Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher_temp.webp differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher_temp_round.webp b/app/src/main/res/mipmap-xxhdpi/ic_launcher_temp_round.webp new file mode 100644 index 00000000..f4b04e3a Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher_temp_round.webp differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_temp.webp b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_temp.webp new file mode 100644 index 00000000..91502f73 Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_temp.webp differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_temp_round.webp b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_temp_round.webp new file mode 100644 index 00000000..9d824496 Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_temp_round.webp differ diff --git a/app/src/main/res/values/ic_launcher_temp_background.xml b/app/src/main/res/values/ic_launcher_temp_background.xml new file mode 100644 index 00000000..94a6cd1e --- /dev/null +++ b/app/src/main/res/values/ic_launcher_temp_background.xml @@ -0,0 +1,4 @@ + + + #A386EB + \ No newline at end of file diff --git a/component/scanner/src/main/java/one/nem/lacerta/component/scanner/ScannerManagerActivity.java b/component/scanner/src/main/java/one/nem/lacerta/component/scanner/ScannerManagerActivity.java index dcfc89fa..80cf6ae5 100644 --- a/component/scanner/src/main/java/one/nem/lacerta/component/scanner/ScannerManagerActivity.java +++ b/component/scanner/src/main/java/one/nem/lacerta/component/scanner/ScannerManagerActivity.java @@ -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; diff --git a/component/scanner/src/main/res/menu/scanner_result_toolbar.xml b/component/scanner/src/main/res/menu/scanner_result_toolbar.xml index 3321aadc..dc815d7b 100644 --- a/component/scanner/src/main/res/menu/scanner_result_toolbar.xml +++ b/component/scanner/src/main/res/menu/scanner_result_toolbar.xml @@ -6,9 +6,9 @@ android:icon="@drawable/save_24px" android:title="Save" app:showAsAction="ifRoom"/> - + + + + + \ No newline at end of file diff --git a/utils/src/main/java/one/nem/lacerta/utils/FeatureSwitch.java b/utils/src/main/java/one/nem/lacerta/utils/FeatureSwitch.java index 5c808841..aae02397 100644 --- a/utils/src/main/java/one/nem/lacerta/utils/FeatureSwitch.java +++ b/utils/src/main/java/one/nem/lacerta/utils/FeatureSwitch.java @@ -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 {