Custom sharing fixes
This commit is contained in:
parent
2d06ca921a
commit
73133ea6ce
|
@ -59,8 +59,8 @@ import java.util.List;
|
|||
|
||||
import es.dmoral.toasty.Toasty;
|
||||
import fr.gouv.etalab.mastodon.R;
|
||||
import fr.gouv.etalab.mastodon.activities.MainActivity;
|
||||
import fr.gouv.etalab.mastodon.activities.CustomSharingActivity;
|
||||
import fr.gouv.etalab.mastodon.activities.MainActivity;
|
||||
import fr.gouv.etalab.mastodon.activities.MediaActivity;
|
||||
import fr.gouv.etalab.mastodon.activities.ShowAccountActivity;
|
||||
import fr.gouv.etalab.mastodon.activities.ShowConversationActivity;
|
||||
|
@ -707,6 +707,9 @@ public class NotificationsListAdapter extends RecyclerView.Adapter implements On
|
|||
popup.getMenu().findItem(R.id.action_block_domain).setVisible(false);
|
||||
|
||||
}
|
||||
boolean custom_sharing = sharedpreferences.getBoolean(Helper.SET_CUSTOM_SHARING, false);
|
||||
if( custom_sharing && status.getVisibility().equals("public"))
|
||||
popup.getMenu().findItem(R.id.action_custom_sharing).setVisible(true);
|
||||
|
||||
popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
|
||||
public boolean onMenuItemClick(MenuItem item) {
|
||||
|
|
|
@ -1914,7 +1914,9 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
|
|||
popup.getMenu().findItem(R.id.action_block_domain).setVisible(false);
|
||||
|
||||
}
|
||||
|
||||
boolean custom_sharing = sharedpreferences.getBoolean(Helper.SET_CUSTOM_SHARING, false);
|
||||
if( custom_sharing && status.getVisibility().equals("public"))
|
||||
popup.getMenu().findItem(R.id.action_custom_sharing).setVisible(true);
|
||||
MenuItem itemBookmark = popup.getMenu().findItem(R.id.action_bookmark);
|
||||
if (itemBookmark.getActionView() != null)
|
||||
itemBookmark.getActionView().setOnLongClickListener(new View.OnLongClickListener() {
|
||||
|
|
|
@ -637,23 +637,30 @@ public class SettingsFragment extends Fragment {
|
|||
});
|
||||
|
||||
// Custom Sharing
|
||||
boolean custom_sharing = sharedpreferences.getBoolean(Helper.SET_CUSTOM_SHARING, true);
|
||||
final EditText edit_custom_sharing_url = rootView.findViewById(R.id.custom_sharing_url);
|
||||
boolean custom_sharing = sharedpreferences.getBoolean(Helper.SET_CUSTOM_SHARING, false);
|
||||
final CheckBox set_custom_sharing = rootView.findViewById(R.id.set_custom_sharing);
|
||||
set_custom_sharing.setChecked(custom_sharing);
|
||||
|
||||
if( custom_sharing)
|
||||
edit_custom_sharing_url.setVisibility(View.VISIBLE);
|
||||
else
|
||||
edit_custom_sharing_url.setVisibility(View.GONE);
|
||||
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();
|
||||
if( set_custom_sharing.isChecked())
|
||||
edit_custom_sharing_url.setVisibility(View.VISIBLE);
|
||||
else
|
||||
edit_custom_sharing_url.setVisibility(View.GONE);
|
||||
}
|
||||
});
|
||||
|
||||
String custom_sharing_url = sharedpreferences.getString(Helper.SET_CUSTOM_SHARING_URL,"");
|
||||
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}&description=${description}&keywords=${keywords}";
|
||||
custom_sharing_url = "http://example.net/add?user=fedilab&url=${url}&title=${title}&source=${source}&id=${id}&description=${description}&keywords=${keywords}";
|
||||
}
|
||||
edit_custom_sharing_url.setText(custom_sharing_url);
|
||||
|
||||
|
@ -677,6 +684,7 @@ public class SettingsFragment extends Fragment {
|
|||
}
|
||||
});
|
||||
|
||||
|
||||
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);
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
android:title="@string/more_action_6"
|
||||
app:showAsAction="never" />
|
||||
<item
|
||||
android:visible="false"
|
||||
android:id="@+id/action_custom_sharing"
|
||||
android:title="@string/settings_title_custom_sharing"
|
||||
app:showAsAction="never" />
|
||||
|
|
Loading…
Reference in New Issue