示例#1
0
 @Override
 public void setShowDetails(boolean showDetails) {
   // TODO CHANGE THIS!!! (was just a quick fix)
   if (adapter != null) {
     adapter.setShowDetails(showDetails);
     adapter.notifyDataSetChanged();
   }
 }
示例#2
0
  @Override
  public void onLookChecked() {
    if (isRenameActionMode || actionMode == null) {
      return;
    }

    int numberOfSelectedItems = adapter.getAmountOfCheckedItems();

    if (numberOfSelectedItems == 0) {
      actionMode.setTitle(actionModeTitle);
    } else {
      String appendix = multipleItemAppendixActionMode;

      if (numberOfSelectedItems == 1) {
        appendix = singleItemAppendixActionMode;
      }

      String numberOfItems = Integer.toString(numberOfSelectedItems);
      String completeTitle = actionModeTitle + " " + numberOfItems + " " + appendix;

      int titleLength = actionModeTitle.length();

      Spannable completeSpannedTitle = new SpannableString(completeTitle);
      completeSpannedTitle.setSpan(
          new ForegroundColorSpan(getResources().getColor(R.color.actionbar_title_color)),
          titleLength + 1,
          titleLength + (1 + numberOfItems.length()),
          Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);

      actionMode.setTitle(completeSpannedTitle);
    }
  }
示例#3
0
  @Override
  public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    listView = getListView();
    registerForContextMenu(listView);

    if (savedInstanceState != null) {
      selectedLookData =
          (LookData) savedInstanceState.getSerializable(BUNDLE_ARGUMENTS_SELECTED_LOOK);

      boolean uriIsSet = savedInstanceState.getBoolean(BUNDLE_ARGUMENTS_URI_IS_SET);
      if (uriIsSet) {
        String defLookName = getString(R.string.default_look_name);
        lookFromCameraUri = UtilCamera.getDefaultLookFromCameraUri(defLookName);
      }
    }
    lookDataList = ProjectManager.INSTANCE.getCurrentSprite().getLookDataList();

    adapter =
        new LookAdapter(getActivity(), R.layout.fragment_look_looklist_item, lookDataList, false);
    adapter.setOnLookEditListener(this);
    setListAdapter(adapter);

    Utils.loadProjectIfNeeded(getActivity());
  }
示例#4
0
        @Override
        public void onDestroyActionMode(ActionMode mode) {
          Set<Integer> checkedLooks = adapter.getCheckedItems();
          Iterator<Integer> iterator = checkedLooks.iterator();

          while (iterator.hasNext()) {
            int position = iterator.next();
            sendPocketPaintIntent(position);
          }
          setSelectMode(ListView.CHOICE_MODE_NONE);
          adapter.clearCheckedItems();

          actionMode = null;
          setActionModeActive(false);

          registerForContextMenu(listView);
          BottomBar.enableButtons(getActivity());
        }
示例#5
0
 @Override
 public boolean getShowDetails() {
   // TODO CHANGE THIS!!! (was just a quick fix)
   if (adapter != null) {
     return adapter.getShowDetails();
   } else {
     return false;
   }
 }
示例#6
0
        @Override
        public void onDestroyActionMode(ActionMode mode) {
          Set<Integer> checkedLooks = adapter.getCheckedItems();
          Iterator<Integer> iterator = checkedLooks.iterator();

          if (iterator.hasNext()) {
            int position = iterator.next();
            selectedLookData = (LookData) listView.getItemAtPosition(position);
            showRenameDialog();
          }
          setSelectMode(ListView.CHOICE_MODE_NONE);
          adapter.clearCheckedItems();

          actionMode = null;
          setActionModeActive(false);

          registerForContextMenu(listView);
          BottomBar.enableButtons(getActivity());
        }
示例#7
0
  @Override
  public void onCreateContextMenu(ContextMenu menu, View view, ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, view, menuInfo);

    selectedLookData = adapter.getItem(selectedLookPosition);
    menu.setHeaderTitle(selectedLookData.getLookName());

    getSherlockActivity().getMenuInflater().inflate(R.menu.context_menu_default, menu);
    menu.findItem(R.id.context_edit_in_pocket_paint).setVisible(true);
  }
示例#8
0
  private void updateLookAdapter(String name, String fileName) {
    name = Utils.getUniqueLookName(name);

    LookData lookData = new LookData();
    lookData.setLookFilename(fileName);
    lookData.setLookName(name);
    lookDataList.add(lookData);

    adapter.notifyDataSetChanged();

    if (lookDataListChangedAfterNewListener != null) {
      lookDataListChangedAfterNewListener.onLookDataListChangedAfterNew(lookData);
    }

    // scroll down the list to the new item:
    final ListView listView = getListView();
    listView.post(
        new Runnable() {
          @Override
          public void run() {
            listView.setSelection(listView.getCount() - 1);
          }
        });
  }
示例#9
0
 @Override
 public int getSelectMode() {
   return adapter.getSelectMode();
 }
示例#10
0
 @Override
 public void setSelectMode(int selectMode) {
   adapter.setSelectMode(selectMode);
   adapter.notifyDataSetChanged();
 }