modified build script
This commit is contained in:
parent
edd5748c7a
commit
dd4104b503
11
.travis.yml
11
.travis.yml
|
@ -21,9 +21,16 @@ android:
|
|||
# if you need to run emulator(s) during your tests
|
||||
# - sys-img-armeabi-v7a-android-19
|
||||
# - sys-img-x86-android-17
|
||||
|
||||
script: ./gradlew build --no-daemon
|
||||
jdk:
|
||||
- openjdk7
|
||||
|
||||
sudo: false
|
||||
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- python2.7
|
||||
|
||||
script: ./gradlew build --no-daemon
|
||||
|
||||
after_success: ./scripts/travis_upload_release_to_github.py
|
||||
|
|
|
@ -50,8 +50,8 @@ public class GeoLocation implements ValueMap {
|
|||
}
|
||||
};
|
||||
|
||||
protected double latitude;
|
||||
protected double longitude;
|
||||
double latitude;
|
||||
double longitude;
|
||||
|
||||
/**
|
||||
* Creates a GeoLocation instance
|
||||
|
@ -64,10 +64,6 @@ public class GeoLocation implements ValueMap {
|
|||
this.longitude = longitude;
|
||||
}
|
||||
|
||||
/* For serialization purposes only. */
|
||||
/* package */GeoLocation() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object o) {
|
||||
|
|
|
@ -19,14 +19,23 @@
|
|||
|
||||
package edu.tsinghua.hotmobi;
|
||||
|
||||
import android.content.Context;
|
||||
import android.location.Location;
|
||||
|
||||
import org.mariotaku.twidere.app.TwidereApplication;
|
||||
import org.mariotaku.twidere.model.ParcelableStatus;
|
||||
import org.mariotaku.twidere.util.Utils;
|
||||
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
import edu.tsinghua.hotmobi.model.BaseEvent;
|
||||
import edu.tsinghua.hotmobi.model.FirstLaunchEvent;
|
||||
import edu.tsinghua.hotmobi.model.LatLng;
|
||||
import edu.tsinghua.hotmobi.model.RefreshEvent;
|
||||
import edu.tsinghua.hotmobi.model.SessionEvent;
|
||||
import edu.tsinghua.hotmobi.model.TweetEvent;
|
||||
import edu.tsinghua.hotmobi.model.TweetType;
|
||||
|
||||
/**
|
||||
* Created by mariotaku on 15/8/10.
|
||||
|
@ -35,7 +44,7 @@ public class HotMobiLogger {
|
|||
|
||||
private final Executor mExecutor;
|
||||
|
||||
HotMobiLogger() {
|
||||
public HotMobiLogger() {
|
||||
mExecutor = Executors.newSingleThreadExecutor();
|
||||
}
|
||||
|
||||
|
@ -61,4 +70,18 @@ public class HotMobiLogger {
|
|||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static int getTweetType(ParcelableStatus status) {
|
||||
return TweetType.TEXT;
|
||||
}
|
||||
|
||||
public static HotMobiLogger getInstance(Context context) {
|
||||
return ((TwidereApplication) context.getApplicationContext()).getHotMobiLogger();
|
||||
}
|
||||
|
||||
public static LatLng getCachedLatLng(Context context) {
|
||||
final Location location = Utils.getCachedLocation(context);
|
||||
if (location == null) return null;
|
||||
return new LatLng(location.getLatitude(), location.getLongitude());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,10 +19,14 @@
|
|||
|
||||
package edu.tsinghua.hotmobi.model;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.bluelinelabs.logansquare.annotation.JsonField;
|
||||
import com.bluelinelabs.logansquare.annotation.JsonObject;
|
||||
|
||||
import org.mariotaku.twidere.api.twitter.model.Location;
|
||||
import java.util.TimeZone;
|
||||
|
||||
import edu.tsinghua.hotmobi.HotMobiLogger;
|
||||
|
||||
/**
|
||||
* Created by mariotaku on 15/8/8.
|
||||
|
@ -36,5 +40,31 @@ public class BaseEvent {
|
|||
@JsonField(name = "time_offset")
|
||||
long timeOffset;
|
||||
@JsonField(name = "location")
|
||||
Location location;
|
||||
LatLng location;
|
||||
|
||||
public void setStartTime(long startTime) {
|
||||
this.startTime = startTime;
|
||||
}
|
||||
|
||||
public void setEndTime(long endTime) {
|
||||
this.endTime = endTime;
|
||||
}
|
||||
|
||||
public void setTimeOffset(long timeOffset) {
|
||||
this.timeOffset = timeOffset;
|
||||
}
|
||||
|
||||
public void setLocation(LatLng location) {
|
||||
this.location = location;
|
||||
}
|
||||
|
||||
public void markStart(Context context) {
|
||||
setStartTime(System.currentTimeMillis());
|
||||
setTimeOffset(TimeZone.getDefault().getOffset(startTime));
|
||||
setLocation(HotMobiLogger.getCachedLatLng(context));
|
||||
}
|
||||
|
||||
public void markEnd() {
|
||||
setEndTime(System.currentTimeMillis());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,59 @@
|
|||
/*
|
||||
* Twidere - Twitter client for Android
|
||||
*
|
||||
* Copyright (C) 2012-2015 Mariotaku Lee <mariotaku.lee@gmail.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package edu.tsinghua.hotmobi.model;
|
||||
|
||||
import com.bluelinelabs.logansquare.annotation.JsonField;
|
||||
import com.bluelinelabs.logansquare.annotation.JsonObject;
|
||||
|
||||
/**
|
||||
* Created by mariotaku on 15/8/13.
|
||||
*/
|
||||
@JsonObject
|
||||
public class LatLng {
|
||||
@JsonField(name = "latitude")
|
||||
double latitude;
|
||||
@JsonField(name = "longitude")
|
||||
double longitude;
|
||||
|
||||
public LatLng() {
|
||||
}
|
||||
|
||||
public LatLng(double latitude, double longitude) {
|
||||
|
||||
this.latitude = latitude;
|
||||
this.longitude = longitude;
|
||||
}
|
||||
|
||||
public double getLatitude() {
|
||||
return latitude;
|
||||
}
|
||||
|
||||
public void setLatitude(double latitude) {
|
||||
this.latitude = latitude;
|
||||
}
|
||||
|
||||
public double getLongitude() {
|
||||
return longitude;
|
||||
}
|
||||
|
||||
public void setLongitude(double longitude) {
|
||||
this.longitude = longitude;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,108 @@
|
|||
/*
|
||||
* Twidere - Twitter client for Android
|
||||
*
|
||||
* Copyright (C) 2012-2015 Mariotaku Lee <mariotaku.lee@gmail.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package edu.tsinghua.hotmobi.model;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.bluelinelabs.logansquare.annotation.JsonField;
|
||||
import com.bluelinelabs.logansquare.annotation.JsonObject;
|
||||
|
||||
import org.mariotaku.twidere.model.ParcelableMedia;
|
||||
import org.mariotaku.twidere.model.ParcelableStatus;
|
||||
|
||||
import edu.tsinghua.hotmobi.HotMobiLogger;
|
||||
|
||||
/**
|
||||
* Created by mariotaku on 15/8/7.
|
||||
*/
|
||||
@JsonObject
|
||||
public class MediaEvent extends BaseEvent {
|
||||
|
||||
@JsonField(name = "id")
|
||||
long id;
|
||||
@JsonField(name = "user_id")
|
||||
long userId;
|
||||
@JsonField(name = "tweet_type")
|
||||
int tweetType;
|
||||
@JsonField(name = "timeline_type")
|
||||
int timelineType;
|
||||
@JsonField(name = "action")
|
||||
int action;
|
||||
@JsonField(name = "preview_url")
|
||||
String previewUrl;
|
||||
@JsonField(name = "media_url")
|
||||
String mediaUrl;
|
||||
@JsonField(name = "preview_enabled")
|
||||
boolean previewEnabled;
|
||||
|
||||
public static MediaEvent create(Context context, ParcelableStatus status, ParcelableMedia media, int timelineType, boolean previewEnabled) {
|
||||
final MediaEvent event = new MediaEvent();
|
||||
event.markStart(context);
|
||||
event.setId(status.id);
|
||||
event.setUserId(status.user_id);
|
||||
event.setMediaUrl(media.media_url);
|
||||
event.setPreviewUrl(media.preview_url);
|
||||
event.setPreviewEnabled(previewEnabled);
|
||||
event.setTimelineType(timelineType);
|
||||
event.setTweetType(HotMobiLogger.getTweetType(status));
|
||||
return event;
|
||||
}
|
||||
|
||||
public void setPreviewEnabled(boolean previewEnabled) {
|
||||
this.previewEnabled = previewEnabled;
|
||||
}
|
||||
|
||||
public void setMediaUrl(String mediaUrl) {
|
||||
this.mediaUrl = mediaUrl;
|
||||
}
|
||||
|
||||
public void setPreviewUrl(String previewUrl) {
|
||||
this.previewUrl = previewUrl;
|
||||
}
|
||||
|
||||
public void setAction(int action) {
|
||||
this.action = action;
|
||||
}
|
||||
|
||||
public void setId(long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public void setUserId(long userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public void setTweetType(int tweetType) {
|
||||
this.tweetType = tweetType;
|
||||
}
|
||||
|
||||
public void setTimelineType(int timelineType) {
|
||||
this.timelineType = timelineType;
|
||||
}
|
||||
|
||||
|
||||
public interface Action {
|
||||
int OPEN = 0;
|
||||
int RETWEET = 1;
|
||||
int FAVORITE = 2;
|
||||
|
||||
int UNFAVORITE = -2;
|
||||
}
|
||||
}
|
|
@ -19,6 +19,8 @@
|
|||
|
||||
package edu.tsinghua.hotmobi.model;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.bluelinelabs.logansquare.annotation.JsonField;
|
||||
import com.bluelinelabs.logansquare.annotation.JsonObject;
|
||||
|
||||
|
@ -33,4 +35,19 @@ public class RefreshEvent extends BaseEvent {
|
|||
@JsonField(name = "timeline_type")
|
||||
int timelineType;
|
||||
|
||||
public void setIds(long[] ids) {
|
||||
this.ids = ids;
|
||||
}
|
||||
|
||||
public void setTimelineType(int timelineType) {
|
||||
this.timelineType = timelineType;
|
||||
}
|
||||
|
||||
public static RefreshEvent create(final Context context, long[] ids, int timelineType) {
|
||||
final RefreshEvent event = new RefreshEvent();
|
||||
event.markStart(context);
|
||||
event.setIds(ids);
|
||||
event.setTimelineType(timelineType);
|
||||
return event;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,16 +19,20 @@
|
|||
|
||||
package edu.tsinghua.hotmobi.model;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.bluelinelabs.logansquare.annotation.JsonField;
|
||||
import com.bluelinelabs.logansquare.annotation.JsonObject;
|
||||
|
||||
import org.mariotaku.twidere.api.twitter.model.Location;
|
||||
import org.mariotaku.twidere.model.ParcelableStatus;
|
||||
|
||||
import edu.tsinghua.hotmobi.HotMobiLogger;
|
||||
|
||||
/**
|
||||
* Created by mariotaku on 15/8/7.
|
||||
*/
|
||||
@JsonObject
|
||||
public class TweetEvent extends BaseEvent{
|
||||
public class TweetEvent extends BaseEvent {
|
||||
|
||||
@JsonField(name = "id")
|
||||
long id;
|
||||
|
@ -38,5 +42,45 @@ public class TweetEvent extends BaseEvent{
|
|||
int tweetType;
|
||||
@JsonField(name = "timeline_type")
|
||||
int timelineType;
|
||||
@JsonField(name = "action")
|
||||
int action;
|
||||
|
||||
public void setAction(int action) {
|
||||
this.action = action;
|
||||
}
|
||||
|
||||
public void setId(long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public void setUserId(long userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public void setTweetType(int tweetType) {
|
||||
this.tweetType = tweetType;
|
||||
}
|
||||
|
||||
public void setTimelineType(int timelineType) {
|
||||
this.timelineType = timelineType;
|
||||
}
|
||||
|
||||
public static TweetEvent create(Context context, ParcelableStatus status, int timelineType) {
|
||||
final TweetEvent event = new TweetEvent();
|
||||
event.markStart(context);
|
||||
event.setId(status.id);
|
||||
event.setUserId(status.user_id);
|
||||
event.setTimelineType(timelineType);
|
||||
event.setTweetType(HotMobiLogger.getTweetType(status));
|
||||
return event;
|
||||
}
|
||||
|
||||
|
||||
public interface Action {
|
||||
int OPEN = 0;
|
||||
int RETWEET = 1;
|
||||
int FAVORITE = 2;
|
||||
|
||||
int UNFAVORITE =-2;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* Twidere - Twitter client for Android
|
||||
*
|
||||
* Copyright (C) 2012-2015 Mariotaku Lee <mariotaku.lee@gmail.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package edu.tsinghua.hotmobi.model;
|
||||
|
||||
/**
|
||||
* Created by mariotaku on 15/8/13.
|
||||
*/
|
||||
public interface TweetType {
|
||||
int TEXT = 0;
|
||||
int PHOTO = 1;
|
||||
int VIDEO = 2;
|
||||
int OTHER = 3;
|
||||
}
|
|
@ -73,6 +73,8 @@ import org.mariotaku.twidere.util.net.TwidereHostAddressResolver;
|
|||
|
||||
import java.io.File;
|
||||
|
||||
import edu.tsinghua.hotmobi.HotMobiLogger;
|
||||
|
||||
import static org.mariotaku.twidere.util.Utils.getBestCacheDir;
|
||||
import static org.mariotaku.twidere.util.Utils.getInternalCacheDir;
|
||||
import static org.mariotaku.twidere.util.Utils.initAccountColor;
|
||||
|
@ -110,6 +112,7 @@ public class TwidereApplication extends MultiDexApplication implements Constants
|
|||
private UserColorNameManager mUserColorNameManager;
|
||||
|
||||
private String mDefaultUserAgent;
|
||||
private HotMobiLogger mHotMobiLogger;
|
||||
|
||||
@NonNull
|
||||
public static TwidereApplication getInstance(@NonNull final Context context) {
|
||||
|
@ -350,4 +353,9 @@ public class TwidereApplication extends MultiDexApplication implements Constants
|
|||
}
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public HotMobiLogger getHotMobiLogger() {
|
||||
if (mHotMobiLogger != null) return mHotMobiLogger;
|
||||
return mHotMobiLogger = new HotMobiLogger();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -122,8 +122,9 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import edu.tsinghua.spice.Utilies.SpiceProfilingUtil;
|
||||
import edu.tsinghua.spice.Utilies.TypeMappingUtil;
|
||||
import edu.tsinghua.hotmobi.HotMobiLogger;
|
||||
import edu.tsinghua.hotmobi.model.MediaEvent;
|
||||
import edu.tsinghua.hotmobi.model.TweetEvent;
|
||||
|
||||
/**
|
||||
* Created by mariotaku on 14/12/5.
|
||||
|
@ -156,6 +157,7 @@ public class StatusFragment extends BaseSupportFragment implements LoaderCallbac
|
|||
// Data fields
|
||||
private boolean mRepliesLoaderInitialized;
|
||||
private ParcelableStatus mSelectedStatus;
|
||||
private TweetEvent mStatusEvent;
|
||||
|
||||
// Listeners
|
||||
private LoaderCallbacks<List<ParcelableStatus>> mRepliesLoaderCallback = new LoaderCallbacks<List<ParcelableStatus>>() {
|
||||
|
@ -291,14 +293,10 @@ public class StatusFragment extends BaseSupportFragment implements LoaderCallbac
|
|||
if (status == null) return;
|
||||
final Bundle options = Utils.createMediaViewerActivityOption(view);
|
||||
Utils.openMedia(getActivity(), status, media, options);
|
||||
SpiceProfilingUtil.log(
|
||||
status.id + ",Clicked," + status.account_id + "," + status.user_id + "," + status.text_plain.length()
|
||||
+ "," + media.preview_url + "," + media.media_url + "," + TypeMappingUtil.getMediaType(media.type)
|
||||
+ "," + mStatusAdapter.isMediaPreviewEnabled() + "," + status.timestamp);
|
||||
SpiceProfilingUtil.profile(getActivity(), status.account_id,
|
||||
status.id + ",Clicked," + status.account_id + "," + status.user_id + "," + status.text_plain.length()
|
||||
+ "," + media.preview_url + "," + media.media_url + "," + TypeMappingUtil.getMediaType(media.type)
|
||||
+ "," + mStatusAdapter.isMediaPreviewEnabled() + "," + status.timestamp);
|
||||
|
||||
MediaEvent event = MediaEvent.create(getActivity(), status, media, 0,
|
||||
mStatusAdapter.isMediaPreviewEnabled());
|
||||
HotMobiLogger.getInstance(getActivity()).log(event);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -375,16 +373,11 @@ public class StatusFragment extends BaseSupportFragment implements LoaderCallbac
|
|||
if (status == null) return;
|
||||
final Bundle options = Utils.createMediaViewerActivityOption(view);
|
||||
Utils.openMediaDirectly(getActivity(), accountId, status, media, status.media, options);
|
||||
//spice
|
||||
SpiceProfilingUtil.log(
|
||||
status.id + ",Clicked," + status.account_id + "," + status.user_id + "," + status.text_plain.length()
|
||||
+ "," + media.preview_url + "," + media.media_url + "," + TypeMappingUtil.getMediaType(media.type)
|
||||
+ "," + mStatusAdapter.isMediaPreviewEnabled() + "," + status.timestamp);
|
||||
SpiceProfilingUtil.profile(getActivity(), status.account_id,
|
||||
status.id + ",Clicked," + status.account_id + "," + status.user_id + "," + status.text_plain.length()
|
||||
+ "," + media.preview_url + "," + media.media_url + "," + TypeMappingUtil.getMediaType(media.type)
|
||||
+ "," + mStatusAdapter.isMediaPreviewEnabled() + "," + status.timestamp);
|
||||
//end
|
||||
// BEGIN HotMobi
|
||||
MediaEvent event = MediaEvent.create(getActivity(), status, media, 0,
|
||||
mStatusAdapter.isMediaPreviewEnabled());
|
||||
HotMobiLogger.getInstance(getActivity()).log(event);
|
||||
// END HotMobi
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -479,45 +472,6 @@ public class StatusFragment extends BaseSupportFragment implements LoaderCallbac
|
|||
}
|
||||
getLoaderManager().initLoader(LOADER_ID_STATUS_REPLIES, args, mRepliesLoaderCallback);
|
||||
mRepliesLoaderInitialized = true;
|
||||
//spice
|
||||
if (status.media == null) {
|
||||
SpiceProfilingUtil.profile(getActivity(), status.account_id,
|
||||
status.id + ",Words," + status.account_id + "," + status.user_id + "," + status.reply_count
|
||||
+ "," + status.retweet_count + "," + status.favorite_count
|
||||
+ "," + status.text_plain.length() + "," + status.timestamp);
|
||||
SpiceProfilingUtil.log(status.id + ",Words," + status.account_id + "," + status.user_id
|
||||
+ "," + status.reply_count + "," + status.retweet_count + "," + status.favorite_count
|
||||
+ "," + status.text_plain.length() + "," + status.timestamp);
|
||||
} else {
|
||||
for (final ParcelableMedia media : status.media) {
|
||||
if (media.type == ParcelableMedia.TYPE_IMAGE) {
|
||||
SpiceProfilingUtil.profile(getActivity(), status.account_id,
|
||||
status.id + ",PreviewM," + status.account_id + "," + status.user_id
|
||||
+ "," + status.reply_count + "," + status.retweet_count + "," + status.favorite_count
|
||||
+ "," + status.text_plain.length() + "," + TypeMappingUtil.getMediaType(media.type)
|
||||
+ "," + media.media_url + "," + media.width + "x" + media.height
|
||||
+ "," + status.timestamp);
|
||||
SpiceProfilingUtil.log(
|
||||
status.id + ",PreviewM," + status.account_id + "," + status.user_id
|
||||
+ "," + status.reply_count + "," + status.retweet_count + "," + status.favorite_count
|
||||
+ "," + status.text_plain.length() + "," + TypeMappingUtil.getMediaType(media.type)
|
||||
+ "," + media.media_url + "," + media.width + "x" + media.height
|
||||
+ "," + status.timestamp);
|
||||
} else {
|
||||
SpiceProfilingUtil.profile(getActivity(), status.account_id,
|
||||
status.id + ",PreviewO," + status.account_id + "," + status.user_id
|
||||
+ "," + status.reply_count + "," + status.retweet_count + "," + status.favorite_count
|
||||
+ "," + status.text_plain.length() + "," + TypeMappingUtil.getMediaType(media.type)
|
||||
+ "," + media.preview_url + "," + media.media_url + "," + status.timestamp);
|
||||
SpiceProfilingUtil.log(
|
||||
status.id + ",PreviewO," + status.account_id + "," + status.user_id
|
||||
+ "," + status.reply_count + "," + status.retweet_count + "," + status.favorite_count
|
||||
+ "," + status.text_plain.length() + "," + TypeMappingUtil.getMediaType(media.type)
|
||||
+ "," + media.preview_url + "," + media.media_url + "," + status.timestamp);
|
||||
}
|
||||
}
|
||||
}
|
||||
//end
|
||||
}
|
||||
|
||||
private void restoreReadPosition(@Nullable Pair<Long, Integer> position) {
|
||||
|
@ -559,6 +513,9 @@ public class StatusFragment extends BaseSupportFragment implements LoaderCallbac
|
|||
mStatusAdapter.setReplies(null);
|
||||
loadReplies(status);
|
||||
loadConversation(status);
|
||||
final TweetEvent event = TweetEvent.create(getActivity(), status, 0);
|
||||
event.setAction(TweetEvent.Action.OPEN);
|
||||
mStatusEvent = event;
|
||||
} else {
|
||||
final int position = mStatusAdapter.findPositionById(itemId);
|
||||
mLayoutManager.scrollToPositionWithOffset(position, top);
|
||||
|
@ -1601,7 +1558,10 @@ public class StatusFragment extends BaseSupportFragment implements LoaderCallbac
|
|||
|
||||
@Override
|
||||
public void onLoaderReset(final Loader<SingleResponse<ParcelableStatus>> loader) {
|
||||
|
||||
final TweetEvent event = mStatusEvent;
|
||||
if (event == null) return;
|
||||
event.markEnd();
|
||||
HotMobiLogger.getInstance(getActivity()).log(event);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -65,7 +65,6 @@ import org.mariotaku.twidere.constant.SharedPreferenceConstants;
|
|||
import org.mariotaku.twidere.model.ListResponse;
|
||||
import org.mariotaku.twidere.model.ParcelableAccount;
|
||||
import org.mariotaku.twidere.model.ParcelableLocation;
|
||||
import org.mariotaku.twidere.model.ParcelableMedia;
|
||||
import org.mariotaku.twidere.model.ParcelableMediaUpdate;
|
||||
import org.mariotaku.twidere.model.ParcelableStatus;
|
||||
import org.mariotaku.twidere.model.ParcelableStatusUpdate;
|
||||
|
@ -106,8 +105,9 @@ import java.util.Locale;
|
|||
import java.util.Set;
|
||||
import java.util.concurrent.CopyOnWriteArraySet;
|
||||
|
||||
import edu.tsinghua.spice.Utilies.SpiceProfilingUtil;
|
||||
import edu.tsinghua.spice.Utilies.TypeMappingUtil;
|
||||
import edu.tsinghua.hotmobi.HotMobiLogger;
|
||||
import edu.tsinghua.hotmobi.model.RefreshEvent;
|
||||
import edu.tsinghua.hotmobi.model.TweetEvent;
|
||||
|
||||
public class AsyncTwitterWrapper extends TwitterWrapper {
|
||||
|
||||
|
@ -918,17 +918,13 @@ public class AsyncTwitterWrapper extends TwitterWrapper {
|
|||
if (result.hasData()) {
|
||||
final ParcelableStatus status = result.getData();
|
||||
|
||||
//spice
|
||||
final Context context = getContext();
|
||||
SpiceProfilingUtil.profile(context,
|
||||
status.account_id, status.id + ",Favor,"
|
||||
+ status.account_id + "," + status.user_id + "," + status.reply_count
|
||||
+ "," + status.retweet_count + "," + status.favorite_count
|
||||
+ "," + status.timestamp);
|
||||
SpiceProfilingUtil.log(status.id + ",Favor,"
|
||||
+ status.account_id + "," + status.user_id + "," + status.reply_count
|
||||
+ "," + status.retweet_count + "," + status.favorite_count + "," + status.timestamp);
|
||||
//end
|
||||
// BEGIN HotMobi
|
||||
|
||||
final TweetEvent event = TweetEvent.create(getContext(), status, 0);
|
||||
event.setAction(TweetEvent.Action.FAVORITE);
|
||||
HotMobiLogger.getInstance(getContext()).log(event);
|
||||
|
||||
// END HotMobi
|
||||
|
||||
final Bus bus = TwidereApplication.getInstance(mContext).getMessageBus();
|
||||
assert bus != null;
|
||||
|
@ -1558,18 +1554,13 @@ public class AsyncTwitterWrapper extends TwitterWrapper {
|
|||
mDestroyingFavoriteIds.remove(account_id, status_id);
|
||||
if (result.hasData()) {
|
||||
final ParcelableStatus status = result.getData();
|
||||
//spice
|
||||
final Context context = getContext();
|
||||
SpiceProfilingUtil.profile(context,
|
||||
status.account_id, status.id + ",Unfavor," + status.account_id
|
||||
+ "," + status.user_id + "," + status.reply_count
|
||||
+ "," + status.retweet_count + "," + status.favorite_count
|
||||
+ "," + status.timestamp);
|
||||
SpiceProfilingUtil.log(status.id + ",Unfavor," + status.account_id
|
||||
+ "," + status.user_id + "," + status.reply_count
|
||||
+ "," + status.retweet_count + "," + status.favorite_count
|
||||
+ "," + status.timestamp);
|
||||
//end
|
||||
// BEGIN HotMobi
|
||||
|
||||
final TweetEvent event = TweetEvent.create(getContext(), status, 0);
|
||||
event.setAction(TweetEvent.Action.UNFAVORITE);
|
||||
HotMobiLogger.getInstance(getContext()).log(event);
|
||||
|
||||
// END HotMobi
|
||||
|
||||
final Bus bus = TwidereApplication.getInstance(mContext).getMessageBus();
|
||||
assert bus != null;
|
||||
|
@ -2209,9 +2200,11 @@ public class AsyncTwitterWrapper extends TwitterWrapper {
|
|||
rowsDeleted = 0;
|
||||
}
|
||||
countCur.close();
|
||||
//spice
|
||||
SpiceProfilingUtil.profile(mContext, accountId, accountId + ",Refresh," + TwidereArrayUtils.toString(statusIds, ',', true));
|
||||
//end
|
||||
|
||||
// BEGIN HotMobi
|
||||
final RefreshEvent event = RefreshEvent.create(mContext, statusIds, 0);
|
||||
HotMobiLogger.getInstance(mContext).log(event);
|
||||
// END HotMobi
|
||||
|
||||
// Insert a gap.
|
||||
final boolean deletedOldGap = rowsDeleted > 0 && ArrayUtils.contains(statusIds, maxId);
|
||||
|
@ -2569,6 +2562,7 @@ public class AsyncTwitterWrapper extends TwitterWrapper {
|
|||
}
|
||||
Utils.showInfoMessage(mContext, R.string.reported_user_for_spam, false);
|
||||
final Bus bus = TwidereApplication.getInstance(mContext).getMessageBus();
|
||||
assert bus != null;
|
||||
bus.post(new FriendshipUserUpdatedEvent(result.getData()));
|
||||
} else {
|
||||
Utils.showErrorMessage(mContext, R.string.action_reporting_for_spam, result.getException(), true);
|
||||
|
@ -2629,32 +2623,15 @@ public class AsyncTwitterWrapper extends TwitterWrapper {
|
|||
for (final Uri uri : TwidereDataStore.STATUSES_URIS) {
|
||||
mResolver.update(uri, values, where.getSQL(), null);
|
||||
}
|
||||
//spice
|
||||
if (status.media == null) {
|
||||
SpiceProfilingUtil.log(status.id + ",Retweet," + account_id + ","
|
||||
+ status.user_id + "," + status.reply_count + "," + status.retweet_count + "," + status.favorite_count);
|
||||
SpiceProfilingUtil.profile(getContext(), account_id, status.id + ",Retweet," + account_id + ","
|
||||
+ status.user_id + "," + status.reply_count + "," + status.retweet_count + "," + status.favorite_count);
|
||||
} else {
|
||||
for (final ParcelableMedia spiceMedia : status.media) {
|
||||
if (spiceMedia.type == ParcelableMedia.TYPE_IMAGE) {
|
||||
SpiceProfilingUtil.log(status.id + ",RetweetM," + account_id + ","
|
||||
+ status.user_id + "," + status.reply_count + "," + status.retweet_count + "," + status.favorite_count
|
||||
+ "," + spiceMedia.media_url + "," + TypeMappingUtil.getMediaType(spiceMedia.type) + "," + spiceMedia.width + "x" + spiceMedia.height);
|
||||
SpiceProfilingUtil.profile(getContext(), account_id, status.id + ",RetweetM," + account_id + ","
|
||||
+ status.user_id + "," + status.reply_count + "," + status.retweet_count + "," + status.favorite_count
|
||||
+ "," + spiceMedia.preview_url + "," + spiceMedia.media_url + "," + TypeMappingUtil.getMediaType(spiceMedia.type) + "," + spiceMedia.width + "x" + spiceMedia.height);
|
||||
} else {
|
||||
SpiceProfilingUtil.log(status.id + ",RetweetO," + account_id + ","
|
||||
+ status.user_id + "," + status.reply_count + "," + status.retweet_count + "," + status.favorite_count
|
||||
+ "," + spiceMedia.media_url + "," + TypeMappingUtil.getMediaType(spiceMedia.type));
|
||||
SpiceProfilingUtil.profile(getContext(), account_id, status.id + ",RetweetO," + account_id + ","
|
||||
+ status.user_id + "," + status.reply_count + "," + status.retweet_count + "," + status.favorite_count
|
||||
+ "," + spiceMedia.preview_url + "," + spiceMedia.media_url + "," + TypeMappingUtil.getMediaType(spiceMedia.type));
|
||||
}
|
||||
}
|
||||
}
|
||||
//end
|
||||
|
||||
// BEGIN HotMobi
|
||||
|
||||
final TweetEvent event = TweetEvent.create(getContext(), status, 0);
|
||||
event.setAction(TweetEvent.Action.RETWEET);
|
||||
HotMobiLogger.getInstance(getContext()).log(event);
|
||||
|
||||
// END HotMobi
|
||||
|
||||
final Bus bus = TwidereApplication.getInstance(mContext).getMessageBus();
|
||||
assert bus != null;
|
||||
bus.post(new StatusRetweetedEvent(status));
|
||||
|
|
|
@ -84,14 +84,12 @@ import android.support.v7.app.AppCompatActivity;
|
|||
import android.support.v7.widget.ShareActionProvider;
|
||||
import android.text.Editable;
|
||||
import android.text.SpannableStringBuilder;
|
||||
import android.text.Spanned;
|
||||
import android.text.TextUtils;
|
||||
import android.text.format.DateFormat;
|
||||
import android.text.format.DateUtils;
|
||||
import android.text.format.Time;
|
||||
import android.text.style.CharacterStyle;
|
||||
import android.text.style.StyleSpan;
|
||||
import android.text.style.URLSpan;
|
||||
import android.transition.Transition;
|
||||
import android.transition.TransitionInflater;
|
||||
import android.util.Log;
|
||||
|
@ -147,6 +145,7 @@ import org.mariotaku.twidere.api.twitter.Twitter;
|
|||
import org.mariotaku.twidere.api.twitter.TwitterException;
|
||||
import org.mariotaku.twidere.api.twitter.auth.OAuthSupport;
|
||||
import org.mariotaku.twidere.api.twitter.model.DirectMessage;
|
||||
import org.mariotaku.twidere.api.twitter.model.GeoLocation;
|
||||
import org.mariotaku.twidere.api.twitter.model.RateLimitStatus;
|
||||
import org.mariotaku.twidere.api.twitter.model.Relationship;
|
||||
import org.mariotaku.twidere.api.twitter.model.Status;
|
||||
|
@ -227,7 +226,6 @@ import org.mariotaku.twidere.provider.TwidereDataStore.Statuses;
|
|||
import org.mariotaku.twidere.provider.TwidereDataStore.Tabs;
|
||||
import org.mariotaku.twidere.provider.TwidereDataStore.UnreadCounts;
|
||||
import org.mariotaku.twidere.service.RefreshService;
|
||||
import org.mariotaku.twidere.text.OriginalStatusSpan;
|
||||
import org.mariotaku.twidere.util.TwidereLinkify.HighlightStyle;
|
||||
import org.mariotaku.twidere.util.content.ContentResolverUtils;
|
||||
import org.mariotaku.twidere.util.menu.TwidereMenuInfo;
|
||||
|
@ -3974,6 +3972,12 @@ public final class Utils implements Constants {
|
|||
}
|
||||
}
|
||||
|
||||
public static GeoLocation getCachedGeoLocation(Context context) {
|
||||
final Location location = getCachedLocation(context);
|
||||
if (location == null) return null;
|
||||
return new GeoLocation(location.getLatitude(), location.getLongitude());
|
||||
}
|
||||
|
||||
public static Location getCachedLocation(Context context) {
|
||||
Location location = null;
|
||||
try {
|
||||
|
|
Loading…
Reference in New Issue