@Override protected void setupSettings() { this.specialList = SpecialList.getSpecialList( getIntent().getIntExtra("id", SpecialList.firstSpecial().getId()) * -1); try { new SpecialListSettings(this, this.specialList).setup(); } catch (NoSuchListException e) { finish(); } }
public static SpecialList firstSpecialSafe(final Context ctx) { SpecialList s = SpecialList.firstSpecial(); if (s == null) { s = SpecialList.newSpecialList( ctx.getString(R.string.list_all), new HashMap<String, SpecialListsBaseProperty>(), true, ctx); if (ListMirakel.count() == 0) { ListMirakel.safeFirst(ctx); } s.save(false); } return s; }
public static ListMirakel getList(Context context, int widgetId) { int listId = getSettings(context).getInt(getKey(widgetId, "list_id"), 0); ListMirakel list = ListMirakel.getList(listId); if (list == null) { list = SpecialList.firstSpecial(); if (list == null) { list = ListMirakel.first(); if (list == null) { Toast.makeText(context, "You have no Lists!", Toast.LENGTH_SHORT).show(); return null; } } } return list; }