mirror of
https://github.com/nuclearfog/Shitter.git
synced 2025-01-31 03:17:19 +01:00
removed swipe delay, added swipe coloring, database fix
This commit is contained in:
parent
a9401fe37f
commit
3131fe5e4e
@ -726,7 +726,7 @@ public class AppDatabase {
|
|||||||
userColumn.put(UserTable.TWEETS, user.getTweetCount());
|
userColumn.put(UserTable.TWEETS, user.getTweetCount());
|
||||||
userColumn.put(UserTable.FAVORS, user.getFavoriteCount());
|
userColumn.put(UserTable.FAVORS, user.getFavoriteCount());
|
||||||
|
|
||||||
db.insertWithOnConflict(UserTable.NAME, null, userColumn, mode);
|
db.insertWithOnConflict(UserTable.NAME, "", userColumn, mode);
|
||||||
setUserRegister(db, user.getId(), register);
|
setUserRegister(db, user.getId(), register);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -786,7 +786,7 @@ public class AppDatabase {
|
|||||||
status.put(TweetTable.REPLYUSER, tweet.getReplyUserId());
|
status.put(TweetTable.REPLYUSER, tweet.getReplyUserId());
|
||||||
status.put(TweetTable.REPLYNAME, tweet.getReplyName());
|
status.put(TweetTable.REPLYNAME, tweet.getReplyName());
|
||||||
|
|
||||||
db.insertWithOnConflict(TweetTable.NAME, null, status, CONFLICT_REPLACE);
|
db.insertWithOnConflict(TweetTable.NAME, "", status, CONFLICT_REPLACE);
|
||||||
|
|
||||||
storeUser(user, db, CONFLICT_IGNORE);
|
storeUser(user, db, CONFLICT_IGNORE);
|
||||||
setTweetRegister(db, tweet, statusRegister);
|
setTweetRegister(db, tweet, statusRegister);
|
||||||
@ -847,7 +847,7 @@ public class AppDatabase {
|
|||||||
ContentValues favTable = new ContentValues(2);
|
ContentValues favTable = new ContentValues(2);
|
||||||
favTable.put(FavoriteTable.TWEETID, tweetId);
|
favTable.put(FavoriteTable.TWEETID, tweetId);
|
||||||
favTable.put(FavoriteTable.FAVORITEDBY, ownerId);
|
favTable.put(FavoriteTable.FAVORITEDBY, ownerId);
|
||||||
db.insertWithOnConflict(FavoriteTable.NAME, null, favTable, CONFLICT_REPLACE);
|
db.insertWithOnConflict(FavoriteTable.NAME, "", favTable, CONFLICT_REPLACE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -877,7 +877,7 @@ public class AppDatabase {
|
|||||||
messageColumn.put(MessageTable.MESSAGE, message.getText());
|
messageColumn.put(MessageTable.MESSAGE, message.getText());
|
||||||
if (message.getMedia() != null)
|
if (message.getMedia() != null)
|
||||||
messageColumn.put(MessageTable.MEDIA, message.getMedia().toString());
|
messageColumn.put(MessageTable.MEDIA, message.getMedia().toString());
|
||||||
db.insertWithOnConflict(MessageTable.NAME, null, messageColumn, CONFLICT_IGNORE);
|
db.insertWithOnConflict(MessageTable.NAME, "", messageColumn, CONFLICT_IGNORE);
|
||||||
// store user information
|
// store user information
|
||||||
storeUser(message.getSender(), db, CONFLICT_IGNORE);
|
storeUser(message.getSender(), db, CONFLICT_IGNORE);
|
||||||
storeUser(message.getReceiver(), db, CONFLICT_IGNORE);
|
storeUser(message.getReceiver(), db, CONFLICT_IGNORE);
|
||||||
|
@ -25,17 +25,10 @@ import org.nuclearfog.twidda.database.GlobalSettings;
|
|||||||
*/
|
*/
|
||||||
public abstract class ListFragment extends Fragment implements OnRefreshListener {
|
public abstract class ListFragment extends Fragment implements OnRefreshListener {
|
||||||
|
|
||||||
/**
|
|
||||||
* delay to enable swipe view in milliseconds
|
|
||||||
*/
|
|
||||||
private static final int REFRESH_DELAY = 500;
|
|
||||||
|
|
||||||
private RecyclerView list;
|
private RecyclerView list;
|
||||||
private SwipeRefreshLayout reload;
|
private SwipeRefreshLayout reload;
|
||||||
protected GlobalSettings settings;
|
protected GlobalSettings settings;
|
||||||
|
|
||||||
private boolean refreshLock = false;
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup parent, @Nullable Bundle b) {
|
public final View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup parent, @Nullable Bundle b) {
|
||||||
@ -45,6 +38,7 @@ public abstract class ListFragment extends Fragment implements OnRefreshListener
|
|||||||
list.setLayoutManager(new LinearLayoutManager(requireContext()));
|
list.setLayoutManager(new LinearLayoutManager(requireContext()));
|
||||||
reload = new SwipeRefreshLayout(requireContext());
|
reload = new SwipeRefreshLayout(requireContext());
|
||||||
reload.setProgressBackgroundColorSchemeColor(settings.getHighlightColor());
|
reload.setProgressBackgroundColorSchemeColor(settings.getHighlightColor());
|
||||||
|
reload.setColorSchemeColors(settings.getIconColor());
|
||||||
reload.setOnRefreshListener(this);
|
reload.setOnRefreshListener(this);
|
||||||
reload.addView(list);
|
reload.addView(list);
|
||||||
return reload;
|
return reload;
|
||||||
@ -53,7 +47,6 @@ public abstract class ListFragment extends Fragment implements OnRefreshListener
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final void onRefresh() {
|
public final void onRefresh() {
|
||||||
refreshLock = true;
|
|
||||||
onReload();
|
onReload();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,19 +56,7 @@ public abstract class ListFragment extends Fragment implements OnRefreshListener
|
|||||||
* @param enable true to enable swipe view delayed, false to stop immediately
|
* @param enable true to enable swipe view delayed, false to stop immediately
|
||||||
*/
|
*/
|
||||||
protected void setRefresh(boolean enable) {
|
protected void setRefresh(boolean enable) {
|
||||||
refreshLock = !enable;
|
reload.setRefreshing(enable);
|
||||||
if (enable) {
|
|
||||||
reload.postDelayed(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
if (!reload.isRefreshing() && !refreshLock) {
|
|
||||||
reload.setRefreshing(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, REFRESH_DELAY);
|
|
||||||
} else {
|
|
||||||
reload.setRefreshing(false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user