package com.aesean.fuckbaiduwormhole;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.widget.TextView;

import com.aesean.wromhole.CheckWormHole;

public class MainActivity extends AppCompatActivity implements View.OnClickListener {

    private TextView tv_Result;
    private TextView tv_ResultDetail;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);

        findViewById(R.id.bt_Check).setOnClickListener(this);
        tv_Result = (TextView) findViewById(R.id.tv_Result);
        tv_ResultDetail = (TextView) findViewById(R.id.tv_ResultDetail);
    }

    @Override
    protected void onStart() {
        super.onStart();
        check();
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.bt_Check:
                check();
                break;
            default:
                break;
        }
    }

    private void check() {
        CheckWormHole.check(new CheckWormHole.Callback() {
            @Override
            public void wormHoleCheckResult(String url, int resultCode, String message) {
                if (CheckWormHole.isDangerous(resultCode)) {
                    tv_Result.setText(R.string.Dangerous);
                    tv_Result.setTextColor(getResources().getColor(R.color.Dangerous));

                    tv_ResultDetail.setText(tv_ResultDetail.getText().toString() + CheckWormHole.NEW_LINE + url);
                }
            }
        });
    }
}

@@ -1644,17 +1644,16 @@
 rous));%0A
-%0A
         
@@ -1754,24 +1754,235 @@
 INE + url);%0A
+                %7D else %7B%0A                    tv_Result.setText(R.string.Safe);%0A                    tv_Result.setTextColor(getResources().getColor(R.color.Safe));%0A                    tv_ResultDetail.setText(%22%22);%0A
             

repair bug