// Path: app/src/main/java/com/secuso/privacyfriendlycodescanner/qrscanner/ui/adapter/EmailResultAdapter.java
// public class EmailResultAdapter extends RecyclerView.Adapter<EmailResultAdapter.EmailViewHolder> {
// 
//     public static class EmailResultItem {
//         public final EmailResultItemType type;
//         public final String content;
// 
//         EmailResultItem(EmailResultItemType type, String content) {
//             this.type = type;
//             this.content = content;
//         }
//     }
// 
//     public enum EmailResultItemType {
//         TYPE_TO(R.string.item_result_email_to),
//         TYPE_CC(R.string.item_result_email_cc),
//         TYPE_BCC(R.string.item_result_email_bcc),
//         TYPE_SUBJECT(R.string.item_result_email_subject),
//         TYPE_BODY(R.string.item_result_email_body);
// 
//         @StringRes
//         int local;
// 
//         EmailResultItemType(int local) {
//             this.local = local;
//         }
//     }
// 
//     private final List<EmailResultItem> resultItems = new ArrayList<>();
// 
//     private EmailResultAdapter(@NonNull List<EmailResultItem> resultItems) {
//         this.resultItems.addAll(resultItems);
//     }
// 
//     public EmailResultAdapter(EmailAddressParsedResult result) {
//         this(buildResultItems(result));
//     }
// 
//     private static List<EmailResultItem> buildResultItems(EmailAddressParsedResult result) {
//         List<EmailResultItem> items = new ArrayList<>();
// 
//         if(result != null) {
//             if(result.getTos() != null) {
//                 for(String to : result.getTos()) {
//                     items.add(new EmailResultItem(EmailResultItemType.TYPE_TO, to));
//                 }
//             }
//             if(result.getCCs() != null) {
//                 for(String cc : result.getCCs()) {
//                     items.add(new EmailResultItem(EmailResultItemType.TYPE_CC, cc));
//                 }
//             }
//             if(result.getBCCs() != null) {
//                 for(String bcc : result.getBCCs()) {
//                     items.add(new EmailResultItem(EmailResultItemType.TYPE_BCC, bcc));
//                 }
//             }
//             if(result.getSubject() != null) {
//                 items.add(new EmailResultItem(EmailResultItemType.TYPE_SUBJECT, result.getSubject()));
//             }
//             if(result.getBody() != null) {
//                 items.add(new EmailResultItem(EmailResultItemType.TYPE_BODY, result.getBody()));
//             }
//         }
//         return items;
//     }
// 
//     @NonNull
//     @Override
//     public EmailViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int viewType) {
//         LayoutInflater inflater = LayoutInflater.from(viewGroup.getContext());
//         View v = inflater.inflate(R.layout.item_result_email, viewGroup, false);
// //        switch(EmailResultItemType.values()[viewType]) {
// //            case TYPE_CC:
// //                v = inflater.inflate(R.layout.item_result_email, viewGroup, false);
// //                break;
// //            case TYPE_BCC:
// //                v = inflater.inflate(R.layout.item_result_email, viewGroup, false);
// //                break;
// //            case TYPE_SUBJECT:
// //                v = inflater.inflate(R.layout.item_result_email, viewGroup, false);
// //                break;
// //            case TYPE_BODY:
// //                v = inflater.inflate(R.layout.item_result_email, viewGroup, false);
// //                break;
// //            case TYPE_TO: default:
// //                v = inflater.inflate(R.layout.item_result_email, viewGroup, false);
// //                break;
// //
// //        }
//         return new EmailViewHolder(v);
//     }
// 
//     @Override
//     public void onBindViewHolder(@NonNull EmailViewHolder viewHolder, int i) {
//         Context context = viewHolder.content.getContext();
//         viewHolder.content.setText(resultItems.get(i).content);
//         viewHolder.type.setText(context.getString(resultItems.get(i).type.local));
//     }
// 
//     @Override
//     public int getItemCount() {
//         return resultItems.size();
//     }
// 
//     @Override
//     public int getItemViewType(int position) {
//         return resultItems.get(position).type.ordinal();
//     }
// 
//     class EmailViewHolder extends RecyclerView.ViewHolder {
//         TextView content;
//         TextView type;
//         EmailViewHolder(@NonNull View itemView) {
//             super(itemView);
//             content = itemView.findViewById(R.id.item_result_email_content);
//             type = itemView.findViewById(R.id.item_result_email_type);
//         }
//     }
// }


import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.provider.ContactsContract;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.google.zxing.client.result.EmailAddressParsedResult;
import com.secuso.privacyfriendlycodescanner.qrscanner.R;
import com.secuso.privacyfriendlycodescanner.qrscanner.ui.adapter.EmailResultAdapter;
package com.secuso.privacyfriendlycodescanner.qrscanner.ui.resultfragments;




public class EmailResultFragment extends ResultFragment {

    EmailAddressParsedResult result;

    RecyclerView resultList;

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

    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        super.onCreateView(inflater, container, savedInstanceState);

        View v = inflater.inflate(R.layout.fragment_result_email, container, false);

        result = (EmailAddressParsedResult) parsedResult;

