<commit_before>package com.example.administrator.my.activity;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import com.example.administrator.my.R;
import com.example.administrator.my.model.Active;
import com.example.administrator.my.utils.ToastUtil;

/**
 * 此界面为活动详情——周凯歌
 */
public class DetailActivity extends AppCompatActivity {

    private Button loginButton;
    private TextView activityLocation;
    private TextView activityDes;
    private TextView activtyName;
    private Active active;
    private String activeName;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_detail);


        Intent intent = getIntent();

        active = (Active) intent.getSerializableExtra("active");
        Log.d("考虑", "" + active);
        //初始化数据
        initData();

    }

    /**
     * 初始化数据
     */
    private void initData() {
        activtyName = (TextView) findViewById(R.id.tv_name);
        activityLocation = (TextView) findViewById(R.id.tv_location);
        activityDes = (TextView) findViewById(R.id.tv_des);

        activeName = active.getActiveName();
        activtyName.setText(activeName);
        activityLocation.setText(active.getActiveLocation());
        activityDes.setText(active.getActiveDes());

        loginButton = (Button) findViewById(R.id.loginButton);  //登录按钮
        loginButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(DetailActivity.this, MoveActivity.class);
                intent.putExtra("activeName", active.getActiveName());
                intent.putExtra("location",active.getActiveLocation());
                intent.putExtra("activityDes",active.getActiveDes());
                startActivity(intent);
                finish();
            }
        });

    }
}<commit_msg>新增判断在当前时间能否进行签到<commit_after>package com.example.administrator.my.activity;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import com.example.administrator.my.R;
import com.example.administrator.my.model.Active;
import com.example.administrator.my.utils.ToastUtil;

import java.sql.Date;
import java.text.ParseException;
import java.text.SimpleDateFormat;

/**
 * 此界面为活动详情——周凯歌
 */
public class DetailActivity extends AppCompatActivity {

    private Button loginButton;
    private TextView activityLocation;
    private TextView activityDes;
    private TextView activtyName;
    private Active active;
    private String activeName;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_detail);


        Intent intent = getIntent();

        active = (Active) intent.getSerializableExtra("active");
        Log.d("考虑", "" + active);
        //初始化数据
        initData();

    }

    /**
     * 初始化数据
     */
    private void initData() {
        activtyName = (TextView) findViewById(R.id.tv_name);
        activityLocation = (TextView) findViewById(R.id.tv_location);
        activityDes = (TextView) findViewById(R.id.tv_des);

        activeName = active.getActiveName();

        activtyName.setText(activeName);
        activityLocation.setText(active.getActiveLocation());
        activityDes.setText(active.getActiveDes());

        loginButton = (Button) findViewById(R.id.loginButton);  //登录按钮
        loginButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if(TimeCompare(active.getActiveTime().replace("T"," ").substring(0,16))){
                    Intent intent = new Intent(DetailActivity.this, MoveActivity.class);
                    intent.putExtra("activeName", active.getActiveName());
                    intent.putExtra("location",active.getActiveLocation());
                    intent.putExtra("activityDes",active.getActiveDes());
                    startActivity(intent);
                    finish();
                }else {
                    ToastUtil.show("未到签到时间");
                }

            }
        });

    }

    /**
     *判断是否到了签到时间   true/false
     * @param signTime  需要签到的时间
     */
    private boolean TimeCompare(String signTime){
        //格式化时间
        SimpleDateFormat currentTime= new SimpleDateFormat("yyyy-MM-dd HH:mm");
        String presentTime = currentTime.format(new java.util.Date());//当前时间
        try {
            java.util.Date beginTime = currentTime.parse(signTime);
            java.util.Date endTime = currentTime.parse(presentTime);
            if(endTime.getTime()>=beginTime.getTime()) {
//                System.out.println("运行了运行了运行了运行了运行了");
                return true;
            }else{
                return false;
            }
        } catch (ParseException e) {
            e.printStackTrace();
        }
        return true;
    }
}
{'fraction_non_alphanumeric': 0.11002075863370447, 'fraction_numerical': 0.0009435742592942064, 'mean_word_length': 2.5714285714285716, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, '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': '5046222', 'n_tokens_mistral': 1507, 'n_tokens_neox': 1476, 'n_words': 255}