You cannot select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
	
	
		
			67 lines
		
	
	
		
			2.3 KiB
		
	
	
	
		
			Java
		
	
			
		
		
	
	
			67 lines
		
	
	
		
			2.3 KiB
		
	
	
	
		
			Java
		
	
| package org.thoughtcrime.securesms;
 | |
| 
 | |
| 
 | |
| import android.content.Context;
 | |
| import android.os.Bundle;
 | |
| import android.support.annotation.NonNull;
 | |
| import android.support.v4.app.Fragment;
 | |
| import android.view.LayoutInflater;
 | |
| import android.view.View;
 | |
| import android.view.ViewGroup;
 | |
| 
 | |
| import org.thoughtcrime.securesms.jobs.MultiDeviceConfigurationUpdateJob;
 | |
| import org.thoughtcrime.securesms.util.TextSecurePreferences;
 | |
| 
 | |
| import network.loki.messenger.R;
 | |
| 
 | |
| public class LinkPreviewsIntroFragment extends Fragment {
 | |
| 
 | |
|   private Controller controller;
 | |
| 
 | |
|   public static LinkPreviewsIntroFragment newInstance() {
 | |
|     LinkPreviewsIntroFragment fragment = new LinkPreviewsIntroFragment();
 | |
|     Bundle                    args     = new Bundle();
 | |
|     fragment.setArguments(args);
 | |
|     return fragment;
 | |
|   }
 | |
| 
 | |
|   public LinkPreviewsIntroFragment() {}
 | |
| 
 | |
|   @Override
 | |
|   public void onCreate(Bundle savedInstanceState) {
 | |
|     super.onCreate(savedInstanceState);
 | |
|   }
 | |
| 
 | |
|   @Override
 | |
|   public void onAttach(Context context) {
 | |
|     super.onAttach(context);
 | |
| 
 | |
|     if (!(getActivity() instanceof Controller)) {
 | |
|       throw new IllegalStateException("Parent activity must implement the Controller interface.");
 | |
|     }
 | |
| 
 | |
|     controller = (Controller) getActivity();
 | |
|   }
 | |
| 
 | |
|   @Override
 | |
|   public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
 | |
|     View view = inflater.inflate(R.layout.experience_upgrade_link_previews_fragment, container, false);
 | |
| 
 | |
|     view.findViewById(R.id.experience_ok_button).setOnClickListener(v -> {
 | |
|       ApplicationContext.getInstance(requireContext())
 | |
|                         .getJobManager()
 | |
|                         .add(new MultiDeviceConfigurationUpdateJob(TextSecurePreferences.isReadReceiptsEnabled(requireContext()),
 | |
|                                                                    TextSecurePreferences.isTypingIndicatorsEnabled(requireContext()),
 | |
|                                                                    TextSecurePreferences.isShowUnidentifiedDeliveryIndicatorsEnabled(requireContext()),
 | |
|                                                                    TextSecurePreferences.isLinkPreviewsEnabled(requireContext())));
 | |
|       controller.onLinkPreviewsFinished();
 | |
|     });
 | |
| 
 | |
|     return view;
 | |
|   }
 | |
| 
 | |
|   public interface Controller {
 | |
|     void onLinkPreviewsFinished();
 | |
|   }
 | |
| }
 |