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

View File

@ -21,8 +21,10 @@ package edu.tsinghua.hotmobi;
import android.app.Application;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.location.Location;
import android.os.BatteryManager;
import android.text.TextUtils;
import org.mariotaku.twidere.Constants;
@ -40,6 +42,7 @@ import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import edu.tsinghua.hotmobi.model.BatteryRecord;
import edu.tsinghua.hotmobi.model.LatLng;
import edu.tsinghua.hotmobi.model.LinkEvent;
import edu.tsinghua.hotmobi.model.MediaEvent;
@ -89,6 +92,8 @@ public class HotMobiLogger {
return "network";
} else if (event instanceof ScrollRecord) {
return "scroll";
} else if (event instanceof BatteryRecord) {
return "battery";
}
throw new UnsupportedOperationException("Unknown event type " + event);
}
@ -141,6 +146,18 @@ public class HotMobiLogger {
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) {
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 edu.tsinghua.hotmobi.HotMobiLogger;
import static org.mariotaku.twidere.util.ParseUtils.parseInt;
import static org.mariotaku.twidere.util.Utils.getAccountIds;
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
public IBinder onBind(final Intent intent) {
return null;
@ -139,19 +148,27 @@ public class RefreshService extends Service implements Constants {
mPendingRefreshDirectMessagesIntent = PendingIntent.getBroadcast(this, 0, new Intent(
BROADCAST_REFRESH_DIRECT_MESSAGES), 0);
mPendingRefreshTrendsIntent = PendingIntent.getBroadcast(this, 0, new Intent(BROADCAST_REFRESH_TRENDS), 0);
final IntentFilter filter = new IntentFilter(BROADCAST_NOTIFICATION_DELETED);
filter.addAction(BROADCAST_REFRESH_HOME_TIMELINE);
filter.addAction(BROADCAST_REFRESH_MENTIONS);
filter.addAction(BROADCAST_REFRESH_DIRECT_MESSAGES);
filter.addAction(BROADCAST_RESCHEDULE_HOME_TIMELINE_REFRESHING);
filter.addAction(BROADCAST_RESCHEDULE_MENTIONS_REFRESHING);
filter.addAction(BROADCAST_RESCHEDULE_DIRECT_MESSAGES_REFRESHING);
registerReceiver(mStateReceiver, filter);
final IntentFilter refreshFilter = new IntentFilter(BROADCAST_NOTIFICATION_DELETED);
refreshFilter.addAction(BROADCAST_REFRESH_HOME_TIMELINE);
refreshFilter.addAction(BROADCAST_REFRESH_MENTIONS);
refreshFilter.addAction(BROADCAST_REFRESH_DIRECT_MESSAGES);
refreshFilter.addAction(BROADCAST_RESCHEDULE_HOME_TIMELINE_REFRESHING);
refreshFilter.addAction(BROADCAST_RESCHEDULE_MENTIONS_REFRESHING);
refreshFilter.addAction(BROADCAST_RESCHEDULE_DIRECT_MESSAGES_REFRESHING);
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();
}
@Override
public void onDestroy() {
unregisterReceiver(mBatteryReceiver);
unregisterReceiver(mStateReceiver);
if (hasAutoRefreshAccounts(this)) {
// 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.content.Context;
import android.graphics.Rect;
import android.support.v4.view.ViewCompat;
import android.support.v7.app.AppCompatCallback;
import android.support.v7.internal.view.StandaloneActionMode;
@ -38,6 +39,7 @@ import android.view.accessibility.AccessibilityEvent;
import android.widget.PopupWindow;
import org.mariotaku.twidere.activity.iface.IThemedActivity;
import org.mariotaku.twidere.fragment.iface.IBaseFragment;
import org.mariotaku.twidere.view.TintedStatusNativeActionModeAwareLayout;
/**
@ -120,12 +122,13 @@ public class TwidereActionModeForChildListener implements TintedStatusNativeActi
mThemed.getCurrentThemeResourceId(), mThemed.getCurrentThemeColor(),
mThemed.getCurrentThemeBackgroundOption(), false);
mActionModePopup.setHeight(ViewGroup.LayoutParams.WRAP_CONTENT);
final int actionModeOffset = getActionModeOffset();
mShowActionModePopup = new Runnable() {
@Override
public void run() {
mActionModePopup.showAtLocation(
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;
}
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() {
if (mActionMode != null) {
mActionMode.finish();