Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
fastdevelop
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
高超
fastdevelop
Commits
68e43135
Commit
68e43135
authored
Mar 06, 2019
by
gao.chao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
登录页,MVP框架
parent
0f23a161
Show whitespace changes
Inline
Side-by-side
Showing
46 changed files
with
1046 additions
and
46 deletions
+1046
-46
app/src/main/java/com/mayi/demo/BannerActivity.java
+17
-0
app/src/main/java/com/mayi/demo/DownLoadAPKActivity.java
+17
-0
app/src/main/java/com/mayi/demo/FunctionActivity.java
+35
-1
app/src/main/java/com/mayi/demo/LoadingPicturesActivity.java
+12
-0
app/src/main/java/com/mayi/demo/MainActivity.java
+17
-0
app/src/main/java/com/mayi/demo/MyApplication.java
+2
-0
app/src/main/java/com/mayi/demo/MyScanActivity.java
+17
-0
app/src/main/java/com/mayi/demo/OnMultiClickActivity.java
+17
-0
app/src/main/java/com/mayi/demo/PageActivity.java
+24
-8
app/src/main/java/com/mayi/demo/PermissionActivity.java
+16
-1
app/src/main/java/com/mayi/demo/QRActivity.java
+17
-0
app/src/main/java/com/mayi/demo/SmartRefreshLayoutActivity.java
+17
-0
app/src/main/java/com/mayi/demo/StartActivity.java
+11
-0
app/src/main/java/com/mayi/demo/TitleActivity.java
+17
-0
app/src/main/java/com/mayi/demo/ViewActviity.java
+16
-0
app/src/main/res/layout/activity_function.xml
+6
-0
app/src/main/res/layout/activity_page.xml
+6
-0
fastDevelop/src/main/AndroidManifest.xml
+2
-0
fastDevelop/src/main/java/com/mayi/fastdevelop/api/UserAPI.java
+19
-0
fastDevelop/src/main/java/com/mayi/fastdevelop/base/BaseAPI.java
+4
-0
fastDevelop/src/main/java/com/mayi/fastdevelop/base/BaseActivity.java
+56
-6
fastDevelop/src/main/java/com/mayi/fastdevelop/base/BasePresenter.java
+34
-0
fastDevelop/src/main/java/com/mayi/fastdevelop/base/BaseView.java
+4
-0
fastDevelop/src/main/java/com/mayi/fastdevelop/bean/LocationBean.java
+59
-0
fastDevelop/src/main/java/com/mayi/fastdevelop/commonpage/UpdateDownLoadAPKActvity.java
+1
-1
fastDevelop/src/main/java/com/mayi/fastdevelop/commonpage/WebActivity.java
+55
-10
fastDevelop/src/main/java/com/mayi/fastdevelop/commonpage/amap/MapLocationActivity.java
+12
-0
fastDevelop/src/main/java/com/mayi/fastdevelop/commonpage/login/LoginActivity.java
+176
-0
fastDevelop/src/main/java/com/mayi/fastdevelop/commonpage/login/LoginContract.java
+38
-0
fastDevelop/src/main/java/com/mayi/fastdevelop/commonpage/login/LoginPresenter.java
+29
-0
fastDevelop/src/main/java/com/mayi/fastdevelop/commonpage/main/MainActivity.java
+17
-0
fastDevelop/src/main/java/com/mayi/fastdevelop/comnon/Configure.java
+9
-0
fastDevelop/src/main/java/com/mayi/fastdevelop/comnon/HttpUrl.java
+10
-0
fastDevelop/src/main/java/com/mayi/fastdevelop/comnon/Key.java
+5
-0
fastDevelop/src/main/java/com/mayi/fastdevelop/comnon/UserManager.java
+14
-0
fastDevelop/src/main/java/com/mayi/fastdevelop/okhttp/NetWorkBuilder.java
+0
-13
fastDevelop/src/main/java/com/mayi/fastdevelop/okhttp/NetWorkUtil.java
+15
-6
fastDevelop/src/main/java/com/mayi/fastdevelop/util/LocationUtils.java
+70
-0
fastDevelop/src/main/res/color/color_enable_white_grey_light.xml
+6
-0
fastDevelop/src/main/res/layout/activity_login.xml
+127
-0
fastDevelop/src/main/res/mipmap-xxhdpi/ic_launcher.png
+0
-0
fastDevelop/src/main/res/mipmap-xxhdpi/icon_close_eyes.png
+0
-0
fastDevelop/src/main/res/mipmap-xxhdpi/icon_open_eyes.png
+0
-0
fastDevelop/src/main/res/values/dimens.xml
+1
-0
fastDevelop/src/main/res/values/integers.xml
+10
-0
fastDevelop/src/main/res/values/strings.xml
+9
-0
No files found.
app/src/main/java/com/mayi/demo/BannerActivity.java
View file @
68e43135
...
@@ -3,7 +3,9 @@ package com.mayi.demo;
...
@@ -3,7 +3,9 @@ package com.mayi.demo;
import
android.os.Bundle
;
import
android.os.Bundle
;
import
android.support.annotation.Nullable
;
import
android.support.annotation.Nullable
;
import
com.mayi.fastdevelop.base.BaseAPI
;
import
com.mayi.fastdevelop.base.BaseActivity
;
import
com.mayi.fastdevelop.base.BaseActivity
;
import
com.mayi.fastdevelop.base.BasePresenter
;
import
com.mayi.fastdevelop.view.PicassoImageLoader
;
import
com.mayi.fastdevelop.view.PicassoImageLoader
;
import
com.youth.banner.Banner
;
import
com.youth.banner.Banner
;
import
com.youth.banner.BannerConfig
;
import
com.youth.banner.BannerConfig
;
...
@@ -19,6 +21,16 @@ public class BannerActivity extends BaseActivity implements OnBannerListener {
...
@@ -19,6 +21,16 @@ public class BannerActivity extends BaseActivity implements OnBannerListener {
List
listText
=
new
ArrayList
();
List
listText
=
new
ArrayList
();
@Override
@Override
public
BasePresenter
getPresenterInstance
()
{
return
null
;
}
@Override
public
BaseAPI
getModelInstance
()
{
return
null
;
}
@Override
protected
void
onCreate
(
@Nullable
Bundle
savedInstanceState
)
{
protected
void
onCreate
(
@Nullable
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_banner
);
setContentView
(
R
.
layout
.
activity_banner
);
...
@@ -60,4 +72,9 @@ public class BannerActivity extends BaseActivity implements OnBannerListener {
...
@@ -60,4 +72,9 @@ public class BannerActivity extends BaseActivity implements OnBannerListener {
public
void
OnBannerClick
(
int
position
)
{
public
void
OnBannerClick
(
int
position
)
{
showToast
(
"position="
+
position
);
showToast
(
"position="
+
position
);
}
}
@Override
public
BasePresenter
getPresenter
()
{
return
null
;
}
}
}
app/src/main/java/com/mayi/demo/DownLoadAPKActivity.java
View file @
68e43135
...
@@ -4,12 +4,24 @@ import android.os.Bundle;
...
@@ -4,12 +4,24 @@ import android.os.Bundle;
import
android.support.annotation.Nullable
;
import
android.support.annotation.Nullable
;
import
android.view.View
;
import
android.view.View
;
import
com.mayi.fastdevelop.base.BaseAPI
;
import
com.mayi.fastdevelop.base.BasePresenter
;
import
com.mayi.fastdevelop.bean.AppConfig
;
import
com.mayi.fastdevelop.bean.AppConfig
;
import
com.mayi.fastdevelop.commonpage.UpdateDownLoadAPKActvity
;
import
com.mayi.fastdevelop.commonpage.UpdateDownLoadAPKActvity
;
public
class
DownLoadAPKActivity
extends
UpdateDownLoadAPKActvity
{
public
class
DownLoadAPKActivity
extends
UpdateDownLoadAPKActvity
{
@Override
@Override
public
BasePresenter
getPresenterInstance
()
{
return
null
;
}
@Override
public
BaseAPI
getModelInstance
()
{
return
null
;
}
@Override
protected
void
onCreate
(
@Nullable
Bundle
savedInstanceState
)
{
protected
void
onCreate
(
@Nullable
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
avtivity_download_apk
);
setContentView
(
R
.
layout
.
avtivity_download_apk
);
...
@@ -48,4 +60,9 @@ public class DownLoadAPKActivity extends UpdateDownLoadAPKActvity {
...
@@ -48,4 +60,9 @@ public class DownLoadAPKActivity extends UpdateDownLoadAPKActvity {
appConfig
.
setUpdateUrl
(
"https://kuka-life.oss-cn-hangzhou.aliyuncs.com/usermanager/app/android/userManager.apk"
);
appConfig
.
setUpdateUrl
(
"https://kuka-life.oss-cn-hangzhou.aliyuncs.com/usermanager/app/android/userManager.apk"
);
downLoadAPK
(
appConfig
);
downLoadAPK
(
appConfig
);
}
}
@Override
public
BasePresenter
getPresenter
()
{
return
null
;
}
}
}
app/src/main/java/com/mayi/demo/FunctionActivity.java
View file @
68e43135
...
@@ -4,17 +4,31 @@ import android.os.Bundle;
...
@@ -4,17 +4,31 @@ import android.os.Bundle;
import
android.support.annotation.Nullable
;
import
android.support.annotation.Nullable
;
import
android.view.View
;
import
android.view.View
;
import
com.alibaba.fastjson.JSON
;
import
com.mayi.fastdevelop.base.BaseAPI
;
import
com.mayi.fastdevelop.base.BaseActivity
;
import
com.mayi.fastdevelop.base.BaseActivity
;
import
com.mayi.fastdevelop.base.BasePresenter
;
import
com.mayi.fastdevelop.bean.LocationBean
;
import
com.mayi.fastdevelop.bean.UserInfo
;
import
com.mayi.fastdevelop.bean.UserInfo
;
import
com.mayi.fastdevelop.comnon.Constant
;
import
com.mayi.fastdevelop.comnon.Constant
;
import
com.mayi.fastdevelop.okhttp.NetWorkBuilder
;
import
com.mayi.fastdevelop.okhttp.NetWorkBuilder
;
import
com.mayi.fastdevelop.okhttp.NetWorkUtil
;
import
com.mayi.fastdevelop.okhttp.ResultCallback
;
import
com.mayi.fastdevelop.okhttp.ResultCallback
;
import
com.mayi.fastdevelop.util.LocationUtils
;
import
com.mayi.fastdevelop.view.OnMultiClickListener
;
import
com.mayi.fastdevelop.view.OnMultiClickListener
;
public
class
FunctionActivity
extends
BaseActivity
{
public
class
FunctionActivity
extends
BaseActivity
{
@Override
@Override
public
BasePresenter
getPresenterInstance
()
{
return
null
;
}
@Override
public
BaseAPI
getModelInstance
()
{
return
null
;
}
@Override
protected
void
onCreate
(
@Nullable
Bundle
savedInstanceState
)
{
protected
void
onCreate
(
@Nullable
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_function
);
setContentView
(
R
.
layout
.
activity_function
);
...
@@ -86,7 +100,27 @@ public class FunctionActivity extends BaseActivity {
...
@@ -86,7 +100,27 @@ public class FunctionActivity extends BaseActivity {
}).
execute
();
}).
execute
();
}
}
});
});
findViewById
(
R
.
id
.
b8
).
setOnClickListener
(
new
OnMultiClickListener
()
{
@Override
public
void
onMultiClick
(
View
v
)
{
LocationUtils
.
startLocation
(
v
.
getContext
(),
new
LocationUtils
.
LocationCallback
()
{
@Override
public
void
onFail
(
String
msg
)
{
showToast
(
msg
);
}
@Override
public
void
onSuccess
(
LocationBean
bean
)
{
showToast
(
JSON
.
toJSONString
(
bean
));
}
});
}
});
}
}
@Override
public
BasePresenter
getPresenter
()
{
return
null
;
}
}
}
app/src/main/java/com/mayi/demo/LoadingPicturesActivity.java
View file @
68e43135
...
@@ -5,7 +5,9 @@ import android.os.Environment;
...
@@ -5,7 +5,9 @@ import android.os.Environment;
import
android.support.annotation.Nullable
;
import
android.support.annotation.Nullable
;
import
android.widget.ImageView
;
import
android.widget.ImageView
;
import
com.mayi.fastdevelop.base.BaseAPI
;
import
com.mayi.fastdevelop.base.BaseActivity
;
import
com.mayi.fastdevelop.base.BaseActivity
;
import
com.mayi.fastdevelop.base.BasePresenter
;
import
com.mayi.fastdevelop.view.LoadingPictures
;
import
com.mayi.fastdevelop.view.LoadingPictures
;
import
java.io.File
;
import
java.io.File
;
...
@@ -14,6 +16,16 @@ public class LoadingPicturesActivity extends BaseActivity {
...
@@ -14,6 +16,16 @@ public class LoadingPicturesActivity extends BaseActivity {
@Override
@Override
public
BasePresenter
getPresenterInstance
()
{
return
null
;
}
@Override
public
BaseAPI
getModelInstance
()
{
return
null
;
}
@Override
protected
void
onCreate
(
@Nullable
Bundle
savedInstanceState
)
{
protected
void
onCreate
(
@Nullable
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_loading_pictures
);
setContentView
(
R
.
layout
.
activity_loading_pictures
);
...
...
app/src/main/java/com/mayi/demo/MainActivity.java
View file @
68e43135
...
@@ -9,7 +9,9 @@ import android.view.View;
...
@@ -9,7 +9,9 @@ import android.view.View;
import
android.view.ViewGroup
;
import
android.view.ViewGroup
;
import
android.widget.Button
;
import
android.widget.Button
;
import
com.mayi.fastdevelop.base.BaseAPI
;
import
com.mayi.fastdevelop.base.BaseActivity
;
import
com.mayi.fastdevelop.base.BaseActivity
;
import
com.mayi.fastdevelop.base.BasePresenter
;
import
com.mayi.fastdevelop.util.DrawableUtils
;
import
com.mayi.fastdevelop.util.DrawableUtils
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
...
@@ -18,6 +20,16 @@ import java.util.List;
...
@@ -18,6 +20,16 @@ import java.util.List;
public
class
MainActivity
extends
BaseActivity
{
public
class
MainActivity
extends
BaseActivity
{
@Override
@Override
public
BasePresenter
getPresenterInstance
()
{
return
null
;
}
@Override
public
BaseAPI
getModelInstance
()
{
return
null
;
}
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_main
);
setContentView
(
R
.
layout
.
activity_main
);
...
@@ -64,6 +76,11 @@ public class MainActivity extends BaseActivity {
...
@@ -64,6 +76,11 @@ public class MainActivity extends BaseActivity {
});
});
}
}
@Override
public
BasePresenter
getPresenter
()
{
return
null
;
}
class
MyViewHolder
extends
RecyclerView
.
ViewHolder
{
class
MyViewHolder
extends
RecyclerView
.
ViewHolder
{
Button
tv
;
Button
tv
;
...
...
app/src/main/java/com/mayi/demo/MyApplication.java
View file @
68e43135
...
@@ -3,6 +3,7 @@ package com.mayi.demo;
...
@@ -3,6 +3,7 @@ package com.mayi.demo;
import
android.app.Application
;
import
android.app.Application
;
import
com.mayi.fastdevelop.base.BaseApplication
;
import
com.mayi.fastdevelop.base.BaseApplication
;
import
com.mayi.fastdevelop.comnon.Configure
;
public
class
MyApplication
extends
BaseApplication
{
public
class
MyApplication
extends
BaseApplication
{
...
@@ -10,6 +11,7 @@ public class MyApplication extends BaseApplication{
...
@@ -10,6 +11,7 @@ public class MyApplication extends BaseApplication{
public
void
onCreate
()
{
public
void
onCreate
()
{
super
.
onCreate
();
super
.
onCreate
();
initBugly
(
"cb8018da1b"
,
true
);
initBugly
(
"cb8018da1b"
,
true
);
Configure
.
APP_LOGO
=
R
.
mipmap
.
ic_launcher
;
}
}
@Override
@Override
...
...
app/src/main/java/com/mayi/demo/MyScanActivity.java
View file @
68e43135
package
com
.
mayi
.
demo
;
package
com
.
mayi
.
demo
;
import
com.mayi.fastdevelop.base.BaseAPI
;
import
com.mayi.fastdevelop.base.BasePresenter
;
import
com.mayi.fastdevelop.commonpage.zxing.BaseScanActivity
;
import
com.mayi.fastdevelop.commonpage.zxing.BaseScanActivity
;
public
class
MyScanActivity
extends
BaseScanActivity
{
public
class
MyScanActivity
extends
BaseScanActivity
{
...
@@ -8,4 +10,19 @@ public class MyScanActivity extends BaseScanActivity{
...
@@ -8,4 +10,19 @@ public class MyScanActivity extends BaseScanActivity{
showToast
(
resultString
);
showToast
(
resultString
);
restartPreview
();
restartPreview
();
}
}
@Override
public
BasePresenter
getPresenterInstance
()
{
return
null
;
}
@Override
public
BaseAPI
getModelInstance
()
{
return
null
;
}
@Override
public
BasePresenter
getPresenter
()
{
return
null
;
}
}
}
app/src/main/java/com/mayi/demo/OnMultiClickActivity.java
View file @
68e43135
...
@@ -5,7 +5,9 @@ import android.support.annotation.Nullable;
...
@@ -5,7 +5,9 @@ import android.support.annotation.Nullable;
import
android.view.View
;
import
android.view.View
;
import
android.widget.Button
;
import
android.widget.Button
;
import
com.mayi.fastdevelop.base.BaseAPI
;
import
com.mayi.fastdevelop.base.BaseActivity
;
import
com.mayi.fastdevelop.base.BaseActivity
;
import
com.mayi.fastdevelop.base.BasePresenter
;
import
com.mayi.fastdevelop.view.OnMultiClickListener
;
import
com.mayi.fastdevelop.view.OnMultiClickListener
;
public
class
OnMultiClickActivity
extends
BaseActivity
{
public
class
OnMultiClickActivity
extends
BaseActivity
{
...
@@ -13,6 +15,16 @@ public class OnMultiClickActivity extends BaseActivity {
...
@@ -13,6 +15,16 @@ public class OnMultiClickActivity extends BaseActivity {
private
long
last
;
private
long
last
;
@Override
@Override
public
BasePresenter
getPresenterInstance
()
{
return
null
;
}
@Override
public
BaseAPI
getModelInstance
()
{
return
null
;
}
@Override
protected
void
onCreate
(
@Nullable
Bundle
savedInstanceState
)
{
protected
void
onCreate
(
@Nullable
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_onmulticlick
);
setContentView
(
R
.
layout
.
activity_onmulticlick
);
...
@@ -29,4 +41,9 @@ public class OnMultiClickActivity extends BaseActivity {
...
@@ -29,4 +41,9 @@ public class OnMultiClickActivity extends BaseActivity {
}
}
});
});
}
}
@Override
public
BasePresenter
getPresenter
()
{
return
null
;
}
}
}
app/src/main/java/com/mayi/demo/PageActivity.java
View file @
68e43135
package
com
.
mayi
.
demo
;
package
com
.
mayi
.
demo
;
import
android.annotation.SuppressLint
;
import
android.app.Activity
;
import
android.app.Activity
;
import
android.content.Context
;
import
android.content.Intent
;
import
android.content.Intent
;
import
android.net.Uri
;
import
android.os.Bundle
;
import
android.os.Bundle
;
import
android.support.annotation.Nullable
;
import
android.support.annotation.Nullable
;
import
android.telephony.PhoneNumberUtils
;
import
android.telephony.TelephonyManager
;
import
android.text.TextUtils
;
import
android.view.View
;
import
android.view.View
;
import
com.mayi.fastdevelop.base.BaseAPI
;
import
com.mayi.fastdevelop.base.BaseActivity
;
import
com.mayi.fastdevelop.base.BaseActivity
;
import
com.mayi.fastdevelop.base.BasePresenter
;
import
com.mayi.fastdevelop.commonpage.WebActivity
;
import
com.mayi.fastdevelop.commonpage.WebActivity
;
import
com.mayi.fastdevelop.commonpage.amap.MapLocationActivity
;
import
com.mayi.fastdevelop.commonpage.amap.MapLocationActivity
;
import
com.mayi.fastdevelop.commonpage.login.LoginActivity
;
import
com.mayi.fastdevelop.comnon.Key
;
import
com.mayi.fastdevelop.comnon.Key
;
import
com.mayi.fastdevelop.comnon.RequestCode
;
import
com.mayi.fastdevelop.comnon.RequestCode
;
import
com.mayi.fastdevelop.util.SystemUtil
;
import
com.mayi.fastdevelop.util.ToastUtil
;
import
com.mayi.fastdevelop.util.ToolUtils
;
import
com.mayi.fastdevelop.util.ToolUtils
;
import
com.mayi.fastdevelop.view.OnMultiClickListener
;
import
com.mayi.fastdevelop.view.OnMultiClickListener
;
...
@@ -26,6 +21,16 @@ public class PageActivity extends BaseActivity {
...
@@ -26,6 +21,16 @@ public class PageActivity extends BaseActivity {
@Override
@Override
public
BasePresenter
getPresenterInstance
()
{
return
null
;
}
@Override
public
BaseAPI
getModelInstance
()
{
return
null
;
}
@Override
protected
void
onCreate
(
@Nullable
Bundle
savedInstanceState
)
{
protected
void
onCreate
(
@Nullable
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_page
);
setContentView
(
R
.
layout
.
activity_page
);
...
@@ -77,6 +82,12 @@ public class PageActivity extends BaseActivity {
...
@@ -77,6 +82,12 @@ public class PageActivity extends BaseActivity {
startActivityForResult
(
intent
,
RequestCode
.
MAP_LOCATION_ACTIVITY_RESULTCODE
);
startActivityForResult
(
intent
,
RequestCode
.
MAP_LOCATION_ACTIVITY_RESULTCODE
);
}
}
});
});
findViewById
(
R
.
id
.
b8
).
setOnClickListener
(
new
OnMultiClickListener
()
{
@Override
public
void
onMultiClick
(
View
v
)
{
gotoActivity
(
LoginActivity
.
class
);
}
});
}
}
@Override
@Override
...
@@ -88,4 +99,9 @@ public class PageActivity extends BaseActivity {
...
@@ -88,4 +99,9 @@ public class PageActivity extends BaseActivity {
}
}
super
.
onActivityResult
(
requestCode
,
resultCode
,
data
);
super
.
onActivityResult
(
requestCode
,
resultCode
,
data
);
}
}
@Override
public
BasePresenter
getPresenter
()
{
return
null
;
}
}
}
app/src/main/java/com/mayi/demo/PermissionActivity.java
View file @
68e43135
...
@@ -8,7 +8,9 @@ import android.widget.Button;
...
@@ -8,7 +8,9 @@ import android.widget.Button;
import
android.widget.TextView
;
import
android.widget.TextView
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.mayi.fastdevelop.base.BaseAPI
;
import
com.mayi.fastdevelop.base.BaseActivity
;
import
com.mayi.fastdevelop.base.BaseActivity
;
import
com.mayi.fastdevelop.base.BasePresenter
;
import
com.mayi.fastdevelop.util.PermissionUtil
;
import
com.mayi.fastdevelop.util.PermissionUtil
;
import
com.mayi.fastdevelop.view.OnMultiClickListener
;
import
com.mayi.fastdevelop.view.OnMultiClickListener
;
import
com.yanzhenjie.permission.Permission
;
import
com.yanzhenjie.permission.Permission
;
...
@@ -21,6 +23,16 @@ import java.util.List;
...
@@ -21,6 +23,16 @@ import java.util.List;
public
class
PermissionActivity
extends
BaseActivity
{
public
class
PermissionActivity
extends
BaseActivity
{
@Override
@Override
public
BasePresenter
getPresenterInstance
()
{
return
null
;
}
@Override
public
BaseAPI
getModelInstance
()
{
return
null
;
}
@Override
protected
void
onCreate
(
@Nullable
Bundle
savedInstanceState
)
{
protected
void
onCreate
(
@Nullable
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_permission
);
setContentView
(
R
.
layout
.
activity_permission
);
...
@@ -47,5 +59,8 @@ public class PermissionActivity extends BaseActivity {
...
@@ -47,5 +59,8 @@ public class PermissionActivity extends BaseActivity {
}
}
@Override
public
BasePresenter
getPresenter
()
{
return
null
;
}
}
}
app/src/main/java/com/mayi/demo/QRActivity.java
View file @
68e43135
...
@@ -8,7 +8,9 @@ import android.widget.EditText;
...
@@ -8,7 +8,9 @@ import android.widget.EditText;
import
android.widget.ImageView
;
import
android.widget.ImageView
;
import
android.widget.TextView
;
import
android.widget.TextView
;
import
com.mayi.fastdevelop.base.BaseAPI
;
import
com.mayi.fastdevelop.base.BaseActivity
;
import
com.mayi.fastdevelop.base.BaseActivity
;
import
com.mayi.fastdevelop.base.BasePresenter
;
import
com.mayi.fastdevelop.util.BitmapUtil
;
import
com.mayi.fastdevelop.util.BitmapUtil
;
import
com.mayi.fastdevelop.util.QrUtil
;
import
com.mayi.fastdevelop.util.QrUtil
;
...
@@ -21,6 +23,16 @@ public class QRActivity extends BaseActivity {
...
@@ -21,6 +23,16 @@ public class QRActivity extends BaseActivity {
@Override
@Override
public
BasePresenter
getPresenterInstance
()
{
return
null
;
}
@Override
public
BaseAPI
getModelInstance
()
{
return
null
;
}
@Override
protected
void
onCreate
(
@Nullable
Bundle
savedInstanceState
)
{
protected
void
onCreate
(
@Nullable
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
qr_layout
);
setContentView
(
R
.
layout
.
qr_layout
);
...
@@ -49,4 +61,9 @@ public class QRActivity extends BaseActivity {
...
@@ -49,4 +61,9 @@ public class QRActivity extends BaseActivity {
tv
.
setText
(
"图片中二维码文字:"
+
QrUtil
.
recogQRcode
(
BitmapUtil
.
getBitmap
(
this
,
R
.
mipmap
.
qr_icon
)));
tv
.
setText
(
"图片中二维码文字:"
+
QrUtil
.
recogQRcode
(
BitmapUtil
.
getBitmap
(
this
,
R
.
mipmap
.
qr_icon
)));
}
}
@Override
public
BasePresenter
getPresenter
()
{
return
null
;
}
}
}
app/src/main/java/com/mayi/demo/SmartRefreshLayoutActivity.java
View file @
68e43135
...
@@ -10,7 +10,9 @@ import android.view.View;
...
@@ -10,7 +10,9 @@ import android.view.View;
import
android.view.ViewGroup
;
import
android.view.ViewGroup
;
import
android.widget.TextView
;
import
android.widget.TextView
;
import
com.mayi.fastdevelop.base.BaseAPI
;
import
com.mayi.fastdevelop.base.BaseActivity
;
import
com.mayi.fastdevelop.base.BaseActivity
;
import
com.mayi.fastdevelop.base.BasePresenter
;
import
com.scwang.smartrefresh.layout.SmartRefreshLayout
;
import
com.scwang.smartrefresh.layout.SmartRefreshLayout
;
import
com.scwang.smartrefresh.layout.api.RefreshLayout
;
import
com.scwang.smartrefresh.layout.api.RefreshLayout
;
import
com.scwang.smartrefresh.layout.listener.OnLoadmoreListener
;
import
com.scwang.smartrefresh.layout.listener.OnLoadmoreListener
;
...
@@ -25,6 +27,16 @@ public class SmartRefreshLayoutActivity extends BaseActivity {
...
@@ -25,6 +27,16 @@ public class SmartRefreshLayoutActivity extends BaseActivity {
Handler
handler
;
Handler
handler
;
@Override
@Override
public
BasePresenter
getPresenterInstance
()
{
return
null
;
}
@Override
public
BaseAPI
getModelInstance
()
{
return
null
;
}
@Override
protected
void
onCreate
(
@Nullable
Bundle
savedInstanceState
)
{
protected
void
onCreate
(
@Nullable
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_smartrefreshlayout
);
setContentView
(
R
.
layout
.
activity_smartrefreshlayout
);
...
@@ -67,6 +79,11 @@ public class SmartRefreshLayoutActivity extends BaseActivity {
...
@@ -67,6 +79,11 @@ public class SmartRefreshLayoutActivity extends BaseActivity {
});
});
}
}
@Override
public
BasePresenter
getPresenter
()
{
return
null
;
}
class
MyAdapter
extends
RecyclerView
.
Adapter
<
MyVH
>
{
class
MyAdapter
extends
RecyclerView
.
Adapter
<
MyVH
>
{
...
...
app/src/main/java/com/mayi/demo/StartActivity.java
View file @
68e43135
package
com
.
mayi
.
demo
;
package
com
.
mayi
.
demo
;
import
com.mayi.fastdevelop.base.BaseAPI
;
import
com.mayi.fastdevelop.base.BasePresenter
;
import
com.mayi.fastdevelop.commonpage.BaseStartActivity
;
import
com.mayi.fastdevelop.commonpage.BaseStartActivity
;
public
class
StartActivity
extends
BaseStartActivity
<
ViewActviity
,
ViewActviity
,
ViewActviity
>{
public
class
StartActivity
extends
BaseStartActivity
<
ViewActviity
,
ViewActviity
,
ViewActviity
>{
...
@@ -18,4 +20,13 @@ public class StartActivity extends BaseStartActivity<ViewActviity,ViewActviity,V
...
@@ -18,4 +20,13 @@ public class StartActivity extends BaseStartActivity<ViewActviity,ViewActviity,V
return
ViewActviity
.
class
;
return
ViewActviity
.
class
;
}
}
@Override
public
BasePresenter
getPresenterInstance
()
{
return
null
;
}
@Override
public
BaseAPI
getModelInstance
()
{
return
null
;
}
}
}
app/src/main/java/com/mayi/demo/TitleActivity.java
View file @
68e43135
...
@@ -4,13 +4,25 @@ import android.os.Bundle;
...
@@ -4,13 +4,25 @@ import android.os.Bundle;
import
android.support.annotation.Nullable
;
import
android.support.annotation.Nullable
;
import
android.view.View
;
import
android.view.View
;
import
com.mayi.fastdevelop.base.BaseAPI
;
import
com.mayi.fastdevelop.base.BaseActivity
;
import
com.mayi.fastdevelop.base.BaseActivity
;
import
com.mayi.fastdevelop.base.BasePresenter
;
import
com.mayi.fastdevelop.util.ToastUtil
;
import
com.mayi.fastdevelop.util.ToastUtil
;
import
com.mayi.fastdevelop.view.CustomTitleBar
;
import
com.mayi.fastdevelop.view.CustomTitleBar
;
public
class
TitleActivity
extends
BaseActivity
{
public
class
TitleActivity
extends
BaseActivity
{
@Override
@Override
public
BasePresenter
getPresenterInstance
()
{
return
null
;
}
@Override
public
BaseAPI
getModelInstance
()
{
return
null
;
}
@Override
protected
void
onCreate
(
@Nullable
Bundle
savedInstanceState
)
{
protected
void
onCreate
(
@Nullable
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
title_activity_layout
);
setContentView
(
R
.
layout
.
title_activity_layout
);
...
@@ -67,4 +79,9 @@ public class TitleActivity extends BaseActivity{
...
@@ -67,4 +79,9 @@ public class TitleActivity extends BaseActivity{
titleBar5
.
setTextCenter
(
"标题5"
);
titleBar5
.
setTextCenter
(
"标题5"
);
titleBar5
.
setTextCenterDrawableLeftRight
(
R
.
mipmap
.
ic_launcher
,
R
.
mipmap
.
ic_launcher_round
);
titleBar5
.
setTextCenterDrawableLeftRight
(
R
.
mipmap
.
ic_launcher
,
R
.
mipmap
.
ic_launcher_round
);
}
}
@Override
public
BasePresenter
getPresenter
()
{
return
null
;
}
}
}
app/src/main/java/com/mayi/demo/ViewActviity.java
View file @
68e43135
...
@@ -5,7 +5,9 @@ import android.support.annotation.Nullable;
...
@@ -5,7 +5,9 @@ import android.support.annotation.Nullable;
import
android.util.Log
;
import
android.util.Log
;
import
android.view.View
;
import
android.view.View
;
import
com.mayi.fastdevelop.base.BaseAPI
;
import
com.mayi.fastdevelop.base.BaseActivity
;
import
com.mayi.fastdevelop.base.BaseActivity
;
import
com.mayi.fastdevelop.base.BasePresenter
;
import
com.mayi.fastdevelop.util.DialogUtils
;
import
com.mayi.fastdevelop.util.DialogUtils
;
import
com.mayi.fastdevelop.util.LogUtils
;
import
com.mayi.fastdevelop.util.LogUtils
;
import
com.mayi.fastdevelop.util.ToastUtil
;
import
com.mayi.fastdevelop.util.ToastUtil
;
...
@@ -21,6 +23,16 @@ public class ViewActviity extends BaseActivity {
...
@@ -21,6 +23,16 @@ public class ViewActviity extends BaseActivity {
@Override
@Override
public
BasePresenter
getPresenterInstance
()
{
return
null
;
}
@Override
public
BaseAPI
getModelInstance
()
{
return
null
;
}
@Override
protected
void
onCreate
(
@Nullable
Bundle
savedInstanceState
)
{
protected
void
onCreate
(
@Nullable
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
test_layout
);
setContentView
(
R
.
layout
.
test_layout
);
...
@@ -161,6 +173,10 @@ public class ViewActviity extends BaseActivity {
...
@@ -161,6 +173,10 @@ public class ViewActviity extends BaseActivity {
gotoActivity
(
OnMultiClickActivity
.
class
);
gotoActivity
(
OnMultiClickActivity
.
class
);
}
}
});
});
}
@Override
public
BasePresenter
getPresenter
()
{
return
null
;
}
}
}
}
app/src/main/res/layout/activity_function.xml
View file @
68e43135
...
@@ -50,6 +50,12 @@
...
@@ -50,6 +50,12 @@
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"发起post请求"
/>
android:text=
"发起post请求"
/>
<Button
android:id=
"@+id/b8"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"定位"
/>
</LinearLayout>
</LinearLayout>
...
...
app/src/main/res/layout/activity_page.xml
View file @
68e43135
...
@@ -50,6 +50,12 @@
...
@@ -50,6 +50,12 @@
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"搜索地址页"
/>
android:text=
"搜索地址页"
/>
<Button
android:id=
"@+id/b8"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"登录页"
/>
</LinearLayout>
</LinearLayout>
...
...
fastDevelop/src/main/AndroidManifest.xml
View file @
68e43135
...
@@ -19,6 +19,8 @@
...
@@ -19,6 +19,8 @@
<activity
android:name=
".commonpage.amap.MapLocationActivity"
/>
<activity
android:name=
".commonpage.amap.MapLocationActivity"
/>
<activity
android:name=
".commonpage.WebActivity"
/>
<activity
android:name=
".commonpage.WebActivity"
/>
<activity
android:name=
".commonpage.main.MainActivity"
/>
<activity
android:name=
".commonpage.login.LoginActivity"
/>
<!-- 解决 Android N 7.0 上 报错:android.os.FileUriExposedException -->
<!-- 解决 Android N 7.0 上 报错:android.os.FileUriExposedException -->
<provider
<provider
...
...
fastDevelop/src/main/java/com/mayi/fastdevelop/api/UserAPI.java
0 → 100644
View file @
68e43135
package
com
.
mayi
.
fastdevelop
.
api
;
import
com.mayi.fastdevelop.base.BaseAPI
;
import
com.mayi.fastdevelop.bean.UserInfo
;
import
com.mayi.fastdevelop.comnon.HttpUrl
;
import
com.mayi.fastdevelop.okhttp.NetWorkBuilder
;
import
com.mayi.fastdevelop.okhttp.ResultCallback
;
public
class
UserAPI
implements
BaseAPI
{
public
static
void
login
(
String
mobile
,
String
password
,
ResultCallback
<
UserInfo
>
callback
)
{
new
NetWorkBuilder
().
setUrl
(
HttpUrl
.
URL_LOGIN
)
.
addParam
(
"mobile"
,
mobile
)
.
addParam
(
"password"
,
password
)
.
setCallback
(
callback
)
.
execute
();
}
}
fastDevelop/src/main/java/com/mayi/fastdevelop/base/BaseAPI.java
0 → 100644
View file @
68e43135
package
com
.
mayi
.
fastdevelop
.
base
;
public
interface
BaseAPI
{
}
fastDevelop/src/main/java/com/mayi/fastdevelop/base/BaseActivity.java
View file @
68e43135
...
@@ -2,16 +2,62 @@ package com.mayi.fastdevelop.base;
...
@@ -2,16 +2,62 @@ package com.mayi.fastdevelop.base;
import
android.app.Dialog
;
import
android.app.Dialog
;
import
android.content.Intent
;
import
android.content.Intent
;
import
android.content.pm.ActivityInfo
;
import
android.os.Bundle
;
import
android.os.Bundle
;
import
android.support.annotation.Nullable
;
import
android.support.v7.app.AppCompatActivity
;
import
android.support.v7.app.AppCompatActivity
;
import
com.mayi.fastdevelop.util.ToastUtil
;
import
com.mayi.fastdevelop.util.ToastUtil
;
import
com.mayi.fastdevelop.view.LoadingDialog
;
import
com.mayi.fastdevelop.view.LoadingDialog
;
public
abstract
class
BaseActivity
extends
AppCompatActivity
{
public
abstract
class
BaseActivity
<
P
extends
BasePresenter
,
M
extends
BaseAPI
>
extends
AppCompatActivity
{
private
Dialog
dialog
;
private
Dialog
dialog
;
//p 层实例
private
BasePresenter
mPresenter
;
//model 层实例
private
BaseAPI
mModel
;
//获取 Presenter 实例
public
abstract
P
getPresenterInstance
();
//获取 Model 实例
public
abstract
M
getModelInstance
();
@SuppressWarnings
(
"unchecked"
)
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
if
(
mModel
==
null
)
{
//实例化 Model
mModel
=
getModelInstance
();
}
if
(
mPresenter
==
null
)
{
mPresenter
=
getPresenterInstance
();
}
if
(
mPresenter
!=
null
)
{
mPresenter
.
setVM
(
this
,
mModel
);
}
super
.
onCreate
(
savedInstanceState
);
setRequestedOrientation
(
ActivityInfo
.
SCREEN_ORIENTATION_PORTRAIT
);
//强制竖屏
}
@SuppressWarnings
(
"unchecked"
)
protected
P
getPresenter
()
{
if
(
mPresenter
==
null
)
{
return
null
;
}
return
(
P
)
mPresenter
;
}
@SuppressWarnings
(
"unchecked"
)
protected
M
getModel
()
{
if
(
mModel
==
null
)
{
return
null
;
}
return
(
M
)
mModel
;
}
public
void
showLoadingDialog
()
{
public
void
showLoadingDialog
()
{
if
(
dialog
==
null
)
{
if
(
dialog
==
null
)
{
...
@@ -29,6 +75,7 @@ public abstract class BaseActivity extends AppCompatActivity {
...
@@ -29,6 +75,7 @@ public abstract class BaseActivity extends AppCompatActivity {
/**
/**
* 跳转页面并结束当前页面
* 跳转页面并结束当前页面
*
* @param activity
* @param activity
*/
*/
public
void
gotoActivityAndFinish
(
Class
activity
)
{
public
void
gotoActivityAndFinish
(
Class
activity
)
{
...
@@ -39,6 +86,7 @@ public abstract class BaseActivity extends AppCompatActivity {
...
@@ -39,6 +86,7 @@ public abstract class BaseActivity extends AppCompatActivity {
/**
/**
* 跳转页面
* 跳转页面
*
* @param activity
* @param activity
*/
*/
public
void
gotoActivity
(
Class
activity
)
{
public
void
gotoActivity
(
Class
activity
)
{
...
@@ -48,9 +96,10 @@ public abstract class BaseActivity extends AppCompatActivity {
...
@@ -48,9 +96,10 @@ public abstract class BaseActivity extends AppCompatActivity {
/**
/**
* 跳转页面并结束当前页面
* 跳转页面并结束当前页面
*
* @param activity
* @param activity
*/
*/
public
void
gotoActivityAndFinish
(
Class
activity
,
Bundle
bundle
)
{
public
void
gotoActivityAndFinish
(
Class
activity
,
Bundle
bundle
)
{
Intent
intent
=
new
Intent
(
this
,
activity
);
Intent
intent
=
new
Intent
(
this
,
activity
);
intent
.
putExtras
(
bundle
);
intent
.
putExtras
(
bundle
);
startActivity
(
intent
);
startActivity
(
intent
);
...
@@ -59,16 +108,17 @@ public abstract class BaseActivity extends AppCompatActivity {
...
@@ -59,16 +108,17 @@ public abstract class BaseActivity extends AppCompatActivity {
/**
/**
* 跳转页面
* 跳转页面
*
* @param activity
* @param activity
*/
*/
public
void
gotoActivity
(
Class
activity
,
Bundle
bundle
)
{
public
void
gotoActivity
(
Class
activity
,
Bundle
bundle
)
{
Intent
intent
=
new
Intent
(
this
,
activity
);
Intent
intent
=
new
Intent
(
this
,
activity
);
intent
.
putExtras
(
bundle
);
intent
.
putExtras
(
bundle
);
startActivity
(
intent
);
startActivity
(
intent
);
}
}
public
void
showToast
(
String
msg
){
public
void
showToast
(
String
msg
)
{
ToastUtil
.
show
(
this
,
msg
);
ToastUtil
.
show
(
this
,
msg
);
}
}
@Override
@Override
...
...
fastDevelop/src/main/java/com/mayi/fastdevelop/base/BasePresenter.java
0 → 100644
View file @
68e43135
package
com
.
mayi
.
fastdevelop
.
base
;
public
abstract
class
BasePresenter
<
M
,
V
>
{
//model
protected
M
mModel
;
//view
protected
V
mView
;
public
void
setVM
(
V
v
,
M
m
)
{
this
.
mView
=
v
;
this
.
mModel
=
m
;
}
/**
* 获取 View
*
* @return
*/
protected
V
getView
()
{
return
mView
;
}
/**
* 获取 Model
*
* @return
*/
protected
M
getModel
()
{
return
mModel
;
}
}
fastDevelop/src/main/java/com/mayi/fastdevelop/base/BaseView.java
0 → 100644
View file @
68e43135
package
com
.
mayi
.
fastdevelop
.
base
;
public
interface
BaseView
{
}
fastDevelop/src/main/java/com/mayi/fastdevelop/bean/LocationBean.java
0 → 100644
View file @
68e43135
package
com
.
mayi
.
fastdevelop
.
bean
;
public
class
LocationBean
{
private
String
address
;
//详细地址
private
String
provinceName
;
//省名称
private
String
cityName
;
//市名称
private
String
areaName
;
//区名称
private
String
latitude
;
//纬度
private
String
longitude
;
//经度
public
String
getAddress
()
{
return
address
;
}
public
void
setAddress
(
String
address
)
{
this
.
address
=
address
;
}
public
String
getProvinceName
()
{
return
provinceName
;
}
public
void
setProvinceName
(
String
provinceName
)
{
this
.
provinceName
=
provinceName
;
}
public
String
getCityName
()
{
return
cityName
;
}
public
void
setCityName
(
String
cityName
)
{
this
.
cityName
=
cityName
;
}
public
String
getAreaName
()
{
return
areaName
;
}
public
void
setAreaName
(
String
areaName
)
{
this
.
areaName
=
areaName
;
}
public
String
getLatitude
()
{
return
latitude
;
}
public
void
setLatitude
(
String
latitude
)
{
this
.
latitude
=
latitude
;
}
public
String
getLongitude
()
{
return
longitude
;
}
public
void
setLongitude
(
String
longitude
)
{
this
.
longitude
=
longitude
;
}
}
fastDevelop/src/main/java/com/mayi/fastdevelop/commonpage/UpdateDownLoadAPKActvity.java
View file @
68e43135
...
@@ -24,7 +24,7 @@ import com.mayi.fastdevelop.view.installapk.AppUpgradeManager;
...
@@ -24,7 +24,7 @@ import com.mayi.fastdevelop.view.installapk.AppUpgradeManager;
/**
/**
* 下载安装Activity
* 下载安装Activity
*/
*/
public
class
UpdateDownLoadAPKActvity
extends
BaseActivity
{
public
abstract
class
UpdateDownLoadAPKActvity
extends
BaseActivity
{
private
ApkInstallReceiver
receiver
;
private
ApkInstallReceiver
receiver
;
...
...
fastDevelop/src/main/java/com/mayi/fastdevelop/commonpage/WebActivity.java
View file @
68e43135
...
@@ -22,13 +22,25 @@ import android.view.KeyEvent;
...
@@ -22,13 +22,25 @@ import android.view.KeyEvent;
import
android.view.View
;
import
android.view.View
;
import
android.webkit.JavascriptInterface
;
import
android.webkit.JavascriptInterface
;
import
com.alibaba.fastjson.JSON
;
import
com.amap.api.location.AMapLocation
;
import
com.amap.api.location.AMapLocationClient
;
import
com.amap.api.location.AMapLocationClientOption
;
import
com.amap.api.location.AMapLocationListener
;
import
com.amap.api.maps.CameraUpdateFactory
;
import
com.amap.api.maps.model.LatLng
;
import
com.amap.api.services.core.LatLonPoint
;
import
com.mayi.fastdevelop.R
;
import
com.mayi.fastdevelop.R
;
import
com.mayi.fastdevelop.base.BaseAPI
;
import
com.mayi.fastdevelop.base.BaseActivity
;
import
com.mayi.fastdevelop.base.BaseActivity
;
import
com.mayi.fastdevelop.base.BasePresenter
;
import
com.mayi.fastdevelop.bean.LocationBean
;
import
com.mayi.fastdevelop.commonpage.amap.MapLocationActivity
;
import
com.mayi.fastdevelop.commonpage.amap.MapLocationActivity
;
import
com.mayi.fastdevelop.comnon.Key
;
import
com.mayi.fastdevelop.comnon.Key
;
import
com.mayi.fastdevelop.comnon.RequestCode
;
import
com.mayi.fastdevelop.comnon.RequestCode
;
import
com.mayi.fastdevelop.util.BitmapUtil
;
import
com.mayi.fastdevelop.util.BitmapUtil
;
import
com.mayi.fastdevelop.util.DialogUtils
;
import
com.mayi.fastdevelop.util.DialogUtils
;
import
com.mayi.fastdevelop.util.LocationUtils
;
import
com.mayi.fastdevelop.util.SpUtil
;
import
com.mayi.fastdevelop.util.SpUtil
;
import
com.mayi.fastdevelop.util.SystemUtil
;
import
com.mayi.fastdevelop.util.SystemUtil
;
import
com.mayi.fastdevelop.view.CustomTitleBar
;
import
com.mayi.fastdevelop.view.CustomTitleBar
;
...
@@ -60,6 +72,16 @@ public class WebActivity extends BaseActivity {
...
@@ -60,6 +72,16 @@ public class WebActivity extends BaseActivity {
private
String
mCurrentPhotoPath
;
private
String
mCurrentPhotoPath
;
@Override
@Override
public
BasePresenter
getPresenterInstance
()
{
return
null
;
}
@Override
public
BaseAPI
getModelInstance
()
{
return
null
;
}
@Override
protected
void
onCreate
(
@Nullable
Bundle
savedInstanceState
)
{
protected
void
onCreate
(
@Nullable
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_web
);
setContentView
(
R
.
layout
.
activity_web
);
...
@@ -253,12 +275,7 @@ public class WebActivity extends BaseActivity {
...
@@ -253,12 +275,7 @@ public class WebActivity extends BaseActivity {
}
else
if
(
TextUtils
.
equals
(
"backPage"
,
method
))
{
//返回上一页
}
else
if
(
TextUtils
.
equals
(
"backPage"
,
method
))
{
//返回上一页
webPageBack
();
webPageBack
();
}
else
if
(
TextUtils
.
equals
(
"goPage"
,
method
))
{
//跳转原生页面
}
else
if
(
TextUtils
.
equals
(
"goPage"
,
method
))
{
//跳转原生页面
try
{
goPage
(
data
);
JSONObject
jsonObject
=
new
JSONObject
(
data
);
goPage
(
jsonObject
.
optString
(
"page"
),
jsonObject
.
optString
(
"parameter"
));
}
catch
(
JSONException
e
)
{
e
.
printStackTrace
();
}
}
else
if
(
TextUtils
.
equals
(
"openDebug"
,
method
))
{
//开启Debug模式
}
else
if
(
TextUtils
.
equals
(
"openDebug"
,
method
))
{
//开启Debug模式
WebView
.
setWebContentsDebuggingEnabled
(
true
);
WebView
.
setWebContentsDebuggingEnabled
(
true
);
}
else
if
(
TextUtils
.
equals
(
"goBrowser"
,
method
))
{
//跳转浏览器
}
else
if
(
TextUtils
.
equals
(
"goBrowser"
,
method
))
{
//跳转浏览器
...
@@ -267,6 +284,18 @@ public class WebActivity extends BaseActivity {
...
@@ -267,6 +284,18 @@ public class WebActivity extends BaseActivity {
appCallJs
(
"setUserInfo"
,
SpUtil
.
get
(
Key
.
USER_INFO
,
""
));
appCallJs
(
"setUserInfo"
,
SpUtil
.
get
(
Key
.
USER_INFO
,
""
));
}
else
if
(
TextUtils
.
equals
(
"sendSMS"
,
method
))
{
//发送短信
}
else
if
(
TextUtils
.
equals
(
"sendSMS"
,
method
))
{
//发送短信
sendSMS
(
data
);
sendSMS
(
data
);
}
else
if
(
TextUtils
.
equals
(
"location"
,
method
))
{
//发送短信
LocationUtils
.
startLocation
(
WebActivity
.
this
,
new
LocationUtils
.
LocationCallback
()
{
@Override
public
void
onFail
(
String
msg
)
{
appCallJs
(
"LocationFail"
,
msg
);
}
@Override
public
void
onSuccess
(
LocationBean
bean
)
{
appCallJs
(
"LocationSuccess"
,
JSON
.
toJSONString
(
bean
));
}
});
}
}
}
}
});
});
...
@@ -285,11 +314,16 @@ public class WebActivity extends BaseActivity {
...
@@ -285,11 +314,16 @@ public class WebActivity extends BaseActivity {
/**
/**
* 跳转原生页面
* 跳转原生页面
* 待扩展
* 待扩展
*
* @param pageName
* @param parameter
*/
*/
public
void
goPage
(
String
pageName
,
String
parameter
)
{
public
void
goPage
(
String
data
)
{
String
pageName
=
null
,
parameter
=
null
;
try
{
JSONObject
jsonObject
=
new
JSONObject
(
data
);
pageName
=
jsonObject
.
optString
(
"page"
);
parameter
=
jsonObject
.
optString
(
"parameter"
);
}
catch
(
JSONException
e
)
{
e
.
printStackTrace
();
}
if
(
TextUtils
.
equals
(
pageName
,
"MapLocation"
))
{
//地图定位页面
if
(
TextUtils
.
equals
(
pageName
,
"MapLocation"
))
{
//地图定位页面
Intent
intent
=
new
Intent
(
this
,
MapLocationActivity
.
class
);
Intent
intent
=
new
Intent
(
this
,
MapLocationActivity
.
class
);
startActivityForResult
(
intent
,
RequestCode
.
MAP_LOCATION_ACTIVITY_RESULTCODE
);
startActivityForResult
(
intent
,
RequestCode
.
MAP_LOCATION_ACTIVITY_RESULTCODE
);
...
@@ -302,6 +336,17 @@ public class WebActivity extends BaseActivity {
...
@@ -302,6 +336,17 @@ public class WebActivity extends BaseActivity {
settings
.
setMixedContentMode
(
2
);
settings
.
setMixedContentMode
(
2
);
}
}
settings
.
setBlockNetworkImage
(
false
);
settings
.
setBlockNetworkImage
(
false
);
JSONObject
jsonObject
=
new
JSONObject
();
try
{
jsonObject
.
put
(
"platform"
,
"Android"
);
jsonObject
.
put
(
"versionName"
,
SystemUtil
.
getVersionName
(
this
));
jsonObject
.
put
(
"AppName"
,
SystemUtil
.
getAppName
(
this
));
}
catch
(
JSONException
e
)
{
e
.
printStackTrace
();
}
settings
.
setUserAgentString
(
jsonObject
.
toString
());
settings
.
setSupportMultipleWindows
(
false
);
settings
.
setSupportMultipleWindows
(
false
);
settings
.
setDefaultTextEncodingName
(
"utf-8"
);
settings
.
setDefaultTextEncodingName
(
"utf-8"
);
settings
.
setJavaScriptEnabled
(
true
);
settings
.
setJavaScriptEnabled
(
true
);
...
...
fastDevelop/src/main/java/com/mayi/fastdevelop/commonpage/amap/MapLocationActivity.java
View file @
68e43135
...
@@ -45,7 +45,9 @@ import com.amap.api.services.help.Tip;
...
@@ -45,7 +45,9 @@ import com.amap.api.services.help.Tip;
import
com.amap.api.services.poisearch.PoiResult
;
import
com.amap.api.services.poisearch.PoiResult
;
import
com.amap.api.services.poisearch.PoiSearch
;
import
com.amap.api.services.poisearch.PoiSearch
;
import
com.mayi.fastdevelop.R
;
import
com.mayi.fastdevelop.R
;
import
com.mayi.fastdevelop.base.BaseAPI
;
import
com.mayi.fastdevelop.base.BaseActivity
;
import
com.mayi.fastdevelop.base.BaseActivity
;
import
com.mayi.fastdevelop.base.BasePresenter
;
import
com.mayi.fastdevelop.comnon.Key
;
import
com.mayi.fastdevelop.comnon.Key
;
import
com.mayi.fastdevelop.util.DisplayUtil
;
import
com.mayi.fastdevelop.util.DisplayUtil
;
import
com.mayi.fastdevelop.util.LogUtils
;
import
com.mayi.fastdevelop.util.LogUtils
;
...
@@ -108,6 +110,16 @@ public class MapLocationActivity extends BaseActivity implements LocationSource,
...
@@ -108,6 +110,16 @@ public class MapLocationActivity extends BaseActivity implements LocationSource,
private
String
city
=
""
;
private
String
city
=
""
;
@Override
@Override
public
BasePresenter
getPresenterInstance
()
{
return
null
;
}
@Override
public
BaseAPI
getModelInstance
()
{
return
null
;
}
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
super
.
onCreate
(
savedInstanceState
);
requestWindowFeature
(
Window
.
FEATURE_NO_TITLE
);
requestWindowFeature
(
Window
.
FEATURE_NO_TITLE
);
...
...
fastDevelop/src/main/java/com/mayi/fastdevelop/commonpage/login/LoginActivity.java
0 → 100644
View file @
68e43135
package
com
.
mayi
.
fastdevelop
.
commonpage
.
login
;
import
android.annotation.SuppressLint
;
import
android.app.ActivityManager
;
import
android.os.Bundle
;
import
android.support.annotation.Nullable
;
import
android.text.Editable
;
import
android.text.TextUtils
;
import
android.text.TextWatcher
;
import
android.text.method.DigitsKeyListener
;
import
android.view.View
;
import
android.widget.Button
;
import
android.widget.EditText
;
import
android.widget.ImageView
;
import
com.mayi.fastdevelop.R
;
import
com.mayi.fastdevelop.api.UserAPI
;
import
com.mayi.fastdevelop.base.BaseActivity
;
import
com.mayi.fastdevelop.bean.UserInfo
;
import
com.mayi.fastdevelop.commonpage.main.MainActivity
;
import
com.mayi.fastdevelop.comnon.Configure
;
import
com.mayi.fastdevelop.comnon.Key
;
import
com.mayi.fastdevelop.comnon.UserManager
;
import
com.mayi.fastdevelop.util.ActivitysManager
;
import
com.mayi.fastdevelop.util.RegUtil
;
import
com.mayi.fastdevelop.util.SpUtil
;
import
com.mayi.fastdevelop.util.SystemUtil
;
/**
* 登录界面
*/
public
class
LoginActivity
extends
BaseActivity
<
LoginPresenter
,
UserAPI
>
implements
LoginContract
.
View
,
View
.
OnClickListener
{
EditText
mEditAccount
;
EditText
mEditPwd
;
Button
mBtnLogin
;
ImageView
mImgEye
;
ImageView
img_logo
;
private
int
icon_open_eyes
,
icon_close_eyes
;
private
boolean
bShowPwd
;
@Override
public
LoginPresenter
getPresenterInstance
()
{
return
new
LoginPresenter
();
}
@Override
public
UserAPI
getModelInstance
()
{
return
new
UserAPI
();
}
@Override
protected
void
onCreate
(
@Nullable
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_login
);
if
(
Configure
.
ICON_LOGIN_PWD_CLOSE_EYES
==
0
)
{
icon_close_eyes
=
R
.
mipmap
.
icon_close_eyes
;
}
else
{
icon_close_eyes
=
Configure
.
ICON_LOGIN_PWD_CLOSE_EYES
;
}
if
(
Configure
.
ICON_LOGIN_PWD_OPEN_EYES
==
0
)
{
icon_open_eyes
=
R
.
mipmap
.
icon_open_eyes
;
}
else
{
icon_open_eyes
=
Configure
.
ICON_LOGIN_PWD_OPEN_EYES
;
}
initComponent
();
}
protected
void
initComponent
()
{
img_logo
=
findViewById
(
R
.
id
.
img_logo
);
mEditAccount
=
findViewById
(
R
.
id
.
edit_account
);
mEditPwd
=
findViewById
(
R
.
id
.
edit_pwd
);
mImgEye
=
findViewById
(
R
.
id
.
img_eye
);
mBtnLogin
=
findViewById
(
R
.
id
.
btn_login
);
mImgEye
.
setOnClickListener
(
this
);
mBtnLogin
.
setOnClickListener
(
this
);
img_logo
.
setBackgroundResource
(
Configure
.
APP_LOGO
);
UserManager
.
clearUserInfo
();
mBtnLogin
.
setEnabled
(
mEditAccount
.
getText
().
toString
().
trim
().
length
()
==
getResources
().
getInteger
(
R
.
integer
.
phone_length
)
&&
mEditPwd
.
getText
().
toString
().
trim
().
length
()
>=
getResources
().
getInteger
(
R
.
integer
.
pwd_min_length
));
mEditAccount
.
addTextChangedListener
(
new
TextWatcher
()
{
@Override
public
void
beforeTextChanged
(
CharSequence
s
,
int
start
,
int
count
,
int
after
)
{
}
@Override
public
void
onTextChanged
(
CharSequence
s
,
int
start
,
int
before
,
int
count
)
{
}
@Override
public
void
afterTextChanged
(
Editable
s
)
{
mBtnLogin
.
setEnabled
(
s
.
length
()
==
getResources
().
getInteger
(
R
.
integer
.
phone_length
)
&&
mEditPwd
.
getText
().
toString
().
trim
().
length
()
>=
getResources
()
.
getInteger
(
R
.
integer
.
pwd_min_length
));
}
});
mEditPwd
.
addTextChangedListener
(
new
TextWatcher
()
{
@Override
public
void
beforeTextChanged
(
CharSequence
s
,
int
start
,
int
count
,
int
after
)
{
}
@Override
public
void
onTextChanged
(
CharSequence
s
,
int
start
,
int
before
,
int
count
)
{
}
@Override
public
void
afterTextChanged
(
Editable
s
)
{
mBtnLogin
.
setEnabled
(
mEditAccount
.
getText
().
toString
().
trim
().
length
()
==
getResources
().
getInteger
(
R
.
integer
.
phone_length
)
&&
s
.
length
()
>=
getResources
()
.
getInteger
(
R
.
integer
.
pwd_min_length
));
}
});
mEditAccount
.
setText
(
SpUtil
.
get
(
Key
.
ACCOUNT
,
""
));
}
@Override
public
void
loginSuccess
(
UserInfo
userInfo
)
{
dismssLoadingDialog
();
int
tipId
=
R
.
string
.
login_failt
;
if
(
userInfo
!=
null
)
{
tipId
=
R
.
string
.
login_success
;
SpUtil
.
set
(
Key
.
ACCOUNT
,
mEditAccount
.
getText
().
toString
());
UserManager
.
setUserInfo
(
userInfo
);
gotoActivityAndFinish
(
getMainActivity
());
}
showToast
(
getString
(
tipId
));
}
@Override
public
void
loginFailure
(
String
msg
)
{
dismssLoadingDialog
();
showToast
(
TextUtils
.
isEmpty
(
msg
)
?
getString
(
R
.
string
.
login_failt
)
:
msg
);
}
@Override
public
void
onClick
(
View
view
)
{
int
i
=
view
.
getId
();
if
(
i
==
R
.
id
.
btn_login
)
{
if
(
RegUtil
.
isPhone
(
mEditAccount
.
getText
().
toString
()))
{
showLoadingDialog
();
getPresenter
().
login
(
mEditAccount
.
getText
().
toString
(),
mEditPwd
.
getText
().
toString
());
}
else
{
showToast
(
getString
(
R
.
string
.
error_mobile
));
}
}
else
if
(
i
==
R
.
id
.
img_eye
)
{
bShowPwd
=
!
bShowPwd
;
mImgEye
.
setImageResource
(
bShowPwd
?
icon_open_eyes
:
icon_close_eyes
);
mEditPwd
.
setKeyListener
(
DigitsKeyListener
.
getInstance
(
getString
(
R
.
string
.
digits
)));
/*只能输入数字和字母*/
SystemUtil
.
setEditTextPwdShow
(
mEditPwd
,
bShowPwd
);
}
}
@Override
public
void
onBackPressed
()
{
super
.
onBackPressed
();
try
{
ActivitysManager
.
finishAllActivity
();
@SuppressLint
(
"WrongConstant"
)
ActivityManager
manager
=
(
ActivityManager
)
getSystemService
(
"activity"
);
manager
.
killBackgroundProcesses
(
getPackageName
());
System
.
exit
(
0
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
public
Class
getMainActivity
()
{
return
MainActivity
.
class
;
}
}
fastDevelop/src/main/java/com/mayi/fastdevelop/commonpage/login/LoginContract.java
0 → 100644
View file @
68e43135
package
com
.
mayi
.
fastdevelop
.
commonpage
.
login
;
import
com.mayi.fastdevelop.api.UserAPI
;
import
com.mayi.fastdevelop.base.BasePresenter
;
import
com.mayi.fastdevelop.base.BaseView
;
import
com.mayi.fastdevelop.bean.UserInfo
;
/**
* 登录规范类
*/
public
class
LoginContract
{
public
interface
View
extends
BaseView
{
/**
* 登录成功
*
* @param userInfo 用户信息
*/
void
loginSuccess
(
UserInfo
userInfo
);
/**
* 登录失败
*
* @param msg 失败原因
*/
void
loginFailure
(
String
msg
);
}
public
static
abstract
class
Presenter
extends
BasePresenter
<
UserAPI
,
View
>
{
/**
* 登录
*/
public
abstract
void
login
(
String
mobile
,
String
password
);
}
}
fastDevelop/src/main/java/com/mayi/fastdevelop/commonpage/login/LoginPresenter.java
0 → 100644
View file @
68e43135
package
com
.
mayi
.
fastdevelop
.
commonpage
.
login
;
import
com.mayi.fastdevelop.api.UserAPI
;
import
com.mayi.fastdevelop.bean.UserInfo
;
import
com.mayi.fastdevelop.okhttp.ResultCallback
;
public
class
LoginPresenter
extends
LoginContract
.
Presenter
{
@Override
public
void
login
(
String
mobile
,
String
password
)
{
UserAPI
.
login
(
mobile
,
password
,
new
ResultCallback
<
UserInfo
>()
{
@Override
public
void
onFail
(
String
msg
)
{
if
(
getView
()
!=
null
)
{
getView
().
loginFailure
(
msg
);
}
}
@Override
public
void
onSuccess
(
UserInfo
userInfo
)
{
if
(
getView
()
!=
null
)
{
getView
().
loginSuccess
(
userInfo
);
}
}
});
}
}
fastDevelop/src/main/java/com/mayi/fastdevelop/commonpage/main/MainActivity.java
0 → 100644
View file @
68e43135
package
com
.
mayi
.
fastdevelop
.
commonpage
.
main
;
import
com.mayi.fastdevelop.base.BaseAPI
;
import
com.mayi.fastdevelop.base.BaseActivity
;
import
com.mayi.fastdevelop.base.BasePresenter
;
public
class
MainActivity
extends
BaseActivity
{
@Override
public
BasePresenter
getPresenterInstance
()
{
return
null
;
}
@Override
public
BaseAPI
getModelInstance
()
{
return
null
;
}
}
fastDevelop/src/main/java/com/mayi/fastdevelop/comnon/Configure.java
0 → 100644
View file @
68e43135
package
com
.
mayi
.
fastdevelop
.
comnon
;
public
class
Configure
{
public
static
int
APP_LOGO
;
//app logo图片资源id
public
static
int
ICON_LOGIN_PWD_OPEN_EYES
;
//登录页-密码框显示密码图片
public
static
int
ICON_LOGIN_PWD_CLOSE_EYES
;
//登录页-密码框不显示密码图片
}
fastDevelop/src/main/java/com/mayi/fastdevelop/comnon/HttpUrl.java
0 → 100644
View file @
68e43135
package
com
.
mayi
.
fastdevelop
.
comnon
;
public
class
HttpUrl
{
public
static
String
URL_BASE_URL
=
"https://customer.kujiatech.com"
;
/* 登录 */
public
static
String
URL_LOGIN
=
URL_BASE_URL
+
"/user/appLogin.do"
;
}
fastDevelop/src/main/java/com/mayi/fastdevelop/comnon/Key.java
View file @
68e43135
...
@@ -11,4 +11,9 @@ public class Key {
...
@@ -11,4 +11,9 @@ public class Key {
public
static
final
String
USER_INFO
=
"userinfo"
;
public
static
final
String
USER_INFO
=
"userinfo"
;
/*是否首次登录*/
/*是否首次登录*/
public
static
final
String
FIRST_LOGIN
=
"first_login"
;
public
static
final
String
FIRST_LOGIN
=
"first_login"
;
/* 用户信息 */
public
static
final
String
S_USER_INFO
=
"s_userinfo"
;
public
static
final
String
ACCOUNT
=
"account"
;
public
static
final
String
S_PASSWORD
=
"s_password"
;
}
}
fastDevelop/src/main/java/com/mayi/fastdevelop/comnon/UserManager.java
View file @
68e43135
...
@@ -44,6 +44,20 @@ public class UserManager {
...
@@ -44,6 +44,20 @@ public class UserManager {
}
}
/**
/**
* 设置用户信息
*
* @param userInfo
*/
public
static
void
setUserInfo
(
UserInfo
userInfo
)
{
if
(
userInfo
!=
null
)
{
synchronized
(
UserManager
.
class
)
{
SpUtil
.
set
(
Key
.
USER_INFO
,
JSON
.
toJSONString
(
userInfo
));
UserManager
.
userInfo
=
userInfo
;
}
}
}
/**
* 清除用户信息
* 清除用户信息
*/
*/
public
static
void
clearUserInfo
()
{
public
static
void
clearUserInfo
()
{
...
...
fastDevelop/src/main/java/com/mayi/fastdevelop/okhttp/NetWorkBuilder.java
View file @
68e43135
...
@@ -72,19 +72,6 @@ public class NetWorkBuilder {
...
@@ -72,19 +72,6 @@ public class NetWorkBuilder {
if
(!
TextUtils
.
isEmpty
(
stringParam
))
{
if
(!
TextUtils
.
isEmpty
(
stringParam
))
{
NetWorkUtil
.
getInstance
().
performSynPostHttpRequest
(
url
,
stringParam
,
callback
);
NetWorkUtil
.
getInstance
().
performSynPostHttpRequest
(
url
,
stringParam
,
callback
);
}
else
if
(
params
.
toString
().
length
()
>
2
)
{
}
else
if
(
params
.
toString
().
length
()
>
2
)
{
StringBuilder
builder
=
new
StringBuilder
();
builder
.
append
(
"?"
);
Iterator
<
String
>
keys
=
params
.
keys
();
while
(
keys
.
hasNext
())
{
String
key
=
keys
.
next
().
toString
();
String
value
=
params
.
optString
(
key
);
builder
.
append
(
key
);
builder
.
append
(
"="
);
builder
.
append
(
value
);
builder
.
append
(
"&"
);
}
String
s
=
builder
.
toString
();
s
.
substring
(
0
,
s
.
length
()
-
1
);
NetWorkUtil
.
getInstance
().
performSynPostHttpRequest
(
url
,
params
.
toString
(),
callback
);
NetWorkUtil
.
getInstance
().
performSynPostHttpRequest
(
url
,
params
.
toString
(),
callback
);
}
else
{
}
else
{
NetWorkUtil
.
getInstance
().
performSynPostHttpRequest
(
url
,
null
,
callback
);
NetWorkUtil
.
getInstance
().
performSynPostHttpRequest
(
url
,
null
,
callback
);
...
...
fastDevelop/src/main/java/com/mayi/fastdevelop/okhttp/NetWorkUtil.java
View file @
68e43135
...
@@ -3,21 +3,18 @@ package com.mayi.fastdevelop.okhttp;
...
@@ -3,21 +3,18 @@ package com.mayi.fastdevelop.okhttp;
import
android.os.Handler
;
import
android.os.Handler
;
import
android.os.Looper
;
import
android.os.Looper
;
import
android.text.TextUtils
;
import
android.text.TextUtils
;
import
android.util.Log
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.mayi.fastdevelop.bean.UserInfo
;
import
com.mayi.fastdevelop.util.LogUtils
;
import
com.mayi.fastdevelop.util.LogUtils
;
import
com.orhanobut.logger.Logger
;
import
org.json.JSONException
;
import
org.json.JSONException
;
import
org.json.JSONObject
;
import
org.json.JSONObject
;
import
java.io.BufferedReader
;
import
java.io.BufferedReader
;
import
java.io.File
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.InputStream
;
import
java.io.InputStreamReader
;
import
java.io.InputStreamReader
;
import
java.net.SocketTimeoutException
;
import
java.net.UnknownHostException
;
import
java.net.UnknownHostException
;
import
java.util.concurrent.TimeUnit
;
import
java.util.concurrent.TimeUnit
;
...
@@ -114,13 +111,13 @@ public class NetWorkUtil {
...
@@ -114,13 +111,13 @@ public class NetWorkUtil {
//发起get请求
//发起get请求
public
void
performSynGetHttpRequest
(
String
url
,
ResultCallback
callback
)
{
public
void
performSynGetHttpRequest
(
String
url
,
ResultCallback
callback
)
{
Request
request
=
new
Request
.
Builder
()
Request
request
=
new
Request
.
Builder
()
.
get
()
.
url
(
url
)
.
url
(
url
)
.
build
();
.
build
();
initiateRequest
(
callback
,
request
);
initiateRequest
(
callback
,
request
);
}
}
private
void
initiateRequest
(
final
ResultCallback
callback
,
Request
request
)
{
private
void
initiateRequest
(
final
ResultCallback
callback
,
final
Request
request
)
{
client
.
newCall
(
request
).
enqueue
(
new
Callback
()
{
client
.
newCall
(
request
).
enqueue
(
new
Callback
()
{
@Override
@Override
public
void
onFailure
(
Call
call
,
final
IOException
e
)
{
public
void
onFailure
(
Call
call
,
final
IOException
e
)
{
...
@@ -130,6 +127,8 @@ public class NetWorkUtil {
...
@@ -130,6 +127,8 @@ public class NetWorkUtil {
public
void
run
()
{
public
void
run
()
{
if
(
e
instanceof
UnknownHostException
)
{
if
(
e
instanceof
UnknownHostException
)
{
callback
.
onFail
(
"连接网络异常"
);
callback
.
onFail
(
"连接网络异常"
);
}
else
if
(
e
instanceof
SocketTimeoutException
)
{
callback
.
onFail
(
"服务器连接超时,请稍后再试!"
);
}
else
{
}
else
{
callback
.
onFail
(
"服务器繁忙,请稍后再试!"
);
callback
.
onFail
(
"服务器繁忙,请稍后再试!"
);
}
}
...
@@ -143,6 +142,8 @@ public class NetWorkUtil {
...
@@ -143,6 +142,8 @@ public class NetWorkUtil {
public
void
onResponse
(
Call
call
,
final
Response
response
)
throws
IOException
{
public
void
onResponse
(
Call
call
,
final
Response
response
)
throws
IOException
{
//{"code":401,"msg":"UNAUTHORIZED","ok":false,"timestamp":1551166509635,"obj":"网络成功返回数据"}
//{"code":401,"msg":"UNAUTHORIZED","ok":false,"timestamp":1551166509635,"obj":"网络成功返回数据"}
final
String
json
=
convertStreamToString
(
response
.
body
().
byteStream
());
final
String
json
=
convertStreamToString
(
response
.
body
().
byteStream
());
if
(
response
.
networkResponse
().
code
()
==
200
)
{
response
.
networkResponse
().
code
();
if
(
callback
!=
null
)
{
if
(
callback
!=
null
)
{
try
{
try
{
final
JSONObject
jsonObject
=
new
JSONObject
(
json
);
final
JSONObject
jsonObject
=
new
JSONObject
(
json
);
...
@@ -167,6 +168,14 @@ public class NetWorkUtil {
...
@@ -167,6 +168,14 @@ public class NetWorkUtil {
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
}
}
}
else
{
handler
.
post
(
new
Runnable
()
{
@Override
public
void
run
()
{
callback
.
onFail
(
"服务器繁忙,请稍后再试!"
);
}
});
}
LogUtils
.
netWorkSuccess
(
"NetWorkUtil"
,
call
.
request
().
url
().
toString
(),
bodyToString
(
call
.
request
()),
json
);
LogUtils
.
netWorkSuccess
(
"NetWorkUtil"
,
call
.
request
().
url
().
toString
(),
bodyToString
(
call
.
request
()),
json
);
}
}
});
});
...
...
fastDevelop/src/main/java/com/mayi/fastdevelop/util/LocationUtils.java
0 → 100644
View file @
68e43135
package
com
.
mayi
.
fastdevelop
.
util
;
import
android.content.Context
;
import
com.amap.api.location.AMapLocation
;
import
com.amap.api.location.AMapLocationClient
;
import
com.amap.api.location.AMapLocationClientOption
;
import
com.amap.api.location.AMapLocationListener
;
import
com.mayi.fastdevelop.bean.LocationBean
;
public
class
LocationUtils
{
public
static
void
startLocation
(
Context
context
,
final
LocationCallback
callback
)
{
final
AMapLocationClient
mlocationClient
=
new
AMapLocationClient
(
context
);
//设置定位监听
mlocationClient
.
setLocationListener
(
new
AMapLocationListener
()
{
@Override
public
void
onLocationChanged
(
AMapLocation
amapLocation
)
{
if
(
amapLocation
!=
null
)
{
if
(
amapLocation
.
getErrorCode
()
==
0
)
{
LogUtils
.
e
(
"amapLocation"
+
amapLocation
);
if
(
callback
!=
null
)
{
LocationBean
bean
=
new
LocationBean
();
bean
.
setAddress
(
amapLocation
.
getAddress
());
bean
.
setCityName
(
amapLocation
.
getCity
());
bean
.
setProvinceName
(
amapLocation
.
getProvince
());
bean
.
setAreaName
(
amapLocation
.
getDistrict
());
bean
.
setLatitude
(
String
.
valueOf
(
amapLocation
.
getLatitude
()));
bean
.
setLongitude
(
String
.
valueOf
(
amapLocation
.
getLongitude
()));
callback
.
onSuccess
(
bean
);
}
}
else
{
String
errText
=
"定位失败,"
+
amapLocation
.
getErrorCode
()
+
": "
+
amapLocation
.
getErrorInfo
();
LogUtils
.
e
(
"AmapErr"
+
errText
);
if
(
callback
!=
null
)
{
callback
.
onFail
(
errText
);
}
}
}
else
{
String
errText
=
"定位失败"
;
LogUtils
.
e
(
"AmapErr"
+
errText
);
if
(
callback
!=
null
)
{
callback
.
onFail
(
errText
);
}
}
mlocationClient
.
stopLocation
();
mlocationClient
.
onDestroy
();
}
});
AMapLocationClientOption
mLocationOption
=
new
AMapLocationClientOption
();
mLocationOption
.
setOnceLocationLatest
(
true
);
mLocationOption
.
setOnceLocation
(
true
);
mLocationOption
.
setWifiScan
(
false
);
mLocationOption
.
setLocationMode
(
AMapLocationClientOption
.
AMapLocationMode
.
Battery_Saving
);
//设置定位参数
mlocationClient
.
setLocationOption
(
mLocationOption
);
mlocationClient
.
startLocation
();
}
public
interface
LocationCallback
{
public
abstract
void
onFail
(
String
msg
);
public
abstract
void
onSuccess
(
LocationBean
bean
);
}
}
fastDevelop/src/main/res/color/color_enable_white_grey_light.xml
0 → 100644
View file @
68e43135
<?xml version="1.0" encoding="utf-8"?>
<selector
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<item
android:color=
"@color/white"
android:state_enabled=
"true"
/>
<item
android:color=
"@color/txt_grey_light"
android:state_enabled=
"false"
/>
</selector>
\ No newline at end of file
fastDevelop/src/main/res/layout/activity_login.xml
0 → 100644
View file @
68e43135
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"@color/white"
>
<ImageView
android:id=
"@+id/img_logo"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_alignParentTop=
"true"
android:layout_centerHorizontal=
"true"
android:layout_gravity=
"center_horizontal"
android:layout_marginTop=
"70dp"
android:src=
"@mipmap/ic_launcher"
/>
<LinearLayout
android:id=
"@+id/ll_input"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_below=
"@id/img_logo"
android:layout_marginTop=
"25dp"
android:background=
"@color/white"
android:orientation=
"vertical"
android:padding=
"@dimen/space_30px"
>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:gravity=
"center_vertical"
android:minHeight=
"45dp"
android:orientation=
"horizontal"
android:paddingLeft=
"@dimen/space_20px"
android:paddingRight=
"@dimen/space_20px"
>
<!--帐号-->
<TextView
style=
"@style/txt_normal"
android:gravity=
"center"
android:minWidth=
"70dp"
android:text=
"@string/account"
/>
<EditText
android:id=
"@+id/edit_account"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"@null"
android:hint=
"@string/hint_input_account"
android:inputType=
"number"
android:maxLength=
"@integer/phone_length"
android:maxLines=
"1"
android:singleLine=
"true"
android:textColorHint=
"@color/txt_color_hint"
android:textSize=
"@dimen/txt_size_28px"
/>
</LinearLayout>
<View
style=
"@style/line_h"
/>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:gravity=
"center_vertical"
android:minHeight=
"45dp"
android:orientation=
"horizontal"
android:paddingLeft=
"@dimen/space_20px"
android:paddingRight=
"@dimen/space_20px"
>
<!--密码-->
<TextView
style=
"@style/txt_normal"
android:gravity=
"center"
android:minWidth=
"70dp"
android:text=
"@string/pwd"
/>
<EditText
android:id=
"@+id/edit_pwd"
android:layout_width=
"0dp"
android:layout_height=
"match_parent"
android:layout_weight=
"1"
android:background=
"@null"
android:digits=
"@string/digits"
android:hint=
"@string/hint_pwd"
android:inputType=
"textPassword"
android:maxLength=
"@integer/pwd_max_length"
android:maxLines=
"1"
android:textColor=
"@color/txt_black"
android:textColorHint=
"@color/txt_color_hint"
android:textSize=
"@dimen/txt_size_28px"
/>
<ImageView
android:id=
"@+id/img_eye"
android:layout_width=
"45dp"
android:layout_height=
"45dp"
android:padding=
"@dimen/space_30px"
android:src=
"@mipmap/icon_close_eyes"
/>
</LinearLayout>
<View
style=
"@style/line_h"
/>
</LinearLayout>
<!--登录-->
<Button
android:id=
"@+id/btn_login"
android:layout_width=
"match_parent"
android:layout_height=
"@dimen/im_dp_44"
android:layout_below=
"@id/ll_input"
android:layout_marginLeft=
"@dimen/space_30px"
android:layout_marginRight=
"@dimen/space_30px"
android:layout_marginTop=
"@dimen/space_20px"
android:background=
"@drawable/btn_accont_grey_radius"
android:gravity=
"center"
android:text=
"@string/login"
android:textColor=
"@color/color_enable_white_grey_light"
android:textSize=
"@dimen/txt_size_32px"
/>
<!--<TextView-->
<!--android:id="@+id/txt_froget_pwd"-->
<!--style="@style/txt_normal"-->
<!--android:layout_alignParentRight="true"-->
<!--android:layout_below="@id/btn_login"-->
<!--android:layout_gravity="right"-->
<!--android:gravity="center"-->
<!--android:padding="@dimen/space_30px"-->
<!--android:text="@string/txt_froget_pwd"-->
<!--android:textColor="@color/color_DF0029" />-->
</RelativeLayout>
\ No newline at end of file
fastDevelop/src/main/res/mipmap-xxhdpi/ic_launcher.png
0 → 100644
View file @
68e43135
6.31 KB
fastDevelop/src/main/res/mipmap-xxhdpi/icon_close_eyes.png
0 → 100644
View file @
68e43135
19.7 KB
fastDevelop/src/main/res/mipmap-xxhdpi/icon_open_eyes.png
0 → 100644
View file @
68e43135
18.4 KB
fastDevelop/src/main/res/values/dimens.xml
View file @
68e43135
...
@@ -63,6 +63,7 @@
...
@@ -63,6 +63,7 @@
<dimen
name=
"im_dp_33"
>
33dp
</dimen>
<dimen
name=
"im_dp_33"
>
33dp
</dimen>
<dimen
name=
"im_dp_36"
>
36dp
</dimen>
<dimen
name=
"im_dp_36"
>
36dp
</dimen>
<dimen
name=
"im_dp_40"
>
40dp
</dimen>
<dimen
name=
"im_dp_40"
>
40dp
</dimen>
<dimen
name=
"im_dp_44"
>
44dp
</dimen>
<dimen
name=
"im_dp_48"
>
48dp
</dimen>
<dimen
name=
"im_dp_48"
>
48dp
</dimen>
<dimen
name=
"im_dp_50"
>
50dp
</dimen>
<dimen
name=
"im_dp_50"
>
50dp
</dimen>
<dimen
name=
"im_dp_54"
>
54dp
</dimen>
<dimen
name=
"im_dp_54"
>
54dp
</dimen>
...
...
fastDevelop/src/main/res/values/integers.xml
0 → 100644
View file @
68e43135
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!--手机号长度11位-->
<integer
name=
"phone_length"
>
11
</integer>
<!--密码至少6位-->
<integer
name=
"pwd_min_length"
>
6
</integer>
<!--密码最大位数-->
<integer
name=
"pwd_max_length"
>
20
</integer>
</resources>
\ No newline at end of file
fastDevelop/src/main/res/values/strings.xml
View file @
68e43135
...
@@ -21,4 +21,13 @@
...
@@ -21,4 +21,13 @@
<string
name=
"position"
>
位置
</string>
<string
name=
"position"
>
位置
</string>
<string
name=
"send"
>
发送
</string>
<string
name=
"send"
>
发送
</string>
<string
name=
"not_phone"
>
本机没有手机号
</string>
<string
name=
"not_phone"
>
本机没有手机号
</string>
<string
name=
"login_success"
>
登录成功
</string>
<string
name=
"login_failt"
>
登录失败
</string>
<string
name=
"login"
>
登录
</string>
<string
name=
"account"
>
帐号
</string>
<string
name=
"pwd"
>
密码
</string>
<string
name=
"hint_pwd"
>
6-20位数字和字母组合
</string>
<string
name=
"digits"
>
1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
</string>
<string
name=
"error_mobile"
>
手机号码格式有误
</string>
<string
name=
"hint_input_account"
>
请输入手机号码
</string>
</resources>
</resources>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment