package cgeo.geocaching.ui;

import cgeo.geocaching.utils.CryptUtils;

import android.text.Spannable;
import android.view.View;
import android.widget.TextView;

public class DecryptTextClickListener implements View.OnClickListener {

    @Override
    public void onClick(View view) {
        if (view == null) {
            return;
        }

        try {
            final TextView logView = (TextView) view;
            CharSequence text = logView.getText();
            if (text instanceof Spannable) {
                Spannable span = (Spannable) text;
                logView.setText(CryptUtils.rot13(span));
            }
            else {
                String string = (String) text;
                logView.setText(CryptUtils.rot13(string));
            }
        } catch (Exception e) {
            // nothing
        }
    }
}

@@ -423,16 +423,217 @@
  view;%0D%0A
+%0D%0A            // do not run the click listener if a link was clicked%0D%0A            if (logView.getSelectionStart() != -1 %7C%7C logView.getSelectionEnd() != -1) %7B%0D%0A                return;%0D%0A            %7D%0D%0A%0D%0A
         

fix #2619: Clicking link in log decrypts log