Subscribe to change settings text
This commit is contained in:
parent
0e6a7ea206
commit
f0b0c68374
|
@ -495,7 +495,6 @@ public class FeedItemlistFragment extends Fragment implements AdapterView.OnItem
|
|||
boolean isSubscribed = feed.getState() == Feed.STATE_SUBSCRIBED;
|
||||
viewBinding.header.butShowInfo.setVisibility(isSubscribed ? View.VISIBLE : View.GONE);
|
||||
viewBinding.header.butFilter.setVisibility(isSubscribed ? View.VISIBLE : View.GONE);
|
||||
viewBinding.header.butShowSettings.setVisibility(isSubscribed ? View.VISIBLE : View.GONE);
|
||||
viewBinding.header.butSubscribe.setVisibility(isSubscribed ? View.GONE : View.VISIBLE);
|
||||
}
|
||||
|
||||
|
@ -517,6 +516,10 @@ public class FeedItemlistFragment extends Fragment implements AdapterView.OnItem
|
|||
});
|
||||
viewBinding.header.butShowSettings.setOnClickListener(v -> {
|
||||
if (feed != null) {
|
||||
if (feed.getState() != Feed.STATE_SUBSCRIBED) {
|
||||
EventBus.getDefault().post(new MessageEvent(getString(R.string.subscribe_for_settings)));
|
||||
return;
|
||||
}
|
||||
FeedSettingsFragment fragment = FeedSettingsFragment.newInstance(feed);
|
||||
((MainActivity) getActivity()).loadChildFragment(fragment, TransitionEffect.SLIDE);
|
||||
}
|
||||
|
|
|
@ -6,10 +6,15 @@ import android.text.TextUtils;
|
|||
import android.util.Log;
|
||||
import android.widget.Toast;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import com.google.android.material.snackbar.Snackbar;
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.databinding.OnlinefeedviewActivityBinding;
|
||||
import de.danoeh.antennapod.event.MessageEvent;
|
||||
import de.danoeh.antennapod.ui.common.ThemeSwitcher;
|
||||
import de.danoeh.antennapod.ui.common.ThemeUtils;
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
import static de.danoeh.antennapod.ui.appstartintent.OnlineFeedviewActivityStarter.ARG_FEEDURL;
|
||||
import static de.danoeh.antennapod.ui.appstartintent.OnlineFeedviewActivityStarter.ARG_STARTED_FROM_SEARCH;
|
||||
|
@ -72,4 +77,26 @@ public class OnlineFeedViewActivity extends AppCompatActivity {
|
|||
super.finish();
|
||||
overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
EventBus.getDefault().register(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
EventBus.getDefault().unregister(this);
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onEventMainThread(MessageEvent event) {
|
||||
Log.d(TAG, "onEvent(" + event + ")");
|
||||
Snackbar snackbar = Snackbar.make(findViewById(R.id.fragmentContainer), event.message, Snackbar.LENGTH_LONG);
|
||||
if (event.action != null) {
|
||||
snackbar.setAction(event.actionText, v -> event.action.accept(this));
|
||||
}
|
||||
snackbar.show();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,6 +28,14 @@
|
|||
android:layout_width="148dp"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/butSubscribe"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/subscribe_label"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/butShowInfo"
|
||||
android:layout_width="40dp"
|
||||
|
@ -38,6 +46,7 @@
|
|||
android:layout_marginStart="-8dp"
|
||||
android:scaleType="fitXY"
|
||||
android:padding="8dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
app:srcCompat="@drawable/ic_info_white"
|
||||
tools:visibility="visible" />
|
||||
|
||||
|
@ -49,6 +58,7 @@
|
|||
android:contentDescription="@string/filter"
|
||||
android:scaleType="fitXY"
|
||||
android:padding="8dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
app:srcCompat="@drawable/ic_filter_white"
|
||||
tools:visibility="visible" />
|
||||
|
||||
|
@ -60,17 +70,10 @@
|
|||
android:contentDescription="@string/show_feed_settings_label"
|
||||
android:scaleType="fitXY"
|
||||
android:padding="8dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
app:srcCompat="@drawable/ic_settings_white"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/butSubscribe"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/subscribe_label"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
|
|
|
@ -682,6 +682,7 @@
|
|||
<!-- Online feed view -->
|
||||
<string name="subscribe_label">Subscribe</string>
|
||||
<string name="preview_episodes">Preview episodes</string>
|
||||
<string name="subscribe_for_settings">Subscribe to change settings</string>
|
||||
|
||||
<!-- Content descriptions for image buttons -->
|
||||
<string name="toolbar_back_button_content_description">Back</string>
|
||||
|
|
Loading…
Reference in New Issue