Skip to content

Commit 19d7c57

Browse files
authored
Merge pull request #62 from StringCare/develop
Develop
2 parents fc942fb + 01088bb commit 19d7c57

File tree

17 files changed

+323
-32
lines changed

17 files changed

+323
-32
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010

1111
#### [Implementation](https://github.com/StringCare/AndroidLibrary/wiki/Implementation)
1212

13-
#### [Usage](https://github.com/StringCare/AndroidLibrary/wiki/Usage)
13+
#### [Strings Usage](https://github.com/StringCare/AndroidLibrary/wiki/Strings-Usage)
14+
15+
#### [Assets Usage](https://github.com/StringCare/AndroidLibrary/wiki/Assets-Usage)
1416

1517
#### [Configuration](https://github.com/StringCare/AndroidLibrary/wiki/Configuration)
1618

app/build.gradle

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ android {
1111

1212
defaultConfig {
1313
applicationId "com.efraespada.stringobfuscator"
14-
minSdkVersion 14
14+
minSdkVersion 15
1515
targetSdkVersion 28
1616
versionCode 1
1717
versionName "1.0"
@@ -55,9 +55,10 @@ dependencies {
5555
})
5656
implementation 'com.android.support:appcompat-v7:28.0.0'
5757
testImplementation 'junit:junit:4.12'
58-
// implementation project(path: ':library')
58+
implementation project(path: ':library')
5959
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
60-
implementation "com.stringcare:library:$stringcare_version"
60+
implementation 'commons-io:commons-io:2.5'
61+
// implementation "com.stringcare:library:$stringcare_version"
6162
}
6263

6364

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[
2+
{
3+
"user": "user123",
4+
"message": "hello world"
5+
},
6+
{
7+
"user": "user456",
8+
"message": "hello there"
9+
}
10+
]

app/src/main/assets/test.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"user": "user123",
3+
"message": "hello world"
4+
}

app/src/main/java/com/efraespada/stringobfuscator/MainActivity.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,14 @@ protected void onCreate(Bundle savedInstanceState) {
4242
boolean equals = SC.reveal(R.string.hello_world_b).equals(getString(R.string.hello_world_a));
4343
String areEquals = "Same result: " + equals;
4444
((TextView) findViewById(R.id.same_value)).setText(areEquals);
45+
46+
String jsonObjectName = SC.reveal(R.string.asset_json_file);
47+
SC.asset().asyncJson(jsonObjectName, json -> ((TextView) findViewById(R.id.json_object)).setText(json.toString()));
48+
SC.asset().asyncBytes(jsonObjectName, bytes -> ((TextView) findViewById(R.id.json_object_original)).setText(new String(bytes)), false);
49+
50+
String jsonArrayName = SC.reveal(R.string.asset_json_raw_file);
51+
SC.asset().asyncJsonArray(jsonArrayName, json -> ((TextView) findViewById(R.id.json_array)).setText(json.toString()));
52+
SC.asset().asyncBytes(jsonArrayName, bytes -> ((TextView) findViewById(R.id.json_array_original)).setText(new String(bytes)), false);
53+
4554
}
4655
}

app/src/main/res/layout/activity_main.xml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,70 @@
158158
app:androidTreatment="false"
159159
app:visible="true" />
160160

