added account label for retweet quote dialog
This commit is contained in:
parent
6f3d7af4c0
commit
6358edefdb
|
@ -70,16 +70,20 @@ public class TwitterDateConverter extends StringBasedTypeConverter<Date> {
|
|||
if (date != null) return date;
|
||||
try {
|
||||
date = mDateFormat.parse(string);
|
||||
checkTime(string, date);
|
||||
} catch (ParseException e) {
|
||||
AbsLogger.error("Unrecognized date: " + string, e);
|
||||
return null;
|
||||
}
|
||||
return date;
|
||||
}
|
||||
|
||||
private void checkTime(String string, Date date) {
|
||||
final long currentTime = System.currentTimeMillis();
|
||||
if (date.getTime() - currentTime > ONE_MINUTE) {
|
||||
AbsLogger.error("Tweet date from future, raw string: " + string + ", date parsed: "
|
||||
+ date + ", current time is " + currentTime);
|
||||
}
|
||||
return date;
|
||||
}
|
||||
|
||||
private Date parseTwitterDate(String string) {
|
||||
|
@ -110,6 +114,7 @@ public class TwitterDateConverter extends StringBasedTypeConverter<Date> {
|
|||
AbsLogger.error("Week mismatch " + string + " => " + date);
|
||||
return null;
|
||||
}
|
||||
checkTime(string, date);
|
||||
return date;
|
||||
}
|
||||
|
||||
|
|
|
@ -101,7 +101,9 @@ public class RetweetQuoteDialogFragment extends BaseSupportDialogFragment implem
|
|||
mPreferences = SharedPreferencesWrapper.getInstance(context, SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE, SharedPreferenceConstants.class);
|
||||
final LayoutInflater inflater = LayoutInflater.from(context);
|
||||
@SuppressLint("InflateParams") final View view = inflater.inflate(R.layout.dialog_status_quote_retweet, null);
|
||||
final StatusViewHolder holder = new StatusViewHolder(new DummyStatusHolderAdapter(context), view.findViewById(R.id.item_content));
|
||||
final DummyStatusHolderAdapter adapter = new DummyStatusHolderAdapter(context);
|
||||
adapter.setShouldShowAccountsColor(true);
|
||||
final StatusViewHolder holder = new StatusViewHolder(adapter, view.findViewById(R.id.item_content));
|
||||
final ParcelableStatus status = getStatus();
|
||||
|
||||
assert status != null;
|
||||
|
@ -225,6 +227,30 @@ public class RetweetQuoteDialogFragment extends BaseSupportDialogFragment implem
|
|||
}
|
||||
}
|
||||
|
||||
private void retweetOrQuote(AsyncTwitterWrapper twitter, ParcelableStatus status) {
|
||||
if (mEditComment.length() > 0) {
|
||||
final Menu menu = mPopupMenu.getMenu();
|
||||
final MenuItem quoteOriginalStatus = menu.findItem(R.id.quote_original_status);
|
||||
final MenuItem linkToQuotedStatus = menu.findItem(R.id.link_to_quoted_status);
|
||||
final Uri statusLink;
|
||||
final long inReplyToStatusId;
|
||||
if (!status.is_quote || !quoteOriginalStatus.isChecked()) {
|
||||
inReplyToStatusId = status.id;
|
||||
statusLink = LinkCreator.getTwitterStatusLink(status.user_screen_name, status.id);
|
||||
} else {
|
||||
inReplyToStatusId = status.quoted_id;
|
||||
statusLink = LinkCreator.getTwitterStatusLink(status.quoted_user_screen_name, status.quoted_id);
|
||||
}
|
||||
final String commentText = mEditComment.getText() + " " + statusLink;
|
||||
twitter.updateStatusAsync(new long[]{status.account_id}, commentText, null, null,
|
||||
linkToQuotedStatus.isChecked() ? inReplyToStatusId : -1, status.is_possibly_sensitive);
|
||||
} else if (isMyRetweet(status)) {
|
||||
twitter.cancelRetweetAsync(status.account_id, status.id, status.my_retweet_id);
|
||||
} else {
|
||||
twitter.retweetStatusAsync(status.account_id, status.id);
|
||||
}
|
||||
}
|
||||
|
||||
public static RetweetQuoteDialogFragment show(final FragmentManager fm, final ParcelableStatus status) {
|
||||
final Bundle args = new Bundle();
|
||||
args.putParcelable(EXTRA_STATUS, status);
|
||||
|
|
|
@ -1,55 +0,0 @@
|
|||
/*
|
||||
* 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 org.mariotaku.twidere.view;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.v4.widget.DrawerLayout;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.MotionEvent;
|
||||
|
||||
/**
|
||||
* Created by mariotaku on 15/9/4.
|
||||
*/
|
||||
public class HomeViewPager extends ExtendedViewPager {
|
||||
|
||||
private DrawerLayout mDrawerLayout;
|
||||
|
||||
public HomeViewPager(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public HomeViewPager(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
public void setDrawerLayout(DrawerLayout drawerLayout) {
|
||||
mDrawerLayout = drawerLayout;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onInterceptTouchEvent(MotionEvent event) {
|
||||
return super.onInterceptTouchEvent(event);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean overScrollBy(int deltaX, int deltaY, int scrollX, int scrollY, int scrollRangeX, int scrollRangeY, int maxOverScrollX, int maxOverScrollY, boolean isTouchEvent) {
|
||||
return super.overScrollBy(deltaX, deltaY, scrollX, scrollY, scrollRangeX, scrollRangeY, maxOverScrollX, maxOverScrollY, isTouchEvent);
|
||||
}
|
||||
}
|
|
@ -464,6 +464,7 @@ public class StatusViewHolder extends ViewHolder implements Constants, OnClickLi
|
|||
private boolean sensitiveContentEnabled;
|
||||
private boolean hideCardActions;
|
||||
private boolean displayMediaPreview;
|
||||
private boolean shouldShowAccountsColor;
|
||||
|
||||
public DummyStatusHolderAdapter(Context context) {
|
||||
this.context = context;
|
||||
|
@ -477,6 +478,10 @@ public class StatusViewHolder extends ViewHolder implements Constants, OnClickLi
|
|||
updateOptions();
|
||||
}
|
||||
|
||||
public void setShouldShowAccountsColor(boolean shouldShowAccountsColor) {
|
||||
this.shouldShowAccountsColor = shouldShowAccountsColor;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public MediaLoaderWrapper getMediaLoader() {
|
||||
|
@ -602,7 +607,7 @@ public class StatusViewHolder extends ViewHolder implements Constants, OnClickLi
|
|||
|
||||
@Override
|
||||
public boolean shouldShowAccountsColor() {
|
||||
return false;
|
||||
return shouldShowAccountsColor;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -8,6 +8,17 @@
|
|||
android:key="category_content"
|
||||
android:title="@string/content">
|
||||
|
||||
<org.mariotaku.twidere.preference.AutoFixSwitchPreference
|
||||
android:defaultValue="true"
|
||||
android:key="name_first"
|
||||
android:title="@string/name_first"
|
||||
app:asb_summaryOff="@string/name_first_summary_off"
|
||||
app:asb_summaryOn="@string/name_first_summary_on">
|
||||
<extra
|
||||
android:name="notify_change"
|
||||
android:value="true" />
|
||||
</org.mariotaku.twidere.preference.AutoFixSwitchPreference>
|
||||
|
||||
<org.mariotaku.twidere.preference.SeekBarDialogPreference
|
||||
android:defaultValue="20"
|
||||
android:key="load_item_limit"
|
||||
|
|
|
@ -18,20 +18,8 @@
|
|||
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
|
||||
<PreferenceScreen
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<org.mariotaku.twidere.preference.AutoFixSwitchPreference
|
||||
android:defaultValue="true"
|
||||
android:key="name_first"
|
||||
android:title="@string/name_first"
|
||||
app:asb_summaryOff="@string/name_first_summary_off"
|
||||
app:asb_summaryOn="@string/name_first_summary_on">
|
||||
<extra
|
||||
android:name="notify_change"
|
||||
android:value="true"/>
|
||||
</org.mariotaku.twidere.preference.AutoFixSwitchPreference>
|
||||
<org.mariotaku.twidere.preference.SummaryListPreference
|
||||
android:defaultValue="@string/default_profile_image_style"
|
||||
android:entries="@array/entries_profile_image_style"
|
||||
|
@ -62,14 +50,6 @@
|
|||
android:name="notify_change"
|
||||
android:value="true"/>
|
||||
</org.mariotaku.twidere.preference.AutoFixSwitchPreference>
|
||||
<org.mariotaku.twidere.preference.AutoFixSwitchPreference
|
||||
android:defaultValue="true"
|
||||
android:key="card_animation"
|
||||
android:title="@string/card_animation">
|
||||
<extra
|
||||
android:name="notify_change"
|
||||
android:value="true"/>
|
||||
</org.mariotaku.twidere.preference.AutoFixSwitchPreference>
|
||||
<org.mariotaku.twidere.preference.AutoFixSwitchPreference
|
||||
android:defaultValue="true"
|
||||
android:key="unread_count"
|
||||
|
|
Loading…
Reference in New Issue