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
47585350
Commit
47585350
authored
Jan 15, 2019
by
gao.chao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
轮播,图片加载
parent
0fccab18
Show whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
276 additions
and
2 deletions
+276
-2
app/src/main/AndroidManifest.xml
+2
-0
app/src/main/java/com/mayi/demo/BannerActivity.java
+63
-0
app/src/main/java/com/mayi/demo/LoadingPicturesActivity.java
+27
-0
app/src/main/java/com/mayi/demo/SmartRefreshLayoutActivity.java
+6
-0
app/src/main/java/com/mayi/demo/ViewActviity.java
+15
-0
app/src/main/res/layout/activity_banner.xml
+38
-0
app/src/main/res/layout/activity_loading_pictures.xml
+35
-0
app/src/main/res/layout/test_layout.xml
+14
-0
fastDevelop/build.gradle
+4
-2
fastDevelop/src/main/java/com/mayi/fastdevelop/base/BaseActivity.java
+5
-0
fastDevelop/src/main/java/com/mayi/fastdevelop/view/LoadingPictures.java
+39
-0
fastDevelop/src/main/java/com/mayi/fastdevelop/view/PicassoImageLoader.java
+28
-0
fastDevelop/src/main/res/mipmap-xxhdpi/b1.jpg
+0
-0
fastDevelop/src/main/res/mipmap-xxhdpi/b2.jpg
+0
-0
fastDevelop/src/main/res/mipmap-xxhdpi/b3.jpg
+0
-0
fastDevelop/src/main/res/mipmap-xxhdpi/loading_pictures_error_icon.png
+0
-0
fastDevelop/src/main/res/mipmap-xxhdpi/loading_pictures_placeholder_icon.jpg
+0
-0
No files found.
app/src/main/AndroidManifest.xml
View file @
47585350
...
...
@@ -18,6 +18,8 @@
</intent-filter>
</activity>
<activity
android:name=
".LoadingPicturesActivity"
/>
<activity
android:name=
".BannerActivity"
/>
<activity
android:name=
".ViewActviity"
/>
<activity
android:name=
".QRActivity"
/>
<activity
android:name=
".TitleActivity"
/>
...
...
app/src/main/java/com/mayi/demo/BannerActivity.java
0 → 100644
View file @
47585350
package
com
.
mayi
.
demo
;
import
android.os.Bundle
;
import
android.support.annotation.Nullable
;
import
com.mayi.fastdevelop.base.BaseActivity
;
import
com.mayi.fastdevelop.view.PicassoImageLoader
;
import
com.youth.banner.Banner
;
import
com.youth.banner.BannerConfig
;
import
com.youth.banner.listener.OnBannerListener
;
import
com.youth.banner.transformer.FlipHorizontalTransformer
;
import
java.util.ArrayList
;
import
java.util.List
;
public
class
BannerActivity
extends
BaseActivity
implements
OnBannerListener
{
List
list
=
new
ArrayList
();
List
listText
=
new
ArrayList
();
@Override
protected
void
onCreate
(
@Nullable
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_banner
);
list
.
add
(
"http://ww4.sinaimg.cn/large/006uZZy8jw1faic1xjab4j30ci08cjrv.jpg"
);
list
.
add
(
"http://ww4.sinaimg.cn/large/006uZZy8jw1faic21363tj30ci08ct96.jpg"
);
list
.
add
(
"http://ww4.sinaimg.cn/large/006uZZy8jw1faic259ohaj30ci08c74r.jpg"
);
list
.
add
(
"http://ww4.sinaimg.cn/large/006uZZy8jw1faic2b16zuj30ci08cwf4.jpg"
);
list
.
add
(
"http://ww4.sinaimg.cn/large/006uZZy8jw1faic2e7vsaj30ci08cglz.jpg"
);
listText
.
add
(
"1"
);
listText
.
add
(
"2"
);
listText
.
add
(
"3"
);
listText
.
add
(
"4"
);
listText
.
add
(
"5"
);
Banner
banner1
=
findViewById
(
R
.
id
.
banner1
);
banner1
.
setIndicatorGravity
(
BannerConfig
.
LEFT
);
//设置指示器位置
banner1
.
updateBannerStyle
(
BannerConfig
.
NUM_INDICATOR_TITLE
);
//设置样式
banner1
.
setImages
(
list
)
.
setBannerTitles
(
listText
)
//设置图片文字
.
setBannerAnimation
(
FlipHorizontalTransformer
.
class
)
//设置动画
.
setImageLoader
(
new
PicassoImageLoader
())
.
setOnBannerListener
(
this
)
.
start
();
Banner
banner2
=
findViewById
(
R
.
id
.
banner2
);
List
<
Integer
>
list
=
new
ArrayList
<>();
list
.
add
(
R
.
mipmap
.
b1
);
list
.
add
(
R
.
mipmap
.
b2
);
list
.
add
(
R
.
mipmap
.
b3
);
banner2
.
setImages
(
list
)
.
setImageLoader
(
new
PicassoImageLoader
())
.
start
();
}
@Override
public
void
OnBannerClick
(
int
position
)
{
showToast
(
"position="
+
position
);
}
}
app/src/main/java/com/mayi/demo/LoadingPicturesActivity.java
0 → 100644
View file @
47585350
package
com
.
mayi
.
demo
;
import
android.os.Bundle
;
import
android.os.Environment
;
import
android.support.annotation.Nullable
;
import
android.widget.ImageView
;
import
com.mayi.fastdevelop.base.BaseActivity
;
import
com.mayi.fastdevelop.view.LoadingPictures
;
import
java.io.File
;
public
class
LoadingPicturesActivity
extends
BaseActivity
{
@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/SmartRefreshLayoutActivity.java
0 → 100644
View file @
47585350
package
com
.
mayi
.
demo
;
import
com.mayi.fastdevelop.base.BaseActivity
;
public
class
SmartRefreshLayoutActivity
extends
BaseActivity
{
}
app/src/main/java/com/mayi/demo/ViewActviity.java
View file @
47585350
...
...
@@ -2,10 +2,12 @@ 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.BaseActivity
;
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
;
...
...
@@ -131,5 +133,18 @@ public class ViewActviity extends BaseActivity {
}
});
findViewById
(
R
.
id
.
b10
).
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
gotoActivity
(
BannerActivity
.
class
);
}
});
findViewById
(
R
.
id
.
b11
).
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
gotoActivity
(
LoadingPicturesActivity
.
class
);
}
});
}
}
app/src/main/res/layout/activity_banner.xml
0 → 100644
View file @
47585350
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:orientation=
"vertical"
>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"加载网络图片及设置动画,设置样式,设置指针位置"
/>
<com.youth.banner.Banner
android:id=
"@+id/banner1"
android:layout_width=
"match_parent"
android:layout_height=
"@dimen/im_dp_150"
/>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"加载本地图片"
/>
<com.youth.banner.Banner
android:id=
"@+id/banner2"
android:layout_width=
"match_parent"
android:layout_height=
"@dimen/im_dp_150"
/>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"Github地址: https://github.com/youth5201314/banner"
/>
</LinearLayout>
</ScrollView>
\ No newline at end of file
app/src/main/res/layout/activity_loading_pictures.xml
0 → 100644
View file @
47585350
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:orientation=
"vertical"
>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"加载网络图片"
/>
<ImageView
android:id=
"@+id/img1"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
/>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"加载本地图片"
/>
<ImageView
android:id=
"@+id/img2"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
/>
</LinearLayout>
</ScrollView>
\ No newline at end of file
app/src/main/res/layout/test_layout.xml
View file @
47585350
...
...
@@ -64,5 +64,18 @@
android:layout_height=
"wrap_content"
android:text=
"标题栏"
/>
<Button
android:id=
"@+id/b10"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"图片轮播控件"
/>
<Button
android:id=
"@+id/b11"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"图片加载"
/>
</LinearLayout>
</ScrollView>
\ No newline at end of file
fastDevelop/build.gradle
View file @
47585350
...
...
@@ -26,10 +26,12 @@ android {
dependencies
{
api
fileTree
(
include:
[
'*.jar'
],
dir:
'libs'
)
api
'com.scwang.smartrefresh:SmartRefreshLayout:1.0.3'
//下拉刷新,加载更多
api
'com.youth.banner:banner:1.4.10'
//图片轮播控件
api
"com.tencent.bugly:crashreport_upgrade:1.3.4"
api
'com.tencent.bugly:nativecrashreport:3.6.0.1'
api
'com.squareup.okhttp3:okhttp:3.10.0'
api
'com.squareup.picasso:picasso:2.5.2'
api
'com.squareup.picasso:picasso:2.5.2'
//图片加载
api
'com.tencent.bugly:crashreport_upgrade:1.3.4'
api
'com.tencent.bugly:nativecrashreport:3.6.0.1'
api
'com.orhanobut:logger:2.2.0'
...
...
@@ -40,5 +42,5 @@ dependencies {
androidTestImplementation
'com.android.support.test:runner:1.0.2'
androidTestImplementation
'com.android.support.test.espresso:espresso-core:3.0.2'
api
files
(
'libs/zixing-core-3.2.0.jar'
)
implementation
files
(
'libs/tbs_sdk_thirdapp_v3.6.0.1371_43624_sharewithdownload_withoutGame_obfs_20181106_121046.jar'
)
implementation
files
(
'libs/tbs_sdk_thirdapp_v3.6.0.1371_43624_sharewithdownload_withoutGame_obfs_20181106_121046.jar'
)
//腾讯X5浏览器
}
fastDevelop/src/main/java/com/mayi/fastdevelop/base/BaseActivity.java
View file @
47585350
...
...
@@ -6,6 +6,7 @@ import android.os.Bundle;
import
android.support.annotation.Nullable
;
import
android.support.v7.app.AppCompatActivity
;
import
com.mayi.fastdevelop.util.ToastUtil
;
import
com.mayi.fastdevelop.view.LoadingDialog
;
public
abstract
class
BaseActivity
extends
AppCompatActivity
{
...
...
@@ -72,6 +73,10 @@ public abstract class BaseActivity extends AppCompatActivity {
startActivity
(
intent
);
}
public
void
showToast
(
String
msg
){
ToastUtil
.
show
(
this
,
msg
);
}
@Override
protected
void
onDestroy
()
{
dismssLoadingDialog
();
...
...
fastDevelop/src/main/java/com/mayi/fastdevelop/view/LoadingPictures.java
0 → 100644
View file @
47585350
package
com
.
mayi
.
fastdevelop
.
view
;
import
android.widget.ImageView
;
import
com.mayi.fastdevelop.R
;
import
com.squareup.picasso.Picasso
;
import
java.io.File
;
/**
* 加载图片
*/
public
class
LoadingPictures
{
public
static
int
error
=
R
.
mipmap
.
loading_pictures_error_icon
;
public
static
int
placeholder
=
R
.
mipmap
.
loading_pictures_placeholder_icon
;
public
static
void
loadUri
(
String
url
,
ImageView
img
)
{
Picasso
.
with
(
img
.
getContext
())
.
load
(
url
)
.
resize
(
2000
,
2000
)
.
onlyScaleDown
()
// 如果图片规格大于2000*2000,将只会被resize
.
placeholder
(
placeholder
)
.
error
(
error
)
.
into
(
img
);
}
public
static
void
loadFile
(
File
file
,
ImageView
img
)
{
Picasso
.
with
(
img
.
getContext
())
.
load
(
file
)
.
placeholder
(
placeholder
)
.
error
(
error
)
.
into
(
img
);
}
public
static
void
loadFile
(
String
pathname
,
ImageView
img
)
{
loadFile
(
new
File
(
pathname
),
img
);
}
}
fastDevelop/src/main/java/com/mayi/fastdevelop/view/PicassoImageLoader.java
0 → 100644
View file @
47585350
package
com
.
mayi
.
fastdevelop
.
view
;
import
android.content.Context
;
import
android.net.Uri
;
import
android.widget.ImageView
;
import
com.squareup.picasso.Picasso
;
import
com.youth.banner.loader.ImageLoader
;
import
java.io.File
;
/**
* 支持加载本地图片,网络图片,文件中图片
*/
public
class
PicassoImageLoader
extends
ImageLoader
{
@Override
public
void
displayImage
(
Context
context
,
Object
path
,
ImageView
imageView
)
{
if
(
path
instanceof
String
)
{
Picasso
.
with
(
context
).
load
((
String
)
path
).
into
(
imageView
);
}
else
if
(
path
instanceof
Integer
)
{
Picasso
.
with
(
context
).
load
((
Integer
)
path
).
into
(
imageView
);
}
else
if
(
path
instanceof
Uri
)
{
Picasso
.
with
(
context
).
load
((
Uri
)
path
).
into
(
imageView
);
}
else
if
(
path
instanceof
File
)
{
Picasso
.
with
(
context
).
load
((
File
)
path
).
into
(
imageView
);
}
}
}
fastDevelop/src/main/res/mipmap-xxhdpi/b1.jpg
0 → 100644
View file @
47585350
102 KB
fastDevelop/src/main/res/mipmap-xxhdpi/b2.jpg
0 → 100644
View file @
47585350
98.8 KB
fastDevelop/src/main/res/mipmap-xxhdpi/b3.jpg
0 → 100644
View file @
47585350
127 KB
fastDevelop/src/main/res/mipmap-xxhdpi/loading_pictures_error_icon.png
0 → 100644
View file @
47585350
7.38 KB
fastDevelop/src/main/res/mipmap-xxhdpi/loading_pictures_placeholder_icon.jpg
0 → 100644
View file @
47585350
3.41 KB
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