基本信息
源码名称:基于高德地图物流车辆轨迹APP源码(含服务端源码以及数据库)
源码大小:7.96M
文件格式:.zip
开发语言:C/C++
更新时间:2019-11-21
   友情提示:(无需注册或充值,赞助后即可获取资源下载链接)

     嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300

本次赞助数额为: 2 元 
   源码介绍
基于高德地图物流车辆轨迹APP,后端为 C#语言,webservice做接口

package com.example.logisticstrail;

import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import com.example.DbUtil.DBUtil;
import Decoder.BASE64Encoder;
import android.os.Bundle;
import android.os.StrictMode;
import android.app.Activity;
import android.content.Intent;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.view.Menu;
import android.view.View;
import android.view.ViewTreeObserver.OnPreDrawListener;
import android.widget.Button;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.RadioGroup.OnCheckedChangeListener; 
import android.widget.Toast;

public class LoginActivity extends Activity {

    private RadioGroup group;  
    private RadioButton rb_company,rb_person;  
    private Drawable bottomDrawableUnchecked;  
    private Drawable bottomDrawableChecked; 
    private Button bt_Exp,bt_Login;
    private DBUtil dbUtil=new DBUtil();
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.login);

if (android.os.Build.VERSION.SDK_INT > 9) {
   StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
   StrictMode.setThreadPolicy(policy);
}
 
        group = (RadioGroup) this.findViewById(R.id.radioGroup1);  
        rb_company = (RadioButton) this.findViewById(R.id.rb_company);  
        rb_person = (RadioButton) this.findViewById(R.id.rb_person);  
        bt_Exp=(Button)findViewById(R.id.bt_Exp);
        bt_Login=(Button)findViewById(R.id.bt_Login);
        //处理点击事件  
        
        group.setOnCheckedChangeListener(new OnCheckedChangeListener() {  
              
            @Override  
            public void onCheckedChanged(RadioGroup group, int checkedId) {  
                  
            }  
        });  
       
        rb_company.setOnCheckedChangeListener(rbCheckedChangeListener);  
        rb_person.setOnCheckedChangeListener(rbCheckedChangeListener);  
        rb_company.setChecked(true);  
          
        bottomDrawableUnchecked = getResources().getDrawable(R.drawable.unchecked);  
        bottomDrawableChecked = getResources().getDrawable(R.drawable.checked);  

        rb_company.getViewTreeObserver().addOnPreDrawListener(new OnPreDrawListener() {  
              
            public boolean onPreDraw() {  
                
                //如果draw的Bounds = rb1.getMeasuredWidth() 就代表已经设置过了。  
                if(!(bottomDrawableChecked.getBounds().right ==  rb_company.getMeasuredWidth())){  
                    Rect rect = new Rect(0, 0, rb_company.getMeasuredWidth(), 10);  
                    //设置图片边框  
                    bottomDrawableUnchecked.setBounds(rect);  
                    bottomDrawableChecked.setBounds(rect);  
                    //设置图片  
                    rb_company.setCompoundDrawables(null, null, null, bottomDrawableChecked);//第一个是选中状态  
                    rb_person.setCompoundDrawables(null, null, null, bottomDrawableUnchecked);  
                    //设置图片与文字的间距  
                    rb_company.setCompoundDrawablePadding(10);  
                    rb_person.setCompoundDrawablePadding(10);
                }                   
                return true;  
            }  
        });    
        
        /*增加命令按钮单机监听事件*/
        bt_Login.setOnClickListener(new Button.OnClickListener()
        {

@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
try
{
EditText et_userName=(EditText)findViewById(R.id.et_userName);
EditText et_password=(EditText)findViewById(R.id.et_password);

String userName=et_userName.getText().toString();
String password=et_password.getText().toString();

if(userName.equals("") || password.equals(""))
{
Toast.makeText(LoginActivity.this, "请输入用户名与密码", Toast.LENGTH_LONG).show();
return;
}
else
{
String pwd=digestMD5(password);
if(dbUtil.QueryUserInfo(userName, pwd)==1)
{
Intent intent=new Intent();
intent.setClass(LoginActivity.this,MainActivity.class);
startActivity(intent);
}
else if(dbUtil.QueryUserInfo(userName, pwd)==0)
{
Toast.makeText(LoginActivity.this, "用户名密码错误", Toast.LENGTH_LONG).show();
return;
}
else if(dbUtil.QueryUserInfo(userName, pwd)==2)
{
Toast.makeText(LoginActivity.this, "网络连接失败", Toast.LENGTH_LONG).show();
return;
}
}
}
catch(Exception e)
{
System.out.println(e.getMessage());
}
}
       
        });
        bt_Exp.setOnClickListener(new Button.OnClickListener()
        {

@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
Intent intent=new Intent();
intent.setClass(LoginActivity.this,MainActivity.class);
startActivity(intent);
}       
        });
}
    private CompoundButton.OnCheckedChangeListener  rbCheckedChangeListener = new CompoundButton.OnCheckedChangeListener() {  
        
        @Override  
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {  
            if(isChecked){  
                buttonView.setCompoundDrawables(null, null, null, bottomDrawableChecked);  
            }else{  
                buttonView.setCompoundDrawables(null, null, null, bottomDrawableUnchecked);  
            } 
              
        }  
    };  
    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.main, menu);
        return true;
    }
    public static String digestMD5(String psw){
MessageDigest md;
try {
md = MessageDigest.getInstance("MD5");
byte[] bbs = md.digest(psw.getBytes());
BASE64Encoder base64 = new BASE64Encoder();
String s = base64.encode(bbs);
return s;
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
}
return null;
}
}