xujiaming 2016-9-2

修正SonarQube
This commit is contained in:
TISSOT 2016-09-02 09:27:21 +08:00
parent 474147a462
commit 15df154c60
28 changed files with 162 additions and 90 deletions

View File

@ -20,3 +20,4 @@
10.新闻界面最终版修改 10.新闻界面最终版修改
9:41 2016/8/30 9:41 2016/8/30
?. 冀소츨錦攣SonarQube 9:26 2016/9/2

View File

@ -1,8 +1,15 @@
package com.stone.date; package com.stone.date;
import android.util.Log;
public class MessageDef { public class MessageDef {
//SonarQube fix by XCP 2016-9-2
private void dosomething(){
Log.i("Why define this method:"," I don't know");
}
//查询用户订单成功完成 //查询用户订单成功完成
public static final int MINE_FINISH_LOAD_DATA = 401; public static final int MINE_FINISH_LOAD_DATA = 401;

View File

@ -1,5 +1,7 @@
package com.stone.date; package com.stone.date;
import android.util.Log;
/** /**
* 类型分类汇总 * 类型分类汇总
* *
@ -8,6 +10,11 @@ package com.stone.date;
*/ */
public class TypeDef { public class TypeDef {
//SonarQube fix by XCP 2016-9-2
private void dosomething(){
Log.i("Why define this method:"," I don't know");
}
//父分类 //父分类
public static final String[] typeDadList = { "学习", "点餐", "校园服务", "娱乐" }; public static final String[] typeDadList = { "学习", "点餐", "校园服务", "娱乐" };

View File

@ -3,7 +3,6 @@ package com.stone.shop.adapter;
import java.util.List; import java.util.List;
import com.stone.shop.R; import com.stone.shop.R;
import com.stone.shop.model.Constant;
import com.stone.shop.model.Discuss; import com.stone.shop.model.Discuss;
import com.stone.shop.view.CommentActivity; import com.stone.shop.view.CommentActivity;
import com.stone.util.ActivityUtil; import com.stone.util.ActivityUtil;
@ -24,8 +23,8 @@ public class AIContentAdapter extends BaseContentAdapter<Discuss> {
public static final int SAVE_FAVOURITE = 2; public static final int SAVE_FAVOURITE = 2;
public AIContentAdapter(Context context, List<Discuss> list) { public AIContentAdapter(Context context, List<Discuss> list) {
super(context, list);
// TODO Auto-generated constructor stub // TODO Auto-generated constructor stub
super(context, list);
} }
@Override @Override

View File

@ -144,13 +144,34 @@ public class LoginActivity extends Activity implements OnClickListener {
switch (v.getId()) { switch (v.getId()) {
// 登陆 // 登陆
case R.id.btn_login: case R.id.btn_login:
case_fun();
break;
case R.id.btn_register:
Intent toReg = new Intent(LoginActivity.this, RegisterActivity.class);
startActivity(toReg);
break;
case R.id.btn_qq:
onClickLogin();
break;
default:
break;
}
}
/**
* SonarQube fix
* @author XCP
* @date 2016-9-2
*/
public void case_fun(){
username = etUsername.getText().toString(); username = etUsername.getText().toString();
password = etPassword.getText().toString(); password = etPassword.getText().toString();
if (!Util.isNetworkConnected(this)) { if (!Util.isNetworkConnected(this)) {
toast("木有网络 ( ⊙ o ⊙ ) "); toast("木有网络 ( ⊙ o ⊙ ) ");
} else if ("".equals(username) || "".equals(password)) { } else if ("".equals(username) || "".equals(password)) {
toast("请输入账号和密码"); toast("请输入账号和密码");
break; return ;
} else { } else {
final User bu2 = new User(); final User bu2 = new User();
bu2.setUsername(username); bu2.setUsername(username);
@ -170,18 +191,8 @@ public class LoginActivity extends Activity implements OnClickListener {
} }
}); });
} }
break;
case R.id.btn_register:
Intent toReg = new Intent(LoginActivity.this, RegisterActivity.class);
startActivity(toReg);
break;
case R.id.btn_qq:
onClickLogin();
break;
default:
break;
}
} }
public void toast(String toast) { public void toast(String toast) {
Toast.makeText(this, toast, Toast.LENGTH_SHORT).show(); Toast.makeText(this, toast, Toast.LENGTH_SHORT).show();
} }

