Skip to content

Commit f89e64c

Browse files
authored
Merge pull request #41 from StringCare/develop
Develop
2 parents 2c2fff2 + 1b08cb9 commit f89e64c

File tree

33 files changed

+120
-193
lines changed

33 files changed

+120
-193
lines changed

README.md

Lines changed: 12 additions & 168 deletions
Original file line numberDiff line numberDiff line change
@@ -1,183 +1,26 @@
1-
<p align="center"><img width="10%" vspace="20" src="https://raw.githubusercontent.com/StringCare/AndroidLibrary/develop/sample/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png"></p>
1+
<p align="center"><img width="10%" vspace="10" src="https://github.com/StringCare/AndroidLibrary/raw/develop/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png"></p>
22

3+
<h3 align="center" style="margin-bottom:30px" vspace="20">StringCare Android Library</h3>
34

5+
<p align="center"><img width="10%" vspace="20" src="https://github.com/StringCare/AndroidLibrary/raw/develop/white.png"></p>
46

5-
String Care Android Library
6-
=========================
7+
#### [Wiki Library](https://github.com/StringCare/AndroidLibrary/wiki)
78

8-
Hide strings easily with that lib and plugin! It uses AES/ECB/PKCS5Padding transformation to convert strings with your app's SHA1 fingerprint.
9+
#### [What is StringCare](https://github.com/StringCare/AndroidLibrary/wiki/What-is-StringCare)
910

10-
Gradle implementation
11-
------------
11+
#### [Library Implementation](https://github.com/StringCare/AndroidLibrary/wiki/Library-Implementation)
1212

13-
```groovy
14-
// root_project/build.gradle
15-
16-
buildscript {
17-
18-
ext {
19-
stringcare_version = '0.7'
20-
}
21-
22-
repositories {
23-
jcenter()
24-
}
25-
26-
dependencies {
27-
classpath "com.stringcare:plugin:$stringcare_version"
28-
}
29-
30-
}
31-
32-
apply plugin: StringCare
33-
```
13+
#### [Library Usage](https://github.com/StringCare/AndroidLibrary/wiki/Library-Usage)
3414

35-
```groovy
36-
// root_project/your_module/build.gradle
15+
#### [Publish APK](https://github.com/StringCare/AndroidLibrary/wiki/Publish-APK)
3716

38-
repositories {
39-
jcenter()
40-
}
41-
42-
dependencies {
43-
implementation "com.stringcare:library:$stringcare_version"
44-
}
45-
```
17+
#### [Limitations](https://github.com/StringCare/AndroidLibrary/wiki/Limitations)
4618

47-
Setup
48-
-----
49-
Initialize the library:
50-
```java
51-
SC.init(getApplicationContext());
52-
```
53-
54-
55-
#### Encrypt
56-
The plugin will encrypt all string tags with `hidden="true"` as attribute.
57-
58-
```xml
59-
<resources>
60-
<string name="app_name">StringObfuscator</string>
61-
<string name="hello" hidden="true">hello world!</string>
62-
<string name="test_a" hidden="true">%1$s (%2$d)</string>
63-
</resources>
64-
```
65-
66-
Or encrypt strings programmatically by doing:
67-
68-
```java
69-
String encrypted = SC.encryptString(string_var);
70-
```
71-
72-
#### Decrypt
73-
From resources:
74-
```java
75-
String decrypted = SC.getString(R.string.hello);
76-
String decrypted = SC.getString(R.string.test_a, "hi", 3); // hi (3)
77-
```
78-
Or from encrypted variables:
79-
```java
80-
String decrypted = SC.decryptString(encrypted_var);
81-
```
82-
Sample
83-
------
84-
85-
```java
86-
SC.init(getApplicationContext());
87-
88-
// getting encrypted string resources
89-
int stringId = R.string.hello;
90-
91-
String message = getString(stringId);
92-
message += " is ";
93-
message += SC.getString(stringId);
94-
95-
// and secret
96-
String mySecret = "lalilulelo";
97-
98-
message += "\n\nFor Metal Gear lovers:\n\n\"Snake, the password is " +
99-
SC.encryptString(mySecret) +
100-
"\n\n.. or " +
101-
SC.decryptString(SC.encryptString(mySecret)) +
102-
"\"";
103-
104-
((TextView) findViewById(R.id.example)).setText(message);
105-
```
106-
107-
<p align="center"><img width="40%" vspace="20" src="https://raw.githubusercontent.com/efraespada/AndroidStringObfuscator/master/sample.png"></p>
108-
109-
110-
Configuration
111-
-----------------------------
112-
By default the plugin will encrypt every `strings.xml` file inside `src/main`folder but you can choose a different configuration.
113-
```groovy
114-
// root_folder/build.gradle
115-
116-
apply plugin: StringCare
117-
118-
stringcare {
119-
120-
debug true // prints details
121-
122-
modules {
123-
124-
sample {
125-
stringFiles = ['strings.xml',"other_file.xml"]
126-
srcFolders = ['src/main', "other_folder"]
127-
}
128-
129-
// root_folder/sample/src/main/res/.../strings.xml
130-
// root_folder/sample/src/main/res/.../other_file.xml
131-
// root_folder/sample/other_folder/res/.../strings.xml
132-
// root_folder/sample/other_folder/res/.../other_file.xml
133-
134-
other_module {
135-
srcFolders = ['src/moduleB']
136-
}
137-
138-
// root_folder/other_module/src/moduleB/res/.../strings.xml
139-
140-
other_module_ {} //
141-
142-
// root_folder/other_module_/src/main/res/.../strings.xml
143-
144-
}
145-
146-
}
147-
```
148-
149-
Gradle Console Output Example
150-
-----------------------------
151-
```
152-
...
153-
:sample:generateDebugResValues UP-TO-DATE
154-
:sample:generateDebugResources UP-TO-DATE
155-
:sample:mergeDebugResources
156-
:sample:debug:B8:DC:47:58:9B:5F:2C:21:45:C4:04:37:0E:56:53:DC:24:6B:2C:66
157-
:sample:backupStringResources
158-
- values/strings.xml
159-
:sample:encryptStringResources
160-
- values/strings.xml
161-
[hello world!] - [A8590C43DA85D67..]
162-
:sample:mergeDebugResources UP-TO-DATE
163-
:sample:restoreStringResources
164-
- values/strings.xml
165-
:sample:createDebugCompatibleScreenManifests UP-TO-DATE
166-
...
167-
```
168-
169-
Plugin won't work if there is no config defined for the selected variant:
170-
```bash
171-
...
172-
:sample:mergeReleaseResources
173-
🤯 no config defined for variant release
174-
:sample:createReleaseCompatibleScreenManifests
175-
...
176-
```
19+
#### [Wiki Plugin](https://github.com/StringCare/GradlePlugin/wiki)
17720

