Merge pull request #113 from lacerta-doc/submit_jan23

23日に提出した状態に追従
This commit is contained in:
ろむねこ 2024-01-24 12:37:26 +09:00 committed by GitHub
commit ab5a8bfa87
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
21 changed files with 78 additions and 12 deletions

View File

@ -17,7 +17,7 @@
android:allowBackup="true" android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules" android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules" android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher" android:icon="@mipmap/ic_launcher_temp_round"
android:name=".LacertaApplication" android:name=".LacertaApplication"
android:label="@string/app_name" android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round" android:roundIcon="@mipmap/ic_launcher_round"

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

View File

@ -6,6 +6,7 @@ import android.util.Log;
import com.google.android.material.color.DynamicColors; import com.google.android.material.color.DynamicColors;
import dagger.hilt.android.HiltAndroidApp; import dagger.hilt.android.HiltAndroidApp;
import one.nem.lacerta.utils.FeatureSwitch;
@HiltAndroidApp @HiltAndroidApp
public class LacertaApplication extends Application { public class LacertaApplication extends Application {
@ -15,7 +16,11 @@ public class LacertaApplication extends Application {
if (DynamicColors.isDynamicColorAvailable()) { if (DynamicColors.isDynamicColorAvailable()) {
Log.d("DynamicColors", "DynamicColors is available. Applying to activities..."); Log.d("DynamicColors", "DynamicColors is available. Applying to activities...");
if (FeatureSwitch.Meta.disableDynamicColor) {
Log.d("DynamicColors", "DynamicColors is disabled by FeatureSwitch.");
} else {
DynamicColors.applyToActivitiesIfAvailable(this); DynamicColors.applyToActivitiesIfAvailable(this);
}
} else { } else {
Log.d("DynamicColors", "DynamicColors is not available."); Log.d("DynamicColors", "DynamicColors is not available.");
} }

View File

@ -1,5 +1,6 @@
package one.nem.lacerta; package one.nem.lacerta;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar; import androidx.appcompat.widget.Toolbar;
import androidx.core.content.ContextCompat; import androidx.core.content.ContextCompat;
@ -11,6 +12,7 @@ import androidx.navigation.fragment.NavHostFragment;
import androidx.navigation.ui.NavigationUI; import androidx.navigation.ui.NavigationUI;
import android.content.Intent; import android.content.Intent;
import android.content.pm.PackageManager;
import android.graphics.Color; import android.graphics.Color;
import android.os.Bundle; import android.os.Bundle;
import android.util.Log; 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() { private void initializeApp() {
Log.d("Init", "Initializing app"); Log.d("Init", "Initializing app");
// Set feature switch override to default value // Set feature switch override to default value

View 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>

View 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>

View 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>

Binary file not shown.

After

Width:  |  Height:  |  Size: 768 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 630 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1004 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="ic_launcher_temp_background">#A386EB</color>
</resources>

View File

@ -1,6 +1,8 @@
package one.nem.lacerta.component.scanner; package one.nem.lacerta.component.scanner;
import android.Manifest;
import android.app.ProgressDialog; import android.app.ProgressDialog;
import android.content.pm.PackageManager;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.BitmapFactory; import android.graphics.BitmapFactory;
import android.os.Bundle; import android.os.Bundle;
@ -11,6 +13,8 @@ import android.widget.Toast;
import androidx.activity.EdgeToEdge; import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import androidx.core.graphics.Insets; import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat; import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat; import androidx.core.view.WindowInsetsCompat;
@ -92,6 +96,14 @@ public class ScannerManagerActivity extends AppCompatActivity {
return insets; 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); MaterialToolbar toolbar = findViewById(R.id.top_toolbar);
setSupportActionBar(toolbar); setSupportActionBar(toolbar);
Objects.requireNonNull(getSupportActionBar()).setDisplayHomeAsUpEnabled(true); Objects.requireNonNull(getSupportActionBar()).setDisplayHomeAsUpEnabled(true);
@ -116,11 +128,12 @@ public class ScannerManagerActivity extends AppCompatActivity {
Toast.makeText(this, "保存処理", Toast.LENGTH_SHORT).show(); Toast.makeText(this, "保存処理", Toast.LENGTH_SHORT).show();
saveNewDocument(); saveNewDocument();
return true; return true;
} else if (item.getItemId() == R.id.action_insert_exist) { // }
// 既存ドキュメントに挿入 // else if (item.getItemId() == R.id.action_insert_exist) {
Toast.makeText(this, "Work in progress", Toast.LENGTH_SHORT).show(); // // 既存ドキュメントに挿入
insertToExistDocument(); // Toast.makeText(this, "Work in progress", Toast.LENGTH_SHORT).show();
return true; // insertToExistDocument();
// return true;
} else if (item.getItemId() == android.R.id.home) { } else if (item.getItemId() == android.R.id.home) {
finish(); finish();
return true; return true;

View File

@ -6,9 +6,9 @@
android:icon="@drawable/save_24px" android:icon="@drawable/save_24px"
android:title="Save" android:title="Save"
app:showAsAction="ifRoom"/> app:showAsAction="ifRoom"/>
<item <!-- <item-->
android:id="@+id/action_insert_exist" <!-- android:id="@+id/action_insert_exist"-->
android:icon="@drawable/ic_baseline_add_24" <!-- android:icon="@drawable/description_24px"-->
android:title="Save" <!-- android:title="Insert"-->
app:showAsAction="ifRoom"/> <!-- app:showAsAction="ifRoom"/>-->
</menu> </menu>

View File

@ -4,6 +4,8 @@ public class FeatureSwitch {
public static class Meta { public static class Meta {
public static boolean canOverrideSwitch = false; public static boolean canOverrideSwitch = false;
public static boolean disableDynamicColor = false;
} }
public static class RecyclerView { public static class RecyclerView {