        resultList = v.findViewById(R.id.fragment_result_recycler_view);
        resultList.setLayoutManager(new LinearLayoutManager(getContext()));
// Path: app/src/main/java/com/secuso/privacyfriendlycodescanner/qrscanner/ui/adapter/EmailResultAdapter.java
// public class EmailResultAdapter extends RecyclerView.Adapter<EmailResultAdapter.EmailViewHolder> {
// 
//     public static class EmailResultItem {
//         public final EmailResultItemType type;
//         public final String content;
// 
//         EmailResultItem(EmailResultItemType type, String content) {
//             this.type = type;
//             this.content = content;
//         }
//     }
// 
//     public enum EmailResultItemType {
//         TYPE_TO(R.string.item_result_email_to),
//         TYPE_CC(R.string.item_result_email_cc),
//         TYPE_BCC(R.string.item_result_email_bcc),
//         TYPE_SUBJECT(R.string.item_result_email_subject),
//         TYPE_BODY(R.string.item_result_email_body);
// 
//         @StringRes
//         int local;
// 
//         EmailResultItemType(int local) {
//             this.local = local;
//         }
//     }
// 
//     private final List<EmailResultItem> resultItems = new ArrayList<>();
// 
//     private EmailResultAdapter(@NonNull List<EmailResultItem> resultItems) {
//         this.resultItems.addAll(resultItems);
//     }
// 
//     public EmailResultAdapter(EmailAddressParsedResult result) {
//         this(buildResultItems(result));
//     }
// 
//     private static List<EmailResultItem> buildResultItems(EmailAddressParsedResult result) {
//         List<EmailResultItem> items = new ArrayList<>();
// 
//         if(result != null) {
//             if(result.getTos() != null) {
//                 for(String to : result.getTos()) {
//                     items.add(new EmailResultItem(EmailResultItemType.TYPE_TO, to));
//                 }
//             }
//             if(result.getCCs() != null) {
//                 for(String cc : result.getCCs()) {
//                     items.add(new EmailResultItem(EmailResultItemType.TYPE_CC, cc));
//                 }
//             }
//             if(result.getBCCs() != null) {
//                 for(String bcc : result.getBCCs()) {
//                     items.add(new EmailResultItem(EmailResultItemType.TYPE_BCC, bcc));
//                 }
//             }
//             if(result.getSubject() != null) {
//                 items.add(new EmailResultItem(EmailResultItemType.TYPE_SUBJECT, result.getSubject()));
//             }
//             if(result.getBody() != null) {
//                 items.add(new EmailResultItem(EmailResultItemType.TYPE_BODY, result.getBody()));
//             }
//         }
//         return items;
//     }
// 
//     @NonNull
//     @Override
//     public EmailViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int viewType) {
//         LayoutInflater inflater = LayoutInflater.from(viewGroup.getContext());
//         View v = inflater.inflate(R.layout.item_result_email, viewGroup, false);
// //        switch(EmailResultItemType.values()[viewType]) {
// //            case TYPE_CC:
// //                v = inflater.inflate(R.layout.item_result_email, viewGroup, false);
// //                break;
// //            case TYPE_BCC:
// //                v = inflater.inflate(R.layout.item_result_email, viewGroup, false);
// //                break;
// //            case TYPE_SUBJECT:
// //                v = inflater.inflate(R.layout.item_result_email, viewGroup, false);
// //                break;
// //            case TYPE_BODY:
// //                v = inflater.inflate(R.layout.item_result_email, viewGroup, false);
// //                break;
// //            case TYPE_TO: default:
// //                v = inflater.inflate(R.layout.item_result_email, viewGroup, false);
// //                break;
// //
// //        }
//         return new EmailViewHolder(v);
//     }
// 
//     @Override
//     public void onBindViewHolder(@NonNull EmailViewHolder viewHolder, int i) {
//         Context context = viewHolder.content.getContext();
//         viewHolder.content.setText(resultItems.get(i).content);
//         viewHolder.type.setText(context.getString(resultItems.get(i).type.local));
//     }
// 
//     @Override
//     public int getItemCount() {
//         return resultItems.size();
//     }
// 
//     @Override
//     public int getItemViewType(int position) {
//         return resultItems.get(position).type.ordinal();
//     }
// 
//     class EmailViewHolder extends RecyclerView.ViewHolder {
//         TextView content;
//         TextView type;
//         EmailViewHolder(@NonNull View itemView) {
//             super(itemView);
//             content = itemView.findViewById(R.id.item_result_email_content);
//             type = itemView.findViewById(R.id.item_result_email_type);
//         }
//     }
// }


// Path: app/src/main/java/com/secuso/privacyfriendlycodescanner/qrscanner/ui/resultfragments/EmailResultFragment.java
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.provider.ContactsContract;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.google.zxing.client.result.EmailAddressParsedResult;
import com.secuso.privacyfriendlycodescanner.qrscanner.R;
import com.secuso.privacyfriendlycodescanner.qrscanner.ui.adapter.EmailResultAdapter;

package com.secuso.privacyfriendlycodescanner.qrscanner.ui.resultfragments;




public class EmailResultFragment extends ResultFragment {

    EmailAddressParsedResult result;

    RecyclerView resultList;

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

    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        super.onCreateView(inflater, container, savedInstanceState);

        View v = inflater.inflate(R.layout.fragment_result_email, container, false);

        result = (EmailAddressParsedResult) parsedResult;

        resultList = v.findViewById(R.id.fragment_result_recycler_view);
        resultList.setLayoutManager(new LinearLayoutManager(getContext()));
        resultList.setAdapter(new EmailResultAdapter(result));