New selection menu
|
@ -1,298 +0,0 @@
|
||||||
package org.schabi.newpipe.settings;
|
|
||||||
|
|
||||||
import android.app.Dialog;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.SharedPreferences;
|
|
||||||
import android.content.res.TypedArray;
|
|
||||||
import android.graphics.Canvas;
|
|
||||||
import android.graphics.drawable.Drawable;
|
|
||||||
import android.os.Bundle;
|
|
||||||
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.LinearLayoutManager;
|
|
||||||
import android.support.v7.widget.RecyclerView;
|
|
||||||
import android.view.LayoutInflater;
|
|
||||||
import android.view.View;
|
|
||||||
import android.view.ViewGroup;
|
|
||||||
import android.widget.Button;
|
|
||||||
import android.widget.TextView;
|
|
||||||
|
|
||||||
import org.schabi.newpipe.R;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class ContentSettingsDialog extends DialogFragment {
|
|
||||||
|
|
||||||
|
|
||||||
public AllAdapter allAdapter;
|
|
||||||
public UsedAdapter usedAdapter;
|
|
||||||
|
|
||||||
List<String> usedTabs = new ArrayList<>();
|
|
||||||
|
|
||||||
public String[] allTabs = new String[7];
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
|
|
||||||
Bundle savedInstanceState) {
|
|
||||||
return inflater.inflate(R.layout.dialog_contentsettings, container);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onViewCreated(@NonNull View rootView, @Nullable Bundle savedInstanceState) {
|
|
||||||
super.onViewCreated(rootView, savedInstanceState);
|
|
||||||
|
|
||||||
tabNames();
|
|
||||||
initButtons(rootView);
|
|
||||||
initUsedTabs();
|
|
||||||
|
|
||||||
RecyclerView allTabs = rootView.findViewById(R.id.tabs);
|
|
||||||
allTabs.setLayoutManager(new LinearLayoutManager(getContext()));
|
|
||||||
allAdapter = new AllAdapter();
|
|
||||||
allTabs.setAdapter(allAdapter);
|
|
||||||
allTabs.addItemDecoration(new DividerItemDecoration(getActivity()));
|
|
||||||
|
|
||||||
RecyclerView usedTabs = rootView.findViewById(R.id.usedTabs);
|
|
||||||
usedTabs.setLayoutManager(new LinearLayoutManager(getContext()));
|
|
||||||
usedAdapter = new UsedAdapter();
|
|
||||||
usedTabs.setAdapter(usedAdapter);
|
|
||||||
usedTabs.addItemDecoration(new DividerItemDecoration(getActivity()));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void initButtons(View rootView){
|
|
||||||
rootView.findViewById(R.id.cancelText).setOnClickListener((v -> {
|
|
||||||
dismiss();
|
|
||||||
}));
|
|
||||||
|
|
||||||
rootView.findViewById(R.id.confirmText).setOnClickListener((v -> {
|
|
||||||
StringBuilder save = new StringBuilder();
|
|
||||||
if(usedTabs.size()==0) {
|
|
||||||
save = new StringBuilder("0");
|
|
||||||
} else {
|
|
||||||
for(String s: usedTabs) {
|
|
||||||
save.append(s);
|
|
||||||
save.append("\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getContext());
|
|
||||||
SharedPreferences.Editor editor = sharedPreferences.edit();
|
|
||||||
editor.putString("saveUsedTabs", save.toString());
|
|
||||||
editor.commit();
|
|
||||||
dismiss();
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void initUsedTabs() {
|
|
||||||
String save = PreferenceManager.getDefaultSharedPreferences(getContext()).getString("saveUsedTabs", "1\n2\n4\n");
|
|
||||||
String tabs[] = save.trim().split("\n");
|
|
||||||
usedTabs.addAll(Arrays.asList(tabs));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void tabNames() {
|
|
||||||
allTabs[0] = getString(R.string.blank_page_summary);
|
|
||||||
allTabs[1] = getString(R.string.kiosk_page_summary);
|
|
||||||
allTabs[2] = getString(R.string.subscription_page_summary);
|
|
||||||
allTabs[3] = getString(R.string.feed_page_summary);
|
|
||||||
allTabs[4] = getString(R.string.tab_bookmarks);
|
|
||||||
allTabs[5] = getString(R.string.title_activity_history);
|
|
||||||
allTabs[6] = getString(R.string.channel_page_summary);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void addTab(int position) {
|
|
||||||
if(position!=6) {
|
|
||||||
usedTabs.add(String.valueOf(position));
|
|
||||||
usedAdapter.notifyDataSetChanged();
|
|
||||||
} else {
|
|
||||||
SelectChannelFragment selectChannelFragment = new SelectChannelFragment();
|
|
||||||
selectChannelFragment.setOnSelectedLisener((String url, String name, int service) -> {
|
|
||||||
usedTabs.add(position+"\t"+url+"\t"+name+"\t"+service);
|
|
||||||
usedAdapter.notifyDataSetChanged();
|
|
||||||
});
|
|
||||||
selectChannelFragment.show(getFragmentManager(), "select_channel");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void removeTab(int position) {
|
|
||||||
usedTabs.remove(position);
|
|
||||||
usedAdapter.notifyDataSetChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void upTab(int position){
|
|
||||||
String first = usedTabs.get(position - 1);
|
|
||||||
String second = usedTabs.get(position);
|
|
||||||
|
|
||||||
usedTabs.set(position - 1, second);
|
|
||||||
usedTabs.set(position, first);
|
|
||||||
|
|
||||||
usedAdapter.notifyDataSetChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void downTab(int position){
|
|
||||||
String first = usedTabs.get(position + 1);
|
|
||||||
String second = usedTabs.get(position);
|
|
||||||
|
|
||||||
usedTabs.set(position + 1, second);
|
|
||||||
usedTabs.set(position, first);
|
|
||||||
|
|
||||||
usedAdapter.notifyDataSetChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
public class AllAdapter extends RecyclerView.Adapter<AllAdapter.TabViewHolder>{
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public TabViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
|
||||||
|
|
||||||
LayoutInflater inflater = LayoutInflater.from(getContext());
|
|
||||||
View view = inflater.inflate(R.layout.dialog_contentsettingtab, parent, false);
|
|
||||||
return new TabViewHolder(view);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onBindViewHolder(@NonNull TabViewHolder holder, int position) {
|
|
||||||
holder.bind(position);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getItemCount() {
|
|
||||||
return allTabs.length;
|
|
||||||
}
|
|
||||||
|
|
||||||
class TabViewHolder extends RecyclerView.ViewHolder {
|
|
||||||
|
|
||||||
TextView text;
|
|
||||||
Button add;
|
|
||||||
Button up;
|
|
||||||
Button down;
|
|
||||||
|
|
||||||
public TabViewHolder(View itemView) {
|
|
||||||
super(itemView);
|
|
||||||
|
|
||||||
text = itemView.findViewById(R.id.tabName);
|
|
||||||
add = itemView.findViewById(R.id.buttonAddRemove);
|
|
||||||
up = itemView.findViewById(R.id.buttonUp);
|
|
||||||
down = itemView.findViewById(R.id.buttonDown);
|
|
||||||
}
|
|
||||||
|
|
||||||
void bind(int position) {
|
|
||||||
up.setBackgroundResource(0);
|
|
||||||
down.setBackgroundResource(0);
|
|
||||||
text.setText(allTabs[position]);
|
|
||||||
add.setBackgroundResource(R.drawable.ic_add);
|
|
||||||
add.setOnClickListener(v -> {
|
|
||||||
addTab(position);
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class UsedAdapter extends RecyclerView.Adapter<UsedAdapter.TabViewHolder>{
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public TabViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
|
||||||
|
|
||||||
LayoutInflater inflater = LayoutInflater.from(getContext());
|
|
||||||
View view = inflater.inflate(R.layout.dialog_contentsettingtab, parent, false);
|
|
||||||
return new TabViewHolder(view);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onBindViewHolder(@NonNull TabViewHolder holder, int position) {
|
|
||||||
holder.bind(position);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getItemCount() {
|
|
||||||
return usedTabs.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
class TabViewHolder extends RecyclerView.ViewHolder {
|
|
||||||
|
|
||||||
TextView text;
|
|
||||||
Button remove;
|
|
||||||
Button up;
|
|
||||||
Button down;
|
|
||||||
|
|
||||||
public TabViewHolder(View itemView) {
|
|
||||||
super(itemView);
|
|
||||||
|
|
||||||
text = itemView.findViewById(R.id.tabName);
|
|
||||||
remove = itemView.findViewById(R.id.buttonAddRemove);
|
|
||||||
up = itemView.findViewById(R.id.buttonUp);
|
|
||||||
down = itemView.findViewById(R.id.buttonDown);
|
|
||||||
}
|
|
||||||
|
|
||||||
void bind(int position) {
|
|
||||||
if(position!=0) {
|
|
||||||
up.setBackgroundResource(R.drawable.ic_arrow_up_white);
|
|
||||||
up.setOnClickListener(v -> {
|
|
||||||
upTab(position);
|
|
||||||
});
|
|
||||||
} else up.setBackgroundResource(0);
|
|
||||||
|
|
||||||
if(position!=usedTabs.size()-1) {
|
|
||||||
down.setBackgroundResource(R.drawable.ic_arrow_down_white);
|
|
||||||
down.setOnClickListener(v -> {
|
|
||||||
downTab(position);
|
|
||||||
});
|
|
||||||
} else down.setBackgroundResource(0);
|
|
||||||
|
|
||||||
if(usedTabs.get(position).startsWith("6\t")) {
|
|
||||||
String channelInfo[] = usedTabs.get(position).split("\t");
|
|
||||||
String channelName = "";
|
|
||||||
if(channelInfo.length==4) channelName = channelInfo[2];
|
|
||||||
String textToSet = allTabs[6]+": "+channelName;
|
|
||||||
text.setText(textToSet);
|
|
||||||
} else {
|
|
||||||
text.setText(allTabs[Integer.parseInt(usedTabs.get(position))]);
|
|
||||||
}
|
|
||||||
|
|
||||||
remove.setBackgroundResource(R.drawable.ic_remove);
|
|
||||||
remove.setOnClickListener(v -> {
|
|
||||||
removeTab(position);
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -2,7 +2,6 @@ package org.schabi.newpipe.settings;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.app.Dialog;
|
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
|
@ -10,12 +9,10 @@ import android.os.Bundle;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
import android.support.v4.app.FragmentManager;
|
import android.support.v4.app.Fragment;
|
||||||
import android.support.v4.app.FragmentTransaction;
|
|
||||||
import android.support.v7.preference.ListPreference;
|
import android.support.v7.preference.ListPreference;
|
||||||
import android.support.v7.preference.Preference;
|
import android.support.v7.preference.Preference;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.widget.LinearLayout;
|
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import com.nononsenseapps.filepicker.Utils;
|
import com.nononsenseapps.filepicker.Utils;
|
||||||
|
@ -24,15 +21,12 @@ import com.nostra13.universalimageloader.core.ImageLoader;
|
||||||
import org.schabi.newpipe.R;
|
import org.schabi.newpipe.R;
|
||||||
import org.schabi.newpipe.extractor.NewPipe;
|
import org.schabi.newpipe.extractor.NewPipe;
|
||||||
import org.schabi.newpipe.extractor.StreamingService;
|
import org.schabi.newpipe.extractor.StreamingService;
|
||||||
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
|
|
||||||
import org.schabi.newpipe.report.ErrorActivity;
|
import org.schabi.newpipe.report.ErrorActivity;
|
||||||
import org.schabi.newpipe.report.UserAction;
|
import org.schabi.newpipe.report.UserAction;
|
||||||
import org.schabi.newpipe.util.Constants;
|
|
||||||
import org.schabi.newpipe.util.FilePickerActivityHelper;
|
import org.schabi.newpipe.util.FilePickerActivityHelper;
|
||||||
import org.schabi.newpipe.util.KioskTranslator;
|
import org.schabi.newpipe.util.KioskTranslator;
|
||||||
import org.schabi.newpipe.util.ZipHelper;
|
import org.schabi.newpipe.util.ZipHelper;
|
||||||
|
|
||||||
import java.io.BufferedInputStream;
|
|
||||||
import java.io.BufferedOutputStream;
|
import java.io.BufferedOutputStream;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
|
@ -46,11 +40,8 @@ import java.util.Date;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.zip.ZipFile;
|
import java.util.zip.ZipFile;
|
||||||
import java.util.zip.ZipInputStream;
|
|
||||||
import java.util.zip.ZipOutputStream;
|
import java.util.zip.ZipOutputStream;
|
||||||
|
|
||||||
import static android.content.Context.MODE_PRIVATE;
|
|
||||||
|
|
||||||
public class ContentSettingsFragment extends BasePreferenceFragment {
|
public class ContentSettingsFragment extends BasePreferenceFragment {
|
||||||
|
|
||||||
private static final int REQUEST_IMPORT_PATH = 8945;
|
private static final int REQUEST_IMPORT_PATH = 8945;
|
||||||
|
@ -102,12 +93,6 @@ public class ContentSettingsFragment extends BasePreferenceFragment {
|
||||||
|
|
||||||
addPreferencesFromResource(R.xml.content_settings);
|
addPreferencesFromResource(R.xml.content_settings);
|
||||||
|
|
||||||
Preference contentPreference = findPreference(getString(R.string.main_page_content_key));
|
|
||||||
contentPreference.setOnPreferenceClickListener((Preference p) -> {
|
|
||||||
new ContentSettingsDialog().show(getFragmentManager(),"select_content");
|
|
||||||
return true;
|
|
||||||
});
|
|
||||||
|
|
||||||
Preference importDataPreference = findPreference(getString(R.string.import_data));
|
Preference importDataPreference = findPreference(getString(R.string.import_data));
|
||||||
importDataPreference.setOnPreferenceClickListener((Preference p) -> {
|
importDataPreference.setOnPreferenceClickListener((Preference p) -> {
|
||||||
Intent i = new Intent(getActivity(), FilePickerActivityHelper.class)
|
Intent i = new Intent(getActivity(), FilePickerActivityHelper.class)
|
||||||
|
|
|
@ -0,0 +1,281 @@
|
||||||
|
package org.schabi.newpipe.settings;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
|
import android.content.res.TypedArray;
|
||||||
|
import android.graphics.Canvas;
|
||||||
|
import android.graphics.drawable.Drawable;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.support.annotation.NonNull;
|
||||||
|
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.LinearLayoutManager;
|
||||||
|
import android.support.v7.widget.RecyclerView;
|
||||||
|
import android.support.v7.widget.helper.ItemTouchHelper;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import org.schabi.newpipe.R;
|
||||||
|
import org.schabi.newpipe.database.LocalItem;
|
||||||
|
import org.schabi.newpipe.database.playlist.PlaylistStreamEntry;
|
||||||
|
import org.schabi.newpipe.util.NavigationHelper;
|
||||||
|
import org.schabi.newpipe.util.OnClickGesture;
|
||||||
|
import org.schabi.newpipe.util.ServiceHelper;
|
||||||
|
import org.schabi.newpipe.util.ThemeHelper;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class ContentSettingsMain extends Fragment {
|
||||||
|
|
||||||
|
public ContentSettingsMain.UsedAdapter usedAdapter;
|
||||||
|
|
||||||
|
RecyclerView usedTabsView;
|
||||||
|
|
||||||
|
List<String> usedTabs = new ArrayList<>();
|
||||||
|
|
||||||
|
public String[] allTabs = new String[7];
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
|
||||||
|
Bundle savedInstanceState) {
|
||||||
|
((AppCompatActivity)getContext()).getSupportActionBar().setTitle(R.string.main_page_content);
|
||||||
|
return inflater.inflate(R.layout.dialog_contentsettings, container, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onViewCreated(@NonNull View rootView, @Nullable Bundle savedInstanceState) {
|
||||||
|
super.onViewCreated(rootView, savedInstanceState);
|
||||||
|
|
||||||
|
tabNames();
|
||||||
|
initUsedTabs();
|
||||||
|
initAddButton(rootView);
|
||||||
|
|
||||||
|
usedTabsView = rootView.findViewById(R.id.usedTabs);
|
||||||
|
usedTabsView.setLayoutManager(new LinearLayoutManager(getContext()));
|
||||||
|
usedAdapter = new ContentSettingsMain.UsedAdapter();
|
||||||
|
usedTabsView.setAdapter(usedAdapter);
|
||||||
|
usedTabsView.addItemDecoration(new ContentSettingsMain.DividerItemDecoration(getActivity()));
|
||||||
|
|
||||||
|
ItemTouchHelper.Callback callback = new SimpleItemTouchHelperCallback(usedAdapter);
|
||||||
|
ItemTouchHelper touchHelper = new ItemTouchHelper(callback);
|
||||||
|
touchHelper.attachToRecyclerView(usedTabsView);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void saveChanges() {
|
||||||
|
StringBuilder save = new StringBuilder();
|
||||||
|
if(usedTabs.size()==0) {
|
||||||
|
save = new StringBuilder("0");
|
||||||
|
} else {
|
||||||
|
for(String s: usedTabs) {
|
||||||
|
save.append(s);
|
||||||
|
save.append("\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SharedPreferences sharedPreferences = android.preference.PreferenceManager.getDefaultSharedPreferences(getContext());
|
||||||
|
SharedPreferences.Editor editor = sharedPreferences.edit();
|
||||||
|
editor.putString("saveUsedTabs", save.toString());
|
||||||
|
editor.commit();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initUsedTabs() {
|
||||||
|
String save = android.preference.PreferenceManager.getDefaultSharedPreferences(getContext()).getString("saveUsedTabs", "1\n2\n4\n");
|
||||||
|
String tabs[] = save.trim().split("\n");
|
||||||
|
usedTabs.addAll(Arrays.asList(tabs));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initAddButton(View rootView) {
|
||||||
|
Button addButton = rootView.findViewById(R.id.buttonAdd);
|
||||||
|
addButton.setBackgroundResource(ThemeHelper.getIconByAttr(R.attr.ic_add, getActivity()));
|
||||||
|
addButton.setOnClickListener(v -> {
|
||||||
|
ContentSettingsMainDialog contentSettingsMainDialog = new ContentSettingsMainDialog();
|
||||||
|
contentSettingsMainDialog.setOnAddListener((int position) -> {
|
||||||
|
addTab(position);
|
||||||
|
});
|
||||||
|
contentSettingsMainDialog.show(getFragmentManager(), "select_channel");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void tabNames() {
|
||||||
|
allTabs[0] = getString(R.string.blank_page_summary);
|
||||||
|
allTabs[1] = getString(R.string.kiosk_page_summary);
|
||||||
|
allTabs[2] = getString(R.string.subscription_page_summary);
|
||||||
|
allTabs[3] = getString(R.string.feed_page_summary);
|
||||||
|
allTabs[4] = getString(R.string.tab_bookmarks);
|
||||||
|
allTabs[5] = getString(R.string.title_activity_history);
|
||||||
|
allTabs[6] = getString(R.string.channel_page_summary);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addTab(int position) {
|
||||||
|
if(position!=6) {
|
||||||
|
usedTabs.add(String.valueOf(position));
|
||||||
|
usedAdapter.notifyDataSetChanged();
|
||||||
|
saveChanges();
|
||||||
|
} else {
|
||||||
|
SelectChannelFragment selectChannelFragment = new SelectChannelFragment();
|
||||||
|
selectChannelFragment.setOnSelectedLisener((String url, String name, int service) -> {
|
||||||
|
usedTabs.add(position+"\t"+url+"\t"+name+"\t"+service);
|
||||||
|
usedAdapter.notifyDataSetChanged();
|
||||||
|
saveChanges();
|
||||||
|
});
|
||||||
|
selectChannelFragment.show(getFragmentManager(), "select_channel");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class UsedAdapter extends RecyclerView.Adapter<ContentSettingsMain.UsedAdapter.TabViewHolder>
|
||||||
|
implements ItemTouchHelperAdapter {
|
||||||
|
// ... code from gist
|
||||||
|
@Override
|
||||||
|
public void onItemDismiss(int position) {
|
||||||
|
usedTabs.remove(position);
|
||||||
|
notifyItemRemoved(position);
|
||||||
|
saveChanges();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onItemMove(int fromPosition, int toPosition) {
|
||||||
|
if (fromPosition < toPosition) {
|
||||||
|
for (int i = fromPosition; i < toPosition; i++) {
|
||||||
|
Collections.swap(usedTabs, i, i + 1);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (int i = fromPosition; i > toPosition; i--) {
|
||||||
|
Collections.swap(usedTabs, i, i - 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
notifyItemMoved(fromPosition, toPosition);
|
||||||
|
saveChanges();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ContentSettingsMain.UsedAdapter.TabViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||||
|
|
||||||
|
LayoutInflater inflater = LayoutInflater.from(getContext());
|
||||||
|
View view = inflater.inflate(R.layout.dialog_contentsettingtab, parent, false);
|
||||||
|
return new ContentSettingsMain.UsedAdapter.TabViewHolder(view);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBindViewHolder(@NonNull ContentSettingsMain.UsedAdapter.TabViewHolder holder, int position) {
|
||||||
|
holder.bind(position);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemCount() {
|
||||||
|
return usedTabs.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
class TabViewHolder extends RecyclerView.ViewHolder {
|
||||||
|
|
||||||
|
TextView text;
|
||||||
|
Button remove;
|
||||||
|
Button up;
|
||||||
|
Button down;
|
||||||
|
|
||||||
|
public TabViewHolder(View itemView) {
|
||||||
|
super(itemView);
|
||||||
|
|
||||||
|
text = itemView.findViewById(R.id.tabName);
|
||||||
|
}
|
||||||
|
|
||||||
|
void bind(int position) {
|
||||||
|
if(usedTabs.get(position).startsWith("6\t")) {
|
||||||
|
String channelInfo[] = usedTabs.get(position).split("\t");
|
||||||
|
String channelName = "";
|
||||||
|
if(channelInfo.length==4) channelName = channelInfo[2];
|
||||||
|
String textToSet = allTabs[6]+": "+channelName;
|
||||||
|
text.setText(textToSet);
|
||||||
|
} else {
|
||||||
|
text.setText(allTabs[Integer.parseInt(usedTabs.get(position))]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class SimpleItemTouchHelperCallback extends ItemTouchHelper.Callback {
|
||||||
|
|
||||||
|
private final ItemTouchHelperAdapter mAdapter;
|
||||||
|
|
||||||
|
public SimpleItemTouchHelperCallback(ItemTouchHelperAdapter adapter) {
|
||||||
|
mAdapter = adapter;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isLongPressDragEnabled() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isItemViewSwipeEnabled() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getMovementFlags(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) {
|
||||||
|
int dragFlags = ItemTouchHelper.UP | ItemTouchHelper.DOWN;
|
||||||
|
int swipeFlags = ItemTouchHelper.START | ItemTouchHelper.END;
|
||||||
|
return makeMovementFlags(dragFlags, swipeFlags);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onMove(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder,
|
||||||
|
RecyclerView.ViewHolder target) {
|
||||||
|
mAdapter.onItemMove(viewHolder.getAdapterPosition(), target.getAdapterPosition());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSwiped(RecyclerView.ViewHolder viewHolder, int direction) {
|
||||||
|
mAdapter.onItemDismiss(viewHolder.getAdapterPosition());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface ItemTouchHelperAdapter {
|
||||||
|
|
||||||
|
void onItemMove(int fromPosition, int toPosition);
|
||||||
|
|
||||||
|
void onItemDismiss(int position);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,164 @@
|
||||||
|
package org.schabi.newpipe.settings;
|
||||||
|
|
||||||
|
import android.app.Dialog;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
|
import android.content.res.TypedArray;
|
||||||
|
import android.graphics.Canvas;
|
||||||
|
import android.graphics.drawable.Drawable;
|
||||||
|
import android.os.Bundle;
|
||||||
|
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.LinearLayoutManager;
|
||||||
|
import android.support.v7.widget.RecyclerView;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import org.schabi.newpipe.R;
|
||||||
|
import org.schabi.newpipe.database.subscription.SubscriptionEntity;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class ContentSettingsMainDialog extends DialogFragment {
|
||||||
|
|
||||||
|
|
||||||
|
public AllAdapter allAdapter;
|
||||||
|
|
||||||
|
public String[] allTabs = new String[7];
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
|
||||||
|
Bundle savedInstanceState) {
|
||||||
|
return inflater.inflate(R.layout.dialog_contentsettingsadd, container);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onViewCreated(@NonNull View rootView, @Nullable Bundle savedInstanceState) {
|
||||||
|
super.onViewCreated(rootView, savedInstanceState);
|
||||||
|
|
||||||
|
tabNames();
|
||||||
|
|
||||||
|
RecyclerView allTabs = rootView.findViewById(R.id.allTabs);
|
||||||
|
allTabs.setLayoutManager(new LinearLayoutManager(getContext()));
|
||||||
|
allAdapter = new AllAdapter();
|
||||||
|
allTabs.setAdapter(allAdapter);
|
||||||
|
allTabs.addItemDecoration(new DividerItemDecoration(getActivity()));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void tabNames() {
|
||||||
|
allTabs[0] = getString(R.string.blank_page_summary);
|
||||||
|
allTabs[1] = getString(R.string.kiosk_page_summary);
|
||||||
|
allTabs[2] = getString(R.string.subscription_page_summary);
|
||||||
|
allTabs[3] = getString(R.string.feed_page_summary);
|
||||||
|
allTabs[4] = getString(R.string.tab_bookmarks);
|
||||||
|
allTabs[5] = getString(R.string.title_activity_history);
|
||||||
|
allTabs[6] = getString(R.string.channel_page_summary);
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface OnAddListener {
|
||||||
|
void onAddListener(int position);
|
||||||
|
}
|
||||||
|
ContentSettingsMainDialog.OnAddListener onAddListener = null;
|
||||||
|
public void setOnAddListener(ContentSettingsMainDialog.OnAddListener listener) {
|
||||||
|
onAddListener = listener;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addTab(int position) {
|
||||||
|
if(onAddListener != null) {
|
||||||
|
onAddListener.onAddListener(position);
|
||||||
|
}
|
||||||
|
dismiss();
|
||||||
|
}
|
||||||
|
|
||||||
|
public class AllAdapter extends RecyclerView.Adapter<AllAdapter.TabViewHolder>{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TabViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||||
|
|
||||||
|
LayoutInflater inflater = LayoutInflater.from(getContext());
|
||||||
|
View view = inflater.inflate(R.layout.dialog_contentsettingtab, parent, false);
|
||||||
|
return new TabViewHolder(view);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBindViewHolder(@NonNull TabViewHolder holder, int position) {
|
||||||
|
holder.bind(position);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemCount() {
|
||||||
|
return allTabs.length;
|
||||||
|
}
|
||||||
|
|
||||||
|
class TabViewHolder extends RecyclerView.ViewHolder {
|
||||||
|
|
||||||
|
TextView text;
|
||||||
|
Button add;
|
||||||
|
Button up;
|
||||||
|
Button down;
|
||||||
|
View view;
|
||||||
|
|
||||||
|
public TabViewHolder(View itemView) {
|
||||||
|
super(itemView);
|
||||||
|
|
||||||
|
text = itemView.findViewById(R.id.tabName);
|
||||||
|
add = itemView.findViewById(R.id.buttonAddRemove);
|
||||||
|
up = itemView.findViewById(R.id.buttonUp);
|
||||||
|
down = itemView.findViewById(R.id.buttonDown);
|
||||||
|
view = itemView;
|
||||||
|
}
|
||||||
|
|
||||||
|
void bind(int position) {
|
||||||
|
up.setBackgroundResource(0);
|
||||||
|
down.setBackgroundResource(0);
|
||||||
|
text.setText(allTabs[position]);
|
||||||
|
add.setBackgroundResource(0);
|
||||||
|
view.setOnClickListener(v -> {
|
||||||
|
addTab(position);
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
BIN
app/src/main/res/drawable-hdpi/ic_add_black_24dp.png
Normal file
After Width: | Height: | Size: 187 B |
BIN
app/src/main/res/drawable-hdpi/ic_add_white_24dp.png
Normal file
After Width: | Height: | Size: 194 B |
BIN
app/src/main/res/drawable-mdpi/ic_add_black_24dp.png
Normal file
After Width: | Height: | Size: 164 B |
BIN
app/src/main/res/drawable-mdpi/ic_add_white_24dp.png
Normal file
After Width: | Height: | Size: 172 B |
BIN
app/src/main/res/drawable-xhdpi/ic_add_black_24dp.png
Normal file
After Width: | Height: | Size: 221 B |
BIN
app/src/main/res/drawable-xhdpi/ic_add_white_24dp.png
Normal file
After Width: | Height: | Size: 227 B |
BIN
app/src/main/res/drawable-xxhdpi/ic_add_black_24dp.png
Normal file
After Width: | Height: | Size: 352 B |
BIN
app/src/main/res/drawable-xxhdpi/ic_add_white_24dp.png
Normal file
After Width: | Height: | Size: 349 B |
|
@ -1,83 +1,53 @@
|
||||||
<?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:layout_width="wrap_content"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="match_parent"
|
||||||
android:minWidth="550dp"
|
android:orientation="vertical">
|
||||||
android:orientation="vertical"
|
|
||||||
android:padding="12dp">
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="match_parent"
|
||||||
android:layout_alignParentTop="true"
|
android:layout_alignParentTop="true"
|
||||||
android:layout_above="@id/buttonLayout"
|
android:layout_margin="2dp"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<TextView
|
<RelativeLayout
|
||||||
android:id="@+id/firstText"
|
android:id="@+id/topBar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:paddingBottom="2dp"
|
android:layout_marginBottom="5dp"
|
||||||
android:paddingTop="2dp"
|
android:orientation="horizontal"
|
||||||
android:text="@string/selection"
|
android:paddingBottom="3dp"
|
||||||
android:textAppearance="?android:attr/textAppearanceLarge" />
|
android:paddingTop="3dp">
|
||||||
|
|
||||||
<android.support.v7.widget.RecyclerView
|
|
||||||
android:id="@+id/tabs"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_margin="0dp"
|
|
||||||
android:background="@color/gray_transparent">
|
|
||||||
|
|
||||||
</android.support.v7.widget.RecyclerView>
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/secondText"
|
android:id="@+id/secondText"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:paddingBottom="2dp"
|
android:paddingLeft="3dp"
|
||||||
android:paddingTop="2dp"
|
|
||||||
android:text="@string/chosenTabs"
|
android:text="@string/chosenTabs"
|
||||||
android:textAppearance="?android:attr/textAppearanceLarge" />
|
android:textAppearance="?android:attr/textAppearanceLarge" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/buttonAdd"
|
||||||
|
android:layout_width="20dp"
|
||||||
|
android:layout_height="20dp"
|
||||||
|
android:layout_alignParentRight="true"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:layout_marginRight="10dp"
|
||||||
|
android:background="@color/transparent_background_color"
|
||||||
|
android:paddingBottom="5dp"
|
||||||
|
android:paddingLeft="5dp"
|
||||||
|
android:paddingRight="15dp"
|
||||||
|
android:paddingTop="5dp" />
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
<android.support.v7.widget.RecyclerView
|
<android.support.v7.widget.RecyclerView
|
||||||
android:id="@+id/usedTabs"
|
android:id="@+id/usedTabs"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="match_parent"
|
||||||
android:layout_margin="0dp"
|
android:layout_margin="0dp" />
|
||||||
android:background="@color/gray_transparent" />
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/buttonLayout"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_alignParentBottom="true"
|
|
||||||
android:layout_alignParentEnd="true"
|
|
||||||
android:layout_alignParentRight="true"
|
|
||||||
android:layout_marginBottom="10dp"
|
|
||||||
android:orientation="horizontal"
|
|
||||||
android:padding="4dp">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/cancelText"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:padding="4dp"
|
|
||||||
android:paddingLeft="6dp"
|
|
||||||
android:paddingRight="6dp"
|
|
||||||
android:text="@string/cancel"
|
|
||||||
android:textColor="@color/black_settings_accent_color"
|
|
||||||
android:textStyle="bold" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/confirmText"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:padding="4dp"
|
|
||||||
android:text="@string/accept"
|
|
||||||
android:textColor="@color/black_settings_accent_color"
|
|
||||||
android:textStyle="bold" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
13
app/src/main/res/layout/dialog_contentsettingsadd.xml
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<android.support.v7.widget.RecyclerView
|
||||||
|
android:id="@+id/allTabs"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_margin="0dp" />
|
||||||
|
|
||||||
|
</RelativeLayout>
|
|
@ -8,18 +8,16 @@
|
||||||
android:id="@+id/tabName"
|
android:id="@+id/tabName"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="2dp"
|
android:layout_alignParentLeft="true"
|
||||||
|
android:layout_alignParentStart="true"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
android:layout_marginStart="0dp"
|
android:layout_marginStart="0dp"
|
||||||
android:paddingBottom="2dp"
|
android:layout_toLeftOf="@id/buttonDown"
|
||||||
android:paddingLeft="2dp"
|
android:layout_toStartOf="@id/buttonDown"
|
||||||
android:paddingStart="3dp"
|
android:paddingStart="3dp"
|
||||||
android:paddingTop="2dp"
|
|
||||||
android:textAppearance="?android:attr/textAppearanceListItem"
|
android:textAppearance="?android:attr/textAppearanceListItem"
|
||||||
android:textSize="24sp"
|
android:textSize="24sp"
|
||||||
android:layout_toStartOf="@id/buttonDown"
|
android:paddingLeft="3dp" />
|
||||||
android:layout_toLeftOf="@id/buttonDown"
|
|
||||||
android:layout_alignParentLeft="true"
|
|
||||||
android:layout_alignParentStart="true" />
|
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/buttonAddRemove"
|
android:id="@+id/buttonAddRemove"
|
||||||
|
|
|
@ -35,6 +35,7 @@
|
||||||
<attr name="ic_import_export" format="reference"/>
|
<attr name="ic_import_export" format="reference"/>
|
||||||
<attr name="ic_save" format="reference"/>
|
<attr name="ic_save" format="reference"/>
|
||||||
<attr name="ic_backup" format="reference"/>
|
<attr name="ic_backup" format="reference"/>
|
||||||
|
<attr name="ic_add" format="reference"/>
|
||||||
|
|
||||||
<!-- Can't refer to colors directly into drawable's xml-->
|
<!-- Can't refer to colors directly into drawable's xml-->
|
||||||
<attr name="toolbar_shadow_drawable" format="reference"/>
|
<attr name="toolbar_shadow_drawable" format="reference"/>
|
||||||
|
|
|
@ -51,6 +51,7 @@
|
||||||
<item name="ic_import_export">@drawable/ic_import_export_black_24dp</item>
|
<item name="ic_import_export">@drawable/ic_import_export_black_24dp</item>
|
||||||
<item name="ic_save">@drawable/ic_save_black_24dp</item>
|
<item name="ic_save">@drawable/ic_save_black_24dp</item>
|
||||||
<item name="ic_backup">@drawable/ic_backup_black_24dp</item>
|
<item name="ic_backup">@drawable/ic_backup_black_24dp</item>
|
||||||
|
<item name="ic_add">@drawable/ic_add_black_24dp</item>
|
||||||
|
|
||||||
<item name="separator_color">@color/light_separator_color</item>
|
<item name="separator_color">@color/light_separator_color</item>
|
||||||
<item name="contrast_background_color">@color/light_contrast_background_color</item>
|
<item name="contrast_background_color">@color/light_contrast_background_color</item>
|
||||||
|
@ -108,6 +109,7 @@
|
||||||
<item name="ic_import_export">@drawable/ic_import_export_white_24dp</item>
|
<item name="ic_import_export">@drawable/ic_import_export_white_24dp</item>
|
||||||
<item name="ic_save">@drawable/ic_save_white_24dp</item>
|
<item name="ic_save">@drawable/ic_save_white_24dp</item>
|
||||||
<item name="ic_backup">@drawable/ic_backup_white_24dp</item>
|
<item name="ic_backup">@drawable/ic_backup_white_24dp</item>
|
||||||
|
<item name="ic_add">@drawable/ic_add_white_24dp</item>
|
||||||
|
|
||||||
<item name="separator_color">@color/dark_separator_color</item>
|
<item name="separator_color">@color/dark_separator_color</item>
|
||||||
<item name="contrast_background_color">@color/dark_contrast_background_color</item>
|
<item name="contrast_background_color">@color/dark_contrast_background_color</item>
|
||||||
|
|
|
@ -43,7 +43,8 @@
|
||||||
android:title="@string/download_thumbnail_title"
|
android:title="@string/download_thumbnail_title"
|
||||||
android:summary="@string/download_thumbnail_summary"/>
|
android:summary="@string/download_thumbnail_summary"/>
|
||||||
|
|
||||||
<Preference
|
<PreferenceScreen
|
||||||
|
android:fragment="org.schabi.newpipe.settings.ContentSettingsMain"
|
||||||
android:summary="@string/main_page_content_summary"
|
android:summary="@string/main_page_content_summary"
|
||||||
android:key="@string/main_page_content_key"
|
android:key="@string/main_page_content_key"
|
||||||
android:title="@string/main_page_content"/>
|
android:title="@string/main_page_content"/>
|
||||||
|
|