<commit_before>package de.wellenvogel.avnav.main;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.graphics.Paint;
import android.net.Uri;
import android.os.Bundle;
import android.os.ParcelFileDescriptor;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v7.widget.Toolbar;
import android.util.Xml;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;


import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;

import de.wellenvogel.avnav.settings.SettingsActivity;
import de.wellenvogel.avnav.util.AvnLog;
import de.wellenvogel.avnav.util.AvnUtil;

import static java.lang.System.in;

/**
 * Created by andreas on 09.01.15.
 * just to go back from the notification
 */
public class RouteReceiver extends Activity {
    class ListItem{
        public boolean ok;
        public Uri routeUri;
        public File outFile;
        public String error;
        ListItem(Uri u){
            routeUri=u;
            ok=true;
        }
        ListItem(Uri u,String error){
            routeUri=u;
            ok=false;
            this.error=error;
        }
        public String toString(){
            return routeUri.getLastPathSegment();
        }
        public void setError(String error){
            ok=false;
            this.error=error;
        }
    }

    class ListAdapter extends ArrayAdapter<ListItem>{
        public ListAdapter(@NonNull Context context, int resource, List<ListItem> items) {
            super(context, resource,items);
        }

        @NonNull
        @Override
        public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
            View v=super.getView(position, convertView, parent);
            if (! getItem(position).ok){
                ((TextView)v).setPaintFlags(((TextView)v).getPaintFlags()| Paint.STRIKE_THRU_TEXT_FLAG);
            }
            return v;
        }
    }
    private static final int ACTION_EXIT=0;
    private static final int ACTION_MAIN=1;
    private static final int ACTION_IMPORT=2;
    private int nextButtonAction=ACTION_EXIT;
    private ListView receiverInfo;
    private Button button;
    private List<ListItem> names;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.route_receiver);
        receiverInfo = findViewById(R.id.receiverInfo);
        button = findViewById(R.id.btReceiverOk);
        Toolbar toolbar = findViewById(R.id.toolbar);
        toolbar.setNavigationOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
        toolbar.setTitle(R.string.importRouteTitle);
        button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                buttonAction();
            }
        });
        if (!SettingsActivity.checkSettings(this, false, false)) {
            Toast.makeText(this, R.string.receiveMustStart, Toast.LENGTH_LONG).show();
            finish();
            return;
        }
        names = new ArrayList<>();
        ListAdapter adapter = new ListAdapter(this, android.R.layout.simple_list_item_1, names);
        receiverInfo.setAdapter(adapter);
        Intent intent = getIntent();
        String action = intent.getAction();
        Uri routeUri = null;
        if (Intent.ACTION_SEND.equals(action))<commit_msg>add reason for non imported routes<commit_after>package de.wellenvogel.avnav.main;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.graphics.Paint;
import android.net.Uri;
import android.os.Bundle;
import android.os.ParcelFileDescriptor;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v7.widget.Toolbar;
import android.util.Xml;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import android.widget.TwoLineListItem;


import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;

import de.wellenvogel.avnav.settings.SettingsActivity;
import de.wellenvogel.avnav.util.AvnLog;
import de.wellenvogel.avnav.util.AvnUtil;

import static java.lang.System.in;

/**
 * Created by andreas on 09.01.15.
 * just to go back from the notification
 */
public class RouteReceiver extends Activity {
    class ListItem{
        public boolean ok;
        public Uri routeUri;
        public File outFile;
        public String error;
        ListItem(Uri u){
            routeUri=u;
            ok=true;
        }
        ListItem(Uri u,String error){
            routeUri=u;
            ok=false;
            this.error=error;
        }
        public String toString(){
            return routeUri.getLastPathSegment();
        }
        public void setError(String error){
            ok=false;
            this.error=error;
        }
    }
    class MyAdapter extends BaseAdapter {

        private Context context;
        private List<ListItem> items;

        public MyAdapter(Context context, List<ListItem> items) {
            this.context = context;
            this.items = items;
        }

        @Override
        public int getCount() {
            return items.size();
        }

        @Override
        public Object getItem(int position) {
            return items.get(position);
        }

        @Override
        public long getItemId(int position) {
            return 0;
        }

        @Override
        public View getView(int position, View convertView, ViewGroup parent) {

            View twoLineListItem;

            if (convertView == null) {
                LayoutInflater inflater = (LayoutInflater) context
                        .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
                twoLineListItem =  inflater.inflate(
                        android.R.layout.simple_list_item_2, null);
            } else {
                twoLineListItem = convertView;
            }

            TextView text1 = twoLineListItem.findViewById(android.R.id.text1);
            TextView text2 = twoLineListItem.findViewById(android.R.id.text2);

            text1.setText(items.get(position).toString());
            if (items.get(position).ok) {
                text2.setText("");
                text1.setPaintFlags((text1).getPaintFlags()& ~Paint.STRIKE_THRU_TEXT_FLAG);
            }
            else{
                text2.setText(items.get(position).error);
                text1.setPaintFlags((text1).getPaintFlags()| Paint.STRIKE_THRU_TEXT_FLAG);
            }

            return twoLineListItem;
        }
    }

    private static final int ACTION_EXIT=0;
    private static final int ACTION_MAIN=1;
    private static final int ACTION_IMPORT=2;
    private int nextButtonAction=ACTION_EXIT;
    private ListView receiverInfo;
    private Button button;
    private List<ListItem> names;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.route_receiver);
        receiverInfo = findViewById(R.id.receiverInfo);
        button = findViewById(R.id.btReceiverOk);
        Toolbar toolbar = findViewById(R.id.toolbar);
        toolbar.setNavigationOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
        toolbar.setTitle(R.string.importRouteTitle);
        button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                buttonAction();
            }
        });
        if (!SettingsActivity.checkSettings(this, false, false)) {
            Toast.makeText(this, R.string.receiveMustStart, Toast.LENGTH_LONG).show();
            finish();
            return;
        }
        names = new ArrayList<>();
        MyAdapter adapter = new MyAdapter(this, names);
        receiverInfo.setAdapter(adapter);
        Intent intent = getIntent();
        String action = intent.getAction();
        Uri routeUri = null;
        if (Intent.ACTION_SEND.equals(action))
{'fraction_non_alphanumeric': 0.09281502511465385, 'fraction_numerical': 0.004149377593360996, 'mean_word_length': 2.4798632218844983, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2892431', 'n_tokens_mistral': 2520, 'n_tokens_neox': 2437, 'n_words': 542}