Style OnlineFeedViewActivity like a dialog
User study showed that new users do not get the difference between the actual feed list and the preview. If the preview is a dialog, this is a lot easier to see. Additionally, the "dialog" now closes after the subscription succeeded.
This commit is contained in:
parent
363c3614f8
commit
8aff9709c3
|
@ -237,6 +237,7 @@
|
||||||
<activity
|
<activity
|
||||||
android:name=".activity.OnlineFeedViewActivity"
|
android:name=".activity.OnlineFeedViewActivity"
|
||||||
android:configChanges="orientation|screenSize"
|
android:configChanges="orientation|screenSize"
|
||||||
|
android:theme="@style/Theme.AntennaPod.Dark.Translucent"
|
||||||
android:label="@string/add_feed_label">
|
android:label="@string/add_feed_label">
|
||||||
<meta-data
|
<meta-data
|
||||||
android:name="android.support.PARENT_ACTIVITY"
|
android:name="android.support.PARENT_ACTIVITY"
|
||||||
|
|
|
@ -10,7 +10,6 @@ import android.os.Bundle;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.UiThread;
|
import androidx.annotation.UiThread;
|
||||||
import androidx.core.app.NavUtils;
|
import androidx.core.app.NavUtils;
|
||||||
import androidx.appcompat.app.ActionBar;
|
|
||||||
import androidx.appcompat.app.AlertDialog;
|
import androidx.appcompat.app.AlertDialog;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
@ -22,10 +21,8 @@ import android.widget.AdapterView;
|
||||||
import android.widget.ArrayAdapter;
|
import android.widget.ArrayAdapter;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.LinearLayout;
|
|
||||||
import android.widget.ListView;
|
import android.widget.ListView;
|
||||||
import android.widget.ProgressBar;
|
import android.widget.ProgressBar;
|
||||||
import android.widget.RelativeLayout;
|
|
||||||
import android.widget.Spinner;
|
import android.widget.Spinner;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
@ -98,10 +95,12 @@ public class OnlineFeedViewActivity extends AppCompatActivity {
|
||||||
private Downloader downloader;
|
private Downloader downloader;
|
||||||
|
|
||||||
private boolean isPaused;
|
private boolean isPaused;
|
||||||
|
private boolean didPressSubscribe = false;
|
||||||
|
|
||||||
private Dialog dialog;
|
private Dialog dialog;
|
||||||
|
private ListView listView;
|
||||||
private Button subscribeButton;
|
private Button subscribeButton;
|
||||||
|
private ProgressBar progressBar;
|
||||||
|
|
||||||
private Disposable download;
|
private Disposable download;
|
||||||
private Disposable parser;
|
private Disposable parser;
|
||||||
|
@ -109,18 +108,12 @@ public class OnlineFeedViewActivity extends AppCompatActivity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
setTheme(UserPreferences.getTheme());
|
setTheme(UserPreferences.getTranslucentTheme());
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
ActionBar actionBar = getSupportActionBar();
|
|
||||||
if (actionBar != null) {
|
|
||||||
actionBar.setDisplayHomeAsUpEnabled(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (actionBar != null && getIntent() != null && getIntent().hasExtra(ARG_TITLE)) {
|
|
||||||
actionBar.setTitle(getIntent().getStringExtra(ARG_TITLE));
|
|
||||||
}
|
|
||||||
|
|
||||||
StorageUtils.checkStorageAvailability(this);
|
StorageUtils.checkStorageAvailability(this);
|
||||||
|
setContentView(R.layout.onlinefeedview_activity);
|
||||||
|
listView = findViewById(R.id.listview);
|
||||||
|
progressBar = findViewById(R.id.progressBar);
|
||||||
|
|
||||||
String feedUrl = null;
|
String feedUrl = null;
|
||||||
if (getIntent().hasExtra(ARG_FEEDURL)) {
|
if (getIntent().hasExtra(ARG_FEEDURL)) {
|
||||||
|
@ -129,9 +122,6 @@ public class OnlineFeedViewActivity extends AppCompatActivity {
|
||||||
|| TextUtils.equals(getIntent().getAction(), Intent.ACTION_VIEW)) {
|
|| TextUtils.equals(getIntent().getAction(), Intent.ACTION_VIEW)) {
|
||||||
feedUrl = TextUtils.equals(getIntent().getAction(), Intent.ACTION_SEND)
|
feedUrl = TextUtils.equals(getIntent().getAction(), Intent.ACTION_SEND)
|
||||||
? getIntent().getStringExtra(Intent.EXTRA_TEXT) : getIntent().getDataString();
|
? getIntent().getStringExtra(Intent.EXTRA_TEXT) : getIntent().getDataString();
|
||||||
if (actionBar != null) {
|
|
||||||
actionBar.setTitle(R.string.add_feed_label);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (feedUrl == null) {
|
if (feedUrl == null) {
|
||||||
|
@ -156,19 +146,8 @@ public class OnlineFeedViewActivity extends AppCompatActivity {
|
||||||
* Displays a progress indicator.
|
* Displays a progress indicator.
|
||||||
*/
|
*/
|
||||||
private void setLoadingLayout() {
|
private void setLoadingLayout() {
|
||||||
RelativeLayout rl = new RelativeLayout(this);
|
progressBar.setVisibility(View.VISIBLE);
|
||||||
RelativeLayout.LayoutParams rlLayoutParams = new RelativeLayout.LayoutParams(
|
listView.setVisibility(View.GONE);
|
||||||
LinearLayout.LayoutParams.MATCH_PARENT,
|
|
||||||
LinearLayout.LayoutParams.MATCH_PARENT);
|
|
||||||
|
|
||||||
ProgressBar pb = new ProgressBar(this);
|
|
||||||
pb.setIndeterminate(true);
|
|
||||||
RelativeLayout.LayoutParams pbLayoutParams = new RelativeLayout.LayoutParams(
|
|
||||||
LinearLayout.LayoutParams.WRAP_CONTENT,
|
|
||||||
LinearLayout.LayoutParams.WRAP_CONTENT);
|
|
||||||
pbLayoutParams.addRule(RelativeLayout.CENTER_IN_PARENT);
|
|
||||||
rl.addView(pb, pbLayoutParams);
|
|
||||||
addContentView(rl, rlLayoutParams);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -221,6 +200,12 @@ public class OnlineFeedViewActivity extends AppCompatActivity {
|
||||||
setIntent(intent);
|
setIntent(intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void finish() {
|
||||||
|
super.finish();
|
||||||
|
overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
switch (item.getItemId()) {
|
switch (item.getItemId()) {
|
||||||
|
@ -291,7 +276,7 @@ public class OnlineFeedViewActivity extends AppCompatActivity {
|
||||||
.subscribe(
|
.subscribe(
|
||||||
feeds -> {
|
feeds -> {
|
||||||
OnlineFeedViewActivity.this.feeds = feeds;
|
OnlineFeedViewActivity.this.feeds = feeds;
|
||||||
setSubscribeButtonState(feed);
|
handleUpdatedFeedStatus(feed);
|
||||||
}, error -> Log.e(TAG, Log.getStackTraceString(error))
|
}, error -> Log.e(TAG, Log.getStackTraceString(error))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -299,7 +284,7 @@ public class OnlineFeedViewActivity extends AppCompatActivity {
|
||||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||||
public void onEventMainThread(DownloadEvent event) {
|
public void onEventMainThread(DownloadEvent event) {
|
||||||
Log.d(TAG, "onEventMainThread() called with: " + "event = [" + event + "]");
|
Log.d(TAG, "onEventMainThread() called with: " + "event = [" + event + "]");
|
||||||
setSubscribeButtonState(feed);
|
handleUpdatedFeedStatus(feed);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void parseFeed() {
|
private void parseFeed() {
|
||||||
|
@ -374,11 +359,10 @@ public class OnlineFeedViewActivity extends AppCompatActivity {
|
||||||
* This method is executed on the GUI thread.
|
* This method is executed on the GUI thread.
|
||||||
*/
|
*/
|
||||||
private void showFeedInformation(final Feed feed, Map<String, String> alternateFeedUrls) {
|
private void showFeedInformation(final Feed feed, Map<String, String> alternateFeedUrls) {
|
||||||
setContentView(R.layout.listview_activity);
|
progressBar.setVisibility(View.GONE);
|
||||||
|
listView.setVisibility(View.VISIBLE);
|
||||||
this.feed = feed;
|
this.feed = feed;
|
||||||
this.selectedDownloadUrl = feed.getDownload_url();
|
this.selectedDownloadUrl = feed.getDownload_url();
|
||||||
ListView listView = findViewById(R.id.listview);
|
|
||||||
listView.setSelector(android.R.color.transparent);
|
listView.setSelector(android.R.color.transparent);
|
||||||
LayoutInflater inflater = LayoutInflater.from(this);
|
LayoutInflater inflater = LayoutInflater.from(this);
|
||||||
View header = inflater.inflate(R.layout.onlinefeedview_header, listView, false);
|
View header = inflater.inflate(R.layout.onlinefeedview_header, listView, false);
|
||||||
|
@ -425,10 +409,7 @@ public class OnlineFeedViewActivity extends AppCompatActivity {
|
||||||
|
|
||||||
subscribeButton.setOnClickListener(v -> {
|
subscribeButton.setOnClickListener(v -> {
|
||||||
if (feedInFeedlist(feed)) {
|
if (feedInFeedlist(feed)) {
|
||||||
// feed.getId() is always 0, we have to retrieve the id from the feed list from
|
openFeed();
|
||||||
// the database
|
|
||||||
Intent intent = MainActivity.getIntentToOpenFeed(this, getFeedId(feed));
|
|
||||||
startActivity(intent);
|
|
||||||
} else {
|
} else {
|
||||||
Feed f = new Feed(selectedDownloadUrl, null, feed.getTitle());
|
Feed f = new Feed(selectedDownloadUrl, null, feed.getTitle());
|
||||||
f.setPreferences(feed.getPreferences());
|
f.setPreferences(feed.getPreferences());
|
||||||
|
@ -439,7 +420,8 @@ public class OnlineFeedViewActivity extends AppCompatActivity {
|
||||||
Log.e(TAG, Log.getStackTraceString(e));
|
Log.e(TAG, Log.getStackTraceString(e));
|
||||||
DownloadRequestErrorDialogCreator.newRequestErrorDialog(this, e.getMessage());
|
DownloadRequestErrorDialogCreator.newRequestErrorDialog(this, e.getMessage());
|
||||||
}
|
}
|
||||||
setSubscribeButtonState(feed);
|
didPressSubscribe = true;
|
||||||
|
handleUpdatedFeedStatus(feed);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -485,10 +467,18 @@ public class OnlineFeedViewActivity extends AppCompatActivity {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
setSubscribeButtonState(feed);
|
handleUpdatedFeedStatus(feed);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setSubscribeButtonState(Feed feed) {
|
private void openFeed() {
|
||||||
|
// feed.getId() is always 0, we have to retrieve the id from the feed list from
|
||||||
|
// the database
|
||||||
|
Intent intent = MainActivity.getIntentToOpenFeed(this, getFeedId(feed));
|
||||||
|
finish();
|
||||||
|
startActivity(intent);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void handleUpdatedFeedStatus(Feed feed) {
|
||||||
if (subscribeButton != null && feed != null) {
|
if (subscribeButton != null && feed != null) {
|
||||||
if (DownloadRequester.getInstance().isDownloadingFile(feed.getDownload_url())) {
|
if (DownloadRequester.getInstance().isDownloadingFile(feed.getDownload_url())) {
|
||||||
subscribeButton.setEnabled(false);
|
subscribeButton.setEnabled(false);
|
||||||
|
@ -496,6 +486,9 @@ public class OnlineFeedViewActivity extends AppCompatActivity {
|
||||||
} else if (feedInFeedlist(feed)) {
|
} else if (feedInFeedlist(feed)) {
|
||||||
subscribeButton.setEnabled(true);
|
subscribeButton.setEnabled(true);
|
||||||
subscribeButton.setText(R.string.open_podcast);
|
subscribeButton.setText(R.string.open_podcast);
|
||||||
|
if (didPressSubscribe) {
|
||||||
|
openFeed();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
subscribeButton.setEnabled(true);
|
subscribeButton.setEnabled(true);
|
||||||
subscribeButton.setText(R.string.subscribe_label);
|
subscribeButton.setText(R.string.subscribe_label);
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<androidx.cardview.widget.CardView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
app:cardCornerRadius="4dp"
|
||||||
|
android:layout_margin="16dp"
|
||||||
|
android:elevation="16dp">
|
||||||
|
|
||||||
|
<FrameLayout
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<ProgressBar
|
||||||
|
style="?android:attr/progressBarStyle"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:id="@+id/progressBar"
|
||||||
|
android:layout_gravity="center"/>
|
||||||
|
<ListView
|
||||||
|
android:id="@+id/listview"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"/>
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
|
</androidx.cardview.widget.CardView>
|
||||||
|
</LinearLayout>
|
|
@ -182,6 +182,17 @@ public class UserPreferences {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static int getTranslucentTheme() {
|
||||||
|
int theme = getTheme();
|
||||||
|
if (theme == R.style.Theme_AntennaPod_Dark) {
|
||||||
|
return R.style.Theme_AntennaPod_Dark_Translucent;
|
||||||
|
} else if (theme == R.style.Theme_AntennaPod_TrueBlack) {
|
||||||
|
return R.style.Theme_AntennaPod_TrueBlack_Translucent;
|
||||||
|
} else {
|
||||||
|
return R.style.Theme_AntennaPod_Light_Translucent;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static List<String> getHiddenDrawerItems() {
|
public static List<String> getHiddenDrawerItems() {
|
||||||
String hiddenItems = prefs.getString(PREF_HIDDEN_DRAWER_ITEMS, "");
|
String hiddenItems = prefs.getString(PREF_HIDDEN_DRAWER_ITEMS, "");
|
||||||
return new ArrayList<>(Arrays.asList(TextUtils.split(hiddenItems, ",")));
|
return new ArrayList<>(Arrays.asList(TextUtils.split(hiddenItems, ",")));
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources xmlns:android="http://schemas.android.com/apk/res/android">
|
<resources xmlns:tools="http://schemas.android.com/tools" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
<style name="Theme.AntennaPod.Light" parent="Theme.Base.AntennaPod.Light">
|
<style name="Theme.AntennaPod.Light" parent="Theme.Base.AntennaPod.Light">
|
||||||
<!-- Room for API dependent attributes -->
|
<!-- Room for API dependent attributes -->
|
||||||
|
@ -224,6 +224,43 @@
|
||||||
<item name="windowActionModeOverlay">true</item>
|
<item name="windowActionModeOverlay">true</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
<style name="Theme.AntennaPod.Light.Translucent" parent="Theme.AntennaPod.Light.NoTitle">
|
||||||
|
<item name="android:windowIsTranslucent">true</item>
|
||||||
|
<item name="android:windowBackground">@android:color/transparent</item>
|
||||||
|
<item name="android:background">@android:color/transparent</item>
|
||||||
|
<item name="android:windowContentOverlay">@null</item>
|
||||||
|
<item name="android:backgroundDimEnabled">true</item>
|
||||||
|
<item name="android:windowAnimationStyle">@style/AnimationFade</item>
|
||||||
|
<item name="android:windowTranslucentStatus" tools:targetApi="kitkat">true</item>
|
||||||
|
<item name="android:fitsSystemWindows">true</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="Theme.AntennaPod.Dark.Translucent" parent="Theme.AntennaPod.Dark.NoTitle">
|
||||||
|
<item name="android:windowIsTranslucent">true</item>
|
||||||
|
<item name="android:windowBackground">@android:color/transparent</item>
|
||||||
|
<item name="android:background">@android:color/transparent</item>
|
||||||
|
<item name="android:windowContentOverlay">@null</item>
|
||||||
|
<item name="android:backgroundDimEnabled">true</item>
|
||||||
|
<item name="android:windowAnimationStyle">@style/AnimationFade</item>
|
||||||
|
<item name="android:windowTranslucentStatus" tools:targetApi="kitkat">true</item>
|
||||||
|
<item name="android:fitsSystemWindows">true</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="Theme.AntennaPod.TrueBlack.Translucent" parent="Theme.Base.AntennaPod.TrueBlack">
|
||||||
|
<item name="android:windowIsTranslucent">true</item>
|
||||||
|
<item name="android:windowBackground">@android:color/transparent</item>
|
||||||
|
<item name="android:background">@android:color/transparent</item>
|
||||||
|
<item name="android:windowContentOverlay">@null</item>
|
||||||
|
<item name="android:backgroundDimEnabled">true</item>
|
||||||
|
<item name="android:windowAnimationStyle">@style/AnimationFade</item>
|
||||||
|
<item name="android:windowTranslucentStatus" tools:targetApi="kitkat">true</item>
|
||||||
|
<item name="android:fitsSystemWindows">true</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="AnimationFade">
|
||||||
|
<item name="android:windowEnterAnimation">@android:anim/fade_in</item>
|
||||||
|
<item name="android:windowExitAnimation">@android:anim/fade_out</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
<style name="Theme.AntennaPod.Dark.Splash" parent="Theme.AppCompat.NoActionBar">
|
<style name="Theme.AntennaPod.Dark.Splash" parent="Theme.AppCompat.NoActionBar">
|
||||||
<item name="android:windowBackground">@drawable/bg_splash</item>
|
<item name="android:windowBackground">@drawable/bg_splash</item>
|
||||||
|
|
Loading…
Reference in New Issue