Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Relocate resource loading codes of background, sliding style and back…

…ground scaling style to fix the crash when using custom header. Previous version mistakenly bound these attributes to custom header attribute.
  • Loading branch information...
commit de7494d1315c82053bef8ade431c535e4ea3d5fa 1 parent 9456d7f
@uframer authored
Showing with 36 additions and 35 deletions.
  1. +36 −35 src/me/uframer/android/ui/PanoramaView.java
View
71 src/me/uframer/android/ui/PanoramaView.java
@@ -185,41 +185,42 @@ private void initializePanoramaView(Context context, AttributeSet attrs, int def
mTitle = ta.getString(R.styleable.PanoramaView_title);
mTitleColor = ta.getColor(R.styleable.PanoramaView_titleColor, DEFAULT_TITLE_COLOR);
mTitleIcon = ta.getDrawable(R.styleable.PanoramaView_icon);
- mBackgroundDrawable = ta.getDrawable(R.styleable.PanoramaView_background);
- // slidingStyle
- String slidingStyle = ta.getString(R.styleable.PanoramaView_slidingStyle);
- if (slidingStyle == null) {
- mSlidingStyle = SlidingStyle.TOWED;
- }
- else if (slidingStyle.equals("bounded")) {
- mSlidingStyle = SlidingStyle.BOUNDED;
- }
- else if (slidingStyle.equals("towed")) {
- mSlidingStyle = SlidingStyle.TOWED;
- }
- else if (slidingStyle.equals("synced")) {
- mSlidingStyle = SlidingStyle.SYNCED;
- }
- else {
- throw new Error("invalid sliding style");
- }
- // backgroundScalingStyle
- String backgroundScalingStyle = ta.getString(R.styleable.PanoramaView_backgroundScalingStyle);
- if (backgroundScalingStyle == null) {
- mBackgroundScalingStyle = BackgroundScalingStyle.VERTICAL_STRETCH;
- }
- else if (backgroundScalingStyle.equals("none")) {
- mBackgroundScalingStyle = BackgroundScalingStyle.NONE;
- }
- else if (backgroundScalingStyle.equals("vertical_fill")) {
- mBackgroundScalingStyle = BackgroundScalingStyle.VERTICAL_FILL;
- }
- else if (backgroundScalingStyle.equals("vertical_stretch")) {
- mBackgroundScalingStyle = BackgroundScalingStyle.VERTICAL_STRETCH;
- }
- else {
- throw new Error("invalid background scaling style");
- }
+ }
+
+ mBackgroundDrawable = ta.getDrawable(R.styleable.PanoramaView_background);
+ // slidingStyle
+ String slidingStyle = ta.getString(R.styleable.PanoramaView_slidingStyle);
+ if (slidingStyle == null) {
+ mSlidingStyle = SlidingStyle.TOWED;
+ }
+ else if (slidingStyle.equals("bounded")) {
+ mSlidingStyle = SlidingStyle.BOUNDED;
+ }
+ else if (slidingStyle.equals("towed")) {
+ mSlidingStyle = SlidingStyle.TOWED;
+ }
+ else if (slidingStyle.equals("synced")) {
+ mSlidingStyle = SlidingStyle.SYNCED;
+ }
+ else {
+ throw new Error("invalid sliding style");
+ }
+ // backgroundScalingStyle
+ String backgroundScalingStyle = ta.getString(R.styleable.PanoramaView_backgroundScalingStyle);
+ if (backgroundScalingStyle == null) {
+ mBackgroundScalingStyle = BackgroundScalingStyle.VERTICAL_STRETCH;
+ }
+ else if (backgroundScalingStyle.equals("none")) {
+ mBackgroundScalingStyle = BackgroundScalingStyle.NONE;
+ }
+ else if (backgroundScalingStyle.equals("vertical_fill")) {
+ mBackgroundScalingStyle = BackgroundScalingStyle.VERTICAL_FILL;
+ }
+ else if (backgroundScalingStyle.equals("vertical_stretch")) {
+ mBackgroundScalingStyle = BackgroundScalingStyle.VERTICAL_STRETCH;
+ }
+ else {
+ throw new Error("invalid background scaling style");
}
// debug
String debug = ta.getString(R.styleable.PanoramaView_debug);
Please sign in to comment.
Something went wrong with that request. Please try again.