Skip to content

Commit

Permalink
Added splash screen, Fixed #2
Browse files Browse the repository at this point in the history
  • Loading branch information
mrgames13 committed Jul 26, 2019
1 parent 73f8248 commit 1456ce1
Show file tree
Hide file tree
Showing 16 changed files with 199 additions and 25 deletions.
Binary file modified .idea/caches/build_file_checksums.ser
Binary file not shown.
Binary file modified .idea/caches/gradle_models.ser
Binary file not shown.
116 changes: 116 additions & 0 deletions .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ android {
applicationId "com.mrgames13.jimdo.colorconverter"
minSdkVersion 16
targetSdkVersion 28
versionCode 118
versionName "1.1.8"
versionCode 119
versionName "1.1.9"
vectorDrawables.useSupportLibrary = true
}
buildTypes {
Expand Down
4 changes: 2 additions & 2 deletions base-feature/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ android {
defaultConfig {
minSdkVersion 16
targetSdkVersion 28
versionCode 118
versionName "1.1.8"
versionCode 119
versionName "1.1.9"
vectorDrawables.useSupportLibrary = true
multiDexEnabled true
}
Expand Down
3 changes: 2 additions & 1 deletion base-feature/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CAMERA" />

<application
android:allowBackup="true"
Expand All @@ -19,7 +20,7 @@
<activity
android:name=".App.MainActivity"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar"
android:theme="@style/SplashTheme"
android:windowSoftInputMode="adjustPan">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ public class ImageActivity extends AppCompatActivity implements BSImagePicker.On
//Konstanten
private final int REQ_CAMERA_CHOOSER = 10002;
private final int REQ_PERMISSION_READ_EXTERNAL_STORAGE = 10003;
private final int REQ_PERMISSION_CAMERA = 10004;

//Variablen als Objekte
private Resources res;
Expand Down Expand Up @@ -403,23 +404,29 @@ private void chooseImageFromGallery() {
}

private void chooseImageFromCamera() {
Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
takePictureIntent.addFlags(FLAG_GRANT_READ_URI_PERMISSION);
takePictureIntent.addFlags(FLAG_GRANT_WRITE_URI_PERMISSION);
if (takePictureIntent.resolveActivity(getPackageManager()) != null) {
try {
File photoFile = createImageFile();
if (photoFile != null) {
Uri photoURI;
if (Build.VERSION.SDK_INT >= 24) {
photoURI = FileProvider.getUriForFile(this, "com.mrgames13.jimdo.colorconverter.fileprovider", photoFile);
} else {
photoURI = Uri.fromFile(photoFile);
if (ActivityCompat.checkSelfPermission(ImageActivity.this, Manifest.permission.CAMERA) == PackageManager.PERMISSION_GRANTED) {
Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
takePictureIntent.addFlags(FLAG_GRANT_READ_URI_PERMISSION);
takePictureIntent.addFlags(FLAG_GRANT_WRITE_URI_PERMISSION);
if (takePictureIntent.resolveActivity(getPackageManager()) != null) {
try {
File photoFile = createImageFile();
if (photoFile != null) {
Uri photoURI;
if (Build.VERSION.SDK_INT >= 24) {
photoURI = FileProvider.getUriForFile(this, "com.mrgames13.jimdo.colorconverter.fileprovider", photoFile);
} else {
photoURI = Uri.fromFile(photoFile);
}
takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, photoURI);
startActivityForResult(takePictureIntent, REQ_CAMERA_CHOOSER);
}
takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, photoURI);
startActivityForResult(takePictureIntent, REQ_CAMERA_CHOOSER);
} catch (Exception e) {
e.printStackTrace();
}
} catch (Exception e) {}
}
} else {
ActivityCompat.requestPermissions(ImageActivity.this, new String[]{Manifest.permission.CAMERA}, REQ_PERMISSION_CAMERA);
}
}

Expand Down Expand Up @@ -494,7 +501,11 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);

if (requestCode == REQ_PERMISSION_READ_EXTERNAL_STORAGE && grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_DENIED) finish();
if(requestCode == REQ_PERMISSION_CAMERA && grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
chooseImageFromCamera();
} else if(requestCode == REQ_PERMISSION_READ_EXTERNAL_STORAGE && grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_DENIED) {
finish();
}
}

private void setBitmapToImageView() {
Expand Down
Binary file added base-feature/src/main/res/drawable/app_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions base-feature/src/main/res/drawable/splash.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/white" />
<item
android:width="200dp"
android:height="200dp"
android:drawable="@drawable/app_icon"
android:gravity="center"/>
</layer-list>
3 changes: 2 additions & 1 deletion base-feature/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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:background="@color/white"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context=".App.MainActivity">

<androidx.appcompat.widget.Toolbar
Expand Down
8 changes: 8 additions & 0 deletions base-feature/src/main/res/values-v19/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,12 @@
<item name="android:windowTranslucentStatus">true</item>
<item name="android:windowContentOverlay">@null</item>
</style>

<style name="SplashTheme" parent="AppTheme.NoActionBar">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="android:windowTranslucentStatus">true</item>
<item name="android:textColor">@android:color/darker_gray</item>
</style>
</resources>
10 changes: 10 additions & 0 deletions base-feature/src/main/res/values-v21/styles.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="SplashTheme" parent="AppTheme.NoActionBar">
<item name="android:statusBarColor">@color/colorPrimaryDark</item>
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="android:windowTranslucentStatus">true</item>
</style>
</resources>
11 changes: 11 additions & 0 deletions base-feature/src/main/res/values-v23/styles.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="SplashTheme" parent="AppTheme.NoActionBar">
<item name="android:windowBackground">@drawable/splash</item>
<item name="android:statusBarColor">@color/colorPrimaryDark</item>
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="android:windowTranslucentStatus">true</item>
</style>
</resources>
7 changes: 7 additions & 0 deletions base-feature/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,11 @@
<style name="showCaseView.text.title" parent="showCaseView.text">
<item name="android:textStyle">bold</item>
</style>

<style name="SplashTheme" parent="AppTheme.NoActionBar">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="android:textColor">@android:color/darker_gray</item>
</style>
</resources>
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ buildscript {
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.0-beta04'
classpath 'com.android.tools.build:gradle:3.5.0-rc01'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
4 changes: 2 additions & 2 deletions instantapp/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ android {
defaultConfig {
minSdkVersion 16
targetSdkVersion 28
versionCode 118
versionName "1.1.8"
versionCode 119
versionName "1.1.9"
vectorDrawables.useSupportLibrary = true
}
buildTypes {
Expand Down

0 comments on commit 1456ce1

Please sign in to comment.