trying to fix wrong action mode offset

This commit is contained in:
Mariotaku Lee 2015-09-30 18:24:29 +08:00
parent 68039a10ec
commit 970877fdd5
6 changed files with 319 additions and 150 deletions

View File

@ -1,65 +1,64 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.mariotaku.twidere"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
package="org.mariotaku.twidere"
android:installLocation="auto"> android:installLocation="auto">
<uses-sdk/> <uses-sdk />
<uses-feature <uses-feature
android:name="android.hardware.camera" android:name="android.hardware.camera"
android:required="false"/> android:required="false" />
<uses-feature <uses-feature
android:name="android.hardware.location" android:name="android.hardware.location"
android:required="false"/> android:required="false" />
<uses-feature <uses-feature
android:name="android.hardware.location.gps" android:name="android.hardware.location.gps"
android:required="false"/> android:required="false" />
<uses-feature <uses-feature
android:name="android.hardware.location.network" android:name="android.hardware.location.network"
android:required="false"/> android:required="false" />
<uses-feature <uses-feature
android:name="android.hardware.touchscreen" android:name="android.hardware.touchscreen"
android:required="false"/> android:required="false" />
<uses-feature <uses-feature
android:name="android.hardware.nfc" android:name="android.hardware.nfc"
android:required="false"/> android:required="false" />
<uses-feature <uses-feature
android:glEsVersion="0x00020000" android:glEsVersion="0x00020000"
android:required="true"/> android:required="true" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.VIBRATE"/> <uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.NFC"/> <uses-permission android:name="android.permission.NFC" />
<uses-permission android:name="org.mariotaku.twidere.permission.SHORTEN_STATUS"/> <uses-permission android:name="org.mariotaku.twidere.permission.SHORTEN_STATUS" />
<uses-permission android:name="org.mariotaku.twidere.permission.UPLOAD_MEDIA"/> <uses-permission android:name="org.mariotaku.twidere.permission.UPLOAD_MEDIA" />
<uses-permission android:name="org.mariotaku.twidere.permission.SYNC_TIMELINE"/> <uses-permission android:name="org.mariotaku.twidere.permission.SYNC_TIMELINE" />
<permission-group <permission-group
android:name="org.mariotaku.twidere.permission.PERMISSION_GROUP" android:name="org.mariotaku.twidere.permission.PERMISSION_GROUP"
android:label="@string/app_name"/> android:label="@string/app_name" />
<permission <permission
android:name="org.mariotaku.twidere.permission.SHORTEN_STATUS" android:name="org.mariotaku.twidere.permission.SHORTEN_STATUS"
android:description="@string/permission_description_shorten_status" android:description="@string/permission_description_shorten_status"
android:label="@string/permission_label_shorten_status" android:label="@string/permission_label_shorten_status"
android:permissionGroup="org.mariotaku.twidere.permission.PERMISSION_GROUP"/> android:permissionGroup="org.mariotaku.twidere.permission.PERMISSION_GROUP" />
<permission <permission
android:name="org.mariotaku.twidere.permission.UPLOAD_MEDIA" android:name="org.mariotaku.twidere.permission.UPLOAD_MEDIA"
android:description="@string/permission_description_upload_media" android:description="@string/permission_description_upload_media"
android:label="@string/permission_label_upload_media" android:label="@string/permission_label_upload_media"
android:permissionGroup="org.mariotaku.twidere.permission.PERMISSION_GROUP"/> android:permissionGroup="org.mariotaku.twidere.permission.PERMISSION_GROUP" />
<permission <permission
android:name="org.mariotaku.twidere.permission.SYNC_TIMELINE" android:name="org.mariotaku.twidere.permission.SYNC_TIMELINE"
android:description="@string/permission_description_sync_timeline" android:description="@string/permission_description_sync_timeline"
android:label="@string/permission_label_sync_timeline" android:label="@string/permission_label_sync_timeline"
android:permissionGroup="org.mariotaku.twidere.permission.PERMISSION_GROUP"/> android:permissionGroup="org.mariotaku.twidere.permission.PERMISSION_GROUP" />
<application <application
android:name=".app.TwidereApplication" android:name=".app.TwidereApplication"
@ -73,29 +72,29 @@
tools:ignore="UnusedAttribute"> tools:ignore="UnusedAttribute">
<uses-library <uses-library
android:name="com.sec.android.app.multiwindow" android:name="com.sec.android.app.multiwindow"
android:required="false"/> android:required="false" />
<meta-data <meta-data
android:name="com.google.android.backup.api_key" android:name="com.google.android.backup.api_key"
android:value="AEdPqrEAAAAIKbKATV1AGbLB4kem3w8QaPVJSPVVumbMHxkfwA"/> android:value="AEdPqrEAAAAIKbKATV1AGbLB4kem3w8QaPVJSPVVumbMHxkfwA" />
<meta-data <meta-data
android:name="com.sec.android.support.multiwindow" android:name="com.sec.android.support.multiwindow"
android:value="true"/> android:value="true" />
<meta-data <meta-data
android:name="com.sec.android.multiwindow.DEFAULT_SIZE_W" android:name="com.sec.android.multiwindow.DEFAULT_SIZE_W"
android:value="480dp"/> android:value="480dp" />
<meta-data <meta-data
android:name="com.sec.android.multiwindow.DEFAULT_SIZE_H" android:name="com.sec.android.multiwindow.DEFAULT_SIZE_H"
android:value="640dp"/> android:value="640dp" />
<meta-data <meta-data
android:name="com.sec.android.multiwindow.MINIMUM_SIZE_W" android:name="com.sec.android.multiwindow.MINIMUM_SIZE_W"
android:value="240dp"/> android:value="240dp" />
<meta-data <meta-data
android:name="com.sec.android.multiwindow.MINIMUM_SIZE_H" android:name="com.sec.android.multiwindow.MINIMUM_SIZE_H"
android:value="320dp"/> android:value="320dp" />
<meta-data <meta-data
android:name="override_tinted_status_bar_defaults" android:name="override_tinted_status_bar_defaults"
android:value="true"/> android:value="true" />
<activity <activity
android:name=".activity.MainActivity" android:name=".activity.MainActivity"
@ -105,11 +104,11 @@
android:theme="@style/Theme.Launcher" android:theme="@style/Theme.Launcher"
android:windowSoftInputMode="adjustNothing"> android:windowSoftInputMode="adjustNothing">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN"/> <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER"/> <category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/> <category android:name="android.intent.category.MULTIWINDOW_LAUNCHER" />
<category android:name="android.intent.category.DEFAULT"/> <category android:name="android.intent.category.DEFAULT" />
</intent-filter> </intent-filter>
</activity> </activity>
<activity <activity
@ -121,11 +120,11 @@
android:theme="@style/Theme.Launcher" android:theme="@style/Theme.Launcher"
android:windowSoftInputMode="adjustResize"> android:windowSoftInputMode="adjustResize">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN"/> <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER"/> <category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/> <category android:name="android.intent.category.MULTIWINDOW_LAUNCHER" />
<category android:name="android.intent.category.DEFAULT"/> <category android:name="android.intent.category.DEFAULT" />
</intent-filter> </intent-filter>
</activity> </activity>
<activity <activity
@ -135,22 +134,22 @@
android:theme="@style/Theme.Twidere.Dark.NoActionBar" android:theme="@style/Theme.Twidere.Dark.NoActionBar"
android:windowSoftInputMode="adjustResize"> android:windowSoftInputMode="adjustResize">
<intent-filter> <intent-filter>
<action android:name="org.mariotaku.twidere.HOME"/> <action android:name="org.mariotaku.twidere.HOME" />
<category android:name="android.intent.category.DEFAULT"/> <category android:name="android.intent.category.DEFAULT" />
</intent-filter> </intent-filter>
<intent-filter> <intent-filter>
<action android:name="android.intent.action.SEARCH"/> <action android:name="android.intent.action.SEARCH" />
<category android:name="android.intent.category.DEFAULT"/> <category android:name="android.intent.category.DEFAULT" />
</intent-filter> </intent-filter>
<meta-data <meta-data
android:name="android.app.searchable" android:name="android.app.searchable"
android:resource="@xml/searchable"/> android:resource="@xml/searchable" />
<meta-data <meta-data
android:name="android.app.default_searchable" android:name="android.app.default_searchable"
android:value=".activity.support.HomeActivity"/> android:value=".activity.support.HomeActivity" />
</activity> </activity>
<activity <activity
android:name=".activity.support.ComposeActivity" android:name=".activity.support.ComposeActivity"
@ -160,29 +159,29 @@
android:theme="@style/Theme.Twidere.Dark.Dialog" android:theme="@style/Theme.Twidere.Dark.Dialog"
android:windowSoftInputMode="adjustResize"> android:windowSoftInputMode="adjustResize">
<intent-filter android:label="@string/compose"> <intent-filter android:label="@string/compose">
<action android:name="android.intent.action.MAIN"/> <action android:name="android.intent.action.MAIN" />
<action android:name="org.mariotaku.twidere.COMPOSE"/> <action android:name="org.mariotaku.twidere.COMPOSE" />
<action android:name="org.mariotaku.twidere.REPLY"/> <action android:name="org.mariotaku.twidere.REPLY" />
<action android:name="org.mariotaku.twidere.QUOTE"/> <action android:name="org.mariotaku.twidere.QUOTE" />
<action android:name="org.mariotaku.twidere.EDIT_DRAFT"/> <action android:name="org.mariotaku.twidere.EDIT_DRAFT" />
<action android:name="org.mariotaku.twidere.MENTION"/> <action android:name="org.mariotaku.twidere.MENTION" />
<action android:name="org.mariotaku.twidere.REPLY_MULTIPLE"/> <action android:name="org.mariotaku.twidere.REPLY_MULTIPLE" />
<category android:name="android.intent.category.DEFAULT"/> <category android:name="android.intent.category.DEFAULT" />
</intent-filter> </intent-filter>
<intent-filter android:label="@string/app_name"> <intent-filter android:label="@string/app_name">
<action android:name="android.intent.action.SEND"/> <action android:name="android.intent.action.SEND" />
<action android:name="android.intent.action.SEND_MULTIPLE"/> <action android:name="android.intent.action.SEND_MULTIPLE" />
<category android:name="android.intent.category.DEFAULT"/> <category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/*"/> <data android:mimeType="image/*" />
<data android:mimeType="text/plain"/> <data android:mimeType="text/plain" />
</intent-filter> </intent-filter>
<meta-data <meta-data
android:name="android.support.PARENT_ACTIVITY" android:name="android.support.PARENT_ACTIVITY"
android:value=".activity.support.HomeActivity"/> android:value=".activity.support.HomeActivity" />
</activity> </activity>
<activity <activity
android:name=".activity.support.QuickSearchBarActivity" android:name=".activity.support.QuickSearchBarActivity"
@ -191,9 +190,9 @@
android:theme="@style/Theme.Twidere.Dark.Dialog" android:theme="@style/Theme.Twidere.Dark.Dialog"
android:windowSoftInputMode="adjustResize"> android:windowSoftInputMode="adjustResize">
<intent-filter> <intent-filter>
<action android:name="org.mariotaku.twidere.GLOBAL_SEARCH"/> <action android:name="org.mariotaku.twidere.GLOBAL_SEARCH" />
<category android:name="android.intent.category.DEFAULT"/> <category android:name="android.intent.category.DEFAULT" />
</intent-filter> </intent-filter>
</activity> </activity>
<activity <activity
@ -202,9 +201,9 @@
android:theme="@style/Theme.Twidere.Dark.DialogWhenLarge.NoActionBar" android:theme="@style/Theme.Twidere.Dark.DialogWhenLarge.NoActionBar"
android:windowSoftInputMode="adjustResize"> android:windowSoftInputMode="adjustResize">
<intent-filter> <intent-filter>
<action android:name="org.mariotaku.twidere.TWITTER_LOGIN"/> <action android:name="org.mariotaku.twidere.TWITTER_LOGIN" />
<category android:name="android.intent.category.DEFAULT"/> <category android:name="android.intent.category.DEFAULT" />
</intent-filter> </intent-filter>
</activity> </activity>
<activity <activity
@ -213,9 +212,9 @@
android:theme="@style/Theme.Twidere.Dark.Dialog" android:theme="@style/Theme.Twidere.Dark.Dialog"
android:windowSoftInputMode="adjustResize"> android:windowSoftInputMode="adjustResize">
<intent-filter> <intent-filter>
<action android:name="org.mariotaku.twidere.TWITTER_BROWSER_LOGIN"/> <action android:name="org.mariotaku.twidere.TWITTER_BROWSER_LOGIN" />
<category android:name="android.intent.category.DEFAULT"/> <category android:name="android.intent.category.DEFAULT" />
</intent-filter> </intent-filter>
</activity> </activity>
<activity <activity
@ -224,50 +223,50 @@
android:theme="@style/Theme.Twidere.Dark" android:theme="@style/Theme.Twidere.Dark"
android:windowSoftInputMode="adjustResize"> android:windowSoftInputMode="adjustResize">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MANAGE_NETWORK_USAGE"/> <action android:name="android.intent.action.MANAGE_NETWORK_USAGE" />
<action android:name="org.mariotaku.twidere.SETTINGS"/> <action android:name="org.mariotaku.twidere.SETTINGS" />
<category android:name="android.intent.category.DEFAULT"/> <category android:name="android.intent.category.DEFAULT" />
</intent-filter> </intent-filter>
<meta-data <meta-data
android:name="android.support.PARENT_ACTIVITY" android:name="android.support.PARENT_ACTIVITY"
android:value=".activity.support.HomeActivity"/> android:value=".activity.support.HomeActivity" />
</activity> </activity>
<activity <activity
android:name=".activity.support.APIEditorActivity" android:name=".activity.support.APIEditorActivity"
android:label="@string/edit_api" android:label="@string/edit_api"
android:theme="@style/Theme.Twidere.Dark.Dialog" android:theme="@style/Theme.Twidere.Dark.Dialog"
android:windowSoftInputMode="adjustResize"/> android:windowSoftInputMode="adjustResize" />
<activity <activity
android:name=".activity.support.AccountSelectorActivity" android:name=".activity.support.AccountSelectorActivity"
android:label="@string/select_account" android:label="@string/select_account"
android:theme="@style/Theme.Twidere.Dark.Dialog"> android:theme="@style/Theme.Twidere.Dark.Dialog">
<intent-filter> <intent-filter>
<action android:name="org.mariotaku.twidere.SELECT_ACCOUNT"/> <action android:name="org.mariotaku.twidere.SELECT_ACCOUNT" />
<category android:name="android.intent.category.DEFAULT"/> <category android:name="android.intent.category.DEFAULT" />
</intent-filter> </intent-filter>
</activity> </activity>
<activity <activity
android:name=".activity.support.ColorPickerDialogActivity" android:name=".activity.support.ColorPickerDialogActivity"
android:label="@string/set_color" android:label="@string/set_color"
android:theme="@style/Theme.Twidere.Light.NoDisplay"/> android:theme="@style/Theme.Twidere.Light.NoDisplay" />
<activity <activity
android:name=".activity.support.LinkHandlerActivity" android:name=".activity.support.LinkHandlerActivity"
android:theme="@style/Theme.Twidere.Dark.DialogWhenLarge.NoActionBar" android:theme="@style/Theme.Twidere.Dark.DialogWhenLarge.NoActionBar"
android:windowSoftInputMode="adjustResize"> android:windowSoftInputMode="adjustResize">
<meta-data <meta-data
android:name="android.support.PARENT_ACTIVITY" android:name="android.support.PARENT_ACTIVITY"
android:value=".activity.support.HomeActivity"/> android:value=".activity.support.HomeActivity" />
<intent-filter> <intent-filter>
<action android:name="android.intent.action.VIEW"/> <action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE"/> <category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT"/> <category android:name="android.intent.category.DEFAULT" />
<data android:scheme="twidere"/> <data android:scheme="twidere" />
</intent-filter> </intent-filter>
</activity> </activity>
<activity <activity
@ -278,14 +277,14 @@
android:launchMode="singleTop" android:launchMode="singleTop"
android:theme="@style/Theme.Twidere.Viewer"> android:theme="@style/Theme.Twidere.Viewer">
<intent-filter> <intent-filter>
<action android:name="org.mariotaku.twidere.VIEW_MEDIA"/> <action android:name="org.mariotaku.twidere.VIEW_MEDIA" />
<category android:name="android.intent.category.DEFAULT"/> <category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE"/> <category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="http"/> <data android:scheme="http" />
<data android:scheme="https"/> <data android:scheme="https" />
<data android:scheme="file"/> <data android:scheme="file" />
</intent-filter> </intent-filter>
</activity> </activity>
<activity <activity
@ -295,10 +294,10 @@
android:theme="@style/Theme.Twidere.Light.NoDisplay" android:theme="@style/Theme.Twidere.Light.NoDisplay"
android:windowSoftInputMode="adjustResize"> android:windowSoftInputMode="adjustResize">
<intent-filter> <intent-filter>
<action android:name="org.mariotaku.twidere.PICK_FILE"/> <action android:name="org.mariotaku.twidere.PICK_FILE" />
<action android:name="org.mariotaku.twidere.PICK_DIRECTORY"/> <action android:name="org.mariotaku.twidere.PICK_DIRECTORY" />
<category android:name="android.intent.category.DEFAULT"/> <category android:name="android.intent.category.DEFAULT" />
</intent-filter> </intent-filter>
</activity> </activity>
<activity <activity
@ -307,11 +306,11 @@
android:theme="@style/Theme.Twidere.Light.NoDisplay" android:theme="@style/Theme.Twidere.Light.NoDisplay"
android:windowSoftInputMode="adjustResize"> android:windowSoftInputMode="adjustResize">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN"/> <action android:name="android.intent.action.MAIN" />
<action android:name="org.mariotaku.twidere.PICK_IMAGE"/> <action android:name="org.mariotaku.twidere.PICK_IMAGE" />
<action android:name="org.mariotaku.twidere.TAKE_PHOTO"/> <action android:name="org.mariotaku.twidere.TAKE_PHOTO" />
<category android:name="android.intent.category.DEFAULT"/> <category android:name="android.intent.category.DEFAULT" />
</intent-filter> </intent-filter>
</activity> </activity>
<activity <activity
@ -321,10 +320,10 @@
android:theme="@style/Theme.Twidere.Dark.Dialog" android:theme="@style/Theme.Twidere.Dark.Dialog"
android:windowSoftInputMode="adjustResize"> android:windowSoftInputMode="adjustResize">
<intent-filter> <intent-filter>
<action android:name="org.mariotaku.twidere.ADD_TAB"/> <action android:name="org.mariotaku.twidere.ADD_TAB" />
<action android:name="org.mariotaku.twidere.EDIT_TAB"/> <action android:name="org.mariotaku.twidere.EDIT_TAB" />
<category android:name="android.intent.category.DEFAULT"/> <category android:name="android.intent.category.DEFAULT" />
</intent-filter> </intent-filter>
</activity> </activity>
<activity <activity
@ -332,9 +331,9 @@
android:label="@string/compose" android:label="@string/compose"
android:theme="@style/Theme.Twidere.Dark.NoDisplay"> android:theme="@style/Theme.Twidere.Dark.NoDisplay">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.CREATE_SHORTCUT"/> <action android:name="android.intent.action.CREATE_SHORTCUT" />
<category android:name="android.intent.category.DEFAULT"/> <category android:name="android.intent.category.DEFAULT" />
</intent-filter> </intent-filter>
</activity> </activity>
<activity <activity
@ -342,9 +341,9 @@
android:label="@string/permissions_request" android:label="@string/permissions_request"
android:theme="@style/Theme.Twidere.Dark.Dialog"> android:theme="@style/Theme.Twidere.Dark.Dialog">
<intent-filter> <intent-filter>
<action android:name="org.mariotaku.twidere.REQUEST_PERMISSIONS"/> <action android:name="org.mariotaku.twidere.REQUEST_PERMISSIONS" />
<category android:name="android.intent.category.DEFAULT"/> <category android:name="android.intent.category.DEFAULT" />
</intent-filter> </intent-filter>
</activity> </activity>
<activity <activity
@ -352,31 +351,31 @@
android:label="@string/select_user_list" android:label="@string/select_user_list"
android:theme="@style/Theme.Twidere.Dark.Dialog"> android:theme="@style/Theme.Twidere.Dark.Dialog">
<intent-filter> <intent-filter>
<action android:name="org.mariotaku.twidere.SELECT_USER"/> <action android:name="org.mariotaku.twidere.SELECT_USER" />
<action android:name="org.mariotaku.twidere.SELECT_USER_LIST"/> <action android:name="org.mariotaku.twidere.SELECT_USER_LIST" />
<category android:name="android.intent.category.DEFAULT"/> <category android:name="android.intent.category.DEFAULT" />
</intent-filter> </intent-filter>
</activity> </activity>
<activity <activity
android:name=".activity.SettingsWizardActivity" android:name=".activity.SettingsWizardActivity"
android:label="@string/settings_wizard" android:label="@string/settings_wizard"
android:theme="@style/Theme.Twidere.Wizard"/> android:theme="@style/Theme.Twidere.Wizard" />
<activity <activity
android:name=".activity.support.DataExportActivity" android:name=".activity.support.DataExportActivity"
android:label="@string/export_settings" android:label="@string/export_settings"
android:theme="@android:style/Theme.NoDisplay"/> android:theme="@android:style/Theme.NoDisplay" />
<activity <activity
android:name=".activity.support.DataImportActivity" android:name=".activity.support.DataImportActivity"
android:label="@string/import_settings" android:label="@string/import_settings"
android:theme="@android:style/Theme.NoDisplay"/> android:theme="@android:style/Theme.NoDisplay" />
<activity <activity
android:name=".activity.support.ActivityPickerActivity" android:name=".activity.support.ActivityPickerActivity"
android:theme="@style/Theme.Twidere.Dark.Dialog"> android:theme="@style/Theme.Twidere.Dark.Dialog">
<intent-filter> <intent-filter>
<action android:name="org.mariotaku.twidere.PICK_ACTIVITY"/> <action android:name="org.mariotaku.twidere.PICK_ACTIVITY" />
<category android:name="android.intent.category.DEFAULT"/> <category android:name="android.intent.category.DEFAULT" />
</intent-filter> </intent-filter>
</activity> </activity>
<activity <activity
@ -388,33 +387,33 @@
<data <data
android:host="twitter.com" android:host="twitter.com"
android:pathPrefix="/" android:pathPrefix="/"
android:scheme="http"/> android:scheme="http" />
<data <data
android:host="twitter.com" android:host="twitter.com"
android:pathPrefix="/" android:pathPrefix="/"
android:scheme="https"/> android:scheme="https" />
<data <data
android:host="www.twitter.com" android:host="www.twitter.com"
android:pathPrefix="/" android:pathPrefix="/"
android:scheme="http"/> android:scheme="http" />
<data <data
android:host="www.twitter.com" android:host="www.twitter.com"
android:pathPrefix="/" android:pathPrefix="/"
android:scheme="https"/> android:scheme="https" />
<data <data
android:host="mobile.twitter.com" android:host="mobile.twitter.com"
android:pathPrefix="/" android:pathPrefix="/"
android:scheme="http"/> android:scheme="http" />
<data <data
android:host="mobile.twitter.com" android:host="mobile.twitter.com"
android:pathPrefix="/" android:pathPrefix="/"
android:scheme="https"/> android:scheme="https" />
<action android:name="android.intent.action.VIEW"/> <action android:name="android.intent.action.VIEW" />
<action android:name="android.nfc.action.NDEF_DISCOVERED"/> <action android:name="android.nfc.action.NDEF_DISCOVERED" />
<category android:name="android.intent.category.DEFAULT"/> <category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE"/> <category android:name="android.intent.category.BROWSABLE" />
</intent-filter> </intent-filter>
</activity> </activity>
<activity <activity
@ -424,18 +423,18 @@
android:taskAffinity=":twidere_assist_launcher" android:taskAffinity=":twidere_assist_launcher"
android:theme="@style/Theme.Launcher"> android:theme="@style/Theme.Launcher">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.ASSIST"/> <action android:name="android.intent.action.ASSIST" />
<category android:name="android.intent.category.DEFAULT"/> <category android:name="android.intent.category.DEFAULT" />
</intent-filter> </intent-filter>
<meta-data <meta-data
android:name="com.android.systemui.action_assist_icon" android:name="com.android.systemui.action_assist_icon"
android:resource="@drawable/ic_assist_twidere"/> android:resource="@drawable/ic_assist_twidere" />
</activity> </activity>
<activity <activity
android:name=".activity.KeyboardShortcutPreferenceCompatActivity" android:name=".activity.KeyboardShortcutPreferenceCompatActivity"
android:theme="@style/Theme.Twidere.Dark.Dialog"/> android:theme="@style/Theme.Twidere.Dark.Dialog" />
<activity <activity
android:name=".activity.TestActivity" android:name=".activity.TestActivity"
android:enabled="false" android:enabled="false"
@ -443,35 +442,35 @@
android:launchMode="singleTop" android:launchMode="singleTop"
android:windowSoftInputMode="adjustResize"> android:windowSoftInputMode="adjustResize">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN"/> <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER"/> <category android:name="android.intent.category.LAUNCHER" />
</intent-filter> </intent-filter>
</activity> </activity>
<activity <activity
android:name=".activity.NyanActivity" android:name=".activity.NyanActivity"
android:launchMode="singleTop" android:launchMode="singleTop"
android:theme="@style/Theme.Nyan" android:theme="@style/Theme.Nyan"
android:windowSoftInputMode="stateAlwaysHidden"/> android:windowSoftInputMode="stateAlwaysHidden" />
<activity <activity
android:name=".activity.UsageStatisticsActivity" android:name=".activity.UsageStatisticsActivity"
android:label="@string/usage_statistics" android:label="@string/usage_statistics"
android:theme="@android:style/Theme.NoDisplay"/> android:theme="@android:style/Theme.NoDisplay" />
<activity <activity
android:name=".activity.ImageCropperActivity" android:name=".activity.ImageCropperActivity"
android:label="@string/crop_image" android:label="@string/crop_image"
android:theme="@style/Theme.Twidere.Dark.NoActionBar" android:theme="@style/Theme.Twidere.Dark.NoActionBar"
android:windowSoftInputMode="adjustResize"/> android:windowSoftInputMode="adjustResize" />
<service <service
android:name=".service.RefreshService" android:name=".service.RefreshService"
android:label="@string/label_refresh_service"/> android:label="@string/label_refresh_service" />
<service <service
android:name=".service.StreamingService" android:name=".service.StreamingService"
android:label="@string/label_streaming_service"/> android:label="@string/label_streaming_service" />
<service <service
android:name=".service.BackgroundOperationService" android:name=".service.BackgroundOperationService"
android:label="@string/label_background_operation_service"/> android:label="@string/label_background_operation_service" />
<service <service
android:name=".nyan.NyanWallpaperService" android:name=".nyan.NyanWallpaperService"
android:enabled="false" android:enabled="false"
@ -481,12 +480,12 @@
android:permission="android.permission.BIND_WALLPAPER" android:permission="android.permission.BIND_WALLPAPER"
android:process=":wallpaper"> android:process=":wallpaper">
<intent-filter android:priority="1"> <intent-filter android:priority="1">
<action android:name="android.service.wallpaper.WallpaperService"/> <action android:name="android.service.wallpaper.WallpaperService" />
</intent-filter> </intent-filter>
<meta-data <meta-data
android:name="android.service.wallpaper" android:name="android.service.wallpaper"
android:resource="@xml/nyan_wallpaper"/> android:resource="@xml/nyan_wallpaper" />
</service> </service>
<service <service
android:name=".nyan.NyanDaydreamService" android:name=".nyan.NyanDaydreamService"
@ -497,7 +496,7 @@
android:process=":daydream" android:process=":daydream"
tools:ignore="ExportedService"> tools:ignore="ExportedService">
<intent-filter android:priority="1"> <intent-filter android:priority="1">
<action android:name="android.service.dreams.DreamService"/> <action android:name="android.service.dreams.DreamService" />
</intent-filter> </intent-filter>
</service> </service>
@ -507,38 +506,44 @@
android:exported="true" android:exported="true"
android:grantUriPermissions="true" android:grantUriPermissions="true"
android:label="@string/label_data_provider" android:label="@string/label_data_provider"
tools:ignore="ExportedContentProvider"/> tools:ignore="ExportedContentProvider" />
<provider <provider
android:name=".provider.TwidereCommandProvider" android:name=".provider.TwidereCommandProvider"
android:authorities="twidere.command" android:authorities="twidere.command"
android:exported="true" android:exported="true"
tools:ignore="ExportedContentProvider"/> tools:ignore="ExportedContentProvider" />
<provider <provider
android:name=".provider.RecentSearchProvider" android:name=".provider.RecentSearchProvider"
android:authorities="org.mariotaku.twidere.provider.SearchRecentSuggestions" android:authorities="org.mariotaku.twidere.provider.SearchRecentSuggestions"
tools:ignore="ExportedContentProvider"/> tools:ignore="ExportedContentProvider" />
<receiver android:name=".receiver.ConnectivityStateReceiver"> <receiver android:name=".receiver.ConnectivityStateReceiver">
<intent-filter> <intent-filter>
<action android:name="android.net.conn.CONNECTIVITY_CHANGE"/> <action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
</intent-filter> </intent-filter>
</receiver> </receiver>
<receiver <receiver
android:name=".receiver.NotificationReceiver" android:name=".receiver.NotificationReceiver"
android:exported="false"> android:exported="false">
<intent-filter> <intent-filter>
<action android:name="org.mariotaku.twidere.NOTIFICATION_DELETED"/> <action android:name="org.mariotaku.twidere.NOTIFICATION_DELETED" />
</intent-filter> </intent-filter>
</receiver> </receiver>
<receiver <receiver
android:name=".receiver.SecretCodeBroadcastReceiver" android:name=".receiver.SecretCodeBroadcastReceiver"
android:label="@string/twidere_test"> android:label="@string/twidere_test">
<intent-filter> <intent-filter>
<action android:name="android.provider.Telephony.SECRET_CODE"/> <action android:name="android.provider.Telephony.SECRET_CODE" />
<data <data
android:host="8943373" android:host="8943373"
android:scheme="android_secret_code"/> android:scheme="android_secret_code" />
</intent-filter>
</receiver>
<receiver android:name=".receiver.PowerStateReceiver">
<intent-filter>
<action android:name="android.intent.action.BATTERY_LOW" />
<action android:name="android.intent.action.BATTERY_OKAY" />
</intent-filter> </intent-filter>
</receiver> </receiver>

View File

@ -21,8 +21,10 @@ package edu.tsinghua.hotmobi;
import android.app.Application; import android.app.Application;
import android.content.Context; import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.location.Location; import android.location.Location;
import android.os.BatteryManager;
import android.text.TextUtils; import android.text.TextUtils;
import org.mariotaku.twidere.Constants; import org.mariotaku.twidere.Constants;
@ -40,6 +42,7 @@ import java.util.concurrent.Executor;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import edu.tsinghua.hotmobi.model.BatteryRecord;
import edu.tsinghua.hotmobi.model.LatLng; import edu.tsinghua.hotmobi.model.LatLng;
import edu.tsinghua.hotmobi.model.LinkEvent; import edu.tsinghua.hotmobi.model.LinkEvent;
import edu.tsinghua.hotmobi.model.MediaEvent; import edu.tsinghua.hotmobi.model.MediaEvent;
@ -89,6 +92,8 @@ public class HotMobiLogger {
return "network"; return "network";
} else if (event instanceof ScrollRecord) { } else if (event instanceof ScrollRecord) {
return "scroll"; return "scroll";
} else if (event instanceof BatteryRecord) {
return "battery";
} }
throw new UnsupportedOperationException("Unknown event type " + event); throw new UnsupportedOperationException("Unknown event type " + event);
} }
@ -141,6 +146,18 @@ public class HotMobiLogger {
return prefs.getLong(LAST_UPLOAD_TIME, -1); return prefs.getLong(LAST_UPLOAD_TIME, -1);
} }
public static void logPowerBroadcast(Context context, Intent intent) {
if (!intent.hasExtra(BatteryManager.EXTRA_LEVEL) || !intent.hasExtra(BatteryManager.EXTRA_SCALE) ||
!intent.hasExtra(BatteryManager.EXTRA_STATUS)) return;
final BatteryRecord record = new BatteryRecord();
record.setLevel(intent.getIntExtra(BatteryManager.EXTRA_LEVEL, -1) / (float)
intent.getIntExtra(BatteryManager.EXTRA_SCALE, -1));
record.setState(intent.getIntExtra(BatteryManager.EXTRA_STATUS, -1));
record.setTimestamp(System.currentTimeMillis());
record.setTimeOffset(TimeZone.getDefault().getRawOffset());
getInstance(context).log(record);
}
public void log(long accountId, final Object event) { public void log(long accountId, final Object event) {
mExecutor.execute(new WriteLogTask(mApplication, accountId, event)); mExecutor.execute(new WriteLogTask(mApplication, accountId, event));
} }

View File

@ -0,0 +1,81 @@
/*
* Twidere - Twitter client for Android
*
* Copyright (C) 2012-2015 Mariotaku Lee <mariotaku.lee@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package edu.tsinghua.hotmobi.model;
import com.bluelinelabs.logansquare.annotation.JsonField;
import com.bluelinelabs.logansquare.annotation.JsonObject;
/**
* Created by mariotaku on 15/9/28.
*/
@JsonObject
public class BatteryRecord {
@JsonField(name = "level")
float level;
@JsonField(name = "state")
int state;
@JsonField(name = "timestamp")
long timestamp;
@JsonField(name = "time_offset")
long timeOffset;
public long getTimeOffset() {
return timeOffset;
}
public void setTimeOffset(long timeOffset) {
this.timeOffset = timeOffset;
}
public long getTimestamp() {
return timestamp;
}
public void setTimestamp(long timestamp) {
this.timestamp = timestamp;
}
public float getLevel() {
return level;
}
public void setLevel(float level) {
this.level = level;
}
public int getState() {
return state;
}
public void setState(int state) {
this.state = state;
}
@Override
public String toString() {
return "BatteryRecord{" +
"level=" + level +
", state=" + state +
", timestamp=" + timestamp +
", timeOffset=" + timeOffset +
'}';
}
}

