Show "include in auto downloads" checkbox on adding podcast (#4627)

This commit is contained in:
asdoi 2020-11-04 10:18:44 +01:00 committed by GitHub
parent 6ef793a9ae
commit adcab6f983
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 57 additions and 26 deletions

View File

@ -13,6 +13,7 @@ import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.UiThread;
@ -509,11 +510,21 @@ public class OnlineFeedViewActivity extends AppCompatActivity {
viewBinding.subscribeButton.setEnabled(true);
viewBinding.subscribeButton.setText(R.string.open_podcast);
if (didPressSubscribe) {
didPressSubscribe = false;
if (UserPreferences.isEnableAutodownload()) {
Feed feed1 = DBReader.getFeed(getFeedId(feed));
FeedPreferences feedPreferences = feed1.getPreferences();
feedPreferences.setAutoDownload(viewBinding.autoDownloadCheckBox.isChecked());
feed1.savePreferences();
}
openFeed();
}
} else {
viewBinding.subscribeButton.setEnabled(true);
viewBinding.subscribeButton.setText(R.string.subscribe_label);
if (UserPreferences.isEnableAutodownload()) {
viewBinding.autoDownloadCheckBox.setVisibility(View.VISIBLE);
}
}
}
}

View File

@ -105,35 +105,55 @@
tools:text="Podcast author"/>
</RelativeLayout>
<Spinner
android:id="@+id/alternate_urls_spinner"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginTop="8dp"
android:padding="8dp"
android:textColor="?android:attr/textColorPrimary"
android:textSize="@dimen/text_size_micro"/>
<Button
android:id="@+id/subscribeButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:focusable="false"
android:text="@string/subscribe_label"/>
<Button
android:id="@+id/stopPreviewButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:layout_marginBottom="16dp"
android:focusable="false"
android:text="@string/stop_preview"
android:visibility="gone" />
android:orientation="vertical">
<Spinner
android:id="@+id/alternate_urls_spinner"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:padding="8dp"
android:textColor="?android:attr/textColorPrimary"
android:textSize="@dimen/text_size_micro" />
<Button
android:id="@+id/subscribeButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="8dp"
android:focusable="false"
android:text="@string/subscribe_label" />
<CheckBox
android:id="@+id/autoDownloadCheckBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:focusable="false"
android:checked="true"
android:text="@string/auto_download_label"
android:visibility="gone"
tools:visibility="visible" />
<Button
android:id="@+id/stopPreviewButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:focusable="false"
android:text="@string/stop_preview"
android:visibility="gone"
tools:visibility="visible" />
</LinearLayout>
<ListView
android:id="@+id/listView"