Commit d1f92db1 by chengxiuhong

test main

parent 6aeb6145
......@@ -5,6 +5,7 @@ import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.KeyEvent;
import android.view.View;
import android.widget.AdapterView;
import android.widget.EditText;
......@@ -17,6 +18,7 @@ import android.widget.TextView;
import com.app.baselibrary.base.common.BaseActivity;
import com.app.baselibrary.commonUtil.CheckUtil;
import com.app.baselibrary.commonUtil.LogUtil;
import com.app.baselibrary.commonUtil.ToastUtil;
import com.oo.eye.EyeConfig;
import com.oo.eye.R;
......@@ -118,10 +120,41 @@ public class MorePeopleTestActivity extends BaseActivity {
search();
}
private boolean isKeyEditHaveFocus;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ButterKnife.bind(this);
mKeyTest.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
isKeyEditHaveFocus = hasFocus;
}
});
}
private long mLastOnKeyTime = -1;
@Override
public boolean dispatchKeyEvent(KeyEvent event) {
if (event.getAction() == KeyEvent.ACTION_UP) {
//两次点击大于1秒
long currentTime = System.currentTimeMillis();
if (mLastOnKeyTime > 0 && currentTime - mLastOnKeyTime < 500) {
return true;
}
mLastOnKeyTime = currentTime;
LogUtil.e("---查看按键对应的数字---" + event.getKeyCode());
switch (event.getKeyCode()) {
case KeyEvent.KEYCODE_DEL://返回键
if (!isKeyEditHaveFocus) {
finish();
}
return true;
}
}
return super.dispatchKeyEvent(event);
}
@OnClick({R.id.back_iv, R.id.selete_area_lay, R.id.selete_lay, R.id.selete1_lay, R.id.do_search, R.id.begin_test})
......@@ -163,7 +196,7 @@ public class MorePeopleTestActivity extends BaseActivity {
popuPosition = 2;
showPopWindow(mBeanArrayList);
break;
case R.id.selete1_lay:
case R.id.selete1_lay://全部小组
popuPosition = 3;
if (!CheckUtil.isEmpty(mClassList)) {
showPopWindow(mClassList);
......@@ -195,8 +228,8 @@ public class MorePeopleTestActivity extends BaseActivity {
case R.id.do_search:
// String string = mKeyTest.getText().toString().toString();
// if (!CheckUtil.isEmpty(string)) {
mSearchParamBean.setStudentId(mKeyTest.getText().toString().trim());
search();
mSearchParamBean.setStudentId(mKeyTest.getText().toString().trim());
search();
// } else {
// ToastUtil.showMessage("请输入需要查询的学院后四位");
// }
......
......@@ -4,6 +4,7 @@ import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.KeyEvent;
import android.view.View;
import android.widget.AdapterView;
import android.widget.EditText;
......@@ -15,6 +16,7 @@ import android.widget.TextView;
import com.app.baselibrary.base.common.BaseActivity;
import com.app.baselibrary.commonUtil.CheckUtil;
import com.app.baselibrary.commonUtil.LogUtil;
import com.app.baselibrary.commonUtil.ToastUtil;
import com.oo.eye.EyeConfig;
import com.oo.eye.R;
......@@ -66,7 +68,7 @@ public class SinglePeopleTestActivity extends BaseActivity {
private PopuAdapter mPopuAdapter;
private List<PopuBean> mAreaList = new ArrayList<>();
private PopupWindow mPopupWindow;
private boolean isKeyEditHaveFocus;
@Override
protected int getLayoutId() {
return R.layout.activity_singletest;
......@@ -82,8 +84,38 @@ public class SinglePeopleTestActivity extends BaseActivity {
mPeopleAdapter = new SinglePeopleAdapter(mStudentBeans, this);
mRecycleView.setAdapter(mPeopleAdapter);
search();//
mKeyTest.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
isKeyEditHaveFocus = hasFocus;
}
});
}
private long mLastOnKeyTime = -1;
@Override
public boolean dispatchKeyEvent(KeyEvent event) {
if (event.getAction() == KeyEvent.ACTION_UP) {
//两次点击大于1秒
long currentTime = System.currentTimeMillis();
if (mLastOnKeyTime > 0 && currentTime - mLastOnKeyTime < 500) {
return true;
}
mLastOnKeyTime = currentTime;
LogUtil.e("---查看按键对应的数字---" + event.getKeyCode());
switch (event.getKeyCode()) {
case KeyEvent.KEYCODE_DEL://返回键
if (!isKeyEditHaveFocus) {
finish();
}
return true;
}
}
return super.dispatchKeyEvent(event);
}
@OnClick({R.id.back_iv, R.id.selete_area_lay, R.id.do_search, R.id.begin_test})
public void onClick(View view) {
switch (view.getId()) {
......
......@@ -4,6 +4,7 @@ import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.KeyEvent;
import android.view.View;
import android.widget.AdapterView;
import android.widget.EditText;
......@@ -17,6 +18,7 @@ import android.widget.TextView;
import com.app.baselibrary.base.common.BaseActivity;
import com.app.baselibrary.commonUtil.CheckUtil;
import com.app.baselibrary.commonUtil.LogUtil;
import com.app.baselibrary.commonUtil.ToastUtil;
import com.oo.eye.EyeConfig;
import com.oo.eye.R;
......@@ -104,7 +106,7 @@ public class TestResurtListActivity extends BaseActivity {
private int popuPosition;//1学校,2小组
private SchoolBean mSchoolBean;
private PopupWindow mPopupWindow;
private boolean isKeyEditHaveFocus;
@Override
protected int getLayoutId() {
return R.layout.activity_testresult;
......@@ -121,8 +123,38 @@ public class TestResurtListActivity extends BaseActivity {
mRecycleView.setAdapter(mResultListAdapter);
mSearchParamBean.setSchoolId(EyeConfig.TEST_SCHOOL_ID);
search();
mKeyTest.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
isKeyEditHaveFocus = hasFocus;
}
});
}
private long mLastOnKeyTime = -1;
@Override
public boolean dispatchKeyEvent(KeyEvent event) {
if (event.getAction() == KeyEvent.ACTION_UP) {
//两次点击大于1秒
long currentTime = System.currentTimeMillis();
if (mLastOnKeyTime > 0 && currentTime - mLastOnKeyTime < 500) {
return true;
}
mLastOnKeyTime = currentTime;
LogUtil.e("---查看按键对应的数字---" + event.getKeyCode());
switch (event.getKeyCode()) {
case KeyEvent.KEYCODE_DEL://返回键
if (!isKeyEditHaveFocus) {
finish();
}
return true;
}
}
return super.dispatchKeyEvent(event);
}
private boolean isA;
private boolean isTemporary;//是否是临时报表
......
......@@ -181,24 +181,5 @@ public abstract class BaseActivity extends RxAppCompatActivity {
}
private long mLastOnKeyTime = -1;
@Override
public boolean dispatchKeyEvent(KeyEvent event) {
if (event.getAction() == KeyEvent.ACTION_UP) {
//两次点击大于1秒
long currentTime = System.currentTimeMillis();
if (mLastOnKeyTime > 0 && currentTime - mLastOnKeyTime < 500) {
return true;
}
mLastOnKeyTime = currentTime;
LogUtil.e("---查看按键对应的数字---" + event.getKeyCode());
switch (event.getKeyCode()) {
case KeyEvent.KEYCODE_DEL://返回键
finish();
return true;
}
}
return super.dispatchKeyEvent(event);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment