1
0
mirror of https://github.com/TwidereProject/Twidere-Android synced 2025-02-16 19:50:53 +01:00

separated to F-Droid version (no closed source dependency) and Google Play version (GMS integrated)

removed swipe back
fixed window resizing bug
This commit is contained in:
Mariotaku Lee 2014-10-26 21:38:48 +08:00
parent 891b48c5f5
commit 486efec36b
48 changed files with 1723 additions and 4112 deletions

View File

@ -66,24 +66,29 @@ android {
lintOptions {
abortOnError false
}
productFlavors {
google {}
fdroid {}
}
}
dependencies {
wearApp project(':twidere.wear')
compile 'com.android.support:support-v13:21.0.0'
compile 'com.android.support:appcompat-v7:21.0.0'
compile 'com.android.support:cardview-v7:21.0.0'
compile 'com.android.support:recyclerview-v7:21.0.0'
compile 'com.google.android.gms:play-services:6.1.11'
compile 'com.etsy.android.grid:library:1.0.5'
compile 'com.sothree.slidinguppanel:library:2.0.0'
compile 'it.sephiroth.android.library.imagezoom:imagezoom:+'
compile 'com.twitter:twitter-text:1.9.5'
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.2'
compile 'org.apache.httpcomponents:httpclient-android:4.3.3'
compile 'org.apache.httpcomponents:httpmime:4.3.3'
compile 'com.twitter:twitter-text:1.9.9'
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.3'
compile 'org.apache.httpcomponents:httpclient-android:4.3.5'
compile 'org.apache.httpcomponents:httpmime:4.3.5'
compile 'ch.acra:acra:4.5.0'
compile 'com.google.android.apps.dashclock:dashclock-api:2.0.0'
googleCompile 'com.google.android.gms:play-services:6.1.11'
fdroidCompile 'org.osmdroid:osmdroid-android:4.2'
fdroidCompile 'org.slf4j:slf4j-simple:1.6.1'
compile project(':SlidingMenu')
compile project(':DragSortListView')
compile project(':MenuComponent')

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application>
<activity
android:name=".activity.support.OpenStreetMapViewerActivity"
android:exported="false"
android:label="@string/view_map"
android:theme="@style/Theme.Blank">
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.BROWSABLE"/>
<category android:name="android.intent.category.DEFAULT"/>
<data
android:host="map"
android:scheme="twidere"/>
</intent-filter>
</activity>
</application>
</manifest>

View File

@ -0,0 +1,160 @@
/*
* Twidere - Twitter client for Android
*
* Copyright (C) 2012-2014 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.activity.support;
import android.app.ActionBar;
import android.graphics.Point;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import org.mariotaku.twidere.Constants;
import org.mariotaku.twidere.R;
import org.mariotaku.twidere.menu.TwidereMenuInflater;
import org.mariotaku.twidere.util.ParseUtils;
import org.mariotaku.twidere.util.ThemeUtils;
import org.osmdroid.ResourceProxy;
import org.osmdroid.api.IMapController;
import org.osmdroid.api.IMapView;
import org.osmdroid.util.GeoPoint;
import org.osmdroid.views.MapView;
import org.osmdroid.views.overlay.ItemizedOverlay;
import org.osmdroid.views.overlay.Overlay;
import org.osmdroid.views.overlay.OverlayItem;
import java.util.ArrayList;
import java.util.List;
public class OpenStreetMapViewerActivity extends BaseSupportActivity implements Constants {
private MapView mMapView;
private double mLatitude, mLongitude;
@Override
public int getThemeResourceId() {
return ThemeUtils.getViewerThemeResource(this);
}
@Override
public boolean onCreateOptionsMenu(final Menu menu, final TwidereMenuInflater inflater) {
inflater.inflate(R.menu.menu_osm_viewer, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(final MenuItem item) {
switch (item.getItemId()) {
case MENU_HOME: {
onBackPressed();
break;
}
case MENU_CENTER: {
moveToCenter(mLatitude, mLongitude);
break;
}
}
return true;
}
private void moveToCenter(double lat, double lng) {
final GeoPoint gp = new GeoPoint((int) (lat * 1E6), (int) (lng * 1E6));
final IMapController mc = mMapView.getController();
mc.animateTo(gp);
}
@Override
public void onContentChanged() {
super.onContentChanged();
mMapView = (MapView) findViewById(R.id.map_view);
}
@Override
protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
final Uri uri = getIntent().getData();
if (uri == null || !AUTHORITY_MAP.equals(uri.getAuthority())) {
finish();
return;
}
final double latitude = ParseUtils.parseDouble(uri.getQueryParameter(QUERY_PARAM_LAT), Double.NaN);
final double longitude = ParseUtils.parseDouble(uri.getQueryParameter(QUERY_PARAM_LNG), Double.NaN);
if (Double.isNaN(latitude) || Double.isNaN(longitude)) {
finish();
return;
}
mLatitude = latitude;
mLongitude = longitude;
final ActionBar actionBar = getActionBar();
if (actionBar != null) {
actionBar.setDisplayHomeAsUpEnabled(true);
}
setContentView(R.layout.activity_osm_viewer);
mMapView.setMultiTouchControls(true);
mMapView.setBuiltInZoomControls(true);
final List<Overlay> overlays = mMapView.getOverlays();
final GeoPoint gp = new GeoPoint((int) (latitude * 1E6), (int) (longitude * 1E6));
final Drawable d = getResources().getDrawable(R.drawable.ic_map_marker);
final Itemization markers = new Itemization(d, mMapView.getResourceProxy());
final OverlayItem overlayitem = new OverlayItem("", "", gp);
markers.addOverlay(overlayitem);
overlays.add(markers);
final IMapController mc = mMapView.getController();
mc.setZoom(12);
mc.setCenter(gp);
}
static class Itemization extends ItemizedOverlay<OverlayItem> {
private final ArrayList<OverlayItem> mOverlays = new ArrayList<OverlayItem>();
public Itemization(final Drawable defaultMarker, final ResourceProxy proxy) {
super(boundCenterBottom(defaultMarker), proxy);
}
public void addOverlay(final OverlayItem overlay) {
mOverlays.add(overlay);
populate();
}
@Override
public boolean onSnapToItem(final int x, final int y, final Point snapPoint, final IMapView mapView) {
return false;
}
@Override
public int size() {
return mOverlays.size();
}
@Override
protected OverlayItem createItem(final int i) {
return mOverlays.get(i);
}
protected static Drawable boundCenterBottom(final Drawable d) {
d.setBounds(-d.getIntrinsicWidth() / 2, -d.getIntrinsicHeight(), d.getIntrinsicWidth() / 2, 0);
return d;
}
}
}

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<org.osmdroid.views.MapView
android:id="@+id/map_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
tilesource="Mapnik"/>
</merge>

View File

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version"/>
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyCVdCIMFFxdNqHnCPrJ9yKUzoTfs8jhYGc"/>
<activity
android:name=".activity.support.GoogleMapViewerActivity"
android:exported="false"
android:label="@string/view_map"
android:theme="@style/Theme.Blank">
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.BROWSABLE"/>
<category android:name="android.intent.category.DEFAULT"/>
<data
android:host="map"
android:scheme="twidere"/>
</intent-filter>
</activity>
</application>
</manifest>

View File

@ -0,0 +1,110 @@
/*
* Twidere - Twitter client for Android
*
* Copyright (C) 2012-2014 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.activity.support;
import android.app.ActionBar;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.view.Menu;
import android.view.MenuItem;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GooglePlayServicesUtil;
import com.google.android.gms.maps.MapView;
import org.mariotaku.twidere.Constants;
import org.mariotaku.twidere.R;
import org.mariotaku.twidere.fragment.iface.IMapFragment;
import org.mariotaku.twidere.fragment.support.GoogleMapFragment;
import org.mariotaku.twidere.fragment.support.WebMapFragment;
import org.mariotaku.twidere.menu.TwidereMenuInflater;
import org.mariotaku.twidere.util.ParseUtils;
import org.mariotaku.twidere.util.ThemeUtils;
public class GoogleMapViewerActivity extends BaseSupportActivity implements Constants {
@Override
public int getThemeResourceId() {
return ThemeUtils.getViewerThemeResource(this);
}
@Override
public boolean onCreateOptionsMenu(final Menu menu, final TwidereMenuInflater inflater) {
inflater.inflate(R.menu.menu_google_maps_viewer, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(final MenuItem item) {
switch (item.getItemId()) {
case MENU_HOME: {
onBackPressed();
break;
}
case MENU_CENTER: {
final Fragment fragment = getSupportFragmentManager().findFragmentById(android.R.id.content);
if (!(fragment instanceof IMapFragment)) {
break;
}
((IMapFragment) fragment).center();
break;
}
}
return true;
}
@Override
protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
final Uri uri = getIntent().getData();
if (uri == null || !AUTHORITY_MAP.equals(uri.getAuthority())) {
finish();
return;
}
final Bundle bundle = new Bundle();
final double latitude = ParseUtils.parseDouble(uri.getQueryParameter(QUERY_PARAM_LAT), Double.NaN);
final double longitude = ParseUtils.parseDouble(uri.getQueryParameter(QUERY_PARAM_LNG), Double.NaN);
if (Double.isNaN(latitude) || Double.isNaN(longitude)) {
finish();
return;
}
try {
bundle.putDouble(EXTRA_LATITUDE, latitude);
bundle.putDouble(EXTRA_LONGITUDE, longitude);
} catch (final NumberFormatException e) {
finish();
return;
}
final ActionBar actionBar = getActionBar();
if (actionBar != null) {
actionBar.setDisplayHomeAsUpEnabled(true);
}
final Fragment fragment = isNativeMapSupported() ? new GoogleMapFragment() : new WebMapFragment();
fragment.setArguments(bundle);
final FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
ft.replace(android.R.id.content, fragment).commit();
}
private boolean isNativeMapSupported() {
return GooglePlayServicesUtil.isGooglePlayServicesAvailable(this) == ConnectionResult.SUCCESS;
}
}

View File

@ -0,0 +1,70 @@
/*
* Twidere - Twitter client for Android
*
* Copyright (C) 2012-2014 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.fragment.support;
import android.os.Bundle;
import com.google.android.gms.maps.CameraUpdate;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.MarkerOptions;
import org.mariotaku.twidere.Constants;
import org.mariotaku.twidere.fragment.iface.IMapFragment;
public class GoogleMapFragment extends SupportMapFragment implements Constants, IMapFragment {
private GoogleMap mMapView;
@Override
public void center() {
center(true);
}
public void center(final boolean animate) {
final Bundle args = getArguments();
if (mMapView == null || args == null || !args.containsKey(EXTRA_LATITUDE) || !args.containsKey(EXTRA_LONGITUDE))
return;
final double lat = args.getDouble(EXTRA_LATITUDE, 0.0), lng = args.getDouble(EXTRA_LONGITUDE, 0.0);
final CameraUpdate c = CameraUpdateFactory.newLatLngZoom(new LatLng(lat, lng), 12);
if (animate) {
mMapView.animateCamera(c);
} else {
mMapView.moveCamera(c);
}
}
@Override
public void onActivityCreated(final Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
final Bundle args = getArguments();
if (args == null || !args.containsKey(EXTRA_LATITUDE) || !args.containsKey(EXTRA_LONGITUDE))
return;
final double lat = args.getDouble(EXTRA_LATITUDE, 0.0), lng = args.getDouble(EXTRA_LONGITUDE, 0.0);
mMapView = getMap();
final MarkerOptions marker = new MarkerOptions();
marker.position(new LatLng(lat, lng));
mMapView.addMarker(marker);
center(false);
}
}

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@id/center"
android:icon="@drawable/ic_action_mylocation"
android:showAsAction="always"
android:title="@string/center"/>
</menu>

View File

@ -1,54 +1,53 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.mariotaku.twidere"
android:installLocation="auto">
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: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="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<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="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: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: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:permissionGroup="org.mariotaku.twidere.permission.PERMISSION_GROUP" />
android:permissionGroup="org.mariotaku.twidere.permission.PERMISSION_GROUP"/>
<application
android:name=".app.TwidereApplication"
@ -60,35 +59,29 @@
android:theme="@style/Theme.Blank">
<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" />
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyCVdCIMFFxdNqHnCPrJ9yKUzoTfs8jhYGc" />
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"
@ -96,13 +89,13 @@
android:label="@string/app_name"
android:launchMode="singleTop"
android:theme="@style/Theme.Launcher"
android:windowSoftInputMode="adjustResize">
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
@ -114,11 +107,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
@ -127,22 +120,22 @@
android:launchMode="singleTop"
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"
@ -152,38 +145,38 @@
android:theme="@style/Theme.Blank.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/share_via_twidere">
<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.SignInActivity"
android:label="@string/sign_in"
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
@ -192,9 +185,9 @@
android:theme="@style/Theme.Blank.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
@ -203,42 +196,42 @@
android:theme="@style/Theme.Blank"
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.FiltersActivity"
android:label="@string/filters">
<intent-filter>
<action android:name="org.mariotaku.twidere.FILTERS" />
<action android:name="org.mariotaku.twidere.FILTERS"/>
<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.Blank.Dialog"
android:windowSoftInputMode="adjustResize" />
android:windowSoftInputMode="adjustResize"/>
<activity
android:name=".activity.support.AccountSelectorActivity"
android:label="@string/select_account"
android:theme="@style/Theme.Blank.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
@ -246,104 +239,104 @@
android:exported="false"
android:label="@string/browser">
<intent-filter>
<action android:name="org.mariotaku.twidere.VIEW_WEBPAGE" />
<action android:name="org.mariotaku.twidere.VIEW_WEBPAGE"/>
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.DEFAULT"/>
<data android:scheme="file" />
<data android:scheme="http" />
<data android:scheme="https" />
<data android:scheme="file"/>
<data android:scheme="http"/>
<data android:scheme="https"/>
</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: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:host="user"
android:scheme="twidere" />
android:scheme="twidere"/>
<data
android:host="users"
android:scheme="twidere" />
android:scheme="twidere"/>
<data
android:host="user_timeline"
android:scheme="twidere" />
android:scheme="twidere"/>
<data
android:host="user_favorites"
android:scheme="twidere" />
android:scheme="twidere"/>
<data
android:host="user_followers"
android:scheme="twidere" />
android:scheme="twidere"/>
<data
android:host="user_friends"
android:scheme="twidere" />
android:scheme="twidere"/>
<data
android:host="user_blocks"
android:scheme="twidere" />
android:scheme="twidere"/>
<data
android:host="status"
android:scheme="twidere" />
android:scheme="twidere"/>
<data
android:host="status_retweeters"
android:scheme="twidere" />
android:scheme="twidere"/>
<data
android:host="status_favoriters"
android:scheme="twidere" />
android:scheme="twidere"/>
<data
android:host="status_replies"
android:scheme="twidere" />
android:scheme="twidere"/>
<data
android:host="statuses"
android:scheme="twidere" />
android:scheme="twidere"/>
<data
android:host="direct_messages_conversation"
android:scheme="twidere" />
android:scheme="twidere"/>
<data
android:host="user_list"
android:scheme="twidere" />
android:scheme="twidere"/>
<data
android:host="user_lists"
android:scheme="twidere" />
android:scheme="twidere"/>
<data
android:host="user_list_timeline"
android:scheme="twidere" />
android:scheme="twidere"/>
<data
android:host="user_list_members"
android:scheme="twidere" />
android:scheme="twidere"/>
<data
android:host="user_list_subscribers"
android:scheme="twidere" />
android:scheme="twidere"/>
<data
android:host="user_list_memberships"
android:scheme="twidere" />
android:scheme="twidere"/>
<data
android:host="saved_searches"
android:scheme="twidere" />
android:scheme="twidere"/>
<data
android:host="user_mentions"
android:scheme="twidere" />
android:scheme="twidere"/>
<data
android:host="incoming_friendships"
android:scheme="twidere" />
android:scheme="twidere"/>
<data
android:host="search"
android:scheme="twidere" />
android:scheme="twidere"/>
<data
android:host="mutes_users"
android:scheme="twidere" />
android:scheme="twidere"/>
</intent-filter>
</activity>
<activity
@ -352,14 +345,14 @@
android:label="@string/drafts"
android:launchMode="singleTop">
<intent-filter>
<action android:name="org.mariotaku.twidere.DRAFTS" />
<action android:name="org.mariotaku.twidere.DRAFTS"/>
<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="org.mariotaku.gallery3d.ImageViewerGLActivity"
@ -370,30 +363,14 @@
android:process=":image_viewer"
android:theme="@style/Theme.Blank">
<intent-filter>
<action android:name="org.mariotaku.twidere.VIEW_IMAGE" />
<action android:name="org.mariotaku.twidere.VIEW_IMAGE"/>
<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" />
</intent-filter>
</activity>
<activity
android:name=".activity.support.MapViewerActivity"
android:exported="false"
android:label="@string/view_map"
android:theme="@style/Theme.Blank">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
<data
android:host="map"
android:scheme="twidere" />
<data android:scheme="http"/>
<data android:scheme="https"/>
<data android:scheme="file"/>
</intent-filter>
</activity>
<activity
@ -403,10 +380,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
@ -415,11 +392,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
@ -428,15 +405,15 @@
android:label="@string/edit_profile"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="org.mariotaku.twidere.EDIT_USER_PROFILE" />
<action android:name="org.mariotaku.twidere.EDIT_USER_PROFILE"/>
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>
<activity
android:name=".activity.CustomTabsActivity"
android:label="@string/tabs"
android:theme="@style/Theme.Blank" />
android:theme="@style/Theme.Blank"/>
<activity
android:name=".activity.support.CustomTabEditorActivity"
android:exported="false"
@ -444,10 +421,10 @@
android:theme="@style/Theme.Blank.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
@ -455,33 +432,33 @@
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
android:name=".activity.DataProfilingSettingsActivity"
android:exported="false"
android:label="@string/data_profiling"
android:theme="@style/Theme.Blank" />
android:theme="@style/Theme.Blank"/>
<activity
android:name=".activity.support.RequestPermissionsActivity"
android:label="@string/permissions_request"
android:theme="@style/Theme.Blank.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
android:name=".activity.CameraCropActivity"
android:exported="false">
<intent-filter>
<action android:name="org.mariotaku.twidere.CAMERA_CROP" />
<action android:name="org.mariotaku.twidere.CAMERA_CROP"/>
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>
<activity
@ -489,31 +466,31 @@
android:label="@string/select_user_list"
android:theme="@style/Theme.Blank.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.Blank.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
@ -524,27 +501,27 @@
<intent-filter>
<data
android:host="twitter.com"
android:scheme="http" />
android:scheme="http"/>
<data
android:host="twitter.com"
android:scheme="https" />
android:scheme="https"/>
<data
android:host="www.twitter.com"
android:scheme="http" />
android:scheme="http"/>
<data
android:host="www.twitter.com"
android:scheme="https" />
android:scheme="https"/>
<data
android:host="mobile.twitter.com"
android:scheme="http" />
android:scheme="http"/>
<data
android:host="mobile.twitter.com"
android:scheme="https" />
android:scheme="https"/>
<action android:name="android.intent.action.VIEW" />
<action android:name="android.intent.action.VIEW"/>
<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
@ -553,54 +530,65 @@
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.TestActivity"
android:launchMode="singleTop"
android:theme="@style/Theme.Twidere.Settings.Light"
android:windowSoftInputMode="adjustResize" />
android:theme="@style/Theme.Test"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<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"/>
</intent-filter>
</activity>
<activity
android:name=".activity.NyanActivity"
android:launchMode="singleTop"
android:theme="@style/Theme.Nyan"
android:windowSoftInputMode="stateAlwaysHidden" />
android:windowSoftInputMode="stateAlwaysHidden"/>
<service
android:name=".service.RefreshService"
android:label="@string/label_refresh_service"
android:settingsActivity=".activity.SettingsActivity" />
android:settingsActivity=".activity.SettingsActivity"/>
<service
android:name=".service.BackgroundOperationService"
android:label="@string/label_background_operation_service" />
android:label="@string/label_background_operation_service"/>
<service
android:name="edu.ucdavis.earlybird.UCDService"
android:settingsActivity=".activity.DataProfilingSettingsActivity" />
android:settingsActivity=".activity.DataProfilingSettingsActivity"/>
<service
android:name=".service.DashClockHomeUnreadCountService"
android:icon="@drawable/ic_extension_twidere"
android:label="@string/dashclock_home_unread_count_name"
android:permission="com.google.android.apps.dashclock.permission.READ_EXTENSION_DATA">
<intent-filter>
<action android:name="com.google.android.apps.dashclock.Extension" />
<action android:name="com.google.android.apps.dashclock.Extension"/>
</intent-filter>
<meta-data
android:name="protocolVersion"
android:value="2" />
android:value="2"/>
<meta-data
android:name="worldReadable"
android:value="true" />
android:value="true"/>
<meta-data
android:name="description"
android:value="@string/dashclock_home_unread_count_description" />
android:value="@string/dashclock_home_unread_count_description"/>
</service>
<service
android:name=".service.DashClockMentionsUnreadCountService"
@ -608,18 +596,18 @@
android:label="@string/dashclock_mentions_unread_count_name"
android:permission="com.google.android.apps.dashclock.permission.READ_EXTENSION_DATA">
<intent-filter>
<action android:name="com.google.android.apps.dashclock.Extension" />
<action android:name="com.google.android.apps.dashclock.Extension"/>
</intent-filter>
<meta-data
android:name="protocolVersion"
android:value="2" />
android:value="2"/>
<meta-data
android:name="worldReadable"
android:value="true" />
android:value="true"/>
<meta-data
android:name="description"
android:value="@string/dashclock_mentions_unread_count_description" />
android:value="@string/dashclock_mentions_unread_count_description"/>
</service>
<service
android:name=".service.DashClockMessagesUnreadCountService"
@ -627,18 +615,18 @@
android:label="@string/dashclock_messages_unread_count_name"
android:permission="com.google.android.apps.dashclock.permission.READ_EXTENSION_DATA">
<intent-filter>
<action android:name="com.google.android.apps.dashclock.Extension" />
<action android:name="com.google.android.apps.dashclock.Extension"/>
</intent-filter>
<meta-data
android:name="protocolVersion"
android:value="2" />
android:value="2"/>
<meta-data
android:name="worldReadable"
android:value="true" />
android:value="true"/>
<meta-data
android:name="description"
android:value="@string/dashclock_messages_unread_count_description" />
android:value="@string/dashclock_messages_unread_count_description"/>
</service>
<service
android:name=".service.NyanWallpaperService"
@ -649,12 +637,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=".service.NyanDaydreamService"
@ -664,7 +652,7 @@
android:label="@string/nyan_sakamoto"
android:process=":daydream">
<intent-filter android:priority="1">
<action android:name="android.service.dreams.DreamService" />
<action android:name="android.service.dreams.DreamService"/>
</intent-filter>
</service>
@ -673,39 +661,39 @@
android:authorities="twidere"
android:exported="true"
android:grantUriPermissions="true"
android:label="@string/label_tweetstore_provider" />
android:label="@string/label_tweetstore_provider"/>
<provider
android:name=".provider.TwidereCommandProvider"
android:authorities="twidere.command"
android:exported="true" />
android:exported="true"/>
<provider
android:name=".provider.RecentSearchProvider"
android:authorities="org.mariotaku.twidere.provider.SearchRecentSuggestions" />
android:authorities="org.mariotaku.twidere.provider.SearchRecentSuggestions"/>
<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.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="edu.ucdavis.earlybird.UploadReceiver"
android:exported="false">
<intent-filter>
<action android:name="android.net.wifi.supplicant.CONNECTION_CHANGE" />
<action android:name="android.intent.action.ACTION_POWER_CONNECTED" />
<action android:name="android.intent.action.ACTION_POWER_DISCONNECTED" />
<action android:name="edu.ucdavis.earlybird.UPLOAD_PROFILE" />
<action android:name="android.net.wifi.supplicant.CONNECTION_CHANGE"/>
<action android:name="android.intent.action.ACTION_POWER_CONNECTED"/>
<action android:name="android.intent.action.ACTION_POWER_DISCONNECTED"/>
<action android:name="edu.ucdavis.earlybird.UPLOAD_PROFILE"/>
</intent-filter>
</receiver>
</application>

View File

@ -1,620 +0,0 @@
package me.imid.swipebacklayout.lib;
import android.app.Activity;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.support.v4.view.ViewCompat;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.ImageView.ScaleType;
import org.mariotaku.twidere.R;
import org.mariotaku.twidere.util.MathUtils;
import org.mariotaku.twidere.util.ThemeUtils;
import org.mariotaku.twidere.util.accessor.ViewAccessor;
public class SwipeBackLayout extends FrameLayout {
/**
* Minimum velocity that will be detected as a fling
*/
private static final int MIN_FLING_VELOCITY = 400; // dips per second
private static final int DEFAULT_SCRIM_COLOR = 0x99000000;
/**
* Edge flag indicating that the left edge should be affected.
*/
public static final int EDGE_LEFT = ViewDragHelper.EDGE_LEFT;
/**
* Edge flag indicating that the right edge should be affected.
*/
public static final int EDGE_RIGHT = ViewDragHelper.EDGE_RIGHT;
/**
* Edge flag indicating that the bottom edge should be affected.
*/
public static final int EDGE_BOTTOM = ViewDragHelper.EDGE_BOTTOM;
/**
* Edge flag set indicating all edges should be affected.
*/
public static final int EDGE_ALL = EDGE_LEFT | EDGE_RIGHT | EDGE_BOTTOM;
/**
* A view is not currently being dragged or animating as a result of a
* fling/snap.
*/
public static final int STATE_IDLE = ViewDragHelper.STATE_IDLE;
/**
* A view is currently being dragged. The position is currently changing as
* a result of user input or simulated user input.
*/
public static final int STATE_DRAGGING = ViewDragHelper.STATE_DRAGGING;
/**
* A view is currently settling into place as a result of a fling or
* predefined non-interactive motion.
*/
public static final int STATE_SETTLING = ViewDragHelper.STATE_SETTLING;
/**
* Default threshold of scroll
*/
private static final float DEFAULT_SCROLL_THRESHOLD = 0.3f;
private static final int OVERSCROLL_DISTANCE = 10;
private static final int[] EDGE_FLAGS = {EDGE_LEFT, EDGE_RIGHT, EDGE_BOTTOM, EDGE_ALL};
private int mEdgeFlags;
/**
* Threshold of scroll, we will close the activity, when scrollPercent over
* this value;
*/
private float mScrollThreshold = DEFAULT_SCROLL_THRESHOLD;
private Activity mActivity;
private boolean mEnable = true;
private View mContentView;
private ImageView mBackgroundView;
private final ViewDragHelper mDragHelper;
private float mScrollPercent;
private int mContentLeft;
private int mContentTop;
private SwipeListener mSwipeListener;
private Drawable mShadowLeft;
private Drawable mShadowRight;
private Drawable mShadowBottom;
private float mScrimOpacity;
private int mScrimColor;
private float mScrimAlpha;
private boolean mInLayout;
private final Rect mTmpRect = new Rect();
/**
* Edge being dragged
*/
private int mTrackingEdge;
private float mScalePercent;
private OnSwipeBackScrollListener mOnSwipeBackScrollListener;
public SwipeBackLayout(final Context context) {
this(context, null);
}
public SwipeBackLayout(final Context context, final AttributeSet attrs) {
this(context, attrs, R.attr.SwipeBackLayoutStyle);
}
public SwipeBackLayout(final Context context, final AttributeSet attrs, final int defStyle) {
super(context, attrs);
mDragHelper = ViewDragHelper.create(this, new ViewDragCallback());
final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.SwipeBackLayout, defStyle,
R.style.SwipeBackLayout);
final int edgeSize = a.getDimensionPixelSize(R.styleable.SwipeBackLayout_edgeSize, -1);
if (edgeSize > 0) {
setEdgeSize(edgeSize);
}
final int mode = EDGE_FLAGS[a.getInt(R.styleable.SwipeBackLayout_edgeFlag, 0)];
setEdgeTrackingEnabled(mode);
final int shadowLeft = a.getResourceId(R.styleable.SwipeBackLayout_shadowLeft, R.drawable.shadow_left);
final int shadowRight = a.getResourceId(R.styleable.SwipeBackLayout_shadowRight, R.drawable.shadow_right);
final int shadowBottom = a.getResourceId(R.styleable.SwipeBackLayout_shadowBottom, R.drawable.shadow_bottom);
final int scrimColor = a.getColor(R.styleable.SwipeBackLayout_scrimColor, DEFAULT_SCRIM_COLOR);
final float scrimAlpha = a.getFloat(R.styleable.SwipeBackLayout_scrimAlpha, Color.alpha(scrimColor) / 255.0f);
final float scalePercent = a.getFraction(R.styleable.SwipeBackLayout_scalePercent, 1, 1, 1);
setShadow(shadowLeft, EDGE_LEFT);
setShadow(shadowRight, EDGE_RIGHT);
setShadow(shadowBottom, EDGE_BOTTOM);
setScalePercent(scalePercent);
setScrimColor(scrimColor);
setScrimAlpha(scrimAlpha);
a.recycle();
final float density = getResources().getDisplayMetrics().density;
final float minVel = MIN_FLING_VELOCITY * density;
mDragHelper.setMinVelocity(minVel);
}
public void attachToActivity(final Activity activity) {
mActivity = activity;
final Drawable background = ThemeUtils.getWindowBackground(activity);
final ViewGroup decor = (ViewGroup) activity.getWindow().getDecorView();
final ViewGroup decorChild = (ViewGroup) decor.getChildAt(0);
final ImageView backgroundChild = new ImageView(activity);
backgroundChild.setScaleType(ScaleType.CENTER_CROP);
ViewAccessor.setBackground(decorChild, background);
decor.removeView(decorChild);
setBackgroundView(backgroundChild);
setContentView(decorChild);
addView(decorChild, LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
final FrameLayout frame = new FrameLayout(activity);
frame.addView(backgroundChild, LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
frame.addView(this);
decor.addView(frame);
}
@Override
public void computeScroll() {
mScrimOpacity = 1 - mScrollPercent;
updateWindowBackground();
if (mDragHelper.continueSettling(true)) {
ViewCompat.postInvalidateOnAnimation(this);
}
if (mOnSwipeBackScrollListener != null) {
mOnSwipeBackScrollListener.onSwipeBackScroll(mScrollPercent);
}
}
public int getEdgeFlags() {
return mEdgeFlags;
}
public Drawable getShadow(final int edgeFlag) {
if ((edgeFlag & EDGE_LEFT) != 0)
return mShadowLeft;
else if ((edgeFlag & EDGE_RIGHT) != 0)
return mShadowRight;
else if ((edgeFlag & EDGE_BOTTOM) != 0) return mShadowBottom;
return null;
}
public int getTrackingEdge() {
return mTrackingEdge;
}
public boolean isSwiping() {
return mDragHelper != null && mDragHelper.getViewDragState() != ViewDragHelper.STATE_IDLE;
}
@Override
public boolean onInterceptTouchEvent(final MotionEvent event) {
if (!mEnable) return false;
try {
return mDragHelper.shouldInterceptTouchEvent(event);
} catch (final ArrayIndexOutOfBoundsException e) {
// FIXME: handle exception
// issues #9
return false;
}
}
@Override
public boolean onTouchEvent(final MotionEvent event) {
if (!mEnable) return false;
mDragHelper.processTouchEvent(event);
return true;
}
@Override
public void requestLayout() {
if (!mInLayout) {
super.requestLayout();
}
}
/**
* Scroll out contentView and finish the activity
*/
public void scrollToFinishActivity() {
final int childWidth = mContentView.getWidth();
final int childHeight = mContentView.getHeight();
int left = 0, top = 0;
if ((mEdgeFlags & EDGE_LEFT) != 0) {
left = childWidth + mShadowLeft.getIntrinsicWidth() + OVERSCROLL_DISTANCE;
mTrackingEdge = EDGE_LEFT;
} else if ((mEdgeFlags & EDGE_RIGHT) != 0) {
left = -childWidth - mShadowRight.getIntrinsicWidth() - OVERSCROLL_DISTANCE;
mTrackingEdge = EDGE_RIGHT;
} else if ((mEdgeFlags & EDGE_BOTTOM) != 0) {
top = -childHeight - mShadowBottom.getIntrinsicHeight() - OVERSCROLL_DISTANCE;
mTrackingEdge = EDGE_BOTTOM;
}
mDragHelper.smoothSlideViewTo(mContentView, left, top);
invalidate();
}
/**
* Set the size of an edge. This is the range in pixels along the edges of
* this view that will actively detect edge touches or drags if edge
* tracking is enabled.
*
* @param size The size of an edge in pixels
*/
public void setEdgeSize(final int size) {
mDragHelper.setEdgeSize(size);
}
/**
* Enable edge tracking for the selected edges of the parent view. The
* callback's
* {@link me.imid.swipebacklayout.lib.ViewDragHelper.Callback#onEdgeTouched(int, int)}
* and
* {@link me.imid.swipebacklayout.lib.ViewDragHelper.Callback#onEdgeDragStarted(int, int)}
* methods will only be invoked for edges for which edge tracking has been
* enabled.
*
* @param edgeFlags Combination of edge flags describing the edges to watch
* @see #EDGE_LEFT
* @see #EDGE_RIGHT
* @see #EDGE_BOTTOM
*/
public void setEdgeTrackingEnabled(final int edgeFlags) {
mEdgeFlags = edgeFlags;
mDragHelper.setEdgeTrackingEnabled(mEdgeFlags);
}
public void setEnableGesture(final boolean enable) {
mEnable = enable;
}
public void setOnSwipeBackScrollListener(final OnSwipeBackScrollListener listener) {
mOnSwipeBackScrollListener = listener;
}
/**
* Set a color to use for the scrim that obscures primary content while a
* drawer is open.
*
* @param color Color to use in 0xAARRGGBB format.
*/
public void setScrimColor(final int color) {
mScrimColor = color;
invalidate();
}
/**
* Set scroll threshold, we will close the activity, when scrollPercent over
* this value
*
* @param threshold
*/
public void setScrollThresHold(final float threshold) {
if (threshold >= 1.0f || threshold <= 0)
throw new IllegalArgumentException("Threshold value should be between 0 and 1.0");
mScrollThreshold = threshold;
}
/**
* Set a drawable used for edge shadow.
*
* @param shadow Drawable to use
* @param edgeFlag Combination of edge flags describing the edge to set
* @see #EDGE_LEFT
* @see #EDGE_RIGHT
* @see #EDGE_BOTTOM
*/
public void setShadow(final Drawable shadow, final int edgeFlag) {
if ((edgeFlag & EDGE_LEFT) != 0) {
mShadowLeft = shadow;
} else if ((edgeFlag & EDGE_RIGHT) != 0) {
mShadowRight = shadow;
} else if ((edgeFlag & EDGE_BOTTOM) != 0) {
mShadowBottom = shadow;
}
invalidate();
}
/**
* Set a drawable used for edge shadow.
*
* @param resId Resource of drawable to use
* @param edgeFlag Combination of edge flags describing the edge to set
* @see #EDGE_LEFT
* @see #EDGE_RIGHT
* @see #EDGE_BOTTOM
*/
public void setShadow(final int resId, final int edgeFlag) {
setShadow(getResources().getDrawable(resId), edgeFlag);
}
/**
* Register a callback to be invoked when a swipe event is sent to this
* view.
*
* @param listener the swipe listener to attach to this view
*/
public void setSwipeListener(final SwipeListener listener) {
mSwipeListener = listener;
}
public void setWindowBackgroundDrawable(final Drawable d) {
if (mBackgroundView == null) return;
mBackgroundView.setImageDrawable(d);
}
@Override
protected boolean drawChild(final Canvas canvas, final View child, final long drawingTime) {
final boolean drawContent = child == mContentView;
drawShadow(canvas, child);
final boolean ret = super.drawChild(canvas, child, drawingTime);
if (mScrimOpacity > 0 && drawContent && mDragHelper.getViewDragState() != ViewDragHelper.STATE_IDLE) {
drawScrim(canvas, child);
}
return ret;
}
@Override
protected void onLayout(final boolean changed, final int left, final int top, final int right, final int bottom) {
mInLayout = true;
if (mContentView != null) {
mContentView.layout(mContentLeft, mContentTop, mContentLeft + mContentView.getMeasuredWidth(), mContentTop
+ mContentView.getMeasuredHeight());
}
mInLayout = false;
}
private void drawScrim(final Canvas canvas, final View child) {
final int alpha = (int) (mScrimAlpha * 255 * mScrimOpacity);
final int color = alpha << 24 | mScrimColor & 0xffffff;
if ((mTrackingEdge & EDGE_LEFT) != 0) {
canvas.clipRect(0, 0, child.getLeft(), getHeight());
} else if ((mTrackingEdge & EDGE_RIGHT) != 0) {
canvas.clipRect(child.getRight(), 0, getRight(), getHeight());
} else if ((mTrackingEdge & EDGE_BOTTOM) != 0) {
canvas.clipRect(child.getLeft(), child.getBottom(), getRight(), getHeight());
}
canvas.drawColor(color);
}
private void drawShadow(final Canvas canvas, final View child) {
final Rect childRect = mTmpRect;
child.getHitRect(childRect);
if ((mEdgeFlags & EDGE_LEFT) != 0) {
mShadowLeft.setBounds(childRect.left - mShadowLeft.getIntrinsicWidth(), childRect.top, childRect.left,
childRect.bottom);
mShadowLeft.draw(canvas);
}
if ((mEdgeFlags & EDGE_RIGHT) != 0) {
mShadowRight.setBounds(childRect.right, childRect.top, childRect.right + mShadowRight.getIntrinsicWidth(),
childRect.bottom);
mShadowRight.draw(canvas);
}
if ((mEdgeFlags & EDGE_BOTTOM) != 0) {
mShadowBottom.setBounds(childRect.left, childRect.bottom, childRect.right,
childRect.bottom + mShadowBottom.getIntrinsicHeight());
mShadowBottom.draw(canvas);
}
}
private void setBackgroundView(final ImageView view) {
mBackgroundView = view;
}
/**
* Set up contentView which will be moved by user gesture
*
* @param view
*/
private void setContentView(final View view) {
mContentView = view;
}
private void setScalePercent(final float scalePercent) {
mScalePercent = scalePercent;
}
private void setScrimAlpha(final float scrimAlpha) {
mScrimAlpha = scrimAlpha;
invalidate();
}
private void updateWindowBackground() {
if (mBackgroundView == null) return;
final float scrollPercentAbs = Math.abs(mScrollPercent);
final float percent = MathUtils.clamp(1 - (1 - scrollPercentAbs) * (1 - mScalePercent), 1, 0);
mBackgroundView.setScaleType(ScaleType.CENTER_CROP);
mBackgroundView.setScaleX(percent);
mBackgroundView.setScaleY(percent);
mBackgroundView.setVisibility(mScrollPercent <= 0 ? View.INVISIBLE : View.VISIBLE);
mBackgroundView.setAlpha(scrollPercentAbs);
// mBackgroundView.setScrollPercent(mScrollPercent / mScalePercent);
}
public interface OnSwipeBackScrollListener {
void onSwipeBackScroll(float percent);
}
public static interface SwipeListener {
/**
* Invoke when edge touched
*
* @param edgeFlag edge flag describing the edge being touched
* @see #EDGE_LEFT
* @see #EDGE_RIGHT
* @see #EDGE_BOTTOM
*/
public void onEdgeTouch(int edgeFlag);
/**
* Invoke when scroll percent over the threshold for the first time
*/
public void onScrollOverThreshold();
/**
* Invoke when state change
*
* @param state flag to describe scroll state
* @param scrollPercent scroll percent of this view
* @see #STATE_IDLE
* @see #STATE_DRAGGING
* @see #STATE_SETTLING
*/
public void onScrollStateChange(int state, float scrollPercent);
}
private class ViewDragCallback extends ViewDragHelper.Callback {
private boolean mIsScrollOverValid;
@Override
public int clampViewPositionHorizontal(final View child, final int left, final int dx) {
int ret = 0;
if ((mTrackingEdge & EDGE_LEFT) != 0) {
ret = Math.min(child.getWidth(), Math.max(left, 0));
} else if ((mTrackingEdge & EDGE_RIGHT) != 0) {
ret = Math.min(0, Math.max(left, -child.getWidth()));
}
return ret;
}
@Override
public int clampViewPositionVertical(final View child, final int top, final int dy) {
int ret = 0;
if ((mTrackingEdge & EDGE_BOTTOM) != 0) {
ret = Math.min(0, Math.max(top, -child.getHeight()));
}
return ret;
}
@Override
public int getViewHorizontalDragRange(final View child) {
return mEdgeFlags & (EDGE_LEFT | EDGE_RIGHT);
}
@Override
public int getViewVerticalDragRange(final View child) {
return mEdgeFlags & EDGE_BOTTOM;
}
@Override
public void onViewDragStateChanged(final int state) {
super.onViewDragStateChanged(state);
if (mSwipeListener != null) {
mSwipeListener.onScrollStateChange(state, mScrollPercent);
}
}
@Override
public void onViewPositionChanged(final View changedView, final int left, final int top, final int dx,
final int dy) {
super.onViewPositionChanged(changedView, left, top, dx, dy);
if ((mTrackingEdge & EDGE_LEFT) != 0) {
mScrollPercent = Math.abs((float) left / (mContentView.getWidth() + mShadowLeft.getIntrinsicWidth()));
} else if ((mTrackingEdge & EDGE_RIGHT) != 0) {
mScrollPercent = Math.abs((float) left / (mContentView.getWidth() + mShadowRight.getIntrinsicWidth()));
} else if ((mTrackingEdge & EDGE_BOTTOM) != 0) {
mScrollPercent = Math
.abs((float) top / (mContentView.getHeight() + mShadowBottom.getIntrinsicHeight()));
}
mContentLeft = left;
mContentTop = top;
invalidate();
if (mScrollPercent < mScrollThreshold && !mIsScrollOverValid) {
mIsScrollOverValid = true;
}
if (mSwipeListener != null && mDragHelper.getViewDragState() == STATE_DRAGGING
&& mScrollPercent >= mScrollThreshold && mIsScrollOverValid) {
mIsScrollOverValid = false;
mSwipeListener.onScrollOverThreshold();
}
if (mScrollPercent >= 1) {
if (!mActivity.isFinishing()) {
mActivity.finish();
mActivity.overridePendingTransition(0, 0);
}
}
}
@Override
public void onViewReleased(final View releasedChild, final float xvel, final float yvel) {
final int childWidth = releasedChild.getWidth();
final int childHeight = releasedChild.getHeight();
int left = 0, top = 0;
if ((mTrackingEdge & EDGE_LEFT) != 0) {
left = xvel > 0 || xvel == 0 && mScrollPercent > mScrollThreshold ? childWidth
+ mShadowLeft.getIntrinsicWidth() + OVERSCROLL_DISTANCE : 0;
} else if ((mTrackingEdge & EDGE_RIGHT) != 0) {
left = xvel < 0 || xvel == 0 && mScrollPercent > mScrollThreshold ? -(childWidth
+ mShadowLeft.getIntrinsicWidth() + OVERSCROLL_DISTANCE) : 0;
} else if ((mTrackingEdge & EDGE_BOTTOM) != 0) {
top = yvel < 0 || yvel == 0 && mScrollPercent > mScrollThreshold ? -(childHeight
+ mShadowBottom.getIntrinsicHeight() + OVERSCROLL_DISTANCE) : 0;
}
mDragHelper.settleCapturedViewAt(left, top);
invalidate();
}
@Override
public boolean tryCaptureView(final View view, final int i) {
final boolean ret = mDragHelper.isEdgeTouched(mEdgeFlags, i);
if (ret) {
if (mDragHelper.isEdgeTouched(EDGE_LEFT, i)) {
mTrackingEdge = EDGE_LEFT;
} else if (mDragHelper.isEdgeTouched(EDGE_RIGHT, i)) {
mTrackingEdge = EDGE_RIGHT;
} else if (mDragHelper.isEdgeTouched(EDGE_BOTTOM, i)) {
mTrackingEdge = EDGE_BOTTOM;
}
if (mSwipeListener != null) {
mSwipeListener.onEdgeTouch(mTrackingEdge);
}
mIsScrollOverValid = true;
}
return ret;
}
}
}

View File

@ -1,55 +0,0 @@
package me.imid.swipebacklayout.lib.app;
import android.annotation.SuppressLint;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.view.View;
import me.imid.swipebacklayout.lib.SwipeBackLayout;
@SuppressLint("Registered")
public class SwipeBackActivity extends FragmentActivity implements SwipeBackActivityBase {
private SwipeBackActivityHelper mSwipebackHelper;
@Override
public View findViewById(final int id) {
final View v = super.findViewById(id);
if (v == null && mSwipebackHelper != null) return mSwipebackHelper.findViewById(id);
return v;
}
@Override
public SwipeBackLayout getSwipeBackLayout() {
return mSwipebackHelper.getSwipeBackLayout();
}
@Override
public void scrollToFinishActivity() {
getSwipeBackLayout().scrollToFinishActivity();
}
@Override
public void setSwipeBackEnable(final boolean enable) {
getSwipeBackLayout().setEnableGesture(enable);
}
@Override
protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mSwipebackHelper = new SwipeBackActivityHelper(this);
mSwipebackHelper.onActivtyCreate();
}
@Override
protected void onDestroy() {
super.onDestroy();
mSwipebackHelper.onDestroy();
}
@Override
protected void onPostCreate(final Bundle savedInstanceState) {
super.onPostCreate(savedInstanceState);
mSwipebackHelper.onPostCreate();
}
}

