2017-09-27 22:11:44 +00:00
|
|
|
package org.thoughtcrime.securesms;
|
|
|
|
|
|
|
|
|
|
|
|
import android.os.Bundle;
|
2019-05-22 16:51:56 +00:00
|
|
|
import android.support.annotation.NonNull;
|
2017-09-27 22:11:44 +00:00
|
|
|
import android.support.v4.app.Fragment;
|
|
|
|
import android.support.v7.widget.SwitchCompat;
|
|
|
|
import android.view.LayoutInflater;
|
|
|
|
import android.view.View;
|
|
|
|
import android.view.ViewGroup;
|
|
|
|
|
2018-10-11 23:45:22 +00:00
|
|
|
import org.thoughtcrime.securesms.jobs.MultiDeviceConfigurationUpdateJob;
|
2017-09-27 22:11:44 +00:00
|
|
|
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
|
|
|
import org.thoughtcrime.securesms.util.ViewUtil;
|
|
|
|
|
2019-07-24 02:30:23 +00:00
|
|
|
import network.loki.messenger.R;
|
|
|
|
|
2017-09-27 22:11:44 +00:00
|
|
|
public class ReadReceiptsIntroFragment extends Fragment {
|
|
|
|
|
|
|
|
public static ReadReceiptsIntroFragment newInstance() {
|
|
|
|
ReadReceiptsIntroFragment fragment = new ReadReceiptsIntroFragment();
|
|
|
|
Bundle args = new Bundle();
|
|
|
|
fragment.setArguments(args);
|
|
|
|
return fragment;
|
|
|
|
}
|
|
|
|
|
|
|
|
public ReadReceiptsIntroFragment() {}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onCreate(Bundle savedInstanceState) {
|
|
|
|
super.onCreate(savedInstanceState);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2019-05-22 16:51:56 +00:00
|
|
|
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
2017-09-27 22:11:44 +00:00
|
|
|
View v = inflater.inflate(R.layout.experience_upgrade_preference_fragment, container, false);
|
|
|
|
SwitchCompat preference = ViewUtil.findById(v, R.id.preference);
|
|
|
|
|
|
|
|
preference.setChecked(TextSecurePreferences.isReadReceiptsEnabled(getContext()));
|
2017-10-02 19:15:45 +00:00
|
|
|
preference.setOnCheckedChangeListener((buttonView, isChecked) -> {
|
|
|
|
TextSecurePreferences.setReadReceiptsEnabled(getContext(), isChecked);
|
|
|
|
ApplicationContext.getInstance(getContext())
|
|
|
|
.getJobManager()
|
2019-03-28 15:56:35 +00:00
|
|
|
.add(new MultiDeviceConfigurationUpdateJob(isChecked,
|
2018-10-29 22:14:31 +00:00
|
|
|
TextSecurePreferences.isTypingIndicatorsEnabled(requireContext()),
|
2019-01-15 08:41:05 +00:00
|
|
|
TextSecurePreferences.isShowUnidentifiedDeliveryIndicatorsEnabled(getContext()),
|
|
|
|
TextSecurePreferences.isLinkPreviewsEnabled(getContext())));
|
2017-10-02 19:15:45 +00:00
|
|
|
});
|
2017-09-27 22:11:44 +00:00
|
|
|
|
|
|
|
return v;
|
|
|
|
}
|
|
|
|
}
|