mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2024-12-02 03:11:23 +01:00
UI redisign
This commit is contained in:
parent
072e27ed27
commit
8d6d18e875
@ -11,6 +11,7 @@ import android.support.annotation.Nullable;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.support.v7.preference.PreferenceManager;
|
||||
import android.support.v7.widget.CardView;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.support.v7.widget.helper.ItemTouchHelper;
|
||||
@ -18,6 +19,7 @@ import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.schabi.newpipe.R;
|
||||
@ -176,11 +178,13 @@ public class ContentSettingsMain extends Fragment {
|
||||
|
||||
TextView text;
|
||||
View view;
|
||||
CardView cardView;
|
||||
|
||||
public TabViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
|
||||
text = itemView.findViewById(R.id.tabName);
|
||||
cardView = itemView.findViewById(R.id.layoutCard);
|
||||
view = itemView;
|
||||
}
|
||||
|
||||
|
@ -11,6 +11,7 @@ import android.preference.PreferenceManager;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.app.DialogFragment;
|
||||
import android.support.v7.widget.CardView;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.view.LayoutInflater;
|
||||
@ -50,7 +51,6 @@ public class ContentSettingsMainDialog extends DialogFragment {
|
||||
allTabs.setLayoutManager(new LinearLayoutManager(getContext()));
|
||||
allAdapter = new AllAdapter();
|
||||
allTabs.setAdapter(allAdapter);
|
||||
allTabs.addItemDecoration(new DividerItemDecoration(getActivity()));
|
||||
}
|
||||
|
||||
private void tabNames() {
|
||||
@ -107,11 +107,12 @@ public class ContentSettingsMainDialog extends DialogFragment {
|
||||
super(itemView);
|
||||
|
||||
text = itemView.findViewById(R.id.tabName);
|
||||
view = itemView.findViewById(R.id.layout);
|
||||
view = itemView.findViewById(R.id.layoutCard);
|
||||
}
|
||||
|
||||
void bind(int position) {
|
||||
text.setText(allTabs[position]);
|
||||
((CardView) view).setCardElevation(0);
|
||||
view.setOnClickListener(v -> {
|
||||
addTab(position);
|
||||
});
|
||||
@ -119,37 +120,4 @@ public class ContentSettingsMainDialog extends DialogFragment {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class DividerItemDecoration extends RecyclerView.ItemDecoration {
|
||||
|
||||
private final int[] ATTRS = new int[]{android.R.attr.listDivider};
|
||||
|
||||
private Drawable divider;
|
||||
|
||||
public DividerItemDecoration(Context context) {
|
||||
final TypedArray styledAttributes = context.obtainStyledAttributes(ATTRS);
|
||||
divider = styledAttributes.getDrawable(0);
|
||||
styledAttributes.recycle();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onDraw(Canvas c, RecyclerView parent, RecyclerView.State state) {
|
||||
int left = parent.getPaddingLeft();
|
||||
int right = parent.getWidth() - parent.getPaddingRight();
|
||||
|
||||
int childCount = parent.getChildCount();
|
||||
for (int i = 0; i < childCount; i++) {
|
||||
View child = parent.getChildAt(i);
|
||||
|
||||
RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child.getLayoutParams();
|
||||
|
||||
int top = child.getBottom() + params.bottomMargin;
|
||||
int bottom = top + divider.getIntrinsicHeight();
|
||||
|
||||
divider.setBounds(left, top, right, bottom);
|
||||
divider.draw(c);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/relLay"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
@ -8,6 +9,8 @@
|
||||
android:id="@+id/usedTabs"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="0dp" />
|
||||
android:layout_margin="0dp"
|
||||
android:paddingBottom="0dp"
|
||||
android:paddingTop="0dp" />
|
||||
|
||||
</RelativeLayout>
|
@ -9,14 +9,14 @@
|
||||
android:id="@+id/titleTextView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/tab_chose"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:layout_marginLeft="19dp"
|
||||
android:layout_marginRight="19dp"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginRight="5dp"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:layout_marginBottom="10dp"/>
|
||||
android:text="@string/tab_chose"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge" />
|
||||
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:id="@+id/allTabs"
|
||||
|
@ -1,9 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/layout"
|
||||
android:id="@+id/layoutCard"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="0dp"
|
||||
android:layout_marginTop="1dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
@ -15,10 +16,11 @@
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:paddingBottom="6dp"
|
||||
android:paddingLeft="3dp"
|
||||
android:paddingBottom="9dp"
|
||||
android:paddingLeft="19dp"
|
||||
android:paddingRight="19dp"
|
||||
android:paddingStart="3dp"
|
||||
android:paddingTop="6dp"
|
||||
android:paddingTop="9dp"
|
||||
android:textAppearance="?android:attr/textAppearanceListItem"
|
||||
android:textSize="16sp" />
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user