View File

@ -1,21 +0,0 @@
package me.imid.swipebacklayout.lib.app;
import me.imid.swipebacklayout.lib.SwipeBackLayout;
/**
* @author Yrom
*/
public interface SwipeBackActivityBase {
/**
* @return the SwipeBackLayout associated with this activity.
*/
public abstract SwipeBackLayout getSwipeBackLayout();
/**
* Scroll out contentView and finish the activity
*/
public abstract void scrollToFinishActivity();
public abstract void setSwipeBackEnable(boolean enable);
}

View File

@ -1,67 +0,0 @@
package me.imid.swipebacklayout.lib.app;
import android.app.Activity;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.Window;
import me.imid.swipebacklayout.lib.SwipeBackLayout;
import org.mariotaku.twidere.R;
import org.mariotaku.twidere.TwidereConstants;
import org.mariotaku.twidere.app.TwidereApplication;
import org.mariotaku.twidere.graphic.EmptyDrawable;
import org.mariotaku.twidere.util.SwipebackActivityUtils.SwipebackScreenshotManager;
/**
* @author Yrom
*
*/
public class SwipeBackActivityHelper implements TwidereConstants {
private final Activity mActivity;
private SwipeBackLayout mSwipeBackLayout;
public SwipeBackActivityHelper(final Activity activity) {
mActivity = activity;
}
public View findViewById(final int id) {
if (mSwipeBackLayout != null) return mSwipeBackLayout.findViewById(id);
return null;
}
public SwipeBackLayout getSwipeBackLayout() {
return mSwipeBackLayout;
}
public void onActivtyCreate() {
final Window w = mActivity.getWindow();
w.setBackgroundDrawable(new EmptyDrawable());
mSwipeBackLayout = (SwipeBackLayout) LayoutInflater.from(mActivity).inflate(R.layout.swipeback_layout, null);
}
public void onDestroy() {
if (mActivity.isFinishing()) {
final Intent intent = mActivity.getIntent();
final TwidereApplication app = TwidereApplication.getInstance(mActivity);
final SwipebackScreenshotManager sm = app.getSwipebackScreenshotManager();
sm.remove(intent.getLongExtra(EXTRA_ACTIVITY_SCREENSHOT_ID, -1));
}
}
public void onPostCreate() {
mSwipeBackLayout.attachToActivity(mActivity);
final Intent intent = mActivity.getIntent();
final TwidereApplication app = TwidereApplication.getInstance(mActivity);
final SwipebackScreenshotManager sm = app.getSwipebackScreenshotManager();
final Bitmap b = sm.get(intent.getLongExtra(EXTRA_ACTIVITY_SCREENSHOT_ID, -1));
if (b != null) {
mSwipeBackLayout.setWindowBackgroundDrawable(new BitmapDrawable(mActivity.getResources(), b));
}
mSwipeBackLayout.setEnableGesture(b != null);
}
}

View File

