Fixed 4. buggy behavior when adding a new tab.

This commit is contained in:
Somethingweirdhere 2018-06-16 11:49:02 +02:00 committed by Christian Schabesberger
parent fc94f184d2
commit b730cb099f
3 changed files with 6 additions and 48 deletions

View File

@ -184,9 +184,6 @@ public class ContentSettingsMain extends Fragment {
class TabViewHolder extends RecyclerView.ViewHolder { class TabViewHolder extends RecyclerView.ViewHolder {
TextView text; TextView text;
Button remove;
Button up;
Button down;
public TabViewHolder(View itemView) { public TabViewHolder(View itemView) {
super(itemView); super(itemView);

View File

@ -101,26 +101,17 @@ public class ContentSettingsMainDialog extends DialogFragment {
class TabViewHolder extends RecyclerView.ViewHolder { class TabViewHolder extends RecyclerView.ViewHolder {
TextView text; TextView text;
Button add;
Button up;
Button down;
View view; View view;
public TabViewHolder(View itemView) { public TabViewHolder(View itemView) {
super(itemView); super(itemView);
text = itemView.findViewById(R.id.tabName); text = itemView.findViewById(R.id.tabName);
add = itemView.findViewById(R.id.buttonAddRemove); view = itemView.findViewById(R.id.layout);
up = itemView.findViewById(R.id.buttonUp);
down = itemView.findViewById(R.id.buttonDown);
view = itemView;
} }
void bind(int position) { void bind(int position) {
up.setBackgroundResource(0);
down.setBackgroundResource(0);
text.setText(allTabs[position]); text.setText(allTabs[position]);
add.setBackgroundResource(0);
view.setOnClickListener(v -> { view.setOnClickListener(v -> {
addTab(position); addTab(position);
}); });

View File

@ -1,51 +1,21 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="horizontal"> android:orientation="horizontal">
<TextView <TextView
android:id="@+id/tabName" android:id="@+id/tabName"
android:layout_width="wrap_content" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentLeft="true" android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" android:layout_alignParentStart="true"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:layout_marginStart="0dp" android:paddingLeft="3dp"
android:layout_toLeftOf="@id/buttonDown"
android:layout_toStartOf="@id/buttonDown"
android:paddingStart="3dp" android:paddingStart="3dp"
android:textAppearance="?android:attr/textAppearanceListItem" android:textAppearance="?android:attr/textAppearanceListItem"
android:textSize="24sp" android:textSize="24sp" />
android:paddingLeft="3dp" />
<Button
android:id="@+id/buttonAddRemove"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginEnd="0dp"
android:layout_marginRight="0dp"
android:background="@color/transparent_background_color" />
<Button
android:id="@+id/buttonDown"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_centerVertical="true"
android:layout_toLeftOf="@+id/buttonUp"
android:layout_toStartOf="@+id/buttonUp"
android:background="@color/transparent_background_color" />
<Button
android:id="@+id/buttonUp"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_centerVertical="true"
android:layout_toLeftOf="@+id/buttonAddRemove"
android:layout_toStartOf="@+id/buttonAddRemove"
android:background="@color/transparent_background_color" />
</RelativeLayout> </RelativeLayout>