Redesigned add feed page
This commit is contained in:
parent
eaa1527fac
commit
c7f92b7c71
@ -114,6 +114,10 @@ android {
|
|||||||
dexOptions {
|
dexOptions {
|
||||||
jumboMode true
|
jumboMode true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dataBinding {
|
||||||
|
enabled = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
@ -2,13 +2,20 @@ package de.danoeh.antennapod.fragment;
|
|||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.provider.MediaStore;
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
|
import android.view.ContextMenu;
|
||||||
|
import android.view.KeyEvent;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.view.inputmethod.EditorInfo;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
|
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.TextView;
|
||||||
import de.danoeh.antennapod.R;
|
import de.danoeh.antennapod.R;
|
||||||
import de.danoeh.antennapod.activity.MainActivity;
|
import de.danoeh.antennapod.activity.MainActivity;
|
||||||
import de.danoeh.antennapod.activity.OnlineFeedViewActivity;
|
import de.danoeh.antennapod.activity.OnlineFeedViewActivity;
|
||||||
@ -27,11 +34,28 @@ public class AddFeedFragment extends Fragment {
|
|||||||
*/
|
*/
|
||||||
private static final String ARG_FEED_URL = "feedurl";
|
private static final String ARG_FEED_URL = "feedurl";
|
||||||
|
|
||||||
|
private EditText combinedFeedSearchBox;
|
||||||
|
private MainActivity activity;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
super.onCreateView(inflater, container, savedInstanceState);
|
super.onCreateView(inflater, container, savedInstanceState);
|
||||||
View root = inflater.inflate(R.layout.addfeed, container, false);
|
View root = inflater.inflate(R.layout.addfeed, container, false);
|
||||||
|
|
||||||
|
activity = (MainActivity) getActivity();
|
||||||
|
activity.getSupportActionBar().setTitle(R.string.add_feed_label);
|
||||||
|
|
||||||
|
setupAdvancedSearchButtons(root);
|
||||||
|
setupSeachBox(root);
|
||||||
|
|
||||||
|
View butOpmlImport = root.findViewById(R.id.btn_opml_import);
|
||||||
|
butOpmlImport.setOnClickListener(v -> startActivity(new Intent(getActivity(),
|
||||||
|
OpmlImportFromPathActivity.class)));
|
||||||
|
|
||||||
|
return root;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setupSeachBox(View root) {
|
||||||
final EditText etxtFeedurl = root.findViewById(R.id.etxtFeedurl);
|
final EditText etxtFeedurl = root.findViewById(R.id.etxtFeedurl);
|
||||||
|
|
||||||
Bundle args = getArguments();
|
Bundle args = getArguments();
|
||||||
@ -39,35 +63,69 @@ public class AddFeedFragment extends Fragment {
|
|||||||
etxtFeedurl.setText(args.getString(ARG_FEED_URL));
|
etxtFeedurl.setText(args.getString(ARG_FEED_URL));
|
||||||
}
|
}
|
||||||
|
|
||||||
Button butSearchITunes = root.findViewById(R.id.butSearchItunes);
|
Button butConfirmAddUrl = root.findViewById(R.id.butConfirm);
|
||||||
Button butBrowserGpoddernet = root.findViewById(R.id.butBrowseGpoddernet);
|
butConfirmAddUrl.setOnClickListener(v -> {
|
||||||
Button butSearchFyyd = root.findViewById(R.id.butSearchFyyd);
|
addUrl(etxtFeedurl.getText().toString());
|
||||||
Button butSearchCombined = root.findViewById(R.id.butSearchCombined);
|
|
||||||
Button butOpmlImport = root.findViewById(R.id.butOpmlImport);
|
|
||||||
Button butConfirm = root.findViewById(R.id.butConfirm);
|
|
||||||
|
|
||||||
final MainActivity activity = (MainActivity) getActivity();
|
|
||||||
activity.getSupportActionBar().setTitle(R.string.add_feed_label);
|
|
||||||
|
|
||||||
butSearchITunes.setOnClickListener(v -> activity.loadChildFragment(new ItunesSearchFragment()));
|
|
||||||
|
|
||||||
butBrowserGpoddernet.setOnClickListener(v -> activity.loadChildFragment(new GpodnetMainFragment()));
|
|
||||||
|
|
||||||
butSearchFyyd.setOnClickListener(v -> activity.loadChildFragment(new FyydSearchFragment()));
|
|
||||||
|
|
||||||
butSearchCombined.setOnClickListener(v -> activity.loadChildFragment(new CombinedSearchFragment()));
|
|
||||||
|
|
||||||
butOpmlImport.setOnClickListener(v -> startActivity(new Intent(getActivity(),
|
|
||||||
OpmlImportFromPathActivity.class)));
|
|
||||||
|
|
||||||
butConfirm.setOnClickListener(v -> {
|
|
||||||
Intent intent = new Intent(getActivity(), OnlineFeedViewActivity.class);
|
|
||||||
intent.putExtra(OnlineFeedViewActivity.ARG_FEEDURL, etxtFeedurl.getText().toString());
|
|
||||||
intent.putExtra(OnlineFeedViewActivity.ARG_TITLE, getString(R.string.add_feed_label));
|
|
||||||
startActivity(intent);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return root;
|
combinedFeedSearchBox = root.findViewById(R.id.combinedFeedSearchBox);
|
||||||
|
combinedFeedSearchBox.setOnEditorActionListener((v, actionId, event) -> {
|
||||||
|
if (actionId == EditorInfo.IME_ACTION_SEARCH) {
|
||||||
|
performSearch();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setupAdvancedSearchButtons(View root) {
|
||||||
|
View butAdvancedSearch = root.findViewById(R.id.advanced_search);
|
||||||
|
registerForContextMenu(butAdvancedSearch);
|
||||||
|
butAdvancedSearch.setOnClickListener(v -> butAdvancedSearch.showContextMenu());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
|
||||||
|
getActivity().getMenuInflater().inflate(R.menu.advanced_search, menu);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onContextItemSelected(MenuItem item) {
|
||||||
|
switch (item.getItemId()) {
|
||||||
|
case R.id.search_fyyd:
|
||||||
|
activity.loadChildFragment(new FyydSearchFragment());
|
||||||
|
return true;
|
||||||
|
case R.id.search_gpodder:
|
||||||
|
activity.loadChildFragment(new GpodnetMainFragment());
|
||||||
|
return true;
|
||||||
|
case R.id.search_itunes:
|
||||||
|
activity.loadChildFragment(new ItunesSearchFragment());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void addUrl(String url) {
|
||||||
|
Intent intent = new Intent(getActivity(), OnlineFeedViewActivity.class);
|
||||||
|
intent.putExtra(OnlineFeedViewActivity.ARG_FEEDURL, url);
|
||||||
|
intent.putExtra(OnlineFeedViewActivity.ARG_TITLE, getString(R.string.add_feed_label));
|
||||||
|
startActivity(intent);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void performSearch() {
|
||||||
|
String query = combinedFeedSearchBox.getText().toString();
|
||||||
|
|
||||||
|
if (query.startsWith("http")) {
|
||||||
|
addUrl(query);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Bundle bundle = new Bundle();
|
||||||
|
bundle.putString(CombinedSearchFragment.ARGUMENT_QUERY, query);
|
||||||
|
CombinedSearchFragment fragment = new CombinedSearchFragment();
|
||||||
|
fragment.setArguments(bundle);
|
||||||
|
activity.loadChildFragment(fragment);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -30,6 +30,7 @@ import java.util.List;
|
|||||||
public class CombinedSearchFragment extends Fragment {
|
public class CombinedSearchFragment extends Fragment {
|
||||||
|
|
||||||
private static final String TAG = "CombinedSearchFragment";
|
private static final String TAG = "CombinedSearchFragment";
|
||||||
|
public static final String ARGUMENT_QUERY = "query";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adapter responsible with the search results
|
* Adapter responsible with the search results
|
||||||
@ -128,6 +129,10 @@ public class CombinedSearchFragment extends Fragment {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
MenuItemCompat.expandActionView(searchItem);
|
MenuItemCompat.expandActionView(searchItem);
|
||||||
|
|
||||||
|
if (getArguments() != null && getArguments().getString(ARGUMENT_QUERY, null) != null) {
|
||||||
|
sv.setQuery(getArguments().getString(ARGUMENT_QUERY, null), true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void search(String query) {
|
private void search(String query) {
|
||||||
|
@ -1,106 +1,172 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<ScrollView
|
<layout
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="match_parent"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:layout_height="match_parent"
|
>
|
||||||
android:scrollbars="vertical">
|
|
||||||
|
|
||||||
<LinearLayout
|
<ScrollView
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:paddingBottom="8dp"
|
|
||||||
android:paddingLeft="16dp"
|
|
||||||
android:paddingRight="16dp"
|
|
||||||
android:paddingTop="8dp">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/txtvPodcastDirectories"
|
|
||||||
style="@style/AntennaPod.TextView.Heading"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="match_parent"
|
||||||
android:text="@string/podcastdirectories_label"/>
|
android:scrollbars="vertical">
|
||||||
|
|
||||||
<TextView
|
<LinearLayout
|
||||||
android:id="@+id/txtvPodcastDirectoriesDescr"
|
android:layout_width="match_parent"
|
||||||
android:layout_width="match_parent"
|
android:layout_height="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:orientation="vertical"
|
||||||
android:text="@string/podcastdirectories_descr"
|
android:padding="8dp">
|
||||||
android:textSize="@dimen/text_size_medium"/>
|
|
||||||
|
|
||||||
<Button
|
<android.support.v7.widget.CardView
|
||||||
android:id="@+id/butSearchCombined"
|
android:layout_width="match_parent"
|
||||||
android:layout_width="match_parent"
|
android:layout_height="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
app:cardCornerRadius="4dp"
|
||||||
android:layout_marginTop="4dp"
|
android:elevation="16dp"
|
||||||
android:text="Search all providers"/>
|
android:layout_margin="8dp">
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<Button
|
<ImageView
|
||||||
android:id="@+id/butSearchItunes"
|
android:layout_width="40dp"
|
||||||
android:layout_width="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:contentDescription="@string/search_podcast_hint"
|
||||||
android:text="@string/search_itunes_label"/>
|
app:srcCompat="?attr/action_search"
|
||||||
|
android:scaleType="center"/>
|
||||||
|
|
||||||
<Button
|
<EditText
|
||||||
android:id="@+id/butSearchFyyd"
|
android:id="@+id/combinedFeedSearchBox"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/search_fyyd_label"/>
|
android:layout_weight="1"
|
||||||
|
android:inputType="text"
|
||||||
|
android:imeOptions="actionSearch"
|
||||||
|
android:importantForAutofill="no"
|
||||||
|
android:layout_marginLeft="8dp"
|
||||||
|
android:layout_marginRight="8dp"
|
||||||
|
android:paddingTop="16dp"
|
||||||
|
android:paddingBottom="16dp"
|
||||||
|
android:hint="@string/search_podcast_hint"
|
||||||
|
android:background="@null"/>
|
||||||
|
|
||||||
<Button
|
</LinearLayout>
|
||||||
android:id="@+id/butBrowseGpoddernet"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/browse_gpoddernet_label"/>
|
|
||||||
|
|
||||||
<View style="@style/Divider"/>
|
</android.support.v7.widget.CardView>
|
||||||
|
|
||||||
<TextView
|
<android.support.v7.widget.CardView
|
||||||
android:id="@+id/txtvFeedurl"
|
android:layout_width="match_parent"
|
||||||
style="@style/AntennaPod.TextView.Heading"
|
android:layout_height="wrap_content"
|
||||||
android:layout_width="match_parent"
|
app:cardCornerRadius="4dp"
|
||||||
android:layout_height="wrap_content"
|
android:elevation="8dp"
|
||||||
android:text="@string/txtvfeedurl_label"/>
|
android:layout_margin="8dp">
|
||||||
|
|
||||||
<EditText
|
<LinearLayout
|
||||||
android:id="@+id/etxtFeedurl"
|
android:layout_width="match_parent"
|
||||||
android:layout_width="match_parent"
|
android:layout_height="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:padding="8dp"
|
||||||
android:cursorVisible="true"
|
android:orientation="vertical">
|
||||||
android:focusable="true"
|
|
||||||
android:focusableInTouchMode="true"
|
|
||||||
android:hint="@string/etxtFeedurlHint"
|
|
||||||
android:inputType="textUri"/>
|
|
||||||
|
|
||||||
<Button
|
<TextView
|
||||||
android:id="@+id/butConfirm"
|
android:id="@+id/txtvFeedurl"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/confirm_label"/>
|
android:text="@string/txtvfeedurl_label"
|
||||||
|
android:textSize="18sp"
|
||||||
|
android:layout_marginBottom="8dp"
|
||||||
|
android:textColor="?android:attr/textColorPrimary"/>
|
||||||
|
|
||||||
<View style="@style/Divider"/>
|
<EditText
|
||||||
|
android:id="@+id/etxtFeedurl"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:cursorVisible="true"
|
||||||
|
android:focusable="true"
|
||||||
|
android:focusableInTouchMode="true"
|
||||||
|
android:hint="@string/etxtFeedurlHint"
|
||||||
|
android:inputType="textUri"/>
|
||||||
|
|
||||||
<TextView
|
<Button
|
||||||
android:id="@+id/txtvOpmlImport"
|
android:id="@+id/butConfirm"
|
||||||
style="@style/AntennaPod.TextView.Heading"
|
android:layout_width="match_parent"
|
||||||
android:layout_width="match_parent"
|
android:layout_height="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:text="@string/confirm_label"/>
|
||||||
android:text="@string/opml_import_label"/>
|
|
||||||
|
|
||||||
<TextView
|
</LinearLayout>
|
||||||
android:id="@+id/txtvOpmlImportExpl"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/opml_import_txtv_button_lable"
|
|
||||||
android:textSize="@dimen/text_size_medium"/>
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/butOpmlImport"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="4dp"
|
|
||||||
android:text="@string/opml_import_label"/>
|
|
||||||
|
|
||||||
</LinearLayout>
|
</android.support.v7.widget.CardView>
|
||||||
|
|
||||||
</ScrollView>
|
|
||||||
|
<android.support.v7.widget.CardView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:cardCornerRadius="4dp"
|
||||||
|
android:elevation="8dp"
|
||||||
|
android:layout_margin="8dp">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_horizontal"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/advanced_search"
|
||||||
|
android:layout_width="96dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:gravity="center_horizontal"
|
||||||
|
android:padding="16dp"
|
||||||
|
android:background="?android:attr/selectableItemBackground">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="40dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:contentDescription="@string/advanced_search"
|
||||||
|
app:srcCompat="?attr/action_search"
|
||||||
|
android:scaleType="center"
|
||||||
|
android:layout_marginBottom="4dp"
|
||||||
|
android:tint="?android:attr/textColorPrimary"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/advanced_search"
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:textColor="?android:attr/textColorPrimary"/>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/btn_opml_import"
|
||||||
|
android:layout_width="96dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:gravity="center_horizontal"
|
||||||
|
android:padding="16dp"
|
||||||
|
android:background="?android:attr/selectableItemBackground">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="40dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:contentDescription="@string/opml_import_label"
|
||||||
|
app:srcCompat="?attr/av_download"
|
||||||
|
android:scaleType="center"
|
||||||
|
android:layout_marginBottom="4dp"
|
||||||
|
android:tint="?android:attr/textColorPrimary"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/opml_import_label"
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:textColor="?android:attr/textColorPrimary"/>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
</android.support.v7.widget.CardView>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</ScrollView>
|
||||||
|
</layout>
|
14
app/src/main/res/menu/advanced_search.xml
Normal file
14
app/src/main/res/menu/advanced_search.xml
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
|
<item
|
||||||
|
android:id="@+id/search_itunes"
|
||||||
|
android:title="@string/search_itunes_label" />
|
||||||
|
<item
|
||||||
|
android:id="@+id/search_gpodder"
|
||||||
|
android:title="@string/browse_gpoddernet_label" />
|
||||||
|
<item
|
||||||
|
android:id="@+id/search_fyyd"
|
||||||
|
android:title="@string/search_fyyd_label" />
|
||||||
|
|
||||||
|
</menu>
|
@ -658,10 +658,13 @@
|
|||||||
<!-- AntennaPodSP -->
|
<!-- AntennaPodSP -->
|
||||||
<string name="sp_apps_importing_feeds_msg">Importing subscriptions from single-purpose apps…</string>
|
<string name="sp_apps_importing_feeds_msg">Importing subscriptions from single-purpose apps…</string>
|
||||||
|
|
||||||
|
<!-- Add podcast fragment -->
|
||||||
|
<string name="search_podcast_hint">Search podcast…</string>
|
||||||
<string name="search_itunes_label">Search iTunes</string>
|
<string name="search_itunes_label">Search iTunes</string>
|
||||||
<string name="filter">Filter</string>
|
|
||||||
|
|
||||||
<string name="search_fyyd_label">Search fyyd</string>
|
<string name="search_fyyd_label">Search fyyd</string>
|
||||||
|
<string name="advanced_search">Advanced search</string>
|
||||||
|
|
||||||
|
<string name="filter">Filter</string>
|
||||||
|
|
||||||
<!-- Episodes apply actions -->
|
<!-- Episodes apply actions -->
|
||||||
<string name="all_label">All</string>
|
<string name="all_label">All</string>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user