Peertube NSFW filter
This commit is contained in:
parent
155a56dac5
commit
f5a10775b9
|
@ -729,7 +729,9 @@ public class PeertubeAPI {
|
|||
params.put("sort","publishedAt");
|
||||
if( filter != null)
|
||||
params.put("filter",filter);
|
||||
|
||||
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||
boolean nsfw = sharedpreferences.getBoolean(Helper.SET_VIDEO_NSFW, false);
|
||||
params.put("nsfw", String.valueOf(nsfw));
|
||||
List<Peertube> peertubes = new ArrayList<>();
|
||||
try {
|
||||
HttpsConnection httpsConnection = new HttpsConnection(context);
|
||||
|
|
|
@ -24,6 +24,7 @@ import android.view.View;
|
|||
import android.view.ViewGroup;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.Spinner;
|
||||
|
||||
import fr.gouv.etalab.mastodon.R;
|
||||
|
@ -87,6 +88,20 @@ public class SettingsPeertubeFragment extends Fragment {
|
|||
|
||||
}
|
||||
});
|
||||
|
||||
boolean video_nsfw = sharedpreferences.getBoolean(Helper.SET_VIDEO_NSFW, false);
|
||||
final CheckBox set_video_nsfw = rootView.findViewById(R.id.set_video_nsfw);
|
||||
set_video_nsfw.setChecked(video_nsfw);
|
||||
|
||||
set_video_nsfw.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||
editor.putBoolean(Helper.SET_VIDEO_NSFW, set_video_nsfw.isChecked());
|
||||
editor.apply();
|
||||
}
|
||||
});
|
||||
|
||||
return rootView;
|
||||
}
|
||||
|
||||
|
|
|
@ -272,6 +272,7 @@ public class Helper {
|
|||
public static final String SET_LED_COLOUR = "set_led_colour";
|
||||
public static final String SET_SHOW_BOOSTS = "set_show_boost";
|
||||
public static final String SET_SHOW_REPLIES = "set_show_replies";
|
||||
public static final String SET_VIDEO_NSFW = "set_video_nsfw";
|
||||
public static final String INSTANCE_VERSION = "instance_version";
|
||||
public static final String SET_LIVE_NOTIFICATIONS = "set_live_notifications";
|
||||
public static final String SET_DISABLE_GIF = "set_disable_gif";
|
||||
|
|
|
@ -15,16 +15,26 @@
|
|||
You should have received a copy of the GNU General Public License along with Mastalab; if not,
|
||||
see <http://www.gnu.org/licenses>.
|
||||
-->
|
||||
<ScrollView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/swipeContainer"
|
||||
android:paddingLeft="@dimen/drawer_padding"
|
||||
android:paddingRight="@dimen/drawer_padding"
|
||||
android:layout_marginLeft="@dimen/fab_margin"
|
||||
android:layout_marginRight="@dimen/fab_margin"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginStart="@dimen/fab_margin"
|
||||
android:layout_marginEnd="@dimen/fab_margin">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingLeft="@dimen/fab_margin"
|
||||
android:paddingRight="@dimen/fab_margin"
|
||||
android:orientation="vertical"
|
||||
tools:ignore="UselessParent">
|
||||
<!-- Choose stream -->
|
||||
<LinearLayout
|
||||
android:layout_marginTop="10dp"
|
||||
|
@ -42,6 +52,15 @@
|
|||
android:layout_height="wrap_content" />
|
||||
</LinearLayout>
|
||||
|
||||
<!-- DISPLAY NSFW VIDEOS -->
|
||||
<CheckBox
|
||||
android:layout_marginTop="10dp"
|
||||
android:id="@+id/set_video_nsfw"
|
||||
android:layout_width="wrap_content"
|
||||
android:text="@string/display_nsfw_videos"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</ScrollView>
|
||||
|
||||
|
|
|
@ -817,6 +817,7 @@
|
|||
<string name="delete_video">Delete video</string>
|
||||
<string name="delete_video_confirmation">Are you sure to delete this video?</string>
|
||||
<string name="no_video_uploaded">No videos uploaded yet!</string>
|
||||
<string name="display_nsfw_videos">Display NSFW videos</string>
|
||||
<!-- end languages -->
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue