在safari浏览器上,输入控件从cookie中获取详细信息

时间:2017-01-12 11:57:11

标签: javascript angularjs cookies safari

我有一个输入控件

class MyListViewAdapter extends ArrayAdapter<KeyValueList>
{
private int layoutResource;
private String rowId = "-", string = "-";
private String pos = "0";
private String vallue;
private int i = 0;

MyListViewAdapter(Context context, int layoutResource, List<KeyValueList>    keyValueList)
{
    super(context, layoutResource, keyValueList);
    this.layoutResource = layoutResource;
    setDefaultsInt("first", 1, getContext());
}

@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
@NonNull
@Override
public View getView(final int position, final View convertView, @NonNull ViewGroup parent)
{
    KeyValueList keyValuelist = getItem(position);

    View view = convertView;
    if (view == null)
    {
        LayoutInflater layoutInflater = LayoutInflater.from(getContext());
        view = layoutInflater.inflate(layoutResource, null);

        ViewHolder holder = new ViewHolder();
        holder.textView = (TextView) view.findViewById(R.id.key);
        holder.editText = (EditText) view.findViewById(R.id.value);
        holder.text_value = (TextView) view.findViewById(R.id.text_value);
        holder.imageView = (ImageView) view.findViewById(R.id.img);
        view.setTag(holder);
    }

    final ViewHolder holder = (ViewHolder) view.getTag();

    if(openEntry.isEditable)
    {
        holder.text_value.setVisibility(View.GONE);
        holder.editText.setVisibility(View.VISIBLE);
    }

    if(!openEntry.isEditable)
    {
        holder.text_value.setVisibility(View.VISIBLE);
        holder.editText.setVisibility(View.GONE);
    }


    if (holder.textWatcher != null)
        holder.editText.removeTextChangedListener(holder.textWatcher);



    holder.textWatcher = new TextWatcher()
    {
        @Override
        public void beforeTextChanged(CharSequence s, int start, int count, int after)
        {

        }

        @Override
        public void onTextChanged(CharSequence s, int start, int before, int count)
        {

        }

        @Override
        public void afterTextChanged(Editable s)
        {
            if(!s.toString().equals(vallue))
            {
                if(getDefaultsInt("first",getContext()) == 1)
                {
                    openEntry.edit_list.add(null);
                    setDefaultsInt("p", position, getContext());
                    setDefaultsInt("first", 0, getContext());
                }

                if(getDefaultsInt("p", getContext()) != position)
                {
                    openEntry.edit_list.add(null);
                    i++;
                    setDefaultsInt("p", position, getContext());
                }

                try
                {
                    rowId = getRowID(position);
                    string = s.toString();
                    pos = String.valueOf(position);

                } catch (JSONException e)
                {
                    e.printStackTrace();
                }

                HashMap<String, String> edit = new HashMap<>();

                edit.put("rowID", rowId);
                edit.put("string", string);
                edit.put("position", pos);

                openEntry.edit_list.set(i, edit);
            }
        }
    };

    holder.editText.addTextChangedListener(holder.textWatcher);

    assert keyValuelist != null;
    holder.textView.setText(keyValuelist.getKey());

    vallue = keyValuelist.getValue();

    if (vallue.length() != 0 && vallue.contains("printFile"))
    {
        final String durl = vallue.replace("printFile","file");
        new DownloadImageTask(holder.imageView).execute(vallue);
        holder.editText.setVisibility(View.GONE);
        holder.text_value.setVisibility(View.GONE);
        holder.imageView.setVisibility(View.VISIBLE);
        holder.imageView.setOnClickListener(new View.OnClickListener()
        {
            @Override
            public void onClick(View v)
            {
                Uri uriUrl = Uri.parse(durl);
                Intent launchBrowser = new Intent(Intent.ACTION_VIEW, uriUrl);
                getContext().startActivity(launchBrowser);
            }
        });
    }
    else
    {
        holder.editText.setText(vallue);
        holder.text_value.setText(vallue);
    }

    return view;
}

此控件正在正常处理chrome,而在safari上它正在从登录屏幕获取电子邮件。 我怎么能限制它?

这也发生在特定系统(mac)中。我也无法在另一台机器上重现它。

0 个答案:

没有答案