17821
License
17922
-------
180-
Copyright 2017 Efraín Espada
23+
Copyright 2018 StringCare [🐒 SpaceMonkeys]
18124

18225
Licensed under the Apache License, Version 2.0 (the "License");
18326
you may not use this file except in compliance with the License.
@@ -191,3 +34,4 @@ License
19134
See the License for the specific language governing permissions and
19235
limitations under the License.
19336

37+

StringCareSchema.png

188 KB
Loading
File renamed without changes.

sample/build.gradle renamed to app/build.gradle

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@ android {
44
signingConfigs {
55

66
}
7-
compileSdkVersion 26
8-
buildToolsVersion '26.0.2'
7+
compileSdkVersion 28
8+
buildToolsVersion '28.0.3'
9+
910
defaultConfig {
1011
applicationId "com.efraespada.stringobfuscator"
1112
minSdkVersion 14
12-
targetSdkVersion 26
13+
targetSdkVersion 28
1314
versionCode 1
1415
versionName "1.0"
1516
}
@@ -34,7 +35,7 @@ dependencies {
3435
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
3536
exclude group: 'com.android.support', module: 'support-annotations'
3637
})
37-
implementation 'com.android.support:appcompat-v7:26.1.0'
38+
implementation 'com.android.support:appcompat-v7:28.0.0'
3839
testImplementation 'junit:junit:4.12'
3940
// implementation project(path: ':library')
4041
implementation "com.stringcare:library:$stringcare_version"
File renamed without changes.
File renamed without changes.

sample/src/main/java/com/efraespada/stringobfuscator/MainActivity.java renamed to app/src/main/java/com/efraespada/stringobfuscator/MainActivity.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ protected void onCreate(Bundle savedInstanceState) {
1414
setContentView(R.layout.activity_main);
1515

1616
SC.init(getApplicationContext());
17+
// SC.initForLib(getApplicationContext(), this);
1718

1819
int stringId = R.string.hello;
1920

sample/src/main/res/layout/activity_main.xml renamed to app/src/main/res/layout/activity_main.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,14 @@
1717
android:orientation="vertical"
1818
android:layout_centerInParent="true">
1919

20+
<com.stringcare.library.SCTextView
21+
android:padding="10dp"
22+
android:layout_width="wrap_content"
23+
android:layout_height="wrap_content"
24+
android:layout_gravity="center_horizontal"
25+
android:textColor="@android:color/black"
26+
android:text="@string/automatic_decrypt"/>
27+
2028
<TextView
2129
android:padding="10dp"
2230
android:id="@+id/example_a"

0 commit comments

Comments
 (0)