[android-developers] How to observe a cursor

2013-07-16 Thread Wyler Yerrachione
I'm not clear on how a custom view implementation can observe changes to an 
adapter, and I'm having trouble finding an example.  I understand how to do 
this with a ListView, etc, but how to do it with my own custom scroll view 
???

-- 
-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Android Developers group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [android-developers] setLayoutParams stops working

2013-07-03 Thread Wyler Yerrachione
right, so using an animation is another approach I have notes about.  The 
idea there is to use a Scroller to perform callback animating for the 
various changes that are needed as the scroll happens, right?

The things is, it's not like I have any issues with the current approach, 
except that the values for the layout params get stuck.  And I do need the 
layoutparams to change anyway, since the horizontal linear layout needs to 
adjust based on the changing sizes of the items.  So wouldn't I just be 
setting layout params in your approach as well, so would I have any 
expectation of this same flaky behavior not showing up?

-- 
-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Android Developers group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[android-developers] setLayoutParams stops working

2013-07-01 Thread Wyler Yerrachione
I'm using setLayoutParams on some images in a HorizontalScrollView to 
change their size as they scroll past.   This seems to work fine, until I 
hit one of the boundaries, then all the imageViews stop responding to 
setLayoutParams.  They are locked in at their last size.  Monitoring my 
code, I can absolutely see that there are no errors being thrown and that 
setLayoutParams is definitely being called with changing values, just like 
before they got locked in.   The UI, which continuing to scroll, is just 
refusing to update my layout params on this ImageView now.

Very frustrating..  Any ideas what's going on here?


  int iWidth = (int) (scale * 108 * getResources().getDisplayMetrics().
density);

 int iHeight = (int) (scale * 56 * getResources().getDisplayMetrics().
density);

   if(r == R.id.imageView5){

  //Log.v(LOCATION, String.valueOf(imageViewCenter) );

  //Log.v(OFFSET, String.valueOf(offset));

  //Log.v(RATIO, String.valueOf(ratio));

  //Log.v(SCALE, String.valueOf(scale));

  Log.v(DIMS, String.valueOf(iWidth) + : + String.valueOf(iHeight) );

 }

   LinearLayout.LayoutParams layoutParams = 
(android.widget.LinearLayout.LayoutParams) iv.getLayoutParams();

 layoutParams.height = iHeight;

 layoutParams.width = iWidth;

 iv.setLayoutParams(layoutParams);

-- 
-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Android Developers group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[android-developers] Re: setLayoutParams stops working

2013-07-01 Thread Wyler Yerrachione
Full relevant code:

@Override

protected void onScrollChanged(int l, int t, int oldl, int oldt) {

 super.onScrollChanged(l, t, oldl, oldt);

 //Log.v(SCROLL, String.valueOf(l));


 adjustImageSizes();

  }

 private void adjustImageSizes(){

  int width = getWidth();

 int[] views =  { R.id.imageView1, R.id.imageView2, R.id.imageView3, R.id.
imageView4, R.id.imageView5 };

 for(int r : views){

 ImageView iv = (ImageView) findViewById(r);

 int[] location = new int[2];

 iv.getLocationOnScreen(location);


  int imageViewCenter = location[0] + 108 / 2; // This can be calculated 
for each imageView that is on screen

   if(imageViewCenter  0){

  imageViewCenter = 0;

 }

 if(imageViewCenter  width){

  imageViewCenter = width;

 }


  int scrollerCenter = (getWidth() - getPaddingLeft() - getPaddingRight()) 
/ 2 + getPaddingLeft();

 float offset = Math.abs(scrollerCenter - imageViewCenter);


  float ratio = ( offset / ( width / 2)  );


  // Scale the size.

 float scale = .5f + (1.0f - ratio) / 2;

 if (scale = 0) {

  scale = 0.1f;

 }

   int iWidth = (int) (scale * 108 * getResources().getDisplayMetrics().
density);

 int iHeight = (int) (scale * 56 * getResources().getDisplayMetrics().
density);

   if(r == R.id.imageView5){

  //Log.v(LOCATION, String.valueOf(imageViewCenter) );

  //Log.v(OFFSET, String.valueOf(offset));

  //Log.v(RATIO, String.valueOf(ratio));

  //Log.v(SCALE, String.valueOf(scale));

  Log.v(DIMS, String.valueOf(iWidth) + : + String.valueOf(iHeight) );

 }

   LinearLayout.LayoutParams layoutParams = 
(android.widget.LinearLayout.LayoutParams) iv.getLayoutParams();

 layoutParams.height = iHeight;

 layoutParams.width = iWidth;

 iv.setLayoutParams(layoutParams);

 //iv.getLayoutParams().height = iHeight;

 //iv.getLayoutParams().width = iWidth;

 }

}

-- 
-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Android Developers group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[android-developers] Custom album scroller for Android

2013-06-18 Thread Wyler Yerrachione
Greetings!  I'm trying to implement something like the 'music album 
scroller' interface in iTunes, but on an Android device.  I've attached an 
image that describes the interface I'm looking for.  Has anyone see an open 
source implementation of something similar, or what would an ideal approach 
/ pattern look like for this?

https://lh4.googleusercontent.com/-BVqwsN6WAqc/UcDjCnNRGeI/ADc/CXXYtr7JsSA/s1600/Screen+Shot+2013-06-18+at+3.42.43+PM.png

-- 
-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Android Developers group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.