Skip to content

Commit bb5f369

Browse files
committed
Create module for the cute qr code
1 parent 978874a commit bb5f369

File tree

23 files changed

+334
-123
lines changed

23 files changed

+334
-123
lines changed

.idea/gradle.xml

+4-9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

+14-16
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules.xml

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Qart.iml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<content url="file://$MODULE_DIR$">
1414
<excludeFolder url="file://$MODULE_DIR$/.gradle" />
1515
</content>
16-
<orderEntry type="jdk" jdkName="1.8" jdkType="JavaSDK" />
16+
<orderEntry type="inheritedJdk" />
1717
<orderEntry type="sourceFolder" forTests="false" />
1818
</component>
1919
</module>

app/app.iml

+3-3
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@
8888
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/apk_list" />
8989
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" />
9090
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/build-info" />
91-
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/builds" />
9291
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/bundle_manifest" />
9392
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/check_manifest_result" />
9493
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/compatible_screen_manifest" />
@@ -144,6 +143,7 @@
144143
<orderEntry type="library" name="Gradle: androidx.cursoradapter:cursoradapter:1.0.0@aar" level="project" />
145144
<orderEntry type="library" name="Gradle: androidx.lifecycle:lifecycle-livedata:2.0.0@aar" level="project" />
146145
<orderEntry type="library" name="Gradle: androidx.customview:customview:1.0.0@aar" level="project" />
146+
<orderEntry type="library" name="Gradle: androidx.constraintlayout:constraintlayout:1.1.3@aar" level="project" />
147147
<orderEntry type="library" name="Gradle: androidx.vectordrawable:vectordrawable-animated:1.0.0@aar" level="project" />
148148
<orderEntry type="library" name="Gradle: androidx.annotation:annotation:1.0.1@jar" level="project" />
149149
<orderEntry type="library" name="Gradle: androidx.asynclayoutinflater:asynclayoutinflater:1.0.0@aar" level="project" />
@@ -154,6 +154,7 @@
154154
<orderEntry type="library" name="Gradle: androidx.legacy:legacy-support-core-utils:1.0.0@aar" level="project" />
155155
<orderEntry type="library" name="Gradle: androidx.print:print:1.0.0@aar" level="project" />
156156
<orderEntry type="library" name="Gradle: androidx.versionedparcelable:versionedparcelable:1.0.0@aar" level="project" />
157+
<orderEntry type="library" name="Gradle: androidx.constraintlayout:constraintlayout-solver:1.1.3@jar" level="project" />
157158
<orderEntry type="library" name="Gradle: com.journeyapps:zxing-android-embedded:3.3.0@aar" level="project" />
158159
<orderEntry type="library" name="Gradle: com.google.zxing:core:3.3.3@jar" level="project" />
159160
<orderEntry type="library" name="Gradle: androidx.lifecycle:lifecycle-viewmodel:2.0.0@aar" level="project" />
@@ -168,8 +169,7 @@
168169
<orderEntry type="library" name="Gradle: androidx.core:core:1.0.1@aar" level="project" />
169170
<orderEntry type="library" name="Gradle: androidx.collection:collection:1.0.0@jar" level="project" />
170171
<orderEntry type="module" module-name="onboarder" />
171-
<orderEntry type="module" module-name="cropper" />
172-
<orderEntry type="module" module-name="onboarder" />
172+
<orderEntry type="module" module-name="cuteqr" />
173173
<orderEntry type="module" module-name="cropper" />
174174
</component>
175175
</module>

app/build.gradle

+2
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,6 @@ dependencies {
5151
implementation 'com.aurelhubert:ahbottomnavigation:1.5.1'
5252
implementation project(':cropper')
5353
implementation project(':onboarder')
54+
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
55+
implementation project(':cuteqr')
5456
}

app/src/main/AndroidManifest.xml

