/** * Displays a 'List' of 'Demo Beans' */ private void showList(ListActivity listApp) { //Reads the synchronized/locally stored demo beans from the 'offlineapp_demochannel' channel on the device MobileBean[] demoBeans = MobileBean.readAll("offlineapp_demochannel"); //Shows these beans in a List if(demoBeans != null && demoBeans.length >0) { String[] ui = new String[demoBeans.length]; for(int i=0,size=ui.length;i<size;i++) { ui[i] = demoBeans[i].getValue("demoString"); } listApp.setListAdapter(new ArrayAdapter(listApp, android.R.layout.simple_list_item_1, ui)); //List Listener ListItemClickListener clickListener = new ClickListener(demoBeans); NavigationContext.getInstance().addClickListener(clickListener); } }
/** * <p>Constructor: Instantiate a new adapter.</p> * @param parent ListActivity - associated list view * @param cur Cursor - associate managed database query */ public AssignmentAdapter (ListActivity parent, Cursor cur) { super ( parent, R.layout.list_item, cur, // columns for item display new String[] { Repository.NumberCode.NUMBER, Repository.NumberCode.NAME, Repository.NumberCode.CODE }, // associated view elements (identifiers) new int[] { R.id.txt_number, R.id.txt_name, R.id.txt_code } ); }
void checkActivity() { Context context = adapterView.getContext(); if (context instanceof ListActivity) { throw new RuntimeException("ListView cannot belong to an activity which subclasses ListActivity"); } if (context instanceof SherlockActivity || context instanceof SherlockFragmentActivity || context instanceof SherlockPreferenceActivity) { return; } throw new RuntimeException("ListView must belong to an activity which subclasses SherlockActivity"); }
@Override /** * Invoked by the MVC runtime once the screen is rendered. This callback allows the screen setup the business state of the screen * and update the UI to show this information */ public void postRender() { //Gets the currently active 'Activity' instance ListActivity listApp = (ListActivity)Services.getInstance().getCurrentActivity(); //Gets the 'Cloud' configuration AppResources res = Services.getInstance().getResources(); Configuration configuration = Configuration.getInstance(listApp); //Check to see if the 'Demo Beans' are synchronized from the 'Cloud'. If not, a 'Boot Sync' is issued. if(configuration.isActive() && !MobileBean.isBooted("offlineapp_demochannel")) { //Boots up the 'Demo Bean' sync channel CommandContext commandContext = new CommandContext(); commandContext.setTarget("/channel/bootup/helper"); Services.getInstance().getCommandService().execute(commandContext); return; } //Show the List of "Demo Beans" synchronized from the 'Cloud'. this.showList(listApp); //Setup the App Menu this.setMenuItems(); }
public static SubjectFactory<ListActivitySubject, ListActivity> type() { return new SubjectFactory<ListActivitySubject, ListActivity>() { @Override public ListActivitySubject getSubject(FailureStrategy fs, ListActivity that) { return new ListActivitySubject(fs, that); } }; }
@Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { DataItem item = (DataItem) mListView.getItemAtPosition(position); // if navigation is supported, open the next activity if (item.getNavigationInfo() != DataSource.NO_NAVIGATION) { Intent intent = new Intent(this, ListActivity.class); intent.putExtra(TYPE, item.getNavigationInfo()); startActivity(intent); } }
/** * * @param activity * {@link ListActivity} that uses this CursorAdapter * @param uri * {@link Uri} of the {@link Location}s to be displayed */ public LocationCursorAdapter(ListActivity activity, Uri uri) { super(activity, R.layout.list_row, activity.managedQuery(uri, null, null, null, null), new String[]{RedpinContract.Location.SYMBOLIC_ID}, new int[]{R.id.list_row_label}); this.activity = activity; this.uri = uri; setStringConversionColumn(getCursor().getColumnIndex( RedpinContract.Location.SYMBOLIC_ID)); }
/** * * @param activity * {@link ListActivity} that uses this CursorAdapter * @param uri * {@link Uri} of the {@link Map}s to be displayed */ public MapCursorAdapter(ListActivity activity, Uri uri) { super(activity, R.layout.list_row, activity.managedQuery(uri, null, null, null, null), new String[]{RedpinContract.Map.NAME}, new int[]{R.id.list_row_label}); this.activity = activity; this.uri = uri; setStringConversionColumn(getCursor().getColumnIndex( RedpinContract.Map.NAME)); }
public static void onListItemClick( ListActivity activity, ListView l, View v, int position, long id) { try { Method m = ListActivity.class.getDeclaredMethod("onListItemClick", new Class[]{ListView.class, View.class, int.class, long.class}); m.setAccessible(true); m.invoke(activity, new Object[]{new Object[]{l, v, position, id}}); } catch (Exception e) { e.printStackTrace(); throw new RuntimeException("error in onListItemClick", e); } }
public GradeListAdapter(ListActivity context, List<Note> list) { super(context, list, R.layout.grade_list_item); mGradeColors = new int[] { getResources().getColor(R.color.grade_1), getResources().getColor(R.color.grade_2), getResources().getColor(R.color.grade_3), getResources().getColor(R.color.grade_4), getResources().getColor(R.color.grade_5) }; }
private void ensureActivity() { final Context context = adapterView.getContext(); if (context instanceof ListActivity) { throw new RuntimeException("ListView cannot belong to an activity which subclasses ListActivity"); } if (context instanceof ActionBarActivity) { return; } throw new RuntimeException("ListView must belong to an activity which subclasses SherlockActivity"); }
public void test_basic() { Router router = new Router(); router.map("users/:user_id", ListActivity.class); Intent intent = router.intentFor("users/4"); Assert.assertEquals("4", intent.getExtras().getString("user_id")); }
public void test_empty() { Router router = new Router(); router.map("users", ListActivity.class); Intent intent = router.intentFor("users"); Assert.assertNull(intent.getExtras()); }
public void test_url_starting_with_slash() { Router router = new Router(); router.map("/users", ListActivity.class); Intent intent = router.intentFor("/users"); Assert.assertNull(intent.getExtras()); }
public void test_url_querystring() { Router router = new Router(); router.map("/users/:id", ListActivity.class); Intent intent = router.intentFor("/users/123?key1=val2"); Bundle extras = intent.getExtras(); Assert.assertEquals("123", extras.getString("id")); Assert.assertEquals("val2", extras.getString("key1")); }
public void test_url_containing_spaces() { Router router = new Router(); router.map("/path+entry/:id", ListActivity.class); Intent intent = router.intentFor("/path+entry/123"); Bundle extras = intent.getExtras(); Assert.assertEquals("123", extras.getString("id")); }
public void test_url_querystring_with_encoded_value() { Router router = new Router(); router.map("/users/:id", ListActivity.class); Intent intent = router.intentFor("/users/123?key1=val+1&key2=val%202"); Bundle extras = intent.getExtras(); Assert.assertEquals("val 1", extras.getString("key1")); Assert.assertEquals("val 2", extras.getString("key2")); }
public void test_url_querystring_without_value() { Router router = new Router(); router.map("/users/:id", ListActivity.class); Intent intent = router.intentFor("/users/123?val1"); Bundle extras = intent.getExtras(); Assert.assertTrue(extras.containsKey("val1")); }
public void test_url_starting_with_slash_with_params() { Router router = new Router(); router.map("/users/:user_id", ListActivity.class); Intent intent = router.intentFor("/users/4"); Assert.assertEquals("4", intent.getExtras().getString("user_id")); }
void setListAdapter(ListAdapter adapter) { if (host instanceof ListActivity) { ((ListActivity)host).setListAdapter(adapter); } else { lv.setAdapter(adapter); } }
public TimesArrayAdapter(ListActivity context, int layout, boolean ampm, ArrayList<String[]> details) { super(context, layout, details); // Log.v(TAG, "TimesArrayAdapter()"); mDetails = details; mInflater = LayoutInflater.from(context); mLayout = layout; ampmflag = ampm; }
public ListArrayAdapter(ListActivity context, int layout, boolean ampm, ArrayList<String[]> details) { super(context, layout, details); // Log.v(TAG, "TimesArrayAdapter()"); mDetails = details; mInflater = LayoutInflater.from(context); mLayout = layout; ampmflag = ampm; }
public void setScaleFactor(String aNewStringVal) { BitsThumbnailUtils.mThumbnailFilePrefix = BitsThumbnailUtils.DEFAULT_THUMBNAIL_FILE_PREFIX+aNewStringVal; int theNewValue = (aNewStringVal!=null)?Integer.parseInt(aNewStringVal):scaleFactor; if (scaleFactor!=theNewValue) { boolean saveEnabled = isEnabled(); setEnabled(false); emptyRecycleBin(); setEnabled(saveEnabled); scaleFactor = theNewValue; if (mAct instanceof ListActivity) ((ListActivity)mAct).getListView().invalidateViews(); } }
/** * * @param activity * {@link ListActivity} that uses this CursorAdapter * @param uri * {@link Uri} of the {@link Location}s to be displayed */ public LocationCursorAdapter(ListActivity activity, Uri uri) { super(activity, R.layout.list_row, activity.managedQuery(uri, null, null, null, null), new String[] { RedpinContract.Location.SYMBOLIC_ID }, new int[] { R.id.list_row_label }); this.activity = activity; this.uri = uri; setStringConversionColumn(getCursor().getColumnIndex( RedpinContract.Location.SYMBOLIC_ID)); }
/** * * @param activity * {@link ListActivity} that uses this CursorAdapter * @param uri * {@link Uri} of the {@link Map}s to be displayed */ public MapCursorAdapter(ListActivity activity, Uri uri) { super(activity, R.layout.list_row, activity.managedQuery(uri, null, null, null, null), new String[] { RedpinContract.Map.NAME }, new int[] { R.id.list_row_label }); this.activity = activity; this.uri = uri; setStringConversionColumn(getCursor().getColumnIndex( RedpinContract.Map.NAME)); }
/** * Loading of all necessary objects: activity and user list. Getting the * inflater. */ public LazyAdapter(ListActivity activity, ArrayList<String> names) { super(); this.activity = activity; this.names = names; this.folks = new FbUser[this.names.size()]; layoutInflater = (LayoutInflater) activity .getSystemService(Context.LAYOUT_INFLATER_SERVICE); new FetchDataTask(this, 0).execute(new Void[]{}); }
LoadPackagesAsyncTask(ListActivity activity) { this.activity = activity; }
public void postRender() { //render the list ListActivity listApp = (ListActivity)Services.getInstance().getCurrentActivity(); final Configuration conf = Configuration.getInstance(listApp); AppResources appResources = Services.getInstance().getResources(); listApp.setTitle("Sync"); final String[] adapterArray; List<String> myChannels = conf.getMyChannels(); final boolean channelsFound; if(myChannels != null && !myChannels.isEmpty()) { channelsFound = true; adapterArray = myChannels.toArray(new String[0]); listApp.setListAdapter(new ArrayAdapter(listApp, android.R.layout.simple_list_item_1, adapterArray)); } else { channelsFound = false; adapterArray = new String[]{"There aren't any registered channels for synchronization"}; listApp.setListAdapter(new ArrayAdapter(listApp, android.R.layout.simple_list_item_1, adapterArray)); } //Setup Menu this.setupMenu(); //Add a List click listener ListItemClickListener clickListener = new ListItemClickListener() { public void onClick(ListItemClickEvent clickEvent) { if(!channelsFound) { Services.getInstance().getNavigationContext().back(); return; } //Perform channel-oriented functions ManualSyncScreen.this.startChannelSelect(adapterArray[clickEvent.getPosition()]); } }; NavigationContext.getInstance().addClickListener(clickListener); }
protected ListActivitySubject(FailureStrategy failureStrategy, ListActivity subject) { super(failureStrategy, subject); }
MapListView(ListActivity activity) { m_activity = activity; initMapEngine(); }