@ -29,7 +29,6 @@ import android.support.v4.app.LoaderManager;
import android.support.v4.content.Loader;
import android.view.Menu;
import android.view.MenuItem;
import android.view.MenuItem.OnMenuItemClickListener;
import android.view.SubMenu;
import android.view.View;
import android.view.animation.Animation;
@ -49,7 +48,7 @@ import org.mariotaku.menucomponent.widget.MenuBar;
import org.mariotaku.menucomponent.widget.MenuBar.MenuBarListener;
import org.mariotaku.twidere.Constants;
import org.mariotaku.twidere.R;
import org.mariotaku.twidere.activity.support.TwidereSwipeBackActivity;
import org.mariotaku.twidere.activity.support.BaseSupportActivity;
import org.mariotaku.twidere.menu.TwidereMenuInflater;
import org.mariotaku.twidere.util.SaveImageTask;
import org.mariotaku.twidere.util.ThemeUtils;
@ -57,11 +56,9 @@ import org.mariotaku.twidere.util.Utils;
import java.io.File;
import me.imid.swipebacklayout.lib.SwipeBackLayout.SwipeListener;
public final class ImageViewerGLActivity extends TwidereSwipeBackActivity implements Constants, PhotoView.Listener,
public final class ImageViewerGLActivity extends BaseSupportActivity implements Constants, PhotoView.Listener,
GLImageLoader.DownloadListener, LoaderManager.LoaderCallbacks<GLImageLoader.Result>, OnMenuVisibilityListener,
SwipeListener, MenuBarListener {
MenuBarListener {
private final GLView mRootPane = new GLView() {
@Override
@ -180,10 +177,6 @@ public final class ImageViewerGLActivity extends TwidereSwipeBackActivity implem
mProgress.setMax(total > 0 ? (int) (total / 1024) : 0);
}
@Override
public void onEdgeTouch(final int edgeFlag) {
showBars();
}
@Override
public void onLoaderReset(final Loader<GLImageLoader.Result> loader) {
@ -301,15 +294,6 @@ public final class ImageViewerGLActivity extends TwidereSwipeBackActivity implem
mProgress.setProgress((int) (downloaded / 1024));
}
@Override
public void onScrollOverThreshold() {
}
@Override
public void onScrollStateChange(final int state, final float scrollPercent) {
}
@Override
public void onSingleTapUp(final int x, final int y) {
@ -345,7 +329,6 @@ public final class ImageViewerGLActivity extends TwidereSwipeBackActivity implem
mMenuBar.inflate(R.menu.menu_image_viewer);
mMenuBar.setIsBottomBar(true);
mMenuBar.show();
setSwipeListener(this);
}
@Override
@ -434,7 +417,7 @@ public final class ImageViewerGLActivity extends TwidereSwipeBackActivity implem
}
private void hideBars() {
if (!mShowBars || isSwiping()) return;
if (!mShowBars) return;
mShowBars = false;
mActionBar.hide();
final TranslateAnimation anim = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0,

View File

@ -24,213 +24,214 @@ import org.mariotaku.twidere.constant.SharedPreferenceConstants;
/**
* Public constants for both Twidere app and its extensions
*
*
* @author mariotaku
*
*/
public interface TwidereConstants extends SharedPreferenceConstants, IntentConstants {
public static final String APP_NAME = "Twidere";
public static final String APP_PACKAGE_NAME = "org.mariotaku.twidere";
public static final String APP_PROJECT_URL = "https://github.com/mariotaku/twidere";
public static final String APP_PROJECT_EMAIL = "twidere.project@gmail.com";
public static final String APP_NAME = "Twidere";
public static final String APP_PACKAGE_NAME = "org.mariotaku.twidere";
public static final String APP_PROJECT_URL = "https://github.com/mariotaku/twidere";
public static final String APP_PROJECT_EMAIL = "twidere.project@gmail.com";
public static final String LOGTAG = APP_NAME;
public static final String LOGTAG = APP_NAME;
public static final String USER_NICKNAME_PREFERENCES_NAME = "user_nicknames";
public static final String USER_COLOR_PREFERENCES_NAME = "user_colors";
public static final String HOST_MAPPING_PREFERENCES_NAME = "host_mapping";
public static final String SHARED_PREFERENCES_NAME = "preferences";
public static final String PERMISSION_PREFERENCES_NAME = "app_permissions";
public static final String SILENT_NOTIFICATIONS_PREFERENCE_NAME = "silent_notifications";
public static final String TIMELINE_POSITIONS_PREFERENCES_NAME = "timeline_positions";
public static final String ACCOUNT_PREFERENCES_NAME_PREFIX = "account_preferences_";
public static final String USER_NICKNAME_PREFERENCES_NAME = "user_nicknames";
public static final String USER_COLOR_PREFERENCES_NAME = "user_colors";
public static final String HOST_MAPPING_PREFERENCES_NAME = "host_mapping";
public static final String SHARED_PREFERENCES_NAME = "preferences";
public static final String PERMISSION_PREFERENCES_NAME = "app_permissions";
public static final String SILENT_NOTIFICATIONS_PREFERENCE_NAME = "silent_notifications";
public static final String TIMELINE_POSITIONS_PREFERENCES_NAME = "timeline_positions";
public static final String ACCOUNT_PREFERENCES_NAME_PREFIX = "account_preferences_";
public static final String TWITTER_CONSUMER_KEY = "uAFVpMhBntJutfVj6abfA";
public static final String TWITTER_CONSUMER_SECRET = "JARXkJTfxo0F8MyctYy9bUmrLISjo8vXAHsZHYuk2E";
public static final String TWITTER_CONSUMER_KEY_2 = "UyaS0xmUQXKiJ48vZP4dXQ";
public static final String TWITTER_CONSUMER_SECRET_2 = "QlYVMWA751Dl5yNve41CNEN46GV4nxk57FmLeAXAV0";
public static final String TWITTER_CONSUMER_KEY = "uAFVpMhBntJutfVj6abfA";
public static final String TWITTER_CONSUMER_SECRET = "JARXkJTfxo0F8MyctYy9bUmrLISjo8vXAHsZHYuk2E";
public static final String TWITTER_CONSUMER_KEY_2 = "UyaS0xmUQXKiJ48vZP4dXQ";
public static final String TWITTER_CONSUMER_SECRET_2 = "QlYVMWA751Dl5yNve41CNEN46GV4nxk57FmLeAXAV0";
public static final String TWITTER_CONSUMER_KEY_3 = "YljS7Zmbw3JkouhZkxCINAsn6";
public static final String TWITTER_CONSUMER_SECRET_3 = "AYrXN6eAJ3Luf9o5zS4Flq2bSBhrB6A9eioI8JENRx8HMh9YuS";
public static final String SCHEME_HTTP = "http";
public static final String SCHEME_HTTPS = "https";
public static final String SCHEME_CONTENT = "content";
public static final String SCHEME_TWIDERE = "twidere";
public static final String SCHEME_HTTP = "http";
public static final String SCHEME_HTTPS = "https";
public static final String SCHEME_CONTENT = "content";
public static final String SCHEME_TWIDERE = "twidere";
public static final String PROTOCOL_HTTP = SCHEME_HTTP + "://";
public static final String PROTOCOL_HTTPS = SCHEME_HTTPS + "://";
public static final String PROTOCOL_CONTENT = SCHEME_CONTENT + "://";
public static final String PROTOCOL_TWIDERE = SCHEME_TWIDERE + "://";
public static final String PROTOCOL_HTTP = SCHEME_HTTP + "://";
public static final String PROTOCOL_HTTPS = SCHEME_HTTPS + "://";
public static final String PROTOCOL_CONTENT = SCHEME_CONTENT + "://";
public static final String PROTOCOL_TWIDERE = SCHEME_TWIDERE + "://";
public static final String AUTHORITY_USER = "user";
public static final String AUTHORITY_USERS = "users";
public static final String AUTHORITY_USER_TIMELINE = "user_timeline";
public static final String AUTHORITY_USER_FAVORITES = "user_favorites";
public static final String AUTHORITY_USER_FOLLOWERS = "user_followers";
public static final String AUTHORITY_USER_FRIENDS = "user_friends";
public static final String AUTHORITY_USER_BLOCKS = "user_blocks";
public static final String AUTHORITY_STATUS = "status";
public static final String AUTHORITY_STATUSES = "statuses";
public static final String AUTHORITY_DIRECT_MESSAGES_CONVERSATION = "direct_messages_conversation";
public static final String AUTHORITY_SEARCH = "search";
public static final String AUTHORITY_MAP = "map";
public static final String AUTHORITY_USER_LIST = "user_list";
public static final String AUTHORITY_USER_LIST_TIMELINE = "user_list_timeline";
public static final String AUTHORITY_USER_LIST_MEMBERS = "user_list_members";
public static final String AUTHORITY_USER_LIST_SUBSCRIBERS = "user_list_subscribers";
public static final String AUTHORITY_USER_LIST_MEMBERSHIPS = "user_list_memberships";
public static final String AUTHORITY_USER_LISTS = "user_lists";
public static final String AUTHORITY_USERS_RETWEETED_STATUS = "users_retweeted_status";
public static final String AUTHORITY_SAVED_SEARCHES = "saved_searches";
public static final String AUTHORITY_SEARCH_USERS = "search_users";
public static final String AUTHORITY_SEARCH_TWEETS = "search_tweets";
public static final String AUTHORITY_TRENDS = "trends";
public static final String AUTHORITY_USER_MENTIONS = "user_mentions";
public static final String AUTHORITY_ACTIVITIES_ABOUT_ME = "activities_about_me";
public static final String AUTHORITY_ACTIVITIES_BY_FRIENDS = "activities_by_friends";
public static final String AUTHORITY_INCOMING_FRIENDSHIPS = "incoming_friendships";
public static final String AUTHORITY_STATUS_RETWEETERS = "status_retweeters";
public static final String AUTHORITY_STATUS_FAVORITERS = "status_favoriters";
public static final String AUTHORITY_STATUS_REPLIES = "status_replies";
public static final String AUTHORITY_RETWEETS_OF_ME = "retweets_of_me";
public static final String AUTHORITY_MUTES_USERS = "mutes_users";
public static final String AUTHORITY_USER = "user";
public static final String AUTHORITY_USERS = "users";
public static final String AUTHORITY_USER_TIMELINE = "user_timeline";
public static final String AUTHORITY_USER_FAVORITES = "user_favorites";
public static final String AUTHORITY_USER_FOLLOWERS = "user_followers";
public static final String AUTHORITY_USER_FRIENDS = "user_friends";
public static final String AUTHORITY_USER_BLOCKS = "user_blocks";
public static final String AUTHORITY_STATUS = "status";
public static final String AUTHORITY_STATUSES = "statuses";
public static final String AUTHORITY_DIRECT_MESSAGES_CONVERSATION = "direct_messages_conversation";
public static final String AUTHORITY_SEARCH = "search";
public static final String AUTHORITY_MAP = "map";
public static final String AUTHORITY_USER_LIST = "user_list";
public static final String AUTHORITY_USER_LIST_TIMELINE = "user_list_timeline";
public static final String AUTHORITY_USER_LIST_MEMBERS = "user_list_members";
public static final String AUTHORITY_USER_LIST_SUBSCRIBERS = "user_list_subscribers";
public static final String AUTHORITY_USER_LIST_MEMBERSHIPS = "user_list_memberships";
public static final String AUTHORITY_USER_LISTS = "user_lists";
public static final String AUTHORITY_USERS_RETWEETED_STATUS = "users_retweeted_status";
public static final String AUTHORITY_SAVED_SEARCHES = "saved_searches";
public static final String AUTHORITY_SEARCH_USERS = "search_users";
public static final String AUTHORITY_SEARCH_TWEETS = "search_tweets";
public static final String AUTHORITY_TRENDS = "trends";
public static final String AUTHORITY_USER_MENTIONS = "user_mentions";
public static final String AUTHORITY_ACTIVITIES_ABOUT_ME = "activities_about_me";
public static final String AUTHORITY_ACTIVITIES_BY_FRIENDS = "activities_by_friends";
public static final String AUTHORITY_INCOMING_FRIENDSHIPS = "incoming_friendships";
public static final String AUTHORITY_STATUS_RETWEETERS = "status_retweeters";
public static final String AUTHORITY_STATUS_FAVORITERS = "status_favoriters";
public static final String AUTHORITY_STATUS_REPLIES = "status_replies";
public static final String AUTHORITY_RETWEETS_OF_ME = "retweets_of_me";
public static final String AUTHORITY_MUTES_USERS = "mutes_users";
public static final String QUERY_PARAM_ACCOUNT_ID = "account_id";
public static final String QUERY_PARAM_ACCOUNT_IDS = "account_ids";
public static final String QUERY_PARAM_ACCOUNT_NAME = "account_name";
public static final String QUERY_PARAM_STATUS_ID = "status_id";
public static final String QUERY_PARAM_USER_ID = "user_id";
public static final String QUERY_PARAM_LIST_ID = "list_id";
public static final String QUERY_PARAM_SCREEN_NAME = "screen_name";
public static final String QUERY_PARAM_LIST_NAME = "list_name";
public static final String QUERY_PARAM_QUERY = "query";
public static final String QUERY_PARAM_TYPE = "type";
public static final String QUERY_PARAM_VALUE_USERS = "users";
public static final String QUERY_PARAM_VALUE_TWEETS = "tweets";
public static final String QUERY_PARAM_NOTIFY = "notify";
public static final String QUERY_PARAM_LAT = "lat";
public static final String QUERY_PARAM_LNG = "lng";
public static final String QUERY_PARAM_URL = "url";
public static final String QUERY_PARAM_NAME = "name";
public static final String QUERY_PARAM_FINISH_ONLY = "finish_only";
public static final String QUERY_PARAM_NEW_ITEMS_COUNT = "new_items_count";
public static final String QUERY_PARAM_RECIPIENT_ID = "recipient_id";
public static final String QUERY_PARAM_ACCOUNT_ID = "account_id";
public static final String QUERY_PARAM_ACCOUNT_IDS = "account_ids";
public static final String QUERY_PARAM_ACCOUNT_NAME = "account_name";
public static final String QUERY_PARAM_STATUS_ID = "status_id";
public static final String QUERY_PARAM_USER_ID = "user_id";
public static final String QUERY_PARAM_LIST_ID = "list_id";
public static final String QUERY_PARAM_SCREEN_NAME = "screen_name";
public static final String QUERY_PARAM_LIST_NAME = "list_name";
public static final String QUERY_PARAM_QUERY = "query";
public static final String QUERY_PARAM_TYPE = "type";
public static final String QUERY_PARAM_VALUE_USERS = "users";
public static final String QUERY_PARAM_VALUE_TWEETS = "tweets";
public static final String QUERY_PARAM_NOTIFY = "notify";
public static final String QUERY_PARAM_LAT = "lat";
public static final String QUERY_PARAM_LNG = "lng";
public static final String QUERY_PARAM_URL = "url";
public static final String QUERY_PARAM_NAME = "name";
public static final String QUERY_PARAM_FINISH_ONLY = "finish_only";
public static final String QUERY_PARAM_NEW_ITEMS_COUNT = "new_items_count";
public static final String QUERY_PARAM_RECIPIENT_ID = "recipient_id";
public static final String DEFAULT_PROTOCOL = PROTOCOL_HTTPS;
public static final String DEFAULT_PROTOCOL = PROTOCOL_HTTPS;
public static final String OAUTH_CALLBACK_OOB = "oob";
public static final String OAUTH_CALLBACK_URL = PROTOCOL_TWIDERE + "com.twitter.oauth/";
public static final String OAUTH_CALLBACK_OOB = "oob";
public static final String OAUTH_CALLBACK_URL = PROTOCOL_TWIDERE + "com.twitter.oauth/";
public static final int REQUEST_TAKE_PHOTO = 1;
public static final int REQUEST_PICK_IMAGE = 2;
public static final int REQUEST_SELECT_ACCOUNT = 3;
public static final int REQUEST_COMPOSE = 4;
public static final int REQUEST_EDIT_API = 5;
public static final int REQUEST_BROWSER_SIGN_IN = 6;
public static final int REQUEST_SET_COLOR = 7;
public static final int REQUEST_SAVE_FILE = 8;
public static final int REQUEST_EDIT_IMAGE = 9;
public static final int REQUEST_EXTENSION_COMPOSE = 10;
public static final int REQUEST_ADD_TAB = 11;
public static final int REQUEST_EDIT_TAB = 12;
public static final int REQUEST_PICK_FILE = 13;
public static final int REQUEST_PICK_DIRECTORY = 14;
public static final int REQUEST_ADD_TO_LIST = 15;
public static final int REQUEST_SELECT_USER = 16;
public static final int REQUEST_SELECT_USER_LIST = 17;
public static final int REQUEST_PICK_ACTIVITY = 18;
public static final int REQUEST_SETTINGS = 19;
public static final int REQUEST_OPEN_DOCUMENT = 20;
public static final int REQUEST_SWIPEBACK_ACTIVITY = 101;
public static final int REQUEST_TAKE_PHOTO = 1;
public static final int REQUEST_PICK_IMAGE = 2;
public static final int REQUEST_SELECT_ACCOUNT = 3;
public static final int REQUEST_COMPOSE = 4;
public static final int REQUEST_EDIT_API = 5;
public static final int REQUEST_BROWSER_SIGN_IN = 6;
public static final int REQUEST_SET_COLOR = 7;
public static final int REQUEST_SAVE_FILE = 8;
public static final int REQUEST_EDIT_IMAGE = 9;
public static final int REQUEST_EXTENSION_COMPOSE = 10;
public static final int REQUEST_ADD_TAB = 11;
public static final int REQUEST_EDIT_TAB = 12;
public static final int REQUEST_PICK_FILE = 13;
public static final int REQUEST_PICK_DIRECTORY = 14;
public static final int REQUEST_ADD_TO_LIST = 15;
public static final int REQUEST_SELECT_USER = 16;
public static final int REQUEST_SELECT_USER_LIST = 17;
public static final int REQUEST_PICK_ACTIVITY = 18;
public static final int REQUEST_SETTINGS = 19;
public static final int REQUEST_OPEN_DOCUMENT = 20;
public static final int REQUEST_SWIPEBACK_ACTIVITY = 101;
public static final int TABLE_ID_ACCOUNTS = 1;
public static final int TABLE_ID_STATUSES = 12;
public static final int TABLE_ID_MENTIONS = 13;
public static final int TABLE_ID_DIRECT_MESSAGES = 21;
public static final int TABLE_ID_DIRECT_MESSAGES_INBOX = 22;
public static final int TABLE_ID_DIRECT_MESSAGES_OUTBOX = 23;
public static final int TABLE_ID_DIRECT_MESSAGES_CONVERSATION = 24;
public static final int TABLE_ID_DIRECT_MESSAGES_CONVERSATION_SCREEN_NAME = 25;
public static final int TABLE_ID_DIRECT_MESSAGES_CONVERSATIONS_ENTRIES = 26;
public static final int TABLE_ID_FILTERED_USERS = 31;
public static final int TABLE_ID_FILTERED_KEYWORDS = 32;
public static final int TABLE_ID_FILTERED_SOURCES = 33;
public static final int TABLE_ID_FILTERED_LINKS = 34;
public static final int TABLE_ID_TRENDS_LOCAL = 41;
public static final int TABLE_ID_DRAFTS = 51;
public static final int TABLE_ID_TABS = 52;
public static final int TABLE_ID_CACHED_USERS = 61;
public static final int TABLE_ID_CACHED_STATUSES = 62;
public static final int TABLE_ID_CACHED_HASHTAGS = 63;
public static final int VIRTUAL_TABLE_ID_DATABASE_READY = 100;
public static final int VIRTUAL_TABLE_ID_NOTIFICATIONS = 101;
public static final int VIRTUAL_TABLE_ID_PREFERENCES = 102;
public static final int VIRTUAL_TABLE_ID_ALL_PREFERENCES = 103;
public static final int VIRTUAL_TABLE_ID_PERMISSIONS = 104;
public static final int VIRTUAL_TABLE_ID_DNS = 105;
public static final int VIRTUAL_TABLE_ID_CACHED_IMAGES = 106;
public static final int VIRTUAL_TABLE_ID_CACHE_FILES = 107;
public static final int VIRTUAL_TABLE_ID_UNREAD_COUNTS = 108;
public static final int VIRTUAL_TABLE_ID_UNREAD_COUNTS_BY_TYPE = 109;
public static final int TABLE_ID_ACCOUNTS = 1;
public static final int TABLE_ID_STATUSES = 12;
public static final int TABLE_ID_MENTIONS = 13;
public static final int TABLE_ID_DIRECT_MESSAGES = 21;
public static final int TABLE_ID_DIRECT_MESSAGES_INBOX = 22;
public static final int TABLE_ID_DIRECT_MESSAGES_OUTBOX = 23;
public static final int TABLE_ID_DIRECT_MESSAGES_CONVERSATION = 24;
public static final int TABLE_ID_DIRECT_MESSAGES_CONVERSATION_SCREEN_NAME = 25;
public static final int TABLE_ID_DIRECT_MESSAGES_CONVERSATIONS_ENTRIES = 26;
public static final int TABLE_ID_FILTERED_USERS = 31;
public static final int TABLE_ID_FILTERED_KEYWORDS = 32;
public static final int TABLE_ID_FILTERED_SOURCES = 33;
public static final int TABLE_ID_FILTERED_LINKS = 34;
public static final int TABLE_ID_TRENDS_LOCAL = 41;
public static final int TABLE_ID_DRAFTS = 51;
public static final int TABLE_ID_TABS = 52;
public static final int TABLE_ID_CACHED_USERS = 61;
public static final int TABLE_ID_CACHED_STATUSES = 62;
public static final int TABLE_ID_CACHED_HASHTAGS = 63;
public static final int VIRTUAL_TABLE_ID_DATABASE_READY = 100;
public static final int VIRTUAL_TABLE_ID_NOTIFICATIONS = 101;
public static final int VIRTUAL_TABLE_ID_PREFERENCES = 102;
public static final int VIRTUAL_TABLE_ID_ALL_PREFERENCES = 103;
public static final int VIRTUAL_TABLE_ID_PERMISSIONS = 104;
public static final int VIRTUAL_TABLE_ID_DNS = 105;
public static final int VIRTUAL_TABLE_ID_CACHED_IMAGES = 106;
public static final int VIRTUAL_TABLE_ID_CACHE_FILES = 107;
public static final int VIRTUAL_TABLE_ID_UNREAD_COUNTS = 108;
public static final int VIRTUAL_TABLE_ID_UNREAD_COUNTS_BY_TYPE = 109;
public static final int NOTIFICATION_ID_HOME_TIMELINE = 1;
public static final int NOTIFICATION_ID_MENTIONS = 2;
public static final int NOTIFICATION_ID_DIRECT_MESSAGES = 3;
public static final int NOTIFICATION_ID_DRAFTS = 4;
public static final int NOTIFICATION_ID_DATA_PROFILING = 5;
public static final int NOTIFICATION_ID_UPDATE_STATUS = 101;
public static final int NOTIFICATION_ID_SEND_DIRECT_MESSAGE = 102;
public static final int NOTIFICATION_ID_HOME_TIMELINE = 1;
public static final int NOTIFICATION_ID_MENTIONS = 2;
public static final int NOTIFICATION_ID_DIRECT_MESSAGES = 3;
public static final int NOTIFICATION_ID_DRAFTS = 4;
public static final int NOTIFICATION_ID_DATA_PROFILING = 5;
public static final int NOTIFICATION_ID_UPDATE_STATUS = 101;
public static final int NOTIFICATION_ID_SEND_DIRECT_MESSAGE = 102;
public static final String ICON_SPECIAL_TYPE_CUSTOMIZE = "_customize";
public static final String ICON_SPECIAL_TYPE_CUSTOMIZE = "_customize";
public static final String TASK_TAG_GET_HOME_TIMELINE = "get_home_tomeline";
public static final String TASK_TAG_GET_MENTIONS = "get_mentions";
public static final String TASK_TAG_GET_SENT_DIRECT_MESSAGES = "get_sent_direct_messages";
public static final String TASK_TAG_GET_RECEIVED_DIRECT_MESSAGES = "get_received_direct_messages";
public static final String TASK_TAG_GET_TRENDS = "get_trends";
public static final String TASK_TAG_STORE_HOME_TIMELINE = "store_home_tomeline";
public static final String TASK_TAG_STORE_MENTIONS = "store_mentions";
public static final String TASK_TAG_STORE_SENT_DIRECT_MESSAGES = "store_sent_direct_messages";
public static final String TASK_TAG_STORE_RECEIVED_DIRECT_MESSAGES = "store_received_direct_messages";
public static final String TASK_TAG_STORE_TRENDS = "store_trends";
public static final String TASK_TAG_GET_HOME_TIMELINE = "get_home_tomeline";
public static final String TASK_TAG_GET_MENTIONS = "get_mentions";
public static final String TASK_TAG_GET_SENT_DIRECT_MESSAGES = "get_sent_direct_messages";
public static final String TASK_TAG_GET_RECEIVED_DIRECT_MESSAGES = "get_received_direct_messages";
public static final String TASK_TAG_GET_TRENDS = "get_trends";
public static final String TASK_TAG_STORE_HOME_TIMELINE = "store_home_tomeline";
public static final String TASK_TAG_STORE_MENTIONS = "store_mentions";
public static final String TASK_TAG_STORE_SENT_DIRECT_MESSAGES = "store_sent_direct_messages";
public static final String TASK_TAG_STORE_RECEIVED_DIRECT_MESSAGES = "store_received_direct_messages";
public static final String TASK_TAG_STORE_TRENDS = "store_trends";
public static final String SERVICE_COMMAND_REFRESH_ALL = "refresh_all";
public static final String SERVICE_COMMAND_GET_HOME_TIMELINE = "get_home_timeline";
public static final String SERVICE_COMMAND_GET_MENTIONS = "get_mentions";
public static final String SERVICE_COMMAND_GET_SENT_DIRECT_MESSAGES = "get_sent_direct_messages";
public static final String SERVICE_COMMAND_GET_RECEIVED_DIRECT_MESSAGES = "get_received_direct_messages";
public static final String SERVICE_COMMAND_REFRESH_ALL = "refresh_all";
public static final String SERVICE_COMMAND_GET_HOME_TIMELINE = "get_home_timeline";
public static final String SERVICE_COMMAND_GET_MENTIONS = "get_mentions";
public static final String SERVICE_COMMAND_GET_SENT_DIRECT_MESSAGES = "get_sent_direct_messages";
public static final String SERVICE_COMMAND_GET_RECEIVED_DIRECT_MESSAGES = "get_received_direct_messages";
public static final String METADATA_KEY_EXTENSION = "org.mariotaku.twidere.extension";
public static final String METADATA_KEY_EXTENSION_PERMISSIONS = "org.mariotaku.twidere.extension.permissions";
public static final String METADATA_KEY_EXTENSION_SETTINGS = "org.mariotaku.twidere.extension.settings";
public static final String METADATA_KEY_EXTENSION_ICON = "org.mariotaku.twidere.extension.icon";
public static final String METADATA_KEY_EXTENSION_USE_JSON = "org.mariotaku.twidere.extension.use_json";
public static final String METADATA_KEY_EXTENSION = "org.mariotaku.twidere.extension";
public static final String METADATA_KEY_EXTENSION_PERMISSIONS = "org.mariotaku.twidere.extension.permissions";
public static final String METADATA_KEY_EXTENSION_SETTINGS = "org.mariotaku.twidere.extension.settings";
public static final String METADATA_KEY_EXTENSION_ICON = "org.mariotaku.twidere.extension.icon";
public static final String METADATA_KEY_EXTENSION_USE_JSON = "org.mariotaku.twidere.extension.use_json";
public static final char SEPARATOR_PERMISSION = '|';
public static final String SEPARATOR_PERMISSION_REGEX = "\\" + SEPARATOR_PERMISSION;
public static final char SEPARATOR_PERMISSION = '|';
public static final String SEPARATOR_PERMISSION_REGEX = "\\" + SEPARATOR_PERMISSION;
public static final String PERMISSION_DENIED = "denied";
public static final String PERMISSION_REFRESH = "refresh";
public static final String PERMISSION_READ = "read";
public static final String PERMISSION_WRITE = "write";
public static final String PERMISSION_DIRECT_MESSAGES = "direct_messages";
public static final String PERMISSION_ACCOUNTS = "accounts";
public static final String PERMISSION_PREFERENCES = "preferences";
public static final String PERMISSION_DENIED = "denied";
public static final String PERMISSION_REFRESH = "refresh";
public static final String PERMISSION_READ = "read";
public static final String PERMISSION_WRITE = "write";
public static final String PERMISSION_DIRECT_MESSAGES = "direct_messages";
public static final String PERMISSION_ACCOUNTS = "accounts";
public static final String PERMISSION_PREFERENCES = "preferences";
public static final String TAB_TYPE_HOME_TIMELINE = "home_timeline";
public static final String TAB_TYPE_MENTIONS_TIMELINE = "mentions_timeline";
public static final String TAB_TYPE_TRENDS_SUGGESTIONS = "trends_suggestions";
public static final String TAB_TYPE_DIRECT_MESSAGES = "direct_messages";
public static final String TAB_TYPE_FAVORITES = "favorites";
public static final String TAB_TYPE_USER_TIMELINE = "user_timeline";
public static final String TAB_TYPE_SEARCH_STATUSES = "search_statuses";
public static final String TAB_TYPE_LIST_TIMELINE = "list_timeline";
public static final String TAB_TYPE_ACTIVITIES_ABOUT_ME = "activities_about_me";
public static final String TAB_TYPE_ACTIVITIES_BY_FRIENDS = "activities_by_friends";
public static final String TAB_TYPE_RETWEETS_OF_ME = "retweets_of_me";
public static final String TAB_TYPE_STAGGERED_HOME_TIMELINE = "staggered_home_timeline";
public static final String TAB_TYPE_HOME_TIMELINE = "home_timeline";
public static final String TAB_TYPE_MENTIONS_TIMELINE = "mentions_timeline";
public static final String TAB_TYPE_TRENDS_SUGGESTIONS = "trends_suggestions";
public static final String TAB_TYPE_DIRECT_MESSAGES = "direct_messages";
public static final String TAB_TYPE_FAVORITES = "favorites";
public static final String TAB_TYPE_USER_TIMELINE = "user_timeline";
public static final String TAB_TYPE_SEARCH_STATUSES = "search_statuses";
public static final String TAB_TYPE_LIST_TIMELINE = "list_timeline";
public static final String TAB_TYPE_ACTIVITIES_ABOUT_ME = "activities_about_me";
public static final String TAB_TYPE_ACTIVITIES_BY_FRIENDS = "activities_by_friends";
public static final String TAB_TYPE_RETWEETS_OF_ME = "retweets_of_me";
public static final String TAB_TYPE_STAGGERED_HOME_TIMELINE = "staggered_home_timeline";
public static final int TWITTER_MAX_IMAGE_SIZE = 3145728;
public static final int TWITTER_MAX_IMAGE_WIDTH = 1024;
public static final int TWITTER_MAX_IMAGE_HEIGHT = 2048;
public static final int TWITTER_MAX_IMAGE_SIZE = 3145728;
public static final int TWITTER_MAX_IMAGE_WIDTH = 1024;
public static final int TWITTER_MAX_IMAGE_HEIGHT = 2048;
}

View File

@ -42,7 +42,7 @@ public class MainActivity extends Activity implements Constants {
StrictModeUtils.detectAllVmPolicy();
StrictModeUtils.detectAllThreadPolicy();
}
// ThemeUtils.overrideActivityOpenAnimation(this);
ThemeUtils.overrideActivityOpenAnimation(this);
super.onCreate(savedInstanceState);
final Intent intent = new Intent(this, HomeActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);

View File

@ -41,88 +41,88 @@ import org.mariotaku.twidere.util.NyanSurfaceHelper;
public class NyanActivity extends Activity implements Constants, OnLongClickListener, OnSharedPreferenceChangeListener {
private SurfaceView mSurfaceView;
private SharedPreferences mPreferences;
private NyanSurfaceHelper mHelper;
private SurfaceView mSurfaceView;
private SharedPreferences mPreferences;
private NyanSurfaceHelper mHelper;
@Override
public void onContentChanged() {
super.onContentChanged();
mSurfaceView = (SurfaceView) findViewById(R.id.surface);
}
@Override
public void onContentChanged() {
super.onContentChanged();
mSurfaceView = (SurfaceView) findViewById(R.id.surface);
}
@Override
public boolean onLongClick(final View v) {
Toast.makeText(this, R.string.nyan_sakamoto, Toast.LENGTH_SHORT).show();
return true;
}
@Override
public boolean onLongClick(final View v) {
Toast.makeText(this, R.string.nyan_sakamoto, Toast.LENGTH_SHORT).show();
return true;
}
@Override
public void onSharedPreferenceChanged(final SharedPreferences sharedPreferences, final String key) {
if (KEY_LIVE_WALLPAPER_SCALE.equals(key)) {
updateSurface();
}
}
@Override
public void onSharedPreferenceChanged(final SharedPreferences sharedPreferences, final String key) {
if (KEY_LIVE_WALLPAPER_SCALE.equals(key)) {
updateSurface();
}
}
@Override
protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mPreferences = getSharedPreferences(SHARED_PREFERENCES_NAME, MODE_PRIVATE);
mPreferences.registerOnSharedPreferenceChangeListener(this);
setContentView(R.layout.surface_view);
mSurfaceView.setOnLongClickListener(this);
final SurfaceHolder holder = mSurfaceView.getHolder();
mHelper = new NyanSurfaceHelper(this);
holder.addCallback(mHelper);
updateSurface();
enableWallpaperDaydream();
}
@Override
protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mPreferences = getSharedPreferences(SHARED_PREFERENCES_NAME, MODE_PRIVATE);
mPreferences.registerOnSharedPreferenceChangeListener(this);
setContentView(R.layout.surface_view);
mSurfaceView.setOnLongClickListener(this);
final SurfaceHolder holder = mSurfaceView.getHolder();
mHelper = new NyanSurfaceHelper(this);
holder.addCallback(mHelper);
updateSurface();
enableWallpaperDaydream();
}
@Override
protected void onStart() {
super.onStart();
if (mHelper != null) {
mHelper.start();
}
}
@Override
protected void onStart() {
super.onStart();
if (mHelper != null) {
mHelper.start();
}
}
@Override
protected void onStop() {
if (mHelper != null) {
mHelper.stop();
}
super.onStop();
}
@Override
protected void onStop() {
if (mHelper != null) {
mHelper.stop();
}
super.onStop();
}
private void enableWallpaperDaydream() {
final PackageManager pm = getPackageManager();
final ComponentName wallpaperComponent = new ComponentName(this, NyanWallpaperService.class);
final int wallpaperState = pm.getComponentEnabledSetting(wallpaperComponent);
boolean showToast = false;
if (wallpaperState != PackageManager.COMPONENT_ENABLED_STATE_ENABLED) {
pm.setComponentEnabledSetting(wallpaperComponent, PackageManager.COMPONENT_ENABLED_STATE_ENABLED,
PackageManager.DONT_KILL_APP);
showToast = true;
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
final ComponentName daydreamComponent = new ComponentName(this, NyanDaydreamService.class);
final int daydreamState = pm.getComponentEnabledSetting(daydreamComponent);
if (daydreamState != PackageManager.COMPONENT_ENABLED_STATE_ENABLED) {
pm.setComponentEnabledSetting(daydreamComponent, PackageManager.COMPONENT_ENABLED_STATE_ENABLED,
PackageManager.DONT_KILL_APP);
showToast = true;
}
}
if (showToast) {
Toast.makeText(this, R.string.livewp_daydream_enabled_message, Toast.LENGTH_SHORT).show();
}
}
private void enableWallpaperDaydream() {
final PackageManager pm = getPackageManager();
final ComponentName wallpaperComponent = new ComponentName(this, NyanWallpaperService.class);
final int wallpaperState = pm.getComponentEnabledSetting(wallpaperComponent);
boolean showToast = false;
if (wallpaperState != PackageManager.COMPONENT_ENABLED_STATE_ENABLED) {
pm.setComponentEnabledSetting(wallpaperComponent, PackageManager.COMPONENT_ENABLED_STATE_ENABLED,
PackageManager.DONT_KILL_APP);
showToast = true;
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
final ComponentName daydreamComponent = new ComponentName(this, NyanDaydreamService.class);
final int daydreamState = pm.getComponentEnabledSetting(daydreamComponent);
if (daydreamState != PackageManager.COMPONENT_ENABLED_STATE_ENABLED) {
pm.setComponentEnabledSetting(daydreamComponent, PackageManager.COMPONENT_ENABLED_STATE_ENABLED,
PackageManager.DONT_KILL_APP);
showToast = true;
}
}
if (showToast) {
Toast.makeText(this, R.string.livewp_daydream_enabled_message, Toast.LENGTH_SHORT).show();
}
}
private void updateSurface() {
if (mPreferences == null) return;
final Resources res = getResources();
final int def = res.getInteger(R.integer.default_live_wallpaper_scale);
mHelper.setScale(mPreferences.getInt(KEY_LIVE_WALLPAPER_SCALE, def));
}
private void updateSurface() {
if (mPreferences == null) return;
final Resources res = getResources();
final int def = res.getInteger(R.integer.default_live_wallpaper_scale);
mHelper.setScale(mPreferences.getInt(KEY_LIVE_WALLPAPER_SCALE, def));
}
}

