1
0
mirror of https://github.com/TwidereProject/Twidere-Android synced 2024-12-24 23:43:10 +01:00

fixed quoted media view

This commit is contained in:
Mariotaku Lee 2015-09-04 11:45:37 +08:00
parent 8b9fba078f
commit 58be691df1
5 changed files with 29 additions and 41 deletions

View File

@ -116,8 +116,6 @@ import java.util.Map.Entry;
import edu.tsinghua.hotmobi.HotMobiLogger;
import edu.tsinghua.hotmobi.model.SessionEvent;
import edu.tsinghua.spice.Utilies.NetworkStateUtil;
import edu.tsinghua.spice.Utilies.SpiceProfilingUtil;
import static org.mariotaku.twidere.util.CompareUtils.classEquals;
import static org.mariotaku.twidere.util.Utils.cleanDatabasesByItemLimit;
@ -154,7 +152,6 @@ public class HomeActivity extends BaseAppCompatActivity implements OnClickListen
private View mEmptyTabHint;
private View mActionsButton;
private View mActionBarWithOverlay;
private FrameLayout mLeftDrawerContainer;
private TintedStatusFrameLayout mHomeContent;
private UpdateUnreadCountTask mUpdateUnreadCountTask;
@ -300,18 +297,6 @@ public class HomeActivity extends BaseAppCompatActivity implements OnClickListen
return handler.handleKey(this, null, keyCode, event);
}
@Override
public void setControlBarOffset(float offset) {
mActionBarWithOverlay.setTranslationY(mTabColumns > 1 ? 0 : getControlBarHeight() * (offset - 1));
final ViewGroup.LayoutParams lp = mActionsButton.getLayoutParams();
if (lp instanceof MarginLayoutParams) {
mActionsButton.setTranslationY((((MarginLayoutParams) lp).bottomMargin + mActionsButton.getHeight()) * (1 - offset));
} else {
mActionsButton.setTranslationY(mActionsButton.getHeight() * (1 - offset));
}
notifyControlBarOffsetChanged();
}
@Override
public boolean isKeyboardShortcutHandled(@NonNull KeyboardShortcutsHandler handler, int keyCode, @NonNull KeyEvent event) {
if (isFragmentKeyboardShortcutHandled(handler, keyCode, event)) return true;
@ -636,6 +621,18 @@ public class HomeActivity extends BaseAppCompatActivity implements OnClickListen
return 1 + mActionBarWithOverlay.getTranslationY() / totalHeight;
}
@Override
public void setControlBarOffset(float offset) {
mActionBarWithOverlay.setTranslationY(mTabColumns > 1 ? 0 : getControlBarHeight() * (offset - 1));
final ViewGroup.LayoutParams lp = mActionsButton.getLayoutParams();
if (lp instanceof MarginLayoutParams) {
mActionsButton.setTranslationY((((MarginLayoutParams) lp).bottomMargin + mActionsButton.getHeight()) * (1 - offset));
} else {
mActionsButton.setTranslationY(mActionsButton.getHeight() * (1 - offset));
}
notifyControlBarOffsetChanged();
}
@Override
public void onContentChanged() {
super.onContentChanged();

View File

@ -79,7 +79,6 @@ import org.mariotaku.twidere.fragment.support.SupportProgressDialogFragment;
import org.mariotaku.twidere.graphic.EmptyDrawable;
import org.mariotaku.twidere.model.ParcelableCredentials;
import org.mariotaku.twidere.provider.TwidereDataStore.Accounts;
import org.mariotaku.twidere.util.AbsLogger;
import org.mariotaku.twidere.util.AsyncTaskUtils;
import org.mariotaku.twidere.util.ContentValuesCreator;
import org.mariotaku.twidere.util.OAuthPasswordAuthenticator;
@ -458,7 +457,6 @@ public class SignInActivity extends BaseAppCompatActivity implements OnClickList
startActivity(intent);
finish();
} else {
AbsLogger.error(result.exception);
if (result.exception instanceof AuthenticityTokenException) {
Toast.makeText(this, R.string.wrong_api_key, Toast.LENGTH_SHORT).show();
} else if (result.exception instanceof WrongUserPassException) {

View File

@ -62,7 +62,6 @@ import org.mariotaku.twidere.util.MultiSelectManager;
import org.mariotaku.twidere.util.ReadStateManager;
import org.mariotaku.twidere.util.StrictModeUtils;
import org.mariotaku.twidere.util.TwidereLogger;
import org.mariotaku.twidere.util.UserAgentUtils;
import org.mariotaku.twidere.util.UserColorNameManager;
import org.mariotaku.twidere.util.Utils;
import org.mariotaku.twidere.util.VideoLoader;
@ -109,7 +108,6 @@ public class TwidereApplication extends MultiDexApplication implements Constants
private KeyboardShortcutsHandler mKeyboardShortcutsHandler;
private UserColorNameManager mUserColorNameManager;
private String mDefaultUserAgent;
private HotMobiLogger mHotMobiLogger;
@NonNull
@ -122,10 +120,6 @@ public class TwidereApplication extends MultiDexApplication implements Constants
return mAsyncTaskManager = AsyncTaskManager.getInstance();
}
public String getDefaultUserAgent() {
return mDefaultUserAgent;
}
public DiskCache getDiskCache() {
if (mDiskCache != null) return mDiskCache;
return mDiskCache = createDiskCache(DIR_NAME_IMAGE_CACHE);
@ -236,7 +230,6 @@ public class TwidereApplication extends MultiDexApplication implements Constants
super.onCreate();
initDebugMode();
initBugReport();
mDefaultUserAgent = UserAgentUtils.getDefaultUserAgentString(this);
mHandler = new Handler();
mMessageBus = new Bus();
initializeAsyncTask();

View File

@ -566,6 +566,14 @@ public class StatusFragment extends BaseSupportFragment implements LoaderCallbac
mErrorContainer.setVisibility(state == STATE_ERROR ? View.VISIBLE : View.GONE);
}
@Override
public void onLoaderReset(final Loader<SingleResponse<ParcelableStatus>> loader) {
final TweetEvent event = mStatusEvent;
if (event == null) return;
event.markEnd();
HotMobiLogger.getInstance(getActivity()).log(event.getAccountId(), event);
}
private static class DetailStatusViewHolder extends ViewHolder implements OnClickListener,
ActionMenuView.OnMenuItemClickListener {
@ -743,8 +751,14 @@ public class StatusFragment extends BaseSupportFragment implements LoaderCallbac
retweetsCountView.setText(Utils.getLocalizedNumber(locale, status.retweet_count));
favoritesCountView.setText(Utils.getLocalizedNumber(locale, status.favorite_count));
final ParcelableMedia[] media;
if (status.is_quote && ArrayUtils.isEmpty(status.media)) {
media = status.quoted_media;
} else {
media = status.media;
}
if (status.media == null) {
if (media == null) {
mediaPreviewContainer.setVisibility(View.GONE);
mediaPreview.setVisibility(View.GONE);
mediaPreviewLoad.setVisibility(View.GONE);
@ -753,7 +767,7 @@ public class StatusFragment extends BaseSupportFragment implements LoaderCallbac
mediaPreviewContainer.setVisibility(View.VISIBLE);
mediaPreview.setVisibility(View.VISIBLE);
mediaPreviewLoad.setVisibility(View.GONE);
mediaPreview.displayMedia(status.media, loader, status.account_id,
mediaPreview.displayMedia(media, loader, status.account_id,
adapter.getFragment(), adapter.getMediaLoadingHandler());
} else {
mediaPreviewContainer.setVisibility(View.VISIBLE);
@ -1045,18 +1059,14 @@ public class StatusFragment extends BaseSupportFragment implements LoaderCallbac
private final boolean mDisplayProfileImage;
private final boolean mSensitiveContentEnabled;
private final boolean mHideCardActions;
private final UserColorNameManager mUserColorNameManager;
private boolean mLoadMoreSupported;
private boolean mLoadMoreIndicatorVisible;
private boolean mDetailMediaExpanded;
private ParcelableStatus mStatus;
private ParcelableCredentials mStatusAccount;
private List<ParcelableStatus> mConversation, mReplies;
private StatusAdapterListener mStatusAdapterListener;
private final UserColorNameManager mUserColorNameManager;
private RecyclerView mRecyclerView;
private DetailStatusViewHolder mStatusViewHolder;
@ -1555,13 +1565,4 @@ 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.getAccountId(), event);
}
}

View File

@ -45,5 +45,4 @@ public class ExtendedViewPager extends ViewPager {
if (!isEnabled()) return false;
return super.onTouchEvent(event);
}
}