Skip to content

Commit 72e05c2

Browse files
Code Optimization
1 parent 50ea51b commit 72e05c2

29 files changed

+503
-4
lines changed

linkablelog/build.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ android {
1010
defaultConfig {
1111
minSdkVersion 19
1212
targetSdkVersion 29
13-
versionCode 1
14-
versionName "1.0"
13+
versionCode 4
14+
versionName "0.4"
1515

1616
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
1717
consumerProguardFiles 'consumer-rules.pro'
@@ -41,7 +41,7 @@ ext {
4141
bintrayRepo = 'maven'
4242
bintrayName = 'linkablelog'
4343

44-
publishedGroupId = 'com.github.dhl.linkablelog'
44+
publishedGroupId = 'com.github.dhl'
4545
libraryName = 'linkablelog'
4646
artifact = 'linkablelog'
4747

@@ -50,7 +50,7 @@ ext {
5050
siteUrl = 'https://github.com/hitesh-dhamshaniya/LinkableLogApp'
5151
gitUrl = 'https://github.com/hitesh-dhamshaniya/LinkableLogApp.git'
5252

53-
libraryVersion = '1.0'
53+
libraryVersion = '0.4'
5454
//If you are uploading new library try : gradlew install
5555
//If you are updating existing library then execute: gradlew bintrayUpload
5656
//In both the case don't forgot to put bintray credentials in local.properties file.

sample/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

sample/build.gradle

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
apply plugin: 'com.android.application'
2+
3+
apply plugin: 'kotlin-android'
4+
5+
apply plugin: 'kotlin-android-extensions'
6+
7+
android {
8+
compileSdkVersion 29
9+
buildToolsVersion "29.0.2"
10+
defaultConfig {
11+
applicationId "com.github.dhl.sample"
12+
minSdkVersion 19
13+
targetSdkVersion 29
14+
versionCode 1
15+
versionName "1.0"
16+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
17+
}
18+
buildTypes {
19+
release {
20+
minifyEnabled false
21+
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
22+
}
23+
}
24+
}
25+
26+
dependencies {
27+
implementation project(":linkablelog")
28+
implementation fileTree(dir: 'libs', include: ['*.jar'])
29+
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
30+
implementation 'androidx.appcompat:appcompat:1.1.0'
31+
implementation 'androidx.core:core-ktx:1.1.0'
32+
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
33+
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
34+
implementation 'androidx.lifecycle:lifecycle-extensions:2.1.0'
35+
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.1.0'
36+
testImplementation 'junit:junit:4.12'
37+
androidTestImplementation 'androidx.test:runner:1.2.0'
38+
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
39+
}

sample/proguard-rules.pro

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Add project specific ProGuard rules here.
2+
# You can control the set of applied configuration files using the
3+
# proguardFiles setting in build.gradle.
4+
#
5+
# For more details, see
6+
# http://developer.android.com/guide/developing/tools/proguard.html
7+
8+
# If your project uses WebView with JS, uncomment the following
9+
# and specify the fully qualified class name to the JavaScript interface
10+
# class:
11+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12+
# public *;
13+
#}
14+
15+
# Uncomment this to preserve the line number information for
16+
# debugging stack traces.
17+
#-keepattributes SourceFile,LineNumberTable
18+
19+
# If you keep the line number information, uncomment this to
20+
# hide the original source file name.
21+
#-renamesourcefileattribute SourceFile

sample/src/main/AndroidManifest.xml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
package="com.github.dhl.sample">
4+
5+
<application
6+
android:allowBackup="true"
7+
android:icon="@mipmap/ic_launcher"
8+
android:label="@string/app_name"
9+
android:roundIcon="@mipmap/ic_launcher_round"
10+
android:supportsRtl="true"
11+
android:theme="@style/AppTheme">
12+
<service
13+
android:name=".SampleService"
14+
android:enabled="true"
15+
android:exported="true" />
16+
17+
<activity android:name=".MainActivity">
18+
<intent-filter>
19+
<action android:name="android.intent.action.MAIN" />
20+
<action android:name="android.intent.action.VIEW" />
21+
22+
<category android:name="android.intent.category.LAUNCHER" />
23+
</intent-filter>
24+
</activity>
25+
26+
</application>
27+
28+
</manifest>
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
package com.github.dhl.sample
2+
3+
import android.content.Intent
4+
import android.os.Bundle
5+
import android.view.View
6+
import androidx.appcompat.app.AppCompatActivity
7+
import com.github.dhl.linkablelog.Log
8+
9+
class MainActivity : AppCompatActivity() {
10+
11+
override fun onCreate(savedInstanceState: Bundle?) {
12+
super.onCreate(savedInstanceState)
13+
setContentView(R.layout.activity_main)
14+
15+
Log.i("OnCreate", "Call from Main Activity")
16+
Log.i("OnCreate", "Call from Main Activity")
17+
Log.w("OnCreate", "Call from Main Activity")
18+
Log.d("OnCreate", "Call from Main Activity")
19+
Log.w("OnCreate", "Call from Main Activity")
20+
21+
print()
22+
}
23+
24+
fun dummyPrint(){
25+
print()
26+
}
27+
28+
fun print(){
29+
Log.v("OnCreate ", "Main Activity")
30+
}
31+
32+
fun printLog(view: View) {
33+
dummyPrint()
34+
35+
Log.e("Hitesh", "Hello Main Activity")
36+
startService(Intent(MainActivity@ this, SampleService::class.java))
37+
}
38+
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
package com.github.dhl.sample
2+
3+
import android.os.Bundle
4+
import android.view.LayoutInflater
5+
import android.view.View
6+
import android.view.ViewGroup
7+
import androidx.fragment.app.Fragment
8+
import androidx.lifecycle.ViewModelProviders
9+
import com.github.dhl.linkablelog.Log
10+
import kotlinx.android.synthetic.main.sample_fragment.view.*
11+
12+
13+
class SampleFragment : Fragment() {
14+
15+
companion object {
16+
fun newInstance() = SampleFragment()
17+
}
18+
19+
private lateinit var viewModel: SampleViewModel
20+
21+
override fun onCreateView(
22+
inflater: LayoutInflater, container: ViewGroup?,
23+
savedInstanceState: Bundle?
24+
): View? {
25+
val mRootView = inflater.inflate(R.layout.sample_fragment, container, false)
26+
val response =
27+
"{\"glossary\":{\"title\":\"example glossary\",\"GlossDiv\":{\"title\":\"S\",\"GlossList\":{\"GlossEntry\":{\"ID\":\"SGML\",\"SortAs\":\"SGML\",\"GlossTerm\":\"Standard Generalized Markup Language\",\"Acronym\":\"SGML\",\"Abbrev\":\"ISO 8879:1986\",\"GlossDef\":{\"para\":\"A meta-markup language, used to create markup languages such as DocBook.\",\"GlossSeeAlso\":[\"GML\",\"XML\"]},\"GlossSee\":\"markup\"}}}}}"
28+
mRootView.btnFragmentLog.setOnClickListener {
29+
Log.e("Fragment", "Fragment Button Click")
30+
31+
32+
Log.w("Response", response)
33+
}
34+
return mRootView
35+
}
36+
37+
override fun onActivityCreated(savedInstanceState: Bundle?) {
38+
super.onActivityCreated(savedInstanceState)
39+
viewModel = ViewModelProviders.of(this).get(SampleViewModel::class.java)
40+
// TODO: Use the ViewModel
41+
}
42+
43+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package com.github.dhl.sample
2+
3+
import android.app.Service
4+
import android.content.Intent
5+
import android.os.IBinder
6+
import com.github.dhl.linkablelog.Log
7+
8+
class SampleService : Service() {
9+
override fun onBind(p0: Intent?): IBinder? {
10+
return null
11+
}
12+
13+
override fun onCreate() {
14+
super.onCreate()
15+
Log.e("Service", "Log in service")
16+
}
17+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package com.github.dhl.sample
2+
3+
import androidx.lifecycle.ViewModel
4+
5+
class SampleViewModel : ViewModel() {
6+
7+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<vector xmlns:android="http://schemas.android.com/apk/res/android"
2+
xmlns:aapt="http://schemas.android.com/aapt"
3+
android:width="108dp"
4+
android:height="108dp"
5+
android:viewportWidth="108"
6+
android:viewportHeight="108">
7+
<path
8+
android:fillType="evenOdd"
9+
android:pathData="M32,64C32,64 38.39,52.99 44.13,50.95C51.37,48.37 70.14,49.57 70.14,49.57L108.26,87.69L108,109.01L75.97,107.97L32,64Z"
10+
android:strokeWidth="1"
11+
android:strokeColor="#00000000">
12+
<aapt:attr name="android:fillColor">
13+
<gradient
14+
android:endX="78.5885"
15+
android:endY="90.9159"
16+
android:startX="48.7653"
17+
android:startY="61.0927"
18+
android:type="linear">
19+
<item
20+
android:color="#44000000"
21+
android:offset="0.0" />
22+
<item
23+
android:color="#00000000"
24+
android:offset="1.0" />
25+
</gradient>
26+
</aapt:attr>
27+
</path>
28+
<path
29+
android:fillColor="#FFFFFF"
30+
android:fillType="nonZero"
31+
android:pathData="M66.94,46.02L66.94,46.02C72.44,50.07 76,56.61 76,64L32,64C32,56.61 35.56,50.11 40.98,46.06L36.18,41.19C35.45,40.45 35.45,39.3 36.18,38.56C36.91,37.81 38.05,37.81 38.78,38.56L44.25,44.05C47.18,42.57 50.48,41.71 54,41.71C57.48,41.71 60.78,42.57 63.68,44.05L69.11,38.56C69.84,37.81 70.98,37.81 71.71,38.56C72.44,39.3 72.44,40.45 71.71,41.19L66.94,46.02ZM62.94,56.92C64.08,56.92 65,56.01 65,54.88C65,53.76 64.08,52.85 62.94,52.85C61.8,52.85 60.88,53.76 60.88,54.88C60.88,56.01 61.8,56.92 62.94,56.92ZM45.06,56.92C46.2,56.92 47.13,56.01 47.13,54.88C47.13,53.76 46.2,52.85 45.06,52.85C43.92,52.85 43,53.76 43,54.88C43,56.01 43.92,56.92 45.06,56.92Z"
32+
android:strokeWidth="1"
33+
android:strokeColor="#00000000" />
34+
</vector>

0 commit comments

Comments
 (0)