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;
/** /**
* 类型分类汇总 * 类型分类汇总
* *
@ -7,6 +9,11 @@ package com.stone.date;
* @author Stone * @author Stone
*/ */
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,32 +144,7 @@ public class LoginActivity extends Activity implements OnClickListener {
switch (v.getId()) { switch (v.getId()) {
// 登陆 // 登陆
case R.id.btn_login: case R.id.btn_login:
username = etUsername.getText().toString(); case_fun();
password = etPassword.getText().toString();
if (!Util.isNetworkConnected(this)) {
toast("木有网络 ( ⊙ o ⊙ ) ");
} else if ("".equals(username) || "".equals(password)) {
toast("请输入账号和密码");
break;
} else {
final User bu2 = new User();
bu2.setUsername(username);
bu2.setPassword(password);
bu2.login(this, new SaveListener() {
@Override
public void onSuccess() {
toast("欢迎进入 在这里 服务系统");
saveUserInfo(username, password); // 保存用户信息
User.userId = bu2.getObjectId(); // 跳转到主页
Intent toHome = new Intent(LoginActivity.this, BaseActivity.class);
startActivity(toHome);
finish();}
@Override
public void onFailure(int arg0, String arg1) {
toast("用户名或密码错误");
}
});
}
break; break;
case R.id.btn_register: case R.id.btn_register:
Intent toReg = new Intent(LoginActivity.this, RegisterActivity.class); Intent toReg = new Intent(LoginActivity.this, RegisterActivity.class);
@ -182,6 +157,42 @@ public class LoginActivity extends Activity implements OnClickListener {
break; break;
} }
} }
/**
* SonarQube fix
* @author XCP
* @date 2016-9-2
*/
public void case_fun(){
username = etUsername.getText().toString();
password = etPassword.getText().toString();
if (!Util.isNetworkConnected(this)) {
toast("木有网络 ( ⊙ o ⊙ ) ");
} else if ("".equals(username) || "".equals(password)) {
toast("请输入账号和密码");
return ;
} else {
final User bu2 = new User();
bu2.setUsername(username);
bu2.setPassword(password);
bu2.login(this, new SaveListener() {
@Override
public void onSuccess() {
toast("欢迎进入 在这里 服务系统");
saveUserInfo(username, password); // 保存用户信息
User.userId = bu2.getObjectId(); // 跳转到主页
Intent toHome = new Intent(LoginActivity.this, BaseActivity.class);
startActivity(toHome);
finish();}
@Override
public void onFailure(int arg0, String arg1) {
toast("用户名或密码错误");
}
});
}
}
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,32 +177,7 @@ public class MultiViewGroup extends ViewGroup {
mLastionMotionX = x ; mLastionMotionX = x ;
break ; break ;
case MotionEvent.ACTION_UP: case MotionEvent.ACTION_UP:
final VelocityTracker velocityTracker = mVelocityTracker ; case_fun();
velocityTracker.computeCurrentVelocity(1000);
int velocityX = (int) velocityTracker.getXVelocity() ;
Log.e(TAG , "---velocityX---" + velocityX);
//滑动速率达到了一个标准(快速向右滑屏返回上一个屏幕) 马上进行切屏处理
if (velocityX > SNAP_VELOCITY && curScreen > 0) {
// Fling enough to move left
Log.e(TAG, "snap left");
snapToScreen(curScreen - 1);
}
//快速向左滑屏返回下一个屏幕)
else if(velocityX < -SNAP_VELOCITY && curScreen < (getChildCount()-1)){
Log.e(TAG, "snap right");
snapToScreen(curScreen + 1);
}
//以上为快速移动的 强制切换屏幕
else{
//我们是缓慢移动的因此先判断是保留在本屏幕还是到下一屏幕
snapToDestination();
}
if (mVelocityTracker != null) {
mVelocityTracker.recycle();
mVelocityTracker = null;
}
mTouchState = TOUCH_STATE_REST ;
break; break;
case MotionEvent.ACTION_CANCEL: case MotionEvent.ACTION_CANCEL:
mTouchState = TOUCH_STATE_REST ; mTouchState = TOUCH_STATE_REST ;
@ -212,6 +187,41 @@ public class MultiViewGroup extends ViewGroup {
} }
return true ; return true ;
} }
/**
* SonarQube fix
* @author XCP
* @date 2016-9-2
*/
public void case_fun(){
final VelocityTracker velocityTracker = mVelocityTracker ;
velocityTracker.computeCurrentVelocity(1000);
int velocityX = (int) velocityTracker.getXVelocity() ;
Log.e(TAG , "---velocityX---" + velocityX);
//滑动速率达到了一个标准(快速向右滑屏返回上一个屏幕) 马上进行切屏处理
if (velocityX > SNAP_VELOCITY && curScreen > 0) {
// Fling enough to move left
Log.e(TAG, "snap left");
snapToScreen(curScreen - 1);
}
//快速向左滑屏返回下一个屏幕)
else if(velocityX < -SNAP_VELOCITY && curScreen < (getChildCount()-1)){
Log.e(TAG, "snap right");
snapToScreen(curScreen + 1);
}
//以上为快速移动的 强制切换屏幕
else{
//我们是缓慢移动的因此先判断是保留在本屏幕还是到下一屏幕
snapToDestination();
}
if (mVelocityTracker != null) {
mVelocityTracker.recycle();
mVelocityTracker = null;
}
mTouchState = TOUCH_STATE_REST ;
}
////我们是缓慢移动的 ////我们是缓慢移动的
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,16 +219,7 @@ public class ShopItemActivity extends Activity implements OnClickListener, OnIte
long id) { long id) {
switch (viewPager.getCurrentItem()) { switch (viewPager.getCurrentItem()) {
case 0: case 0:
toast("选择的商品名称: " + goodsList.get(position).getName()); case_fun_2(position);
selectGood = goodsList.get(position);
toast("点击了购买按钮");
Intent toOrderActivity = new Intent(ShopItemActivity.this, OrderActivity.class);
Bundle bundle = new Bundle();
bundle.putSerializable("shop", shop );
bundle.putSerializable("good", selectGood);
bundle.putString("shopID", shopID); //商铺的ID需要单独传递,否则获取到的是null
toOrderActivity.putExtras(bundle);
startActivity(toOrderActivity);
break; break;
case 1: case 1:
break; break;
@ -245,6 +228,47 @@ public class ShopItemActivity extends Activity implements OnClickListener, OnIte
} }
} }
/**
* 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());
selectGood = goodsList.get(position);
toast("点击了购买按钮");
Intent toOrderActivity = new Intent(ShopItemActivity.this, OrderActivity.class);
Bundle bundle = new Bundle();
bundle.putSerializable("shop", shop );
bundle.putSerializable("good", selectGood);
bundle.putString("shopID", shopID); //商铺的ID需要单独传递,否则获取到的是null
toOrderActivity.putExtras(bundle);
startActivity(toOrderActivity);
}
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();
} }