Skip to content

Commit 5fa1cb0

Browse files
committed
init kotlin
1 parent 4b2da01 commit 5fa1cb0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+2740
-3279
lines changed

.idea/modules.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/build.gradle

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
apply plugin: 'com.android.application'
2+
apply plugin: 'kotlin-android'
23

34
android {
45
compileSdkVersion 27
@@ -51,4 +52,8 @@ dependencies {
5152
}
5253

5354
compile 'com.google.code.gson:gson:2.8.2'
55+
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
56+
}
57+
repositories {
58+
mavenCentral()
5459
}

app/src/main/AndroidManifest.xml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,14 @@
1212
android:roundIcon="@mipmap/ic_launcher_round"
1313
android:supportsRtl="true"
1414
android:theme="@style/AppTheme">
15-
<activity android:name=".MainActivity">
16-
<intent-filter>
17-
<action android:name="android.intent.action.MAIN" />
1815

19-
<category android:name="android.intent.category.LAUNCHER" />
16+
<activity
17+
android:configChanges="locale|screenSize"
18+
android:name=".MainActivity"
19+
android:windowSoftInputMode="stateHidden">
20+
<intent-filter>
21+
<action android:name="android.intent.action.MAIN"/>
22+
<category android:name="android.intent.category.LAUNCHER"/>
2023
</intent-filter>
2124
</activity>
2225
</application>

app/src/main/java/com/zeroone/concealexample/BaseActivity.java

Lines changed: 0 additions & 37 deletions
This file was deleted.
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
package com.zeroone.concealexample
2+
3+
import android.os.Bundle
4+
import android.support.v7.app.AppCompatActivity
5+
import android.util.Log
6+
7+
import com.zeroone.conceal.SharedChamber
8+
import com.zeroone.conceal.listener.OnDataChamberChangeListener
9+
import com.zeroone.conceal.model.ChamberType
10+
11+
/**
12+
* @author : hafiq on 27/03/2017.
13+
*/
14+
15+
open class BaseActivity : AppCompatActivity(), OnDataChamberChangeListener {
16+
17+
lateinit var chamber: SharedChamber
18+
19+
override fun onCreate(savedInstanceState: Bundle?) {
20+
super.onCreate(savedInstanceState)
21+
22+
chamber = SharedChamber.ChamberBuilder(this)
23+
.setChamberType(ChamberType.KEY_256)
24+
.enableCrypto(false, false)
25+
.enableKeyPrefix(true, "walaoweh")
26+
.setPassword("Password@123")
27+
.setPrefListener(this)
28+
.buildChamber()
29+
}
30+
31+
override fun onDataChange(key: String, value: String) {
32+
Log.d("DATACHANGE", key + " :: " + value)
33+
}
34+
}

app/src/main/java/com/zeroone/concealexample/Data.java

Lines changed: 0 additions & 42 deletions
This file was deleted.
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
package com.zeroone.concealexample
2+
3+
import android.content.Context
4+
5+
import com.google.gson.Gson
6+
import com.google.gson.reflect.TypeToken
7+
8+
import java.io.IOException
9+
import java.nio.charset.Charset
10+
import java.util.ArrayList
11+
12+
/**
13+
* Created by hafiq on 15/12/2017.
14+
*/
15+
16+
object Data {
17+
18+
fun getTaskData(context: Context): List<Task> {
19+
return Gson().fromJson(loadJSONFromAsset(context, "task.json"), object : TypeToken<ArrayList<Task>>() {
20+
21+
}.type)
22+
}
23+
24+
fun getUser(context: Context): User {
25+
return Gson().fromJson(loadJSONFromAsset(context, "users.json"), User::class.java)
26+
}
27+
28+
fun loadJSONFromAsset(context: Context, filename: String): String? {
29+
val json: String?
30+
try {
31+
val assets = context.assets.open(filename)
32+
val size = assets.available()
33+
val buffer = ByteArray(size)
34+
assets.read(buffer)
35+
assets.close()
36+
json = String(buffer, Charset.defaultCharset())
37+
} catch (ex: IOException) {
38+
ex.printStackTrace()
39+
return null
40+
}
41+
42+
return json
43+
}
44+
}

app/src/main/java/com/zeroone/concealexample/MainActivity.java

Lines changed: 0 additions & 146 deletions
This file was deleted.

0 commit comments

Comments
 (0)