本文整理汇总了Java中com.firebase.ui.database.FirebaseListAdapter类的典型用法代码示例。如果您正苦于以下问题:Java FirebaseListAdapter类的具体用法?Java FirebaseListAdapter怎么用?Java FirebaseListAdapter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FirebaseListAdapter类属于com.firebase.ui.database包,在下文中一共展示了FirebaseListAdapter类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: onCreate
import com.firebase.ui.database.FirebaseListAdapter; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.list_view);
game_id = getIntent().getLongExtra(PARENT_ID, 0);
metric_category = getIntent().getIntExtra(METRIC_CATEGORY_EXTRA, MetricHelper.MATCH_PERF_METRICS);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
databaseReference = FirebaseUtil.getFirebaseDatabase().getReference().child("match_perf");
FirebaseListOptions<MetricImportModel> options = new FirebaseListOptions.Builder<MetricImportModel>()
.setQuery(databaseReference, MetricImportModel.class)
.setLayout(R.layout.list_item_metrics_import)
.build();
adapter = new FirebaseListAdapter<MetricImportModel>(options) {
@Override
protected void populateView(View v, MetricImportModel model, int position) {
((TextView) v.findViewById(android.R.id.text1)).setText(model.name);
((TextView) v.findViewById(android.R.id.text2)).setText(model.description);
}
};
mListView = (ListView) findViewById(R.id.list);
mListView.setAdapter(adapter);
mListView.setOnItemClickListener(this);
}
开发者ID:frc2052,项目名称:FRC-Krawler,代码行数:27,代码来源:ImportMetricsActivity.java
示例2: populateSimilarPlantsList
import com.firebase.ui.database.FirebaseListAdapter; //导入依赖的package包/类
private void populateSimilarPlantsList(final ListView list) {
DatabaseReference databaseRef = getDatabaseManager().getGroupPlantsReference(mGroup);
FirebaseListAdapter<String> adapter = new FirebaseListAdapter<String>(getActivity(), String.class, R.layout.list_item_text_button, databaseRef) {
/**
* Show images in glide
* @param view - the current view
* @param plant - the plant to display
* @param position - the position in the menu
*/
@Override
protected void populateView(final View view, final String plant, final int position) {
if (!plant.equals(mSpecies)) {
((TextView) view.findViewById(R.id.text)).setText(plant);
Button addPlantButton = view.findViewById(R.id.button);
addPlantButton.setText(R.string.add_plant);
addPlantButton.setOnClickListener(new View.OnClickListener() {
/**
* User clicked buy now
* @param v - current view
*/
@Override
public void onClick(View v) {
Intent addIntent = new Intent(getActivity(), NewPlantActivity.class);
addIntent.putExtra("species", plant);
getActivity().startActivity(addIntent);
}
});
}
}
};
list.setAdapter(adapter);
}
开发者ID:iskandergaba,项目名称:Botanist,代码行数:33,代码来源:SimilarPlantsController.java
示例3: onCreate
import com.firebase.ui.database.FirebaseListAdapter; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ButterKnife.bind(this);
setSupportActionBar(toolbar);
if (CheckLoginActivity.user != null) {
// User is signed in
emailTextView.setText(CheckLoginActivity.user.getEmail());
nameTextView.setText(CheckLoginActivity.user.getDisplayName());
} else {
finish();
}
FirebaseDatabase database = FirebaseDatabase.getInstance();
DatabaseReference dbRef = database.getReference(CheckLoginActivity.user.getUid()).child(FirebaseContract.CATEGORY_CHILD);
listView = (ListView) findViewById(R.id.categorysDrawerListView);
mainFragment = new MainFragment();
FragmentTransaction ft = getFragmentManager().beginTransaction();
ft.add(R.id.mainFragment, mainFragment);
ft.commit();
categoryAdapter = new FirebaseListAdapter<Category>(this, Category.class, R.layout.category_drawer_item, dbRef) {
@Override
protected void populateView(View v, final Category model, final int position) {
((TextView)v.findViewById(R.id.categoryNameTextView)).setText(model.getName());
v.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
showNotes(model);
}
});
}
};
listView.setAdapter(categoryAdapter);
View header = getLayoutInflater().inflate(R.layout.category_listview_header, null);
listView.addHeaderView(header);
header.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent it = new Intent(getBaseContext(), CategoryActivity.class);
startActivity(it);
}
});
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
drawer.setDrawerListener(toggle);
toggle.syncState();
}
开发者ID:feliperce,项目名称:MyNotes,代码行数:61,代码来源:MainActivity.java
示例4: onActivityCreated
import com.firebase.ui.database.FirebaseListAdapter; //导入依赖的package包/类
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
// if(auth.getCurrentUser()!=null){
// currentUserId = auth.getCurrentUser().getUid();
// }
// ref = Utils.getDatabase().getReference().child("/Guild");
if(auth.getCurrentUser()!=null){
currentUserId = auth.getCurrentUser().getUid();
}
ref = Utils.getDatabase().getReference().child("/users/"+"1qZQ4BDwsJf82bD6fA8C9wY9uNd2"+"/profile/taskList");
final FirebaseListAdapter<Task> mAdapter = new FirebaseListAdapter<Task>(getActivity(), Task.class, android.R.layout.two_line_list_item, ref) {
@Override
protected void populateView(View view, Task chatMessage, int position) {
((TextView) view.findViewById(android.R.id.text1)).setText(chatMessage.getName());
((TextView) view.findViewById(android.R.id.text2)).setText(chatMessage.getDescription());
//this
}
};
taskRecyclerView.setAdapter(mAdapter);
}
开发者ID:mohseenrm,项目名称:LevelUpAndroid,代码行数:30,代码来源:Tab4_Activity.java
示例5: populateDiseasesList
import com.firebase.ui.database.FirebaseListAdapter; //导入依赖的package包/类
/**
* Populate plant diseases list
*/
private void populateDiseasesList(final ListView list) {
DatabaseReference databaseRef = getDatabaseManager().getGroupDiseasesReference(mGroup);
FirebaseListAdapter<String> listAdapter = new FirebaseListAdapter<String>(getActivity(), String.class, R.layout.list_item_text_button, databaseRef) {
String diseaseUrl;
/**
* Show images in glide
* @param view - the current view
* @param disease - the disease to display
* @param position - the position in the menu
*/
@Override
protected void populateView(final View view, final String disease, final int position) {
((TextView) view.findViewById(R.id.text)).setText(disease);
getDatabaseManager().getDiseaseUrlReference(disease).addListenerForSingleValueEvent(new ValueEventListener() {
/**
* Handle a change in the database contents
* @param snapshot - current database contents
*/
@Override
public void onDataChange(DataSnapshot snapshot) {
if (snapshot.exists()) {
diseaseUrl = (String) snapshot.getValue();
}
}
/**
* Do nothing when the process is cancelled
* @param databaseError - Ignored error
*/
@Override
public void onCancelled(DatabaseError databaseError) {
}
});
Button learnMoreButton = view.findViewById(R.id.button);
learnMoreButton.setText(getActivity().getString(R.string.learn_more));
learnMoreButton.setOnClickListener(new View.OnClickListener() {
/**
* User pressed a disease
* @param v - current app view
*/
@Override
public void onClick(View v) {
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(diseaseUrl));
getActivity().startActivity(browserIntent);
}
});
}
};
list.setAdapter(listAdapter);
}
开发者ID:iskandergaba,项目名称:Botanist,代码行数:55,代码来源:DiseaseController.java
示例6: onActivityCreated
import com.firebase.ui.database.FirebaseListAdapter; //导入依赖的package包/类
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
LinearLayoutManager layoutManager = new LinearLayoutManager(getActivity());
layoutManager.setReverseLayout(true);
layoutManager.setStackFromEnd(true);
//queryRef = mRef.orderByChild("/profile/player/level").limitToLast(10);
FirebaseListAdapter<User> mAdapter = new FirebaseListAdapter<User>(getActivity(), User.class, android.R.layout.two_line_list_item, mRef.orderByChild("/profile/player/level").limitToFirst(10)) {
@Override
protected void populateView(View view, User chatMessage, int position) {
if (chatMessage.getUsername() != "Default") {
((TextView) view.findViewById(android.R.id.text1)).setText(chatMessage.getUsername());
((TextView) view.findViewById(android.R.id.text2)).setText(Integer.toString(chatMessage.getprofile().getPlayer().getLevel()));
}
}
};
leaderBoard.setAdapter(mAdapter);
}
开发者ID:mohseenrm,项目名称:LevelUpAndroid,代码行数:30,代码来源:Tab3_Activity.java
注:本文中的com.firebase.ui.database.FirebaseListAdapter类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论