Skip to content

Commit 8dc6d2d

Browse files
committed
Enable multiple ARE instances in one page
1 parent fa9dfea commit 8dc6d2d

Some content is hidden

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

48 files changed

+507
-338
lines changed

ARE/app/build.gradle

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
apply plugin: 'com.android.application'
2+
apply plugin: 'kotlin-android'
3+
apply plugin: 'kotlin-android-extensions'
24

35
android {
46
compileSdkVersion 26
@@ -21,6 +23,7 @@ dependencies {
2123
implementation 'com.android.support:design:27.1.1'
2224
// implementation 'com.android.support:appcompat-v7:26.1.0'
2325
implementation project(':are')
24-
implementation 'com.github.bumptech.glide:glide:4.9.0'
26+
implementation 'com.github.bumptech.glide:glide:4.9.0'
2527
// implementation 'com.github.chinalwb:are:0.1.6'
28+
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
2629
}

ARE/app/src/main/AndroidManifest.xml

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,15 @@
1313
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
1414
<uses-permission android:name="android.permission.INTERNET" />
1515

16-
<!-- android:windowSoftInputMode="stateVisible|adjustResize" -->
1716
<application
1817
android:allowBackup="true"
1918
android:icon="@drawable/ic_launcher"
2019
android:label="@string/app_name"
2120
android:largeHeap="true"
2221
android:theme="@style/AppTheme">
22+
<activity
23+
android:name=".ARE_MultiInstanceActivity"
24+
android:windowSoftInputMode="adjustResize"></activity>
2325
<activity
2426
android:name=".IndexActivity"
2527
android:label="@string/app_name">
@@ -36,19 +38,28 @@
3638
<activity android:name=".TextViewActivity" />
3739
<activity
3840
android:name=".ARE_FullBottomActivity"
39-
android:label="@string/title_activity_are__full_bottom" />
41+
android:label="@string/title_activity_are__full_bottom"
42+
android:windowSoftInputMode="adjustResize" />
4043
<activity
4144
android:name=".ARE_FullTopActivity"
42-
android:label="@string/title_activity_are__full_top" />
45+
android:label="@string/title_activity_are__full_top"
46+
android:windowSoftInputMode="adjustResize" />
4347
<activity
4448
android:name=".ARE_MinBottomActivity"
45-
android:label="@string/title_activity_are__min_bottom" />
46-
<activity android:name=".ARE_MinTopActivity"
47-
android:label="@string/title_activity_are__min_top" />
48-
<activity android:name=".ARE_MinHideActivity"
49-
android:label="@string/title_activity_are__min_hide" />
50-
<activity android:name=".ARE_DefaultToolbarActivity"
51-
android:label="@string/title_activity_are__default_toolbar" />
49+
android:label="@string/title_activity_are__min_bottom"
50+
android:windowSoftInputMode="adjustResize" />
51+
<activity
52+
android:name=".ARE_MinTopActivity"
53+
android:label="@string/title_activity_are__min_top"
54+
android:windowSoftInputMode="adjustResize" />
55+
<activity
56+
android:name=".ARE_MinHideActivity"
57+
android:label="@string/title_activity_are__min_hide"
58+
android:windowSoftInputMode="adjustResize" />
59+
<activity
60+
android:name=".ARE_DefaultToolbarActivity"
61+
android:label="@string/title_activity_are__default_toolbar"
62+
android:windowSoftInputMode="adjustResize" />
5263
</application>
5364

5465
</manifest>
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package com.chinalwb.are.demo
2+
3+
import android.content.Intent
4+
import android.support.v7.app.AppCompatActivity
5+
import android.os.Bundle
6+
import com.chinalwb.are.AREditor
7+
import kotlinx.android.synthetic.main.activity_are__multi_instance.*
8+
import kotlinx.android.synthetic.main.activity_main.*
9+
10+
class ARE_MultiInstanceActivity : AppCompatActivity() {
11+
12+
var activeARE : AREditor? = null
13+
14+
private val areFocusChangeListener = AREditor.ARE_FocusChangeListener { arEditor, hasFocus -> if (hasFocus && arEditor != null) activeARE = arEditor }
15+
16+
override fun onCreate(savedInstanceState: Bundle?) {
17+
super.onCreate(savedInstanceState)
18+
setContentView(R.layout.activity_are__multi_instance)
19+
20+
are_1.setAreFocusChangeListener(areFocusChangeListener)
21+
are_2.setAreFocusChangeListener(areFocusChangeListener)
22+
are_3.setAreFocusChangeListener(areFocusChangeListener)
23+
are_4.setAreFocusChangeListener(areFocusChangeListener)
24+
25+
activeARE = are_1
26+
}
27+
28+
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
29+
this.activeARE?.onActivityResult(requestCode, resultCode, data)
30+
}
31+
}

ARE/app/src/main/java/com/chinalwb/are/demo/IndexActivity.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ private void initViews() {
4141

4242
Button minHideButton = this.findViewById(R.id.minHideButton);
4343
openPage(minHideButton, ARE_MinHideActivity.class);
44+
45+
Button multipleInstanceButton = this.findViewById(R.id.multiInstanceButton);
46+
openPage(multipleInstanceButton, ARE_MultiInstanceActivity.class);
4447
}
4548

