added floating button to profile and search layout, bug fix

This commit is contained in:
nuclearfog 2023-07-24 20:56:39 +02:00
parent b75b6649bc
commit bb3c9567f4
No known key found for this signature in database
GPG Key ID: 03488A185C476379
11 changed files with 375 additions and 390 deletions

View File

@ -36,7 +36,7 @@ import com.google.android.material.navigation.NavigationView.OnNavigationItemSel
import com.squareup.picasso.Picasso;
import org.nuclearfog.twidda.R;
import org.nuclearfog.twidda.backend.async.AsyncExecutor;
import org.nuclearfog.twidda.backend.async.AsyncExecutor.AsyncCallback;
import org.nuclearfog.twidda.backend.async.UserLoader;
import org.nuclearfog.twidda.backend.async.UserLoader.UserParam;
import org.nuclearfog.twidda.backend.async.UserLoader.UserResult;
@ -57,7 +57,7 @@ import org.nuclearfog.twidda.ui.views.TabSelector.OnTabSelectedListener;
* @author nuclearfog
*/
public class MainActivity extends AppCompatActivity implements ActivityResultCallback<ActivityResult>, OnTabSelectedListener,
OnQueryTextListener, OnNavigationItemSelectedListener, OnClickListener, AsyncExecutor.AsyncCallback<UserLoader.UserResult> {
OnQueryTextListener, OnNavigationItemSelectedListener, OnClickListener, AsyncCallback<UserResult> {
public static final String KEY_SELECT_NOTIFICATION = "main_notification";
@ -119,9 +119,15 @@ public class MainActivity extends AppCompatActivity implements ActivityResultCal
picasso = PicassoBuilder.get(this);
tabSelector.addViewPager(viewPager);
viewPager.setOffscreenPageLimit(4);
if (navigationView.getLayoutParams() != null) {
navigationView.getLayoutParams().width = Math.round(getResources().getDisplayMetrics().widthPixels / 2.0f);
}
if (!settings.floatingButtonEnabled()) {
floatingButton.setVisibility(View.INVISIBLE);
}
if (!settings.getLogin().getConfiguration().isFilterSupported()) {
navigationView.getMenu().findItem(R.id.menu_navigator_filter).setVisible(false);
}
toolbar.setTitle("");
toolbar.setNavigationIcon(R.drawable.menu);
@ -378,6 +384,7 @@ public class MainActivity extends AppCompatActivity implements ActivityResultCal
else
intent.putExtra(ProfileActivity.KEY_ID, settings.getLogin().getId());
activityResultLauncher.launch(intent);
drawerLayout.close();
} else if (v.getId() == R.id.home_post) {
Intent intent = new Intent(this, StatusEditor.class);
startActivity(intent);

View File

@ -14,6 +14,7 @@ import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.view.ViewTreeObserver.OnPreDrawListener;
import android.widget.Button;
import android.widget.ImageView;
@ -65,8 +66,8 @@ import org.nuclearfog.twidda.model.User;
import org.nuclearfog.twidda.ui.adapter.viewpager.ProfileAdapter;
import org.nuclearfog.twidda.ui.dialogs.ConfirmDialog;
import org.nuclearfog.twidda.ui.dialogs.ConfirmDialog.OnConfirmListener;
import org.nuclearfog.twidda.ui.views.LockableLinearLayout;
import org.nuclearfog.twidda.ui.views.LockableLinearLayout.LockCallback;
import org.nuclearfog.twidda.ui.views.LockableConstraintLayout;
import org.nuclearfog.twidda.ui.views.LockableConstraintLayout.LockCallback;
import org.nuclearfog.twidda.ui.views.TabSelector;
import org.nuclearfog.twidda.ui.views.TabSelector.OnTabSelectedListener;
@ -142,9 +143,9 @@ public class ProfileActivity extends AppCompatActivity implements OnScrollChange
private UserLoader userLoader;
private TextEmojiLoader emojiLoader;
private NestedScrollView root;
private NestedScrollView scroll;
private ConstraintLayout header;
private LockableLinearLayout body;
private LockableConstraintLayout body;
private TextView user_location, user_createdAt, user_website, description, follow_back, username, screenName;
private ImageView profileImage, bannerImage, toolbarBackground;
private Button following, follower;
@ -168,9 +169,11 @@ public class ProfileActivity extends AppCompatActivity implements OnScrollChange
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.page_profile);
ViewGroup root = findViewById(R.id.page_profile_root);
View floatingButton = findViewById(R.id.page_profile_post_button);
header = findViewById(R.id.page_profile_header);
body = findViewById(R.id.page_profile_body);
root = findViewById(R.id.user_view);
scroll = findViewById(R.id.page_profile_scroll);
toolbar = findViewById(R.id.profile_toolbar);
description = findViewById(R.id.bio);
following = findViewById(R.id.following);
@ -201,6 +204,9 @@ public class ProfileActivity extends AppCompatActivity implements OnScrollChange
constraints.connect(R.id.profile_banner, ConstraintSet.TOP, R.id.profile_toolbar, ConstraintSet.BOTTOM);
constraints.applyTo(header);
}
if (!settings.floatingButtonEnabled()) {
floatingButton.setVisibility(View.INVISIBLE);
}
following.setCompoundDrawablesWithIntrinsicBounds(R.drawable.following, 0, 0, 0);
follower.setCompoundDrawablesWithIntrinsicBounds(R.drawable.follower, 0, 0, 0);
user_createdAt.setCompoundDrawablesWithIntrinsicBounds(R.drawable.date, 0, 0, 0);
@ -270,8 +276,9 @@ public class ProfileActivity extends AppCompatActivity implements OnScrollChange
profileImage.setOnClickListener(this);
bannerImage.setOnClickListener(this);
user_website.setOnClickListener(this);
root.setOnScrollChangeListener(this);
root.getViewTreeObserver().addOnPreDrawListener(this);
floatingButton.setOnClickListener(this);
scroll.setOnScrollChangeListener(this);
scroll.getViewTreeObserver().addOnPreDrawListener(this);
body.addLockCallback(this);
}
@ -295,9 +302,9 @@ public class ProfileActivity extends AppCompatActivity implements OnScrollChange
@Override
public boolean onPreDraw() {
root.getViewTreeObserver().removeOnPreDrawListener(this);
body.getLayoutParams().height = root.getMeasuredHeight();
root.scrollTo(0, 0);
scroll.getViewTreeObserver().removeOnPreDrawListener(this);
body.getLayoutParams().height = scroll.getMeasuredHeight();
scroll.scrollTo(0, 0);
return true;
}
@ -555,6 +562,16 @@ public class ProfileActivity extends AppCompatActivity implements OnScrollChange
startActivity(intent);
}
}
// open status editor
else if (v.getId() == R.id.page_profile_post_button) {
Intent intent = new Intent(this, StatusEditor.class);
if (user != null && !user.isCurrentUser()) {
// add username to status
String prefix = user.getScreenname() + " ";
intent.putExtra(StatusEditor.KEY_TEXT, prefix);
}
startActivity(intent);
}
}
@ -600,7 +617,7 @@ public class ProfileActivity extends AppCompatActivity implements OnScrollChange
@Override
public boolean aquireLock() {
return root.getScrollY() < header.getMeasuredHeight() - SCROLL_THRESHOLD;
return scroll.getScrollY() < header.getMeasuredHeight() - SCROLL_THRESHOLD;
}