View File

@ -19,19 +19,26 @@
package org.mariotaku.twidere.activity;
import android.app.ActionBar;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import org.mariotaku.twidere.Constants;
import org.mariotaku.twidere.R;
import org.mariotaku.twidere.activity.support.BaseSupportActivity;
public class TestActivity extends Activity implements Constants {
@Override
protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@Override
protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
final ActionBar actionBar = getActionBar();
if (actionBar != null) {
actionBar.hide();
}
startActivity(new Intent(this, SettingsWizardActivity.class));
finish();
}
}
}

View File

@ -168,8 +168,8 @@ public class APIEditorActivity extends BaseSupportDialogActivity implements Twit
final int prefAuthType = pref.getInt(KEY_AUTH_TYPE, Accounts.AUTH_TYPE_OAUTH);
final boolean prefSameOAuthSigningUrl = pref.getBoolean(KEY_SAME_OAUTH_SIGNING_URL, false);
final boolean prefNoVersionSuffix = pref.getBoolean(KEY_NO_VERSION_SUFFIX, false);
final String prefConsumerKey = getNonEmptyString(pref, KEY_CONSUMER_KEY, TWITTER_CONSUMER_KEY_2);
final String prefConsumerSecret = getNonEmptyString(pref, KEY_CONSUMER_SECRET, TWITTER_CONSUMER_SECRET_2);
final String prefConsumerKey = getNonEmptyString(pref, KEY_CONSUMER_KEY, TWITTER_CONSUMER_KEY_3);
final String prefConsumerSecret = getNonEmptyString(pref, KEY_CONSUMER_SECRET, TWITTER_CONSUMER_SECRET_3);
if (savedInstanceState != null) {
apiUrlFormat = trim(savedInstanceState.getString(Accounts.API_URL_FORMAT, prefApiUrlFormat));
authType = savedInstanceState.getInt(Accounts.AUTH_TYPE, prefAuthType);

View File

@ -1,92 +0,0 @@
/*
* Twidere - Twitter client for Android
*
* Copyright (C) 2012-2014 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.activity.support;
import android.annotation.SuppressLint;
import android.os.Bundle;
import android.view.View;
import me.imid.swipebacklayout.lib.SwipeBackLayout;
import me.imid.swipebacklayout.lib.SwipeBackLayout.SwipeListener;
import me.imid.swipebacklayout.lib.app.SwipeBackActivityBase;
import me.imid.swipebacklayout.lib.app.SwipeBackActivityHelper;
@SuppressLint("Registered")
public class BaseSupportThemedSwipeBackActivity extends BaseSupportActivity implements SwipeBackActivityBase {
private SwipeBackActivityHelper mSwipebackHelper;
@Override
public View findViewById(final int id) {
final View v = super.findViewById(id);
if (v == null && mSwipebackHelper != null) return mSwipebackHelper.findViewById(id);
return v;
}
@Override
public SwipeBackLayout getSwipeBackLayout() {
if (mSwipebackHelper == null) return null;
return mSwipebackHelper.getSwipeBackLayout();
}
public boolean isSwiping() {
final SwipeBackLayout swipeBackLayout = getSwipeBackLayout();
return swipeBackLayout != null && swipeBackLayout.isSwiping();
}
@Override
public void scrollToFinishActivity() {
final SwipeBackLayout swipeBackLayout = getSwipeBackLayout();
if (swipeBackLayout == null) return;
swipeBackLayout.scrollToFinishActivity();
}
@Override
public void setSwipeBackEnable(final boolean enable) {
final SwipeBackLayout swipeBackLayout = getSwipeBackLayout();
if (swipeBackLayout == null) return;
swipeBackLayout.setEnableGesture(enable);
}
public void setSwipeListener(final SwipeListener listener) {
final SwipeBackLayout swipeBackLayout = getSwipeBackLayout();
if (swipeBackLayout == null) return;
swipeBackLayout.setSwipeListener(listener);
}
@Override
protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mSwipebackHelper = new SwipeBackActivityHelper(this);
mSwipebackHelper.onActivtyCreate();
}
@Override
protected void onDestroy() {
super.onDestroy();
mSwipebackHelper.onDestroy();
}
@Override
protected void onPostCreate(final Bundle savedInstanceState) {
super.onPostCreate(savedInstanceState);
mSwipebackHelper.onPostCreate();
}
}

View File

@ -228,9 +228,9 @@ public class BrowserSignInActivity extends BaseSupportDialogActivity implements
final boolean enable_gzip_compressing = mPreferences.getBoolean(KEY_GZIP_COMPRESSING, false);
final boolean ignore_ssl_error = mPreferences.getBoolean(KEY_IGNORE_SSL_ERROR, false);
final boolean enable_proxy = mPreferences.getBoolean(KEY_ENABLE_PROXY, false);
final String consumer_key = getNonEmptyString(mPreferences, KEY_CONSUMER_KEY, TWITTER_CONSUMER_KEY_2);
final String consumer_key = getNonEmptyString(mPreferences, KEY_CONSUMER_KEY, TWITTER_CONSUMER_KEY_3);
final String consumer_secret = getNonEmptyString(mPreferences, KEY_CONSUMER_SECRET,
TWITTER_CONSUMER_SECRET_2);
TWITTER_CONSUMER_SECRET_3);
cb.setHostAddressResolverFactory(new TwidereHostResolverFactory(mApplication));
cb.setHttpClientFactory(new TwidereHttpClientFactory(mApplication));
setUserAgent(mActivity, cb);

View File

@ -19,8 +19,7 @@
package org.mariotaku.twidere.activity.support;
import static org.mariotaku.twidere.util.Utils.getDefaultTextSize;
import android.app.ActionBar;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.ContentResolver;
@ -68,274 +67,278 @@ import java.io.File;
import java.util.ArrayList;
import java.util.List;
import static org.mariotaku.twidere.util.Utils.getDefaultTextSize;
public class DraftsActivity extends BaseSupportActivity implements LoaderCallbacks<Cursor>, OnItemClickListener,
MultiChoiceModeListener {
MultiChoiceModeListener {
private ContentResolver mResolver;
private SharedPreferences mPreferences;
private ContentResolver mResolver;
private SharedPreferences mPreferences;
private DraftsAdapter mAdapter;
private ListView mListView;
private DraftsAdapter mAdapter;
private ListView mListView;
private PopupMenu mPopupMenu;
private PopupMenu mPopupMenu;
private float mTextSize;
private float mTextSize;
@Override
public boolean onActionItemClicked(final ActionMode mode, final MenuItem item) {
switch (item.getItemId()) {
case MENU_DELETE: {
final DeleteDraftsConfirmDialogFragment f = new DeleteDraftsConfirmDialogFragment();
final Bundle args = new Bundle();
args.putLongArray(EXTRA_IDS, mListView.getCheckedItemIds());
f.setArguments(args);
f.show(getSupportFragmentManager(), "delete_drafts_confirm");
break;
}
case MENU_SEND: {
final Cursor c = mAdapter.getCursor();
if (c == null || c.isClosed()) return false;
final SparseBooleanArray checked = mListView.getCheckedItemPositions();
final List<DraftItem> list = new ArrayList<DraftItem>();
final DraftItem.CursorIndices indices = new DraftItem.CursorIndices(c);
for (int i = 0, j = checked.size(); i < j; i++) {
if (checked.valueAt(i) && c.moveToPosition(checked.keyAt(i))) {
list.add(new DraftItem(c, indices));
}
}
if (sendDrafts(list)) {
final Where where = Where.in(new Column(Drafts._ID),
new RawItemArray(mListView.getCheckedItemIds()));
mResolver.delete(Drafts.CONTENT_URI, where.getSQL(), null);
}
break;
}
default: {
return false;
}
}
mode.finish();
return true;
}
@Override
public boolean onActionItemClicked(final ActionMode mode, final MenuItem item) {
switch (item.getItemId()) {
case MENU_DELETE: {
final DeleteDraftsConfirmDialogFragment f = new DeleteDraftsConfirmDialogFragment();
final Bundle args = new Bundle();
args.putLongArray(EXTRA_IDS, mListView.getCheckedItemIds());
f.setArguments(args);
f.show(getSupportFragmentManager(), "delete_drafts_confirm");
break;
}
case MENU_SEND: {
final Cursor c = mAdapter.getCursor();
if (c == null || c.isClosed()) return false;
final SparseBooleanArray checked = mListView.getCheckedItemPositions();
final List<DraftItem> list = new ArrayList<DraftItem>();
final DraftItem.CursorIndices indices = new DraftItem.CursorIndices(c);
for (int i = 0, j = checked.size(); i < j; i++) {
if (checked.valueAt(i) && c.moveToPosition(checked.keyAt(i))) {
list.add(new DraftItem(c, indices));
}
}
if (sendDrafts(list)) {
final Where where = Where.in(new Column(Drafts._ID),
new RawItemArray(mListView.getCheckedItemIds()));
mResolver.delete(Drafts.CONTENT_URI, where.getSQL(), null);
}
break;
}
default: {
return false;
}
}
mode.finish();
return true;
}
@Override
public boolean onCreateActionMode(final ActionMode mode, final Menu menu) {
getMenuInflater().inflate(R.menu.action_multi_select_drafts, menu);
return true;
}
@Override
public boolean onCreateActionMode(final ActionMode mode, final Menu menu) {
getMenuInflater().inflate(R.menu.action_multi_select_drafts, menu);
return true;
}
@Override
public Loader<Cursor> onCreateLoader(final int id, final Bundle args) {
final Uri uri = Drafts.CONTENT_URI;
final String[] cols = Drafts.COLUMNS;
final String orderBy = Drafts.TIMESTAMP + " DESC";
return new CursorLoader(this, uri, cols, null, null, orderBy);
}
@Override
public Loader<Cursor> onCreateLoader(final int id, final Bundle args) {
final Uri uri = Drafts.CONTENT_URI;
final String[] cols = Drafts.COLUMNS;
final String orderBy = Drafts.TIMESTAMP + " DESC";
return new CursorLoader(this, uri, cols, null, null, orderBy);
}
@Override
public void onDestroyActionMode(final ActionMode mode) {
@Override
public void onDestroyActionMode(final ActionMode mode) {
}
}
@Override
public void onItemCheckedStateChanged(final ActionMode mode, final int position, final long id,
final boolean checked) {
updateTitle(mode);
}
@Override
public void onItemCheckedStateChanged(final ActionMode mode, final int position, final long id,
final boolean checked) {
updateTitle(mode);
}
@Override
public void onItemClick(final AdapterView<?> view, final View child, final int position, final long id) {
final Cursor c = mAdapter.getCursor();
if (c == null || c.isClosed() || !c.moveToPosition(position)) return;
final DraftItem item = new DraftItem(c, new DraftItem.CursorIndices(c));
if (item.action_type == Drafts.ACTION_UPDATE_STATUS || item.action_type <= 0) {
editDraft(item);
}
}
@Override
public void onItemClick(final AdapterView<?> view, final View child, final int position, final long id) {
final Cursor c = mAdapter.getCursor();
if (c == null || c.isClosed() || !c.moveToPosition(position)) return;
final DraftItem item = new DraftItem(c, new DraftItem.CursorIndices(c));
if (item.action_type == Drafts.ACTION_UPDATE_STATUS || item.action_type <= 0) {
editDraft(item);
}
}
@Override
public void onLoaderReset(final Loader<Cursor> loader) {
mAdapter.swapCursor(null);
}
@Override
public void onLoaderReset(final Loader<Cursor> loader) {
mAdapter.swapCursor(null);
}
@Override
public void onLoadFinished(final Loader<Cursor> loader, final Cursor cursor) {
mAdapter.swapCursor(cursor);
}
@Override
public void onLoadFinished(final Loader<Cursor> loader, final Cursor cursor) {
mAdapter.swapCursor(cursor);
}
@Override
public boolean onOptionsItemSelected(final MenuItem item) {
switch (item.getItemId()) {
case MENU_HOME: {
onBackPressed();
break;
}
}
return super.onOptionsItemSelected(item);
}
@Override
public boolean onOptionsItemSelected(final MenuItem item) {
switch (item.getItemId()) {
case MENU_HOME: {
onBackPressed();
break;
}
}
return super.onOptionsItemSelected(item);
}
@Override
public boolean onPrepareActionMode(final ActionMode mode, final Menu menu) {
updateTitle(mode);
return true;
}
@Override
public boolean onPrepareActionMode(final ActionMode mode, final Menu menu) {
updateTitle(mode);
return true;
}
@Override
protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mResolver = getContentResolver();
mPreferences = getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE);
mTextSize = mPreferences.getInt(KEY_TEXT_SIZE, getDefaultTextSize(this));
setContentView(android.R.layout.list_content);
// setOverrideExitAniamtion(false);
getActionBar().setDisplayHomeAsUpEnabled(true);
mAdapter = new DraftsAdapter(this);
mListView = (ListView) findViewById(android.R.id.list);
mListView.setDivider(null);
mListView.setSelector(android.R.color.transparent);
mListView.setAdapter(mAdapter);
mListView.setOnItemClickListener(this);
mListView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE_MODAL);
mListView.setMultiChoiceModeListener(this);
getSupportLoaderManager().initLoader(0, null, this);
}
@Override
protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mResolver = getContentResolver();
mPreferences = getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE);
mTextSize = mPreferences.getInt(KEY_TEXT_SIZE, getDefaultTextSize(this));
setContentView(R.layout.activity_drafts);
final ActionBar actionBar = getActionBar();
if (actionBar != null) {
actionBar.setDisplayHomeAsUpEnabled(true);
}
mAdapter = new DraftsAdapter(this);
mListView = (ListView) findViewById(android.R.id.list);
mListView.setDivider(null);
mListView.setSelector(android.R.color.transparent);
mListView.setAdapter(mAdapter);
mListView.setOnItemClickListener(this);
mListView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE_MODAL);
mListView.setMultiChoiceModeListener(this);
getSupportLoaderManager().initLoader(0, null, this);
}
@Override
protected void onResume() {
super.onResume();
final float text_size = mPreferences.getInt(KEY_TEXT_SIZE, getDefaultTextSize(this));
mAdapter.setTextSize(text_size);
if (mTextSize != text_size) {
mTextSize = text_size;
mListView.invalidateViews();
}
}
@Override
protected void onResume() {
super.onResume();
final float text_size = mPreferences.getInt(KEY_TEXT_SIZE, getDefaultTextSize(this));
mAdapter.setTextSize(text_size);
if (mTextSize != text_size) {
mTextSize = text_size;
mListView.invalidateViews();
}
}
@Override
protected void onStart() {
final AsyncTwitterWrapper twitter = getTwitterWrapper();
if (twitter != null) {
twitter.clearNotificationAsync(NOTIFICATION_ID_DRAFTS);
}
super.onStart();
}
@Override
protected void onStart() {
final AsyncTwitterWrapper twitter = getTwitterWrapper();
if (twitter != null) {
twitter.clearNotificationAsync(NOTIFICATION_ID_DRAFTS);
}
super.onStart();
}
@Override
protected void onStop() {
if (mPopupMenu != null) {
mPopupMenu.dismiss();
}
super.onStop();
}
@Override
protected void onStop() {
if (mPopupMenu != null) {
mPopupMenu.dismiss();
}
super.onStop();
}
private void editDraft(final DraftItem draft) {
final Intent intent = new Intent(INTENT_ACTION_EDIT_DRAFT);
final Bundle bundle = new Bundle();
bundle.putParcelable(EXTRA_DRAFT, draft);
intent.putExtras(bundle);
mResolver.delete(Drafts.CONTENT_URI, Where.equals(Drafts._ID, draft._id).getSQL(), null);
startActivityForResult(intent, REQUEST_COMPOSE);
}
private void editDraft(final DraftItem draft) {
final Intent intent = new Intent(INTENT_ACTION_EDIT_DRAFT);
final Bundle bundle = new Bundle();
bundle.putParcelable(EXTRA_DRAFT, draft);
intent.putExtras(bundle);
mResolver.delete(Drafts.CONTENT_URI, Where.equals(Drafts._ID, draft._id).getSQL(), null);
startActivityForResult(intent, REQUEST_COMPOSE);
}
private boolean sendDrafts(final List<DraftItem> list) {
final AsyncTwitterWrapper twitter = getTwitterWrapper();
if (twitter == null) return false;
for (final DraftItem item : list) {
if (item.action_type == Drafts.ACTION_UPDATE_STATUS || item.action_type <= 0) {
twitter.updateStatusesAsync(new ParcelableStatusUpdate(this, item));
} else if (item.action_type == Drafts.ACTION_SEND_DIRECT_MESSAGE) {
final long recipientId = item.action_extras.optLong(EXTRA_RECIPIENT_ID);
if (item.account_ids == null || item.account_ids.length <= 0 || recipientId <= 0) {
continue;
}
final long accountId = item.account_ids[0];
final String imageUri = item.medias != null && item.medias.length > 0 ? item.medias[0].uri : null;
twitter.sendDirectMessageAsync(accountId, recipientId, item.text, imageUri);
}
}
return true;
}
private boolean sendDrafts(final List<DraftItem> list) {
final AsyncTwitterWrapper twitter = getTwitterWrapper();
if (twitter == null) return false;
for (final DraftItem item : list) {
if (item.action_type == Drafts.ACTION_UPDATE_STATUS || item.action_type <= 0) {
twitter.updateStatusesAsync(new ParcelableStatusUpdate(this, item));
} else if (item.action_type == Drafts.ACTION_SEND_DIRECT_MESSAGE) {
final long recipientId = item.action_extras.optLong(EXTRA_RECIPIENT_ID);
if (item.account_ids == null || item.account_ids.length <= 0 || recipientId <= 0) {
continue;
}
final long accountId = item.account_ids[0];
final String imageUri = item.medias != null && item.medias.length > 0 ? item.medias[0].uri : null;
twitter.sendDirectMessageAsync(accountId, recipientId, item.text, imageUri);
}
}
return true;
}
private void updateTitle(final ActionMode mode) {
if (mListView == null || mode == null) return;
final int count = mListView.getCheckedItemCount();
mode.setTitle(getResources().getQuantityString(R.plurals.Nitems_selected, count, count));
}
private void updateTitle(final ActionMode mode) {
if (mListView == null || mode == null) return;
final int count = mListView.getCheckedItemCount();
mode.setTitle(getResources().getQuantityString(R.plurals.Nitems_selected, count, count));
}
public static class DeleteDraftsConfirmDialogFragment extends BaseSupportDialogFragment implements OnClickListener {
public static class DeleteDraftsConfirmDialogFragment extends BaseSupportDialogFragment implements OnClickListener {
@Override
public void onClick(final DialogInterface dialog, final int which) {
switch (which) {
case DialogInterface.BUTTON_POSITIVE: {
final Bundle args = getArguments();
if (args == null) return;
final DeleteDraftsTask task = new DeleteDraftsTask(getActivity(), args.getLongArray(EXTRA_IDS));
task.execute();
break;
}
}
}
@Override
public void onClick(final DialogInterface dialog, final int which) {
switch (which) {
case DialogInterface.BUTTON_POSITIVE: {
final Bundle args = getArguments();
if (args == null) return;
final DeleteDraftsTask task = new DeleteDraftsTask(getActivity(), args.getLongArray(EXTRA_IDS));
task.execute();
break;
}
}
}
@Override
public Dialog onCreateDialog(final Bundle savedInstanceState) {
final Context context = ThemeUtils.getDialogThemedContext(getActivity());
final AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setMessage(R.string.delete_drafts_confirm);
builder.setPositiveButton(android.R.string.ok, this);
builder.setNegativeButton(android.R.string.cancel, null);
return builder.create();
}
@Override
public Dialog onCreateDialog(final Bundle savedInstanceState) {
final Context context = ThemeUtils.getDialogThemedContext(getActivity());
final AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setMessage(R.string.delete_drafts_confirm);
builder.setPositiveButton(android.R.string.ok, this);
builder.setNegativeButton(android.R.string.cancel, null);
return builder.create();
}
}
}
private static class DeleteDraftsTask extends AsyncTask<Void, Void, Integer> {
private static class DeleteDraftsTask extends AsyncTask<Void, Void, Integer> {
private static final String FRAGMENT_TAG_DELETING_DRAFTS = "deleting_drafts";
private final FragmentActivity mActivity;
private final long[] mIds;
private static final String FRAGMENT_TAG_DELETING_DRAFTS = "deleting_drafts";
private final FragmentActivity mActivity;
private final long[] mIds;
private DeleteDraftsTask(final FragmentActivity activity, final long[] ids) {
mActivity = activity;
mIds = ids;
}
private DeleteDraftsTask(final FragmentActivity activity, final long[] ids) {
mActivity = activity;
mIds = ids;
}
@Override
protected Integer doInBackground(final Void... params) {
final ContentResolver resolver = mActivity.getContentResolver();
final Where where = Where.in(new Column(Drafts._ID), new RawItemArray(mIds));
final String[] projection = { Drafts.MEDIAS };
final Cursor c = resolver.query(Drafts.CONTENT_URI, projection, where.getSQL(), null, null);
final int idxMedias = c.getColumnIndex(Drafts.MEDIAS);
c.moveToFirst();
while (!c.isAfterLast()) {
for (final ParcelableMediaUpdate media : ParcelableMediaUpdate.fromJSONString(c.getString(idxMedias))) {
final Uri uri = Uri.parse(media.uri);
if ("file".equals(uri.getScheme()) && uri.getPath() != null) {
new File(uri.getPath()).delete();
}
}
c.moveToNext();
}
c.close();
return resolver.delete(Drafts.CONTENT_URI, where.getSQL(), null);
}
@Override
protected Integer doInBackground(final Void... params) {
final ContentResolver resolver = mActivity.getContentResolver();
final Where where = Where.in(new Column(Drafts._ID), new RawItemArray(mIds));
final String[] projection = {Drafts.MEDIAS};
final Cursor c = resolver.query(Drafts.CONTENT_URI, projection, where.getSQL(), null, null);
final int idxMedias = c.getColumnIndex(Drafts.MEDIAS);
c.moveToFirst();
while (!c.isAfterLast()) {
for (final ParcelableMediaUpdate media : ParcelableMediaUpdate.fromJSONString(c.getString(idxMedias))) {
final Uri uri = Uri.parse(media.uri);
if ("file".equals(uri.getScheme()) && uri.getPath() != null) {
new File(uri.getPath()).delete();
}
}
c.moveToNext();
}
c.close();
return resolver.delete(Drafts.CONTENT_URI, where.getSQL(), null);
}
@Override
protected void onPostExecute(final Integer result) {
super.onPostExecute(result);
final Fragment f = mActivity.getSupportFragmentManager().findFragmentByTag(FRAGMENT_TAG_DELETING_DRAFTS);
if (f instanceof DialogFragment) {
((DialogFragment) f).dismiss();
}
}
@Override
protected void onPostExecute(final Integer result) {
super.onPostExecute(result);
final Fragment f = mActivity.getSupportFragmentManager().findFragmentByTag(FRAGMENT_TAG_DELETING_DRAFTS);
if (f instanceof DialogFragment) {
((DialogFragment) f).dismiss();
}
}
@Override
protected void onPreExecute() {
super.onPreExecute();
final SupportProgressDialogFragment f = SupportProgressDialogFragment.show(mActivity,
FRAGMENT_TAG_DELETING_DRAFTS);
f.setCancelable(false);
}
}
@Override
protected void onPreExecute() {
super.onPreExecute();
final SupportProgressDialogFragment f = SupportProgressDialogFragment.show(mActivity,
FRAGMENT_TAG_DELETING_DRAFTS);
f.setCancelable(false);
}
}
}

View File

@ -30,7 +30,6 @@ import android.content.Intent;
import android.content.IntentFilter;
import android.content.SharedPreferences;
import android.content.pm.ActivityInfo;
import android.content.res.Resources;
import android.database.ContentObserver;
import android.graphics.Canvas;
import android.graphics.Color;
@ -87,7 +86,6 @@ import org.mariotaku.twidere.util.FlymeUtils;
import org.mariotaku.twidere.util.HotKeyHandler;
import org.mariotaku.twidere.util.MathUtils;
import org.mariotaku.twidere.util.MultiSelectEventHandler;
import org.mariotaku.twidere.util.SwipebackActivityUtils;
import org.mariotaku.twidere.util.ThemeUtils;
import org.mariotaku.twidere.util.UnreadCountUtils;
import org.mariotaku.twidere.util.Utils;
@ -271,7 +269,7 @@ public class HomeActivity extends BaseSupportActivity implements OnClickListener
@Override
public boolean getSystemWindowsInsets(Rect insets) {
final int height = mTabIndicator.getHeight();
final int height = mTabIndicator != null ? mTabIndicator.getHeight() : 0;
insets.top = height != 0 ? height : Utils.getActionBarHeight(this);
return true;
}
@ -386,11 +384,8 @@ public class HomeActivity extends BaseSupportActivity implements OnClickListener
title = R.string.compose;
}
}
final ActionBar actionBar = getActionBar();
final MenuItem actionsItem = menu.findItem(MENU_ACTIONS);
if (actionBar != null) {
actionsItem.setIcon(actionBar.getThemedContext().getResources().getDrawable(icon));
}
actionsItem.setIcon(icon);
actionsItem.setTitle(title);
}
return true;
@ -502,13 +497,11 @@ public class HomeActivity extends BaseSupportActivity implements OnClickListener
mMultiSelectHandler = new MultiSelectEventHandler(this);
mHotKeyHandler = new HotKeyHandler(this);
mMultiSelectHandler.dispatchOnCreate();
final Resources res = getResources();
final boolean displayIcon = res.getBoolean(R.bool.home_display_icon);
final long[] accountIds = getAccountIds(this);
if (accountIds.length == 0) {
final Intent sign_in_intent = new Intent(INTENT_ACTION_TWITTER_LOGIN);
sign_in_intent.setClass(this, SignInActivity.class);
startActivity(sign_in_intent);
final Intent signInIntent = new Intent(INTENT_ACTION_TWITTER_LOGIN);
signInIntent.setClass(this, SignInActivity.class);
startActivity(signInIntent);
finish();
return;
} else {
@ -519,15 +512,15 @@ public class HomeActivity extends BaseSupportActivity implements OnClickListener
finish();
return;
}
final ActionBar actionBar = getActionBar();
if (actionBar != null) {
actionBar.hide();
}
setContentView(R.layout.activity_home);
sendBroadcast(new Intent(BROADCAST_HOME_ACTIVITY_ONCREATE));
final boolean refreshOnStart = mPreferences.getBoolean(KEY_REFRESH_ON_START, false);
mTabDisplayOption = getTabDisplayOptionInt(this);
final int initialTabPosition = handleIntent(intent, savedInstanceState == null);
final ActionBar actionBar = getActionBar();
if (actionBar != null) {
actionBar.hide();
}
ThemeUtils.applyBackground(mTabIndicator);
mPagerAdapter = new SupportTabsAdapter(this, getSupportFragmentManager(), mTabIndicator, 1);
@ -567,17 +560,21 @@ public class HomeActivity extends BaseSupportActivity implements OnClickListener
mPagerPosition = Float.NaN;
final int themeColor = getThemeColor(), contrastColor = Utils.getContrastYIQ(themeColor, 192);
final int themeResId = getCurrentThemeResourceId();
final boolean isTransparent = ThemeUtils.isTransparentBackground(themeResId);
final int actionBarAlpha = isTransparent ? ThemeUtils.getUserThemeBackgroundAlpha(this) : 0xFF;
if (ThemeUtils.isColoredActionBar(themeResId)) {
ViewAccessor.setBackground(mTabIndicator, new ColorDrawable(themeColor));
mTabIndicator.setStripColor(contrastColor);
mTabIndicator.setIconColor(contrastColor);
} else {
ViewAccessor.setBackground(mTabIndicator, ThemeUtils.getActionBarBackground(this, themeResId));
ViewAccessor.setBackground(mTabIndicator, ThemeUtils.getActionBarBackground(this, false));
mTabIndicator.setStripColor(themeColor);
mTabIndicator.setIconColor(ThemeUtils.isLightActionBar(themeResId) ? Color.BLACK : Color.WHITE);
}
mTabIndicator.setAlpha(actionBarAlpha / 255f);
if (mActionsButton instanceof IHomeActionButton) {
((IHomeActionButton) mActionsButton).setColor(themeColor);
mActionsButton.setAlpha(actionBarAlpha / 255f);
}
ViewAccessor.setBackground(mActionBarOverlay, ThemeUtils.getWindowContentOverlay(this));
}
@ -694,7 +691,7 @@ public class HomeActivity extends BaseSupportActivity implements OnClickListener
final Intent extraIntent = intent.getParcelableExtra(EXTRA_EXTRA_INTENT);
if (extraIntent != null && firstCreate) {
extraIntent.setExtrasClassLoader(getClassLoader());
SwipebackActivityUtils.startSwipebackActivity(this, extraIntent);
startActivity(extraIntent);
}
return initialTab;
}
@ -781,11 +778,7 @@ public class HomeActivity extends BaseSupportActivity implements OnClickListener
final Window window = getWindow();
final Drawable windowBackground = ThemeUtils.getWindowBackground(this, getCurrentThemeResourceId());
ViewAccessor.setBackground(mSlidingMenu.getContent(), windowBackground);
if (isTransparentBackground) {
window.setBackgroundDrawable(new EmptyDrawable());
} else {
window.setBackgroundDrawable(null);
}
window.setBackgroundDrawable(new EmptyDrawable());
}
private void showDataProfilingRequest() {

View File

@ -1,104 +0,0 @@
/*
* Twidere - Twitter client for Android
*
* Copyright (C) 2012-2014 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.activity.support;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.view.Menu;
import android.view.MenuItem;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GooglePlayServicesUtil;
import org.mariotaku.twidere.Constants;
import org.mariotaku.twidere.R;
import org.mariotaku.twidere.fragment.iface.IMapFragment;
import org.mariotaku.twidere.fragment.support.NativeMapFragment;
import org.mariotaku.twidere.fragment.support.WebMapFragment;
import org.mariotaku.twidere.menu.TwidereMenuInflater;
import org.mariotaku.twidere.util.ThemeUtils;
public class MapViewerActivity extends TwidereSwipeBackActivity implements Constants {
@Override
public int getThemeResourceId() {
return ThemeUtils.getViewerThemeResource(this);
}
@Override
public boolean onCreateOptionsMenu(final Menu menu, final TwidereMenuInflater inflater) {
inflater.inflate(R.menu.menu_map_viewer, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(final MenuItem item) {
switch (item.getItemId()) {
case MENU_HOME: {
onBackPressed();
break;
}
case MENU_CENTER: {
final Fragment fragment = getSupportFragmentManager().findFragmentById(android.R.id.content);
if (!(fragment instanceof IMapFragment)) {
break;
}
((IMapFragment) fragment).center();
break;
}
}
return true;
}
@Override
protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getActionBar().setDisplayHomeAsUpEnabled(true);
final Uri uri = getIntent().getData();
if (uri == null || !AUTHORITY_MAP.equals(uri.getAuthority())) {
finish();
return;
}
final Bundle bundle = new Bundle();
final String param_lat = uri.getQueryParameter(QUERY_PARAM_LAT);
final String param_lng = uri.getQueryParameter(QUERY_PARAM_LNG);
if (param_lat == null || param_lng == null) {
finish();
return;
}
try {
bundle.putDouble(EXTRA_LATITUDE, Double.valueOf(param_lat));
bundle.putDouble(EXTRA_LONGITUDE, Double.valueOf(param_lng));
} catch (final NumberFormatException e) {
finish();
return;
}
final Fragment fragment = isNativeMapSupported() ? new NativeMapFragment() : new WebMapFragment();
fragment.setArguments(bundle);
final FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
ft.replace(android.R.id.content, fragment).commit();
}
private boolean isNativeMapSupported() {
return GooglePlayServicesUtil.isGooglePlayServicesAvailable(this) == ConnectionResult.SUCCESS;
}
}

View File

@ -409,8 +409,8 @@ public class SignInActivity extends BaseSupportActivity implements TwitterConsta
}
}
if (isEmpty(mConsumerKey) || isEmpty(mConsumerSecret)) {
cb.setOAuthConsumerKey(TWITTER_CONSUMER_KEY_2);
cb.setOAuthConsumerSecret(TWITTER_CONSUMER_SECRET_2);
cb.setOAuthConsumerKey(TWITTER_CONSUMER_KEY_3);
cb.setOAuthConsumerSecret(TWITTER_CONSUMER_SECRET_3);
} else {
cb.setOAuthConsumerKey(mConsumerKey);
cb.setOAuthConsumerSecret(mConsumerSecret);
@ -440,8 +440,8 @@ public class SignInActivity extends BaseSupportActivity implements TwitterConsta
final int authType = mPreferences.getInt(KEY_AUTH_TYPE, Accounts.AUTH_TYPE_OAUTH);
final boolean sameOAuthSigningUrl = mPreferences.getBoolean(KEY_SAME_OAUTH_SIGNING_URL, false);
final boolean noVersionSuffix = mPreferences.getBoolean(KEY_NO_VERSION_SUFFIX, false);
final String consumerKey = getNonEmptyString(mPreferences, KEY_CONSUMER_KEY, TWITTER_CONSUMER_KEY_2);
final String consumerSecret = getNonEmptyString(mPreferences, KEY_CONSUMER_SECRET, TWITTER_CONSUMER_SECRET_2);
final String consumerKey = getNonEmptyString(mPreferences, KEY_CONSUMER_KEY, TWITTER_CONSUMER_KEY_3);
final String consumerSecret = getNonEmptyString(mPreferences, KEY_CONSUMER_SECRET, TWITTER_CONSUMER_SECRET_3);
if (isEmpty(mAPIUrlFormat) || defaultApiChanged) {
mAPIUrlFormat = apiUrlFormat;
}

View File

@ -1,97 +0,0 @@
/*
* Twidere - Twitter client for Android
*
* Copyright (C) 2012-2014 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.activity.support;
import android.annotation.SuppressLint;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import me.imid.swipebacklayout.lib.SwipeBackLayout;
import me.imid.swipebacklayout.lib.SwipeBackLayout.OnSwipeBackScrollListener;
import org.mariotaku.twidere.fragment.iface.SupportFragmentCallback;
import org.mariotaku.twidere.util.ThemeUtils;
import java.util.ArrayList;
import java.util.List;
@SuppressLint("Registered")
public class TwidereSwipeBackActivity extends BaseSupportThemedSwipeBackActivity implements SupportFragmentCallback,
OnSwipeBackScrollListener {
private final List<Fragment> mAttachedFragments = new ArrayList<Fragment>();
private Fragment mCurrentVisibleFragment;
@Override
public void finish() {
super.finish();
ThemeUtils.overrideActivityCloseAnimation(this);
}
@Override
public Fragment getCurrentVisibleFragment() {
if (mCurrentVisibleFragment != null) return mCurrentVisibleFragment;
for (final Fragment f : mAttachedFragments) {
if (f.getUserVisibleHint()) return f;
}
return null;
}
@Override
public void onAttachFragment(final Fragment fragment) {
super.onAttachFragment(fragment);
mAttachedFragments.add(fragment);
}
@Override
public void onDetachFragment(final Fragment fragment) {
mAttachedFragments.remove(fragment);
}
@Override
public void onSetUserVisibleHint(final Fragment fragment, final boolean isVisibleToUser) {
if (isVisibleToUser) {
mCurrentVisibleFragment = fragment;
}
}
@Override
public void onSwipeBackScroll(final float percent) {
}
@Override
public boolean triggerRefresh(final int position) {
return false;
}
@Override
protected void onCreate(final Bundle savedInstanceState) {
ThemeUtils.overrideActivityOpenAnimation(this);
super.onCreate(savedInstanceState);
final SwipeBackLayout swipeBack = getSwipeBackLayout();
swipeBack.setOnSwipeBackScrollListener(this);
}
@Override
protected void onPostCreate(final Bundle savedInstanceState) {
super.onPostCreate(savedInstanceState);
}
}

View File

@ -59,7 +59,6 @@ import org.mariotaku.twidere.util.ImageLoaderWrapper;
import org.mariotaku.twidere.util.MessagesManager;
import org.mariotaku.twidere.util.MultiSelectManager;
import org.mariotaku.twidere.util.StrictModeUtils;
import org.mariotaku.twidere.util.SwipebackActivityUtils.SwipebackScreenshotManager;
import org.mariotaku.twidere.util.Utils;
import org.mariotaku.twidere.util.content.TwidereSQLiteOpenHelper;
import org.mariotaku.twidere.util.imageloader.TwidereImageDownloader;
@ -96,7 +95,6 @@ public class TwidereApplication extends Application implements Constants, OnShar
private DiskCache mDiskCache, mFullDiskCache;
private MessagesManager mCroutonsManager;
private SQLiteOpenHelper mSQLiteOpenHelper;
private SwipebackScreenshotManager mSwipebackScreenshotManager;
private HostAddressResolver mResolver;
private SQLiteDatabase mDatabase;
@ -176,11 +174,6 @@ public class TwidereApplication extends Application implements Constants, OnShar
return mSQLiteOpenHelper = new TwidereSQLiteOpenHelper(this, DATABASES_NAME, DATABASES_VERSION);
}
public SwipebackScreenshotManager getSwipebackScreenshotManager() {
if (mSwipebackScreenshotManager != null) return mSwipebackScreenshotManager;
return mSwipebackScreenshotManager = new SwipebackScreenshotManager(this);
}
public AsyncTwitterWrapper getTwitterWrapper() {
if (mTwitterWrapper != null) return mTwitterWrapper;
return mTwitterWrapper = AsyncTwitterWrapper.getInstance(this);

View File

@ -19,290 +19,288 @@
package org.mariotaku.twidere.constant;
import org.mariotaku.twidere.TwidereConstants;
import org.mariotaku.twidere.annotation.Preference;
import org.mariotaku.twidere.provider.TweetStore.Accounts;
import static org.mariotaku.twidere.annotation.Preference.Type.BOOLEAN;
import static org.mariotaku.twidere.annotation.Preference.Type.INT;
import static org.mariotaku.twidere.annotation.Preference.Type.LONG;
import static org.mariotaku.twidere.annotation.Preference.Type.STRING;
import org.mariotaku.twidere.TwidereConstants;
import org.mariotaku.twidere.annotation.Preference;
import org.mariotaku.twidere.provider.TweetStore.Accounts;
public interface SharedPreferenceConstants {
public static final String FORMAT_PATTERN_TITLE = "[TITLE]";
public static final String FORMAT_PATTERN_TEXT = "[TEXT]";
public static final String FORMAT_PATTERN_NAME = "[NAME]";
public static final String FORMAT_PATTERN_LINK = "[LINK]";
public static final String FORMAT_PATTERN_TITLE = "[TITLE]";
public static final String FORMAT_PATTERN_TEXT = "[TEXT]";
public static final String FORMAT_PATTERN_NAME = "[NAME]";
public static final String FORMAT_PATTERN_LINK = "[LINK]";
public static final String VALUE_NONE = "none";
public static final String VALUE_LINK_HIGHLIGHT_OPTION_NONE = VALUE_NONE;
public static final String VALUE_LINK_HIGHLIGHT_OPTION_HIGHLIGHT = "highlight";
public static final String VALUE_LINK_HIGHLIGHT_OPTION_UNDERLINE = "underline";
public static final String VALUE_LINK_HIGHLIGHT_OPTION_BOTH = "both";
public static final int VALUE_LINK_HIGHLIGHT_OPTION_CODE_NONE = 0x0;
public static final int VALUE_LINK_HIGHLIGHT_OPTION_CODE_HIGHLIGHT = 0x1;
public static final int VALUE_LINK_HIGHLIGHT_OPTION_CODE_UNDERLINE = 0x2;
public static final int VALUE_LINK_HIGHLIGHT_OPTION_CODE_BOTH = VALUE_LINK_HIGHLIGHT_OPTION_CODE_HIGHLIGHT
| VALUE_LINK_HIGHLIGHT_OPTION_CODE_UNDERLINE;
public static final String VALUE_NONE = "none";
public static final String VALUE_LINK_HIGHLIGHT_OPTION_NONE = VALUE_NONE;
public static final String VALUE_LINK_HIGHLIGHT_OPTION_HIGHLIGHT = "highlight";
public static final String VALUE_LINK_HIGHLIGHT_OPTION_UNDERLINE = "underline";
public static final String VALUE_LINK_HIGHLIGHT_OPTION_BOTH = "both";
public static final int VALUE_LINK_HIGHLIGHT_OPTION_CODE_NONE = 0x0;
public static final int VALUE_LINK_HIGHLIGHT_OPTION_CODE_HIGHLIGHT = 0x1;
public static final int VALUE_LINK_HIGHLIGHT_OPTION_CODE_UNDERLINE = 0x2;
public static final int VALUE_LINK_HIGHLIGHT_OPTION_CODE_BOTH = VALUE_LINK_HIGHLIGHT_OPTION_CODE_HIGHLIGHT
| VALUE_LINK_HIGHLIGHT_OPTION_CODE_UNDERLINE;
public static final String VALUE_THEME_FONT_FAMILY_REGULAR = "sans-serif";
public static final String VALUE_THEME_FONT_FAMILY_CONDENSED = "sans-serif-condensed";
public static final String VALUE_THEME_FONT_FAMILY_LIGHT = "sans-serif-light";
public static final String VALUE_THEME_FONT_FAMILY_THIN = "sans-serif-thin";
public static final String VALUE_THEME_FONT_FAMILY_REGULAR = "sans-serif";
public static final String VALUE_THEME_FONT_FAMILY_CONDENSED = "sans-serif-condensed";
public static final String VALUE_THEME_FONT_FAMILY_LIGHT = "sans-serif-light";
public static final String VALUE_THEME_FONT_FAMILY_THIN = "sans-serif-thin";
public static final int VALUE_NOTIFICATION_FLAG_NONE = 0x0;
public static final int VALUE_NOTIFICATION_FLAG_RINGTONE = 0x1;
public static final int VALUE_NOTIFICATION_FLAG_VIBRATION = 0x2;
public static final int VALUE_NOTIFICATION_FLAG_LIGHT = 0x4;
public static final int VALUE_NOTIFICATION_FLAG_NONE = 0x0;
public static final int VALUE_NOTIFICATION_FLAG_RINGTONE = 0x1;
public static final int VALUE_NOTIFICATION_FLAG_VIBRATION = 0x2;
public static final int VALUE_NOTIFICATION_FLAG_LIGHT = 0x4;
public static final String VALUE_COMPOSE_QUIT_ACTION_ASK = "ask";
public static final String VALUE_COMPOSE_QUIT_ACTION_SAVE = "save";
public static final String VALUE_COMPOSE_QUIT_ACTION_DISCARD = "discard";
public static final String VALUE_COMPOSE_QUIT_ACTION_ASK = "ask";
public static final String VALUE_COMPOSE_QUIT_ACTION_SAVE = "save";
public static final String VALUE_COMPOSE_QUIT_ACTION_DISCARD = "discard";
public static final String VALUE_TAB_DIPLAY_OPTION_ICON = "icon";
public static final String VALUE_TAB_DIPLAY_OPTION_LABEL = "label";
public static final String VALUE_TAB_DIPLAY_OPTION_BOTH = "both";
public static final int VALUE_TAB_DIPLAY_OPTION_CODE_ICON = 0x1;
public static final int VALUE_TAB_DIPLAY_OPTION_CODE_LABEL = 0x2;
public static final int VALUE_TAB_DIPLAY_OPTION_CODE_BOTH = VALUE_TAB_DIPLAY_OPTION_CODE_ICON
| VALUE_TAB_DIPLAY_OPTION_CODE_LABEL;
public static final String VALUE_TAB_DIPLAY_OPTION_ICON = "icon";
public static final String VALUE_TAB_DIPLAY_OPTION_LABEL = "label";
public static final String VALUE_TAB_DIPLAY_OPTION_BOTH = "both";
public static final int VALUE_TAB_DIPLAY_OPTION_CODE_ICON = 0x1;
public static final int VALUE_TAB_DIPLAY_OPTION_CODE_LABEL = 0x2;
public static final int VALUE_TAB_DIPLAY_OPTION_CODE_BOTH = VALUE_TAB_DIPLAY_OPTION_CODE_ICON
| VALUE_TAB_DIPLAY_OPTION_CODE_LABEL;
public static final String VALUE_THEME_BACKGROUND_DEFAULT = "default";
public static final String VALUE_THEME_BACKGROUND_SOLID = "solid";
public static final String VALUE_THEME_BACKGROUND_TRANSPARENT = "transparent";
public static final String VALUE_THEME_BACKGROUND_DEFAULT = "default";
public static final String VALUE_THEME_BACKGROUND_SOLID = "solid";
public static final String VALUE_THEME_BACKGROUND_TRANSPARENT = "transparent";
public static final String VALUE_THEME_NAME_TWIDERE = "twidere";
public static final String VALUE_THEME_NAME_DARK = "dark";
public static final String VALUE_THEME_NAME_LIGHT = "light";
public static final String VALUE_THEME_NAME_TWIDERE = "twidere";
public static final String VALUE_THEME_NAME_DARK = "dark";
public static final String VALUE_THEME_NAME_LIGHT = "light";
public static final String VALUE_COMPOSE_NOW_ACTION_COMPOSE = "compose";
public static final String VALUE_COMPOSE_NOW_ACTION_TAKE_PHOTO = "take_photo";
public static final String VALUE_COMPOSE_NOW_ACTION_PICK_IMAGE = "pick_image";
public static final String VALUE_COMPOSE_NOW_ACTION_COMPOSE = "compose";
public static final String VALUE_COMPOSE_NOW_ACTION_TAKE_PHOTO = "take_photo";
public static final String VALUE_COMPOSE_NOW_ACTION_PICK_IMAGE = "pick_image";
public static final String VALUE_CARD_HIGHLIGHT_OPTION_NONE = VALUE_NONE;
public static final String VALUE_CARD_HIGHLIGHT_OPTION_BACKGROUND = "background";
public static final String VALUE_CARD_HIGHLIGHT_OPTION_LINE = "line";
public static final String VALUE_CARD_HIGHLIGHT_OPTION_NONE = VALUE_NONE;
public static final String VALUE_CARD_HIGHLIGHT_OPTION_BACKGROUND = "background";
public static final String VALUE_CARD_HIGHLIGHT_OPTION_LINE = "line";
public static final int VALUE_CARD_HIGHLIGHT_OPTION_CODE_NONE = 0x0;
public static final int VALUE_CARD_HIGHLIGHT_OPTION_CODE_BACKGROUND = 0x1;
public static final int VALUE_CARD_HIGHLIGHT_OPTION_CODE_LINE = 0x2;
public static final int VALUE_CARD_HIGHLIGHT_OPTION_CODE_NONE = 0x0;
public static final int VALUE_CARD_HIGHLIGHT_OPTION_CODE_BACKGROUND = 0x1;
public static final int VALUE_CARD_HIGHLIGHT_OPTION_CODE_LINE = 0x2;
public static final String DEFAULT_THEME = VALUE_THEME_NAME_TWIDERE;
public static final String DEFAULT_THEME_BACKGROUND = VALUE_THEME_BACKGROUND_DEFAULT;
public static final String DEFAULT_THEME_FONT_FAMILY = VALUE_THEME_FONT_FAMILY_REGULAR;
public static final int DEFAULT_THEME_BACKGROUND_ALPHA = 160;
public static final String DEFAULT_THEME = VALUE_THEME_NAME_TWIDERE;
public static final String DEFAULT_THEME_BACKGROUND = VALUE_THEME_BACKGROUND_DEFAULT;
public static final String DEFAULT_THEME_FONT_FAMILY = VALUE_THEME_FONT_FAMILY_REGULAR;
public static final int DEFAULT_THEME_BACKGROUND_ALPHA = 160;
public static final String DEFAULT_QUOTE_FORMAT = "RT @" + FORMAT_PATTERN_NAME + ": " + FORMAT_PATTERN_TEXT;
public static final String DEFAULT_SHARE_FORMAT = FORMAT_PATTERN_TITLE + " - " + FORMAT_PATTERN_TEXT;
public static final String DEFAULT_IMAGE_UPLOAD_FORMAT = FORMAT_PATTERN_TEXT + " " + FORMAT_PATTERN_LINK;
public static final String DEFAULT_QUOTE_FORMAT = "RT @" + FORMAT_PATTERN_NAME + ": " + FORMAT_PATTERN_TEXT;
public static final String DEFAULT_SHARE_FORMAT = FORMAT_PATTERN_TITLE + " - " + FORMAT_PATTERN_TEXT;
public static final String DEFAULT_IMAGE_UPLOAD_FORMAT = FORMAT_PATTERN_TEXT + " " + FORMAT_PATTERN_LINK;
public static final String DEFAULT_REFRESH_INTERVAL = "15";
public static final boolean DEFAULT_AUTO_REFRESH = true;
public static final boolean DEFAULT_AUTO_REFRESH_HOME_TIMELINE = false;
public static final boolean DEFAULT_AUTO_REFRESH_MENTIONS = true;
public static final boolean DEFAULT_AUTO_REFRESH_DIRECT_MESSAGES = true;
public static final boolean DEFAULT_AUTO_REFRESH_TRENDS = false;
public static final boolean DEFAULT_NOTIFICATION = true;
public static final int DEFAULT_NOTIFICATION_TYPE_HOME = VALUE_NOTIFICATION_FLAG_NONE;
public static final int DEFAULT_NOTIFICATION_TYPE_MENTIONS = VALUE_NOTIFICATION_FLAG_VIBRATION
| VALUE_NOTIFICATION_FLAG_LIGHT;
public static final int DEFAULT_NOTIFICATION_TYPE_DIRECT_MESSAGES = VALUE_NOTIFICATION_FLAG_RINGTONE
| VALUE_NOTIFICATION_FLAG_VIBRATION | VALUE_NOTIFICATION_FLAG_LIGHT;
public static final String DEFAULT_REFRESH_INTERVAL = "15";
public static final boolean DEFAULT_AUTO_REFRESH = true;
public static final boolean DEFAULT_AUTO_REFRESH_HOME_TIMELINE = false;
public static final boolean DEFAULT_AUTO_REFRESH_MENTIONS = true;
public static final boolean DEFAULT_AUTO_REFRESH_DIRECT_MESSAGES = true;
public static final boolean DEFAULT_AUTO_REFRESH_TRENDS = false;
public static final boolean DEFAULT_NOTIFICATION = true;
public static final int DEFAULT_NOTIFICATION_TYPE_HOME = VALUE_NOTIFICATION_FLAG_NONE;
public static final int DEFAULT_NOTIFICATION_TYPE_MENTIONS = VALUE_NOTIFICATION_FLAG_VIBRATION
| VALUE_NOTIFICATION_FLAG_LIGHT;
public static final int DEFAULT_NOTIFICATION_TYPE_DIRECT_MESSAGES = VALUE_NOTIFICATION_FLAG_RINGTONE
| VALUE_NOTIFICATION_FLAG_VIBRATION | VALUE_NOTIFICATION_FLAG_LIGHT;
public static final boolean DEFAULT_HOME_TIMELINE_NOTIFICATION = false;
public static final boolean DEFAULT_MENTIONS_NOTIFICATION = true;
public static final boolean DEFAULT_DIRECT_MESSAGES_NOTIFICATION = true;
public static final boolean DEFAULT_HOME_TIMELINE_NOTIFICATION = false;
public static final boolean DEFAULT_MENTIONS_NOTIFICATION = true;
public static final boolean DEFAULT_DIRECT_MESSAGES_NOTIFICATION = true;
public static final int DEFAULT_DATABASE_ITEM_LIMIT = 100;
public static final int DEFAULT_LOAD_ITEM_LIMIT = 20;
public static final String DEFAULT_CARD_HIGHLIGHT_OPTION = VALUE_CARD_HIGHLIGHT_OPTION_BACKGROUND;
public static final int DEFAULT_DATABASE_ITEM_LIMIT = 100;
public static final int DEFAULT_LOAD_ITEM_LIMIT = 20;
public static final String DEFAULT_CARD_HIGHLIGHT_OPTION = VALUE_CARD_HIGHLIGHT_OPTION_BACKGROUND;
@Preference(type = INT, hasDefault = true, defaultInt = DEFAULT_DATABASE_ITEM_LIMIT)
public static final String KEY_DATABASE_ITEM_LIMIT = "database_item_limit";
@Preference(type = INT, hasDefault = true, defaultInt = DEFAULT_LOAD_ITEM_LIMIT)
public static final String KEY_LOAD_ITEM_LIMIT = "load_item_limit";
@Preference(type = INT)
public static final String KEY_TEXT_SIZE = "text_size_int";
@Preference(type = STRING, hasDefault = true, defaultString = DEFAULT_THEME)
public static final String KEY_THEME = "theme";
@Preference(type = STRING, hasDefault = true, defaultString = DEFAULT_THEME_BACKGROUND)
public static final String KEY_THEME_BACKGROUND = "theme_background";
@Preference(type = INT, hasDefault = true, defaultInt = DEFAULT_THEME_BACKGROUND_ALPHA)
public static final String KEY_THEME_BACKGROUND_ALPHA = "theme_background_alpha";
@Preference(type = BOOLEAN, hasDefault = true, defaultBoolean = true)
public static final String KEY_THEME_DARK_ACTIONBAR = "theme_dark_actionbar";
@Preference(type = INT)
public static final String KEY_THEME_COLOR = "theme_color";
@Preference(type = STRING, hasDefault = true, defaultString = DEFAULT_THEME_FONT_FAMILY)
public static final String KEY_THEME_FONT_FAMILY = "theme_font_family";
@Preference(type = BOOLEAN, hasDefault = true, defaultBoolean = true)
public static final String KEY_DISPLAY_PROFILE_IMAGE = "display_profile_image";
@Preference(type = BOOLEAN, hasDefault = true, defaultBoolean = false)
public static final String KEY_DISPLAY_IMAGE_PREVIEW = "display_image_preview";
@Preference(type = BOOLEAN)
public static final String KEY_BOTTOM_COMPOSE_BUTTON = "bottom_compose_button";
@Preference(type = BOOLEAN)
public static final String KEY_LEFTSIDE_COMPOSE_BUTTON = "leftside_compose_button";
@Preference(type = BOOLEAN)
public static final String KEY_BOTTOM_SEND_BUTTON = "bottom_send_button";
@Preference(type = BOOLEAN)
public static final String KEY_ATTACH_LOCATION = "attach_location";
@Preference(type = BOOLEAN, hasDefault = true, defaultBoolean = true)
public static final String KEY_GZIP_COMPRESSING = "gzip_compressing";
@Preference(type = BOOLEAN)
public static final String KEY_IGNORE_SSL_ERROR = "ignore_ssl_error";
@Preference(type = BOOLEAN)
public static final String KEY_LOAD_MORE_AUTOMATICALLY = "load_more_automatically";
@Preference(type = STRING)
public static final String KEY_QUOTE_FORMAT = "quote_format";
@Preference(type = BOOLEAN)
public static final String KEY_REMEMBER_POSITION = "remember_position";
@Preference(type = BOOLEAN, hasDefault = true, defaultBoolean = false)
public static final String KEY_LOAD_MORE_FROM_TOP = "load_more_from_top";
@Preference(type = INT, exportable = false)
public static final String KEY_SAVED_TAB_POSITION = "saved_tab_position";
@Preference(type = BOOLEAN)
public static final String KEY_ENABLE_PROXY = "enable_proxy";
@Preference(type = STRING)
public static final String KEY_PROXY_HOST = "proxy_host";
@Preference(type = STRING)
public static final String KEY_PROXY_PORT = "proxy_port";
@Preference(type = BOOLEAN)
public static final String KEY_REFRESH_ON_START = "refresh_on_start";
@Preference(type = BOOLEAN)
public static final String KEY_REFRESH_AFTER_TWEET = "refresh_after_tweet";
@Preference(type = BOOLEAN)
public static final String KEY_AUTO_REFRESH = "auto_refresh";
@Preference(type = STRING)
public static final String KEY_REFRESH_INTERVAL = "refresh_interval";
@Preference(type = BOOLEAN)
public static final String KEY_AUTO_REFRESH_HOME_TIMELINE = "auto_refresh_home_timeline";
@Preference(type = BOOLEAN)
public static final String KEY_AUTO_REFRESH_MENTIONS = "auto_refresh_mentions";
@Preference(type = BOOLEAN)
public static final String KEY_AUTO_REFRESH_DIRECT_MESSAGES = "auto_refresh_direct_messages";
@Preference(type = BOOLEAN)
public static final String KEY_AUTO_REFRESH_TRENDS = "auto_refresh_trends";
@Preference(type = BOOLEAN)
public static final String KEY_HOME_TIMELINE_NOTIFICATION = "home_timeline_notification";
@Preference(type = BOOLEAN)
public static final String KEY_MENTIONS_NOTIFICATION = "mentions_notification";
@Preference(type = BOOLEAN)
public static final String KEY_DIRECT_MESSAGES_NOTIFICATION = "direct_messages_notification";
@Preference(type = INT)
public static final String KEY_LOCAL_TRENDS_WOEID = "local_trends_woeid";
public static final String KEY_NOTIFICATION_RINGTONE = "notification_ringtone";
public static final String KEY_NOTIFICATION_LIGHT_COLOR = "notification_light_color";
public static final String KEY_SHARE_FORMAT = "share_format";
public static final String KEY_HOME_REFRESH_MENTIONS = "home_refresh_mentions";
public static final String KEY_HOME_REFRESH_DIRECT_MESSAGES = "home_refresh_direct_messages";
public static final String KEY_HOME_REFRESH_TRENDS = "home_refresh_trends";
public static final String KEY_IMAGE_UPLOAD_FORMAT = "image_upload_format";
public static final String KEY_STATUS_SHORTENER = "status_shortener";
public static final String KEY_MEDIA_UPLOADER = "media_uploader";
@Preference(type = BOOLEAN, hasDefault = true, defaultBoolean = false)
public static final String KEY_SHOW_ABSOLUTE_TIME = "show_absolute_time";
@Preference(type = BOOLEAN, hasDefault = true, defaultBoolean = false)
public static final String KEY_QUICK_SEND = "quick_send";
@Preference(type = STRING, exportable = false)
public static final String KEY_COMPOSE_ACCOUNTS = "compose_accounts";
@Preference(type = BOOLEAN, hasDefault = true, defaultBoolean = false)
public static final String KEY_TCP_DNS_QUERY = "tcp_dns_query";
@Preference(type = STRING, hasDefault = true, defaultString = "8.8.8.8")
public static final String KEY_DNS_SERVER = "dns_server";
public static final String KEY_CONNECTION_TIMEOUT = "connection_timeout";
@Preference(type = BOOLEAN, hasDefault = true, defaultBoolean = true)
public static final String KEY_NAME_FIRST = "name_first";
public static final String KEY_STOP_AUTO_REFRESH_WHEN_BATTERY_LOW = "stop_auto_refresh_when_battery_low";
@Preference(type = BOOLEAN, exportable = false)
public static final String KEY_UCD_DATA_PROFILING = "ucd_data_profiling";
@Preference(type = BOOLEAN, exportable = false)
public static final String KEY_SHOW_UCD_DATA_PROFILING_REQUEST = "show_ucd_data_profiling_request";
@Preference(type = BOOLEAN, hasDefault = true, defaultBoolean = false)
public static final String KEY_DISPLAY_SENSITIVE_CONTENTS = "display_sensitive_contents";
@Preference(type = BOOLEAN, hasDefault = true, defaultBoolean = true)
public static final String KEY_PHISHING_LINK_WARNING = "phishing_link_warning";
@Preference(type = BOOLEAN, hasDefault = true, defaultBoolean = false)
public static final String KEY_FAST_SCROLL_THUMB = "fast_scroll_thumb";
public static final String KEY_LINK_HIGHLIGHT_OPTION = "link_highlight_option";
@Preference(type = BOOLEAN, hasDefault = true, defaultBoolean = true)
public static final String KEY_INDICATE_MY_STATUS = "indicate_my_status";
public static final String KEY_PRELOAD_PROFILE_IMAGES = "preload_profile_images";
public static final String KEY_PRELOAD_PREVIEW_IMAGES = "preload_preview_images";
@Preference(type = BOOLEAN, hasDefault = true, defaultBoolean = true)
public static final String KEY_PRELOAD_WIFI_ONLY = "preload_wifi_only";
@Preference(type = BOOLEAN, hasDefault = true, defaultBoolean = true)
public static final String KEY_DISABLE_TAB_SWIPE = "disable_tab_swipe";
@Preference(type = BOOLEAN, hasDefault = true, defaultBoolean = true)
public static final String KEY_LINK_TO_QUOTED_TWEET = "link_to_quoted_tweet";
@Preference(type = BOOLEAN)
public static final String KEY_BACKGROUND_TOAST_NOTIFICATION = "background_toast_notification";
@Preference(type = STRING)
public static final String KEY_COMPOSE_QUIT_ACTION = "compose_quit_action";
@Preference(type = BOOLEAN)
public static final String KEY_NO_CLOSE_AFTER_TWEET_SENT = "no_close_after_tweet_sent";
@Preference(type = BOOLEAN)
public static final String KEY_FAST_IMAGE_LOADING = "fast_image_loading";
@Preference(type = STRING, hasDefault = false)
public static final String KEY_API_URL_FORMAT = "api_url_format";
@Preference(type = BOOLEAN, hasDefault = true, defaultBoolean = false)
public static final String KEY_SAME_OAUTH_SIGNING_URL = "same_oauth_signing_url";
@Preference(type = INT, hasDefault = true, defaultInt = DEFAULT_DATABASE_ITEM_LIMIT)
public static final String KEY_DATABASE_ITEM_LIMIT = "database_item_limit";
@Preference(type = INT, hasDefault = true, defaultInt = DEFAULT_LOAD_ITEM_LIMIT)
public static final String KEY_LOAD_ITEM_LIMIT = "load_item_limit";
@Preference(type = INT)
public static final String KEY_TEXT_SIZE = "text_size_int";
@Preference(type = STRING, hasDefault = true, defaultString = DEFAULT_THEME)
public static final String KEY_THEME = "theme";
@Preference(type = STRING, hasDefault = true, defaultString = DEFAULT_THEME_BACKGROUND)
public static final String KEY_THEME_BACKGROUND = "theme_background";
@Preference(type = INT, hasDefault = true, defaultInt = DEFAULT_THEME_BACKGROUND_ALPHA)
public static final String KEY_THEME_BACKGROUND_ALPHA = "theme_background_alpha";
@Preference(type = BOOLEAN, hasDefault = true, defaultBoolean = true)
public static final String KEY_THEME_DARK_ACTIONBAR = "theme_dark_actionbar";
@Preference(type = INT)
public static final String KEY_THEME_COLOR = "theme_color";
@Preference(type = STRING, hasDefault = true, defaultString = DEFAULT_THEME_FONT_FAMILY)
public static final String KEY_THEME_FONT_FAMILY = "theme_font_family";
@Preference(type = BOOLEAN, hasDefault = true, defaultBoolean = true)
public static final String KEY_DISPLAY_PROFILE_IMAGE = "display_profile_image";
@Preference(type = BOOLEAN, hasDefault = true, defaultBoolean = false)
public static final String KEY_DISPLAY_IMAGE_PREVIEW = "display_image_preview";
@Preference(type = BOOLEAN)
public static final String KEY_BOTTOM_COMPOSE_BUTTON = "bottom_compose_button";
@Preference(type = BOOLEAN)
public static final String KEY_LEFTSIDE_COMPOSE_BUTTON = "leftside_compose_button";
@Preference(type = BOOLEAN)
public static final String KEY_BOTTOM_SEND_BUTTON = "bottom_send_button";
@Preference(type = BOOLEAN)
public static final String KEY_ATTACH_LOCATION = "attach_location";
@Preference(type = BOOLEAN, hasDefault = true, defaultBoolean = true)
public static final String KEY_GZIP_COMPRESSING = "gzip_compressing";
@Preference(type = BOOLEAN)
public static final String KEY_IGNORE_SSL_ERROR = "ignore_ssl_error";
@Preference(type = BOOLEAN)
public static final String KEY_LOAD_MORE_AUTOMATICALLY = "load_more_automatically";
@Preference(type = STRING)
public static final String KEY_QUOTE_FORMAT = "quote_format";
@Preference(type = BOOLEAN)
public static final String KEY_REMEMBER_POSITION = "remember_position";
@Preference(type = BOOLEAN, hasDefault = true, defaultBoolean = false)
public static final String KEY_LOAD_MORE_FROM_TOP = "load_more_from_top";
@Preference(type = INT, exportable = false)
public static final String KEY_SAVED_TAB_POSITION = "saved_tab_position";
@Preference(type = BOOLEAN)
public static final String KEY_ENABLE_PROXY = "enable_proxy";
@Preference(type = STRING)
public static final String KEY_PROXY_HOST = "proxy_host";
@Preference(type = STRING)
public static final String KEY_PROXY_PORT = "proxy_port";
@Preference(type = BOOLEAN)
public static final String KEY_REFRESH_ON_START = "refresh_on_start";
@Preference(type = BOOLEAN)
public static final String KEY_REFRESH_AFTER_TWEET = "refresh_after_tweet";
@Preference(type = BOOLEAN)
public static final String KEY_AUTO_REFRESH = "auto_refresh";
@Preference(type = STRING)
public static final String KEY_REFRESH_INTERVAL = "refresh_interval";
@Preference(type = BOOLEAN)
public static final String KEY_AUTO_REFRESH_HOME_TIMELINE = "auto_refresh_home_timeline";
@Preference(type = BOOLEAN)
public static final String KEY_AUTO_REFRESH_MENTIONS = "auto_refresh_mentions";
@Preference(type = BOOLEAN)
public static final String KEY_AUTO_REFRESH_DIRECT_MESSAGES = "auto_refresh_direct_messages";
@Preference(type = BOOLEAN)
public static final String KEY_AUTO_REFRESH_TRENDS = "auto_refresh_trends";
@Preference(type = BOOLEAN)
public static final String KEY_HOME_TIMELINE_NOTIFICATION = "home_timeline_notification";
@Preference(type = BOOLEAN)
public static final String KEY_MENTIONS_NOTIFICATION = "mentions_notification";
@Preference(type = BOOLEAN)
public static final String KEY_DIRECT_MESSAGES_NOTIFICATION = "direct_messages_notification";
@Preference(type = INT)
public static final String KEY_LOCAL_TRENDS_WOEID = "local_trends_woeid";
public static final String KEY_NOTIFICATION_RINGTONE = "notification_ringtone";
public static final String KEY_NOTIFICATION_LIGHT_COLOR = "notification_light_color";
public static final String KEY_SHARE_FORMAT = "share_format";
public static final String KEY_HOME_REFRESH_MENTIONS = "home_refresh_mentions";
public static final String KEY_HOME_REFRESH_DIRECT_MESSAGES = "home_refresh_direct_messages";
public static final String KEY_HOME_REFRESH_TRENDS = "home_refresh_trends";
public static final String KEY_IMAGE_UPLOAD_FORMAT = "image_upload_format";
public static final String KEY_STATUS_SHORTENER = "status_shortener";
public static final String KEY_MEDIA_UPLOADER = "media_uploader";
@Preference(type = BOOLEAN, hasDefault = true, defaultBoolean = false)
public static final String KEY_SHOW_ABSOLUTE_TIME = "show_absolute_time";
@Preference(type = BOOLEAN, hasDefault = true, defaultBoolean = false)
public static final String KEY_QUICK_SEND = "quick_send";
@Preference(type = STRING, exportable = false)
public static final String KEY_COMPOSE_ACCOUNTS = "compose_accounts";
@Preference(type = BOOLEAN, hasDefault = true, defaultBoolean = false)
public static final String KEY_TCP_DNS_QUERY = "tcp_dns_query";
@Preference(type = STRING, hasDefault = true, defaultString = "8.8.8.8")
public static final String KEY_DNS_SERVER = "dns_server";
public static final String KEY_CONNECTION_TIMEOUT = "connection_timeout";
@Preference(type = BOOLEAN, hasDefault = true, defaultBoolean = true)
public static final String KEY_NAME_FIRST = "name_first";
public static final String KEY_STOP_AUTO_REFRESH_WHEN_BATTERY_LOW = "stop_auto_refresh_when_battery_low";
@Preference(type = BOOLEAN, exportable = false)
public static final String KEY_UCD_DATA_PROFILING = "ucd_data_profiling";
@Preference(type = BOOLEAN, exportable = false)
public static final String KEY_SHOW_UCD_DATA_PROFILING_REQUEST = "show_ucd_data_profiling_request";
@Preference(type = BOOLEAN, hasDefault = true, defaultBoolean = false)
public static final String KEY_DISPLAY_SENSITIVE_CONTENTS = "display_sensitive_contents";
@Preference(type = BOOLEAN, hasDefault = true, defaultBoolean = true)
public static final String KEY_PHISHING_LINK_WARNING = "phishing_link_warning";
@Preference(type = BOOLEAN, hasDefault = true, defaultBoolean = false)
public static final String KEY_FAST_SCROLL_THUMB = "fast_scroll_thumb";
public static final String KEY_LINK_HIGHLIGHT_OPTION = "link_highlight_option";
@Preference(type = BOOLEAN, hasDefault = true, defaultBoolean = true)
public static final String KEY_INDICATE_MY_STATUS = "indicate_my_status";
public static final String KEY_PRELOAD_PROFILE_IMAGES = "preload_profile_images";
public static final String KEY_PRELOAD_PREVIEW_IMAGES = "preload_preview_images";
@Preference(type = BOOLEAN, hasDefault = true, defaultBoolean = true)
public static final String KEY_PRELOAD_WIFI_ONLY = "preload_wifi_only";
@Preference(type = BOOLEAN, hasDefault = true, defaultBoolean = true)
public static final String KEY_DISABLE_TAB_SWIPE = "disable_tab_swipe";
@Preference(type = BOOLEAN, hasDefault = true, defaultBoolean = true)
public static final String KEY_LINK_TO_QUOTED_TWEET = "link_to_quoted_tweet";
@Preference(type = BOOLEAN)
public static final String KEY_BACKGROUND_TOAST_NOTIFICATION = "background_toast_notification";
@Preference(type = STRING)
public static final String KEY_COMPOSE_QUIT_ACTION = "compose_quit_action";
@Preference(type = BOOLEAN)
public static final String KEY_NO_CLOSE_AFTER_TWEET_SENT = "no_close_after_tweet_sent";
@Preference(type = BOOLEAN)
public static final String KEY_FAST_IMAGE_LOADING = "fast_image_loading";
@Preference(type = STRING, hasDefault = false)
public static final String KEY_API_URL_FORMAT = "api_url_format";
@Preference(type = BOOLEAN, hasDefault = true, defaultBoolean = false)
public static final String KEY_SAME_OAUTH_SIGNING_URL = "same_oauth_signing_url";
@Preference(type = BOOLEAN, hasDefault = true, defaultBoolean = false)
public static final String KEY_NO_VERSION_SUFFIX = "no_version_suffix";
@Preference(type = INT, hasDefault = true, defaultInt = Accounts.AUTH_TYPE_OAUTH)
public static final String KEY_AUTH_TYPE = "auth_type";
@Preference(type = STRING, hasDefault = true, defaultString = TwidereConstants.TWITTER_CONSUMER_KEY_2)
public static final String KEY_CONSUMER_KEY = "consumer_key";
@Preference(type = STRING, hasDefault = true, defaultString = TwidereConstants.TWITTER_CONSUMER_SECRET_2)
public static final String KEY_CONSUMER_SECRET = "consumer_secret";
public static final String KEY_FILTERS_IN_HOME_TIMELINE = "filters_in_home_timeline";
public static final String KEY_FILTERS_IN_MENTIONS = "filters_in_mentions";
public static final String KEY_FILTERS_FOR_RTS = "filters_for_rts";
@Preference(type = BOOLEAN, hasDefault = true, defaultBoolean = false)
public static final String KEY_NICKNAME_ONLY = "nickname_only";
public static final String KEY_SETTINGS_WIZARD_COMPLETED = "settings_wizard_completed";
@Preference(type = BOOLEAN, hasDefault = true, defaultBoolean = true)
public static final String KEY_CARD_ANIMATION = "card_animation";
public static final String KEY_UNREAD_COUNT = "unread_count";
public static final String KEY_NOTIFICATION = "notification";
public static final String KEY_NOTIFICATION_TYPE_HOME = "notification_type_home";
public static final String KEY_NOTIFICATION_TYPE_MENTIONS = "notification_type_mentions";
public static final String KEY_NOTIFICATION_TYPE_DIRECT_MESSAGES = "notification_type_direct_messages";
public static final String KEY_MY_FOLLOWING_ONLY = "my_following_only";
@Preference(type = INT, hasDefault = true, defaultInt = Accounts.AUTH_TYPE_OAUTH)
public static final String KEY_AUTH_TYPE = "auth_type";
@Preference(type = STRING, hasDefault = true, defaultString = TwidereConstants.TWITTER_CONSUMER_KEY_3)
public static final String KEY_CONSUMER_KEY = "consumer_key";
@Preference(type = STRING, hasDefault = true, defaultString = TwidereConstants.TWITTER_CONSUMER_SECRET_3)
public static final String KEY_CONSUMER_SECRET = "consumer_secret";
public static final String KEY_FILTERS_IN_HOME_TIMELINE = "filters_in_home_timeline";
public static final String KEY_FILTERS_IN_MENTIONS = "filters_in_mentions";
public static final String KEY_FILTERS_FOR_RTS = "filters_for_rts";
@Preference(type = BOOLEAN, hasDefault = true, defaultBoolean = false)
public static final String KEY_NICKNAME_ONLY = "nickname_only";
public static final String KEY_SETTINGS_WIZARD_COMPLETED = "settings_wizard_completed";
@Preference(type = BOOLEAN, hasDefault = true, defaultBoolean = true)
public static final String KEY_CARD_ANIMATION = "card_animation";
public static final String KEY_UNREAD_COUNT = "unread_count";
public static final String KEY_NOTIFICATION = "notification";
public static final String KEY_NOTIFICATION_TYPE_HOME = "notification_type_home";
public static final String KEY_NOTIFICATION_TYPE_MENTIONS = "notification_type_mentions";
public static final String KEY_NOTIFICATION_TYPE_DIRECT_MESSAGES = "notification_type_direct_messages";
public static final String KEY_MY_FOLLOWING_ONLY = "my_following_only";
@Preference(type = BOOLEAN, hasDefault = true, defaultBoolean = false)
public static final String KEY_COMPACT_CARDS = "compact_cards";
@Preference(type = BOOLEAN, hasDefault = true, defaultBoolean = false)
public static final String KEY_LONG_CLICK_TO_OPEN_MENU = "long_click_to_open_menu";
@Preference(type = BOOLEAN, hasDefault = true, defaultBoolean = false)
public static final String KEY_SWIPE_BACK = "swipe_back";
@Preference(type = BOOLEAN, hasDefault = true, defaultBoolean = false)
public static final String KEY_FORCE_USING_PRIVATE_APIS = "force_using_private_apis";
@Preference(type = STRING, hasDefault = true, defaultString = "140")
public static final String KEY_STATUS_TEXT_LIMIT = "status_text_limit";
@Preference(type = STRING, hasDefault = true, defaultString = VALUE_COMPOSE_NOW_ACTION_COMPOSE)
public static final String KEY_COMPOSE_NOW_ACTION = "compose_now_action";
public static final String KEY_FALLBACK_TWITTER_LINK_HANDLER = "fallback_twitter_link_handler";
@Preference(type = STRING, hasDefault = true, defaultString = "CENTER_CROP")
public static final String KEY_IMAGE_PREVIEW_SCALE_TYPE = "image_preview_scale_type";
@Preference(type = BOOLEAN, hasDefault = true, defaultBoolean = false)
public static final String KEY_PLAIN_LIST_STYLE = "plain_list_style";
@Preference(type = BOOLEAN, hasDefault = true, defaultBoolean = true)
public static final String KEY_DARK_DRAWER = "dark_drawer";
@Preference(type = BOOLEAN, hasDefault = true, defaultBoolean = false)
public static final String KEY_COMPACT_CARDS = "compact_cards";
@Preference(type = BOOLEAN, hasDefault = true, defaultBoolean = false)
public static final String KEY_LONG_CLICK_TO_OPEN_MENU = "long_click_to_open_menu";
@Preference(type = BOOLEAN, hasDefault = true, defaultBoolean = false)
public static final String KEY_FORCE_USING_PRIVATE_APIS = "force_using_private_apis";
@Preference(type = STRING, hasDefault = true, defaultString = "140")
public static final String KEY_STATUS_TEXT_LIMIT = "status_text_limit";
@Preference(type = STRING, hasDefault = true, defaultString = VALUE_COMPOSE_NOW_ACTION_COMPOSE)
public static final String KEY_COMPOSE_NOW_ACTION = "compose_now_action";
public static final String KEY_FALLBACK_TWITTER_LINK_HANDLER = "fallback_twitter_link_handler";
@Preference(type = STRING, hasDefault = true, defaultString = "CENTER_CROP")
public static final String KEY_IMAGE_PREVIEW_SCALE_TYPE = "image_preview_scale_type";
@Preference(type = BOOLEAN, hasDefault = true, defaultBoolean = false)
public static final String KEY_PLAIN_LIST_STYLE = "plain_list_style";
@Preference(type = BOOLEAN, hasDefault = true, defaultBoolean = true)
public static final String KEY_DARK_DRAWER = "dark_drawer";
public static final String KEY_QUICK_MENU_EXPANDED = "quick_menu_expanded";
public static final String KEY_QUICK_MENU_EXPANDED = "quick_menu_expanded";
@Preference(type = STRING)
public static final String KEY_TRANSLATION_DESTINATION = "translation_destination";
@Preference(type = STRING)
public static final String KEY_TAB_DISPLAY_OPTION = "tab_display_option";
@Preference(type = STRING)
public static final String KEY_CARD_HIGHLIGHT_OPTION = "card_highlight_option";
@Preference(type = INT, exportable = false)
public static final String KEY_LIVE_WALLPAPER_SCALE = "live_wallpaper_scale";
@Preference(type = LONG, exportable = false)
public static final String KEY_API_LAST_CHANGE = "api_last_change";
@Preference(type = LONG, exportable = false)
public static final String KEY_DEFAULT_ACCOUNT_ID = "default_account_id";
@Preference(type = STRING)
public static final String KEY_TRANSLATION_DESTINATION = "translation_destination";
@Preference(type = STRING)
public static final String KEY_TAB_DISPLAY_OPTION = "tab_display_option";
@Preference(type = STRING)
public static final String KEY_CARD_HIGHLIGHT_OPTION = "card_highlight_option";
@Preference(type = INT, exportable = false)
public static final String KEY_LIVE_WALLPAPER_SCALE = "live_wallpaper_scale";
@Preference(type = LONG, exportable = false)
public static final String KEY_API_LAST_CHANGE = "api_last_change";
@Preference(type = LONG, exportable = false)
public static final String KEY_DEFAULT_ACCOUNT_ID = "default_account_id";
}

View File

@ -1,69 +0,0 @@
/*
* Twidere - Twitter client for Android
*
* Copyright (C) 2012-2014 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.fragment.support;
import android.os.Bundle;
import com.google.android.gms.maps.CameraUpdate;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.MarkerOptions;
import org.mariotaku.twidere.Constants;
import org.mariotaku.twidere.fragment.iface.IMapFragment;
public class NativeMapFragment extends SupportMapFragment implements Constants, IMapFragment {
private GoogleMap mMapView;
@Override
public void center() {
center(true);
}
public void center(final boolean animate) {
final Bundle args = getArguments();
if (mMapView == null || args == null || !args.containsKey(EXTRA_LATITUDE) || !args.containsKey(EXTRA_LONGITUDE))
return;
final double lat = args.getDouble(EXTRA_LATITUDE, 0.0), lng = args.getDouble(EXTRA_LONGITUDE, 0.0);
final CameraUpdate c = CameraUpdateFactory.newLatLngZoom(new LatLng(lat, lng), 12);
if (animate) {
mMapView.animateCamera(c);
} else {
mMapView.moveCamera(c);
}
}
@Override
public void onActivityCreated(final Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
final Bundle args = getArguments();
if (args == null || !args.containsKey(EXTRA_LATITUDE) || !args.containsKey(EXTRA_LONGITUDE)) return;
final double lat = args.getDouble(EXTRA_LATITUDE, 0.0), lng = args.getDouble(EXTRA_LONGITUDE, 0.0);
mMapView = getMap();
final MarkerOptions marker = new MarkerOptions();
marker.position(new LatLng(lat, lng));
mMapView.addMarker(marker);
center(false);
}
}

View File

@ -63,7 +63,6 @@ import android.widget.ListView;
import android.widget.ProgressBar;
import android.widget.TextView;
import org.mariotaku.menucomponent.widget.MenuBar;
import org.mariotaku.querybuilder.Where;
import org.mariotaku.twidere.R;
import org.mariotaku.twidere.activity.support.AccountSelectorActivity;
@ -619,7 +618,7 @@ public class UserProfileFragment extends BaseSupportListFragment implements OnCl
break;
}
case TwidereLinkify.LINK_TYPE_HASHTAG: {
openTweetSearch(getActivity(), user.account_id, link);
openTweetSearch(getActivity(), user.account_id, "#" + link);
break;
}
case TwidereLinkify.LINK_TYPE_LINK: {

View File

@ -101,8 +101,8 @@ public class DefaultAPIPreference extends DialogPreference implements Constants,
final int authType = pref.getInt(KEY_AUTH_TYPE, Accounts.AUTH_TYPE_OAUTH);
final boolean sameOAuthSigningUrl = pref.getBoolean(KEY_SAME_OAUTH_SIGNING_URL, false);
final boolean noVersionSuffix = pref.getBoolean(KEY_NO_VERSION_SUFFIX, false);
final String consumerKey = getNonEmptyString(pref, KEY_CONSUMER_KEY, TWITTER_CONSUMER_KEY_2);
final String consumerSecret = getNonEmptyString(pref, KEY_CONSUMER_SECRET, TWITTER_CONSUMER_SECRET_2);
final String consumerKey = getNonEmptyString(pref, KEY_CONSUMER_KEY, TWITTER_CONSUMER_KEY_3);
final String consumerSecret = getNonEmptyString(pref, KEY_CONSUMER_SECRET, TWITTER_CONSUMER_SECRET_3);
setValues(apiUrlFormat, authType, noVersionSuffix, sameOAuthSigningUrl, consumerKey, consumerSecret);
}
@ -164,8 +164,8 @@ public class DefaultAPIPreference extends DialogPreference implements Constants,
final String prefApiUrlFormat = getNonEmptyString(pref, KEY_API_URL_FORMAT, DEFAULT_REST_BASE_URL);
final int prefAuthType = pref.getInt(KEY_AUTH_TYPE, Accounts.AUTH_TYPE_OAUTH);
final boolean prefSameOAuthSigningUrl = pref.getBoolean(KEY_API_URL_FORMAT, false);
final String prefConsumerKey = getNonEmptyString(pref, KEY_CONSUMER_KEY, TWITTER_CONSUMER_KEY_2);
final String prefConsumerSecret = getNonEmptyString(pref, KEY_CONSUMER_SECRET, TWITTER_CONSUMER_SECRET_2);
final String prefConsumerKey = getNonEmptyString(pref, KEY_CONSUMER_KEY, TWITTER_CONSUMER_KEY_3);
final String prefConsumerSecret = getNonEmptyString(pref, KEY_CONSUMER_SECRET, TWITTER_CONSUMER_SECRET_3);
final String apiUrlFormat = trim(savedInstanceState.getString(Accounts.API_URL_FORMAT, prefApiUrlFormat));
final int authType = savedInstanceState.getInt(Accounts.AUTH_TYPE, prefAuthType);
final boolean sameOAuthSigningUrl = savedInstanceState.getBoolean(Accounts.SAME_OAUTH_SIGNING_URL,

View File

@ -19,89 +19,89 @@
package org.mariotaku.twidere.util;
import static org.mariotaku.twidere.util.Utils.openImage;
import static org.mariotaku.twidere.util.Utils.openStatus;
import static org.mariotaku.twidere.util.Utils.openTweetSearch;
import static org.mariotaku.twidere.util.Utils.openUserListDetails;
import static org.mariotaku.twidere.util.Utils.openUserProfile;
import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import edu.ucdavis.earlybird.ProfilingUtil;
import org.mariotaku.twidere.Constants;
import org.mariotaku.twidere.util.TwidereLinkify.OnLinkClickListener;
import edu.ucdavis.earlybird.ProfilingUtil;
import static org.mariotaku.twidere.util.Utils.openImage;
import static org.mariotaku.twidere.util.Utils.openStatus;
import static org.mariotaku.twidere.util.Utils.openTweetSearch;
import static org.mariotaku.twidere.util.Utils.openUserListDetails;
import static org.mariotaku.twidere.util.Utils.openUserProfile;
public class OnLinkClickHandler implements OnLinkClickListener, Constants {
protected final Activity activity;
protected final MultiSelectManager manager;
protected final Activity activity;
protected final MultiSelectManager manager;
public OnLinkClickHandler(final Context context, final MultiSelectManager manager) {
activity = context instanceof Activity ? (Activity) context : null;
this.manager = manager;
}
public OnLinkClickHandler(final Context context, final MultiSelectManager manager) {
activity = context instanceof Activity ? (Activity) context : null;
this.manager = manager;
}
@Override
public void onLinkClick(final String link, final String orig, final long account_id, final int type,
final boolean sensitive) {
if (activity == null || manager.isActive()) return;
// UCD
ProfilingUtil.profile(activity, account_id, "Click, " + link + ", " + type);
@Override
public void onLinkClick(final String link, final String orig, final long account_id, final int type,
final boolean sensitive) {
if (activity == null || manager.isActive()) return;
// UCD
ProfilingUtil.profile(activity, account_id, "Click, " + link + ", " + type);
if (activity == null) return;
switch (type) {
case TwidereLinkify.LINK_TYPE_MENTION: {
openUserProfile(activity, account_id, -1, link);
break;
}
case TwidereLinkify.LINK_TYPE_HASHTAG: {
openTweetSearch(activity, account_id, link);
break;
}
case TwidereLinkify.LINK_TYPE_LINK: {
if (MediaPreviewUtils.isLinkSupported(link)) {
openImage(activity, account_id, link, sensitive);
} else {
openLink(link);
}
break;
}
case TwidereLinkify.LINK_TYPE_LIST: {
final String[] mention_list = link.split("\\/");
if (mention_list == null || mention_list.length != 2) {
break;
}
openUserListDetails(activity, account_id, -1, -1, mention_list[0], mention_list[1]);
break;
}
case TwidereLinkify.LINK_TYPE_CASHTAG: {
openTweetSearch(activity, account_id, link);
break;
}
case TwidereLinkify.LINK_TYPE_USER_ID: {
openUserProfile(activity, account_id, ParseUtils.parseLong(link), null);
break;
}
case TwidereLinkify.LINK_TYPE_STATUS: {
openStatus(activity, account_id, ParseUtils.parseLong(link));
break;
}
}
}
if (activity == null) return;
switch (type) {
case TwidereLinkify.LINK_TYPE_MENTION: {
openUserProfile(activity, account_id, -1, link);
break;
}
case TwidereLinkify.LINK_TYPE_HASHTAG: {
openTweetSearch(activity, account_id, "#" + link);
break;
}
case TwidereLinkify.LINK_TYPE_LINK: {
if (MediaPreviewUtils.isLinkSupported(link)) {
openImage(activity, account_id, link, sensitive);
} else {
openLink(link);
}
break;
}
case TwidereLinkify.LINK_TYPE_LIST: {
final String[] mention_list = link.split("\\/");
if (mention_list == null || mention_list.length != 2) {
break;
}
openUserListDetails(activity, account_id, -1, -1, mention_list[0], mention_list[1]);
break;
}
case TwidereLinkify.LINK_TYPE_CASHTAG: {
openTweetSearch(activity, account_id, link);
break;
}
case TwidereLinkify.LINK_TYPE_USER_ID: {
openUserProfile(activity, account_id, ParseUtils.parseLong(link), null);
break;
}
case TwidereLinkify.LINK_TYPE_STATUS: {
openStatus(activity, account_id, ParseUtils.parseLong(link));
break;
}
}
}
protected void openLink(final String link) {
if (activity == null || manager.isActive()) return;
final Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(link));
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
try {
activity.startActivity(intent);
} catch (final ActivityNotFoundException e) {
// TODO
}
}
protected void openLink(final String link) {
if (activity == null || manager.isActive()) return;
final Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(link));
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
try {
activity.startActivity(intent);
} catch (final ActivityNotFoundException e) {
// TODO
}
}
}

View File

@ -1,164 +0,0 @@
/*
* Twidere - Twitter client for Android
*
* Copyright (C) 2012-2014 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.util;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Bitmap;
import android.graphics.Bitmap.CompressFormat;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffXfermode;
import android.graphics.Rect;
import android.os.Bundle;
import android.support.v4.app.ActivityCompat;
import android.view.View;
import android.view.Window;
import org.mariotaku.twidere.TwidereConstants;
import org.mariotaku.twidere.app.TwidereApplication;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
public class SwipebackActivityUtils implements TwidereConstants {
public static void setActivityScreenshot(final Activity activity, final Intent target) {
if (activity == null || target == null) return;
final SharedPreferences prefs = activity.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE);
if (!prefs.getBoolean(KEY_SWIPE_BACK, false)) return;
final TwidereApplication app = TwidereApplication.getInstance(activity);
final SwipebackScreenshotManager sm = app.getSwipebackScreenshotManager();
final long key = System.currentTimeMillis();
final Bitmap sc = getActivityScreenshot(activity, View.DRAWING_CACHE_QUALITY_LOW);
sm.put(key, sc, ThemeUtils.isTransparentBackground(activity));
target.putExtra(EXTRA_ACTIVITY_SCREENSHOT_ID, key);
}
public static void startSwipebackActivity(final Activity activity, final Intent intent) {
setActivityScreenshot(activity, intent);
activity.startActivityForResult(intent, REQUEST_SWIPEBACK_ACTIVITY);
}
public static void startSwipebackActivity(final Activity activity, final Intent intent, final Bundle options) {
setActivityScreenshot(activity, intent);
ActivityCompat.startActivityForResult(activity, intent, REQUEST_SWIPEBACK_ACTIVITY, options);
}
/**
*
* May cause OutOfMemoryError
*
* @param activity
* @param cacheQuality
* @return Activity screenshot
*/
private static Bitmap getActivityScreenshot(final Activity activity, final int cacheQuality) {
try {
return getActivityScreenshotInternal(activity, cacheQuality);
} catch (final OutOfMemoryError oom) {
return null;
} catch (final StackOverflowError sof) {
return null;
}
}
/**
*
* May cause OutOfMemoryError
*
* @param activity
* @param cacheQuality
* @return Activity screenshot
*/
private static Bitmap getActivityScreenshotInternal(final Activity activity, final int cacheQuality) {
if (activity == null) return null;
final Window w = activity.getWindow();
final View view = w.getDecorView();
final int width = view.getWidth(), height = view.getHeight();
if (width <= 0 || height <= 0) return null;
final Bitmap b = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_4444);
final Rect frame = new Rect();
view.getWindowVisibleDisplayFrame(frame);
// Remove window background behind status bar.
final Canvas c = new Canvas(b);
view.draw(c);
final Paint paint = new Paint();
paint.setColor(Color.TRANSPARENT);
paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN));
c.drawRect(frame.left, 0, frame.right, frame.top, paint);
return b;
}
public static class SwipebackScreenshotManager {
private final static String DIR_NAME_SWIPEBACK_CACHE = "swipeback_cache";
private static final CompressFormat COMPRESS_FORMAT = Bitmap.CompressFormat.JPEG;
private static final CompressFormat COMPRESS_FORMAT_TRANSPARENT = Bitmap.CompressFormat.PNG;
private final File mCacheDir;
public SwipebackScreenshotManager(final Context context) {
mCacheDir = Utils.getBestCacheDir(context, DIR_NAME_SWIPEBACK_CACHE);
}
public Bitmap get(final long id) {
final File f = new File(mCacheDir, String.valueOf(id));
if (!f.exists()) return null;
try {
return BitmapFactory.decodeFile(f.getAbsolutePath());
} catch (final OutOfMemoryError e) {
return null;
} finally {
System.gc();
}
}
public void put(final long id, final Bitmap bitmap, final boolean alphaChannel) {
if (bitmap == null || bitmap.isRecycled()) return;
try {
final OutputStream os = new FileOutputStream(new File(mCacheDir, String.valueOf(id)));
bitmap.compress(alphaChannel ? COMPRESS_FORMAT_TRANSPARENT : COMPRESS_FORMAT, 75, os);
bitmap.recycle();
} catch (final IOException e) {
e.printStackTrace();
} finally {
System.gc();
}
}
public boolean remove(final long id) {
final File f = new File(mCacheDir, String.valueOf(id));
if (!f.exists()) return false;
try {
return f.delete();
} finally {
System.gc();
}
}
}
}

