Commit f98ae2cb authored by Varun Patil's avatar Varun Patil Committed by GitHub

Reduce technical debt (#271)

* Reduce technical debt (4)

* Remove test files

* Reduce technical debt (5)
parent 3449c40a
package app.insti;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.assertEquals;
/**
* Instrumentation test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("app.insti", appContext.getPackageName());
}
}
...@@ -199,7 +199,6 @@ public class InstiAppFirebaseMessagingService extends FirebaseMessagingService { ...@@ -199,7 +199,6 @@ public class InstiAppFirebaseMessagingService extends FirebaseMessagingService {
Bitmap.Config.ARGB_8888); Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(output); Canvas canvas = new Canvas(output);
final int color = 0xffa19774;
final Paint paint = new Paint(); final Paint paint = new Paint();
final Rect rect = new Rect(0, 0, radius, radius); final Rect rect = new Rect(0, 0, radius, radius);
final Rect destRect = new Rect( final Rect destRect = new Rect(
......
...@@ -11,9 +11,9 @@ import app.insti.api.model.User; ...@@ -11,9 +11,9 @@ import app.insti.api.model.User;
public class SessionManager { public class SessionManager {
public SharedPreferences pref; public SharedPreferences pref;
Editor editor; private Editor editor;
Context context; private Context context;
int PRIVATE_MODE = 0; private final int PRIVATE_MODE = 0;
public SessionManager(Context context) { public SessionManager(Context context) {
this.context = context; this.context = context;
......
...@@ -36,8 +36,8 @@ public class LoginActivity extends AppCompatActivity { ...@@ -36,8 +36,8 @@ public class LoginActivity extends AppCompatActivity {
private final String guestUri = "https://guesturi"; private final String guestUri = "https://guesturi";
public String authCode = null; public String authCode = null;
public String fcmId = null; public String fcmId = null;
SessionManager session; private SessionManager session;
Context mContext = this; private Context mContext = this;
private boolean loggingIn = false; private boolean loggingIn = false;
private ProgressDialog progressDialog; private ProgressDialog progressDialog;
...@@ -169,22 +169,6 @@ public class LoginActivity extends AppCompatActivity { ...@@ -169,22 +169,6 @@ public class LoginActivity extends AppCompatActivity {
}); });
} }
private boolean checkPlayServices() {
GoogleApiAvailability apiAvailability = GoogleApiAvailability.getInstance();
int resultCode = apiAvailability.isGooglePlayServicesAvailable(this);
if (resultCode != ConnectionResult.SUCCESS) {
if (apiAvailability.isUserResolvableError(resultCode)) {
apiAvailability.getErrorDialog(this, resultCode, PLAY_SERVICES_RESOLUTION_REQUEST)
.show();
} else {
Log.i(TAG, "This device is not supported.");
finish();
}
return false;
}
return true;
}
private class WvClient extends WebViewClient { private class WvClient extends WebViewClient {
@Override @Override
public boolean shouldOverrideUrlLoading(final WebView view, final String url) { public boolean shouldOverrideUrlLoading(final WebView view, final String url) {
......
...@@ -93,8 +93,8 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On ...@@ -93,8 +93,8 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
private static final String TAG = "MainActivity"; private static final String TAG = "MainActivity";
SessionManager session; private SessionManager session;
FeedFragment feedFragment; private FeedFragment feedFragment;
private User currentUser; private User currentUser;
private BackHandledFragment selectedFragment; private BackHandledFragment selectedFragment;
private Menu menu; private Menu menu;
......
...@@ -18,8 +18,6 @@ import android.widget.LinearLayout; ...@@ -18,8 +18,6 @@ import android.widget.LinearLayout;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import com.squareup.picasso.Picasso;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
...@@ -30,7 +28,6 @@ import app.insti.api.model.User; ...@@ -30,7 +28,6 @@ import app.insti.api.model.User;
import app.insti.api.model.Venter; import app.insti.api.model.Venter;
import app.insti.fragment.ComplaintFragment; import app.insti.fragment.ComplaintFragment;
import app.insti.utils.DateTimeUtil; import app.insti.utils.DateTimeUtil;
import de.hdodenhof.circleimageview.CircleImageView;
import retrofit2.Call; import retrofit2.Call;
import retrofit2.Callback; import retrofit2.Callback;
import retrofit2.Response; import retrofit2.Response;
......
...@@ -15,7 +15,6 @@ import app.insti.api.model.MessMenu; ...@@ -15,7 +15,6 @@ import app.insti.api.model.MessMenu;
public class MessMenuAdapter extends RecyclerView.Adapter<MessMenuAdapter.ViewHolder> { public class MessMenuAdapter extends RecyclerView.Adapter<MessMenuAdapter.ViewHolder> {
private List<MessMenu> messMenus; private List<MessMenu> messMenus;
private Context context;
public MessMenuAdapter(List<MessMenu> messMenus) { public MessMenuAdapter(List<MessMenu> messMenus) {
this.messMenus = messMenus; this.messMenus = messMenus;
...@@ -25,7 +24,7 @@ public class MessMenuAdapter extends RecyclerView.Adapter<MessMenuAdapter.ViewHo ...@@ -25,7 +24,7 @@ public class MessMenuAdapter extends RecyclerView.Adapter<MessMenuAdapter.ViewHo
@NonNull @NonNull
@Override @Override
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
context = parent.getContext(); final Context context = parent.getContext();
LayoutInflater inflater = LayoutInflater.from(context); LayoutInflater inflater = LayoutInflater.from(context);
View postView = inflater.inflate(R.layout.mess_menu_card, parent, false); View postView = inflater.inflate(R.layout.mess_menu_card, parent, false);
......
...@@ -28,7 +28,6 @@ public class TrainingBlogAdapter extends RecyclerView.Adapter<RecyclerView.ViewH ...@@ -28,7 +28,6 @@ public class TrainingBlogAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
private final int VIEW_PROG = 0; private final int VIEW_PROG = 0;
private List<TrainingBlogPost> posts; private List<TrainingBlogPost> posts;
private Context context;
private ItemClickListener itemClickListener; private ItemClickListener itemClickListener;
public TrainingBlogAdapter(List<TrainingBlogPost> posts, ItemClickListener itemClickListener) { public TrainingBlogAdapter(List<TrainingBlogPost> posts, ItemClickListener itemClickListener) {
...@@ -47,7 +46,7 @@ public class TrainingBlogAdapter extends RecyclerView.Adapter<RecyclerView.ViewH ...@@ -47,7 +46,7 @@ public class TrainingBlogAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
@Override @Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
context = parent.getContext(); final Context context = parent.getContext();
if (viewType == VIEW_ITEM) { if (viewType == VIEW_ITEM) {
LayoutInflater inflater = LayoutInflater.from(context); LayoutInflater inflater = LayoutInflater.from(context);
View postView = inflater.inflate(R.layout.blog_post_card, parent, false); View postView = inflater.inflate(R.layout.blog_post_card, parent, false);
...@@ -63,7 +62,6 @@ public class TrainingBlogAdapter extends RecyclerView.Adapter<RecyclerView.ViewH ...@@ -63,7 +62,6 @@ public class TrainingBlogAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
} else { } else {
LayoutInflater inflater = LayoutInflater.from(context); LayoutInflater inflater = LayoutInflater.from(context);
View loadView = inflater.inflate(R.layout.blog_load_item, parent, false); View loadView = inflater.inflate(R.layout.blog_load_item, parent, false);
final TrainingBlogAdapter.ViewHolder postViewHolder = new TrainingBlogAdapter.ViewHolder(loadView);
return new TrainingBlogAdapter.ProgressViewHolder(loadView); return new TrainingBlogAdapter.ProgressViewHolder(loadView);
} }
} }
......
...@@ -56,23 +56,6 @@ public class Body implements CardInterface { ...@@ -56,23 +56,6 @@ public class Body implements CardInterface {
this.bodyID = bodyID; this.bodyID = bodyID;
} }
public Body(String bodyID, String bodyStrID, String bodyName, String bodyShortDescription, String bodyDescription, String bodyImageURL, List<Body> bodyChildren, List<Body> bodyParents, List<Event> bodyEvents, int bodyFollowersCount, String bodyWebsiteURL, String bodyBlogURL, boolean bodyUserFollows, List<Role> bodyRoles) {
this.bodyID = bodyID;
this.bodyStrID = bodyStrID;
this.bodyName = bodyName;
this.bodyShortDescription = bodyShortDescription;
this.bodyDescription = bodyDescription;
this.bodyImageURL = bodyImageURL;
this.bodyChildren = bodyChildren;
this.bodyParents = bodyParents;
this.bodyEvents = bodyEvents;
this.bodyFollowersCount = bodyFollowersCount;
this.bodyWebsiteURL = bodyWebsiteURL;
this.bodyBlogURL = bodyBlogURL;
this.bodyUserFollows = bodyUserFollows;
this.bodyRoles = bodyRoles;
}
public String getBodyID() { public String getBodyID() {
return bodyID; return bodyID;
} }
......
...@@ -66,23 +66,8 @@ public class Event implements CardInterface { ...@@ -66,23 +66,8 @@ public class Event implements CardInterface {
private boolean eventBigImage = false; private boolean eventBigImage = false;
public Event(String eventID, String eventStrID, String eventName, String eventDescription, String eventImageURL, Timestamp eventStartTime, Timestamp eventEndTime, boolean allDayEvent, List<Venue> eventVenues, List<Body> eventBodies, int eventInterestedCount, int eventGoingCount, List<User> eventInterested, List<User> eventGoing, String eventWebsiteURL, int eventUserUes) { public Event(@NonNull String eventID) {
this.eventID = eventID; this.eventID = eventID;
this.eventStrID = eventStrID;
this.eventName = eventName;
this.eventDescription = eventDescription;
this.eventImageURL = eventImageURL;
this.eventStartTime = eventStartTime;
this.eventEndTime = eventEndTime;
this.allDayEvent = allDayEvent;
this.eventVenues = eventVenues;
this.eventBodies = eventBodies;
this.eventInterestedCount = eventInterestedCount;
this.eventGoingCount = eventGoingCount;
this.eventInterested = eventInterested;
this.eventGoing = eventGoing;
this.eventWebsiteURL = eventWebsiteURL;
this.eventUserUes = eventUserUes;
} }
public String getEventID() { public String getEventID() {
......
...@@ -42,19 +42,8 @@ public class Venue { ...@@ -42,19 +42,8 @@ public class Venue {
@SerializedName("lng") @SerializedName("lng")
private double venueLongitude; private double venueLongitude;
public Venue(String venueID, String venueName, String venueShortName, String venueDescripion, String venueParentId, String venueParentRelation, Integer venueGroupId, Integer venuePixelX, Integer venuePixelY, Boolean venueReusable, double venueLatitude, double venueLongitude) { public Venue(@NonNull String venueID) {
this.venueID = venueID; this.venueID = venueID;
this.venueName = venueName;
this.venueShortName = venueShortName;
this.venueDescripion = venueDescripion;
this.venueParentId = venueParentId;
this.venueParentRelation = venueParentRelation;
this.venueGroupId = venueGroupId;
this.venuePixelX = venuePixelX;
this.venuePixelY = venuePixelY;
this.venueReusable = venueReusable;
this.venueLatitude = venueLatitude;
this.venueLongitude = venueLongitude;
} }
public String getVenueID() { public String getVenueID() {
......
...@@ -50,7 +50,7 @@ import retrofit2.Response; ...@@ -50,7 +50,7 @@ import retrofit2.Response;
* create an instance of this fragment. * create an instance of this fragment.
*/ */
public class BodyFragment extends BackHandledFragment implements TransitionTargetFragment { public class BodyFragment extends BackHandledFragment implements TransitionTargetFragment {
String TAG = "BodyFragment"; public final String TAG = "BodyFragment";
private Body min_body; private Body min_body;
private SwipeRefreshLayout bodySwipeRefreshLayout; private SwipeRefreshLayout bodySwipeRefreshLayout;
......
...@@ -30,9 +30,6 @@ public class BodyRecyclerViewFragment extends Fragment implements TransitionTarg ...@@ -30,9 +30,6 @@ public class BodyRecyclerViewFragment extends Fragment implements TransitionTarg
public static final String TAG = "BodyRecyclerViewFragment"; public static final String TAG = "BodyRecyclerViewFragment";
public Fragment parentFragment = null; public Fragment parentFragment = null;
private RecyclerView recyclerView;
private BodyAdapter bodyAdapter;
private List<Body> bodyList; private List<Body> bodyList;
public BodyRecyclerViewFragment() { public BodyRecyclerViewFragment() {
...@@ -74,8 +71,8 @@ public class BodyRecyclerViewFragment extends Fragment implements TransitionTarg ...@@ -74,8 +71,8 @@ public class BodyRecyclerViewFragment extends Fragment implements TransitionTarg
public void onStart() { public void onStart() {
super.onStart(); super.onStart();
recyclerView = (RecyclerView) getActivity().findViewById(R.id.body_recycler_view); RecyclerView recyclerView = (RecyclerView) getActivity().findViewById(R.id.body_recycler_view);
bodyAdapter = new BodyAdapter(bodyList, this); BodyAdapter bodyAdapter = new BodyAdapter(bodyList, this);
bodyAdapter.uid = "BRVFrag"; bodyAdapter.uid = "BRVFrag";
recyclerView.setAdapter(bodyAdapter); recyclerView.setAdapter(bodyAdapter);
recyclerView.setLayoutManager(new LinearLayoutManager(getContext())); recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
......
...@@ -60,7 +60,7 @@ import static android.view.View.VISIBLE; ...@@ -60,7 +60,7 @@ import static android.view.View.VISIBLE;
*/ */
public class CalendarFragment extends BaseFragment { public class CalendarFragment extends BaseFragment {
FloatingActionButton fab; private FloatingActionButton fab;
private View view; private View view;
private FeedAdapter feedAdapter = null; private FeedAdapter feedAdapter = null;
private List<Event> events = new ArrayList<>(); private List<Event> events = new ArrayList<>();
......
...@@ -352,7 +352,7 @@ public class EventFragment extends BackHandledFragment implements TransitionTarg ...@@ -352,7 +352,7 @@ public class EventFragment extends BackHandledFragment implements TransitionTarg
} }
/** Setup button colors depending on status */ /** Setup button colors depending on status */
void setFollowButtons(int status) { private void setFollowButtons(int status) {
// Set colors // Set colors
Utils.setupFollowButton(getContext(), interestedButton, status == Constants.STATUS_INTERESTED); Utils.setupFollowButton(getContext(), interestedButton, status == Constants.STATUS_INTERESTED);
Utils.setupFollowButton(getContext(), goingButton, status == Constants.STATUS_GOING); Utils.setupFollowButton(getContext(), goingButton, status == Constants.STATUS_GOING);
...@@ -362,7 +362,7 @@ public class EventFragment extends BackHandledFragment implements TransitionTarg ...@@ -362,7 +362,7 @@ public class EventFragment extends BackHandledFragment implements TransitionTarg
goingButton.setText(getCountBadgeSpannable("GOING", event.getEventGoingCount())); goingButton.setText(getCountBadgeSpannable("GOING", event.getEventGoingCount()));
} }
View.OnClickListener getUESOnClickListener(final int status) { private View.OnClickListener getUESOnClickListener(final int status) {
return new View.OnClickListener() { return new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
......
...@@ -29,9 +29,6 @@ public class EventRecyclerViewFragment extends Fragment implements TransitionTar ...@@ -29,9 +29,6 @@ public class EventRecyclerViewFragment extends Fragment implements TransitionTar
private static final String TAG = "EventRecyclerViewFragment"; private static final String TAG = "EventRecyclerViewFragment";
public Fragment parentFragment = null; public Fragment parentFragment = null;
private RecyclerView recyclerView;
private FeedAdapter feedAdapter;
private List<Event> eventList; private List<Event> eventList;
public EventRecyclerViewFragment() { public EventRecyclerViewFragment() {
...@@ -72,8 +69,8 @@ public class EventRecyclerViewFragment extends Fragment implements TransitionTar ...@@ -72,8 +69,8 @@ public class EventRecyclerViewFragment extends Fragment implements TransitionTar
public void onStart() { public void onStart() {
super.onStart(); super.onStart();
recyclerView = (RecyclerView) getActivity().findViewById(R.id.event_recycler_view); RecyclerView recyclerView = getActivity().findViewById(R.id.event_recycler_view);
feedAdapter = new FeedAdapter(eventList, this); FeedAdapter feedAdapter = new FeedAdapter(eventList, this);
recyclerView.setAdapter(feedAdapter); recyclerView.setAdapter(feedAdapter);
recyclerView.setLayoutManager(new LinearLayoutManager(getContext())); recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
......
...@@ -282,7 +282,7 @@ public class MapFragment extends Fragment implements TextWatcher, ...@@ -282,7 +282,7 @@ public class MapFragment extends Fragment implements TextWatcher,
}); });
} }
void setupWithData(List<Venue> venues) { private void setupWithData(List<Venue> venues) {
if (getActivity() == null || getView() == null || getContext() == null) return; if (getActivity() == null || getView() == null || getContext() == null) return;
// Setup fade animation for background // Setup fade animation for background
...@@ -502,7 +502,6 @@ public class MapFragment extends Fragment implements TextWatcher, ...@@ -502,7 +502,6 @@ public class MapFragment extends Fragment implements TextWatcher,
@Override @Override
public void onTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) { public void onTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) {
this.setCorrectIcons();
} }
@Override @Override
...@@ -536,7 +535,6 @@ public class MapFragment extends Fragment implements TextWatcher, ...@@ -536,7 +535,6 @@ public class MapFragment extends Fragment implements TextWatcher,
fragmentManager.popBackStack(firstStackTag, fragmentManager.popBackStack(firstStackTag,
FragmentManager.POP_BACK_STACK_INCLUSIVE); FragmentManager.POP_BACK_STACK_INCLUSIVE);
this.removeEditTextFocus(null); this.removeEditTextFocus(null);
this.setCorrectIcons();
this.displayMap(); this.displayMap();
} }
...@@ -898,23 +896,6 @@ public class MapFragment extends Fragment implements TextWatcher, ...@@ -898,23 +896,6 @@ public class MapFragment extends Fragment implements TextWatcher,
} }
} }
private void setCorrectIcons() {
if (noFragments) {
if (this.handleRemoveIcon()) {
this.noIndexButton();
}
} else {
if (fragment instanceof ListFragment) {
if (this.handleRemoveIcon()) {
this.noIndexButton();
}
}
}
}
private void noIndexButton() {
}
private boolean handleRemoveIcon() { private boolean handleRemoveIcon() {
String text = editText.getText().toString(); String text = editText.getText().toString();
return !text.isEmpty(); return !text.isEmpty();
...@@ -932,7 +913,6 @@ public class MapFragment extends Fragment implements TextWatcher, ...@@ -932,7 +913,6 @@ public class MapFragment extends Fragment implements TextWatcher,
} else { } else {
fragmentContainer.setOnTouchListener(null); fragmentContainer.setOnTouchListener(null);
} }
this.setCorrectIcons();
} }
private void hideKeyboard() { private void hideKeyboard() {
...@@ -953,12 +933,10 @@ public class MapFragment extends Fragment implements TextWatcher, ...@@ -953,12 +933,10 @@ public class MapFragment extends Fragment implements TextWatcher,
} }
public void playAnimSound(int sound_index) { public void playAnimSound(int sound_index) {
if (sound_index >= 0 && sound_index < soundPoolIds.length) { if ((sound_index >= 0 && sound_index < soundPoolIds.length) && !settingsManager.isMuted()) {
if (!settingsManager.isMuted()) {
soundPool.play(soundPoolIds[sound_index], 1.0f, 1.0f, 1, 0, 1f); soundPool.play(soundPoolIds[sound_index], 1.0f, 1.0f, 1, 0, 1f);
} }
} }
}
public void playAnimSoundDelayed(int sound_index, long delay) { public void playAnimSoundDelayed(int sound_index, long delay) {
Message msg = mHandler.obtainMessage(MSG_PLAY_SOUND, sound_index, 0); Message msg = mHandler.obtainMessage(MSG_PLAY_SOUND, sound_index, 0);
......
...@@ -40,7 +40,6 @@ public class MessMenuFragment extends BaseFragment { ...@@ -40,7 +40,6 @@ public class MessMenuFragment extends BaseFragment {
private MessMenuAdapter messMenuAdapter; private MessMenuAdapter messMenuAdapter;
private RecyclerView messMenuRecyclerView; private RecyclerView messMenuRecyclerView;
private SwipeRefreshLayout messMenuSwipeRefreshLayout; private SwipeRefreshLayout messMenuSwipeRefreshLayout;
private Spinner hostelSpinner;
private String hostel; private String hostel;
public MessMenuFragment() { public MessMenuFragment() {
...@@ -74,7 +73,7 @@ public class MessMenuFragment extends BaseFragment { ...@@ -74,7 +73,7 @@ public class MessMenuFragment extends BaseFragment {
} }
}); });
hostelSpinner = getActivity().findViewById(R.id.hostel_spinner); Spinner hostelSpinner = getActivity().findViewById(R.id.hostel_spinner);
ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(getContext(), R.array.hostels_array, R.layout.hostel_spinner_item); ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(getContext(), R.array.hostels_array, R.layout.hostel_spinner_item);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
hostelSpinner.setAdapter(adapter); hostelSpinner.setAdapter(adapter);
......
...@@ -24,7 +24,7 @@ import app.insti.api.model.Role; ...@@ -24,7 +24,7 @@ import app.insti.api.model.Role;
* create an instance of this fragment. * create an instance of this fragment.
*/ */
public class RoleRecyclerViewFragment extends Fragment implements TransitionTargetFragment, TransitionTargetChild { public class RoleRecyclerViewFragment extends Fragment implements TransitionTargetFragment, TransitionTargetChild {
private static final String TAG = "RoleRecyclerViewFragment"; public static final String TAG = "RoleRecyclerViewFragment";
public Fragment parentFragment = null; public Fragment parentFragment = null;
private List<Role> roleList; private List<Role> roleList;
......
...@@ -24,8 +24,8 @@ import app.insti.fragment.MapFragment; ...@@ -24,8 +24,8 @@ import app.insti.fragment.MapFragment;
public class FuzzySearchAdapter extends BaseAdapter { public class FuzzySearchAdapter extends BaseAdapter {
Context mContext; private Context mContext;
LayoutInflater inflater; private LayoutInflater inflater;
private List<Marker> resultlist = null; private List<Marker> resultlist = null;
private ArrayList<Marker> inputlist; private ArrayList<Marker> inputlist;
private List<ScoredMarker> map; private List<ScoredMarker> map;
......
...@@ -7,29 +7,21 @@ import android.view.View; ...@@ -7,29 +7,21 @@ import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.ListView; import android.widget.ListView;
import com.mrane.data.Marker;
import java.util.HashMap;
import app.insti.R; import app.insti.R;
import app.insti.fragment.MapFragment; import app.insti.fragment.MapFragment;
public class ListFragment extends Fragment { public class ListFragment extends Fragment {
MapFragment mainActivity;
View rootView;
ListView list;
public ListFragment() { public ListFragment() {
} }
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) { Bundle savedInstanceState) {
mainActivity = MapFragment.getMainActivity(); MapFragment mainActivity = MapFragment.getMainActivity();
final FuzzySearchAdapter adapter = mainActivity.getAdapter(); final FuzzySearchAdapter adapter = mainActivity.getAdapter();
rootView = inflater.inflate(R.layout.map_list_fragment, container, false); View rootView = inflater.inflate(R.layout.map_list_fragment, container, false);
list = (ListView) rootView.findViewById(R.id.suggestion_list); ListView list = rootView.findViewById(R.id.suggestion_list);
list.setAdapter(adapter); list.setAdapter(adapter);
list.setOnItemClickListener(mainActivity); list.setOnItemClickListener(mainActivity);
list.setOnTouchListener(mainActivity); list.setOnTouchListener(mainActivity);
......
package app.insti;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
}
\ No newline at end of file
Markdown is supported
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