- Added Custom Sharing feature support to SettingsFragment and supporting XML
This commit is contained in:
parent
db4d67af11
commit
edf084e42c
|
@ -468,6 +468,28 @@ public class SettingsFragment extends Fragment {
|
|||
}
|
||||
});
|
||||
|
||||
// Custom Sharing
|
||||
boolean custom_sharing = sharedpreferences.getBoolean(Helper.SET_CUSTOM_SHARING, true);
|
||||
final CheckBox set_custom_sharing = rootView.findViewById(R.id.set_custom_sharing);
|
||||
set_custom_sharing.setChecked(custom_sharing);
|
||||
|
||||
set_custom_sharing.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||
editor.putBoolean(Helper.SET_CUSTOM_SHARING, set_custom_sharing.isChecked());
|
||||
editor.apply();
|
||||
}
|
||||
});
|
||||
|
||||
String custom_sharing_url = sharedpreferences.getString(Helper.SET_CUSTOM_SHARING_URL,
|
||||
"http://my.site/add?user=fedilab&url=${url}&title=${title}&source=${source}&id=${id}&descripition=${description}&keywords=${keywords}");
|
||||
final EditText edit_custom_sharing_url = rootView.findViewById(R.id.custom_sharing_url);
|
||||
if (custom_sharing_url.equals("")) {
|
||||
custom_sharing_url = "http://my.site/add?user=fedilab&url=${url}&title=${title}&source=${source}&id=${id}&descripition=${description}&keywords=${keywords}";
|
||||
}
|
||||
edit_custom_sharing_url.setText(custom_sharing_url);
|
||||
|
||||
boolean display_direct = sharedpreferences.getBoolean(Helper.SET_DISPLAY_DIRECT, true);
|
||||
final CheckBox set_display_direct = rootView.findViewById(R.id.set_display_direct);
|
||||
set_display_direct.setChecked(display_direct);
|
||||
|
|
|
@ -288,6 +288,7 @@ public class Helper {
|
|||
public static final String SET_COMPACT_MODE = "set_compact_mode";
|
||||
public static final String SET_SHARE_DETAILS = "set_share_details";
|
||||
public static final String SET_CUSTOM_SHARING = "set_custom_sharing";
|
||||
public static final String SET_CUSTOM_SHARING_URL = "set_custom_sharing_url";
|
||||
public static final String SET_NOTIF_SOUND = "set_notif_sound";
|
||||
public static final String SET_ENABLE_TIME_SLOT = "set_enable_time_slot";
|
||||
public static final String SET_KEEP_BACKGROUND_PROCESS = "set_keep_background_process";
|
||||
|
|
|
@ -347,6 +347,21 @@
|
|||
android:text="@string/set_share_details"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<!-- CUSTOM SHARING -->
|
||||
<CheckBox
|
||||
android:id="@+id/set_custom_sharing"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_marginTop="@dimen/settings_checkbox_margin"
|
||||
android:layout_marginBottom="@dimen/settings_checkbox_margin"
|
||||
android:text="Custom sharing"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<EditText
|
||||
android:hint="Your custom sharing URL..."
|
||||
android:id="@+id/custom_sharing_url"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
|
|
@ -352,6 +352,21 @@
|
|||
android:text="@string/set_share_details"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<!-- CUSTOM SHARING -->
|
||||
<CheckBox
|
||||
android:id="@+id/set_custom_sharing"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_marginTop="@dimen/settings_checkbox_margin"
|
||||
android:layout_marginBottom="@dimen/settings_checkbox_margin"
|
||||
android:text="Custom sharing"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<EditText
|
||||
android:hint="Your custom sharing URL..."
|
||||
android:id="@+id/custom_sharing_url"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
|
Loading…
Reference in New Issue