View File

@ -123,13 +123,15 @@ public class ThemeUtils implements Constants {
final MenuItem item = menu.getItem(i);
final Drawable icon = item.getIcon();
final ContextMenuInfo info = item.getMenuInfo();
if (ArrayUtils.contains(excludedGroups, item.getGroupId())) {
icon.mutate().clearColorFilter();
} else if (info instanceof MenuBarMenuInfo) {
final boolean inPopup = ((MenuBarMenuInfo) info).isInPopup();
icon.mutate().setColorFilter(inPopup ? popupColor : color, mode);
} else {
icon.mutate().setColorFilter(color, mode);
if (icon != null) {
if (ArrayUtils.contains(excludedGroups, item.getGroupId())) {
icon.mutate().clearColorFilter();
} else if (info instanceof MenuBarMenuInfo) {
final boolean inPopup = ((MenuBarMenuInfo) info).isInPopup();
icon.mutate().setColorFilter(inPopup ? popupColor : color, mode);
} else {
icon.mutate().setColorFilter(color, mode);
}
}
if (item.hasSubMenu()) {
applyColorFilterToMenuIcon(item.getSubMenu(), color, popupColor, mode, excludedGroups);
@ -191,9 +193,14 @@ public class ThemeUtils implements Constants {
}
public static Context getActionBarContext(final Context context) {
final TypedArray a = context.obtainStyledAttributes(new int[]{android.R.attr.actionBarWidgetTheme});
final int resId = a.getResourceId(0, 0);
a.recycle();
final TypedArray a = context.obtainStyledAttributes(new int[]{android.R.attr.actionBarTheme,
android.R.attr.actionBarWidgetTheme});
final int resId;
try {
resId = a.hasValue(0) ? a.getResourceId(0, 0) : a.getResourceId(1, 0);
} finally {
a.recycle();
}
if (resId == 0) return new TwidereContextWrapper(context);
return new TwidereContextThemeWrapper(context, resId, getUserThemeColor(context));
}

View File

@ -112,7 +112,6 @@ import org.mariotaku.twidere.BuildConfig;
import org.mariotaku.twidere.Constants;
import org.mariotaku.twidere.R;
import org.mariotaku.twidere.activity.CameraCropActivity;
import org.mariotaku.twidere.activity.support.MapViewerActivity;
import org.mariotaku.twidere.adapter.iface.IBaseAdapter;
import org.mariotaku.twidere.adapter.iface.IBaseCardAdapter;
import org.mariotaku.twidere.app.TwidereApplication;
@ -2878,7 +2877,7 @@ public final class Utils implements Constants, TwitterConstants {
builder.appendQueryParameter(QUERY_PARAM_RECIPIENT_ID, String.valueOf(recipientId));
}
final Intent intent = new Intent(Intent.ACTION_VIEW, builder.build());
SwipebackActivityUtils.startSwipebackActivity(activity, intent);
activity.startActivity(intent);
}
public static void openImage(final Context context, final long accountId, final String uri,
@ -2906,11 +2905,7 @@ public final class Utils implements Constants, TwitterConstants {
intent.setData(Uri.parse(uri));
intent.putExtra(EXTRA_ACCOUNT_ID, accountId);
intent.setClass(context, ImageViewerGLActivity.class);
if (context instanceof Activity) {
SwipebackActivityUtils.startSwipebackActivity((Activity) context, intent);
} else {
context.startActivity(intent);
}
context.startActivity(intent);
}
public static void openIncomingFriendships(final Activity activity, final long account_id) {
@ -2920,7 +2915,7 @@ public final class Utils implements Constants, TwitterConstants {
builder.authority(AUTHORITY_INCOMING_FRIENDSHIPS);
builder.appendQueryParameter(QUERY_PARAM_ACCOUNT_ID, String.valueOf(account_id));
final Intent intent = new Intent(Intent.ACTION_VIEW, builder.build());
SwipebackActivityUtils.startSwipebackActivity(activity, intent);
activity.startActivity(intent);
}
public static void openMap(final Context context, final double latitude, final double longitude) {
@ -2931,12 +2926,8 @@ public final class Utils implements Constants, TwitterConstants {
builder.appendQueryParameter(QUERY_PARAM_LAT, String.valueOf(latitude));
builder.appendQueryParameter(QUERY_PARAM_LNG, String.valueOf(longitude));
final Intent intent = new Intent(Intent.ACTION_VIEW, builder.build());
intent.setClass(context, MapViewerActivity.class);
if (context instanceof Activity) {
SwipebackActivityUtils.startSwipebackActivity((Activity) context, intent);
} else {
context.startActivity(intent);
}
intent.setPackage(context.getPackageName());
context.startActivity(Intent.createChooser(intent, null));
}
public static void openMutesUsers(final Activity activity, final long account_id) {
@ -2946,7 +2937,7 @@ public final class Utils implements Constants, TwitterConstants {
builder.authority(AUTHORITY_MUTES_USERS);
builder.appendQueryParameter(QUERY_PARAM_ACCOUNT_ID, String.valueOf(account_id));
final Intent intent = new Intent(Intent.ACTION_VIEW, builder.build());
SwipebackActivityUtils.startSwipebackActivity(activity, intent);
activity.startActivity(intent);
}
public static void openSavedSearches(final Activity activity, final long account_id) {
@ -2956,7 +2947,7 @@ public final class Utils implements Constants, TwitterConstants {
builder.authority(AUTHORITY_SAVED_SEARCHES);
builder.appendQueryParameter(QUERY_PARAM_ACCOUNT_ID, String.valueOf(account_id));
final Intent intent = new Intent(Intent.ACTION_VIEW, builder.build());
SwipebackActivityUtils.startSwipebackActivity(activity, intent);
activity.startActivity(intent);
}
public static void openSearch(final Activity activity, final long account_id, final String query) {
@ -2967,7 +2958,7 @@ public final class Utils implements Constants, TwitterConstants {
builder.appendQueryParameter(QUERY_PARAM_ACCOUNT_ID, String.valueOf(account_id));
builder.appendQueryParameter(QUERY_PARAM_QUERY, query);
final Intent intent = new Intent(Intent.ACTION_VIEW, builder.build());
SwipebackActivityUtils.startSwipebackActivity(activity, intent);
activity.startActivity(intent);
}
public static void openStatus(final Activity activity, final long accountId, final long statusId) {
@ -2978,7 +2969,7 @@ public final class Utils implements Constants, TwitterConstants {
builder.appendQueryParameter(QUERY_PARAM_ACCOUNT_ID, String.valueOf(accountId));
builder.appendQueryParameter(QUERY_PARAM_STATUS_ID, String.valueOf(statusId));
final Intent intent = new Intent(Intent.ACTION_VIEW, builder.build());
SwipebackActivityUtils.startSwipebackActivity(activity, intent);
activity.startActivity(intent);
}
public static void openStatus(final Activity activity, final ParcelableStatus status) {
@ -2994,7 +2985,7 @@ public final class Utils implements Constants, TwitterConstants {
final Intent intent = new Intent(Intent.ACTION_VIEW, builder.build());
intent.setExtrasClassLoader(activity.getClassLoader());
intent.putExtras(extras);
SwipebackActivityUtils.startSwipebackActivity(activity, intent);
activity.startActivity(intent);
}
public static void openStatuses(final Activity activity, final List<ParcelableStatus> statuses) {
@ -3006,7 +2997,7 @@ public final class Utils implements Constants, TwitterConstants {
builder.authority(AUTHORITY_STATUSES);
final Intent intent = new Intent(Intent.ACTION_VIEW, builder.build());
intent.putExtras(extras);
SwipebackActivityUtils.startSwipebackActivity(activity, intent);
activity.startActivity(intent);
}
public static void openStatusFavoriters(final Activity activity, final long accountId, final long statusId) {
@ -3017,7 +3008,7 @@ public final class Utils implements Constants, TwitterConstants {
builder.appendQueryParameter(QUERY_PARAM_ACCOUNT_ID, String.valueOf(accountId));
builder.appendQueryParameter(QUERY_PARAM_STATUS_ID, String.valueOf(statusId));
final Intent intent = new Intent(Intent.ACTION_VIEW, builder.build());
SwipebackActivityUtils.startSwipebackActivity(activity, intent);
activity.startActivity(intent);
}
public static void openStatusReplies(final Activity activity, final long accountId, final long statusId,
@ -3030,7 +3021,7 @@ public final class Utils implements Constants, TwitterConstants {
builder.appendQueryParameter(QUERY_PARAM_STATUS_ID, String.valueOf(statusId));
builder.appendQueryParameter(QUERY_PARAM_SCREEN_NAME, screenName);
final Intent intent = new Intent(Intent.ACTION_VIEW, builder.build());
SwipebackActivityUtils.startSwipebackActivity(activity, intent);
activity.startActivity(intent);
}
public static void openStatusRetweeters(final Activity activity, final long accountId, final long statusId) {
@ -3041,7 +3032,7 @@ public final class Utils implements Constants, TwitterConstants {
builder.appendQueryParameter(QUERY_PARAM_ACCOUNT_ID, String.valueOf(accountId));
builder.appendQueryParameter(QUERY_PARAM_STATUS_ID, String.valueOf(statusId));
final Intent intent = new Intent(Intent.ACTION_VIEW, builder.build());
SwipebackActivityUtils.startSwipebackActivity(activity, intent);
activity.startActivity(intent);
}
public static void openTweetSearch(final Activity activity, final long accountId, final String query) {
@ -3055,7 +3046,7 @@ public final class Utils implements Constants, TwitterConstants {
builder.appendQueryParameter(QUERY_PARAM_QUERY, query);
}
final Intent intent = new Intent(Intent.ACTION_VIEW, builder.build());
SwipebackActivityUtils.startSwipebackActivity(activity, intent);
activity.startActivity(intent);
}
public static void openUserBlocks(final Activity activity, final long account_id) {
@ -3065,7 +3056,7 @@ public final class Utils implements Constants, TwitterConstants {
builder.authority(AUTHORITY_USER_BLOCKS);
builder.appendQueryParameter(QUERY_PARAM_ACCOUNT_ID, String.valueOf(account_id));
final Intent intent = new Intent(Intent.ACTION_VIEW, builder.build());
SwipebackActivityUtils.startSwipebackActivity(activity, intent);
activity.startActivity(intent);
}
public static void openUserFavorites(final Activity activity, final long account_id, final long user_id,
@ -3082,7 +3073,7 @@ public final class Utils implements Constants, TwitterConstants {
builder.appendQueryParameter(QUERY_PARAM_SCREEN_NAME, screen_name);
}
final Intent intent = new Intent(Intent.ACTION_VIEW, builder.build());
SwipebackActivityUtils.startSwipebackActivity(activity, intent);
activity.startActivity(intent);
}
@ -3100,7 +3091,7 @@ public final class Utils implements Constants, TwitterConstants {
builder.appendQueryParameter(QUERY_PARAM_SCREEN_NAME, screen_name);
}
final Intent intent = new Intent(Intent.ACTION_VIEW, builder.build());
SwipebackActivityUtils.startSwipebackActivity(activity, intent);
activity.startActivity(intent);
}
public static void openUserFriends(final Activity activity, final long account_id, final long user_id,
@ -3117,7 +3108,7 @@ public final class Utils implements Constants, TwitterConstants {
builder.appendQueryParameter(QUERY_PARAM_SCREEN_NAME, screen_name);
}
final Intent intent = new Intent(Intent.ACTION_VIEW, builder.build());
SwipebackActivityUtils.startSwipebackActivity(activity, intent);
activity.startActivity(intent);
}
@ -3141,7 +3132,7 @@ public final class Utils implements Constants, TwitterConstants {
builder.appendQueryParameter(QUERY_PARAM_LIST_NAME, listName);
}
final Intent intent = new Intent(Intent.ACTION_VIEW, builder.build());
SwipebackActivityUtils.startSwipebackActivity(activity, intent);
activity.startActivity(intent);
}
public static void openUserListDetails(final Activity activity, final ParcelableUserList userList) {
@ -3159,7 +3150,7 @@ public final class Utils implements Constants, TwitterConstants {
final Intent intent = new Intent(Intent.ACTION_VIEW, builder.build());
intent.setExtrasClassLoader(activity.getClassLoader());
intent.putExtras(extras);
SwipebackActivityUtils.startSwipebackActivity(activity, intent);
activity.startActivity(intent);
}
public static void openUserListMembers(final Activity activity, final long accountId, final long listId,
@ -3182,7 +3173,7 @@ public final class Utils implements Constants, TwitterConstants {
builder.appendQueryParameter(QUERY_PARAM_LIST_NAME, listName);
}
final Intent intent = new Intent(Intent.ACTION_VIEW, builder.build());
SwipebackActivityUtils.startSwipebackActivity(activity, intent);
activity.startActivity(intent);
}
public static void openUserListMembers(final Activity activity, final ParcelableUserList list) {
@ -3204,7 +3195,7 @@ public final class Utils implements Constants, TwitterConstants {
builder.appendQueryParameter(QUERY_PARAM_SCREEN_NAME, screen_name);
}
final Intent intent = new Intent(Intent.ACTION_VIEW, builder.build());
SwipebackActivityUtils.startSwipebackActivity(activity, intent);
activity.startActivity(intent);
}
public static void openUserLists(final Activity activity, final long account_id, final long user_id,
@ -3221,7 +3212,7 @@ public final class Utils implements Constants, TwitterConstants {
builder.appendQueryParameter(QUERY_PARAM_SCREEN_NAME, screen_name);
}
final Intent intent = new Intent(Intent.ACTION_VIEW, builder.build());
SwipebackActivityUtils.startSwipebackActivity(activity, intent);
activity.startActivity(intent);
}
public static void openUserListSubscribers(final Activity activity, final long accountId, final long listId,
@ -3244,7 +3235,7 @@ public final class Utils implements Constants, TwitterConstants {
builder.appendQueryParameter(QUERY_PARAM_LIST_NAME, listName);
}
final Intent intent = new Intent(Intent.ACTION_VIEW, builder.build());
SwipebackActivityUtils.startSwipebackActivity(activity, intent);
activity.startActivity(intent);
}
public static void openUserListSubscribers(final Activity activity, final ParcelableUserList list) {
@ -3272,7 +3263,7 @@ public final class Utils implements Constants, TwitterConstants {
builder.appendQueryParameter(QUERY_PARAM_LIST_NAME, listName);
}
final Intent intent = new Intent(Intent.ACTION_VIEW, builder.build());
SwipebackActivityUtils.startSwipebackActivity(activity, intent);
activity.startActivity(intent);
}
public static void openUserListTimeline(final Activity activity, final ParcelableUserList list) {
@ -3290,7 +3281,7 @@ public final class Utils implements Constants, TwitterConstants {
builder.appendQueryParameter(QUERY_PARAM_SCREEN_NAME, screen_name);
}
final Intent intent = new Intent(Intent.ACTION_VIEW, builder.build());
SwipebackActivityUtils.startSwipebackActivity(activity, intent);
activity.startActivity(intent);
}
public static void openUserProfile(final Activity activity, final long account_id, final long user_id,
@ -3307,7 +3298,7 @@ public final class Utils implements Constants, TwitterConstants {
builder.appendQueryParameter(QUERY_PARAM_SCREEN_NAME, screen_name);
}
final Intent intent = new Intent(Intent.ACTION_VIEW, builder.build());
SwipebackActivityUtils.startSwipebackActivity(activity, intent);
activity.startActivity(intent);
}
public static void openUserProfile(final Activity activity, final ParcelableUser user) {
@ -3327,7 +3318,7 @@ public final class Utils implements Constants, TwitterConstants {
final Intent intent = new Intent(Intent.ACTION_VIEW, builder.build());
intent.setExtrasClassLoader(activity.getClassLoader());
intent.putExtras(extras);
SwipebackActivityUtils.startSwipebackActivity(activity, intent);
activity.startActivity(intent);
}
public static void openUsers(final Activity activity, final List<ParcelableUser> users) {
@ -3339,7 +3330,7 @@ public final class Utils implements Constants, TwitterConstants {
builder.authority(AUTHORITY_USERS);
final Intent intent = new Intent(Intent.ACTION_VIEW, builder.build());
intent.putExtras(extras);
SwipebackActivityUtils.startSwipebackActivity(activity, intent);
activity.startActivity(intent);
}
public static void openUserTimeline(final Activity activity, final long account_id, final long user_id,
@ -3356,7 +3347,7 @@ public final class Utils implements Constants, TwitterConstants {
builder.appendQueryParameter(QUERY_PARAM_SCREEN_NAME, screen_name);
}
final Intent intent = new Intent(Intent.ACTION_VIEW, builder.build());
SwipebackActivityUtils.startSwipebackActivity(activity, intent);
activity.startActivity(intent);
}

View File

@ -3,26 +3,27 @@ package org.mariotaku.twidere.view;
import android.annotation.SuppressLint;
import android.content.Context;
import android.graphics.Rect;
import android.support.annotation.NonNull;
import android.support.v4.view.ViewPager;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
import com.jeremyfeinstein.slidingmenu.lib.CustomViewAbove;
import com.jeremyfeinstein.slidingmenu.lib.CustomViewBehind;
import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu;
import org.mariotaku.twidere.Constants;
import org.mariotaku.twidere.activity.support.HomeActivity;
/**
* Created by mariotaku on 14/10/21.
*/
public class HomeSlidingMenu extends SlidingMenu {
public class HomeSlidingMenu extends SlidingMenu implements Constants {
private final HomeActivity mActivity;
public HomeSlidingMenu(final Context activity) {
this(activity, null);
public HomeSlidingMenu(final Context context) {
this(context, null);
}
public HomeSlidingMenu(Context context, AttributeSet attrs) {
@ -34,8 +35,9 @@ public class HomeSlidingMenu extends SlidingMenu {
mActivity = (HomeActivity) context;
}
@Override
public boolean dispatchTouchEvent(final MotionEvent ev) {
public boolean dispatchTouchEvent(@NonNull final MotionEvent ev) {
switch (ev.getActionMasked()) {
case MotionEvent.ACTION_DOWN: {
final boolean isTouchingMargin = isTouchingMargin(ev);
@ -46,12 +48,6 @@ public class HomeSlidingMenu extends SlidingMenu {
return super.dispatchTouchEvent(ev);
}
@Override
protected CustomViewAbove newCustomViewAbove(final Context context) {
if (isInEditMode()) return super.newCustomViewAbove(context);
return new MyCustomViewAbove(context, this);
}
@Override
protected CustomViewBehind newCustomViewBehind(final Context context) {
if (isInEditMode()) return super.newCustomViewBehind(context);
@ -81,19 +77,6 @@ public class HomeSlidingMenu extends SlidingMenu {
return false;
}
@SuppressLint("ViewConstructor")
private static class MyCustomViewAbove extends CustomViewAbove {
private final HomeSlidingMenu mSlidingMenu;
public MyCustomViewAbove(final Context context, final HomeSlidingMenu slidingMenu) {
super(context);
mSlidingMenu = slidingMenu;
}
}
@SuppressLint("ViewConstructor")
private static class MyCustomViewBehind extends CustomViewBehind {

View File

@ -3,6 +3,7 @@ package org.mariotaku.twidere.view;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewCompat;
import android.support.v4.view.ViewPager;
import android.support.v4.view.ViewPager.OnPageChangeListener;
import android.support.v7.widget.LinearLayoutManager;
@ -32,6 +33,9 @@ public class TabPagerIndicator extends RecyclerView implements PagerIndicator {
public TabPagerIndicator(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
ViewCompat.setOverScrollMode(this, ViewCompat.OVER_SCROLL_NEVER);
setHorizontalScrollBarEnabled(false);
setVerticalScrollBarEnabled(false);
setLayoutManager(new TabLayoutManager(this));
mIndicatorAdapter = new TabPagerIndicatorAdapter(this);
setAdapter(mIndicatorAdapter);

View File

@ -1,50 +1,51 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/compose_bottombar"
style="?android:actionBarSplitStyle"
android:layout_width="match_parent"
android:layout_height="?android:actionBarSize"
android:baselineAligned="false"
android:gravity="center_vertical"
android:orientation="horizontal">
<LinearLayout android:id="@+id/compose_bottombar"
style="?android:actionBarSplitStyle"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="?android:actionBarSize"
android:baselineAligned="false"
android:gravity="center_vertical"
android:orientation="horizontal">
<com.scvngr.levelup.views.gallery.Gallery
android:id="@+id/account_selector"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"/>
<com.scvngr.levelup.views.gallery.Gallery
android:id="@+id/account_selector"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"/>
<View
android:id="@+id/account_selector_divider"
android:layout_width="0.2dp"
android:layout_height="match_parent"
android:layout_margin="@dimen/element_spacing_normal"
android:layout_weight="0"
android:background="#80808080"/>
<View
android:id="@+id/account_selector_divider"
android:layout_width="0.2dp"
android:layout_height="match_parent"
android:layout_margin="@dimen/element_spacing_normal"
android:layout_weight="0"
android:background="#80808080"/>
<HorizontalScrollView
android:id="@+id/bottom_menu_container"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="0">
<HorizontalScrollView
android:id="@+id/bottom_menu_container"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="0"
android:fadeScrollbars="false">
<org.mariotaku.twidere.view.TwidereMenuBar
android:id="@+id/bottom_menu"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="right"
android:background="@null"
android:max="@integer/max_action_buttons"/>
</HorizontalScrollView>
<org.mariotaku.twidere.view.TwidereMenuBar
android:id="@+id/bottom_menu"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="right"
android:background="@null"
android:max="@integer/max_action_buttons"/>
</HorizontalScrollView>
<View
android:id="@+id/bottom_send_divider"
android:layout_width="0.2dp"
android:layout_height="match_parent"
android:layout_margin="@dimen/element_spacing_normal"
android:layout_weight="0"
android:background="#80808080"/>
<View
android:id="@+id/bottom_send_divider"
android:layout_width="0.2dp"
android:layout_height="match_parent"
android:layout_margin="@dimen/element_spacing_normal"
android:layout_weight="0"
android:background="#80808080"/>
<include layout="@layout/action_item_compose"/>
<include layout="@layout/action_item_compose"/>
</LinearLayout>

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<include layout="@android:layout/list_content"/>r
</FrameLayout>

View File

@ -1,8 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<org.mariotaku.twidere.view.HomeSlidingMenu
android:id="@+id/home_menu"
<merge
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:viewAbove="@layout/activity_home_content"/>
xmlns:app="http://schemas.android.com/apk/res-auto">
<org.mariotaku.twidere.view.HomeSlidingMenu
android:id="@+id/home_menu"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:viewAbove="@layout/activity_home_content"/>
</merge>

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
</merge>

View File

@ -1,62 +1,82 @@
<?xml version="1.0" encoding="utf-8"?>
<org.mariotaku.twidere.view.CardItemLinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingBottom="@dimen/element_spacing_small"
android:paddingLeft="@dimen/element_spacing_normal"
android:paddingRight="@dimen/element_spacing_normal"
android:paddingTop="@dimen/element_spacing_small"
tools:context=".adapter.DraftsAdapter">
<org.mariotaku.twidere.view.CardItemLinearLayout
android:id="@+id/content"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:descendantFocusability="blocksDescendants"
android:orientation="vertical"
android:paddingBottom="@dimen/element_spacing_small"
android:paddingLeft="@dimen/element_spacing_normal"
android:paddingRight="@dimen/element_spacing_normal"
android:paddingTop="@dimen/element_spacing_small"
tools:context=".adapter.DraftsAdapter">
<org.mariotaku.twidere.view.ImagePreviewContainer
android:id="@+id/image_preview_container"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<org.mariotaku.twidere.view.ImagePreviewContainer
android:id="@+id/image_preview_container"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<org.mariotaku.twidere.view.HighlightImageView
android:id="@+id/image_preview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"/>
<org.mariotaku.twidere.view.HighlightImageView
android:id="@+id/image_preview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"/>
<ProgressBar
android:id="@+id/image_preview_progress"
style="?android:progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="16dp"/>
<ProgressBar
android:id="@+id/image_preview_progress"
style="?android:progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="16dp"/>
<View
android:layout_width="match_parent"
android:layout_height="0.2dp"
android:layout_gravity="bottom"
android:background="#40808080"/>
</org.mariotaku.twidere.view.ImagePreviewContainer>
<View
android:layout_width="match_parent"
android:layout_height="0.2dp"
android:layout_gravity="bottom"
android:background="#40808080"/>
</org.mariotaku.twidere.view.ImagePreviewContainer>
<org.mariotaku.twidere.view.themed.ThemedTextView
android:id="@+id/text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?android:listPreferredItemHeightSmall"
android:paddingBottom="@dimen/element_spacing_normal"
android:paddingLeft="@dimen/element_spacing_normal"
android:paddingRight="@dimen/element_spacing_normal"
android:paddingTop="@dimen/element_spacing_normal"
android:textAppearance="?android:textAppearanceSmall"
android:textColor="?android:textColorPrimary"/>
<org.mariotaku.twidere.view.themed.ThemedTextView
android:id="@+id/text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?android:listPreferredItemHeightSmall"
android:paddingBottom="@dimen/element_spacing_normal"
android:paddingLeft="@dimen/element_spacing_normal"
android:paddingRight="@dimen/element_spacing_normal"
android:paddingTop="@dimen/element_spacing_normal"
android:textAppearance="?android:textAppearanceSmall"
android:textColor="?android:textColorPrimary"/>
<org.mariotaku.twidere.view.themed.ThemedTextView
android:id="@+id/time"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="@dimen/element_spacing_normal"
android:paddingLeft="@dimen/element_spacing_normal"
android:paddingRight="@dimen/element_spacing_normal"
android:textAppearance="?android:textAppearanceSmall"
android:textColor="?android:textColorPrimary"/>
<org.mariotaku.twidere.view.themed.ThemedTextView
android:id="@+id/time"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="@dimen/element_spacing_normal"
android:paddingLeft="@dimen/element_spacing_normal"
android:paddingRight="@dimen/element_spacing_normal"
android:textAppearance="?android:textAppearanceSmall"
android:textColor="?android:textColorPrimary"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="right"
android:orientation="horizontal">
<Button
style="?android:borderlessButtonStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/delete"/>
<Button
style="?android:borderlessButtonStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/send"/>
</LinearLayout>
</org.mariotaku.twidere.view.CardItemLinearLayout>

View File

@ -64,7 +64,7 @@
<string name="pick_from_gallery">从图库中选取</string>
<string name="statuses">推文</string>
<string name="followers">关注者</string>
<string name="following">关注</string>
<string name="following">正在关注</string>
<string name="about">关于</string>
<string name="open_source_license">开源许可</string>
<string name="api">API</string>

View File

@ -1,65 +1,65 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Widget.Twidere.ActionBar.Colored" parent="android:Widget.Holo.Light.ActionBar.Solid">
<style name="Widget.Twidere.ActionBar.Colored" parent="android:Widget.DeviceDefault.Light.ActionBar.Solid">
<item name="android:background">@drawable/ab_twidere_solid_color_holo</item>
<!--<item name="android:background">@android:color/transparent</item>-->
</style>
<style name="Widget.Twidere.ActionBar.Colored.Inverse" parent="android:Widget.Holo.Light.ActionBar.Solid.Inverse">
<style name="Widget.Twidere.ActionBar.Colored.Inverse" parent="android:Widget.DeviceDefault.Light.ActionBar.Solid.Inverse">
<item name="android:background">@drawable/ab_twidere_solid_color_holo</item>
<!--<item name="android:background">@android:color/transparent</item>-->
</style>
<style name="Widget.Twidere.ActionBar.Dark" parent="android:Widget.Holo.ActionBar.Solid">
<style name="Widget.Twidere.ActionBar.Dark" parent="android:Widget.DeviceDefault.ActionBar.Solid">
<item name="android:background">@drawable/ab_twidere_solid_dark_holo</item>
<!--<item name="android:background">@android:color/transparent</item>-->
</style>
<style name="Widget.Twidere.ActionBar.Light" parent="android:Widget.Holo.Light.ActionBar.Solid">
<style name="Widget.Twidere.ActionBar.Light" parent="android:Widget.DeviceDefault.Light.ActionBar.Solid">
<item name="android:background">@drawable/ab_twidere_solid_light_holo</item>
<!--<item name="android:background">@android:color/transparent</item>-->
</style>
<style name="Widget.Twidere.ActionBar.Light.DarkActionBar" parent="android:Widget.Holo.Light.ActionBar.Solid.Inverse">
<style name="Widget.Twidere.ActionBar.Light.DarkActionBar" parent="android:Widget.DeviceDefault.Light.ActionBar.Solid.Inverse">
<item name="android:background">@drawable/ab_twidere_solid_dark_holo</item>
<!--<item name="android:background">@android:color/transparent</item>-->
</style>
<style name="Widget.Twidere.Viewer.ActionBar" parent="android:Widget.Holo.ActionBar">
<style name="Widget.Twidere.Viewer.ActionBar" parent="android:Widget.DeviceDefault.ActionBar">
<item name="android:background">#80000000</item>
<item name="android:backgroundSplit">#80000000</item>
</style>
<style name="Widget.Twidere.ImageButton.Borderless" parent="android:Widget.Holo.ImageButton">
<style name="Widget.Twidere.ImageButton.Borderless" parent="android:Widget.DeviceDefault.ImageButton">
<item name="android:background">?android:attr/selectableItemBackground</item>
</style>
<style name="Widget.Twidere.Light.ImageButton.Borderless" parent="android:Widget.Holo.Light.ImageButton">
<style name="Widget.Twidere.Light.ImageButton.Borderless" parent="android:Widget.DeviceDefault.Light.ImageButton">
<item name="android:background">?android:attr/selectableItemBackground</item>
</style>
<style name="Widget.Twidere.SelectableView" parent="android:Widget.Holo">
<style name="Widget.Twidere.SelectableView" parent="android:Widget.DeviceDefault">
<item name="android:background">?android:attr/selectableItemBackground</item>
</style>
<style name="Widget.Twidere.Light.SelectableView" parent="android:Widget.Holo.Light">
<style name="Widget.Twidere.Light.SelectableView" parent="android:Widget.DeviceDefault.Light">
<item name="android:background">?android:attr/selectableItemBackground</item>
</style>
<style name="Widget.Twidere.ActionButton.Colored" parent="android:Widget.Holo.Light.ActionButton">
<style name="Widget.Twidere.ActionButton.Colored" parent="android:Widget.DeviceDefault.Light.ActionButton">
<item name="android:background">?android:actionBarItemBackground</item>
</style>
<style name="Widget.Twidere.ActionButton.Overflow.Colored" parent="android:Widget.Holo.Light.ActionButton.Overflow">
<style name="Widget.Twidere.ActionButton.Overflow.Colored" parent="android:Widget.DeviceDefault.Light.ActionButton.Overflow">
<item name="android:background">?android:actionBarItemBackground</item>
</style>
<style name="Widget.Twidere.ActionButton.Colored.DarkActionBar" parent="android:Widget.Holo.ActionButton">
<style name="Widget.Twidere.ActionButton.Colored.DarkActionBar" parent="android:Widget.DeviceDefault.ActionButton">
<item name="android:background">?android:actionBarItemBackground</item>
</style>
<style name="Widget.Twidere.ActionButton.Overflow.Colored.DarkActionBar" parent="android:Widget.Holo.ActionButton.Overflow">
<style name="Widget.Twidere.ActionButton.Overflow.Colored.DarkActionBar" parent="android:Widget.DeviceDefault.ActionButton.Overflow">
<item name="android:background">?android:actionBarItemBackground</item>
</style>
@ -84,7 +84,7 @@
<item name="android:orientation">horizontal</item>
</style>
<style name="Widget.TabPageIndicator.TabItem.TextView" parent="@android:style/Widget.Holo.TextView">
<style name="Widget.TabPageIndicator.TabItem.TextView" parent="@android:style/Widget.DeviceDefault.TextView">
<item name="android:textAppearance">@style/TextAppearance.TabPageIndicator</item>
<item name="android:textColor">#fff3f3f3</item>
<item name="android:textStyle">bold</item>
@ -118,7 +118,7 @@
<item name="scrimAlpha">0.75</item>
</style>
<style name="Widget.CardItemView" parent="android:Widget.Holo">
<style name="Widget.CardItemView" parent="android:Widget.DeviceDefault">
<item name="cardBackground">?cardItemBackground</item>
<item name="cardBackgroundAlpha">50%p</item>
<item name="cardSelector">?android:selectableItemBackground</item>
@ -130,7 +130,7 @@
<item name="cardGapTextSize">18sp</item>
</style>
<style name="Widget.CardItemView.Light" parent="android:Widget.Holo">
<style name="Widget.CardItemView.Light" parent="android:Widget.DeviceDefault">
<item name="cardBackground">?cardItemBackground</item>
<item name="cardBackgroundAlpha">50%p</item>
<item name="cardSelector">?android:selectableItemBackground</item>
@ -142,7 +142,7 @@
<item name="cardGapTextSize">18sp</item>
</style>
<style name="Widget.StaggeredGridView" parent="android:Widget.Holo">
<style name="Widget.StaggeredGridView" parent="android:Widget.DeviceDefault">
<item name="column_count_portrait">@integer/staggered_grid_columns_port</item>
<item name="column_count_landscape">@integer/staggered_grid_columns_land</item>
</style>

View File

@ -3,7 +3,9 @@
<style name="Theme"/>
<style name="Theme.Launcher" parent="android:Theme.NoDisplay"/>
<style name="Theme.Launcher" parent="android:Theme.NoDisplay">
<item name="android:windowAnimationStyle">@android:style/Animation.Activity</item>
</style>
<style name="Theme.Blank" parent="android:Theme.DeviceDefault.NoActionBar">
@ -463,7 +465,10 @@
<item name="android:windowNoDisplay">true</item>
</style>
<style name="Theme.Test" parent="android:Theme.DeviceDefault"/>
<style name="Theme.Test" parent="android:Theme.DeviceDefault">
<item name="android:windowActionBarOverlay">true</item>
<item name="android:windowActionModeOverlay">true</item>
</style>
<style name="Theme.Nyan" parent="android:Theme.DeviceDefault.NoActionBar">
<item name="android:windowBackground">@color/nyan_background</item>

View File

@ -45,9 +45,5 @@
android:defaultValue="false"
android:key="long_click_to_open_menu"
android:title="@string/long_click_to_open_menu"/>
<org.mariotaku.twidere.preference.AutoFixCheckBoxPreference
android:defaultValue="false"
android:key="swipe_back"
android:title="@string/swipe_back"/>
</PreferenceScreen>