+3
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323
<activity
2424
android:name=".IntroActivity"
2525
android:noHistory="true"></activity>
26+
27+
<activity android:name="io.github.scola.TestActivity" />
28+
2629
<activity
2730
android:name=".QRCodeResultActivity"
2831
android:label="@string/qr_result"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
package io.github.scola;
2+
3+
import android.graphics.Bitmap;
4+
import android.graphics.BitmapFactory;
5+
import android.graphics.Color;
6+
import android.os.AsyncTask;
7+
import android.os.Bundle;
8+
import android.view.View;
9+
import android.widget.ImageView;
10+
11+
import com.akelius.cuteqr.CuteR;
12+
13+
import androidx.annotation.Nullable;
14+
import androidx.appcompat.app.AppCompatActivity;
15+
import io.github.scola.qart.R;
16+
17+
public class TestActivity extends AppCompatActivity {
18+
19+
20+
@Override
21+
protected void onCreate(@Nullable Bundle savedInstanceState) {
22+
super.onCreate(savedInstanceState);
23+
24+
25+
setContentView(R.layout.activity_test);
26+
27+
convert();
28+
findViewById(R.id.convertBtn).setOnClickListener(new View.OnClickListener() {
29+
@Override
30+
public void onClick(View v) {
31+
32+
convert();
33+
34+
}
35+
});
36+
37+
38+
findViewById(R.id.clearBtn).setOnClickListener(new View.OnClickListener() {
39+
@Override
40+
public void onClick(View v) {
41+
((ImageView) findViewById(R.id.imageView)).setImageDrawable(null);
42+
}
43+
});
44+
}
45+
46+
private void convert() {
47+
Bitmap icon = BitmapFactory.decodeResource(getResources(), R.drawable.modigliani);
48+
49+
startConvert(icon,
50+
"Let's " +
51+
"you wanted to dream ",
52+
((ImageView) findViewById(R.id.imageView)));
53+
}
54+
55+
private void startConvert(final Bitmap mCropImage, final String qrText, final ImageView target) {
56+
final int color = Color.BLACK;
57+
final boolean colorful = false;
58+
59+
60+
new AsyncTask<Void, Void, Bitmap>() {
61+
@Override
62+
protected Bitmap doInBackground(Void... voids) {
63+
64+
return CuteR.ProductLogo(mCropImage, qrText, colorful, color);
65+
// return CuteR.ProductNormal(qrText, colorful, color);
66+
}
67+
68+
@Override
69+
protected void onPostExecute(Bitmap post) {
70+
super.onPostExecute(post);
71+
target.setImageBitmap(post);
72+
}
73+
74+
@Override
75+
protected void onPreExecute() {
76+
super.onPreExecute();
77+
}
78+
}.execute();
79+
}
80+
81+
}

app/src/main/java/io/github/scola/qart/MainActivity.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
import android.widget.ProgressBar;
4040
import android.widget.Toast;
4141

42+
import com.akelius.cuteqr.CuteR;
4243
import com.aurelhubert.ahbottomnavigation.AHBottomNavigation;
4344
import com.aurelhubert.ahbottomnavigation.AHBottomNavigationItem;
4445
import com.edmodo.cropper.CropImageView;
@@ -60,7 +61,6 @@
6061
import androidx.core.app.ActivityCompat;
6162
import androidx.core.content.ContextCompat;
6263
import fr.castorflex.android.smoothprogressbar.SmoothProgressDrawable;
63-
import io.github.scola.cuteqr.CuteR;
6464
import io.github.scola.gif.AnimatedGifEncoder;
6565
import pl.droidsonroids.gif.GifDrawable;
6666

