From 1a30776d9b6c9bd2131dea8ec7e57540a535980f Mon Sep 17 00:00:00 2001 From: wangyupeng1-iri <871791801@qq.com> Date: Mon, 17 Jul 2017 18:12:50 +0800 Subject: [PATCH] Simplify the demo3 code --- .../app/src/main/AndroidManifest.xml | 80 +------------------ .../replugin/sample/demo3/MainActivity.kt | 34 +------- .../activity/for_result/ForResultActivity.kt | 22 ----- .../IntentFilterDemoActivity1.kt | 25 ------ .../activity/single_instance/TIActivity1.kt | 25 ------ .../activity/single_top/SingleTopActivity1.kt | 25 ------ .../activity/task_affinity/TAActivity1.kt | 25 ------ .../activity/task_affinity/TAActivity2.kt | 26 ------ .../activity/task_affinity/TAActivity3.kt | 25 ------ .../activity/task_affinity/TAActivity4.kt | 25 ------ .../activity/task_affinity/package-info.kt | 43 ---------- .../activity/task_affinity_2/TA2Activity1.kt | 25 ------ .../activity/task_affinity_2/TA2Activity2.kt | 26 ------ .../activity/task_affinity_2/TA2Activity3.kt | 26 ------ .../activity/task_affinity_2/TA2Activity4.kt | 25 ------ .../activity/task_affinity_2/package-info.kt | 43 ---------- .../theme/ThemeBlackNoTitleBarActivity.kt | 5 +- .../ThemeBlackNoTitleBarFullscreenActivity.kt | 52 ------------ .../activity/theme/ThemeDialogActivity.kt | 52 ------------ .../sample/demo3/fragment/DemoCodeFragment.kt | 33 -------- .../sample/demo3/fragment/DemoFragment.kt | 45 ----------- .../sample/demo3/provider/Provider2.kt | 53 ------------ ...emo1Receiver.kt => PluginDemo3Receiver.kt} | 6 +- .../plugin/plugin-demo3-kotlin/build.gradle | 2 +- 24 files changed, 10 insertions(+), 738 deletions(-) delete mode 100644 replugin-sample/plugin/plugin-demo3-kotlin/app/src/main/java/com/qihoo360/replugin/sample/demo3/activity/for_result/ForResultActivity.kt delete mode 100644 replugin-sample/plugin/plugin-demo3-kotlin/app/src/main/java/com/qihoo360/replugin/sample/demo3/activity/intent_filter/IntentFilterDemoActivity1.kt delete mode 100644 replugin-sample/plugin/plugin-demo3-kotlin/app/src/main/java/com/qihoo360/replugin/sample/demo3/activity/single_instance/TIActivity1.kt delete mode 100644 replugin-sample/plugin/plugin-demo3-kotlin/app/src/main/java/com/qihoo360/replugin/sample/demo3/activity/single_top/SingleTopActivity1.kt delete mode 100644 replugin-sample/plugin/plugin-demo3-kotlin/app/src/main/java/com/qihoo360/replugin/sample/demo3/activity/task_affinity/TAActivity1.kt delete mode 100644 replugin-sample/plugin/plugin-demo3-kotlin/app/src/main/java/com/qihoo360/replugin/sample/demo3/activity/task_affinity/TAActivity2.kt delete mode 100644 replugin-sample/plugin/plugin-demo3-kotlin/app/src/main/java/com/qihoo360/replugin/sample/demo3/activity/task_affinity/TAActivity3.kt delete mode 100644 replugin-sample/plugin/plugin-demo3-kotlin/app/src/main/java/com/qihoo360/replugin/sample/demo3/activity/task_affinity/TAActivity4.kt delete mode 100644 replugin-sample/plugin/plugin-demo3-kotlin/app/src/main/java/com/qihoo360/replugin/sample/demo3/activity/task_affinity/package-info.kt delete mode 100644 replugin-sample/plugin/plugin-demo3-kotlin/app/src/main/java/com/qihoo360/replugin/sample/demo3/activity/task_affinity_2/TA2Activity1.kt delete mode 100644 replugin-sample/plugin/plugin-demo3-kotlin/app/src/main/java/com/qihoo360/replugin/sample/demo3/activity/task_affinity_2/TA2Activity2.kt delete mode 100644 replugin-sample/plugin/plugin-demo3-kotlin/app/src/main/java/com/qihoo360/replugin/sample/demo3/activity/task_affinity_2/TA2Activity3.kt delete mode 100644 replugin-sample/plugin/plugin-demo3-kotlin/app/src/main/java/com/qihoo360/replugin/sample/demo3/activity/task_affinity_2/TA2Activity4.kt delete mode 100644 replugin-sample/plugin/plugin-demo3-kotlin/app/src/main/java/com/qihoo360/replugin/sample/demo3/activity/task_affinity_2/package-info.kt delete mode 100644 replugin-sample/plugin/plugin-demo3-kotlin/app/src/main/java/com/qihoo360/replugin/sample/demo3/activity/theme/ThemeBlackNoTitleBarFullscreenActivity.kt delete mode 100644 replugin-sample/plugin/plugin-demo3-kotlin/app/src/main/java/com/qihoo360/replugin/sample/demo3/activity/theme/ThemeDialogActivity.kt delete mode 100644 replugin-sample/plugin/plugin-demo3-kotlin/app/src/main/java/com/qihoo360/replugin/sample/demo3/fragment/DemoCodeFragment.kt delete mode 100644 replugin-sample/plugin/plugin-demo3-kotlin/app/src/main/java/com/qihoo360/replugin/sample/demo3/fragment/DemoFragment.kt delete mode 100644 replugin-sample/plugin/plugin-demo3-kotlin/app/src/main/java/com/qihoo360/replugin/sample/demo3/provider/Provider2.kt rename replugin-sample/plugin/plugin-demo3-kotlin/app/src/main/java/com/qihoo360/replugin/sample/demo3/receivers/{PluginDemo1Receiver.kt => PluginDemo3Receiver.kt} (91%) diff --git a/replugin-sample/plugin/plugin-demo3-kotlin/app/src/main/AndroidManifest.xml b/replugin-sample/plugin/plugin-demo3-kotlin/app/src/main/AndroidManifest.xml index 9272ad7..4150893 100644 --- a/replugin-sample/plugin/plugin-demo3-kotlin/app/src/main/AndroidManifest.xml +++ b/replugin-sample/plugin/plugin-demo3-kotlin/app/src/main/AndroidManifest.xml @@ -55,89 +55,13 @@ android:screenOrientation="portrait" android:theme="@android:style/Theme.Black.NoTitleBar" /> - - - - - - - - - - - - - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/replugin-sample/plugin/plugin-demo3-kotlin/app/src/main/java/com/qihoo360/replugin/sample/demo3/MainActivity.kt b/replugin-sample/plugin/plugin-demo3-kotlin/app/src/main/java/com/qihoo360/replugin/sample/demo3/MainActivity.kt index 1de3734..e700904 100644 --- a/replugin-sample/plugin/plugin-demo3-kotlin/app/src/main/java/com/qihoo360/replugin/sample/demo3/MainActivity.kt +++ b/replugin-sample/plugin/plugin-demo3-kotlin/app/src/main/java/com/qihoo360/replugin/sample/demo3/MainActivity.kt @@ -31,12 +31,7 @@ import android.widget.ListView import android.widget.Toast import com.qihoo360.replugin.RePlugin -import com.qihoo360.replugin.sample.demo3.activity.single_instance.TIActivity1 -import com.qihoo360.replugin.sample.demo3.activity.single_top.SingleTopActivity1 -import com.qihoo360.replugin.sample.demo3.activity.task_affinity.TAActivity1 import com.qihoo360.replugin.sample.demo3.activity.theme.ThemeBlackNoTitleBarActivity -import com.qihoo360.replugin.sample.demo3.activity.theme.ThemeBlackNoTitleBarFullscreenActivity -import com.qihoo360.replugin.sample.demo3.activity.theme.ThemeDialogActivity import java.util.ArrayList @@ -70,16 +65,6 @@ class MainActivity : Activity() { v.context.startActivity(intent) })) - mItems.add(TestItem("Kotlin Activity: By Action", View.OnClickListener { v -> - val intent = Intent() - intent.action = "com.qihoo360.replugin.sample.demo1.action.theme_fullscreen" - /* - 若 Intent 中声明 category, manifest 中未声明,则无法找到 Activity; - 若 manifest 中声明 category, Intent 中未声明,则可以找到 Activity; - */ - intent.addCategory("com.qihoo360.repluginapp.replugin.demo1.CATEGORY1") - v.context.startActivity(intent) - })) // ========= @@ -87,26 +72,11 @@ class MainActivity : Activity() { // ========= mItems.add(TestItem("Kotlin Broadcast: Send (to All)", View.OnClickListener { v -> val intent = Intent() - intent.action = "com.qihoo360.repluginapp.replugin.receiver.ACTION1" + intent.action = "com.qihoo360.repluginapp.replugin.receiver.ACTION3" intent.putExtra("name", "jerry") v.context.sendBroadcast(intent) })) - mItems.add(TestItem("Kotlin Provider: Query (at UI process)", View.OnClickListener { v -> - val uri = Uri.parse("content://com.qihoo360.replugin.sample.demo1.provider2/" + "test") - - val cv = ContentValues() - cv.put("name", "RePlugin Team") - cv.put("address", "beijing") - - val urii = v.context.contentResolver.insert(uri, cv) - Log.d("a4", "result=" + urii!!) - if (urii != null) { - Toast.makeText(v.context, urii.toString(), Toast.LENGTH_SHORT).show() - } else { - Toast.makeText(v.context, "null", Toast.LENGTH_SHORT).show() - } - })) // ========= // Communication @@ -123,7 +93,7 @@ class MainActivity : Activity() { try { val clz = cl.loadClass("com.qihoo360.replugin.sample.demo2.MainApp") val m = clz.getDeclaredMethod("helloFromDemo1", Context::class.java, String::class.java) - m.invoke(null, v.context, "Demo1") + m.invoke(null, v.context, "Demo3") } catch (e: Exception) { // 有可能Demo2根本没有这个类,也有可能没有相应方法(通常出现在"插件版本升级"的情况) Toast.makeText(v.context, "", Toast.LENGTH_SHORT).show() diff --git a/replugin-sample/plugin/plugin-demo3-kotlin/app/src/main/java/com/qihoo360/replugin/sample/demo3/activity/for_result/ForResultActivity.kt b/replugin-sample/plugin/plugin-demo3-kotlin/app/src/main/java/com/qihoo360/replugin/sample/demo3/activity/for_result/ForResultActivity.kt deleted file mode 100644 index b56228b..0000000 --- a/replugin-sample/plugin/plugin-demo3-kotlin/app/src/main/java/com/qihoo360/replugin/sample/demo3/activity/for_result/ForResultActivity.kt +++ /dev/null @@ -1,22 +0,0 @@ -package com.qihoo360.replugin.sample.demo3.activity.for_result - -import android.content.Intent -import android.os.Bundle - -import com.qihoo360.replugin.loader.a.PluginActivity - -/** - * @author RePlugin Team - */ -class ForResultActivity : PluginActivity() { - - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - - val intent = Intent() - intent.putExtra("data", "data from demo1 plugin, resultCode is 0x012") - setResult(0x012, intent) - - finish() - } -} diff --git a/replugin-sample/plugin/plugin-demo3-kotlin/app/src/main/java/com/qihoo360/replugin/sample/demo3/activity/intent_filter/IntentFilterDemoActivity1.kt b/replugin-sample/plugin/plugin-demo3-kotlin/app/src/main/java/com/qihoo360/replugin/sample/demo3/activity/intent_filter/IntentFilterDemoActivity1.kt deleted file mode 100644 index 81b0b98..0000000 --- a/replugin-sample/plugin/plugin-demo3-kotlin/app/src/main/java/com/qihoo360/replugin/sample/demo3/activity/intent_filter/IntentFilterDemoActivity1.kt +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (C) 2005-2017 Qihoo 360 Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed To in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ - -package com.qihoo360.replugin.sample.demo3.activity.intent_filter - -import com.qihoo360.replugin.sample.demo3.BaseActivity - -/** - * @author RePlugin Team - */ -class IntentFilterDemoActivity1 : BaseActivity() { -} diff --git a/replugin-sample/plugin/plugin-demo3-kotlin/app/src/main/java/com/qihoo360/replugin/sample/demo3/activity/single_instance/TIActivity1.kt b/replugin-sample/plugin/plugin-demo3-kotlin/app/src/main/java/com/qihoo360/replugin/sample/demo3/activity/single_instance/TIActivity1.kt deleted file mode 100644 index 60bd185..0000000 --- a/replugin-sample/plugin/plugin-demo3-kotlin/app/src/main/java/com/qihoo360/replugin/sample/demo3/activity/single_instance/TIActivity1.kt +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (C) 2005-2017 Qihoo 360 Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed To in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ - -package com.qihoo360.replugin.sample.demo3.activity.single_instance - -import com.qihoo360.replugin.sample.demo3.BaseActivity - -/** - * @author RePlugin Team - */ -class TIActivity1 : BaseActivity() { -} diff --git a/replugin-sample/plugin/plugin-demo3-kotlin/app/src/main/java/com/qihoo360/replugin/sample/demo3/activity/single_top/SingleTopActivity1.kt b/replugin-sample/plugin/plugin-demo3-kotlin/app/src/main/java/com/qihoo360/replugin/sample/demo3/activity/single_top/SingleTopActivity1.kt deleted file mode 100644 index d205602..0000000 --- a/replugin-sample/plugin/plugin-demo3-kotlin/app/src/main/java/com/qihoo360/replugin/sample/demo3/activity/single_top/SingleTopActivity1.kt +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (C) 2005-2017 Qihoo 360 Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed To in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ - -package com.qihoo360.replugin.sample.demo3.activity.single_top - -import com.qihoo360.replugin.sample.demo3.BaseActivity - -/** - * @author RePlugin Team - */ -class SingleTopActivity1 : BaseActivity() { -} diff --git a/replugin-sample/plugin/plugin-demo3-kotlin/app/src/main/java/com/qihoo360/replugin/sample/demo3/activity/task_affinity/TAActivity1.kt b/replugin-sample/plugin/plugin-demo3-kotlin/app/src/main/java/com/qihoo360/replugin/sample/demo3/activity/task_affinity/TAActivity1.kt deleted file mode 100644 index 31d79e0..0000000 --- a/replugin-sample/plugin/plugin-demo3-kotlin/app/src/main/java/com/qihoo360/replugin/sample/demo3/activity/task_affinity/TAActivity1.kt +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (C) 2005-2017 Qihoo 360 Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed To in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ - -package com.qihoo360.replugin.sample.demo3.activity.task_affinity - -import com.qihoo360.replugin.sample.demo3.BaseActivity - -/** - * @author RePlugin Team - */ -class TAActivity1 : BaseActivity() { -} diff --git a/replugin-sample/plugin/plugin-demo3-kotlin/app/src/main/java/com/qihoo360/replugin/sample/demo3/activity/task_affinity/TAActivity2.kt b/replugin-sample/plugin/plugin-demo3-kotlin/app/src/main/java/com/qihoo360/replugin/sample/demo3/activity/task_affinity/TAActivity2.kt deleted file mode 100644 index 2e6807e..0000000 --- a/replugin-sample/plugin/plugin-demo3-kotlin/app/src/main/java/com/qihoo360/replugin/sample/demo3/activity/task_affinity/TAActivity2.kt +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (C) 2005-2017 Qihoo 360 Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed To in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ - -package com.qihoo360.replugin.sample.demo3.activity.task_affinity - -import com.qihoo360.replugin.sample.demo3.BaseActivity - -/** - * @author RePlugin Team - */ -class TAActivity2 : BaseActivity() { - -} diff --git a/replugin-sample/plugin/plugin-demo3-kotlin/app/src/main/java/com/qihoo360/replugin/sample/demo3/activity/task_affinity/TAActivity3.kt b/replugin-sample/plugin/plugin-demo3-kotlin/app/src/main/java/com/qihoo360/replugin/sample/demo3/activity/task_affinity/TAActivity3.kt deleted file mode 100644 index c7a17d1..0000000 --- a/replugin-sample/plugin/plugin-demo3-kotlin/app/src/main/java/com/qihoo360/replugin/sample/demo3/activity/task_affinity/TAActivity3.kt +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (C) 2005-2017 Qihoo 360 Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed To in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ - -package com.qihoo360.replugin.sample.demo3.activity.task_affinity - -import com.qihoo360.replugin.sample.demo3.BaseActivity - -/** - * @author RePlugin Team - */ -class TAActivity3 : BaseActivity() { -} diff --git a/replugin-sample/plugin/plugin-demo3-kotlin/app/src/main/java/com/qihoo360/replugin/sample/demo3/activity/task_affinity/TAActivity4.kt b/replugin-sample/plugin/plugin-demo3-kotlin/app/src/main/java/com/qihoo360/replugin/sample/demo3/activity/task_affinity/TAActivity4.kt deleted file mode 100644 index e06c8e0..0000000 --- a/replugin-sample/plugin/plugin-demo3-kotlin/app/src/main/java/com/qihoo360/replugin/sample/demo3/activity/task_affinity/TAActivity4.kt +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (C) 2005-2017 Qihoo 360 Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed To in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ - -package com.qihoo360.replugin.sample.demo3.activity.task_affinity - -import com.qihoo360.replugin.sample.demo3.BaseActivity - -/** - * @author RePlugin Team - */ -class TAActivity4 : BaseActivity() { -} diff --git a/replugin-sample/plugin/plugin-demo3-kotlin/app/src/main/java/com/qihoo360/replugin/sample/demo3/activity/task_affinity/package-info.kt b/replugin-sample/plugin/plugin-demo3-kotlin/app/src/main/java/com/qihoo360/replugin/sample/demo3/activity/task_affinity/package-info.kt deleted file mode 100644 index f728ace..0000000 --- a/replugin-sample/plugin/plugin-demo3-kotlin/app/src/main/java/com/qihoo360/replugin/sample/demo3/activity/task_affinity/package-info.kt +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (C) 2005-2017 Qihoo 360 Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed To in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ - -package com.qihoo360.replugin.sample.demo3.activity.task_affinity - -/** - * 测试 两个 TaskAffinity - * MainActivity : Standard - * TA1Activity : SingleTask + ta_1 - * TA2Activity : SingleTask + ta_1 - * TA3Activity : SingleTask + ta_2 - * TA4Activity : SingleTask + ta_2 - - - * Path | Stack - * Main --(start)--> TA1 | TA1 - * ...................... | Main - - * TA1 --(start)--> TA3 | TA3 - * ........................| TA1 - * ........................| Main - - * TA3 --(start)--> TA2 | Ta1 > TA2 - * ........................| TA3 - * ........................| Main - - * TA2 --(start)--> TA4 | TA3 > TA4 - * ........................| Ta1 > TA2 - * ........................| Main - */ diff --git a/replugin-sample/plugin/plugin-demo3-kotlin/app/src/main/java/com/qihoo360/replugin/sample/demo3/activity/task_affinity_2/TA2Activity1.kt b/replugin-sample/plugin/plugin-demo3-kotlin/app/src/main/java/com/qihoo360/replugin/sample/demo3/activity/task_affinity_2/TA2Activity1.kt deleted file mode 100644 index 8cbb7e2..0000000 --- a/replugin-sample/plugin/plugin-demo3-kotlin/app/src/main/java/com/qihoo360/replugin/sample/demo3/activity/task_affinity_2/TA2Activity1.kt +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (C) 2005-2017 Qihoo 360 Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed To in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ - -package com.qihoo360.replugin.sample.demo3.activity.task_affinity_2 - -import com.qihoo360.replugin.sample.demo3.BaseActivity - -/** - * @author RePlugin Team - */ -class TA2Activity1 : BaseActivity() { -} diff --git a/replugin-sample/plugin/plugin-demo3-kotlin/app/src/main/java/com/qihoo360/replugin/sample/demo3/activity/task_affinity_2/TA2Activity2.kt b/replugin-sample/plugin/plugin-demo3-kotlin/app/src/main/java/com/qihoo360/replugin/sample/demo3/activity/task_affinity_2/TA2Activity2.kt deleted file mode 100644 index 0f8cb10..0000000 --- a/replugin-sample/plugin/plugin-demo3-kotlin/app/src/main/java/com/qihoo360/replugin/sample/demo3/activity/task_affinity_2/TA2Activity2.kt +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (C) 2005-2017 Qihoo 360 Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed To in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ - -package com.qihoo360.replugin.sample.demo3.activity.task_affinity_2 - -import com.qihoo360.replugin.sample.demo3.BaseActivity - -/** - * @author RePlugin Team - */ -class TA2Activity2 : BaseActivity() { - -} diff --git a/replugin-sample/plugin/plugin-demo3-kotlin/app/src/main/java/com/qihoo360/replugin/sample/demo3/activity/task_affinity_2/TA2Activity3.kt b/replugin-sample/plugin/plugin-demo3-kotlin/app/src/main/java/com/qihoo360/replugin/sample/demo3/activity/task_affinity_2/TA2Activity3.kt deleted file mode 100644 index 7009ba3..0000000 --- a/replugin-sample/plugin/plugin-demo3-kotlin/app/src/main/java/com/qihoo360/replugin/sample/demo3/activity/task_affinity_2/TA2Activity3.kt +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (C) 2005-2017 Qihoo 360 Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed To in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ - -package com.qihoo360.replugin.sample.demo3.activity.task_affinity_2 - -import com.qihoo360.replugin.sample.demo3.BaseActivity - -/** - * @author RePlugin Team - */ -class TA2Activity3 : BaseActivity() { - -} diff --git a/replugin-sample/plugin/plugin-demo3-kotlin/app/src/main/java/com/qihoo360/replugin/sample/demo3/activity/task_affinity_2/TA2Activity4.kt b/replugin-sample/plugin/plugin-demo3-kotlin/app/src/main/java/com/qihoo360/replugin/sample/demo3/activity/task_affinity_2/TA2Activity4.kt deleted file mode 100644 index 92af213..0000000 --- a/replugin-sample/plugin/plugin-demo3-kotlin/app/src/main/java/com/qihoo360/replugin/sample/demo3/activity/task_affinity_2/TA2Activity4.kt +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (C) 2005-2017 Qihoo 360 Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed To in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ - -package com.qihoo360.replugin.sample.demo3.activity.task_affinity_2 - -import com.qihoo360.replugin.sample.demo3.BaseActivity - -/** - * @author RePlugin Team - */ -class TA2Activity4 : BaseActivity() { -} diff --git a/replugin-sample/plugin/plugin-demo3-kotlin/app/src/main/java/com/qihoo360/replugin/sample/demo3/activity/task_affinity_2/package-info.kt b/replugin-sample/plugin/plugin-demo3-kotlin/app/src/main/java/com/qihoo360/replugin/sample/demo3/activity/task_affinity_2/package-info.kt deleted file mode 100644 index 613a73a..0000000 --- a/replugin-sample/plugin/plugin-demo3-kotlin/app/src/main/java/com/qihoo360/replugin/sample/demo3/activity/task_affinity_2/package-info.kt +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (C) 2005-2017 Qihoo 360 Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed To in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ - -package com.qihoo360.replugin.sample.demo3.activity.task_affinity_2 - -/** - * 测试 两个 TaskAffinity - * MainActivity : Standard - * TA1Activity : SingleTask + ta_3 - * TA2Activity : SingleTask + ta_3 - * TA3Activity : Standard + ta_3 - * TA4Activity : Standard + ta_3 - - - * Path | Stack - * Main --(start)--> TA1 | TA1 - * ...................... | Main - - * TA1 --(start)--> TA2 | TA1 > TA2 - * ........................| Main - - * TA2 --(start)--> TA3 | Ta1 > TA2 > T3 - * ........................| Main - - * TA3 --(start)--> TA4 | Ta1 > TA2 > T3 > T4 - * ........................| Main - - * TA4 --(start)--> TA3 | Ta1 > TA2 > T3 > T4 > T3 - * ........................| Main - */ diff --git a/replugin-sample/plugin/plugin-demo3-kotlin/app/src/main/java/com/qihoo360/replugin/sample/demo3/activity/theme/ThemeBlackNoTitleBarActivity.kt b/replugin-sample/plugin/plugin-demo3-kotlin/app/src/main/java/com/qihoo360/replugin/sample/demo3/activity/theme/ThemeBlackNoTitleBarActivity.kt index 6335077..2d92901 100644 --- a/replugin-sample/plugin/plugin-demo3-kotlin/app/src/main/java/com/qihoo360/replugin/sample/demo3/activity/theme/ThemeBlackNoTitleBarActivity.kt +++ b/replugin-sample/plugin/plugin-demo3-kotlin/app/src/main/java/com/qihoo360/replugin/sample/demo3/activity/theme/ThemeBlackNoTitleBarActivity.kt @@ -19,12 +19,11 @@ package com.qihoo360.replugin.sample.demo3.activity.theme import android.app.Activity import android.os.Bundle import android.view.Gravity +import android.view.ViewGroup.LayoutParams.MATCH_PARENT import android.widget.FrameLayout import android.widget.LinearLayout import android.widget.TextView -import android.view.ViewGroup.LayoutParams.MATCH_PARENT - /** * @author RePlugin Team */ @@ -43,7 +42,7 @@ class ThemeBlackNoTitleBarActivity : Activity() { val textView = TextView(this) textView.gravity = Gravity.CENTER textView.textSize = 30f - textView.text = "Theme: BlackNoTitleBar" + textView.text = "Theme3: BlackNoTitleBar" val lp2 = LinearLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT) textView.layoutParams = lp2 root.addView(textView) diff --git a/replugin-sample/plugin/plugin-demo3-kotlin/app/src/main/java/com/qihoo360/replugin/sample/demo3/activity/theme/ThemeBlackNoTitleBarFullscreenActivity.kt b/replugin-sample/plugin/plugin-demo3-kotlin/app/src/main/java/com/qihoo360/replugin/sample/demo3/activity/theme/ThemeBlackNoTitleBarFullscreenActivity.kt deleted file mode 100644 index 5c4a738..0000000 --- a/replugin-sample/plugin/plugin-demo3-kotlin/app/src/main/java/com/qihoo360/replugin/sample/demo3/activity/theme/ThemeBlackNoTitleBarFullscreenActivity.kt +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (C) 2005-2017 Qihoo 360 Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed To in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ - -package com.qihoo360.replugin.sample.demo3.activity.theme - -import android.app.Activity -import android.os.Bundle -import android.view.Gravity -import android.widget.FrameLayout -import android.widget.LinearLayout -import android.widget.TextView - -import android.view.ViewGroup.LayoutParams.MATCH_PARENT - -/** - * @author RePlugin Team - */ -class ThemeBlackNoTitleBarFullscreenActivity : Activity() { - - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - val root = LinearLayout(this) - root.setPadding(30, 30, 30, 30) - val lp = FrameLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT) - root.layoutParams = lp - - setContentView(root) - - // textView - val textView = TextView(this) - textView.gravity = Gravity.CENTER - textView.textSize = 30f - textView.text = "Theme: BlackNoTitleBarFullScreen" - val lp2 = LinearLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT) - textView.layoutParams = lp2 - root.addView(textView) - } - -} diff --git a/replugin-sample/plugin/plugin-demo3-kotlin/app/src/main/java/com/qihoo360/replugin/sample/demo3/activity/theme/ThemeDialogActivity.kt b/replugin-sample/plugin/plugin-demo3-kotlin/app/src/main/java/com/qihoo360/replugin/sample/demo3/activity/theme/ThemeDialogActivity.kt deleted file mode 100644 index 02bb9eb..0000000 --- a/replugin-sample/plugin/plugin-demo3-kotlin/app/src/main/java/com/qihoo360/replugin/sample/demo3/activity/theme/ThemeDialogActivity.kt +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (C) 2005-2017 Qihoo 360 Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed To in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ - -package com.qihoo360.replugin.sample.demo3.activity.theme - -import android.app.Activity -import android.os.Bundle -import android.view.Gravity -import android.widget.FrameLayout -import android.widget.LinearLayout -import android.widget.TextView - -import android.view.ViewGroup.LayoutParams.MATCH_PARENT - -/** - * @author RePlugin Team - */ -class ThemeDialogActivity : Activity() { - - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - val root = LinearLayout(this) - root.setPadding(30, 30, 30, 30) - val lp = FrameLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT) - root.layoutParams = lp - - setContentView(root) - - // textView - val textView = TextView(this) - textView.text = "Theme: Dialog" - textView.gravity = Gravity.CENTER - textView.textSize = 30f - val lp2 = LinearLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT) - textView.layoutParams = lp2 - root.addView(textView) - } - -} diff --git a/replugin-sample/plugin/plugin-demo3-kotlin/app/src/main/java/com/qihoo360/replugin/sample/demo3/fragment/DemoCodeFragment.kt b/replugin-sample/plugin/plugin-demo3-kotlin/app/src/main/java/com/qihoo360/replugin/sample/demo3/fragment/DemoCodeFragment.kt deleted file mode 100644 index 3fbb6e2..0000000 --- a/replugin-sample/plugin/plugin-demo3-kotlin/app/src/main/java/com/qihoo360/replugin/sample/demo3/fragment/DemoCodeFragment.kt +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (C) 2005-2017 Qihoo 360 Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed To in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package com.qihoo360.replugin.sample.demo3.fragment - -import android.os.Bundle -import android.view.View -import android.widget.TextView - -import com.qihoo360.replugin.sample.demo3.R -/** - * @author RePlugin Team - */ -class DemoCodeFragment : DemoFragment() { - - override fun onViewCreated(view: View?, savedInstanceState: Bundle?) { - super.onViewCreated(view, savedInstanceState) - val textView = view!!.findViewById(R.id.text) as TextView - textView.text = "DemoCodeFragment from plugin demo1" - } -} diff --git a/replugin-sample/plugin/plugin-demo3-kotlin/app/src/main/java/com/qihoo360/replugin/sample/demo3/fragment/DemoFragment.kt b/replugin-sample/plugin/plugin-demo3-kotlin/app/src/main/java/com/qihoo360/replugin/sample/demo3/fragment/DemoFragment.kt deleted file mode 100644 index c4793c7..0000000 --- a/replugin-sample/plugin/plugin-demo3-kotlin/app/src/main/java/com/qihoo360/replugin/sample/demo3/fragment/DemoFragment.kt +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (C) 2005-2017 Qihoo 360 Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed To in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package com.qihoo360.replugin.sample.demo3.fragment - -import android.os.Bundle -import android.support.v4.app.Fragment -import android.util.Log -import android.view.LayoutInflater -import android.view.View -import android.view.ViewGroup - -import com.qihoo360.replugin.RePlugin -import com.qihoo360.replugin.sample.demo3.R - -/** - * @author RePlugin Team - */ -open class DemoFragment : Fragment() { - - override fun onCreateView(inflater: LayoutInflater?, container: ViewGroup?, savedInstanceState: Bundle?): View? { - Log.d(TAG, "onCreateView() called with: inflater = [$inflater], container = [$container], savedInstanceState = [$savedInstanceState]") - /** - * 需要注意不能使用inflater及container因为他们的Context是宿主的 - */ - return LayoutInflater.from(RePlugin.getPluginContext()).inflate(R.layout.main_fragment, container, false) - } - - companion object { - - private val TAG = "DemoFragment" - } -} diff --git a/replugin-sample/plugin/plugin-demo3-kotlin/app/src/main/java/com/qihoo360/replugin/sample/demo3/provider/Provider2.kt b/replugin-sample/plugin/plugin-demo3-kotlin/app/src/main/java/com/qihoo360/replugin/sample/demo3/provider/Provider2.kt deleted file mode 100644 index 5176f50..0000000 --- a/replugin-sample/plugin/plugin-demo3-kotlin/app/src/main/java/com/qihoo360/replugin/sample/demo3/provider/Provider2.kt +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (C) 2005-2017 Qihoo 360 Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed To in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ - -package com.qihoo360.replugin.sample.demo3.provider - -import android.content.ContentProvider -import android.content.ContentValues -import android.database.Cursor -import android.net.Uri - -/** - * @author RePlugin Team - */ -class Provider2 : ContentProvider() { - - override fun onCreate(): Boolean { - return false - } - - override fun query(uri: Uri, projection: Array?, selection: String?, selectionArgs: Array?, sortOrder: String?): Cursor? { - return null - } - - override fun getType(uri: Uri): String? { - return null - } - - override fun insert(uri: Uri, values: ContentValues?): Uri? { - val u = Uri.parse("a://provider ok") - return u - } - - override fun delete(uri: Uri, selection: String?, selectionArgs: Array?): Int { - return 0 - } - - override fun update(uri: Uri, values: ContentValues?, selection: String?, selectionArgs: Array?): Int { - return 0 - } -} diff --git a/replugin-sample/plugin/plugin-demo3-kotlin/app/src/main/java/com/qihoo360/replugin/sample/demo3/receivers/PluginDemo1Receiver.kt b/replugin-sample/plugin/plugin-demo3-kotlin/app/src/main/java/com/qihoo360/replugin/sample/demo3/receivers/PluginDemo3Receiver.kt similarity index 91% rename from replugin-sample/plugin/plugin-demo3-kotlin/app/src/main/java/com/qihoo360/replugin/sample/demo3/receivers/PluginDemo1Receiver.kt rename to replugin-sample/plugin/plugin-demo3-kotlin/app/src/main/java/com/qihoo360/replugin/sample/demo3/receivers/PluginDemo3Receiver.kt index e311b3d..44695cd 100644 --- a/replugin-sample/plugin/plugin-demo3-kotlin/app/src/main/java/com/qihoo360/replugin/sample/demo3/receivers/PluginDemo1Receiver.kt +++ b/replugin-sample/plugin/plugin-demo3-kotlin/app/src/main/java/com/qihoo360/replugin/sample/demo3/receivers/PluginDemo3Receiver.kt @@ -25,20 +25,20 @@ import android.widget.Toast /** * @author RePlugin Team */ -class PluginDemo1Receiver : BroadcastReceiver() { +class PluginDemo3Receiver : BroadcastReceiver() { override fun onReceive(context: Context, intent: Intent) { val action = intent.action if (!TextUtils.isEmpty(action)) { if (action == ACTION) { val name = intent.getStringExtra("name") - Toast.makeText(context, "Plugin1-action: $action, name = $name", Toast.LENGTH_LONG).show() + Toast.makeText(context, "Plugin3-action: $action, name = $name", Toast.LENGTH_LONG).show() } } } companion object { - val ACTION = "com.qihoo360.repluginapp.replugin.receiver.ACTION1" + val ACTION = "com.qihoo360.repluginapp.replugin.receiver.ACTION3" } } diff --git a/replugin-sample/plugin/plugin-demo3-kotlin/build.gradle b/replugin-sample/plugin/plugin-demo3-kotlin/build.gradle index 5e7cd53..6c17cd4 100644 --- a/replugin-sample/plugin/plugin-demo3-kotlin/build.gradle +++ b/replugin-sample/plugin/plugin-demo3-kotlin/build.gradle @@ -20,7 +20,7 @@ buildscript { } dependencies { classpath 'com.android.tools.build:gradle:2.3.3' - classpath 'com.qihoo360.replugin:replugin-plugin-gradle:3.1.7' + classpath 'com.qihoo360.replugin:replugin-plugin-gradle:2.1.5' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } }