Revert "Remove string"

This reverts commit a9978f8f
This commit is contained in:
Boyd 2019-11-17 11:29:39 +01:00 committed by Thomas
parent e40d465a34
commit 932fa5111a
5 changed files with 77 additions and 6 deletions

View File

@ -127,6 +127,7 @@ public class SlideMediaActivity extends BaseActivity implements OnDownloadInterf
fullscreen = false;
media_description = findViewById(R.id.media_description);
final int med_desc_timeout = sharedpreferences.getInt(Helper.SET_MED_DESC_TIMEOUT, 3) * 1000;
flags = getWindow().getDecorView().getSystemUiVisibility();
swipeEnabled = true;
@ -214,7 +215,7 @@ public class SlideMediaActivity extends BaseActivity implements OnDownloadInterf
public void run() {
media_description.setVisibility(View.GONE);
}
}, 3000);
}, med_desc_timeout);
} else {
media_description.setVisibility(View.GONE);
@ -241,7 +242,7 @@ public class SlideMediaActivity extends BaseActivity implements OnDownloadInterf
public void run() {
media_description.setVisibility(View.GONE);
}
}, 3000);
}, med_desc_timeout);
} else {
media_description.setVisibility(View.GONE);
@ -275,6 +276,9 @@ public class SlideMediaActivity extends BaseActivity implements OnDownloadInterf
@Override
public boolean dispatchTouchEvent(MotionEvent event) {
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
final int med_desc_timeout = sharedpreferences.getInt(Helper.SET_MED_DESC_TIMEOUT, 3) * 1000;
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
startX = event.getX();
@ -300,7 +304,7 @@ public class SlideMediaActivity extends BaseActivity implements OnDownloadInterf
public void run() {
media_description.setVisibility(View.GONE);
}
}, 3000);
}, med_desc_timeout);
} else {
media_description.setVisibility(View.GONE);

View File

@ -1605,6 +1605,38 @@ public class ContentSettingsFragment extends Fragment implements OnRetrieveRemot
});
// Media Description Timeout
SeekBar medDescTimeoutSeekBar = rootView.findViewById(R.id.set_med_desc_timeout);
final TextView set_med_desc_timeout_value = rootView.findViewById(R.id.set_med_desc_timeout_value);
medDescTimeoutSeekBar.setMax(30);
int medDescTimeout = sharedpreferences.getInt(Helper.SET_MED_DESC_TIMEOUT, 3);
medDescTimeoutSeekBar.setProgress(medDescTimeout);
set_med_desc_timeout_value.setText(String.valueOf(medDescTimeout));
medDescTimeoutSeekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
}
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
set_med_desc_timeout_value.setText(String.valueOf(progress));
SharedPreferences.Editor editor = sharedpreferences.edit();
editor.putInt(Helper.SET_MED_DESC_TIMEOUT, progress);
editor.apply();
}
});
LinearLayout toot_visibility_container = rootView.findViewById(R.id.toot_visibility_container);
SQLiteDatabase db = Sqlite.getInstance(context, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();

View File

@ -338,6 +338,7 @@ public class Helper {
public static final String SET_AUTO_STORE = "set_auto_store";
public static final String SET_POPUP_PUSH = "set_popup_push_new";
public static final String SET_NSFW_TIMEOUT = "set_nsfw_timeout";
public static final String SET_MED_DESC_TIMEOUT = "set_med_desc_timeout";
public static final String SET_MEDIA_URLS = "set_media_urls";
public static final String SET_TEXT_SIZE = "set_text_size";
public static final String SET_ICON_SIZE = "set_icon_size";

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<com.google.android.material.circularreveal.CircularRevealFrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
<com.google.android.material.circularreveal.CircularRevealFrameLayout xmlns:TagsEditText="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
@ -9,7 +10,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<ScrollView xmlns:TagsEditText="http://schemas.android.com/apk/res-auto"
<ScrollView
android:id="@+id/swipeContainer"
android:layout_width="match_parent"
android:layout_height="match_parent"
@ -2092,7 +2093,7 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:layout_marginBottom="10dp"
android:orientation="horizontal">
@ -2111,6 +2112,38 @@
android:layout_gravity="center_vertical" />
</LinearLayout>
<!-- Media Description Timeout -->
<TextView
android:id="@+id/textView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:gravity="center_vertical"
android:text="@string/set_med_desc_timeout"
android:textSize="16sp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:layout_marginBottom="10dp"
android:orientation="horizontal">
<TextView
android:id="@+id/set_med_desc_timeout_value"
android:layout_width="20dp"
android:layout_height="wrap_content"
android:layout_marginEnd="10dp"
android:textSize="16sp" />
<SeekBar
android:id="@+id/set_med_desc_timeout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"

View File

@ -290,6 +290,7 @@
<string name="set_notify">Notify?</string>
<string name="set_notif_silent">Silent Notifications</string>
<string name="set_nsfw_timeout">NSFW view timeout (seconds, 0 means off)</string>
<string name="set_med_desc_timeout">Media Description timeout (seconds, 0 means off)</string>
<string name="settings_title_profile">Edit profile</string>
<string name="settings_title_custom_sharing">Custom sharing</string>
<string name="settings_custom_sharing_url">Your custom sharing URL&#8230;</string>