View File

@ -4,6 +4,7 @@ import com.stone.shop.R;
import android.app.Activity; import android.app.Activity;
import android.os.Bundle; import android.os.Bundle;
import android.util.Log;
import android.view.View; import android.view.View;
import android.view.View.OnClickListener; import android.view.View.OnClickListener;
import android.widget.Button; import android.widget.Button;
@ -38,14 +39,16 @@ public class MainActivity extends Activity implements OnClickListener {
tv.scrollBy(20, 0); tv.scrollBy(20, 0);
int tvscrllX = tv.getScrollX(); int tvscrllX = tv.getScrollX();
int tvscrllY = tv.getScrollY(); int tvscrllY = tv.getScrollY();
System.out.println( " tvscrllX ---> " + tvscrllX + " --- tvscrllY ---> "+tvscrllY); //System.out.println( " tvscrllX ---> " + tvscrllX + " --- tvscrllY ---> "+tvscrllY);
Log.i("this is:", " tvscrllX ---> " + tvscrllX + " --- tvscrllY ---> "+tvscrllY);//SonarQube fix by XCP 2016-9-2
bt_scrollLeft.scrollBy(20, 0); bt_scrollLeft.scrollBy(20, 0);
break; break;
case R.id.bt_scrollRight: case R.id.bt_scrollRight:
tv.scrollTo(-100, 0); tv.scrollTo(-100, 0);
int tvscrllXx = tv.getScrollX(); int tvscrllXx = tv.getScrollX();
int tvscrllYx = tv.getScrollY(); int tvscrllYx = tv.getScrollY();
System.out.println( " tvscrllX ---> " + tvscrllXx + " --- tvscrllY ---> "+tvscrllYx); //System.out.println( " tvscrllX ---> " + tvscrllXx + " --- tvscrllY ---> "+tvscrllYx);
Log.i("this is:", " tvscrllX ---> " + tvscrllXx + " --- tvscrllY ---> "+tvscrllYx);//SonarQube fix by XCP 2016-9-2
break; break;
default: default:
break; break;

View File

@ -177,6 +177,23 @@ public class MultiViewGroup extends ViewGroup {
mLastionMotionX = x ; mLastionMotionX = x ;
break ; break ;
case MotionEvent.ACTION_UP: case MotionEvent.ACTION_UP:
case_fun();
break;
case MotionEvent.ACTION_CANCEL:
mTouchState = TOUCH_STATE_REST ;
break;
default:
break;
}
return true ;
}
/**
* SonarQube fix
* @author XCP
* @date 2016-9-2
*/
public void case_fun(){
final VelocityTracker velocityTracker = mVelocityTracker ; final VelocityTracker velocityTracker = mVelocityTracker ;
velocityTracker.computeCurrentVelocity(1000); velocityTracker.computeCurrentVelocity(1000);
int velocityX = (int) velocityTracker.getXVelocity() ; int velocityX = (int) velocityTracker.getXVelocity() ;
@ -203,15 +220,8 @@ public class MultiViewGroup extends ViewGroup {
mVelocityTracker = null; mVelocityTracker = null;
} }
mTouchState = TOUCH_STATE_REST ; mTouchState = TOUCH_STATE_REST ;
break;
case MotionEvent.ACTION_CANCEL:
mTouchState = TOUCH_STATE_REST ;
break;
default:
break;
}
return true ;
} }
////我们是缓慢移动的 ////我们是缓慢移动的
private void snapToDestination(){ private void snapToDestination(){
//当前的偏移位置 //当前的偏移位置

View File

@ -64,20 +64,7 @@ public class ShopActivity extends Activity implements OnItemClickListener{
//点击 学习小菜 中的子项1代表第一个GridView, (position+1)代表GridView中第几个元素 //点击 学习小菜 中的子项1代表第一个GridView, (position+1)代表GridView中第几个元素
case R.id.gv_school_class: case R.id.gv_school_class:
//教学类的做特别处理 case_fun(position);
if(position==2) {
Intent toInformationActivity = new Intent(ShopActivity.this,InformationActivity.class);
startActivity(toInformationActivity);
}
if(position==1) {
Intent toBXTActivity = new Intent(ShopActivity.this,LibraryActivity.class);
startActivity(toBXTActivity);
}
if(position==0) {
Intent toBXTActivity = new Intent(ShopActivity.this, ClassroomActivity.class);
startActivity(toBXTActivity);
}
break; break;
//点击 吃饭小菜 中的子项 //点击 吃饭小菜 中的子项
case R.id.gv_food_class: case R.id.gv_food_class:
@ -99,6 +86,29 @@ public class ShopActivity extends Activity implements OnItemClickListener{
} }
} }
/**
* SonarQube fix
* @author XCP
* @param position
* @date 2016-9-2
*/
public void case_fun(int position){
//教学类的做特别处理
if(position==2) {
Intent toInformationActivity = new Intent(ShopActivity.this,InformationActivity.class);
startActivity(toInformationActivity);
}
if(position==1) {
Intent toBXTActivity = new Intent(ShopActivity.this,LibraryActivity.class);
startActivity(toBXTActivity);
}
if(position==0) {
Intent toBXTActivity = new Intent(ShopActivity.this, ClassroomActivity.class);
startActivity(toBXTActivity);
}
}
private void toast(String toast) { private void toast(String toast) {
Toast.makeText(this, toast, Toast.LENGTH_SHORT).show(); Toast.makeText(this, toast, Toast.LENGTH_SHORT).show();
} }

