use of android.widget.BaseAdapter in project chefly_android by chef-ly.
the class ListViewFragment method setList.
public void setList(RecipeList newList, boolean goToTop) {
list.clear();
for (RecipeInformation r : newList) {
list.add(r);
}
((BaseAdapter) listView.getAdapter()).notifyDataSetChanged();
if (goToTop) {
listView.setSelectionAfterHeaderView();
}
}
use of android.widget.BaseAdapter in project chefly_android by chef-ly.
the class ListViewFragment method removeFavorite.
public void removeFavorite(RecipeInformation r) {
int index = list.indexOf(r);
if (index > 0) {
list.get(index).setFavorite(false);
} else {
Log.d(TAG + "/" + title, "Remove Favorite index -> " + index);
for (RecipeInformation rec : list) {
Log.d(TAG + "/" + title, "ID -> " + rec.getId());
}
}
((BaseAdapter) listView.getAdapter()).notifyDataSetChanged();
}
use of android.widget.BaseAdapter in project android_frameworks_base by crdroidandroid.
the class AppWidgetHostView method viewDataChanged.
/**
* Process data-changed notifications for the specified view in the specified
* set of {@link RemoteViews} views.
*/
void viewDataChanged(int viewId) {
View v = findViewById(viewId);
if ((v != null) && (v instanceof AdapterView<?>)) {
AdapterView<?> adapterView = (AdapterView<?>) v;
Adapter adapter = adapterView.getAdapter();
if (adapter instanceof BaseAdapter) {
BaseAdapter baseAdapter = (BaseAdapter) adapter;
baseAdapter.notifyDataSetChanged();
} else if (adapter == null && adapterView instanceof RemoteAdapterConnectionCallback) {
// If the adapter is null, it may mean that the RemoteViewsAapter has not yet
// connected to its associated service, and hence the adapter hasn't been set.
// In this case, we need to defer the notify call until it has been set.
((RemoteAdapterConnectionCallback) adapterView).deferNotifyDataSetChanged();
}
}
}
use of android.widget.BaseAdapter in project MadMax by deviz92.
the class GroupExpensesActivity method onCreate.
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// setContentView(R.layout.activity_group_expenses);
final String IDGroup;
Intent intent = getIntent();
// if starting activity from itself (adding a new expense)
if (intent.getBooleanExtra("addExpenseToGroup", true)) {
IDGroup = intent.getStringExtra("IDGroup");
String description = intent.getStringExtra("description");
String amount = intent.getStringExtra("amount");
String currency = intent.getStringExtra("currency");
// expenses.put(String.valueOf(i), new Expense(String.valueOf(i), description + " " + currency + " " + amount, (double) i+1));
Group group = MainActivity.getCurrentUser().getUserGroups().get(IDGroup);
expenses = group.getExpenses();
// todo a cosa serve questa expense?? quale utente la fa?
/*Expense e = new Expense(
String.valueOf(expenses.size()), description, null, Double.valueOf(amount),
currency, String.valueOf(R.drawable.expense6), "urlBill", false, group.getID(), null, false
);*/
// save the new expense
// expenses.put(String.valueOf(expenses.size()), e);
// GroupsActivity.users.get(0).addExpense(e);
// GroupsActivity.myself.addExpense(e);
// todo mettere addExpenseFirebase
} else // if starting activity from GroupActivity (tapping on a group for showing details)
{
IDGroup = intent.getStringExtra("IDGroup");
Group group = MainActivity.getCurrentUser().getUserGroups().get(IDGroup);
expenses = group.getExpenses();
}
// then show group expenses list
// todo getting IDGroup from the intent from GroupsActivity
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(GroupExpensesActivity.this, NewExpenseActivity.class);
intent.putExtra("IDGroup", IDGroup);
intent.putExtra("callingActivity", "GroupExpensesActivity");
intent.putExtra("newPending", false);
GroupExpensesActivity.this.startActivity(intent);
finish();
GroupExpensesActivity.this.startActivity(intent);
/*Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();*/
}
});
/* //Button to go to group info
Button groupInfoButton = (Button) findViewById(R.id.infobutton);
groupInfoButton.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View view) {
Context context = GroupExpensesActivity.this;
Class destinationActivity = GroupInfoActivity.class;
Intent intent = new Intent(context, destinationActivity);
intent.putExtra("groupID", IDGroup);
intent.putExtra("caller", "GroupExpensesActivity");
startActivity(intent);
}
});*/
// todo when we'll use Firebase -> retrieve expenses HashMap with IDGroup received from GroupsActivity
ListView lv = (ListView) findViewById(R.id.expenses);
// for putting data inside the list view I need an adapter
BaseAdapter a = new BaseAdapter() {
@Override
public int getCount() {
return expenses.size();
}
@Override
public Object getItem(int position) {
return expenses.get(String.valueOf(position));
}
// not changed
@Override
public long getItemId(int position) {
return 0;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
// if it's the first time I create the view
if (convertView == null) {
// LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
LayoutInflater inflater = LayoutInflater.from(GroupExpensesActivity.this);
// last parameter is very important: for now we don't want to attach our view to the parent view
convertView = inflater.inflate(R.layout.list_item, parent, false);
}
Expense expense = expenses.get(String.valueOf(position));
ImageView photo = (ImageView) convertView.findViewById(R.id.img_photo);
TextView description = (TextView) convertView.findViewById(R.id.tv_sender);
TextView amount = (TextView) convertView.findViewById(R.id.tv_balance);
if (expense.getExpensePhoto() != null)
photo.setImageResource(Integer.parseInt(expense.getExpensePhoto()));
description.setText(expense.getDescription());
String amountString = expense.getAmount() + " " + expense.getCurrency();
amount.setText(amountString);
return convertView;
}
};
lv.setAdapter(a);
}
use of android.widget.BaseAdapter in project xabber-android by redsolution.
the class PreferencesFragment method onResume.
@Override
public void onResume() {
super.onResume();
BaseAdapter adapter = (BaseAdapter) getPreferenceScreen().getRootAdapter();
adapter.notifyDataSetChanged();
PreferenceManager.getDefaultSharedPreferences(getActivity()).registerOnSharedPreferenceChangeListener(this);
}
Aggregations