Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
沉迷打码的小凳子
glide
提交
14d04c55
G
glide
项目概览
沉迷打码的小凳子
/
glide
与 Fork 源项目一致
从无法访问的项目Fork
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
glide
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
14d04c55
编写于
10月 16, 2014
作者:
S
Sam Judd
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add a simple fullscreen activity for flickr sample
上级
1a7d5dfe
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
99 addition
and
1 deletion
+99
-1
samples/flickr/src/main/AndroidManifest.xml
samples/flickr/src/main/AndroidManifest.xml
+2
-0
samples/flickr/src/main/java/com/bumptech/glide/samples/flickr/FlickrPhotoGrid.java
...va/com/bumptech/glide/samples/flickr/FlickrPhotoGrid.java
+9
-0
samples/flickr/src/main/java/com/bumptech/glide/samples/flickr/FlickrPhotoList.java
...va/com/bumptech/glide/samples/flickr/FlickrPhotoList.java
+9
-0
samples/flickr/src/main/java/com/bumptech/glide/samples/flickr/FullscreenActivity.java
...com/bumptech/glide/samples/flickr/FullscreenActivity.java
+34
-0
samples/flickr/src/main/java/com/bumptech/glide/samples/flickr/api/Photo.java
...ain/java/com/bumptech/glide/samples/flickr/api/Photo.java
+40
-1
samples/flickr/src/main/res/layout/fullscreen_activity.xml
samples/flickr/src/main/res/layout/fullscreen_activity.xml
+5
-0
未找到文件。
samples/flickr/src/main/AndroidManifest.xml
浏览文件 @
14d04c55
...
@@ -21,6 +21,8 @@
...
@@ -21,6 +21,8 @@
</intent-filter>
</intent-filter>
</activity>
</activity>
<activity
android:name=
".FullscreenActivity"
/>
</application>
</application>
</manifest>
</manifest>
samples/flickr/src/main/java/com/bumptech/glide/samples/flickr/FlickrPhotoGrid.java
浏览文件 @
14d04c55
package
com.bumptech.glide.samples.flickr
;
package
com.bumptech.glide.samples.flickr
;
import
android.content.Intent
;
import
android.os.Bundle
;
import
android.os.Bundle
;
import
android.support.v4.app.Fragment
;
import
android.support.v4.app.Fragment
;
import
android.view.LayoutInflater
;
import
android.view.LayoutInflater
;
...
@@ -173,6 +174,14 @@ public class FlickrPhotoGrid extends Fragment implements PhotoViewer {
...
@@ -173,6 +174,14 @@ public class FlickrPhotoGrid extends Fragment implements PhotoViewer {
.
thumbnail
(
thumbnail
?
thumbnailRequest
.
load
(
current
)
:
null
)
.
thumbnail
(
thumbnail
?
thumbnailRequest
.
load
(
current
)
:
null
)
.
into
(
imageView
);
.
into
(
imageView
);
imageView
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
Intent
intent
=
FullscreenActivity
.
getIntent
(
getActivity
(),
current
);
startActivity
(
intent
);
}
});
return
imageView
;
return
imageView
;
}
}
}
}
...
...
samples/flickr/src/main/java/com/bumptech/glide/samples/flickr/FlickrPhotoList.java
浏览文件 @
14d04c55
package
com.bumptech.glide.samples.flickr
;
package
com.bumptech.glide.samples.flickr
;
import
android.content.Intent
;
import
android.graphics.Color
;
import
android.graphics.Color
;
import
android.graphics.drawable.ColorDrawable
;
import
android.graphics.drawable.ColorDrawable
;
import
android.os.Bundle
;
import
android.os.Bundle
;
...
@@ -190,6 +191,14 @@ public class FlickrPhotoList extends Fragment implements PhotoViewer {
...
@@ -190,6 +191,14 @@ public class FlickrPhotoList extends Fragment implements PhotoViewer {
.
load
(
current
)
.
load
(
current
)
.
into
(
viewHolder
.
imageView
);
.
into
(
viewHolder
.
imageView
);
viewHolder
.
imageView
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
Intent
intent
=
FullscreenActivity
.
getIntent
(
getActivity
(),
current
);
startActivity
(
intent
);
}
});
viewHolder
.
titleText
.
setText
(
current
.
getTitle
());
viewHolder
.
titleText
.
setText
(
current
.
getTitle
());
return
view
;
return
view
;
}
}
...
...
samples/flickr/src/main/java/com/bumptech/glide/samples/flickr/FullscreenActivity.java
0 → 100644
浏览文件 @
14d04c55
package
com.bumptech.glide.samples.flickr
;
import
android.content.Context
;
import
android.content.Intent
;
import
android.os.Bundle
;
import
android.support.v4.app.FragmentActivity
;
import
android.widget.ImageView
;
import
com.bumptech.glide.Glide
;
import
com.bumptech.glide.samples.flickr.api.Photo
;
/**
* A simple activity for viewing a single photo.
*/
public
class
FullscreenActivity
extends
FragmentActivity
{
private
static
final
String
ARG_PHOTO
=
"photo"
;
public
static
Intent
getIntent
(
Context
context
,
Photo
photo
)
{
Intent
intent
=
new
Intent
(
context
,
FullscreenActivity
.
class
);
intent
.
putExtra
(
ARG_PHOTO
,
photo
);
return
intent
;
}
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
fullscreen_activity
);
ImageView
fullscreenView
=
(
ImageView
)
findViewById
(
R
.
id
.
fullscreen_view
);
Photo
photo
=
getIntent
().
getParcelableExtra
(
ARG_PHOTO
);
Glide
.
with
(
this
)
.
load
(
photo
)
.
fitCenter
()
.
into
(
fullscreenView
);
}
}
samples/flickr/src/main/java/com/bumptech/glide/samples/flickr/api/Photo.java
浏览文件 @
14d04c55
package
com.bumptech.glide.samples.flickr.api
;
package
com.bumptech.glide.samples.flickr.api
;
import
android.os.Parcel
;
import
android.os.Parcelable
;
import
org.json.JSONException
;
import
org.json.JSONException
;
import
org.json.JSONObject
;
import
org.json.JSONObject
;
/**
/**
* A POJO representing a JSON object returned from Flickr's api representing a single image.
* A POJO representing a JSON object returned from Flickr's api representing a single image.
*/
*/
public
class
Photo
{
public
class
Photo
implements
Parcelable
{
public
static
final
Creator
<
Photo
>
CREATOR
=
new
Creator
<
Photo
>()
{
@Override
public
Photo
createFromParcel
(
Parcel
parcel
)
{
return
new
Photo
(
parcel
);
}
@Override
public
Photo
[]
newArray
(
int
i
)
{
return
new
Photo
[
i
];
}
};
private
final
String
id
;
private
final
String
id
;
private
final
String
owner
;
private
final
String
owner
;
private
final
String
title
;
private
final
String
title
;
...
@@ -15,6 +29,7 @@ public class Photo {
...
@@ -15,6 +29,7 @@ public class Photo {
private
final
String
secret
;
private
final
String
secret
;
private
String
partialUrl
=
null
;
private
String
partialUrl
=
null
;
public
Photo
(
JSONObject
jsonPhoto
)
throws
JSONException
{
public
Photo
(
JSONObject
jsonPhoto
)
throws
JSONException
{
this
.
id
=
jsonPhoto
.
getString
(
"id"
);
this
.
id
=
jsonPhoto
.
getString
(
"id"
);
this
.
owner
=
jsonPhoto
.
getString
(
"owner"
);
this
.
owner
=
jsonPhoto
.
getString
(
"owner"
);
...
@@ -24,6 +39,25 @@ public class Photo {
...
@@ -24,6 +39,25 @@ public class Photo {
this
.
secret
=
jsonPhoto
.
getString
(
"secret"
);
this
.
secret
=
jsonPhoto
.
getString
(
"secret"
);
}
}
private
Photo
(
Parcel
in
)
{
id
=
in
.
readString
();
owner
=
in
.
readString
();
title
=
in
.
readString
();
server
=
in
.
readString
();
farm
=
in
.
readString
();
secret
=
in
.
readString
();
}
@Override
public
void
writeToParcel
(
Parcel
parcel
,
int
i
)
{
parcel
.
writeString
(
id
);
parcel
.
writeString
(
owner
);
parcel
.
writeString
(
title
);
parcel
.
writeString
(
server
);
parcel
.
writeString
(
farm
);
parcel
.
writeString
(
secret
);
}
public
String
getPartialUrl
()
{
public
String
getPartialUrl
()
{
if
(
partialUrl
==
null
)
{
if
(
partialUrl
==
null
)
{
partialUrl
=
Api
.
getCacheableUrl
(
this
);
partialUrl
=
Api
.
getCacheableUrl
(
this
);
...
@@ -99,4 +133,9 @@ public class Photo {
...
@@ -99,4 +133,9 @@ public class Photo {
result
=
31
*
result
+
secret
.
hashCode
();
result
=
31
*
result
+
secret
.
hashCode
();
return
result
;
return
result
;
}
}
@Override
public
int
describeContents
()
{
return
0
;
}
}
}
samples/flickr/src/main/res/layout/fullscreen_activity.xml
0 → 100644
浏览文件 @
14d04c55
<?xml version="1.0" encoding="utf-8"?>
<ImageView
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:id=
"@+id/fullscreen_view"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
/>
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录