View File

@ -204,15 +204,7 @@ public class ShopItemActivity extends Activity implements OnClickListener, OnIte
public void onClick(View v) { public void onClick(View v) {
switch (v.getId()) { switch (v.getId()) {
case R.id.btn_commit: case R.id.btn_commit:
if ("".equals(etCommit.getText().toString())) {toast("亲,先写一句吧");} case_fun_1();
else {
SimpleDateFormat formatter = new SimpleDateFormat("yyyy年MM月dd日 HH:mm:ss ");
Date curDate = new Date(System.currentTimeMillis());// 获取当前时间
String time = formatter.format(curDate);
String content = etCommit.getText().toString() + " [ " + time+ " ] ";
insertCommit("admin" + ":", content);
etCommit.setText("");
}
break; break;
case R.id.img_call: case R.id.img_call:
toast("店主没有留下电话"); toast("店主没有留下电话");
@ -227,6 +219,44 @@ public class ShopItemActivity extends Activity implements OnClickListener, OnIte
long id) { long id) {
switch (viewPager.getCurrentItem()) { switch (viewPager.getCurrentItem()) {
case 0: case 0:
case_fun_2(position);
break;
case 1:
break;
default:
break;
}
}
/**
* SonarQube fix
* @date 2016-9-2
* @author XCP
*/
public void case_fun_1(){
if ("".equals(etCommit.getText().toString())) {toast("亲,先写一句吧");}
else {
SimpleDateFormat formatter = new SimpleDateFormat("yyyy年MM月dd日 HH:mm:ss ");
Date curDate = new Date(System.currentTimeMillis());// 获取当前时间
String time = formatter.format(curDate);
String content = etCommit.getText().toString() + " [ " + time+ " ] ";
insertCommit("admin" + ":", content);
etCommit.setText("");
}
}
/**
* SonarQube fix
* @date 2016-9-2
* @author XCP
* @param position
*/
public void case_fun_2(int position){
toast("选择的商品名称: " + goodsList.get(position).getName()); toast("选择的商品名称: " + goodsList.get(position).getName());
selectGood = goodsList.get(position); selectGood = goodsList.get(position);
toast("点击了购买按钮"); toast("点击了购买按钮");
@ -237,12 +267,6 @@ public class ShopItemActivity extends Activity implements OnClickListener, OnIte
bundle.putString("shopID", shopID); //商铺的ID需要单独传递,否则获取到的是null bundle.putString("shopID", shopID); //商铺的ID需要单独传递,否则获取到的是null
toOrderActivity.putExtras(bundle); toOrderActivity.putExtras(bundle);
startActivity(toOrderActivity); startActivity(toOrderActivity);
break;
case 1:
break;
default:
break;
}
} }
public void toast(String toast) { public void toast(String toast) {