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 - $HOME/.local/opt
before_install: before_install:
- ./travis/scripts/extract_signing_config.sh - ./travis/scripts/extract_private_build_config.sh
- ./travis/scripts/install_android_ndk.sh - ./travis/scripts/install_android_ndk.sh
- export PATH=$HOME/.local/bin:$PATH - export PATH=$HOME/.local/bin:$PATH
- pip install -r ./travis/configs/requirements.txt --user - 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 import java.text.SimpleDateFormat
apply plugin: 'com.android.application' apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'com.neenbedankt.android-apt' apply plugin: 'com.neenbedankt.android-apt'
apply plugin: 'androidsvgdrawable' apply plugin: 'androidsvgdrawable'
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.21.2'
}
}
android { android {
defaultConfig { defaultConfig {
@ -28,10 +39,8 @@ android {
targetCompatibility JavaVersion.VERSION_1_7 targetCompatibility JavaVersion.VERSION_1_7
} }
productFlavors { productFlavors {
google { google {}
} fdroid {}
fdroid {
}
} }
buildTypes { buildTypes {
debug { debug {
@ -109,9 +118,7 @@ dependencies {
compile 'com.j256.simplemagic:simplemagic:1.6' compile 'com.j256.simplemagic:simplemagic:1.6'
googleCompile 'com.google.android.gms:play-services-maps:8.4.0' googleCompile 'com.google.android.gms:play-services-maps:8.4.0'
googleCompile 'com.google.maps.android:android-maps-utils:0.4' googleCompile 'com.google.maps.android:android-maps-utils:0.4'
googleCompile('com.crashlytics.sdk.android:crashlytics:2.5.5@aar') { googleCompile('com.crashlytics.sdk.android:crashlytics:2.5.5@aar') { transitive = true }
transitive = true;
}
googleCompile ':YouTubeAndroidPlayerApi:1.2.2@jar' googleCompile ':YouTubeAndroidPlayerApi:1.2.2@jar'
fdroidCompile 'org.osmdroid:osmdroid-android:5.0.1' fdroidCompile 'org.osmdroid:osmdroid-android:5.0.1'
debugCompile 'com.facebook.stetho:stetho:1.2.0' 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()) { mContentObserver = new ContentObserver(new Handler()) {
@Override @Override
public void onChange(boolean selfChange) { public void onChange(boolean selfChange) {
reloadStatuses(); reloadActivities();
} }
}; };
cr.registerContentObserver(Accounts.CONTENT_URI, true, mContentObserver); cr.registerContentObserver(Accounts.CONTENT_URI, true, mContentObserver);
cr.registerContentObserver(Filters.CONTENT_URI, true, mContentObserver); cr.registerContentObserver(Filters.CONTENT_URI, true, mContentObserver);
updateRefreshState(); updateRefreshState();
reloadStatuses(); reloadActivities();
} }
protected void reloadStatuses() { protected void reloadActivities() {
if (getActivity() == null || isDetached()) return; if (getActivity() == null || isDetached()) return;
final Bundle args = new Bundle(), fragmentArgs = getArguments(); final Bundle args = new Bundle(), fragmentArgs = getArguments();
if (fragmentArgs != null) { if (fragmentArgs != null) {

View File

@ -25,6 +25,7 @@ import android.content.Intent;
import android.content.IntentFilter; import android.content.IntentFilter;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.NonNull;
import org.mariotaku.twidere.api.twitter.Twitter; import org.mariotaku.twidere.api.twitter.Twitter;
import org.mariotaku.twidere.api.twitter.TwitterException; import org.mariotaku.twidere.api.twitter.TwitterException;
@ -121,9 +122,10 @@ public class UserListMembersFragment extends CursorSupportUsersListFragment {
} }
@Override @Override
@NonNull
protected SingleResponse<ParcelableUserList> doInBackground(final Object... params) { protected SingleResponse<ParcelableUserList> doInBackground(final Object... params) {
final Twitter twitter = TwitterAPIFactory.getTwitterInstance(getActivity(), accountId, true); final Twitter twitter = TwitterAPIFactory.getTwitterInstance(getActivity(), accountId, true);
if (twitter == null) return null; if (twitter == null) return SingleResponse.getInstance();
try { try {
final UserList list; final UserList list;
if (listId > 0) { if (listId > 0) {
@ -133,7 +135,7 @@ public class UserListMembersFragment extends CursorSupportUsersListFragment {
} else if (screenName != null) { } else if (screenName != null) {
list = twitter.showUserList(listName, screenName); list = twitter.showUserList(listName, screenName);
} else } 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)); return SingleResponse.getInstance(new ParcelableUserList(list, accountId));
} catch (final TwitterException e) { } catch (final TwitterException e) {
return SingleResponse.getInstance(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, 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) { if (statuses == null || statuses.isEmpty() || accountId <= 0) {
return; return;
} }
@ -85,10 +85,14 @@ public abstract class GetStatusesTask extends ManagedAsyncTask<Object, TwitterWr
final long[] statusIds = new long[statuses.size()]; final long[] statusIds = new long[statuses.size()];
long minId = -1; long minId = -1;
int minIdx = -1; int minIdx = -1;
boolean hasIntersection = false;
for (int i = 0, j = statuses.size(); i < j; i++) { for (int i = 0, j = statuses.size(); i < j; i++) {
final org.mariotaku.twidere.api.twitter.model.Status status = statuses.get(i); final org.mariotaku.twidere.api.twitter.model.Status status = statuses.get(i);
values[i] = ContentValuesCreator.createStatus(status, accountId); values[i] = ContentValuesCreator.createStatus(status, accountId);
final long id = status.getId(); final long id = status.getId();
if (sinceId > 0 && id <= sinceId) {
hasIntersection = true;
}
if (minId == -1 || id < minId) { if (minId == -1 || id < minId) {
minId = id; minId = id;
minIdx = i; 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 deletedOldGap = rowsDeleted > 0 && ArrayUtils.contains(statusIds, maxId);
final boolean noRowsDeleted = rowsDeleted == 0; final boolean noRowsDeleted = rowsDeleted == 0;
final boolean insertGap = minId > 0 && (noRowsDeleted || deletedOldGap) && !noItemsBefore final boolean insertGap = minId > 0 && (noRowsDeleted || deletedOldGap) && !noItemsBefore
&& statuses.size() >= loadItemLimit; && !hasIntersection;
if (insertGap && minIdx != -1) { if (insertGap && minIdx != -1) {
values[minIdx].put(TwidereDataStore.Statuses.IS_GAP, true); 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) { if (sinceIds != null && sinceIds[idx] > 0) {
sinceId = sinceIds[idx]; sinceId = sinceIds[idx];
paging.sinceId(sinceId); paging.sinceId(sinceId - 1);
if (maxIds == null || sinceIds[idx] <= 0) { if (maxIds == null || sinceIds[idx] <= 0) {
paging.setLatestResults(true); 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); final List<org.mariotaku.twidere.api.twitter.model.Status> statuses = getStatuses(twitter, paging);
TwitterContentUtils.getStatusesWithQuoteData(twitter, statuses); TwitterContentUtils.getStatusesWithQuoteData(twitter, statuses);
storeStatus(accountId, statuses, maxId, true, loadItemLimit); storeStatus(accountId, statuses, sinceId, maxId, true, loadItemLimit);
publishProgress(new TwitterWrapper.StatusListResponse(accountId, statuses)); publishProgress(new TwitterWrapper.StatusListResponse(accountId, statuses));
} catch (final TwitterException e) { } catch (final TwitterException e) {
Log.w(LOGTAG, 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 <org.mariotaku.twidere.view.MainFrameLayout
android:id="@+id/home_content"
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/home_content"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
@ -28,9 +28,9 @@
android:id="@+id/main_pager" android:id="@+id/main_pager"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="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 <RelativeLayout
android:id="@+id/twidere_action_bar_with_overlay" android:id="@+id/twidere_action_bar_with_overlay"
@ -46,15 +46,15 @@
android:layout_alignParentTop="true" android:layout_alignParentTop="true"
android:layout="@layout/layout_actionbar_home" android:layout="@layout/layout_actionbar_home"
android:touchscreenBlocksFocus="true" android:touchscreenBlocksFocus="true"
tools:ignore="UnusedAttribute" /> tools:ignore="UnusedAttribute"/>
<View <View
android:id="@+id/window_overlay" android:id="@+id/window_overlay"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@+id/twidere_action_bar_container" android:layout_below="@+id/twidere_action_bar_container"
android:background="?android:windowContentOverlay" /> android:background="?android:windowContentOverlay"/>
</RelativeLayout> </RelativeLayout>
<include layout="@layout/layout_home_actions_button" /> <include layout="@layout/layout_home_actions_button"/>
</org.mariotaku.twidere.view.MainFrameLayout> </org.mariotaku.twidere.view.MainFrameLayout>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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