4649
private void openPage(Button button, final Class activity) {

ARE/app/src/main/res/layout/activity_are__full_bottom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
are:expandMode="FULL"
1313
are:hideToolbar="false"
1414
are:toolbarAlignment="BOTTOM"
15+
are:useEmoji="true"
1516
/>
1617

1718
</RelativeLayout>

ARE/app/src/main/res/layout/activity_are__min_bottom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
are:expandMode="MIN"
2929
are:hideToolbar="false"
3030
are:toolbarAlignment="BOTTOM"
31+
are:useEmoji="true"
3132
android:visibility="visible"
3233
/>
3334
</RelativeLayout>
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<android.support.v4.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
3+
xmlns:app="http://schemas.android.com/apk/res-auto"
4+
xmlns:are="http://schemas.android.com/apk/res-auto"
5+
xmlns:tools="http://schemas.android.com/tools"
6+
android:layout_width="match_parent"
7+
android:layout_height="match_parent"
8+
tools:context=".ARE_MultiInstanceActivity">
9+
10+
11+
<LinearLayout
12+
android:layout_width="match_parent"
13+
android:layout_height="match_parent"
14+
android:orientation="vertical"
15+
>
16+
17+
<LinearLayout
18+
android:layout_width="match_parent"
19+
android:layout_height="200dp"
20+
android:orientation="vertical">
21+
22+
<TextView
23+
android:layout_width="match_parent"
24+
android:layout_height="wrap_content"
25+
android:textSize="16sp"
26+
android:background="@color/color_100"
27+
android:padding="8dp"
28+
android:text="ARE One"
29+
android:textColor="@android:color/white"
30+
/>
31+
32+
<com.chinalwb.are.AREditor
33+
android:id="@+id/are_1"
34+
android:layout_width="match_parent"
35+
android:layout_height="match_parent"
36+
are:expandMode="FULL"
37+
are:hideToolbar="false"
38+
are:toolbarAlignment="BOTTOM" />
39+
40+
</LinearLayout>
41+
42+
<LinearLayout
43+
android:layout_width="match_parent"
44+
android:layout_height="300dp"
45+
android:orientation="vertical">
46+
47+
<TextView
48+
android:layout_width="match_parent"
49+
android:layout_height="wrap_content"
50+
android:textSize="16sp"
51+
android:background="@color/color_300"
52+
android:padding="8dp"
53+
android:text="ARE Two"
54+
android:textColor="@android:color/white"
55+
/>
56+
57+
<com.chinalwb.are.AREditor
58+
android:id="@+id/are_2"
59+
android:layout_width="match_parent"
60+
android:layout_height="match_parent"
61+
are:expandMode="FULL"
62+
are:hideToolbar="false"
63+
are:toolbarAlignment="BOTTOM" />
64+
65+
</LinearLayout>
66+
67+
<LinearLayout
68+
android:layout_width="match_parent"
69+
android:layout_height="200dp"
70+
android:orientation="vertical">
71+
72+
<TextView
73+
android:layout_width="match_parent"
74+
android:layout_height="wrap_content"
75+
android:textSize="16sp"
76+
android:background="@color/color_600"
77+
android:padding="8dp"
78+
android:text="ARE Three"
79+
android:textColor="@android:color/white"
80+
/>
81+
82+
<com.chinalwb.are.AREditor
83+
android:id="@+id/are_3"
84+
android:layout_width="match_parent"
85+
android:layout_height="match_parent"
86+
are:expandMode="FULL"
87+
are:hideToolbar="false"
88+
are:toolbarAlignment="BOTTOM" />
89+
90+
</LinearLayout>
91+
92+
<LinearLayout
93+
android:layout_width="match_parent"
94+
android:layout_height="300dp"
95+
android:orientation="vertical">
96+
97+
<TextView
98+
android:layout_width="match_parent"
99+
android:layout_height="wrap_content"
100+
android:textSize="16sp"
101+
android:background="@color/color_900"
102+
android:padding="8dp"
103+
android:text="ARE Four"
104+
android:textColor="@android:color/white"
105+
/>
106+
107+
<com.chinalwb.are.AREditor
108+
android:id="@+id/are_4"
109+
android:layout_width="match_parent"
110+
android:layout_height="match_parent"
111+
are:expandMode="FULL"
112+
are:hideToolbar="false"
113+
are:toolbarAlignment="BOTTOM" />
114+
115+
</LinearLayout>
116+
117+
</LinearLayout>
118+
119+
</android.support.v4.widget.NestedScrollView>

ARE/app/src/main/res/layout/activity_index.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,13 @@
5050
android:textAllCaps="false"
5151
android:text="AREditor Min Hide"/>
5252

53+
<Button
54+
android:id="@+id/multiInstanceButton"
55+
android:layout_width="match_parent"
56+
android:layout_height="wrap_content"
57+
android:textAllCaps="false"
58+
android:text="Multiple AREditor in One Page"/>
59+
5360
<ImageView
5461
android:id="@+id/image"
5562
android:layout_width="300dp"

ARE/app/src/main/res/values/colors.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,9 @@
33
<color name="colorPrimary">#F67eF2</color>
44
<color name="colorPrimaryDark">#e74c3c</color>
55
<color name="colorAccent">#27ae60</color>
6+
7+
<color name="color_100">#DCEDC8</color>
8+
<color name="color_300">#AED581</color>
9+
<color name="color_600">#7CB342</color>
10+
<color name="color_900">#33691E</color>
611
</resources>

0 commit comments

Comments
 (0)