public static void handlePreferenceAppearance(ListActivity activity) {
    PreferenceConfiguration configuration = PreferenceConfiguration.getInstance();
    boolean valid = null == configuration ? false : configuration.isPreferenceConfigurationValid();
    if (valid) {
      int style = configuration.getTitleStyle();
      if (style > 0) {
        activity.setTheme(style);
      }

      int color = configuration.getTitleColor();
      if (color != 0) {
        TextView titleView =
            (TextView) activity.getWindow().getDecorView().findViewById(android.R.id.title);
        if (null != titleView) {
          titleView.setTextColor(color);
        }
      }

      Drawable line = configuration.getSeparateLine();
      if (null != line) {
        activity.getListView().setDivider(line);
      }

      Drawable bg = configuration.getBackground();
      if (null != bg) {
        activity.getListView().setCacheColorHint(0x00000000);
        // activity.getListView().setBackgroundDrawable(bg);
        activity.getWindow().setBackgroundDrawable(bg);
      }

      // 滚动条等有图之后再看看
    }
  }
 public void refresh() {
   final SimpleCursorAdapter.ViewBinder view = new DefaultTargetViewBinder(adapter);
   final Cursor cursor = adapter.fetchByRiposteId(id.value);
   final ListView listView = activity.getListView();
   final ComponentIndex rowIndex = new ComponentIndex(R.layout.target_row);
   final TargetListMapping mapping = new TargetListMapping();
   lists.refresh(activity, cursor, listView, rowIndex, mapping, view);
 }
예제 #3
0
 /** Set the Drawable for the list selector etc. based on the current theme. */
 public static void updateListDrawables(ListActivity la, int theme) {
   ListView lv = la.getListView();
   if (Util.isLightTheme(theme)) {
     lv.setBackgroundResource(android.R.color.background_light);
     lv.setSelector(R.drawable.list_selector_blue);
   } else /* if (Common.isDarkTheme(theme)) */ {
     lv.setSelector(android.R.drawable.list_selector_background);
   }
 }
  public static <LI extends ListItem> void attach(
      @Nonnull ListActivity listActivity, @Nonnull ListItemAdapter<? extends LI> adapter) {
    listActivity.setListAdapter(adapter);

    fillListView(listActivity.getListView(), adapter, listActivity);
  }
예제 #5
0
 public EndlessListAdapter(ListActivity activity, int progressItemLayoutResId) {
   this(activity, activity.getListView(), progressItemLayoutResId);
 }