summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRockchip2015-10-09 09:55:37 +0800
committerRockchip2015-10-09 09:55:37 +0800
commit7a8923ddc9dcc848be4c711b6e4bbef10506f280 (patch)
treed21c5fcd8866a1ae3de32f7024cb84bdf6afbb28
parent1541d6fdc5f07906984f11efa851ccf4aee6d840 (diff)
Revert "Revert "add dual screen function""
This reverts commit 7d5863574e9ebe150b4a042c28cc73c7749083c5. Signed-off-by: Rockchip <service@rock-chips.com>
-rwxr-xr-xAndroidManifest.xml18
-rwxr-xr-xres/drawable-mdpi/ic_dual_screen.pngbin0 -> 849 bytes
-rwxr-xr-x[-rw-r--r--]res/values-zh-rCN/strings.xml8
-rwxr-xr-x[-rw-r--r--]res/values/strings.xml8
-rwxr-xr-x[-rw-r--r--]res/xml/display_settings.xml6
-rwxr-xr-xres/xml/dualscreen.xml10
-rwxr-xr-xsrc/com/android/settings/Settings.java1
-rwxr-xr-xsrc/com/android/settings/SettingsActivity.java4
-rwxr-xr-xsrc/com/android/settings/dualscreen/DualscreenSettings.java202
9 files changed, 256 insertions, 1 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 9ec3d30..021ae1d 100755
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -1868,6 +1868,24 @@
<meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
android:value="true" />
</activity>
+
+ <!-- add by wgh-->
+ <activity android:name="Settings$DualscreenSettingsActivity"
+ android:label="@string/dualscreen_setting"
+ android:taskAffinity="">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <action android:name="android.settings.DREAM_SETTINGS" />
+ <category android:name="android.intent.category.DEFAULT" />
+ <category android:name="com.android.settings.SHORTCUT" />
+ </intent-filter>
+ <meta-data android:name="com.android.settings.FRAGMENT_CLASS"
+ android:value="com.android.settings.dualscreen.DualscreenSettings" />
+ <meta-data android:name="com.android.settings.TOP_LEVEL_HEADER_ID"
+ android:resource="@id/display_settings" />
+ <meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
+ android:value="true" />
+ </activity>
<activity android:name="Settings$UserSettingsActivity"
android:label="@string/user_settings_title"
diff --git a/res/drawable-mdpi/ic_dual_screen.png b/res/drawable-mdpi/ic_dual_screen.png
new file mode 100755
index 0000000..1ff9cbc
--- /dev/null
+++ b/res/drawable-mdpi/ic_dual_screen.png
Binary files differ
diff --git a/res/values-zh-rCN/strings.xml b/res/values-zh-rCN/strings.xml
index f2c595a..6502f22 100644..100755
--- a/res/values-zh-rCN/strings.xml
+++ b/res/values-zh-rCN/strings.xml
@@ -2539,6 +2539,14 @@
<string name="screenshot_version">截屏管理器版本</string>
<string name="screenshot_storage_title">设置截屏图片存储位置</string>
<string name="later">秒以后截屏</string>
+
+ <!-- dual screen but different contents-->
+ <string name="dualscreen_setting">双屏显示</string>
+ <string name="dualscreen_manual">双屏显示手册</string>
+ <string name="dualscreen_settings_title">双屏显示</string>
+ <string name="dualscreen_manual_summary">"启用此功能,如果有连接hdmi,您可以在平板和电视两个屏幕上运行不同的应用,比如说您可以在电视上播放视频,而平板上运行其它应用程序。
+ \n\n两屏显示模式切换:\n <ul>\n两屏显示不同内容:\n 手指触摸屏幕左边50个像素区域快速向右滑动或者触摸屏幕右边50个像素区域快速向左滑动,焦点应用窗口就只在电视上显示,而平板上可以操作其它的应用程序。
+ \n\n两屏显示相同内容:\n 状态栏上有一个同步的按钮(在最近打开应用程序图标的右边),点击按钮即可让两屏显示相同内容。</ul>"</string>
<!-- ethernet settings by blb-->
<string name="ethernet_settings">以太网</string>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 240e0ff..d59c17c 100644..100755
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -6081,6 +6081,14 @@
<string name="screenshot_storage_title">Set the location of screenshot storage</string>
<string name="later">s later capture</string>
+ <!-- dual screen but different contents-->
+ <string name="dualscreen_setting">Dual-Screen</string>
+ <string name="dualscreen_manual">Dual-Screen Manual</string>
+ <string name="dualscreen_settings_title">Dual screen</string>
+ <string name="dualscreen_manual_summary">"When this feature is turned on,If the pad have connected to the HDMI,you can run different applications in pad and TV two screens,for example, you can play video on TV, and run other applications on pad.
+ \n\nThe switching of two display mode:\n <ul>\nShow different content on two screen:\n Touch screen on the left side of the 50 pixel region and fast slide to the right or touch screen on the right side of the 50 pixel region and fast slide to the left, the focus application window will only display on TV, and the pad can operate other applications.
+ \n\nShow same content on two screen:\n There is a simultaneous button on the status bar (right of the recently application icon), click on the button to make the two screen display the same content.</ul>"</string>
+
<!-- ethernet settings by blb-->
<string name="ethernet_settings">Ethernet</string>
<string name="ethernet_connect">Connect</string>
diff --git a/res/xml/display_settings.xml b/res/xml/display_settings.xml
index fc4f3b4..b975659 100644..100755
--- a/res/xml/display_settings.xml
+++ b/res/xml/display_settings.xml
@@ -113,6 +113,12 @@
android:targetPackage="com.android.settings"
android:targetClass="com.android.settings.screen.ScreenScaleActivity" />
</Preference>
+ <!-- add by wgh-->
+ <PreferenceScreen
+ android:key="dualscreen"
+ android:title="@string/dualscreen_setting"
+ android:fragment="com.android.settings.dualscreen.DualscreenSettings" />
+
<ListPreference
android:key="main_screen_interface"/>
diff --git a/res/xml/dualscreen.xml b/res/xml/dualscreen.xml
new file mode 100755
index 0000000..0dca3eb
--- /dev/null
+++ b/res/xml/dualscreen.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" >
+
+ <PreferenceScreen
+ android:key="dualscreen_manual"
+ android:fragment="com.android.settings.dualscreen.DualScreenSettings$ToggleDualScreenManualPreferenceFragment"
+ android:title="@string/dualscreen_manual"
+ />
+
+</PreferenceScreen>
diff --git a/src/com/android/settings/Settings.java b/src/com/android/settings/Settings.java
index 6795e31..92f5e1e 100755
--- a/src/com/android/settings/Settings.java
+++ b/src/com/android/settings/Settings.java
@@ -104,5 +104,6 @@ public class Settings extends SettingsActivity {
public static class HdmiSettingsActivity extends SettingsActivity { /* empty */ }
public static class ScreenshotSettingsActivity extends SettingsActivity { /* empty */ }
public static class UsbConnectSettingsActivity extends SettingsActivity { /* empty */ }
+ public static class DualscreenSettingsActivity extends SettingsActivity { /* empty */ }
}
diff --git a/src/com/android/settings/SettingsActivity.java b/src/com/android/settings/SettingsActivity.java
index b2fa3b1..611984f 100755
--- a/src/com/android/settings/SettingsActivity.java
+++ b/src/com/android/settings/SettingsActivity.java
@@ -115,6 +115,7 @@ import com.android.settings.wifi.p2p.WifiP2pSettings;
import com.android.settings.HdmiSettings;
import com.android.settings.ScreenshotSetting;
import com.android.settings.UsbSetting;
+import com.android.settings.dualscreen.DualscreenSettings;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
@@ -312,7 +313,8 @@ public class SettingsActivity extends Activity
ApnSettings.class.getName(),
HdmiSettings.class.getName(),
ScreenshotSetting.class.getName(),
- UsbSetting.class.getName()
+ UsbSetting.class.getName(),
+ DualscreenSettings.class.getName()
};
diff --git a/src/com/android/settings/dualscreen/DualscreenSettings.java b/src/com/android/settings/dualscreen/DualscreenSettings.java
new file mode 100755
index 0000000..588cd29
--- /dev/null
+++ b/src/com/android/settings/dualscreen/DualscreenSettings.java
@@ -0,0 +1,202 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * 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.android.settings.dualscreen;
+
+import android.app.Activity;
+import android.app.Dialog;
+import android.app.DialogFragment;
+import android.app.Fragment;
+import android.content.ContentResolver;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.content.pm.PackageManager;
+import android.database.DataSetObserver;
+import android.graphics.drawable.Drawable;
+import android.os.Bundle;
+import android.preference.Preference;
+import android.preference.PreferenceActivity;
+import android.preference.PreferenceFragment;
+import android.preference.PreferenceGroupAdapter;
+import android.text.TextUtils;
+import android.util.Log;
+import android.view.LayoutInflater;
+import android.view.Menu;
+import android.view.MenuInflater;
+import android.view.MenuItem;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.Button;
+import android.widget.ListAdapter;
+import android.widget.ListView;
+import android.widget.Switch;
+import android.widget.TextView;
+import android.database.ContentObserver;
+import android.os.Handler;
+import android.provider.Settings;
+import android.app.ActivityManagerNative;
+import android.app.IActivityManager;
+import android.content.res.Configuration;
+import android.os.RemoteException;
+import com.android.settings.R;
+import android.view.Gravity;
+
+import com.android.settings.SettingsActivity;
+import com.android.settings.SettingsPreferenceFragment;
+import com.android.settings.widget.SwitchBar;
+
+
+public class DualscreenSettings extends SettingsPreferenceFragment implements SwitchBar.OnSwitchChangeListener {
+ private static final String TAG = DualscreenSettings.class.getSimpleName();
+ static final boolean DEBUG = true;
+
+ private static final String KEY_DUALSCREEN_MANUAL = "dualscreen_manual";
+ private boolean mOpened;
+
+ private final String store_key = Settings.System.DUAL_SCREEN_MODE;
+ private final String icon_key = Settings.System.DUAL_SCREEN_ICON_USED;
+
+ private final int DUAL_SCREEN_CLOSE = 0;
+ private final int DUAL_SCREEN_OPEN = 1;
+
+ private Context mContext;
+ private SwitchBar mSwitchBar;
+
+ @Override
+ public void onAttach(Activity activity) {
+ logd("onAttach(%s)", activity.getClass().getSimpleName());
+ super.onAttach(activity);
+ mContext = activity;
+ }
+
+ @Override
+ public void onCreate(Bundle icicle) {
+ logd("onCreate(%s)", icicle);
+ super.onCreate(icicle);
+
+ //mManual = (PreferenceScreen)findPreference(KEY_DUALSCREEN_MANUAL);
+ }
+
+ @Override
+ public void onSwitchChanged(Switch switchView, boolean isChecked) {
+ logd("-----------------------------isChecked:"+isChecked);
+ int value = DUAL_SCREEN_CLOSE;
+
+ mContext.getContentResolver().unregisterContentObserver(mValueObserver);
+ mContext.getContentResolver().registerContentObserver(Settings.System.getUriFor(store_key), false, mValueObserver);
+ if (isChecked) {
+ value = DUAL_SCREEN_OPEN;
+ } else {
+ Settings.System.putInt(mContext.getContentResolver(), icon_key, 0);
+ }
+ Settings.System.putInt(mContext.getContentResolver(), store_key, value);
+ handleStateChanged(value);
+ }
+
+ @Override
+ public void onStart() {
+ logd("onStart()");
+ super.onStart();
+ }
+
+ @Override
+ public void onDestroyView() {
+ logd("onDestroyView()");
+ super.onDestroyView();
+
+ mSwitchBar.removeOnSwitchChangeListener(this);
+ mSwitchBar.hide();
+ }
+
+ @Override
+ public void onActivityCreated(Bundle savedInstanceState) {
+ logd("onActivityCreated(%s)", savedInstanceState);
+ super.onActivityCreated(savedInstanceState);
+
+ ListView listView = getListView();
+ listView.setItemsCanFocus(true);
+
+ TextView emptyView = (TextView) getView().findViewById(android.R.id.empty);
+ emptyView.setText(R.string.dualscreen_manual_summary);
+ emptyView.setTextSize(24);
+ emptyView.setGravity(Gravity.LEFT);
+ listView.setEmptyView(emptyView);
+
+ final SettingsActivity sa = (SettingsActivity) getActivity();
+ mSwitchBar = sa.getSwitchBar();
+ mSwitchBar.addOnSwitchChangeListener(this);
+ mSwitchBar.show();
+ }
+
+ @Override
+ public void onPause() {
+ logd("onPause()");
+ super.onPause();
+
+ mContext.getContentResolver().unregisterContentObserver(mValueObserver);
+ }
+
+ @Override
+ public void onResume() {
+ logd("onResume()");
+ super.onResume();
+ handleStateChanged(getDualScreenValue());
+ mContext.getContentResolver().registerContentObserver(Settings.System.getUriFor(store_key), false, mValueObserver);
+ }
+
+ private int getDualScreenValue(){
+ return Settings.System.getInt(mContext.getContentResolver(), store_key, DUAL_SCREEN_CLOSE);
+ }
+
+ void handleStateChanged(int state) {
+ switch (state) {
+ case DUAL_SCREEN_CLOSE:
+ mSwitchBar.setChecked(false);
+ break;
+ case DUAL_SCREEN_OPEN:
+ mSwitchBar.setChecked(true);
+ break;
+ }
+ }
+
+ private final ContentObserver mValueObserver = new ContentObserver(new Handler()) {
+ @Override
+ public void onChange(boolean selfChange) {
+ final boolean enable = (DUAL_SCREEN_CLOSE != getDualScreenValue());
+ Log.d(TAG, "onchagne enable=" + enable + ", selfChange=" + selfChange);
+
+ try {
+ IActivityManager am = ActivityManagerNative.getDefault();
+ Configuration config = am.getConfiguration();
+
+ // Will set userSetLocale to indicate this isn't some passing default - the user
+ // wants this remembered
+ config.setDualScreenFlag(enable);
+
+ am.updateConfiguration(config);
+
+ } catch (RemoteException e) {
+ // Intentionally left blank
+ }
+ }
+ };
+
+ private static void logd(String msg, Object... args) {
+ if (DEBUG)
+ Log.d(TAG, args == null || args.length == 0 ? msg : String.format(msg, args));
+ }
+
+}