@@ -697,7 +697,7 @@ protected void onActivityResult(final int requestCode, final int resultCode, fin
697697
pickPhoto.setImageDrawable(mGifDrawable);
698698
mOriginBitmap = mGifDrawable.seekToFrameAndGet(0);
699699

700-
} else {
700+
} else {//*//
701701
mGif = false;
702702
mOriginBitmap = getBitmapFromUri(data.getData());
703703
convertOrientation(mOriginBitmap, data.getData());

app/src/main/java/io/github/scola/qart/QRCodeResultActivity.java

+2-4
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import android.content.DialogInterface;
99
import android.content.Intent;
1010
import android.content.pm.PackageManager;
11-
import android.graphics.Color;
1211
import android.net.Uri;
1312
import android.os.Build;
1413
import android.os.Bundle;
@@ -22,20 +21,19 @@
2221
import android.widget.TextView;
2322
import android.widget.Toast;
2423

24+
import com.akelius.cuteqr.CuteR;
25+
2526
import org.json.JSONException;
2627
import org.json.JSONObject;
2728

2829
import java.io.File;
2930
import java.io.IOException;
30-
import java.text.SimpleDateFormat;
31-
import java.util.Date;
3231
import java.util.regex.Matcher;
3332

3433
import androidx.appcompat.app.AlertDialog;
3534
import androidx.appcompat.app.AppCompatActivity;
3635
import androidx.appcompat.widget.Toolbar;
3736
import androidx.core.app.ActivityCompat;
38-
import io.github.scola.cuteqr.CuteR;
3937

4038
public class QRCodeResultActivity extends AppCompatActivity {
4139
private final static String TAG = "QRCodeResultActivity";
39.9 KB
Binary file not shown.
+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
3+
xmlns:app="http://schemas.android.com/apk/res-auto"
4+
xmlns:tools="http://schemas.android.com/tools"
5+
android:layout_width="match_parent"
6+
android:layout_height="match_parent"
7+
android:orientation="vertical">
8+
9+
<Button
10+
android:id="@+id/convertBtn"
11+
android:layout_width="wrap_content"
12+
android:layout_height="wrap_content"
13+
android:layout_marginStart="16dp"
14+
android:layout_marginTop="16dp"
15+
android:text="Convert to QR"
16+
app:layout_constraintStart_toStartOf="parent"
17+
app:layout_constraintTop_toTopOf="parent" />
18+
19+
<Button
20+
android:id="@+id/clearBtn"
21+
android:layout_width="wrap_content"
22+
android:layout_height="wrap_content"
23+
android:layout_marginTop="16dp"
24+
android:layout_marginEnd="34dp"
25+
android:text="Clear"
26+
app:layout_constraintEnd_toEndOf="parent"
27+
app:layout_constraintTop_toTopOf="parent" />
28+
29+
<ImageView
30+
android:id="@+id/imageView"
31+
android:layout_width="wrap_content"
32+
android:layout_height="wrap_content"
33+
android:layout_marginBottom="8dp"
34+
app:layout_constraintBottom_toBottomOf="parent"
35+
app:layout_constraintEnd_toEndOf="parent"
36+
app:layout_constraintHorizontal_bias="0.522"
37+
app:layout_constraintStart_toStartOf="parent"
38+
app:layout_constraintTop_toTopOf="parent"
39+
tools:srcCompat="@tools:sample/avatars" />
40+
</androidx.constraintlayout.widget.ConstraintLayout>

cropper/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
apply plugin: 'android-library'
1+
apply plugin: 'com.android.library'
22
apply plugin: 'maven'
33
apply plugin: 'signing'
44

cuteqr/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

cuteqr/build.gradle

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
apply plugin: 'com.android.library'
2+
3+
android {
4+
compileSdkVersion 28
5+
6+
7+
8+
defaultConfig {
9+
minSdkVersion 16
10+
targetSdkVersion 28
11+
versionCode 1
12+
versionName "1.0"
13+
14+
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
15+
16+
}
17+
18+
buildTypes {
19+
release {
20+
minifyEnabled false
21+
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
22+
}
23+
}
24+
25+
}
26+
27+
dependencies {
28+
implementation fileTree(dir: 'libs', include: ['*.jar'])
29+
30+
implementation 'com.android.support:appcompat-v7:28.0.0'
31+
api 'com.google.zxing:core:3.3.3'
32+
testImplementation 'junit:junit:4.12'
33+
androidTestImplementation 'com.android.support.test:runner:1.0.2'
34+
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
35+
}

0 commit comments

Comments
 (0)