Commit ac6cb774 authored by Roger Barton's avatar Roger Barton
Browse files

Lint

parent 4a14058e
......@@ -86,8 +86,7 @@ public class MainActivity extends AppCompatActivity {
}
/**
* Submit a pin for an event to the server and act on response accondingly, ie open scanActivity if valid, or request pin entry again
* @param view
* Submit a pin for an event to the server and act on response accordingly, ie open scanActivity if valid, or request pin entry again
*/
public void SubmitPin(View view)
{
......
......@@ -17,13 +17,13 @@ import ch.amiv.android_app.R;
/**
* This activity is for displaying the list of signed in members, similar to what is seen in the checkin website in the other amiv checkin project.
* Mostly handles updating the data by fetching from the server and then updating the listview. Note the list view is customised, ie the individual item, this is what the CustomListAdapter class and list_item_memberber.xml are for
* Mostly handles updating the data by fetching from the server and then updating the listview. Note the list view is customised, ie the individual item, this is what the CustomListAdapter class and list_item_member.xml are for
*/
public class MemberListActivity extends AppCompatActivity {
RecyclerView mRecylerView;
RecyclerView.Adapter mRecylcerAdaper;
RecyclerView mRecyclerView;
RecyclerView.Adapter mRecyclerAdapter;
RecyclerView.LayoutManager mRecyclerLayoutAdapter;
private final Handler handler = new Handler(); //similar as in scanActivity, to keep refreshing the data
......@@ -71,19 +71,19 @@ public class MemberListActivity extends AppCompatActivity {
}
else if(id == R.id.menuSort_Membership) {
EventDatabase.instance.SetMemberSortingType(EventDatabase.MemberComparator.Membership);
mRecylcerAdaper.notifyDataSetChanged();
mRecyclerAdapter.notifyDataSetChanged();
}
else if(id == R.id.menuSort_Status) {
EventDatabase.instance.SetMemberSortingType(EventDatabase.MemberComparator.Status);
mRecylcerAdaper.notifyDataSetChanged();
mRecyclerAdapter.notifyDataSetChanged();
}
else if(id == R.id.menuSort_Name) {
EventDatabase.instance.SetMemberSortingType(EventDatabase.MemberComparator.Name);
mRecylcerAdaper.notifyDataSetChanged();
mRecyclerAdapter.notifyDataSetChanged();
}
else if(id == R.id.menuSort_Legi) {
EventDatabase.instance.SetMemberSortingType(EventDatabase.MemberComparator.Legi);
mRecylcerAdaper.notifyDataSetChanged();
mRecyclerAdapter.notifyDataSetChanged();
}
return super.onOptionsItemSelected(item);
......@@ -92,20 +92,20 @@ public class MemberListActivity extends AppCompatActivity {
private void InitialiseListView()
{
//=====Recycler View====
mRecylerView = findViewById(R.id.recyclerView);
mRecyclerView = findViewById(R.id.recyclerView);
// use this setting to improve performance if you know that changes
// in content do not change the layout size of the RecyclerView
mRecylerView.setHasFixedSize(true);
mRecyclerView.setHasFixedSize(true);
// use a linear layout manager
mRecyclerLayoutAdapter = new LinearLayoutManager(this);
mRecylerView.setLayoutManager(mRecyclerLayoutAdapter);
mRecyclerView.setLayoutManager(mRecyclerLayoutAdapter);
// specify an adapter (see also next example)
mRecylcerAdaper = new MemberListAdapter(EventDatabase.instance.members, EventDatabase.instance.stats, EventDatabase.instance.eventData.GetInfosAsKeyValuePairs());
mRecylerView.setLayoutAnimation(AnimationUtils.loadLayoutAnimation(this, R.anim.layout_anim_falldown));
mRecylerView.setAdapter(mRecylcerAdaper);
mRecyclerAdapter = new MemberListAdapter(EventDatabase.instance.members, EventDatabase.instance.stats, EventDatabase.instance.eventData.GetInfosAsKeyValuePairs());
mRecyclerView.setLayoutAnimation(AnimationUtils.loadLayoutAnimation(this, R.anim.layout_anim_falldown));
mRecyclerView.setAdapter(mRecyclerAdapter);
AnimateList(null);
}
......@@ -130,18 +130,18 @@ public class MemberListActivity extends AppCompatActivity {
{
this.runOnUiThread(new Runnable() {
public void run() {
mRecylerView.invalidate();
mRecylerView.scheduleLayoutAnimation();
mRecyclerView.invalidate();
mRecyclerView.scheduleLayoutAnimation();
}
});
}
private void UpdateList()
{
if(mRecylerView == null)
if(mRecyclerView == null)
InitialiseListView();
mRecylcerAdaper.notifyDataSetChanged();
mRecyclerAdapter.notifyDataSetChanged();
}
public void RefreshListData(View view)
......
......@@ -243,7 +243,6 @@ public class ScanActivity extends AppCompatActivity {
/**
* Call this to submit a legi nr from a UI Element
* @param view
*/
public void SubmitLegiNrFromTextField(View view)
{
......
......@@ -20,8 +20,8 @@ import ch.amiv.android_app.R;
public class SearchMembersActivity extends AppCompatActivity {
RecyclerView mRecylerView; //for displaying the list of members in the same way as in the memberListActivity
RecyclerView.Adapter mRecylcerAdaper;
RecyclerView mRecyclerView; //for displaying the list of members in the same way as in the memberListActivity
RecyclerView.Adapter mRecyclerAdapter;
RecyclerView.LayoutManager mRecyclerLayoutAdapter;
public List<Member> searchResults = new ArrayList<Member>(); //This is the list of search results, will dynamically change size of course
......@@ -74,7 +74,7 @@ public class SearchMembersActivity extends AppCompatActivity {
RunSearch(newText, false);
if(newText.isEmpty()) {
searchResults.clear();
mRecylcerAdaper.notifyDataSetChanged();
mRecyclerAdapter.notifyDataSetChanged();
}
}
return false;
......@@ -101,15 +101,15 @@ public class SearchMembersActivity extends AppCompatActivity {
private void InitialiseListView() //same as in the memberlistactivity
{
//=====Recycler View====
mRecylerView = findViewById(R.id.recyclerView);
mRecylerView.setHasFixedSize(true);
mRecyclerView = findViewById(R.id.recyclerView);
mRecyclerView.setHasFixedSize(true);
mRecyclerLayoutAdapter = new LinearLayoutManager(this);
mRecylerView.setLayoutManager(mRecyclerLayoutAdapter);
mRecyclerView.setLayoutManager(mRecyclerLayoutAdapter);
mRecylcerAdaper = new SearchMembersListAdapter(searchResults);
mRecylerView.setLayoutAnimation(AnimationUtils.loadLayoutAnimation(this, R.anim.layout_anim_falldown)); //Here we give the searchResults array and use the SearchMemberListAdapter
mRecylerView.setAdapter(mRecylcerAdaper);
mRecyclerAdapter = new SearchMembersListAdapter(searchResults);
mRecyclerView.setLayoutAnimation(AnimationUtils.loadLayoutAnimation(this, R.anim.layout_anim_falldown)); //Here we give the searchResults array and use the SearchMemberListAdapter
mRecyclerView.setAdapter(mRecyclerAdapter);
AnimateList(null);
}
......@@ -133,17 +133,17 @@ public class SearchMembersActivity extends AppCompatActivity {
searchResults.add(EventDatabase.instance.members.get(i));
}
mRecylcerAdaper.notifyDataSetChanged();
mRecyclerAdapter.notifyDataSetChanged();
return true;
}
private void UpdateList()
{
if(mRecylerView == null)
if(mRecyclerView == null)
InitialiseListView();
if(!RunSearch(prevQuery, true))
mRecylcerAdaper.notifyDataSetChanged();
mRecyclerAdapter.notifyDataSetChanged();
}
/**
......@@ -154,8 +154,8 @@ public class SearchMembersActivity extends AppCompatActivity {
{
this.runOnUiThread(new Runnable() {
public void run() {
mRecylerView.invalidate();
mRecylerView.scheduleLayoutAnimation();
mRecyclerView.invalidate();
mRecyclerView.scheduleLayoutAnimation();
}
});
}
......
......@@ -49,7 +49,6 @@ public final class ServerRequests {
/**
* Call this to check with the server if a pin is valid
* @return whether there is internet or not
* @param callback A function to execute when the response has been received
*/
public static void CheckPin (final Context context, final OnCheckPinReceivedCallback callback)
......@@ -102,7 +101,7 @@ public final class ServerRequests {
{
//Note: server will send a Json if the response is valid, ie the person has been checked in, else a string. This is to get the member type. Yet we still need to do a stringRequest
StringRequest req = new StringRequest(Request.Method.POST, SettingsActivity.GetServerURL(context) + ON_SUBMIT_LEGI_URL_EXT
, new Response.Listener<String>() { @Override public void onResponse(String response) {}} //initalise with empty response listeners as we will handle the response in the parseNetworkResponse and parseNetworkError functions
, new Response.Listener<String>() { @Override public void onResponse(String response) {}} //initialise with empty response listeners as we will handle the response in the parseNetworkResponse and parseNetworkError functions
, new Response.ErrorListener() {@Override public void onErrorResponse(VolleyError error) {}})
{
@Override
......@@ -159,7 +158,7 @@ public final class ServerRequests {
Log.e("postrequest", "Params sent: pin=" + MainActivity.CurrentPin + ", URL used: " + SettingsActivity.GetServerURL(context) + GET_DATA_URL_EXT);
JsonObjectRequest req = new JsonObjectRequest(Request.Method.GET, SettingsActivity.GetServerURL(context) + GET_DATA_URL_EXT,
(JSONObject) null, new Response.Listener<JSONObject>() {
null, new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
// Parsing json object response and save to the static memberDB, parse each part in a separate try catch, so we get as much info as possible
......@@ -238,7 +237,7 @@ public final class ServerRequests {
requestQueue.add(req);
}
/** // Note: Is currently commented out as the server side is giving us the eventData as part of the /gchecking_update_data json, however may change to be separate request, so it is only sent at the start of a session
/** // Note: Is currently commented out as the server side is giving us the eventData as part of the /checking_update_data json, however may change to be separate request, so it is only sent at the start of a session
* Will update the event data, only call this when entering a session
* @param callback Use this callback for executing code when the data has been received
*/
......
......@@ -71,7 +71,6 @@ public class SettingsActivity extends AppCompatActivity {
}
/**
* @param context
* @return Returns whether auto fetching data, to update list of members from the server, is allowed
*/
public static boolean GetAutoRefresh (Context context)
......@@ -83,7 +82,6 @@ public class SettingsActivity extends AppCompatActivity {
}
/**
* @param context
* @return Returns the saved refresh frequency for getting data from the server. The value set in the settings activity
*/
public static int GetRefreshFrequency (Context context) //returns in millisec, but is stored in sec
......
......@@ -3,7 +3,7 @@ package ch.amiv.android_app.core;
import android.support.v7.widget.RecyclerView;
/**
* A class to simplify refreshsing a recyclerview, used in events and jobs list for example
* A class to simplify refreshing a recyclerview, used in events and jobs list for example
*/
public abstract class BaseRecyclerAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
......
......@@ -144,7 +144,7 @@ public class ListFragment extends Fragment {
//Setup swipe down to refresh, adds the amiv logo and rotate animation
private void InitSwipeRefreshUI()
{
//Set on resfresh functionality
//Set on refresh functionality
swipeRefreshLayout = getView().findViewById(R.id.swipeRefresh);
swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { //This sets what function is called when we swipe down to refresh
@Override
......
......@@ -70,7 +70,7 @@ public class LoginActivity extends AppCompatActivity {
//Add the toolbar and back navigation
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
if(getSupportActionBar() != null)//XXX doesnt always work, ensure that the back arrow is visible
if(getSupportActionBar() != null)//XXX doesn't always work, ensure that the back arrow is visible
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
//Link UI elements to xml
......@@ -133,7 +133,7 @@ public class LoginActivity extends AppCompatActivity {
SetSubmitButtonState(true, false);
}
//Store the detials in the current user, do this on the main thread to prevent multi thread errors, as several requests could be editing the userinfo at the same time otherwise
//Store the details in the current user, do this on the main thread to prevent multi thread errors, as several requests could be editing the userinfo at the same time otherwise
if(json.has("user")) {
submitButton.post(new Runnable() {
@Override
......
......@@ -232,9 +232,6 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
/**
* Here we can interpret the result of the login/event detail activity, if the login was successful or not, then update accordingly
* @param requestCode
* @param resultCode
* @param data
*/
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
......@@ -383,8 +380,6 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
/**
* Used to reconnect the link to the fragment in onresume
* @param fragment
* @param position
*/
public void ReconnectFragment(ListFragment fragment, int position){
try {
......
......@@ -32,7 +32,7 @@ import ch.amiv.android_app.events.Events;
import ch.amiv.android_app.jobs.Jobs;
/**
* A static class to do backround http requests to the amiv api. Access these requests anywhere
* A static class to do background http requests to the amiv api. Access these requests anywhere
* Most requests have a callback, so you can execute code when the request has returned or failed
* See API Docs to see what requests can be done: https://api.amiv.ethz.ch/docs or via github site https://github.com/amiv-eth/amivapi
*
......@@ -46,7 +46,7 @@ import ch.amiv.android_app.jobs.Jobs;
*
* To load images, don't use a request directly, use a networkImageView, which will handle everything for you including caching
*
* Libary used for network stuff: volley, note: we use our own modified version of the libary as a git submodule
* Library used for network stuff: volley, note: we use our own modified version of the library as a git submodule
*/
public final class Request {
private static RequestQueue requestQueue;
......@@ -82,9 +82,8 @@ public final class Request {
/**
* Will fetch the list of events from the server, note does not require an access token.
* @param errorCallback Use this to know when an error occured to stop loading animations etc
* @param eventId to only fetch for a specific event id add this, else set as emoty
* @return True if the request was sent.
* @param errorCallback Use this to know when an error occurred to stop loading animations etc
* @param eventId to only fetch for a specific event id add this, else set as empty
*/
public static void FetchEventList(final Context context, final OnDataReceivedCallback callback, final OnDataReceivedCallback errorCallback, @NonNull final String eventId)
{
......@@ -174,7 +173,7 @@ public final class Request {
/**
* Will fetch the event signups for the current user and save them in the eventInfos list
* @param eventId to only fetch for a specific event id add this, else set as emoty
* @param eventId to only fetch for a specific event id add this, else set as empty
*/
public static void FetchEventSignups(final Context context, final OnDataReceivedCallback callback, final OnDataReceivedCallback errorCallback, @NonNull String eventId)
{
......@@ -525,7 +524,6 @@ public final class Request {
/**
* Will run the callback on the main thread, use this for easily executing callbacks, which do not have any additional code on the main thread
* @param callback
*/
private static void RunCallback (final OnDataReceivedCallback callback)
{
......
......@@ -115,7 +115,7 @@ public class Settings {
}
/**
* Will return whether the user is only loggedd in with an email, if they do not have an api login, false if current user has not be initialised
* Will return whether the user is only logged in with an email, if they do not have an api login, false if current user has not be initialised
*/
public static boolean IsEmailOnlyLogin(Context context){
return !Settings.HasToken(context) && UserInfo.current != null && !UserInfo.current.email.isEmpty();
......@@ -132,7 +132,7 @@ public class Settings {
//region ---Language---
/**
* Will change the language, NOTE: Highly advised to restart the app/activty for changes to take effect.
* Will change the language, NOTE: Highly advised to restart the app/activity for changes to take effect.
* New strings that are loaded will be in the correct language, but UI that is already created/still in memory will NOT change.
* Returns true if the language has been changed
*/
......
......@@ -7,7 +7,7 @@ import android.os.Bundle;
import ch.amiv.android_app.BuildConfig;
/**
* This is the launcher/splash activity, here we choose to start the main activty or begin the setup process depending on whether the user has done the setup or not (stored in settings)
* This is the launcher/splash activity, here we choose to start the main activity or begin the setup process depending on whether the user has done the setup or not (stored in settings)
* For the UI we use a theme with the splash_screen, using a layout file is not possible as we have to display it while loading, need to use a basic xml, no inflation
* Theme is set in the manifest
*/
......
......@@ -41,7 +41,6 @@ public class UserInfo implements Serializable{
/**
* Used when the user only logs in with an email
* @param email_
*/
public void Update(String email_){
email = email_;
......
......@@ -68,7 +68,7 @@ public class MainActivity extends AppCompatActivity {
//====Handling of the response of the request
@Override
protected Response<String> parseNetworkResponse(NetworkResponse response) { //this is called if we have received a reponse from the server with a successful status code, eg 2xx, not 4xx
protected Response<String> parseNetworkResponse(NetworkResponse response) { //this is called if we have received a response from the server with a successful status code, eg 2xx, not 4xx
if(response != null) {
Log.e("request", "fetch demo data status Code: " + response.statusCode);
......
......@@ -114,7 +114,7 @@ public class EventDetailActivity extends AppCompatActivity {
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == 0 && resultCode == RESULT_OK) {
// If we are returning from the login activity and have had a successfuly login, refresh the user info and login UI
// If we are returning from the login activity and have had a successfully login, refresh the user info and login UI
boolean refreshLogin = data.getBooleanExtra("login_success", false);
if(refreshLogin && Settings.IsLoggedIn(getApplicationContext()))
{
......@@ -173,7 +173,7 @@ public class EventDetailActivity extends AppCompatActivity {
//Check that we have been given an event that exists else return to the calling activity
if(!hasEvent()) {
Log.e("events", "invlaid event index selected during InitUI(), (groupIndex, eventIndex): (" + eventGroup + "," + eventIndex + "), total event size" + Events.eventInfos.size() + ". Ensure that you are not clearing/overwiting the events list while viewing an event.");
Log.e("events", "invalid event index selected during InitUI(), (groupIndex, eventIndex): (" + eventGroup + "," + eventIndex + "), total event size" + Events.eventInfos.size() + ". Ensure that you are not clearing/overwriting the events list while viewing an event.");
onBackPressed();
return;
}
......@@ -194,7 +194,7 @@ public class EventDetailActivity extends AppCompatActivity {
//Setup swipe down to refresh, adds the amiv logo and rotate animation
private void InitSwipeRefreshUI()
{
//Set on resfresh functionality
//Set on refresh functionality
swipeRefreshLayout = findViewById(R.id.swipeRefresh);
swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { //This sets what function is called when we swipe down to refresh
@Override
......@@ -252,7 +252,6 @@ public class EventDetailActivity extends AppCompatActivity {
/**
* Will load the poster for the event if it exists and handle progress bars etc. Can call this again to refresh the poster
* @param isRefreshing
*/
private void LoadEventImage (boolean isRefreshing)
{
......@@ -329,7 +328,7 @@ public class EventDetailActivity extends AppCompatActivity {
}
/**
* This creates the short list under Infos, to display specific details. We get which details to dispkay from the EventInfo
* This creates the short list under Infos, to display specific details. We get which details to display from the EventInfo
*/
private void AddRegisterInfos()
{
......@@ -350,7 +349,6 @@ public class EventDetailActivity extends AppCompatActivity {
/**
* Will send a request to register the user for the event the activity is showing
* @param view
*/
public void RegisterForEvent(View view)
{
......
......@@ -75,7 +75,6 @@ public class EventInfo implements Serializable{
/**
* Overwrite the current data
* @param json
*/
public void UpdateEvent(JSONObject json)
{
......@@ -172,7 +171,6 @@ public class EventInfo implements Serializable{
/**
* Choose the key value pairs to be displayed in the event info section when viewing the event in detail
* @return
*/
public ArrayList<String[]> GetInfos(Resources r){
if(infos != null && infos.size() > 0)
......
......@@ -107,8 +107,6 @@ public final class Events {
/**
* Will update a given event with the id
* @param json
* @param eventId
* @return true if the event was found and updated
*/
public static boolean UpdateSingleEvent(JSONObject json, @NonNull String eventId){
......@@ -123,7 +121,6 @@ public final class Events {
/**
* Add signups to their events, use this when the data is received from the api in a jsonArray
* @param json
*/
public static void AddSignupArray(JSONArray json) {
boolean[] hasUpdatedEvent = new boolean[eventInfos.size()];
......
......@@ -125,7 +125,7 @@ public class EventsListAdapter extends BaseRecyclerAdapter {
* This is where the data in the ui is set. Note that position is the position on screen whereas getAdapterPos is the position in the whole list
*/
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int screenPosition) { //NOTE: screenPosition supplied is position on screen not in the list!, use holder.getAdapterPosition() indstead
public void onBindViewHolder(RecyclerView.ViewHolder holder, int screenPosition) { //NOTE: screenPosition supplied is position on screen not in the list!, use holder.getAdapterPosition() instead
if(activity == null || holder == null)
return;
......
......@@ -91,7 +91,7 @@ public class JobDetailActivity extends AppCompatActivity {
//Check that we have been given a job that exists else return to the calling activity
if(!hasJob()) {
Log.e("jobs", "invlaid job index selected during InitUI(), (groupIndex, jobIndex): (" + jobGroup + "," + jobIndex + "), total job size" + Jobs.jobInfos.size() + ". Ensure that you are not clearing/overwiting the jobs list while viewing a job.");
Log.e("jobs", "invalid job index selected during InitUI(), (groupIndex, jobIndex): (" + jobGroup + "," + jobIndex + "), total job size" + Jobs.jobInfos.size() + ". Ensure that you are not clearing/overwriting the jobs list while viewing a job.");
onBackPressed();
return;
}
......@@ -139,7 +139,6 @@ public class JobDetailActivity extends AppCompatActivity {
/**
* Will start the pdf download as a notification to the downloads folder
* @param view
*/
public void OpenJobPdf(View view) {
OpenJobPdf(true);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment