diff --git a/Generator/.idea/appInsightsSettings.xml b/Generator/.idea/appInsightsSettings.xml new file mode 100644 index 0000000..371f2e2 --- /dev/null +++ b/Generator/.idea/appInsightsSettings.xml @@ -0,0 +1,26 @@ + + + + + + \ No newline at end of file diff --git a/Generator/.idea/vcs.xml b/Generator/.idea/vcs.xml new file mode 100644 index 0000000..6c0b863 --- /dev/null +++ b/Generator/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Generator/app/build.gradle.kts b/Generator/app/build.gradle.kts index e83fc65..2209bcf 100644 --- a/Generator/app/build.gradle.kts +++ b/Generator/app/build.gradle.kts @@ -41,6 +41,10 @@ android { } dependencies { + implementation(libs.appcompat) + implementation(libs.material) + implementation(libs.activity) + implementation(libs.constraintlayout) dependencies { coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:2.1.5") implementation("androidx.multidex:multidex:2.0.1") diff --git a/Generator/app/src/main/AndroidManifest.xml b/Generator/app/src/main/AndroidManifest.xml index 09249c2..350c291 100644 --- a/Generator/app/src/main/AndroidManifest.xml +++ b/Generator/app/src/main/AndroidManifest.xml @@ -8,10 +8,13 @@ android:fullBackupContent="@xml/backup_rules" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" + android:largeHeap="true" android:roundIcon="@drawable/ic_launcher_background" android:supportsRtl="true" - android:largeHeap="true" android:theme="@style/Theme.Generator"> + diff --git a/Generator/app/src/main/java/com/example/generator/StartingPreview.java b/Generator/app/src/main/java/com/example/generator/StartingPreview.java new file mode 100644 index 0000000..1a0835f --- /dev/null +++ b/Generator/app/src/main/java/com/example/generator/StartingPreview.java @@ -0,0 +1,44 @@ +package com.example.generator; + +import android.graphics.Bitmap; +import android.graphics.BitmapFactory; +import android.os.Bundle; +import android.util.Base64; +import android.util.Log; +import android.widget.ImageView; + +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 StartingPreview extends AppCompatActivity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + EdgeToEdge.enable(this); + setContentView(R.layout.activity_starting_preview); + 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; + }); + + ImageView imageView2 = findViewById(R.id.imageView2); + String imageBase64 = getIntent().getStringExtra("EXTRA_IMAGE_BASE64"); + + if (imageBase64 != null && !imageBase64.isEmpty()) { + try { + byte[] decodedString = Base64.decode(imageBase64, Base64.DEFAULT); + Bitmap decodedByte = BitmapFactory.decodeByteArray(decodedString, 0, decodedString.length); + imageView2.setImageBitmap(decodedByte); + } catch (Exception e) { + e.printStackTrace(); + Log.e("PreviewError", "Failed to decode base64 image asset"); + } + } + + } +} \ No newline at end of file diff --git a/Generator/app/src/main/java/com/example/generator/makeActivity.java b/Generator/app/src/main/java/com/example/generator/makeActivity.java index c20d771..8335490 100644 --- a/Generator/app/src/main/java/com/example/generator/makeActivity.java +++ b/Generator/app/src/main/java/com/example/generator/makeActivity.java @@ -71,17 +71,20 @@ public class makeActivity extends AppCompatActivity { nextButton.setOnClickListener((v) -> { if (numPosEdit.getText().toString().trim().isEmpty()) { Toast.makeText(this, "choose a number", Toast.LENGTH_SHORT).show(); - } else + } else { numPos = Integer.parseInt(numPosEdit.getText().toString().trim()); if (Objects.equals(Base64img, "")) { - Toast.makeText(this, "choose a image", Toast.LENGTH_SHORT).show(); - Log.d("test", Base64img); - } else { - Data.setNumPos(numPos); - Data.setBase64(Base64img); - Log.d("Pos", Data.getNumPos()); + Toast.makeText(this, "choose a image", Toast.LENGTH_SHORT).show(); + Log.d("test", Base64img); + } else { + Data.setNumPos(numPos); + Data.setBase64(Base64img); + Log.d("Pos", Data.getNumPos()); + Intent intent = new Intent(this, StartingPreview.class); + intent.putExtra("EXTRA_IMAGE_BASE64", Base64img); + startActivity(intent); } - + } }); chooseButton.setOnClickListener((v) -> { diff --git a/Generator/app/src/main/res/layout/activity_starting_preview.xml b/Generator/app/src/main/res/layout/activity_starting_preview.xml new file mode 100644 index 0000000..107d7c6 --- /dev/null +++ b/Generator/app/src/main/res/layout/activity_starting_preview.xml @@ -0,0 +1,180 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + +