Skip to content

Commit 6eafc5c

Browse files
committed
Initial commit
0 parents  commit 6eafc5c

File tree

66 files changed

+2578
-0
lines changed

Some content is hidden

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

66 files changed

+2578
-0
lines changed

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Auto detect text files and perform LF normalization
2+
* text=auto

.gitignore

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/build
2+
3+
.gradle/
4+
5+
.idea/
6+
7+
captures/
8+
9+
.DS_Store
10+
11+
local.properties
12+
13+
14+
jsonviewer/build/

JsonViewerExample.iml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<module external.linked.project.id="JsonViewerExample" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" type="JAVA_MODULE" version="4">
3+
<component name="FacetManager">
4+
<facet type="java-gradle" name="Java-Gradle">
5+
<configuration>
6+
<option name="BUILD_FOLDER_PATH" value="$MODULE_DIR$/build" />
7+
<option name="BUILDABLE" value="false" />
8+
</configuration>
9+
</facet>
10+
</component>
11+
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7" inherit-compiler-output="true">
12+
<exclude-output />
13+
<content url="file://$MODULE_DIR$">
14+
<excludeFolder url="file://$MODULE_DIR$/.gradle" />
15+
</content>
16+
<orderEntry type="jdk" jdkName="1.8" jdkType="JavaSDK" />
17+
<orderEntry type="sourceFolder" forTests="false" />
18+
</component>
19+
</module>

app/.gitignore

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

app/app.iml

Lines changed: 224 additions & 0 deletions
Large diffs are not rendered by default.

app/build.gradle

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
apply plugin: 'com.android.application'
2+
3+
apply plugin: 'kotlin-android'
4+
5+
apply plugin: 'kotlin-android-extensions'
6+
7+
//TO ADD IN YOUR PROJECT
8+
apply plugin: 'kotlin-kapt'
9+
10+
android {
11+
compileSdkVersion 29
12+
buildToolsVersion "29.0.2"
13+
defaultConfig {
14+
applicationId "org.billcarsonfr.jsonviewerexample"
15+
minSdkVersion 21
16+
targetSdkVersion 29
17+
versionCode 1
18+
versionName "1.0"
19+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
20+
}
21+
buildTypes {
22+
release {
23+
minifyEnabled false
24+
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
25+
}
26+
}
27+
}
28+
29+
dependencies {
30+
implementation fileTree(dir: 'libs', include: ['*.jar'])
31+
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
32+
implementation 'androidx.appcompat:appcompat:1.1.0'
33+
implementation 'androidx.core:core-ktx:1.1.0'
34+
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
35+
36+
37+
//=== ADD IN YOUR PROJECT
38+
// Epoxy dependency
39+
implementation("com.airbnb.android:epoxy:$epoxy_version")
40+
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
41+
kapt "com.airbnb.android:epoxy-processor:$epoxy_version"
42+
implementation 'com.airbnb.android:mvrx:1.3.0'
43+
// ============
44+
45+
testImplementation 'junit:junit:4.12'
46+
androidTestImplementation 'androidx.test.ext:junit:1.1.0'
47+
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
48+
implementation project(path: ':jsonviewer')
49+
}

app/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
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package org.billcarsonfr.jsonviewerexample
2+
3+
import androidx.test.platform.app.InstrumentationRegistry
4+
import androidx.test.ext.junit.runners.AndroidJUnit4
5+
6+
import org.junit.Test
7+
import org.junit.runner.RunWith
8+
9+
import org.junit.Assert.*
10+
11+
/**
12+
* Instrumented test, which will execute on an Android device.
13+
*
14+
* See [testing documentation](http://d.android.com/tools/testing).
15+
*/
16+
@RunWith(AndroidJUnit4::class)
17+
class ExampleInstrumentedTest {
18+
@Test
19+
fun useAppContext() {
20+
// Context of the app under test.
21+
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
22+
assertEquals("org.billcarsonfr.jsonviewerexample", appContext.packageName)
23+
}
24+
}

