mirror of
https://github.com/ArcaneChat/android.git
synced 2026-07-03 14:05:24 +02:00
tweak new profile (#3800)
* adapt divider to style used elsewhere * offer copy-to-clipboard on long-tap address * Revert "offer copy-to-clipboard on long-tap address" This reverts commit 92570b8e1ef5898b99a9a2769eea0e1e16bf25e1. * show copy-context menu on long pressing address
This commit is contained in:
@@ -157,8 +157,4 @@ public class ConversationTitleView extends RelativeLayout {
|
||||
public void setOnBackClickedListener(@Nullable OnClickListener listener) {
|
||||
this.back.setOnClickListener(listener);
|
||||
}
|
||||
|
||||
public void registerForContextMenu(Activity activity) {
|
||||
activity.registerForContextMenu(content);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.b44t.messenger.DcChat;
|
||||
@@ -44,6 +45,7 @@ public class ProfileAdapter extends RecyclerView.Adapter
|
||||
public static final int ITEM_SHARED_CHATS = 60;
|
||||
|
||||
private final @NonNull Context context;
|
||||
private final @NonNull Fragment fragment;
|
||||
private final @NonNull DcContext dcContext;
|
||||
private @Nullable DcChat dcChat;
|
||||
private @Nullable DcContact dcContact;
|
||||
@@ -83,12 +85,13 @@ public class ProfileAdapter extends RecyclerView.Adapter
|
||||
}
|
||||
};
|
||||
|
||||
public ProfileAdapter(@NonNull Context context,
|
||||
public ProfileAdapter(@NonNull Fragment fragment,
|
||||
@NonNull GlideRequests glideRequests,
|
||||
@Nullable ItemClickListener clickListener)
|
||||
{
|
||||
super();
|
||||
this.context = context;
|
||||
this.fragment = fragment;
|
||||
this.context = fragment.requireContext();
|
||||
this.glideRequests = glideRequests;
|
||||
this.clickListener = clickListener;
|
||||
this.dcContext = DcHelper.getContext(context);
|
||||
@@ -211,6 +214,9 @@ public class ProfileAdapter extends RecyclerView.Adapter
|
||||
if (data.viewType == ITEM_LAST_SEEN || data.viewType == ITEM_ADDRESS) {
|
||||
int padding = (int)((float)context.getResources().getDimensionPixelSize(R.dimen.contact_list_normal_padding) * 1.2);
|
||||
item.setPadding(item.getPaddingLeft(), item.getPaddingTop(), item.getPaddingRight(), padding);
|
||||
if (data.viewType == ITEM_ADDRESS) {
|
||||
fragment.registerForContextMenu(item);
|
||||
}
|
||||
} else if (data.viewType == ITEM_INTRODUCED_BY) {
|
||||
int padding = context.getResources().getDimensionPixelSize(R.dimen.contact_list_normal_padding);
|
||||
item.setPadding(item.getPaddingLeft(), padding, item.getPaddingRight(), item.getPaddingBottom());
|
||||
|
||||
@@ -67,7 +67,7 @@ public class ProfileFragment extends Fragment
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.profile_fragment, container, false);
|
||||
adapter = new ProfileAdapter(requireContext(), GlideApp.with(this), this);
|
||||
adapter = new ProfileAdapter(this, GlideApp.with(this), this);
|
||||
|
||||
RecyclerView list = ViewUtil.findById(view, R.id.recycler_view);
|
||||
list.setAdapter(adapter);
|
||||
|
||||
Reference in New Issue
Block a user