Skip to content

Commit

Permalink
Enable multiple ARE instances in one page
Browse files Browse the repository at this point in the history
  • Loading branch information
chinalwb committed Sep 8, 2019
1 parent fa9dfea commit 8dc6d2d
Show file tree
Hide file tree
Showing 48 changed files with 507 additions and 338 deletions.
5 changes: 4 additions & 1 deletion ARE/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'

android {
compileSdkVersion 26
Expand All @@ -21,6 +23,7 @@ dependencies {
implementation 'com.android.support:design:27.1.1'
// implementation 'com.android.support:appcompat-v7:26.1.0'
implementation project(':are')
implementation 'com.github.bumptech.glide:glide:4.9.0'
implementation 'com.github.bumptech.glide:glide:4.9.0'
// implementation 'com.github.chinalwb:are:0.1.6'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
31 changes: 21 additions & 10 deletions ARE/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />

<!-- android:windowSoftInputMode="stateVisible|adjustResize" -->
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:largeHeap="true"
android:theme="@style/AppTheme">
<activity
android:name=".ARE_MultiInstanceActivity"
android:windowSoftInputMode="adjustResize"></activity>
<activity
android:name=".IndexActivity"
android:label="@string/app_name">
Expand All @@ -36,19 +38,28 @@
<activity android:name=".TextViewActivity" />
<activity
android:name=".ARE_FullBottomActivity"
android:label="@string/title_activity_are__full_bottom" />
android:label="@string/title_activity_are__full_bottom"
android:windowSoftInputMode="adjustResize" />
<activity
android:name=".ARE_FullTopActivity"
android:label="@string/title_activity_are__full_top" />
android:label="@string/title_activity_are__full_top"
android:windowSoftInputMode="adjustResize" />
<activity
android:name=".ARE_MinBottomActivity"
android:label="@string/title_activity_are__min_bottom" />
<activity android:name=".ARE_MinTopActivity"
android:label="@string/title_activity_are__min_top" />
<activity android:name=".ARE_MinHideActivity"
android:label="@string/title_activity_are__min_hide" />
<activity android:name=".ARE_DefaultToolbarActivity"
android:label="@string/title_activity_are__default_toolbar" />
android:label="@string/title_activity_are__min_bottom"
android:windowSoftInputMode="adjustResize" />
<activity
android:name=".ARE_MinTopActivity"
android:label="@string/title_activity_are__min_top"
android:windowSoftInputMode="adjustResize" />
<activity
android:name=".ARE_MinHideActivity"
android:label="@string/title_activity_are__min_hide"
android:windowSoftInputMode="adjustResize" />
<activity
android:name=".ARE_DefaultToolbarActivity"
android:label="@string/title_activity_are__default_toolbar"
android:windowSoftInputMode="adjustResize" />
</application>

</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package com.chinalwb.are.demo

import android.content.Intent
import android.support.v7.app.AppCompatActivity
import android.os.Bundle
import com.chinalwb.are.AREditor
import kotlinx.android.synthetic.main.activity_are__multi_instance.*
import kotlinx.android.synthetic.main.activity_main.*

class ARE_MultiInstanceActivity : AppCompatActivity() {

var activeARE : AREditor? = null

private val areFocusChangeListener = AREditor.ARE_FocusChangeListener { arEditor, hasFocus -> if (hasFocus && arEditor != null) activeARE = arEditor }

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_are__multi_instance)

are_1.setAreFocusChangeListener(areFocusChangeListener)
are_2.setAreFocusChangeListener(areFocusChangeListener)
are_3.setAreFocusChangeListener(areFocusChangeListener)
are_4.setAreFocusChangeListener(areFocusChangeListener)

activeARE = are_1
}

override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
this.activeARE?.onActivityResult(requestCode, resultCode, data)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ private void initViews() {

Button minHideButton = this.findViewById(R.id.minHideButton);
openPage(minHideButton, ARE_MinHideActivity.class);

Button multipleInstanceButton = this.findViewById(R.id.multiInstanceButton);
openPage(multipleInstanceButton, ARE_MultiInstanceActivity.class);
}

private void openPage(Button button, final Class activity) {
Expand Down
1 change: 1 addition & 0 deletions ARE/app/src/main/res/layout/activity_are__full_bottom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
are:expandMode="FULL"
are:hideToolbar="false"
are:toolbarAlignment="BOTTOM"
are:useEmoji="true"
/>

</RelativeLayout>
1 change: 1 addition & 0 deletions ARE/app/src/main/res/layout/activity_are__min_bottom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
are:expandMode="MIN"
are:hideToolbar="false"
are:toolbarAlignment="BOTTOM"
are:useEmoji="true"
android:visibility="visible"
/>
</RelativeLayout>
119 changes: 119 additions & 0 deletions ARE/app/src/main/res/layout/activity_are__multi_instance.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:are="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ARE_MultiInstanceActivity">


<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="200dp"
android:orientation="vertical">

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="16sp"
android:background="@color/color_100"
android:padding="8dp"
android:text="ARE One"
android:textColor="@android:color/white"
/>

<com.chinalwb.are.AREditor
android:id="@+id/are_1"
android:layout_width="match_parent"
android:layout_height="match_parent"
are:expandMode="FULL"
are:hideToolbar="false"
are:toolbarAlignment="BOTTOM" />

</LinearLayout>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="300dp"
android:orientation="vertical">

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="16sp"
android:background="@color/color_300"
android:padding="8dp"
android:text="ARE Two"
android:textColor="@android:color/white"
/>

<com.chinalwb.are.AREditor
android:id="@+id/are_2"
android:layout_width="match_parent"
android:layout_height="match_parent"
are:expandMode="FULL"
are:hideToolbar="false"
are:toolbarAlignment="BOTTOM" />

</LinearLayout>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="200dp"
android:orientation="vertical">

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="16sp"
android:background="@color/color_600"
android:padding="8dp"
android:text="ARE Three"
android:textColor="@android:color/white"
/>

<com.chinalwb.are.AREditor
android:id="@+id/are_3"
android:layout_width="match_parent"
android:layout_height="match_parent"
are:expandMode="FULL"
are:hideToolbar="false"
are:toolbarAlignment="BOTTOM" />

</LinearLayout>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="300dp"
android:orientation="vertical">

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="16sp"
android:background="@color/color_900"
android:padding="8dp"
android:text="ARE Four"
android:textColor="@android:color/white"
/>

<com.chinalwb.are.AREditor
android:id="@+id/are_4"
android:layout_width="match_parent"
android:layout_height="match_parent"
are:expandMode="FULL"
are:hideToolbar="false"
are:toolbarAlignment="BOTTOM" />

</LinearLayout>

</LinearLayout>

</android.support.v4.widget.NestedScrollView>
7 changes: 7 additions & 0 deletions ARE/app/src/main/res/layout/activity_index.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,13 @@
android:textAllCaps="false"
android:text="AREditor Min Hide"/>

<Button
android:id="@+id/multiInstanceButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAllCaps="false"
android:text="Multiple AREditor in One Page"/>

<ImageView
android:id="@+id/image"
android:layout_width="300dp"
Expand Down
5 changes: 5 additions & 0 deletions ARE/app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,9 @@
<color name="colorPrimary">#F67eF2</color>
<color name="colorPrimaryDark">#e74c3c</color>
<color name="colorAccent">#27ae60</color>

<color name="color_100">#DCEDC8</color>
<color name="color_300">#AED581</color>
<color name="color_600">#7CB342</color>
<color name="color_900">#33691E</color>
</resources>
Loading

0 comments on commit 8dc6d2d

Please sign in to comment.