fixed compact status card padding
This commit is contained in:
parent
2a75fa15db
commit
25d7491b40
|
@ -22,10 +22,12 @@ package org.mariotaku.twidere.fragment.support;
|
|||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.app.LoaderManager.LoaderCallbacks;
|
||||
import android.support.v4.content.Loader;
|
||||
import android.support.v4.widget.SwipeRefreshLayout.OnRefreshListener;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
@ -39,6 +41,8 @@ import org.mariotaku.twidere.app.TwidereApplication;
|
|||
import org.mariotaku.twidere.fragment.iface.RefreshScrollTopInterface;
|
||||
import org.mariotaku.twidere.model.ParcelableActivity;
|
||||
import org.mariotaku.twidere.util.AsyncTwitterWrapper;
|
||||
import org.mariotaku.twidere.util.KeyboardShortcutsHandler;
|
||||
import org.mariotaku.twidere.util.RecyclerViewNavigationHelper;
|
||||
import org.mariotaku.twidere.view.HeaderDrawerLayout.DrawerCallback;
|
||||
import org.mariotaku.twidere.view.holder.GapViewHolder;
|
||||
|
||||
|
@ -47,17 +51,16 @@ import org.mariotaku.twidere.view.holder.GapViewHolder;
|
|||
*/
|
||||
public abstract class AbsActivitiesFragment<Data> extends AbsContentRecyclerViewFragment<AbsActivitiesAdapter<Data>>
|
||||
implements LoaderCallbacks<Data>, OnRefreshListener, DrawerCallback, RefreshScrollTopInterface,
|
||||
ActivityAdapterListener {
|
||||
ActivityAdapterListener, KeyboardShortcutsHandler.KeyboardShortcutCallback {
|
||||
|
||||
private final Object mStatusesBusCallback;
|
||||
private SharedPreferences mPreferences;
|
||||
private RecyclerViewNavigationHelper mNavigationHelper;
|
||||
|
||||
protected AbsActivitiesFragment() {
|
||||
mStatusesBusCallback = createMessageBusCallback();
|
||||
}
|
||||
|
||||
private SharedPreferences mPreferences;
|
||||
|
||||
|
||||
@Override
|
||||
public void onGapClick(GapViewHolder holder, int position) {
|
||||
final ParcelableActivity activity = getAdapter().getActivity(position);
|
||||
|
@ -66,6 +69,16 @@ public abstract class AbsActivitiesFragment<Data> extends AbsContentRecyclerView
|
|||
getActivities(accountIds, maxIds, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleKeyboardShortcutSingle(@NonNull KeyboardShortcutsHandler handler, int keyCode, @NonNull KeyEvent event) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleKeyboardShortcutRepeat(@NonNull KeyboardShortcutsHandler handler, final int keyCode, final int repeatCount,
|
||||
@NonNull final KeyEvent event) {
|
||||
return mNavigationHelper.handleKeyboardShortcutRepeat(handler, keyCode, repeatCount, event);
|
||||
}
|
||||
|
||||
public SharedPreferences getSharedPreferences() {
|
||||
if (mPreferences != null) return mPreferences;
|
||||
|
@ -82,9 +95,11 @@ public abstract class AbsActivitiesFragment<Data> extends AbsContentRecyclerView
|
|||
@Override
|
||||
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
final AbsActivitiesAdapter<Data> adapter = getAdapter();
|
||||
mNavigationHelper = new RecyclerViewNavigationHelper(getRecyclerView(), getLayoutManager(), adapter);
|
||||
final View view = getView();
|
||||
if (view == null) throw new AssertionError();
|
||||
getAdapter().setListener(this);
|
||||
adapter.setListener(this);
|
||||
getLoaderManager().initLoader(0, getArguments(), this);
|
||||
showProgress();
|
||||
}
|
||||
|
|
|
@ -114,6 +114,10 @@ public abstract class AbsStatusesFragment<Data> extends AbsContentRecyclerViewFr
|
|||
if (position == -1) return false;
|
||||
final ParcelableStatus status = getAdapter().getStatus(position);
|
||||
if (status == null) return false;
|
||||
if (keyCode == KeyEvent.KEYCODE_ENTER) {
|
||||
Utils.openStatus(getActivity(), status, null);
|
||||
return true;
|
||||
}
|
||||
if (action == null) {
|
||||
action = handler.getKeyAction(CONTEXT_TAG_STATUS, keyCode, event);
|
||||
}
|
||||
|
|
|
@ -16,11 +16,10 @@
|
|||
~ You should have received a copy of the GNU General Public License
|
||||
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
<org.mariotaku.twidere.view.ColorLabelFrameLayout
|
||||
android:id="@+id/item_content"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<org.mariotaku.twidere.view.ColorLabelFrameLayout 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"
|
||||
android:id="@+id/item_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
tools:background="?cardItemBackgroundColor">
|
||||
|
@ -41,8 +40,8 @@
|
|||
style="?profileImageStyle"
|
||||
android:layout_width="@dimen/element_size_small"
|
||||
android:layout_height="@dimen/element_size_small"
|
||||
android:layout_alignRight="@id/profile_image_space"
|
||||
android:layout_alignEnd="@id/profile_image_space"
|
||||
android:layout_alignRight="@id/profile_image_space"
|
||||
android:layout_alignTop="@id/reply_retweet_status"
|
||||
android:layout_marginLeft="@dimen/element_spacing_small"
|
||||
android:layout_marginStart="@dimen/element_spacing_small"
|
||||
|
@ -60,25 +59,25 @@
|
|||
android:layout_alignLeft="@+id/status_content"
|
||||
android:layout_alignStart="@+id/status_content"
|
||||
android:layout_marginBottom="@dimen/element_spacing_small"
|
||||
android:layout_marginRight="@dimen/element_spacing_normal"
|
||||
android:layout_marginEnd="@dimen/element_spacing_normal"
|
||||
android:layout_marginRight="@dimen/element_spacing_normal"
|
||||
android:layout_marginTop="@dimen/element_spacing_minus_small"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center_vertical|start"
|
||||
android:minHeight="@dimen/element_size_small"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
tools:textSize="@dimen/text_size_extra_small"
|
||||
android:visibility="gone"
|
||||
tools:text="Retweeted by Mariotaku"
|
||||
tools:textSize="@dimen/text_size_extra_small"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<Space
|
||||
android:id="@+id/profile_image_space"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/icon_size_status_profile_image"
|
||||
android:layout_alignRight="@id/profile_image"
|
||||
android:layout_alignEnd="@id/profile_image"
|
||||
android:layout_alignRight="@id/profile_image"
|
||||
android:layout_below="@+id/reply_retweet_icon" />
|
||||
|
||||
<org.mariotaku.twidere.view.ShapedImageView
|
||||
|
@ -98,11 +97,11 @@
|
|||
android:layout_width="@dimen/icon_size_profile_type"
|
||||
android:layout_height="@dimen/icon_size_profile_type"
|
||||
android:layout_alignBottom="@id/profile_image"
|
||||
android:layout_alignRight="@id/profile_image"
|
||||
android:layout_alignEnd="@id/profile_image"
|
||||
android:layout_alignRight="@id/profile_image"
|
||||
android:layout_marginBottom="@dimen/element_spacing_minus_small"
|
||||
android:layout_marginRight="@dimen/element_spacing_minus_small"
|
||||
android:layout_marginEnd="@dimen/element_spacing_minus_small"
|
||||
android:layout_marginRight="@dimen/element_spacing_minus_small"
|
||||
android:scaleType="fitCenter" />
|
||||
|
||||
<RelativeLayout
|
||||
|
@ -113,8 +112,8 @@
|
|||
android:layout_marginBottom="@dimen/element_spacing_normal"
|
||||
android:layout_marginLeft="@dimen/element_spacing_normal"
|
||||
android:layout_marginStart="@dimen/element_spacing_normal"
|
||||
android:layout_toRightOf="@id/profile_image_space"
|
||||
android:layout_toEndOf="@id/profile_image_space"
|
||||
android:layout_toRightOf="@id/profile_image_space"
|
||||
android:minHeight="@dimen/icon_size_status_profile_image"
|
||||
android:orientation="vertical">
|
||||
|
||||
|
@ -194,8 +193,8 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_alignBottom="@+id/text"
|
||||
android:layout_alignTop="@+id/quoted_name_container"
|
||||
android:layout_marginRight="@dimen/element_spacing_normal"
|
||||
android:layout_marginEnd="@dimen/element_spacing_normal"
|
||||
android:layout_marginRight="@dimen/element_spacing_normal"
|
||||
android:background="?android:dividerHorizontal"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible" />
|
||||
|
@ -205,8 +204,8 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/quote_text"
|
||||
android:layout_toRightOf="@+id/quote_indicator"
|
||||
android:layout_toEndOf="@+id/quote_indicator"
|
||||
android:layout_toRightOf="@+id/quote_indicator"
|
||||
android:gravity="center_vertical|start"
|
||||
android:orientation="horizontal"
|
||||
android:visibility="gone"
|
||||
|
@ -242,8 +241,8 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/quoted_name_container"
|
||||
android:layout_marginTop="@dimen/element_spacing_small"
|
||||
android:layout_toRightOf="@+id/quote_indicator"
|
||||
android:layout_toEndOf="@+id/quote_indicator"
|
||||
android:layout_toRightOf="@+id/quote_indicator"
|
||||
android:horizontalSpacing="@dimen/element_spacing_xsmall"
|
||||
android:verticalSpacing="@dimen/element_spacing_xsmall">
|
||||
|
||||
|
@ -257,8 +256,8 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/media_preview"
|
||||
android:layout_marginTop="@dimen/element_spacing_small"
|
||||
android:layout_toRightOf="@+id/quote_indicator"
|
||||
android:layout_toEndOf="@+id/quote_indicator"
|
||||
android:layout_toRightOf="@+id/quote_indicator"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
tools:text="@string/sample_status_text" />
|
||||
|
@ -336,8 +335,8 @@
|
|||
android:layout_width="@dimen/button_size_content_card"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignBottom="@+id/action_buttons"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignTop="@+id/action_buttons"
|
||||
android:layout_marginTop="@dimen/element_spacing_minus_normal"
|
||||
android:color="?android:textColorTertiary"
|
||||
|
|
Loading…
Reference in New Issue