Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
张胜利
/
Androidgroup
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
550e1a79
authored
Feb 09, 2015
by
张胜利
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
再来初始化一次
parent
9ab372c0
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
304 additions
and
0 deletions
imageLoader/src/com/nostra13/universalimageloader/core/assist/ImageScaleType.java
imageLoader/src/com/nostra13/universalimageloader/core/assist/ImageSize.java
imageLoader/src/com/nostra13/universalimageloader/core/assist/LoadedFrom.java
imageLoader/src/com/nostra13/universalimageloader/core/assist/QueueProcessingType.java
imageLoader/src/com/nostra13/universalimageloader/core/assist/ViewScaleType.java
imageLoader/src/com/nostra13/universalimageloader/core/assist/deque/BlockingDeque.java
imageLoader/src/com/nostra13/universalimageloader/core/assist/deque/Deque.java
imageLoader/src/com/nostra13/universalimageloader/core/assist/deque/LIFOLinkedBlockingDeque.java
imageLoader/src/com/nostra13/universalimageloader/core/assist/deque/LinkedBlockingDeque.java
imageLoader/src/com/nostra13/universalimageloader/core/assist/ImageScaleType.java
0 → 100644
View file @
550e1a79
/*******************************************************************************
* Copyright 2011-2014 Sergey Tarasevich
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*******************************************************************************/
package
com
.
nostra13
.
universalimageloader
.
core
.
assist
;
/**
* Type of image scaling during decoding.
*
* @author Sergey Tarasevich (nostra13[at]gmail[dot]com)
* @since 1.5.0
*/
public
enum
ImageScaleType
{
/** Image won't be scaled */
NONE
,
/**
* Image will be scaled down only if image size is greater than
* {@linkplain javax.microedition.khronos.opengles.GL10#GL_MAX_TEXTURE_SIZE maximum acceptable texture size}.
* Usually it's 2048x2048.<br />
* If Bitmap is expected to display than it must not exceed this size (otherwise you'll get the exception
* "OpenGLRenderer: Bitmap too large to be uploaded into a texture".<br />
* Image will be subsampled in an integer number of times (1, 2, 3, ...) to maximum texture size of device.
*/
NONE_SAFE
,
/**
* Image will be reduces 2-fold until next reduce step make image smaller target size.<br />
* It's <b>fast</b> type and it's preferable for usage in lists/grids/galleries (and other
* {@linkplain android.widget.AdapterView adapter-views}) .<br />
* Relates to {@link android.graphics.BitmapFactory.Options#inSampleSize}<br />
* Note: If original image size is smaller than target size then original image <b>won't</b> be scaled.
*/
IN_SAMPLE_POWER_OF_2
,
/**
* Image will be subsampled in an integer number of times (1, 2, 3, ...). Use it if memory economy is quite
* important.<br />
* Relates to {@link android.graphics.BitmapFactory.Options#inSampleSize}<br />
* Note: If original image size is smaller than target size then original image <b>won't</b> be scaled.
*/
IN_SAMPLE_INT
,
/**
* Image will scaled-down exactly to target size (scaled width or height or both will be equal to target size;
* depends on {@linkplain android.widget.ImageView.ScaleType ImageView's scale type}). Use it if memory economy is
* critically important.<br />
* <b>Note:</b> If original image size is smaller than target size then original image <b>won't</b> be scaled.<br />
* <br />
* <b>NOTE:</b> For creating result Bitmap (of exact size) additional Bitmap will be created with
* {@link android.graphics.Bitmap#createBitmap(android.graphics.Bitmap, int, int, int, int, android.graphics.Matrix, boolean)
* Bitmap.createBitmap(...)}.<br />
* <b>Cons:</b> Saves memory by keeping smaller Bitmap in memory cache (comparing with IN_SAMPLE... scale types)<br />
* <b>Pros:</b> Requires more memory in one time for creation of result Bitmap.
*/
EXACTLY
,
/**
* Image will scaled exactly to target size (scaled width or height or both will be equal to target size; depends on
* {@linkplain android.widget.ImageView.ScaleType ImageView's scale type}). Use it if memory economy is critically
* important.<br />
* <b>Note:</b> If original image size is smaller than target size then original image <b>will be stretched</b> to
* target size.<br />
* <br />
* <b>NOTE:</b> For creating result Bitmap (of exact size) additional Bitmap will be created with
* {@link android.graphics.Bitmap#createBitmap(android.graphics.Bitmap, int, int, int, int, android.graphics.Matrix, boolean)
* Bitmap.createBitmap(...)}.<br />
* <b>Cons:</b> Saves memory by keeping smaller Bitmap in memory cache (comparing with IN_SAMPLE... scale types)<br />
* <b>Pros:</b> Requires more memory in one time for creation of result Bitmap.
*/
EXACTLY_STRETCHED
}
imageLoader/src/com/nostra13/universalimageloader/core/assist/ImageSize.java
0 → 100644
View file @
550e1a79
/*******************************************************************************
* Copyright 2011-2013 Sergey Tarasevich
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*******************************************************************************/
package
com
.
nostra13
.
universalimageloader
.
core
.
assist
;
/**
* Present width and height values
*
* @author Sergey Tarasevich (nostra13[at]gmail[dot]com)
* @since 1.0.0
*/
public
class
ImageSize
{
private
static
final
int
TO_STRING_MAX_LENGHT
=
9
;
// "9999x9999".length()
private
static
final
String
SEPARATOR
=
"x"
;
private
final
int
width
;
private
final
int
height
;
public
ImageSize
(
int
width
,
int
height
)
{
this
.
width
=
width
;
this
.
height
=
height
;
}
public
ImageSize
(
int
width
,
int
height
,
int
rotation
)
{
if
(
rotation
%
180
==
0
)
{
this
.
width
=
width
;
this
.
height
=
height
;
}
else
{
this
.
width
=
height
;
this
.
height
=
width
;
}
}
public
int
getWidth
()
{
return
width
;
}
public
int
getHeight
()
{
return
height
;
}
/** Scales down dimensions in <b>sampleSize</b> times. Returns new object. */
public
ImageSize
scaleDown
(
int
sampleSize
)
{
return
new
ImageSize
(
width
/
sampleSize
,
height
/
sampleSize
);
}
/** Scales dimensions according to incoming scale. Returns new object. */
public
ImageSize
scale
(
float
scale
)
{
return
new
ImageSize
((
int
)
(
width
*
scale
),
(
int
)
(
height
*
scale
));
}
@Override
public
String
toString
()
{
return
new
StringBuilder
(
TO_STRING_MAX_LENGHT
).
append
(
width
).
append
(
SEPARATOR
).
append
(
height
).
toString
();
}
}
imageLoader/src/com/nostra13/universalimageloader/core/assist/LoadedFrom.java
0 → 100644
View file @
550e1a79
package
com
.
nostra13
.
universalimageloader
.
core
.
assist
;
/**
* Source image loaded from.
*
* @author Sergey Tarasevich (nostra13[at]gmail[dot]com)
*/
public
enum
LoadedFrom
{
NETWORK
,
DISC_CACHE
,
MEMORY_CACHE
}
imageLoader/src/com/nostra13/universalimageloader/core/assist/QueueProcessingType.java
0 → 100644
View file @
550e1a79
/*******************************************************************************
* Copyright 2011-2013 Sergey Tarasevich
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*******************************************************************************/
package
com
.
nostra13
.
universalimageloader
.
core
.
assist
;
/**
* Queue processing type which will be used for display task processing
*
* @author Sergey Tarasevich (nostra13[at]gmail[dot]com)
* @since 1.6.3
*/
public
enum
QueueProcessingType
{
FIFO
,
LIFO
}
imageLoader/src/com/nostra13/universalimageloader/core/assist/ViewScaleType.java
0 → 100644
View file @
550e1a79
/*******************************************************************************
* Copyright 2011-2013 Sergey Tarasevich
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*******************************************************************************/
package
com
.
nostra13
.
universalimageloader
.
core
.
assist
;
import
android.widget.ImageView
;
import
android.widget.ImageView.ScaleType
;
/**
* Simplify {@linkplain ScaleType ImageView's scale type} to 2 types: {@link #FIT_INSIDE} and {@link #CROP}
*
* @author Sergey Tarasevich (nostra13[at]gmail[dot]com)
* @since 1.6.1
*/
public
enum
ViewScaleType
{
/**
* Scale the image uniformly (maintain the image's aspect ratio) so that at least one dimension (width or height) of
* the image will be equal to or less the corresponding dimension of the view.
*/
FIT_INSIDE
,
/**
* Scale the image uniformly (maintain the image's aspect ratio) so that both dimensions (width and height) of the
* image will be equal to or larger than the corresponding dimension of the view.
*/
CROP
;
/**
* Defines scale type of ImageView.
*
* @param imageView {@link ImageView}
* @return {@link #FIT_INSIDE} for
* <ul>
* <li>{@link ScaleType#FIT_CENTER}</li>
* <li>{@link ScaleType#FIT_XY}</li>
* <li>{@link ScaleType#FIT_START}</li>
* <li>{@link ScaleType#FIT_END}</li>
* <li>{@link ScaleType#CENTER_INSIDE}</li>
* </ul>
* {@link #CROP} for
* <ul>
* <li>{@link ScaleType#CENTER}</li>
* <li>{@link ScaleType#CENTER_CROP}</li>
* <li>{@link ScaleType#MATRIX}</li>
* </ul>
*/
public
static
ViewScaleType
fromImageView
(
ImageView
imageView
)
{
switch
(
imageView
.
getScaleType
())
{
case
FIT_CENTER:
case
FIT_XY:
case
FIT_START:
case
FIT_END:
case
CENTER_INSIDE:
return
FIT_INSIDE
;
case
MATRIX:
case
CENTER:
case
CENTER_CROP:
default
:
return
CROP
;
}
}
}
imageLoader/src/com/nostra13/universalimageloader/core/assist/deque/BlockingDeque.java
0 → 100644
View file @
550e1a79
This diff is collapsed.
Click to expand it.
imageLoader/src/com/nostra13/universalimageloader/core/assist/deque/Deque.java
0 → 100644
View file @
550e1a79
This diff is collapsed.
Click to expand it.
imageLoader/src/com/nostra13/universalimageloader/core/assist/deque/LIFOLinkedBlockingDeque.java
0 → 100644
View file @
550e1a79
package
com
.
nostra13
.
universalimageloader
.
core
.
assist
.
deque
;
import
java.util.NoSuchElementException
;
/**
* {@link LinkedBlockingDeque} using LIFO algorithm
*
* @author Sergey Tarasevich (nostra13[at]gmail[dot]com)
* @since 1.6.3
*/
public
class
LIFOLinkedBlockingDeque
<
T
>
extends
LinkedBlockingDeque
<
T
>
{
private
static
final
long
serialVersionUID
=
-
4114786347960826192L
;
/**
* Inserts the specified element at the front of this deque if it is possible to do so immediately without violating
* capacity restrictions, returning <tt>true</tt> upon success and <tt>false</tt> if no space is currently
* available. When using a capacity-restricted deque, this method is generally preferable to the {@link #addFirst
* addFirst} method, which can fail to insert an element only by throwing an exception.
*
* @param e
* the element to add
* @throws ClassCastException
* {@inheritDoc}
* @throws NullPointerException
* if the specified element is null
* @throws IllegalArgumentException
* {@inheritDoc}
*/
@Override
public
boolean
offer
(
T
e
)
{
return
super
.
offerFirst
(
e
);
}
/**
* Retrieves and removes the first element of this deque. This method differs from {@link #pollFirst pollFirst} only
* in that it throws an exception if this deque is empty.
*
* @return the head of this deque
* @throws NoSuchElementException
* if this deque is empty
*/
@Override
public
T
remove
()
{
return
super
.
removeFirst
();
}
}
\ No newline at end of file
imageLoader/src/com/nostra13/universalimageloader/core/assist/deque/LinkedBlockingDeque.java
0 → 100644
View file @
550e1a79
This diff is collapsed.
Click to expand it.
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