use of android.support.v7.widget.SimpleItemAnimator in project material-about-library by daniel-stoneuk.
the class MaterialAboutActivity method initViews.
private void initViews() {
setSupportActionBar(toolbar);
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setDisplayHomeAsUpEnabled(true);
}
adapter = new MaterialAboutListAdapter(getViewTypeManager());
recyclerView.setLayoutManager(new LinearLayoutManager(this));
recyclerView.setAdapter(adapter);
RecyclerView.ItemAnimator animator = recyclerView.getItemAnimator();
if (animator instanceof SimpleItemAnimator) {
((SimpleItemAnimator) animator).setSupportsChangeAnimations(false);
}
}
use of android.support.v7.widget.SimpleItemAnimator in project material-about-library by daniel-stoneuk.
the class MaterialAboutFragment method onCreateView.
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
int style = getTheme();
// create ContextThemeWrapper from the original Activity Context with the custom theme
final Context contextThemeWrapper = new android.view.ContextThemeWrapper(getActivity(), style);
LayoutInflater localInflater = inflater.cloneInContext(contextThemeWrapper);
View rootView = localInflater.inflate(R.layout.mal_material_about_fragment, container, false);
recyclerView = (RecyclerView) rootView.findViewById(R.id.mal_recyclerview);
adapter = new MaterialAboutListAdapter(getViewTypeManager());
recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
recyclerView.setAdapter(adapter);
RecyclerView.ItemAnimator animator = recyclerView.getItemAnimator();
if (animator instanceof SimpleItemAnimator) {
((SimpleItemAnimator) animator).setSupportsChangeAnimations(false);
}
recyclerView.setAlpha(0f);
recyclerView.setTranslationY(20);
ListTask task = new ListTask(getActivity());
task.execute();
return rootView;
}
use of android.support.v7.widget.SimpleItemAnimator in project Roblu by wdavies973.
the class TBAEventSelector method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_apievent_select);
teamNumber = new IO(getApplicationContext()).loadSettings().getTeamNumber();
/*
* Setup UI
*/
// Setup
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
if (getSupportActionBar() != null) {
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setTitle("Select an event");
}
// Progress bar
bar = findViewById(R.id.progress_bar);
bar.setVisibility(View.GONE);
// Recycler view
rv = findViewById(R.id.events_recycler);
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this);
linearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
rv.setLayoutManager(linearLayoutManager);
((SimpleItemAnimator) rv.getItemAnimator()).setSupportsChangeAnimations(false);
// Setup the tbaEventAdapter
tbaEventAdapter = new TBAEventAdapter(this, this);
rv.setAdapter(tbaEventAdapter);
// Setup the gesture listener
ItemTouchHelper.Callback callback = new TutorialsRecyclerTouchHelper();
ItemTouchHelper helper = new ItemTouchHelper(callback);
helper.attachToRecyclerView(rv);
/*
* Create the "My Events / All Events" chooser
*/
Spinner showTeam = findViewById(R.id.show_team);
ArrayAdapter<String> sAdapter = new ArrayAdapter<>(this, android.R.layout.simple_spinner_item, new String[] { "My events", "All events" });
sAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
showTeam.setAdapter(sAdapter);
showTeam.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long l) {
onlyShowMyEvents = parent.getItemAtPosition(position).toString().equals("My events");
rv.setVisibility(View.INVISIBLE);
bar.setVisibility(View.VISIBLE);
if (tbaEventAdapter.getEvents() != null)
tbaEventAdapter.getEvents().clear();
tbaEventAdapter.notifyDataSetChanged();
TBALoadEventsTask task = new TBALoadEventsTask(bar, rv, tbaEventAdapter, TBAEventSelector.this, teamNumber, selectedYear, onlyShowMyEvents);
task.execute();
}
@Override
public void onNothingSelected(AdapterView<?> adapterView) {
}
});
// If no team number is found, default to "All events"
if (new IO(getApplicationContext()).loadSettings().getTeamNumber() == 0)
showTeam.setSelection(1);
/*
* Setup the years spinner
*/
Spinner yearsSpinner = findViewById(R.id.spinner);
selectedYear = Calendar.getInstance().get(Calendar.YEAR);
String[] years = new String[selectedYear - 1991];
for (int i = years.length - 1; i >= 0; i--) years[Math.abs(i - years.length + 1)] = String.valueOf(1992 + i);
final ArrayAdapter<String> adapter = new ArrayAdapter<>(this, android.R.layout.simple_spinner_item, years);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
yearsSpinner.setAdapter(adapter);
yearsSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
selectedYear = Integer.parseInt(adapterView.getItemAtPosition(i).toString());
rv.setVisibility(View.INVISIBLE);
bar.setVisibility(View.VISIBLE);
if (tbaEventAdapter.getEvents() != null)
tbaEventAdapter.getEvents().clear();
tbaEventAdapter.notifyDataSetChanged();
TBALoadEventsTask task = new TBALoadEventsTask(bar, rv, tbaEventAdapter, TBAEventSelector.this, teamNumber, selectedYear, onlyShowMyEvents);
task.execute();
}
@Override
public void onNothingSelected(AdapterView<?> adapterView) {
}
});
/*
* Setup the search view
*/
searchView = findViewById(R.id.search_view);
searchView.setHintTextColor(Color.BLACK);
searchView.setHint("Search events");
searchView.setOnSearchViewListener(new MaterialSearchView.SearchViewListener() {
@Override
public void onSearchViewShown() {
}
@Override
public void onSearchViewClosed() {
TBALoadEventsTask task = new TBALoadEventsTask(bar, rv, tbaEventAdapter, TBAEventSelector.this, teamNumber, selectedYear, onlyShowMyEvents);
task.setEvents(events);
task.execute();
}
});
searchView.setOnQueryTextListener(new MaterialSearchView.OnQueryTextListener() {
@Override
public boolean onQueryTextSubmit(String query) {
searchView.closeSearch();
return false;
}
@Override
public boolean onQueryTextChange(String newText) {
TBALoadEventsTask task = new TBALoadEventsTask(bar, rv, tbaEventAdapter, TBAEventSelector.this, teamNumber, selectedYear, onlyShowMyEvents);
task.setEvents(events);
task.setQuery(newText);
task.execute();
return true;
}
});
// Sync UI with user preferences
new UIHandler(this, toolbar).update();
}
use of android.support.v7.widget.SimpleItemAnimator in project Roblu by wdavies973.
the class Tutorial method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_tutorial);
/*
* Setup UI
*/
// Toolbar
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
if (getSupportActionBar() != null) {
getSupportActionBar().setTitle("Tutorials");
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
// List of tutorials
tutorials = new ArrayList<>();
tutorials.add(new RTutorial("Text based", "View the Roblu text based tutorial", "https://docs.google.com/document/d/1DqpgKPdtfZDUc7Zu3MqdJHL59aB-ht8H1ZwllYlzMuc/edit?usp=sharing"));
tutorials.add(new RTutorial("The basics", "Roblu's mission, description of platforms, terms, etc.", "9j6ysvJJyQg"));
tutorials.add(new RTutorial("Events", "Learn how to create, manage, backup, organize, and export events", "6BLlLxltppk"));
tutorials.add(new RTutorial("Forms", "Learn how to create, manage, edit, organize, master form", "xLLbPyhW9fg"));
tutorials.add(new RTutorial("Roblu Cloud (Network syncing)", "Learn how to setup and sync scouting data across unlimited devices over a data connection.", "z9tIGaaV1jQ"));
tutorials.add(new RTutorial("Bluetooth Syncing", "Learn how to setup and sync with Bluetooth syncing.", "Adjp3rjt2_4"));
tutorials.add(new RTutorial("QR Codes", "Learn how to use QR code syncing", "pS_5bvp1D_c"));
tutorials.add(new RTutorial("Manual Schedule Importer", "Learn how to use the manual schedule importer if the FIRST API is down.", "https://github.com/wdavies973/Roblu/wiki/Manually-Importing-a-Match-Schedule"));
tutorials.add(new RTutorial("Scouting / Odds and Ends", "Learn about those features that weren't in any of the other tutorial videos", "JL_lSaB0gsk"));
tutorials.add(new RTutorial("How to get Roblu Cloud for free", "Get Roblu Cloud for free", "dQw4w9WgXcQ"));
tutorials.add(new RTutorial("Roblu Devlogs", "For those interested in watching the development process", ""));
/*
* Add the tutorials to the recycler view
*/
rv = findViewById(R.id.teams_recycler);
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this);
linearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
rv.setLayoutManager(linearLayoutManager);
((SimpleItemAnimator) rv.getItemAnimator()).setSupportsChangeAnimations(false);
TutorialsRecyclerAdapter adapter = new TutorialsRecyclerAdapter(this, this, tutorials);
rv.setAdapter(adapter);
// Gesture listener
ItemTouchHelper.Callback callback = new TutorialsRecyclerTouchHelper();
ItemTouchHelper helper = new ItemTouchHelper(callback);
helper.attachToRecyclerView(rv);
// Sync UI with settings
new UIHandler(this, toolbar).update();
}
use of android.support.v7.widget.SimpleItemAnimator in project Roblu by wdavies973.
the class MetricSortFragment method onCreateView.
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.metric_tab, container, false);
/*
* Receive parameters
*/
Bundle bundle = this.getArguments();
metrics = (ArrayList<RMetric>) bundle.getSerializable("metrics");
processMethod = bundle.getInt("processMethod");
eventID = bundle.getInt("eventID");
/*
* Attach metrics to the RecyclerView
*/
rv = view.findViewById(R.id.metric_recycler);
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(view.getContext());
linearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
rv.setLayoutManager(linearLayoutManager);
((SimpleItemAnimator) rv.getItemAnimator()).setSupportsChangeAnimations(false);
FormRecyclerAdapter adapter = new FormRecyclerAdapter(view.getContext(), this);
rv.setAdapter(adapter);
// setup gesture listener
ItemTouchHelper.Callback callback = new FormRecyclerTouchHelper(adapter, true);
ItemTouchHelper helper = new ItemTouchHelper(callback);
helper.attachToRecyclerView(rv);
adapter.setMetrics(metrics);
return view;
}
Aggregations