app/src/main/AndroidManifest.xml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
package="org.billcarsonfr.jsonviewerexample">
4+
5+
<!-- To access Google+ APIs: -->
6+
<uses-permission android:name="android.permission.INTERNET" />
7+
8+
<application
9+
android:allowBackup="true"
10+
android:icon="@mipmap/ic_launcher"
11+
android:label="@string/app_name"
12+
android:roundIcon="@mipmap/ic_launcher_round"
13+
android:supportsRtl="true"
14+
android:theme="@style/AppTheme">
15+
<activity android:name=".MainActivity">
16+
<intent-filter>
17+
<action android:name="android.intent.action.MAIN" />
18+
19+
<category android:name="android.intent.category.LAUNCHER" />
20+
</intent-filter>
21+
</activity>
22+
</application>
23+
24+
</manifest>
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
package org.billcarsonfr.jsonviewerexample
2+
3+
import android.content.Context
4+
import android.os.Bundle
5+
import android.view.LayoutInflater
6+
import android.view.View
7+
import android.view.ViewGroup
8+
import android.widget.Button
9+
import androidx.fragment.app.Fragment
10+
11+
/**
12+
* Activities that contain this fragment must implement the
13+
* [ChooseSampleFragment.OnFragmentMainNavigationListener] interface
14+
* to handle interaction events.
15+
* Use the [ChooseSampleFragment.newInstance] factory method to
16+
* create an instance of this fragment.
17+
*/
18+
class ChooseSampleFragment : Fragment() {
19+
20+
21+
private var mListener: OnFragmentMainNavigationListener? = null
22+
23+
lateinit var showWrappedButton: Button
24+
25+
override fun onCreate(savedInstanceState: Bundle?) {
26+
super.onCreate(savedInstanceState)
27+
}
28+
29+
override fun onCreateView(
30+
inflater: LayoutInflater, container: ViewGroup?,
31+
savedInstanceState: Bundle?
32+
): View? {
33+
// Inflate the layout for this fragment
34+
return inflater.inflate(R.layout.fragment_choose_sample, container, false).also { view ->
35+
view.findViewById<Button>(R.id.showWrappedViewer)?.let {
36+
it.setOnClickListener {
37+
mListener?.navigateToWrapSample(true)
38+
}
39+
40+
view.findViewById<Button>(R.id.showWrappedViewerScroll)?.let {
41+
it.setOnClickListener {
42+
mListener?.navigateToWrapSample(false)
43+
}
44+
}
45+
46+
47+
view.findViewById<Button>(R.id.showAsBottomSheet)?.let {
48+
it.setOnClickListener {
49+
mListener?.navigateToDialog()
50+
}
51+
}
52+
53+
54+
}
55+
}
56+
}
57+
58+
override fun onAttach(context: Context) {
59+
super.onAttach(context)
60+
if (context is OnFragmentMainNavigationListener) {
61+
mListener = context
62+
} else {
63+
throw RuntimeException("$context must implement OnFragmentMainNavigationListener")
64+
}
65+
}
66+
67+
override fun onDetach() {
68+
super.onDetach()
69+
mListener = null
70+
}
71+
72+
/**
73+
* This interface must be implemented by activities that contain this
74+
* fragment to allow an interaction in this fragment to be communicated
75+
* to the activity and potentially other fragments contained in that
76+
* activity.
77+
*
78+
*
79+
* See the Android Training lesson [Communicating with Other Fragments](http://developer.android.com/training/basics/fragments/communicating.html) for more information.
80+
*/
81+
interface OnFragmentMainNavigationListener {
82+
fun navigateToWrapSample(wrap: Boolean)
83+
fun navigateToDialog()
84+
}
85+
86+
companion object {
87+
fun newInstance(): ChooseSampleFragment {
88+
return ChooseSampleFragment()
89+
}
90+
}
91+
92+
}

0 commit comments

Comments
 (0)