use of android.widget.SimpleAdapter in project Bitocle by mthli.
the class AddTask method onPostExecute.
@Override
protected void onPostExecute(Boolean result) {
pull.setRefreshing(false);
if (result) {
RAction action = new RAction(context);
try {
action.openDatabase(true);
} catch (SQLException s) {
SuperToast.create(fragment.getActivity(), context.getString(R.string.repo_add_failed), SuperToast.Duration.VERY_SHORT, Style.getStyle(Style.RED)).show();
return;
}
List<Repo> repos = action.listRepos();
Collections.sort(repos);
List<Map<String, String>> autoList = new ArrayList<Map<String, String>>();
list.clear();
autoList.clear();
for (Repo r : repos) {
list.add(new RepoItem(r.getName(), r.getDate(), r.getDescription(), r.getLang(), r.getStar(), r.getFork(), r.getOwner(), r.getGit()));
Map<String, String> map = new HashMap<String, String>();
map.put("owner", r.getOwner());
map.put("name", r.getName());
autoList.add(map);
}
action.closeDatabase();
SimpleAdapter autoAdapter = new SimpleAdapter(context, autoList, R.layout.auto_item, new String[] { "owner", "name" }, new int[] { R.id.auto_item_owner, R.id.auto_item_name });
autoAdapter.notifyDataSetChanged();
fragment.getSearch().setAdapter(autoAdapter);
if (list.size() <= 0) {
fragment.setContentEmpty(true);
fragment.setEmptyText(R.string.repo_empty_list);
fragment.setContentShown(true);
} else {
int position = 0;
for (RepoItem r : list) {
if (r.getGit().equals(git)) {
break;
}
position++;
}
fragment.setContentEmpty(false);
adapter.notifyDataSetChanged();
fragment.setContentShown(true);
listView.smoothScrollToPosition(position);
SuperToast.create(fragment.getActivity(), context.getString(R.string.repo_add_successful), SuperToast.Duration.VERY_SHORT, Style.getStyle(Style.BLUE)).show();
}
} else {
SuperToast.create(fragment.getActivity(), context.getString(R.string.repo_add_failed), SuperToast.Duration.VERY_SHORT, Style.getStyle(Style.RED)).show();
}
}
use of android.widget.SimpleAdapter in project Bitocle by mthli.
the class RepoTask method onPostExecute.
@Override
protected void onPostExecute(Boolean result) {
if (result) {
RAction action = new RAction(context);
try {
action.openDatabase(true);
} catch (SQLException s) {
fragment.setContentEmpty(true);
fragment.setEmptyText(R.string.repo_empty_error);
fragment.setContentShown(true);
return;
}
List<Repo> repos = action.listRepos();
Collections.sort(repos);
List<Map<String, String>> autoList = new ArrayList<Map<String, String>>();
list.clear();
autoList.clear();
for (Repo r : repos) {
list.add(new RepoItem(r.getName(), r.getDate(), r.getDescription(), r.getLang(), r.getStar(), r.getFork(), r.getOwner(), r.getGit()));
Map<String, String> map = new HashMap<String, String>();
map.put("owner", r.getOwner());
map.put("name", r.getName());
autoList.add(map);
}
action.closeDatabase();
SimpleAdapter autoAdapter = new SimpleAdapter(context, autoList, R.layout.auto_item, new String[] { "owner", "name" }, new int[] { R.id.auto_item_owner, R.id.auto_item_name });
autoAdapter.notifyDataSetChanged();
fragment.getSearch().setAdapter(autoAdapter);
if (list.size() <= 0) {
fragment.setContentEmpty(true);
fragment.setEmptyText(R.string.repo_empty_list);
fragment.setContentShown(true);
} else {
fragment.setContentEmpty(false);
adapter.notifyDataSetChanged();
fragment.setContentShown(true);
}
if (flag == Flag.REPO_REFRESH) {
SuperToast.create(context, context.getString(R.string.repo_refresh_successful), SuperToast.Duration.VERY_SHORT, Style.getStyle(Style.BLUE)).show();
}
} else {
fragment.setContentEmpty(true);
fragment.setEmptyText(R.string.repo_empty_error);
fragment.setContentShown(true);
}
}
use of android.widget.SimpleAdapter in project ActionBarSherlock by JakeWharton.
the class SampleList method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Intent intent = getIntent();
String path = intent.getStringExtra("com.example.android.apis.Path");
if (path == null) {
path = "";
}
setListAdapter(new SimpleAdapter(this, getData(path), android.R.layout.simple_list_item_1, new String[] { "title" }, new int[] { android.R.id.text1 }));
getListView().setTextFilterEnabled(true);
}
use of android.widget.SimpleAdapter in project ActionBarSherlock by JakeWharton.
the class SampleList method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Intent intent = getIntent();
String path = intent.getStringExtra("com.example.android.apis.Path");
if (path == null) {
path = "";
}
setListAdapter(new SimpleAdapter(this, getData(path), android.R.layout.simple_list_item_1, new String[] { "title" }, new int[] { android.R.id.text1 }));
getListView().setTextFilterEnabled(true);
}
use of android.widget.SimpleAdapter in project android_frameworks_base by DirtyUnicorns.
the class BiDiTestActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
mList = (ListView) findViewById(R.id.testlist);
mList.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
mList.setFocusableInTouchMode(true);
final SimpleAdapter adapter = new SimpleAdapter(this, getTests(), R.layout.custom_list_item, new String[] { "title" }, new int[] { android.R.id.text1 });
mList.setAdapter(adapter);
mList.setOnItemClickListener(mOnClickListener);
}
Aggregations