aboutsummaryrefslogblamecommitdiff
path: root/app/src/main/java/ml/docilealligator/infinityforreddit/settings/TranslationFragment.java
blob: 4704a878318b2a1b9b40140039704fbb523fc8ab (plain) (tree)
1
2
3
4
5
6
7
8
9
10
                                                      
 







                                      


                           
                                                     


                                                                                            
                                                                                   


                                                   

                                          
                                  





                                            
                                                                                   

                                                         
                                                                                                            


                                                                              
                                                                                                                                  
                                              
 
                                                                                      
 
                                 




                                                    
                                          

     
package ml.docilealligator.infinityforreddit.settings;

import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;

import javax.inject.Inject;

import ml.docilealligator.infinityforreddit.Infinity;
import ml.docilealligator.infinityforreddit.activities.BaseActivity;
import ml.docilealligator.infinityforreddit.adapters.TranslationFragmentRecyclerViewAdapter;
import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper;
import ml.docilealligator.infinityforreddit.databinding.FragmentTranslationBinding;

public class TranslationFragment extends Fragment {

    @Inject
    CustomThemeWrapper customThemeWrapper;
    private BaseActivity activity;

    public TranslationFragment() {
        // Required empty public constructor
    }

    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        FragmentTranslationBinding binding = FragmentTranslationBinding.inflate(inflater, container, false);

        ((Infinity) activity.getApplication()).getAppComponent().inject(this);

        TranslationFragmentRecyclerViewAdapter adapter = new TranslationFragmentRecyclerViewAdapter(activity, customThemeWrapper);
        binding.getRoot().setAdapter(adapter);

        binding.getRoot().setBackgroundColor(customThemeWrapper.getBackgroundColor());

        return binding.getRoot();
    }

    @Override
    public void onAttach(@NonNull Context context) {
        super.onAttach(context);
        activity = (BaseActivity) context;
    }
}