View File

@ -0,0 +1,36 @@
/*
* Twidere - Twitter client for Android
*
* Copyright (C) 2012-2015 Mariotaku Lee <mariotaku.lee@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.mariotaku.twidere.receiver;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import edu.tsinghua.hotmobi.HotMobiLogger;
/**
* Created by mariotaku on 15/9/29.
*/
public class PowerStateReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
HotMobiLogger.logPowerBroadcast(context, intent);
}
}

View File

@ -41,6 +41,8 @@ import org.mariotaku.twidere.util.SharedPreferencesWrapper;
import java.util.Arrays; import java.util.Arrays;
import edu.tsinghua.hotmobi.HotMobiLogger;
import static org.mariotaku.twidere.util.ParseUtils.parseInt; import static org.mariotaku.twidere.util.ParseUtils.parseInt;
import static org.mariotaku.twidere.util.Utils.getAccountIds; import static org.mariotaku.twidere.util.Utils.getAccountIds;
import static org.mariotaku.twidere.util.Utils.getDefaultAccountId; import static org.mariotaku.twidere.util.Utils.getDefaultAccountId;
@ -121,6 +123,13 @@ public class RefreshService extends Service implements Constants {
}; };
private final BroadcastReceiver mBatteryReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
HotMobiLogger.logPowerBroadcast(context, intent);
}
};
@Override @Override
public IBinder onBind(final Intent intent) { public IBinder onBind(final Intent intent) {
return null; return null;
@ -139,19 +148,27 @@ public class RefreshService extends Service implements Constants {
mPendingRefreshDirectMessagesIntent = PendingIntent.getBroadcast(this, 0, new Intent( mPendingRefreshDirectMessagesIntent = PendingIntent.getBroadcast(this, 0, new Intent(
BROADCAST_REFRESH_DIRECT_MESSAGES), 0); BROADCAST_REFRESH_DIRECT_MESSAGES), 0);
mPendingRefreshTrendsIntent = PendingIntent.getBroadcast(this, 0, new Intent(BROADCAST_REFRESH_TRENDS), 0); mPendingRefreshTrendsIntent = PendingIntent.getBroadcast(this, 0, new Intent(BROADCAST_REFRESH_TRENDS), 0);
final IntentFilter filter = new IntentFilter(BROADCAST_NOTIFICATION_DELETED); final IntentFilter refreshFilter = new IntentFilter(BROADCAST_NOTIFICATION_DELETED);
filter.addAction(BROADCAST_REFRESH_HOME_TIMELINE); refreshFilter.addAction(BROADCAST_REFRESH_HOME_TIMELINE);
filter.addAction(BROADCAST_REFRESH_MENTIONS); refreshFilter.addAction(BROADCAST_REFRESH_MENTIONS);
filter.addAction(BROADCAST_REFRESH_DIRECT_MESSAGES); refreshFilter.addAction(BROADCAST_REFRESH_DIRECT_MESSAGES);
filter.addAction(BROADCAST_RESCHEDULE_HOME_TIMELINE_REFRESHING); refreshFilter.addAction(BROADCAST_RESCHEDULE_HOME_TIMELINE_REFRESHING);
filter.addAction(BROADCAST_RESCHEDULE_MENTIONS_REFRESHING); refreshFilter.addAction(BROADCAST_RESCHEDULE_MENTIONS_REFRESHING);
filter.addAction(BROADCAST_RESCHEDULE_DIRECT_MESSAGES_REFRESHING); refreshFilter.addAction(BROADCAST_RESCHEDULE_DIRECT_MESSAGES_REFRESHING);
registerReceiver(mStateReceiver, filter); registerReceiver(mStateReceiver, refreshFilter);
final IntentFilter batteryFilter = new IntentFilter();
refreshFilter.addAction(Intent.ACTION_BATTERY_CHANGED);
refreshFilter.addAction(Intent.ACTION_BATTERY_OKAY);
refreshFilter.addAction(Intent.ACTION_BATTERY_LOW);
refreshFilter.addAction(Intent.ACTION_POWER_CONNECTED);
refreshFilter.addAction(Intent.ACTION_POWER_DISCONNECTED);
registerReceiver(mBatteryReceiver, batteryFilter);
startAutoRefresh(); startAutoRefresh();
} }
@Override @Override
public void onDestroy() { public void onDestroy() {
unregisterReceiver(mBatteryReceiver);
unregisterReceiver(mStateReceiver); unregisterReceiver(mStateReceiver);
if (hasAutoRefreshAccounts(this)) { if (hasAutoRefreshAccounts(this)) {
// Auto refresh enabled, so I will try to start service after it was // Auto refresh enabled, so I will try to start service after it was

View File

@ -21,6 +21,7 @@ package org.mariotaku.twidere.util;
import android.app.Activity; import android.app.Activity;
import android.content.Context; import android.content.Context;
import android.graphics.Rect;
import android.support.v4.view.ViewCompat; import android.support.v4.view.ViewCompat;
import android.support.v7.app.AppCompatCallback; import android.support.v7.app.AppCompatCallback;
import android.support.v7.internal.view.StandaloneActionMode; import android.support.v7.internal.view.StandaloneActionMode;
@ -38,6 +39,7 @@ import android.view.accessibility.AccessibilityEvent;
import android.widget.PopupWindow; import android.widget.PopupWindow;
import org.mariotaku.twidere.activity.iface.IThemedActivity; import org.mariotaku.twidere.activity.iface.IThemedActivity;
import org.mariotaku.twidere.fragment.iface.IBaseFragment;
import org.mariotaku.twidere.view.TintedStatusNativeActionModeAwareLayout; import org.mariotaku.twidere.view.TintedStatusNativeActionModeAwareLayout;
/** /**
@ -120,12 +122,13 @@ public class TwidereActionModeForChildListener implements TintedStatusNativeActi
mThemed.getCurrentThemeResourceId(), mThemed.getCurrentThemeColor(), mThemed.getCurrentThemeResourceId(), mThemed.getCurrentThemeColor(),
mThemed.getCurrentThemeBackgroundOption(), false); mThemed.getCurrentThemeBackgroundOption(), false);
mActionModePopup.setHeight(ViewGroup.LayoutParams.WRAP_CONTENT); mActionModePopup.setHeight(ViewGroup.LayoutParams.WRAP_CONTENT);
final int actionModeOffset = getActionModeOffset();
mShowActionModePopup = new Runnable() { mShowActionModePopup = new Runnable() {
@Override @Override
public void run() { public void run() {
mActionModePopup.showAtLocation( mActionModePopup.showAtLocation(
mWindow.getDecorView(), mWindow.getDecorView(),
Gravity.TOP | Gravity.FILL_HORIZONTAL, 0, 0); Gravity.TOP | Gravity.FILL_HORIZONTAL, 0, actionModeOffset);
} }
}; };
} }
@ -159,6 +162,16 @@ public class TwidereActionModeForChildListener implements TintedStatusNativeActi
return mActionMode; return mActionMode;
} }
private int getActionModeOffset() {
if (mActivity instanceof IBaseFragment.SystemWindowsInsetsCallback) {
final Rect insets = new Rect();
if (((IBaseFragment.SystemWindowsInsetsCallback) mActivity).getSystemWindowsInsets(insets)) {
return Utils.getInsetsTopWithoutActionBarHeight(mActivity, insets.top);
}
}
return 0;
}
public boolean finishExisting() { public boolean finishExisting() {
if (mActionMode != null) { if (mActionMode != null) {
mActionMode.finish(); mActionMode.finish();