161+
<TextView
162+
android:layout_width="wrap_content"
163+
android:layout_height="wrap_content"
164+
android:layout_gravity="start"
165+
android:layout_marginTop="15dp"
166+
style="@style/TextAppearance.AppCompat.Title"
167+
android:text="@string/json_object_asset"
168+
android:padding="25dp"
169+
android:textColor="@android:color/black" />
170+
171+
<TextView
172+
android:id="@+id/json_object_original"
173+
android:layout_width="wrap_content"
174+
android:layout_height="wrap_content"
175+
android:layout_gravity="center_horizontal"
176+
android:layout_marginTop="15dp"
177+
android:paddingStart="25dp"
178+
android:paddingEnd="25dp"
179+
android:textSize="12sp"
180+
android:textColor="@android:color/darker_gray" />
181+
182+
<TextView
183+
android:id="@+id/json_object"
184+
android:layout_width="wrap_content"
185+
android:layout_height="wrap_content"
186+
android:layout_gravity="center_horizontal"
187+
android:layout_marginTop="15dp"
188+
android:paddingStart="25dp"
189+
android:paddingEnd="25dp"
190+
android:textColor="@android:color/black" />
191+
192+
<TextView
193+
android:layout_width="wrap_content"
194+
android:layout_height="wrap_content"
195+
android:layout_gravity="start"
196+
android:layout_marginTop="15dp"
197+
style="@style/TextAppearance.AppCompat.Title"
198+
android:text="@string/json_array_asset"
199+
android:padding="25dp"
200+
android:textColor="@android:color/black" />
201+
202+
<TextView
203+
android:id="@+id/json_array_original"
204+
android:layout_width="wrap_content"
205+
android:layout_height="wrap_content"
206+
android:layout_gravity="center_horizontal"
207+
android:layout_marginTop="15dp"
208+
android:paddingStart="25dp"
209+
android:paddingEnd="25dp"
210+
android:paddingBottom="25dp"
211+
android:textSize="12sp"
212+
android:textColor="@android:color/darker_gray" />
213+
214+
<TextView
215+
android:id="@+id/json_array"
216+
android:layout_width="wrap_content"
217+
android:layout_height="wrap_content"
218+
android:layout_gravity="center_horizontal"
219+
android:layout_marginTop="15dp"
220+
android:paddingStart="25dp"
221+
android:paddingEnd="25dp"
222+
android:paddingBottom="25dp"
223+
android:textColor="@android:color/black" />
224+
161225
</LinearLayout>
162226

163227
</ScrollView>

app/src/main/res/values/strings.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,13 @@
1616
<string name="hello_world_c" hidden="true" androidTreatment="false">Hello
1717
World
1818
</string>
19+
<string name="asset_json_file" hidden="true">test.json</string>
20+
<string name="asset_json_raw_file" hidden="true">raw/test_array.json</string>
1921
<string name="long_new_line_comparison">Long New Line Comparison</string>
2022
<string name="html_treatment">HTML treatment</string>
2123
<string name="programmatically_obfuscation">Programmatically Obfuscation</string>
2224
<string name="patterns">Patterns</string>
2325
<string name="string_resource_disabling_android_treatment">String resource disabling Android treatment:</string>
26+
<string name="json_object_asset">JSON Asset</string>
27+
<string name="json_array_asset">JSON Array Raw Asset</string>
2428
</resources>

build.gradle

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ buildscript {
1616
}
1717

1818
dependencies {
19-
classpath "com.stringcare:plugin:$stringcare_version"
20-
// classpath files('../KotlinGradlePlugin/build/libs/plugin-3.1.jar')
21-
classpath 'com.android.tools.build:gradle:3.4.2'
19+
// classpath "com.stringcare:plugin:$stringcare_version"
20+
classpath files('../KotlinGradlePlugin/build/libs/plugin-3.3.jar')
21+
classpath 'com.android.tools.build:gradle:3.6.0-alpha06'
2222
classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.1"
2323
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
2424
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
@@ -44,10 +44,13 @@ apply plugin: StringCare
4444

4545
stringcare {
4646
debug true
47-
47+
modules {
48+
app {
49+
assetsFiles = ["*.json"]
50+
}
51+
}
4852
variants {
4953
prod {
50-
skip = true
5154
applicationId = "com.efraespada.stringobfuscator"
5255
}
5356
dev {
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Sat May 25 04:13:40 CEST 2019
1+
#Fri Aug 16 21:23:15 CEST 2019
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-5.5-all.zip

library/build.gradle

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ apply plugin: 'kotlin-android-extensions'
44
apply plugin: 'com.github.dcendents.android-maven'
55
apply plugin: 'com.jfrog.bintray'
66

7-
version = "3.3"
7+
version = "3.4"
88

99
android {
1010
compileSdkVersion 28
1111
buildToolsVersion '28.0.3'
1212

1313
defaultConfig {
14-
minSdkVersion 14
14+
minSdkVersion 15
1515
targetSdkVersion 28
1616
versionCode 4
1717
versionName version
@@ -46,6 +46,7 @@ dependencies {
4646
exclude group: 'com.android.support', module: 'support-annotations'
4747
})
4848
implementation 'com.android.support:appcompat-v7:28.0.0'
49+
implementation 'org.jetbrains.anko:anko:0.10.8'
4950
implementation 'org.apache.commons:commons-lang3:3.9'
5051
testImplementation 'junit:junit:4.12'
5152
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"

0 commit comments

Comments
 (0)