fixed status gap

This commit is contained in:
Mariotaku Lee 2016-01-07 12:17:03 +08:00
parent 6ff6f38941
commit 3401ce57ad
19 changed files with 63 additions and 41 deletions

View File

@ -42,7 +42,7 @@ cache:
- $HOME/.local/opt
before_install:
- ./travis/scripts/extract_signing_config.sh
- ./travis/scripts/extract_private_build_config.sh
- ./travis/scripts/install_android_ndk.sh
- export PATH=$HOME/.local/bin:$PATH
- pip install -r ./travis/configs/requirements.txt --user

View File

@ -0,0 +1,6 @@
#!/bin/bash
if [ -n ${PRIVATE_BUILD_CONFIG} ]; then
echo ${PRIVATE_BUILD_CONFIG} | base64 -d | tar zxf -
echo 'Extracted signing config'
fi

View File

@ -1,6 +0,0 @@
#!/bin/bash
if [ -n ${SIGNING_CONFIG} ]; then
echo ${SIGNING_CONFIG} | base64 -d | tar zxf -
echo 'Extracted signing config'
fi

View File

@ -3,9 +3,20 @@ import fr.avianey.androidsvgdrawable.gradle.SvgDrawableTask
import java.text.SimpleDateFormat
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'com.neenbedankt.android-apt'
apply plugin: 'androidsvgdrawable'
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.21.2'
}
}
android {
defaultConfig {
@ -28,10 +39,8 @@ android {
targetCompatibility JavaVersion.VERSION_1_7
}
productFlavors {
google {
}
fdroid {
}
google {}
fdroid {}
}
buildTypes {
debug {
@ -109,9 +118,7 @@ dependencies {
compile 'com.j256.simplemagic:simplemagic:1.6'
googleCompile 'com.google.android.gms:play-services-maps:8.4.0'
googleCompile 'com.google.maps.android:android-maps-utils:0.4'
googleCompile('com.crashlytics.sdk.android:crashlytics:2.5.5@aar') {
transitive = true;
}
googleCompile('com.crashlytics.sdk.android:crashlytics:2.5.5@aar') { transitive = true }
googleCompile ':YouTubeAndroidPlayerApi:1.2.2@jar'
fdroidCompile 'org.osmdroid:osmdroid-android:5.0.1'
debugCompile 'com.facebook.stetho:stetho:1.2.0'

View File

@ -132,16 +132,16 @@ public abstract class CursorActivitiesFragment extends AbsActivitiesFragment<Lis
mContentObserver = new ContentObserver(new Handler()) {
@Override
public void onChange(boolean selfChange) {
reloadStatuses();
reloadActivities();
}
};
cr.registerContentObserver(Accounts.CONTENT_URI, true, mContentObserver);
cr.registerContentObserver(Filters.CONTENT_URI, true, mContentObserver);
updateRefreshState();
reloadStatuses();
reloadActivities();
}
protected void reloadStatuses() {
protected void reloadActivities() {
if (getActivity() == null || isDetached()) return;
final Bundle args = new Bundle(), fragmentArgs = getArguments();
if (fragmentArgs != null) {

View File

@ -25,6 +25,7 @@ import android.content.Intent;
import android.content.IntentFilter;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.annotation.NonNull;
import org.mariotaku.twidere.api.twitter.Twitter;
import org.mariotaku.twidere.api.twitter.TwitterException;
@ -121,9 +122,10 @@ public class UserListMembersFragment extends CursorSupportUsersListFragment {
}
@Override
@NonNull
protected SingleResponse<ParcelableUserList> doInBackground(final Object... params) {
final Twitter twitter = TwitterAPIFactory.getTwitterInstance(getActivity(), accountId, true);
if (twitter == null) return null;
if (twitter == null) return SingleResponse.getInstance();
try {
final UserList list;
if (listId > 0) {
@ -133,7 +135,7 @@ public class UserListMembersFragment extends CursorSupportUsersListFragment {
} else if (screenName != null) {
list = twitter.showUserList(listName, screenName);
} else
return null;
throw new TwitterException("list_id or list_name and user_id (or screen_name) required");
return SingleResponse.getInstance(new ParcelableUserList(list, accountId));
} catch (final TwitterException e) {
return SingleResponse.getInstance(e);

View File

@ -73,7 +73,7 @@ public abstract class GetStatusesTask extends ManagedAsyncTask<Object, TwitterWr
}
private void storeStatus(long accountId, List<org.mariotaku.twidere.api.twitter.model.Status> statuses,
long maxId, boolean notify, int loadItemLimit) {
long sinceId, long maxId, boolean notify, int loadItemLimit) {
if (statuses == null || statuses.isEmpty() || accountId <= 0) {
return;
}
@ -85,10 +85,14 @@ public abstract class GetStatusesTask extends ManagedAsyncTask<Object, TwitterWr
final long[] statusIds = new long[statuses.size()];
long minId = -1;
int minIdx = -1;
boolean hasIntersection = false;
for (int i = 0, j = statuses.size(); i < j; i++) {
final org.mariotaku.twidere.api.twitter.model.Status status = statuses.get(i);
values[i] = ContentValuesCreator.createStatus(status, accountId);
final long id = status.getId();
if (sinceId > 0 && id <= sinceId) {
hasIntersection = true;
}
if (minId == -1 || id < minId) {
minId = id;
minIdx = i;
@ -122,7 +126,7 @@ public abstract class GetStatusesTask extends ManagedAsyncTask<Object, TwitterWr
final boolean deletedOldGap = rowsDeleted > 0 && ArrayUtils.contains(statusIds, maxId);
final boolean noRowsDeleted = rowsDeleted == 0;
final boolean insertGap = minId > 0 && (noRowsDeleted || deletedOldGap) && !noItemsBefore
&& statuses.size() >= loadItemLimit;
&& !hasIntersection;
if (insertGap && minIdx != -1) {
values[minIdx].put(TwidereDataStore.Statuses.IS_GAP, true);
}
@ -176,7 +180,7 @@ public abstract class GetStatusesTask extends ManagedAsyncTask<Object, TwitterWr
}
if (sinceIds != null && sinceIds[idx] > 0) {
sinceId = sinceIds[idx];
paging.sinceId(sinceId);
paging.sinceId(sinceId - 1);
if (maxIds == null || sinceIds[idx] <= 0) {
paging.setLatestResults(true);
}
@ -185,7 +189,7 @@ public abstract class GetStatusesTask extends ManagedAsyncTask<Object, TwitterWr
}
final List<org.mariotaku.twidere.api.twitter.model.Status> statuses = getStatuses(twitter, paging);
TwitterContentUtils.getStatusesWithQuoteData(twitter, statuses);
storeStatus(accountId, statuses, maxId, true, loadItemLimit);
storeStatus(accountId, statuses, sinceId, maxId, true, loadItemLimit);
publishProgress(new TwitterWrapper.StatusListResponse(accountId, statuses));
} catch (final TwitterException e) {
Log.w(LOGTAG, e);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 186 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 153 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 263 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 259 B

View File

@ -18,9 +18,9 @@
-->
<org.mariotaku.twidere.view.MainFrameLayout
android:id="@+id/home_content"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/home_content"
android:layout_width="match_parent"
android:layout_height="match_parent">
@ -28,9 +28,9 @@
android:id="@+id/main_pager"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:focusable="true" />
android:focusable="true"/>
<include layout="@layout/layout_empty_tab_hint" />
<include layout="@layout/layout_empty_tab_hint"/>
<RelativeLayout
android:id="@+id/twidere_action_bar_with_overlay"
@ -46,15 +46,15 @@
android:layout_alignParentTop="true"
android:layout="@layout/layout_actionbar_home"
android:touchscreenBlocksFocus="true"
tools:ignore="UnusedAttribute" />
tools:ignore="UnusedAttribute"/>
<View
android:id="@+id/window_overlay"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/twidere_action_bar_container"
android:background="?android:windowContentOverlay" />
android:background="?android:windowContentOverlay"/>
</RelativeLayout>
<include layout="@layout/layout_home_actions_button" />
<include layout="@layout/layout_home_actions_button"/>
</org.mariotaku.twidere.view.MainFrameLayout>

View File

@ -18,7 +18,6 @@
-->
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/fragment_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:animateLayoutChanges="true">

View File

@ -18,13 +18,12 @@
-->
<FrameLayout
android:id="@+id/fragment_content"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:animateLayoutChanges="true">
<include layout="@layout/layout_content_fragment_common" />
<include layout="@layout/layout_content_fragment_common"/>
<org.mariotaku.twidere.view.themed.AccentSwipeRefreshLayout
android:id="@+id/swipe_layout"
@ -38,7 +37,7 @@
android:layout_height="match_parent"
android:clipToPadding="false"
android:focusable="true"
android:scrollbars="vertical" />
android:scrollbars="vertical"/>
</org.mariotaku.twidere.view.themed.AccentSwipeRefreshLayout>
</FrameLayout>

View File

@ -18,7 +18,6 @@
-->
<FrameLayout
android:id="@+id/fragment_content"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"

View File

@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
tools:layout_height="?actionBarSize"
tools:layout_width="match_parent">
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
tools:layout_height="?actionBarSize"
tools:layout_width="match_parent">
<android.support.v7.widget.TwidereToolbar
android:id="@+id/action_bar"
@ -19,7 +19,7 @@
android:layout_height="match_parent"
app:tabDisplayOption="icon"
app:tabExpandEnabled="true"
app:tabHorizontalPadding="@dimen/element_spacing_normal" />
app:tabHorizontalPadding="@dimen/element_spacing_normal"/>
</android.support.v7.widget.TwidereToolbar>
</merge>

View File

@ -3,7 +3,7 @@
<item
android:id="@id/accept"
android:icon="@drawable/ic_action_ok"
android:icon="@drawable/ic_action_confirm"
android:title="@string/accept"/>
<item
android:id="@id/deny"

View File

@ -24,5 +24,5 @@
android:id="@id/save"
app:showAsAction="always"
android:title="@string/save"
android:icon="@drawable/ic_action_ok"/>
android:icon="@drawable/ic_action_confirm"/>
</menu>

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg width="32px" height="32px" viewBox="0 0 32 32" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns">
<!-- Generator: Sketch 3.4.4 (17249) - http://www.bohemiancoding.com/sketch -->
<title>Artboard</title>
<desc>Created with Sketch.</desc>
<defs></defs>
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" sketch:type="MSPage">
<g id="Artboard" sketch:type="MSArtboardGroup" fill="#FFFFFF">
<path d="M13,20.17 L8.83,16 L7.41,17.41 L13,23 L25,11 L23.59,9.59 L13,20.17 Z" id="Shape" sketch:type="MSShapeGroup"></path>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 763 B