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
0d006e94
Commit
0d006e94
authored
Sep 11, 2019
by
gao.chao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
图片裁剪,去BaseAPI,BasePresenter,BaseView
parent
b0c8089a
Show whitespace changes
Inline
Side-by-side
Showing
33 changed files
with
311 additions
and
613 deletions
+311
-613
app/src/main/AndroidManifest.xml
+1
-0
app/src/main/java/com/mayi/demo/BannerActivity.java
+0
-15
app/src/main/java/com/mayi/demo/CutPicturesActivity.java
+40
-0
app/src/main/java/com/mayi/demo/DownLoadAPKActivity.java
+0
-16
app/src/main/java/com/mayi/demo/FunctionActivity.java
+7
-21
app/src/main/java/com/mayi/demo/LoadingPicturesActivity.java
+0
-15
app/src/main/java/com/mayi/demo/MainActivity.java
+88
-16
app/src/main/java/com/mayi/demo/MyScanActivity.java
+0
-16
app/src/main/java/com/mayi/demo/OnMultiClickActivity.java
+0
-15
app/src/main/java/com/mayi/demo/PageActivity.java
+0
-24
app/src/main/java/com/mayi/demo/PermissionActivity.java
+0
-18
app/src/main/java/com/mayi/demo/QRActivity.java
+0
-17
app/src/main/java/com/mayi/demo/SmartRefreshLayoutActivity.java
+0
-17
app/src/main/java/com/mayi/demo/StartActivity.java
+0
-11
app/src/main/java/com/mayi/demo/TitleActivity.java
+0
-15
app/src/main/java/com/mayi/demo/ViewActviity.java
+0
-19
app/src/main/res/layout/activity_cutpictures.xml
+27
-0
app/src/main/res/layout/activity_page.xml
+0
-8
fastDevelop/src/main/java/com/mayi/fastdevelop/api/UserAPI.java
+1
-2
fastDevelop/src/main/java/com/mayi/fastdevelop/base/BaseAPI.java
+0
-4
fastDevelop/src/main/java/com/mayi/fastdevelop/base/BaseActivity.java
+1
-41
fastDevelop/src/main/java/com/mayi/fastdevelop/base/BaseCutPicturesActivity.java
+117
-0
fastDevelop/src/main/java/com/mayi/fastdevelop/base/BasePresenter.java
+0
-34
fastDevelop/src/main/java/com/mayi/fastdevelop/base/BaseView.java
+0
-4
fastDevelop/src/main/java/com/mayi/fastdevelop/commonpage/login/LoginActivity.java
+0
-174
fastDevelop/src/main/java/com/mayi/fastdevelop/commonpage/login/LoginContract.java
+0
-37
fastDevelop/src/main/java/com/mayi/fastdevelop/commonpage/login/LoginPresenter.java
+0
-28
fastDevelop/src/main/java/com/mayi/fastdevelop/commonpage/main/MainActivity.java
+0
-17
fastDevelop/src/main/java/com/mayi/fastdevelop/okhttp/NetWorkBuilder.java
+3
-2
fastDevelop/src/main/java/com/mayi/fastdevelop/okhttp/NetWorkUtil.java
+6
-0
fastDevelop/src/main/java/com/mayi/fastdevelop/util/BitmapUtil.java
+20
-0
map/src/main/java/com/mayi/fastdevelop/map/MapLocationActivity.java
+0
-12
web/src/main/java/com/mayi/fastdevelop/web/BaseWebActivity.java
+0
-15
No files found.
app/src/main/AndroidManifest.xml
View file @
0d006e94
...
...
@@ -54,6 +54,7 @@
<activity
android:name=
".FragmentInteractiveActivity2"
/>
<activity
android:name=
".PageActivity"
/>
<activity
android:name=
".MyScanActivity"
/>
<activity
android:name=
".CutPicturesActivity"
/>
</application>
<!-- 配置APP ID -->
...
...
app/src/main/java/com/mayi/demo/BannerActivity.java
View file @
0d006e94
...
...
@@ -3,9 +3,7 @@ package com.mayi.demo;
import
android.os.Bundle
;
import
android.support.annotation.Nullable
;
import
com.mayi.fastdevelop.base.BaseAPI
;
import
com.mayi.fastdevelop.base.BaseActivity
;
import
com.mayi.fastdevelop.base.BasePresenter
;
import
com.mayi.fastdevelop.view.PicassoImageLoader
;
import
com.youth.banner.Banner
;
import
com.youth.banner.BannerConfig
;
...
...
@@ -20,15 +18,6 @@ public class BannerActivity extends BaseActivity implements OnBannerListener {
List
list
=
new
ArrayList
();
List
listText
=
new
ArrayList
();
@Override
public
BasePresenter
getPresenterInstance
()
{
return
null
;
}
@Override
public
BaseAPI
getModelInstance
()
{
return
null
;
}
@Override
protected
void
onCreate
(
@Nullable
Bundle
savedInstanceState
)
{
...
...
@@ -73,8 +62,4 @@ public class BannerActivity extends BaseActivity implements OnBannerListener {
showToast
(
"position="
+
position
);
}
@Override
public
BasePresenter
getPresenter
()
{
return
null
;
}
}
app/src/main/java/com/mayi/demo/CutPicturesActivity.java
0 → 100644
View file @
0d006e94
package
com
.
mayi
.
demo
;
import
android.os.Bundle
;
import
android.support.annotation.Nullable
;
import
android.view.View
;
import
android.widget.ImageView
;
import
com.mayi.fastdevelop.base.BaseCutPicturesActivity
;
import
com.mayi.fastdevelop.util.BitmapUtil
;
public
class
CutPicturesActivity
extends
BaseCutPicturesActivity
implements
View
.
OnClickListener
{
private
ImageView
img
;
@Override
protected
void
onCreate
(
@Nullable
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_cutpictures
);
img
=
findViewById
(
R
.
id
.
img
);
findViewById
(
R
.
id
.
bt1
).
setOnClickListener
(
this
);
findViewById
(
R
.
id
.
bt2
).
setOnClickListener
(
this
);
}
@Override
protected
void
getBitmapPath
(
String
imgPath
)
{
img
.
setImageBitmap
(
BitmapUtil
.
loadBitmapFromFile
(
imgPath
));
}
@Override
public
void
onClick
(
View
v
)
{
switch
(
v
.
getId
())
{
case
R
.
id
.
bt1
:
goCamera
();
break
;
case
R
.
id
.
bt2
:
goPhotoAlbum
();
break
;
}
}
}
app/src/main/java/com/mayi/demo/DownLoadAPKActivity.java
View file @
0d006e94
...
...
@@ -4,24 +4,12 @@ import android.os.Bundle;
import
android.support.annotation.Nullable
;
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.commonpage.UpdateDownLoadAPKActvity
;
public
class
DownLoadAPKActivity
extends
UpdateDownLoadAPKActvity
{
@Override
public
BasePresenter
getPresenterInstance
()
{
return
null
;
}
@Override
public
BaseAPI
getModelInstance
()
{
return
null
;
}
@Override
protected
void
onCreate
(
@Nullable
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
avtivity_download_apk
);
...
...
@@ -61,8 +49,4 @@ public class DownLoadAPKActivity extends UpdateDownLoadAPKActvity {
downLoadAPK
(
appConfig
);
}
@Override
public
BasePresenter
getPresenter
()
{
return
null
;
}
}
app/src/main/java/com/mayi/demo/FunctionActivity.java
View file @
0d006e94
...
...
@@ -10,28 +10,17 @@ import com.gc.call.CallManage;
import
com.gc.call.CallParticipationBean
;
import
com.gc.call.CallReturnBean
;
import
com.gc.call.CallReturnListener
;
import
com.mayi.fastdevelop.base.BaseAPI
;
import
com.mayi.fastdevelop.base.BaseActivity
;
import
com.mayi.fastdevelop.base.BasePresenter
;
import
com.mayi.fastdevelop.bean.UserInfo
;
import
com.mayi.fastdevelop.comnon.Constant
;
import
com.mayi.fastdevelop.okhttp.NetWorkBuilder
;
import
com.mayi.fastdevelop.okhttp.ResultCallback
;
import
com.mayi.fastdevelop.util.LogUtils
;
import
com.mayi.fastdevelop.view.OnMultiClickListener
;
public
class
FunctionActivity
extends
BaseActivity
{
@Override
public
BasePresenter
getPresenterInstance
()
{
return
null
;
}
@Override
public
BaseAPI
getModelInstance
()
{
return
null
;
}
@Override
protected
void
onCreate
(
@Nullable
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_function
);
...
...
@@ -68,17 +57,19 @@ public class FunctionActivity extends BaseActivity {
findViewById
(
R
.
id
.
b6
).
setOnClickListener
(
new
OnMultiClickListener
()
{
@Override
public
void
onMultiClick
(
View
v
)
{
new
NetWorkBuilder
().
setUrl
(
"https://customer.kujiatech.com/api/thirdPartyService/notify/getNotify"
)
.
addParam
(
"1"
,
"22
"
)
new
NetWorkBuilder
().
setUrl
(
"https://backendrelease.kukahome.com:443/iretail/common/getAuthDataDealerList
"
)
.
setMethod
(
Constant
.
NETWORK_METHOD_GET
)
.
setCallback
(
new
ResultCallback
<
UserInfo
>()
{
.
setCallback
(
new
ResultCallback
<
String
>()
{
@Override
public
void
onFail
(
String
msg
)
{
LogUtils
.
i
(
msg
);
showToast
(
msg
);
}
@Override
public
void
onSuccess
(
UserInfo
o
)
{
public
void
onSuccess
(
String
o
)
{
LogUtils
.
i
(
o
);
showToast
(
o
.
toString
());
}
}).
execute
();
...
...
@@ -121,9 +112,4 @@ public class FunctionActivity extends BaseActivity {
});
}
@Override
public
BasePresenter
getPresenter
()
{
return
null
;
}
}
app/src/main/java/com/mayi/demo/LoadingPicturesActivity.java
View file @
0d006e94
...
...
@@ -5,35 +5,20 @@ import android.os.Environment;
import
android.support.annotation.Nullable
;
import
android.widget.ImageView
;
import
com.mayi.fastdevelop.base.BaseAPI
;
import
com.mayi.fastdevelop.base.BaseActivity
;
import
com.mayi.fastdevelop.base.BasePresenter
;
import
com.mayi.fastdevelop.view.LoadingPictures
;
import
java.io.File
;
public
class
LoadingPicturesActivity
extends
BaseActivity
{
@Override
public
BasePresenter
getPresenterInstance
()
{
return
null
;
}
@Override
public
BaseAPI
getModelInstance
()
{
return
null
;
}
@Override
protected
void
onCreate
(
@Nullable
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_loading_pictures
);
ImageView
img1
=
findViewById
(
R
.
id
.
img1
);
LoadingPictures
.
loadUri
(
"http://ww4.sinaimg.cn/large/006uZZy8jw1faic1xjab4j30ci08cjrv.jpg"
,
img1
);
ImageView
img2
=
findViewById
(
R
.
id
.
img2
);
LoadingPictures
.
loadFile
(
new
File
(
Environment
.
getExternalStorageDirectory
()
+
"/2.jpg"
),
img2
);
}
}
app/src/main/java/com/mayi/demo/MainActivity.java
View file @
0d006e94
package
com
.
mayi
.
demo
;
import
android.content.Intent
;
import
android.graphics.Bitmap
;
import
android.net.Uri
;
import
android.os.Build
;
import
android.os.Bundle
;
import
android.os.Environment
;
import
android.provider.MediaStore
;
import
android.support.annotation.NonNull
;
import
android.support.v4.content.FileProvider
;
import
android.support.v7.widget.LinearLayoutManager
;
import
android.support.v7.widget.RecyclerView
;
import
android.util.Log
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.widget.Button
;
import
com.mayi.fastdevelop.base.BaseAPI
;
import
com.mayi.fastdevelop.base.BaseActivity
;
import
com.mayi.fastdevelop.
base.BasePresenter
;
import
com.mayi.fastdevelop.
util.BitmapUtil
;
import
com.mayi.fastdevelop.util.DrawableUtils
;
import
java.io.File
;
import
java.util.ArrayList
;
import
java.util.List
;
public
class
MainActivity
extends
BaseActivity
{
@Override
public
BasePresenter
getPresenterInstance
()
{
return
null
;
}
@Override
public
BaseAPI
getModelInstance
()
{
return
null
;
}
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
...
...
@@ -54,6 +53,12 @@ public class MainActivity extends BaseActivity {
gotoActivity
(
PageActivity
.
class
);
}
}));
list
.
add
(
new
ItemBean
(
"图片裁剪"
,
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
gotoActivity
(
CutPicturesActivity
.
class
);
}
}));
listView
.
setAdapter
(
new
RecyclerView
.
Adapter
<
MyViewHolder
>()
{
@NonNull
...
...
@@ -76,11 +81,6 @@ public class MainActivity extends BaseActivity {
});
}
@Override
public
BasePresenter
getPresenter
()
{
return
null
;
}
class
MyViewHolder
extends
RecyclerView
.
ViewHolder
{
Button
tv
;
...
...
@@ -91,4 +91,76 @@ public class MainActivity extends BaseActivity {
}
}
private
Uri
uri
;
private
File
cameraSavePath
;
//激活相机操作
private
void
goCamera
()
{
cameraSavePath
=
new
File
(
Environment
.
getExternalStorageDirectory
().
getPath
()
+
"/"
+
getPackageName
()
+
"/"
+
System
.
currentTimeMillis
()
+
".jpg"
);
Intent
intent
=
new
Intent
(
MediaStore
.
ACTION_IMAGE_CAPTURE
);
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
N
)
{
uri
=
FileProvider
.
getUriForFile
(
MainActivity
.
this
,
getPackageName
()
+
".uri"
,
cameraSavePath
);
intent
.
addFlags
(
Intent
.
FLAG_GRANT_READ_URI_PERMISSION
);
}
else
{
uri
=
Uri
.
fromFile
(
cameraSavePath
);
}
intent
.
putExtra
(
MediaStore
.
EXTRA_OUTPUT
,
uri
);
MainActivity
.
this
.
startActivityForResult
(
intent
,
1
);
}
@Override
protected
void
onActivityResult
(
int
requestCode
,
int
resultCode
,
Intent
data
)
{
if
(
requestCode
==
1
&&
resultCode
==
RESULT_OK
)
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
N
)
{
uri
=
FileProvider
.
getUriForFile
(
MainActivity
.
this
,
getPackageName
()
+
".uri"
,
cameraSavePath
);
}
else
{
uri
=
Uri
.
fromFile
(
cameraSavePath
);
}
photoClip
(
uri
);
}
else
if
(
requestCode
==
2
&&
resultCode
==
RESULT_OK
)
{
// photoPath = getPhotoFromPhotoAlbum.getRealPathFromUri(this, data.getData());
Log
.
d
(
"相册返回图片路径:"
,
data
.
getData
()
+
""
);
photoClip
(
data
.
getData
());
// Glide.with(MainActivity.this).load(photoPath).into(ivTest);
}
else
if
(
requestCode
==
3
&&
resultCode
==
RESULT_OK
)
{
Bundle
bundle
=
data
.
getExtras
();
if
(
bundle
!=
null
)
{
//在这里获得了剪裁后的Bitmap对象,可以用于上传
Bitmap
image
=
bundle
.
getParcelable
(
"data"
);
BitmapUtil
.
saveBitmapToFormat
(
image
,
Environment
.
getExternalStorageDirectory
().
getPath
()
+
"/Download/11111.jpg"
);
// //设置到ImageView上
// ivTest.setImageBitmap(image);
// //也可以进行一些保存、压缩等操作后上传
// String path = saveImage("头像", image);
// Log.d("裁剪路径:", path);
}
}
super
.
onActivityResult
(
requestCode
,
resultCode
,
data
);
}
private
void
photoClip
(
Uri
uri
)
{
// 调用系统中自带的图片剪裁
Intent
intent1
=
new
Intent
();
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
N
)
{
intent1
.
addFlags
(
Intent
.
FLAG_GRANT_READ_URI_PERMISSION
);
}
/*设置调用裁剪工具的action*/
intent1
.
setAction
(
"com.android.camera.action.CROP"
);
/*创建一个指向需要操作文件(filename)的文件流。(可解决无法“加载问题”)*/
intent1
.
setDataAndType
(
uri
,
"image/*"
);
intent1
.
putExtra
(
"crop"
,
"true"
);
intent1
.
putExtra
(
"scale"
,
true
);
intent1
.
putExtra
(
"return-data"
,
false
);
Uri
uritempFile
=
Uri
.
parse
(
"file://"
+
"/"
+
Environment
.
getExternalStorageDirectory
().
getPath
()
+
"/"
+
System
.
currentTimeMillis
()
+
".jpg"
);
intent1
.
putExtra
(
MediaStore
.
EXTRA_OUTPUT
,
uritempFile
);
intent1
.
putExtra
(
"outputFormat"
,
Bitmap
.
CompressFormat
.
JPEG
.
toString
());
intent1
.
putExtra
(
"noFaceDetection"
,
true
);
MainActivity
.
this
.
startActivityForResult
(
intent1
,
3
);
}
}
app/src/main/java/com/mayi/demo/MyScanActivity.java
View file @
0d006e94
package
com
.
mayi
.
demo
;
import
com.mayi.fastdevelop.base.BaseAPI
;
import
com.mayi.fastdevelop.base.BasePresenter
;
import
com.mayi.fastdevelop.commonpage.zxing.BaseScanActivity
;
public
class
MyScanActivity
extends
BaseScanActivity
{
...
...
@@ -11,18 +9,4 @@ public class MyScanActivity extends BaseScanActivity{
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 @
0d006e94
...
...
@@ -5,24 +5,13 @@ import android.support.annotation.Nullable;
import
android.view.View
;
import
android.widget.Button
;
import
com.mayi.fastdevelop.base.BaseAPI
;
import
com.mayi.fastdevelop.base.BaseActivity
;
import
com.mayi.fastdevelop.base.BasePresenter
;
import
com.mayi.fastdevelop.view.OnMultiClickListener
;
public
class
OnMultiClickActivity
extends
BaseActivity
{
private
long
last
;
@Override
public
BasePresenter
getPresenterInstance
()
{
return
null
;
}
@Override
public
BaseAPI
getModelInstance
()
{
return
null
;
}
@Override
protected
void
onCreate
(
@Nullable
Bundle
savedInstanceState
)
{
...
...
@@ -42,8 +31,4 @@ public class OnMultiClickActivity extends BaseActivity {
});
}
@Override
public
BasePresenter
getPresenter
()
{
return
null
;
}
}
app/src/main/java/com/mayi/demo/PageActivity.java
View file @
0d006e94
...
...
@@ -9,10 +9,7 @@ import android.view.View;
import
com.gc.call.CallConstant
;
import
com.gc.call.CallManage
;
import
com.gc.call.CallParticipationBean
;
import
com.mayi.fastdevelop.base.BaseAPI
;
import
com.mayi.fastdevelop.base.BaseActivity
;
import
com.mayi.fastdevelop.base.BasePresenter
;
import
com.mayi.fastdevelop.commonpage.login.LoginActivity
;
import
com.mayi.fastdevelop.comnon.Key
;
import
com.mayi.fastdevelop.comnon.RequestCode
;
import
com.mayi.fastdevelop.util.ToolUtils
;
...
...
@@ -20,17 +17,6 @@ import com.mayi.fastdevelop.view.OnMultiClickListener;
public
class
PageActivity
extends
BaseActivity
{
@Override
public
BasePresenter
getPresenterInstance
()
{
return
null
;
}
@Override
public
BaseAPI
getModelInstance
()
{
return
null
;
}
@Override
protected
void
onCreate
(
@Nullable
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
...
...
@@ -87,12 +73,6 @@ public class PageActivity extends BaseActivity {
CallManage
.
getInstance
().
handleTarget
(
bean
);
}
});
findViewById
(
R
.
id
.
b8
).
setOnClickListener
(
new
OnMultiClickListener
()
{
@Override
public
void
onMultiClick
(
View
v
)
{
gotoActivity
(
LoginActivity
.
class
);
}
});
}
@Override
...
...
@@ -105,8 +85,4 @@ public class PageActivity extends BaseActivity {
super
.
onActivityResult
(
requestCode
,
resultCode
,
data
);
}
@Override
public
BasePresenter
getPresenter
()
{
return
null
;
}
}
app/src/main/java/com/mayi/demo/PermissionActivity.java
View file @
0d006e94
package
com
.
mayi
.
demo
;
import
android.os.Bundle
;
import
android.os.Environment
;
import
android.support.annotation.Nullable
;
import
android.view.View
;
import
android.widget.Button
;
import
android.widget.TextView
;
import
com.alibaba.fastjson.JSON
;
import
com.mayi.fastdevelop.base.BaseAPI
;
import
com.mayi.fastdevelop.base.BaseActivity
;
import
com.mayi.fastdevelop.base.BasePresenter
;
import
com.mayi.fastdevelop.util.PermissionUtil
;
import
com.mayi.fastdevelop.view.OnMultiClickListener
;
import
com.yanzhenjie.permission.Permission
;
...
...
@@ -23,16 +20,6 @@ import java.util.List;
public
class
PermissionActivity
extends
BaseActivity
{
@Override
public
BasePresenter
getPresenterInstance
()
{
return
null
;
}
@Override
public
BaseAPI
getModelInstance
()
{
return
null
;
}
@Override
protected
void
onCreate
(
@Nullable
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_permission
);
...
...
@@ -56,11 +43,6 @@ public class PermissionActivity extends BaseActivity {
},
Permission
.
Group
.
CAMERA
);
}
});
}
@Override
public
BasePresenter
getPresenter
()
{
return
null
;
}
}
app/src/main/java/com/mayi/demo/QRActivity.java
View file @
0d006e94
...
...
@@ -8,9 +8,7 @@ import android.widget.EditText;
import
android.widget.ImageView
;
import
android.widget.TextView
;
import
com.mayi.fastdevelop.base.BaseAPI
;
import
com.mayi.fastdevelop.base.BaseActivity
;
import
com.mayi.fastdevelop.base.BasePresenter
;
import
com.mayi.fastdevelop.util.BitmapUtil
;
import
com.mayi.fastdevelop.util.QrUtil
;
...
...
@@ -21,17 +19,6 @@ public class QRActivity extends BaseActivity {
private
EditText
et
,
et0
;
private
TextView
tv
;
@Override
public
BasePresenter
getPresenterInstance
()
{
return
null
;
}
@Override
public
BaseAPI
getModelInstance
()
{
return
null
;
}
@Override
protected
void
onCreate
(
@Nullable
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
...
...
@@ -62,8 +49,4 @@ public class QRActivity extends BaseActivity {
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 @
0d006e94
...
...
@@ -10,9 +10,7 @@ import android.view.View;
import
android.view.ViewGroup
;
import
android.widget.TextView
;
import
com.mayi.fastdevelop.base.BaseAPI
;
import
com.mayi.fastdevelop.base.BaseActivity
;
import
com.mayi.fastdevelop.base.BasePresenter
;
import
com.scwang.smartrefresh.layout.SmartRefreshLayout
;
import
com.scwang.smartrefresh.layout.api.RefreshLayout
;
import
com.scwang.smartrefresh.layout.listener.OnLoadmoreListener
;
...
...
@@ -26,15 +24,6 @@ public class SmartRefreshLayoutActivity extends BaseActivity {
private
int
size
=
50
;
Handler
handler
;
@Override
public
BasePresenter
getPresenterInstance
()
{
return
null
;
}
@Override
public
BaseAPI
getModelInstance
()
{
return
null
;
}
@Override
protected
void
onCreate
(
@Nullable
Bundle
savedInstanceState
)
{
...
...
@@ -79,12 +68,6 @@ public class SmartRefreshLayoutActivity extends BaseActivity {
});
}
@Override
public
BasePresenter
getPresenter
()
{
return
null
;
}
class
MyAdapter
extends
RecyclerView
.
Adapter
<
MyVH
>
{
@NonNull
...
...
app/src/main/java/com/mayi/demo/StartActivity.java
View file @
0d006e94
package
com
.
mayi
.
demo
;
import
com.mayi.fastdevelop.base.BaseAPI
;
import
com.mayi.fastdevelop.base.BasePresenter
;
import
com.mayi.fastdevelop.commonpage.BaseStartActivity
;
public
class
StartActivity
extends
BaseStartActivity
<
ViewActviity
,
ViewActviity
,
ViewActviity
>{
...
...
@@ -20,13 +18,4 @@ public class StartActivity extends BaseStartActivity<ViewActviity,ViewActviity,V
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 @
0d006e94
...
...
@@ -4,23 +4,12 @@ import android.os.Bundle;
import
android.support.annotation.Nullable
;
import
android.view.View
;
import
com.mayi.fastdevelop.base.BaseAPI
;
import
com.mayi.fastdevelop.base.BaseActivity
;
import
com.mayi.fastdevelop.base.BasePresenter
;
import
com.mayi.fastdevelop.util.ToastUtil
;
import
com.mayi.fastdevelop.view.CustomTitleBar
;
public
class
TitleActivity
extends
BaseActivity
{
@Override
public
BasePresenter
getPresenterInstance
()
{
return
null
;
}
@Override
public
BaseAPI
getModelInstance
()
{
return
null
;
}
@Override
protected
void
onCreate
(
@Nullable
Bundle
savedInstanceState
)
{
...
...
@@ -80,8 +69,4 @@ public class TitleActivity extends BaseActivity{
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 @
0d006e94
...
...
@@ -2,14 +2,10 @@ package com.mayi.demo;
import
android.os.Bundle
;
import
android.support.annotation.Nullable
;
import
android.util.Log
;
import
android.view.View
;
import
com.mayi.fastdevelop.base.BaseAPI
;
import
com.mayi.fastdevelop.base.BaseActivity
;
import
com.mayi.fastdevelop.base.BasePresenter
;
import
com.mayi.fastdevelop.util.DialogUtils
;
import
com.mayi.fastdevelop.util.LogUtils
;
import
com.mayi.fastdevelop.util.ToastUtil
;
import
com.mayi.fastdevelop.view.wheel.ChangeAddressDialog
;
import
com.mayi.fastdevelop.view.wheel.ChangeBirthDialog
;
...
...
@@ -21,17 +17,6 @@ import com.mayi.fastdevelop.view.wheel.ChangeTimeDialog;
*/
public
class
ViewActviity
extends
BaseActivity
{
@Override
public
BasePresenter
getPresenterInstance
()
{
return
null
;
}
@Override
public
BaseAPI
getModelInstance
()
{
return
null
;
}
@Override
protected
void
onCreate
(
@Nullable
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
...
...
@@ -175,8 +160,4 @@ public class ViewActviity extends BaseActivity {
});
}
@Override
public
BasePresenter
getPresenter
()
{
return
null
;
}
}
app/src/main/res/layout/activity_cutpictures.xml
0 → 100644
View file @
0d006e94
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:orientation=
"vertical"
>
<Button
android:id=
"@+id/bt1"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"拍照并且裁剪图片"
/>
<Button
android:id=
"@+id/bt2"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"相册并且裁剪图片"
/>
<ImageView
android:id=
"@+id/img"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:scaleType=
"fitXY"
/>
</LinearLayout>
\ No newline at end of file
app/src/main/res/layout/activity_page.xml
View file @
0d006e94
...
...
@@ -50,13 +50,6 @@
android:layout_height=
"wrap_content"
android:text=
"搜索地址页"
/>
<Button
android:id=
"@+id/b8"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"登录页"
/>
</LinearLayout>
</ScrollView>
\ No newline at end of file
fastDevelop/src/main/java/com/mayi/fastdevelop/api/UserAPI.java
View file @
0d006e94
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
class
UserAPI
{
public
static
void
login
(
String
mobile
,
String
password
,
ResultCallback
<
UserInfo
>
callback
)
{
new
NetWorkBuilder
().
setUrl
(
HttpUrl
.
URL_LOGIN
)
...
...
fastDevelop/src/main/java/com/mayi/fastdevelop/base/BaseAPI.java
deleted
100644 → 0
View file @
b0c8089a
package
com
.
mayi
.
fastdevelop
.
base
;
public
interface
BaseAPI
{
}
fastDevelop/src/main/java/com/mayi/fastdevelop/base/BaseActivity.java
View file @
0d006e94
...
...
@@ -9,56 +9,16 @@ import android.support.v7.app.AppCompatActivity;
import
com.mayi.fastdevelop.util.ToastUtil
;
import
com.mayi.fastdevelop.view.LoadingDialog
;
public
abstract
class
BaseActivity
<
P
extends
BasePresenter
,
M
extends
BaseAPI
>
extends
AppCompatActivity
{
public
abstract
class
BaseActivity
extends
AppCompatActivity
{
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
()
{
if
(
dialog
==
null
)
{
dialog
=
LoadingDialog
.
init
(
this
).
setCanTouchOutsideCancel
(
true
).
show
();
...
...
fastDevelop/src/main/java/com/mayi/fastdevelop/base/BaseCutPicturesActivity.java
0 → 100644
View file @
0d006e94
package
com
.
mayi
.
fastdevelop
.
base
;
import
android.Manifest
;
import
android.content.Intent
;
import
android.graphics.Bitmap
;
import
android.net.Uri
;
import
android.os.Build
;
import
android.os.Bundle
;
import
android.os.Environment
;
import
android.provider.MediaStore
;
import
android.support.v4.content.FileProvider
;
import
com.mayi.fastdevelop.util.PermissionUtil
;
import
java.io.File
;
import
java.util.List
;
public
abstract
class
BaseCutPicturesActivity
extends
BaseActivity
{
private
final
int
REQUESTCODE_CAMERA
=
100
;
//拍照回调
private
final
int
REQUESTCODE_CUT_PICTURES
=
101
;
//裁剪图片回调
private
String
imgPath
;
//裁剪保存图片地址
private
Uri
uri
;
private
File
cameraSavePath
;
//拍照保存图片地址
private
String
[]
permissions
=
{
Manifest
.
permission
.
CAMERA
,
Manifest
.
permission
.
WRITE_EXTERNAL_STORAGE
};
@Override
protected
void
onSaveInstanceState
(
Bundle
outState
)
{
super
.
onSaveInstanceState
(
outState
);
}
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
PermissionUtil
.
requestPermission
(
new
PermissionUtil
.
PermissionCallback
()
{
@Override
public
void
onSuccess
(
List
<
String
>
data
)
{
}
@Override
public
void
onFail
(
List
<
String
>
data
)
{
showToast
(
"需要获取您的相册、照相使用权限"
);
finish
();
}
},
permissions
);
}
//激活相册操作
protected
void
goPhotoAlbum
()
{
Intent
intent
=
new
Intent
();
intent
.
setAction
(
Intent
.
ACTION_PICK
);
intent
.
setType
(
"image/*"
);
startActivityForResult
(
intent
,
2
);
}
//激活相机操作
protected
void
goCamera
()
{
cameraSavePath
=
new
File
(
Environment
.
getExternalStorageDirectory
().
getPath
()
+
"/"
+
getPackageName
()
+
"/"
+
System
.
currentTimeMillis
()
+
".jpg"
);
Intent
intent
=
new
Intent
(
MediaStore
.
ACTION_IMAGE_CAPTURE
);
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
N
)
{
uri
=
FileProvider
.
getUriForFile
(
this
,
getPackageName
()
+
".uri"
,
cameraSavePath
);
intent
.
addFlags
(
Intent
.
FLAG_GRANT_READ_URI_PERMISSION
);
}
else
{
uri
=
Uri
.
fromFile
(
cameraSavePath
);
}
intent
.
putExtra
(
MediaStore
.
EXTRA_OUTPUT
,
uri
);
startActivityForResult
(
intent
,
REQUESTCODE_CAMERA
);
}
@Override
protected
void
onActivityResult
(
int
requestCode
,
int
resultCode
,
Intent
data
)
{
if
(
requestCode
==
REQUESTCODE_CAMERA
&&
resultCode
==
RESULT_OK
)
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
N
)
{
uri
=
FileProvider
.
getUriForFile
(
this
,
getPackageName
()
+
".uri"
,
cameraSavePath
);
}
else
{
uri
=
Uri
.
fromFile
(
cameraSavePath
);
}
photoClip
(
uri
);
}
else
if
(
requestCode
==
2
&&
resultCode
==
RESULT_OK
)
{
photoClip
(
data
.
getData
());
}
else
if
(
requestCode
==
REQUESTCODE_CUT_PICTURES
&&
resultCode
==
RESULT_OK
)
{
Bundle
bundle
=
data
.
getExtras
();
if
(
bundle
!=
null
)
{
getBitmapPath
(
imgPath
);
}
}
super
.
onActivityResult
(
requestCode
,
resultCode
,
data
);
}
//获取裁剪图片本地地址
protected
void
getBitmapPath
(
String
imgPath
)
{
}
protected
void
photoClip
(
Uri
uri
)
{
// 调用系统中自带的图片剪裁
Intent
intent1
=
new
Intent
();
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
N
)
{
intent1
.
addFlags
(
Intent
.
FLAG_GRANT_READ_URI_PERMISSION
);
}
/*设置调用裁剪工具的action*/
intent1
.
setAction
(
"com.android.camera.action.CROP"
);
/*创建一个指向需要操作文件(filename)的文件流。(可解决无法“加载问题”)*/
intent1
.
setDataAndType
(
uri
,
"image/*"
);
intent1
.
putExtra
(
"crop"
,
"true"
);
intent1
.
putExtra
(
"scale"
,
true
);
intent1
.
putExtra
(
"return-data"
,
false
);
imgPath
=
Environment
.
getExternalStorageDirectory
().
getPath
()
+
"/"
+
System
.
currentTimeMillis
()
+
".jpg"
;
Uri
uritempFile
=
Uri
.
parse
(
"file://"
+
"/"
+
imgPath
);
intent1
.
putExtra
(
MediaStore
.
EXTRA_OUTPUT
,
uritempFile
);
intent1
.
putExtra
(
"outputFormat"
,
Bitmap
.
CompressFormat
.
JPEG
.
toString
());
intent1
.
putExtra
(
"noFaceDetection"
,
true
);
startActivityForResult
(
intent1
,
REQUESTCODE_CUT_PICTURES
);
}
}
fastDevelop/src/main/java/com/mayi/fastdevelop/base/BasePresenter.java
deleted
100644 → 0
View file @
b0c8089a
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
deleted
100644 → 0
View file @
b0c8089a
package
com
.
mayi
.
fastdevelop
.
base
;
public
interface
BaseView
{
}
fastDevelop/src/main/java/com/mayi/fastdevelop/commonpage/login/LoginActivity.java
deleted
100644 → 0
View file @
b0c8089a
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
deleted
100644 → 0
View file @
b0c8089a
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
deleted
100644 → 0
View file @
b0c8089a
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
deleted
100644 → 0
View file @
b0c8089a
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/okhttp/NetWorkBuilder.java
View file @
0d006e94
...
...
@@ -22,8 +22,9 @@ public class NetWorkBuilder {
private
JSONObject
params
=
new
JSONObject
();
private
String
stringParam
;
public
void
setStringParam
(
String
stringParam
)
{
public
NetWorkBuilder
setStringParam
(
String
stringParam
)
{
this
.
stringParam
=
stringParam
;
return
this
;
}
public
NetWorkBuilder
setCallback
(
ResultCallback
callback
)
{
...
...
@@ -46,7 +47,7 @@ public class NetWorkBuilder {
return
this
;
}
public
NetWorkBuilder
addParam
(
String
key
,
String
param
)
{
public
NetWorkBuilder
addParam
(
String
key
,
Object
param
)
{
try
{
params
.
put
(
key
,
param
);
}
catch
(
JSONException
e
)
{
...
...
fastDevelop/src/main/java/com/mayi/fastdevelop/okhttp/NetWorkUtil.java
View file @
0d006e94
...
...
@@ -114,6 +114,12 @@ public class NetWorkUtil {
public
void
performSynGetHttpRequest
(
String
url
,
ResultCallback
callback
)
{
Request
request
=
new
Request
.
Builder
().
get
()
.
url
(
url
)
.
addHeader
(
"content-type"
,
"application/json"
)
.
addHeader
(
"__REQUEST_TYPE"
,
"HTTP_CLIENT"
)
.
addHeader
(
"AUTH_TYPE"
,
"1"
)
.
addHeader
(
"AUTH_TOKEN"
,
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ7XCJ1c2VyQ29kZVwiOlwiOTA0NjM5NlwifSIsImlhdCI6MTU2MTQ1MTQwOX0.xizAX3iHVFMXNElpdMILZIYD7K7x8gaF2dG9J1hHPhE94e5a8fbea974e10aeebbe55eee21845"
)
.
addHeader
(
"x-auth-token"
,
"5fea181d-ec7f-4083-8647-3afa22268627"
)
.
addHeader
(
"USER_CODE"
,
"9046396"
)
.
build
();
initiateRequest
(
callback
,
request
);
}
...
...
fastDevelop/src/main/java/com/mayi/fastdevelop/util/BitmapUtil.java
View file @
0d006e94
...
...
@@ -354,6 +354,26 @@ public class BitmapUtil {
return
null
;
}
public
static
boolean
createFile
(
File
file
)
{
if
(
file
!=
null
&&
!
file
.
exists
())
{
String
absolutePath
=
file
.
getAbsolutePath
();
if
(
absolutePath
.
endsWith
(
File
.
separator
))
{
//创建文件夹
if
(!
file
.
exists
())
{
//文件夹不存在
return
file
.
mkdirs
();
}
}
else
{
//创建文件
if
(!
file
.
exists
())
{
//文件不存在
if
(!
file
.
getParentFile
().
exists
())
{
return
file
.
getParentFile
().
mkdirs
();
}
}
}
}
return
false
;
}
/**
* @param bitmap
* @param path 绝对路径
...
...
map/src/main/java/com/mayi/fastdevelop/map/MapLocationActivity.java
View file @
0d006e94
...
...
@@ -44,9 +44,7 @@ import com.amap.api.services.help.InputtipsQuery;
import
com.amap.api.services.help.Tip
;
import
com.amap.api.services.poisearch.PoiResult
;
import
com.amap.api.services.poisearch.PoiSearch
;
import
com.mayi.fastdevelop.base.BaseAPI
;
import
com.mayi.fastdevelop.base.BaseActivity
;
import
com.mayi.fastdevelop.base.BasePresenter
;
import
com.mayi.fastdevelop.comnon.Key
;
import
com.mayi.fastdevelop.util.DisplayUtil
;
import
com.mayi.fastdevelop.util.LogUtils
;
...
...
@@ -109,16 +107,6 @@ public class MapLocationActivity extends BaseActivity implements LocationSource,
private
String
city
=
""
;
@Override
public
BasePresenter
getPresenterInstance
()
{
return
null
;
}
@Override
public
BaseAPI
getModelInstance
()
{
return
null
;
}
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
requestWindowFeature
(
Window
.
FEATURE_NO_TITLE
);
...
...
web/src/main/java/com/mayi/fastdevelop/web/BaseWebActivity.java
View file @
0d006e94
package
com
.
mayi
.
fastdevelop
.
web
;
import
android.Manifest
;
import
android.app.Activity
;
import
android.content.Context
;
...
...
@@ -25,11 +24,7 @@ import android.view.ViewGroup;
import
android.view.ViewParent
;
import
android.webkit.JavascriptInterface
;
import
com.alibaba.fastjson.JSON
;
import
com.mayi.fastdevelop.base.BaseAPI
;
import
com.mayi.fastdevelop.base.BaseActivity
;
import
com.mayi.fastdevelop.base.BasePresenter
;
import
com.mayi.fastdevelop.bean.LocationBean
;
import
com.mayi.fastdevelop.comnon.Key
;
import
com.mayi.fastdevelop.comnon.RequestCode
;
import
com.mayi.fastdevelop.util.BitmapUtil
;
...
...
@@ -78,16 +73,6 @@ public class BaseWebActivity extends BaseActivity {
}
@Override
public
BasePresenter
getPresenterInstance
()
{
return
null
;
}
@Override
public
BaseAPI
getModelInstance
()
{
return
null
;
}
@Override
protected
void
onCreate
(
@Nullable
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_web
);
...
...
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