python748 / alternate-java-bridge-library

Automatically exported from code.google.com/p/alternate-java-bridge-library
Apache License 2.0
0 stars 0 forks source link

LOW PRIORITY - Access to ListPickerActivity onCreate method #152

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
This started because I wanted to adjust the title in the listpicker activity 
listview (the actionbar title) and had no direct access to listpickeractivity 
in the bridge.  So as a work around, i had to copy both listpicker, and 
listpickeractivity, to my own library and modify them.  This is an easy enough 
work around, but presents a problem if either of those classes are ever changed 
in the bridge. 

A more elegant, and flexible approach, would be

1.  Access to a method in ListPickerActivity to setActionbarProperties
and/or
2.  Direct access to the onCreate method in ListPickerActivity.  This would 
give us a chance to make a number of adjustments.  (Pre and Post UI Load 
methods would work well enough too) if you want to protect onCreate.

Original issue reported on code.google.com by bric...@gmail.com on 7 May 2013 at 4:49

GoogleCodeExporter commented 8 years ago
After playing with this more.  It seems the problem with extending the 
ListPickerActivity class and simply overriding onCreate, is that there is 
another reference in the class to itself, that we can't change.  in the get 
View method, there is a line,               

draw = MediaUtil.getDrawable(ListPickerActivity.this, item.ImageFile());

that references its on class name.  I ignored this and was able to extend the 
class, but i am unfamiliar with how this line affects that.

in the end, it seems there are a few methods that if added to the ListPick 
class would be useful for anyone moving forward, even if you are doing a custom 
listview.  From what I can see those methods are.  These seem like they would 
be difficult to implement in the bridge (maybe not?, i cant figure it out), but 
would be extremely useful and easy to use once implemented.

ListPick.setActionBarTitle(String title){
}

ListPick.setActionBarSubTitle(String subTitle){
}

ListPick.addMenuXML(R.id.menu_layout.xml) {
    //This method will allow you to set the menu layout to be used with this
    //listpick (for actionBar purposes, lots of uses, besides actionbuttons, also
    //search)
}

ListPick.handleMenuSelection() {
     //We need a method for handling what to do when an actionBar item is clicked
    //i.e. the onMenuItemSelected method
     //Not sure the best way to implement this
}

Original comment by bric...@gmail.com on 8 May 2013 at 3:57