View File

@ -6,6 +6,8 @@ import android.graphics.Color;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.Toast;
@ -37,7 +39,7 @@ import java.io.Serializable;
*
* @author nuclearfog
*/
public class SearchActivity extends AppCompatActivity implements OnTabSelectedListener, OnQueryTextListener, AsyncCallback<HashtagResult> {
public class SearchActivity extends AppCompatActivity implements OnClickListener, OnTabSelectedListener, OnQueryTextListener, AsyncCallback<HashtagResult> {
/**
* Key for the search query, required
@ -79,6 +81,7 @@ public class SearchActivity extends AppCompatActivity implements OnTabSelectedLi
setContentView(R.layout.page_search);
ViewGroup root = findViewById(R.id.search_layout);
TabSelector tabSelector = findViewById(R.id.search_tab);
View floatingButton = findViewById(R.id.search_post_button);
toolbar = findViewById(R.id.search_toolbar);
viewPager = findViewById(R.id.search_pager);
@ -97,6 +100,9 @@ public class SearchActivity extends AppCompatActivity implements OnTabSelectedLi
hashtagAction.execute(param, this);
}
}
if (!settings.floatingButtonEnabled()) {
floatingButton.setVisibility(View.INVISIBLE);
}
toolbar.setTitle("");
setSupportActionBar(toolbar);
viewPager.setOffscreenPageLimit(3);
@ -107,6 +113,7 @@ public class SearchActivity extends AppCompatActivity implements OnTabSelectedLi
AppStyles.setTheme(root);
tabSelector.addOnTabSelectedListener(this);
floatingButton.setOnClickListener(this);
}
@ -230,6 +237,17 @@ public class SearchActivity extends AppCompatActivity implements OnTabSelectedLi
}
@Override
public void onClick(View v) {
if (v.getId() == R.id.search_post_button) {
Intent intent = new Intent(this, StatusEditor.class);
if (search.startsWith("#"))
intent.putExtra(StatusEditor.KEY_TEXT, search + " ");
startActivity(intent);
}
}
@Override
public void onTabSelected(int oldPosition) {
invalidateOptionsMenu();

View File

@ -16,8 +16,10 @@ public class LockableConstraintLayout extends ConstraintLayout {
@Nullable
private LockCallback callback;
private boolean lock = false;
private boolean xLock = false;
private boolean yLock = false;
private float yPos = 0.0f;
private float xPos = 0.0f;
/**
* @inheritDoc
@ -37,20 +39,28 @@ public class LockableConstraintLayout extends ConstraintLayout {
@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
switch (ev.getAction()) {
case MotionEvent.ACTION_MOVE:
float deltaX = ev.getX() - xPos;
float deltaY = ev.getY() - yPos;
// detect scroll down, then aquire scroll lock
if (!xLock && Math.abs(deltaY) > Math.abs(deltaX) * 3.0f) {
xLock = true;
}
if (xLock && deltaY < 0.0f && callback != null) {
yLock = callback.aquireLock();
}
// fall through
case MotionEvent.ACTION_DOWN:
xPos = ev.getX();
yPos = ev.getY();
break;
case MotionEvent.ACTION_MOVE:
// detect scroll down, then aquire scroll lock
float deltaY = ev.getY() - yPos;
if (deltaY < 0.0f && callback != null) {
lock = callback.aquireLock();
}
yPos = ev.getY();
case MotionEvent.ACTION_UP:
xLock = false;
break;
}
return lock;
return yLock;
}
/**
@ -59,7 +69,7 @@ public class LockableConstraintLayout extends ConstraintLayout {
* @param lock true to prevent child views to be scrolled
*/
public void lock(boolean lock) {
this.lock = lock;
this.yLock = lock;
}
/**

View File

@ -1,111 +0,0 @@
package org.nuclearfog.twidda.ui.views;
import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.widget.LinearLayout;
import androidx.annotation.Nullable;
/**
* Vertical {@link LinearLayout} implementation with child scroll lock
*
* @author nuclearfog
*/
public class LockableLinearLayout extends LinearLayout {
/**
* minimum X-Y ratio of a swipe to determine if it's a left right swipe
*/
private static final float LEFT_RIGHT_SWIPE_RATIO = 2.0f;
@Nullable
private LockCallback callback;
private boolean lock = false;
private float xPos = 0.0f;
private float yPos = 0.0f;
/**
* @inheritDoc
*/
public LockableLinearLayout(Context context) {
this(context, null);
}
/**
* @inheritDoc
*/
public LockableLinearLayout(Context context, @Nullable AttributeSet attrs) {
this(context, attrs, 0);
}
/**
* @inheritDoc
*/
public LockableLinearLayout(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
this(context, attrs, defStyleAttr, 0);
}
/**
* @inheritDoc
*/
public LockableLinearLayout(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
setOrientation(VERTICAL);
}
@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
switch (ev.getAction()) {
case MotionEvent.ACTION_DOWN:
yPos = ev.getY();
break;
case MotionEvent.ACTION_MOVE:
float deltaX = ev.getX() - xPos;
float deltaY = ev.getY() - yPos;
// detect up/down swipe
if (deltaY < 0.0f && Math.abs(deltaX * LEFT_RIGHT_SWIPE_RATIO) < Math.abs(deltaY)) {
if (callback != null) {
lock = callback.aquireLock();
}
}
// detect left/right swipe
else {
lock = false;
}
xPos = ev.getX();
yPos = ev.getY();
break;
}
return lock;
}
/**
* lock/unlock child scrolling
*
* @param lock true to prevent child views to be scrolled
*/
public void lock(boolean lock) {
this.lock = lock;
}
/**
* add callback to aquire child scroll lock
*/
public void addLockCallback(LockCallback callback) {
this.callback = callback;
}
/**
* Callback to aquire child view scoll lock from activity
*/
public interface LockCallback {
/**
* @return true to lock child scroll
*/
boolean aquireLock();
}
}

View File

@ -16,7 +16,8 @@
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/fragment_list_recyclerview"
android:layout_width="match_parent"
android:layout_height="match_parent" />
android:layout_height="match_parent"
android:overScrollMode="never" />
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>

View File

@ -58,7 +58,6 @@
android:layout_height="match_parent"
android:fitsSystemWindows="false"
android:layout_gravity="start"
android:maxWidth="@dimen/mainpage_navigation_max_width"
app:headerLayout="@layout/navigation_header"
app:menu="@menu/main_navigation" />

View File

@ -1,241 +1,266 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
<FrameLayout 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/user_view"
android:id="@+id/page_profile_root"
android:fitsSystemWindows="true"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:overScrollMode="never"
tools:context=".ui.activities.ProfileActivity">
<LinearLayout
<androidx.core.widget.NestedScrollView
android:id="@+id/page_profile_scroll"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:overScrollMode="never">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:descendantFocusability="blocksDescendants">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/page_profile_header"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/profile_banner"
android:layout_width="0dp"
android:layout_height="0dp"
android:adjustViewBounds="true"
android:contentDescription="@string/profile_banner"
android:scaleType="centerCrop"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintDimensionRatio="3.0" />
<ImageView
android:id="@+id/profile_toolbar_background"
android:layout_width="0dp"
android:layout_height="@dimen/profile_toolbar_height"
android:scaleType="centerCrop"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toEndOf="parent"
tools:ignore="ContentDescription" />
<androidx.appcompat.widget.Toolbar
android:id="@+id/profile_toolbar"
android:layout_width="0dp"
android:layout_height="@dimen/profile_toolbar_height"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
<ImageView
android:id="@+id/profile_img"
android:layout_width="@dimen/profile_image_size"
android:layout_height="@dimen/profile_image_size"
android:layout_marginStart="@dimen/profile_image_padding_left"
android:contentDescription="@string/profile_image"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/profile_banner"
app:layout_constraintBottom_toBottomOf="@id/profile_banner" />
<TextView
android:id="@+id/profile_username"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="@dimen/profile_tv_background_padding"
android:drawablePadding="@dimen/profile_padding_drawable"
android:layout_marginStart="@dimen/profile_username_margin"
android:layout_marginEnd="@dimen/profile_username_margin"
android:lines="1"
android:textSize="@dimen/profile_textsize_big"
app:layout_constraintStart_toEndOf="@id/profile_img"
app:layout_constraintBottom_toBottomOf="@id/profile_banner"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constrainedWidth="true" />
<TextView
android:id="@+id/profile_screenname"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="@dimen/profile_tv_background_padding"
android:drawablePadding="@dimen/profile_padding_drawable"
android:layout_marginStart="@dimen/profile_username_margin"
android:layout_marginEnd="@dimen/profile_username_margin"
android:lines="1"
android:textSize="@dimen/profile_textsize_big"
app:layout_constraintStart_toEndOf="@id/profile_img"
app:layout_constraintTop_toBottomOf="@id/profile_username"
app:layout_constraintEnd_toEndOf="@id/follow_back"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintHorizontal_chainStyle="packed"
app:layout_constrainedWidth="true" />
<TextView
android:id="@+id/follow_back"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:visibility="invisible"
android:padding="@dimen/profile_tv_background_padding"
android:drawablePadding="@dimen/profile_padding_drawable"
android:layout_marginStart="@dimen/profile_tv_margin"
android:lines="1"
android:text="@string/follows_you"
android:textSize="@dimen/profile_textsize_big"
app:layout_constraintStart_toEndOf="@id/profile_screenname"
app:layout_constraintTop_toBottomOf="@id/profile_username"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_chainStyle="packed"
app:layout_constrainedWidth="true" />
<Button
android:id="@+id/following"
android:layout_width="0dp"
android:layout_height="@dimen/profile_button_height"
android:visibility="invisible"
android:paddingLeft="@dimen/profile_button_background_padding"
android:paddingRight="@dimen/profile_button_background_padding"
android:layout_marginStart="@dimen/profile_button_margin"
android:layout_marginEnd="@dimen/profile_button_margin"
android:textSize="@dimen/profile_textsize_big"
app:layout_constraintStart_toEndOf="@id/profile_img"
app:layout_constraintTop_toBottomOf="@id/profile_screenname"
app:layout_constraintEnd_toStartOf="@id/follower"
app:layout_constraintHorizontal_weight="1"
style="@style/FeedbackButton" />
<Button
android:id="@+id/follower"
android:layout_width="0dp"
android:layout_height="@dimen/profile_button_height"
android:visibility="invisible"
android:paddingLeft="@dimen/profile_button_background_padding"
android:paddingRight="@dimen/profile_button_background_padding"
android:layout_marginStart="@dimen/profile_button_margin"
android:layout_marginEnd="@dimen/profile_button_margin"
android:textSize="@dimen/profile_textsize_big"
app:layout_constraintStart_toEndOf="@id/following"
app:layout_constraintTop_toTopOf="@id/following"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_weight="1"
style="@style/FeedbackButton" />
<androidx.constraintlayout.widget.Barrier
android:id="@+id/profile_bio_barrier"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:barrierDirection="bottom"
app:constraint_referenced_ids="following, follower, profile_img" />
<TextView
android:id="@+id/bio"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/profile_tv_margin"
android:layout_marginTop="@dimen/profile_tv_margin"
android:layout_marginEnd="@dimen/profile_tv_margin"
android:fadeScrollbars="false"
android:linksClickable="true"
android:maxLines="@integer/profile_text_bio_lines"
android:scrollbars="vertical"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/profile_bio_barrier"
app:layout_constraintEnd_toEndOf="parent" />
<TextView
android:id="@+id/location"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:visibility="invisible"
android:drawablePadding="@dimen/profile_padding_drawable"
android:layout_marginStart="@dimen/profile_tv_margin"
android:layout_marginEnd="@dimen/profile_tv_margin"
android:lines="1"
android:textSize="@dimen/profile_textsize_small"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/bio"
app:layout_constraintEnd_toStartOf="@id/links"
app:layout_constraintHorizontal_weight="1" />
<TextView
android:id="@+id/links"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:visibility="invisible"
android:drawablePadding="@dimen/profile_padding_drawable"
android:layout_marginStart="@dimen/profile_tv_margin"
android:layout_marginEnd="@dimen/profile_tv_margin"
android:linksClickable="true"
android:lines="1"
android:textSize="@dimen/profile_textsize_small"
app:layout_constraintStart_toEndOf="@id/location"
app:layout_constraintTop_toBottomOf="@id/bio"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_weight="1" />
<androidx.constraintlayout.widget.Barrier
android:id="@+id/profile_date_barrier"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:barrierDirection="bottom"
app:constraint_referenced_ids="links, location" />
<TextView
android:id="@+id/profile_date"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:visibility="invisible"
android:drawablePadding="@dimen/profile_padding_drawable"
android:layout_marginStart="@dimen/profile_tv_margin"
android:layout_marginEnd="@dimen/profile_tv_margin"
android:lines="1"
android:textSize="@dimen/profile_textsize_small"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/profile_date_barrier"
app:layout_constraintEnd_toEndOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<org.nuclearfog.twidda.ui.views.LockableConstraintLayout
android:id="@+id/page_profile_body"
android:layout_width="match_parent"
android:layout_height="match_parent">
<org.nuclearfog.twidda.ui.views.TabSelector
android:id="@+id/profile_tab"
android:layout_width="0dp"
android:layout_height="@dimen/profile_tabselector_height"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
<androidx.viewpager2.widget.ViewPager2
android:id="@+id/profile_pager"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/profile_tab"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
</org.nuclearfog.twidda.ui.views.LockableConstraintLayout>
</LinearLayout>
</androidx.core.widget.NestedScrollView>
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/page_profile_post_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:descendantFocusability="blocksDescendants">
android:layout_gravity="end|bottom"
android:src="@drawable/post"
android:contentDescription="@string/menu_status"
android:layout_margin="@dimen/profile_floating_button_margin"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/page_profile_header"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/profile_banner"
android:layout_width="0dp"
android:layout_height="0dp"
android:adjustViewBounds="true"
android:contentDescription="@string/profile_banner"
android:scaleType="centerCrop"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintDimensionRatio="3.0" />
<ImageView
android:id="@+id/profile_toolbar_background"
android:layout_width="0dp"
android:layout_height="@dimen/profile_toolbar_height"
android:scaleType="centerCrop"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toEndOf="parent"
tools:ignore="ContentDescription" />
<androidx.appcompat.widget.Toolbar
android:id="@+id/profile_toolbar"
android:layout_width="0dp"
android:layout_height="@dimen/profile_toolbar_height"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
<ImageView
android:id="@+id/profile_img"
android:layout_width="@dimen/profile_image_size"
android:layout_height="@dimen/profile_image_size"
android:layout_marginStart="@dimen/profile_image_padding_left"
android:contentDescription="@string/profile_image"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/profile_banner"
app:layout_constraintBottom_toBottomOf="@id/profile_banner" />
<TextView
android:id="@+id/profile_username"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="@dimen/profile_tv_background_padding"
android:drawablePadding="@dimen/profile_padding_drawable"
android:layout_marginStart="@dimen/profile_username_margin"
android:layout_marginEnd="@dimen/profile_username_margin"
android:lines="1"
android:textSize="@dimen/profile_textsize_big"
app:layout_constraintStart_toEndOf="@id/profile_img"
app:layout_constraintBottom_toBottomOf="@id/profile_banner"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constrainedWidth="true" />
<TextView
android:id="@+id/profile_screenname"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="@dimen/profile_tv_background_padding"
android:drawablePadding="@dimen/profile_padding_drawable"
android:layout_marginStart="@dimen/profile_username_margin"
android:layout_marginEnd="@dimen/profile_username_margin"
android:lines="1"
android:textSize="@dimen/profile_textsize_big"
app:layout_constraintStart_toEndOf="@id/profile_img"
app:layout_constraintTop_toBottomOf="@id/profile_username"
app:layout_constraintEnd_toEndOf="@id/follow_back"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintHorizontal_chainStyle="packed"
app:layout_constrainedWidth="true" />
<TextView
android:id="@+id/follow_back"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:visibility="invisible"
android:padding="@dimen/profile_tv_background_padding"
android:drawablePadding="@dimen/profile_padding_drawable"
android:layout_marginStart="@dimen/profile_tv_margin"
android:lines="1"
android:text="@string/follows_you"
android:textSize="@dimen/profile_textsize_big"
app:layout_constraintStart_toEndOf="@id/profile_screenname"
app:layout_constraintTop_toBottomOf="@id/profile_username"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_chainStyle="packed"
app:layout_constrainedWidth="true" />
<Button
android:id="@+id/following"
android:layout_width="0dp"
android:layout_height="@dimen/profile_button_height"
android:visibility="invisible"
android:paddingLeft="@dimen/profile_button_background_padding"
android:paddingRight="@dimen/profile_button_background_padding"
android:layout_marginStart="@dimen/profile_button_margin"
android:layout_marginEnd="@dimen/profile_button_margin"
android:textSize="@dimen/profile_textsize_big"
app:layout_constraintStart_toEndOf="@id/profile_img"
app:layout_constraintTop_toBottomOf="@id/profile_screenname"
app:layout_constraintEnd_toStartOf="@id/follower"
app:layout_constraintHorizontal_weight="1"
style="@style/FeedbackButton" />
<Button
android:id="@+id/follower"
android:layout_width="0dp"
android:layout_height="@dimen/profile_button_height"
android:visibility="invisible"
android:paddingLeft="@dimen/profile_button_background_padding"
android:paddingRight="@dimen/profile_button_background_padding"
android:layout_marginStart="@dimen/profile_button_margin"
android:layout_marginEnd="@dimen/profile_button_margin"
android:textSize="@dimen/profile_textsize_big"
app:layout_constraintStart_toEndOf="@id/following"
app:layout_constraintTop_toTopOf="@id/following"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_weight="1"
style="@style/FeedbackButton" />
<androidx.constraintlayout.widget.Barrier
android:id="@+id/profile_bio_barrier"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:barrierDirection="bottom"
app:constraint_referenced_ids="following, follower, profile_img" />
<TextView
android:id="@+id/bio"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/profile_tv_margin"
android:layout_marginTop="@dimen/profile_tv_margin"
android:layout_marginEnd="@dimen/profile_tv_margin"
android:fadeScrollbars="false"
android:linksClickable="true"
android:maxLines="@integer/profile_text_bio_lines"
android:scrollbars="vertical"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/profile_bio_barrier"
app:layout_constraintEnd_toEndOf="parent" />
<TextView
android:id="@+id/location"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:visibility="invisible"
android:drawablePadding="@dimen/profile_padding_drawable"
android:layout_marginStart="@dimen/profile_tv_margin"
android:layout_marginEnd="@dimen/profile_tv_margin"
android:lines="1"
android:textSize="@dimen/profile_textsize_small"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/bio"
app:layout_constraintEnd_toStartOf="@id/links"
app:layout_constraintHorizontal_weight="1" />
<TextView
android:id="@+id/links"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:visibility="invisible"
android:drawablePadding="@dimen/profile_padding_drawable"
android:layout_marginStart="@dimen/profile_tv_margin"
android:layout_marginEnd="@dimen/profile_tv_margin"
android:linksClickable="true"
android:lines="1"
android:textSize="@dimen/profile_textsize_small"
app:layout_constraintStart_toEndOf="@id/location"
app:layout_constraintTop_toBottomOf="@id/bio"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_weight="1" />
<androidx.constraintlayout.widget.Barrier
android:id="@+id/profile_date_barrier"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:barrierDirection="bottom"
app:constraint_referenced_ids="links, location" />
<TextView
android:id="@+id/profile_date"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:visibility="invisible"
android:drawablePadding="@dimen/profile_padding_drawable"
android:layout_marginStart="@dimen/profile_tv_margin"
android:layout_marginEnd="@dimen/profile_tv_margin"
android:lines="1"
android:textSize="@dimen/profile_textsize_small"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/profile_date_barrier"
app:layout_constraintEnd_toEndOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<org.nuclearfog.twidda.ui.views.LockableLinearLayout
android:id="@+id/page_profile_body"
android:layout_width="match_parent"
android:layout_height="match_parent">
<org.nuclearfog.twidda.ui.views.TabSelector
android:id="@+id/profile_tab"
android:layout_width="match_parent"
android:layout_height="@dimen/profile_tabselector_height" />
<androidx.viewpager2.widget.ViewPager2
android:id="@+id/profile_pager"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</org.nuclearfog.twidda.ui.views.LockableLinearLayout>
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</FrameLayout>

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/search_layout"
android:fitsSystemWindows="true"
android:orientation="vertical"
@ -10,17 +11,38 @@
<androidx.appcompat.widget.Toolbar
android:id="@+id/search_toolbar"
android:layout_width="match_parent"
android:layout_height="@dimen/searchpage_toolbar_height" />
android:layout_width="0dp"
android:layout_height="@dimen/searchpage_toolbar_height"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
<org.nuclearfog.twidda.ui.views.TabSelector
android:id="@+id/search_tab"
android:layout_width="match_parent"
android:layout_height="@dimen/tabselector_height" />
android:layout_width="0dp"
android:layout_height="@dimen/tabselector_height"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/search_toolbar"
app:layout_constraintEnd_toEndOf="parent" />
<androidx.viewpager2.widget.ViewPager2
android:id="@+id/search_pager"
android:layout_width="match_parent"
android:layout_height="match_parent" />
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/search_tab"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
</LinearLayout>
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/search_post_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end|bottom"
android:src="@drawable/post"
android:contentDescription="@string/menu_status"
android:layout_margin="@dimen/searchpage_floating_button_margin"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -2,18 +2,21 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/profile_post"
android:icon="@drawable/post"
android:title="@string/menu_status"
app:showAsAction="always" />
<item
android:id="@+id/profile_follow"
android:icon="@drawable/add_user"
android:title="@string/menu_follow_user"
android:visible="false"
app:showAsAction="ifRoom" />
app:showAsAction="always" />
<item
android:id="@+id/profile_post"
android:title="@string/menu_status" />
<item
android:id="@+id/profile_message"
android:title="@string/menu_message"
android:visible="false" />
<item
android:id="@+id/profile_block"
@ -30,13 +33,6 @@
android:title="@string/menu_mute_user"
android:visible="false" />
<item
android:id="@+id/profile_message"
android:icon="@drawable/message"
android:title="@string/menu_message"
android:visible="false"
app:showAsAction="ifRoom" />
<item
android:id="@+id/profile_lists"
android:visible="false"

View File

@ -59,6 +59,7 @@
<dimen name="profile_textsize_small">12sp</dimen>
<dimen name="profile_icon_size">14sp</dimen>
<dimen name="profile_tabselector_height">52dp</dimen>
<dimen name="profile_floating_button_margin">20dp</dimen>
<integer name="profile_text_bio_lines">6</integer>
<!--dimens of page_editprofile.xml-->
@ -197,11 +198,11 @@
<!--dimens of page_search.xml-->
<dimen name="searchpage_toolbar_height">@dimen/toolbar_height</dimen>
<dimen name="searchpage_floating_button_margin">20dp</dimen>
<!--dimens of page_main.xml-->
<dimen name="mainpage_toolbar_height">@dimen/toolbar_height</dimen>
<dimen name="mainpage_floating_button_margin">20dp</dimen>
<dimen name="mainpage_navigation_max_width">220sp</dimen>
<!--dimens of page_list.xml-->
<dimen name="listpage_toolbar_height">@dimen/toolbar_height</dimen>