Skip to content

Commit

Permalink
add «Always expand description» in appearance settings, closes #1113
Browse files Browse the repository at this point in the history
  • Loading branch information
B0pol committed Feb 23, 2020
1 parent 8c3be2c commit 0e1d9c7
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,6 @@
import android.os.Build;
import android.os.Bundle;
import android.preference.PreferenceManager;
import androidx.annotation.DrawableRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.google.android.material.appbar.AppBarLayout;
import com.google.android.material.tabs.TabLayout;
import androidx.fragment.app.Fragment;
import androidx.core.content.ContextCompat;
import androidx.viewpager.widget.ViewPager;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import android.text.Html;
import android.text.Spanned;
import android.text.TextUtils;
Expand All @@ -43,6 +32,18 @@
import android.widget.TextView;
import android.widget.Toast;

import androidx.annotation.DrawableRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.Fragment;
import androidx.viewpager.widget.ViewPager;

import com.google.android.material.appbar.AppBarLayout;
import com.google.android.material.tabs.TabLayout;
import com.nostra13.universalimageloader.core.assist.FailReason;
import com.nostra13.universalimageloader.core.listener.ImageLoadingListener;
import com.nostra13.universalimageloader.core.listener.SimpleImageLoadingListener;
Expand Down Expand Up @@ -121,6 +122,7 @@ public class VideoDetailFragment
private boolean autoPlayEnabled;
private boolean showRelatedStreams;
private boolean showComments;
private boolean showDescriptionOnLoad;
private String selectedTabTag;

@State
Expand Down Expand Up @@ -965,6 +967,11 @@ private void setHeightThumbnail() {

private void showContent() {
contentRootLayoutHiding.setVisibility(View.VISIBLE);
showDescriptionOnLoad = PreferenceManager.getDefaultSharedPreferences(activity)
.getBoolean(getString(R.string.always_expand_description_key), false);
if (showDescriptionOnLoad) {
toggleTitleAndDescription();
}
}

protected void setInitialData(int serviceId, String url, String name) {
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values/settings_keys.xml
Original file line number Diff line number Diff line change
Expand Up @@ -953,5 +953,5 @@
<item>@string/list</item>
<item>@string/grid</item>
</string-array>

<string name="always_expand_description_key" translatable="false">always_expand_description</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -589,4 +589,5 @@
<string name="downloads_storage_use_saf_title">Use SAF</string>
<string name="downloads_storage_use_saf_summary">The Storage Access Framework allows downloads to an external SD card.\nNote: some devices are not compatible</string>
<string name="choose_instance_prompt">Choose an instance</string>
<string name="always_expand_description">Always expand description</string>
</resources>
5 changes: 5 additions & 0 deletions app/src/main/res/xml/appearance_settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,9 @@
android:key="@string/main_page_content_key"
android:title="@string/main_page_content"/>

<SwitchPreference
app:iconSpaceReserved="false"
android:defaultValue="false"
android:key="@string/always_expand_description_key"
android:title="@string/always_expand_description"/>
</PreferenceScreen>

0 comments on commit 0e1d9c7

Please sign in to comment.