Permalink
Browse files

Revert "[Trivial] Removed unnecessary type casts since update to SDK …

…26."

This reverts commit 4755b77.
  • Loading branch information...
thecosmicfrog committed Jan 9, 2018
1 parent c5f1960 commit daebb903b666ade9ff18031767401a7a154f969b
Showing with 104 additions and 100 deletions.
  1. +2 −2 mobile/src/main/java/org/thecosmicfrog/luasataglance/activity/AboutActivity.java
  2. +9 −9 mobile/src/main/java/org/thecosmicfrog/luasataglance/activity/FaresActivity.java
  3. +5 −5 mobile/src/main/java/org/thecosmicfrog/luasataglance/activity/FavouritesActivity.java
  4. +2 −2 mobile/src/main/java/org/thecosmicfrog/luasataglance/activity/FavouritesSelectActivity.java
  5. +1 −1 mobile/src/main/java/org/thecosmicfrog/luasataglance/activity/LicenseActivity.java
  6. +8 −8 mobile/src/main/java/org/thecosmicfrog/luasataglance/activity/LineFragment.java
  7. +17 −13 mobile/src/main/java/org/thecosmicfrog/luasataglance/activity/MainActivity.java
  8. +1 −1 mobile/src/main/java/org/thecosmicfrog/luasataglance/activity/NewsActivity.java
  9. +2 −2 mobile/src/main/java/org/thecosmicfrog/luasataglance/activity/NotifyTimeActivity.java
  10. +3 −3 mobile/src/main/java/org/thecosmicfrog/luasataglance/util/StopForecastUtil.java
  11. +1 −1 mobile/src/main/java/org/thecosmicfrog/luasataglance/view/SpinnerCardView.java
  12. +3 −3 mobile/src/main/java/org/thecosmicfrog/luasataglance/view/StatusCardView.java
  13. +18 −18 mobile/src/main/java/org/thecosmicfrog/luasataglance/view/StopForecastCardView.java
  14. +2 −2 mobile/src/main/java/org/thecosmicfrog/luasataglance/view/TutorialCardView.java
  15. +2 −2 mobile/src/main/java/org/thecosmicfrog/luasataglance/widget/StopForecastWidgetConfigureActivity.java
  16. +5 −5 wear/src/main/java/org/thecosmicfrog/luasataglance/activity/FavouritesActivity.java
  17. +2 −2 wear/src/main/java/org/thecosmicfrog/luasataglance/activity/GreenLineActivity.java
  18. +4 −4 wear/src/main/java/org/thecosmicfrog/luasataglance/activity/MainActivity.java
  19. +2 −2 wear/src/main/java/org/thecosmicfrog/luasataglance/activity/RedLineActivity.java
  20. +15 −15 wear/src/main/java/org/thecosmicfrog/luasataglance/activity/StopForecastActivity.java
@@ -52,7 +52,7 @@ protected void onCreate(Bundle savedInstanceState) {
setContentView(R.layout.activity_about);
TextView textViewSourceCode = findViewById(R.id.textview_sourcecode);
TextView textViewSourceCode = (TextView) findViewById(R.id.textview_sourcecode);
textViewSourceCode.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
@@ -64,7 +64,7 @@ public void onClick(View view) {
}
});
TextView textViewLicense = findViewById(R.id.textview_license);
TextView textViewLicense = (TextView) findViewById(R.id.textview_license);
textViewLicense.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
@@ -100,10 +100,10 @@ private void initializeActivity() {
/* Instantiate a new StopNameIdMap. */
mapStopNameId = new StopNameIdMap(localeDefault);
scrollViewFares = findViewById(R.id.scrollview_fares);
scrollViewFares = (ScrollView) findViewById(R.id.scrollview_fares);
spinnerFaresLine =
findViewById(R.id.spinner_fares_line);
(Spinner) findViewById(R.id.spinner_fares_line);
spinnerFaresLine.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> adapterView, View view, int position,
@@ -137,7 +137,7 @@ public void onNothingSelected(AdapterView<?> adapterView) {
});
spinnerFaresOrigin =
findViewById(R.id.spinner_fares_origin);
(Spinner) findViewById(R.id.spinner_fares_origin);
spinnerFaresOrigin.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
@@ -150,7 +150,7 @@ public void onNothingSelected(AdapterView<?> adapterView) {
});
spinnerFaresDestination =
findViewById(R.id.spinner_fares_destination);
(Spinner) findViewById(R.id.spinner_fares_destination);
spinnerFaresDestination.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
@@ -163,7 +163,7 @@ public void onNothingSelected(AdapterView<?> adapterView) {
});
spinnerFaresAdults =
findViewById(R.id.spinner_fares_adults);
(Spinner) findViewById(R.id.spinner_fares_adults);
spinnerFaresAdults.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
@@ -176,7 +176,7 @@ public void onNothingSelected(AdapterView<?> adapterView) {
});
spinnerFaresChildren =
findViewById(R.id.spinner_fares_children);
(Spinner) findViewById(R.id.spinner_fares_children);
spinnerFaresChildren.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
@@ -229,9 +229,9 @@ protected void onResume() {
setIsLoading(false);
textViewFaresOffPeak =
findViewById(R.id.textview_fares_offpeak);
(TextView) findViewById(R.id.textview_fares_offpeak);
textViewFaresPeak =
findViewById(R.id.textview_fares_peak);
(TextView) findViewById(R.id.textview_fares_peak);
}
/**
@@ -361,7 +361,7 @@ private void clearCalculatedFares() {
* @param loading Whether or not progress bar should animate.
*/
private void setIsLoading(final boolean loading) {
final ProgressBar progressBarFares = findViewById(R.id.progressbar_fares);
final ProgressBar progressBarFares = (ProgressBar) findViewById(R.id.progressbar_fares);
runOnUiThread(new Runnable() {
@Override
@@ -72,7 +72,7 @@ protected void onCreate(Bundle savedInstanceState) {
setContentView(R.layout.activity_favourites);
ImageButton buttonEdit = findViewById(R.id.imagebutton_edit);
ImageButton buttonEdit = (ImageButton) findViewById(R.id.imagebutton_edit);
buttonEdit.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
@@ -95,7 +95,7 @@ public void onClick(View v) {
/*
* Populate ListView with the user's favourite stops, as read from file.
*/
ListView listViewFavouriteStops = findViewById(
ListView listViewFavouriteStops = (ListView) findViewById(
R.id.listview_favourite_stops
);
@@ -138,7 +138,7 @@ protected void onResume() {
super.onResume();
TextView textViewFavouritesNoneSelected
= findViewById(R.id.textview_favourites_none_selected);
= (TextView) findViewById(R.id.textview_favourites_none_selected);
textViewFavouritesNoneSelected.setVisibility(View.GONE);
/*
@@ -160,7 +160,7 @@ public void run() {
/*
* Populate ListView with the user's favourite stops, as read from file.
*/
ListView listViewFavouriteStops = findViewById(
ListView listViewFavouriteStops = (ListView) findViewById(
R.id.listview_favourite_stops
);
@@ -211,7 +211,7 @@ public void run() {
Log.i(LOG_TAG, "Favourites not yet set up.");
TextView textViewFavouritesNoneSelected
= findViewById(R.id.textview_favourites_none_selected);
= (TextView) findViewById(R.id.textview_favourites_none_selected);
textViewFavouritesNoneSelected.setVisibility(View.VISIBLE);
} catch (IOException e) {
/*
@@ -101,7 +101,7 @@ protected void onCreate(Bundle savedInstanceState) {
/*
* Populate ListView with all stops on both lines.
*/
final ListView listViewStops = findViewById(R.id.listview_stops);
final ListView listViewStops = (ListView) findViewById(R.id.listview_stops);
listViewStops.setAdapter(adapterFavouriteStops);
listViewStops.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
@@ -127,7 +127,7 @@ public void onItemClick(AdapterView<?> parent, View view, int position, long id)
* Use a Floating Action Button (FAB) to save the selected Favourites.
*/
FloatingActionButton fabFavouritesSave =
findViewById(R.id.fab_favourites_save);
(FloatingActionButton) findViewById(R.id.fab_favourites_save);
fabFavouritesSave.setBackgroundTintList(
ColorStateList.valueOf(ContextCompat.getColor(this, R.color.message_success))
);
@@ -43,7 +43,7 @@ protected void onCreate(Bundle savedInstanceState) {
setContentView(R.layout.activity_license);
TextView textViewLicenseContent = findViewById(R.id.textview_license_content);
TextView textViewLicenseContent = (TextView) findViewById(R.id.textview_license_content);
InputStream inputStream = getResources().openRawResource(R.raw.license);
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
@@ -367,15 +367,15 @@ private void initFragmentVars() {
* Initialise Fragment and its views.
*/
private boolean initFragment() {
tabLayout = getActivity().findViewById(R.id.tablayout);
tabLayout = (TabLayout) getActivity().findViewById(R.id.tablayout);
progressBar = rootView.findViewById(resProgressBar);
progressBar = (ProgressBar) rootView.findViewById(resProgressBar);
setIsLoading(false);
/* Set up Spinner and onItemSelectedListener. */
spinnerCardView =
rootView.findViewById(resSpinnerCardView);
(SpinnerCardView) rootView.findViewById(resSpinnerCardView);
spinnerCardView.setLine(line);
spinnerCardView.getSpinnerStops().setOnItemSelectedListener(
@@ -443,11 +443,11 @@ public void onNothingSelected(AdapterView<?> parent) {
/* Set up Status CardView. */
statusCardView =
rootView.findViewById(resStatusCardView);
(StatusCardView) rootView.findViewById(resStatusCardView);
/* Set up SwipeRefreshLayout. */
swipeRefreshLayout =
rootView.findViewById(resSwipeRefreshLayout);
(SwipeRefreshLayout) rootView.findViewById(resSwipeRefreshLayout);
swipeRefreshLayout.setOnRefreshListener(
new SwipeRefreshLayout.OnRefreshListener() {
@Override
@@ -464,19 +464,19 @@ public void onRefresh() {
}
);
scrollView = rootView.findViewById(resScrollView);
scrollView = (ScrollView) rootView.findViewById(resScrollView);
/* Set up stop forecast CardViews. */
inboundStopForecastCardView =
rootView.findViewById(
(StopForecastCardView) rootView.findViewById(
resInboundStopForecastCardView
);
inboundStopForecastCardView.setStopForecastDirection(
getString(R.string.inbound)
);
outboundStopForecastCardView =
rootView.findViewById(
(StopForecastCardView) rootView.findViewById(
resOutboundStopForecastCardView
);
outboundStopForecastCardView.setStopForecastDirection(
@@ -78,8 +78,8 @@ protected void onCreate(Bundle savedInstanceState) {
/*
* Initialise ViewPager and TabLayout.
*/
final ViewPager viewPager = findViewById(R.id.viewpager);
final TabLayout tabLayout = findViewById(R.id.tablayout);
final ViewPager viewPager = (ViewPager) findViewById(R.id.viewpager);
final TabLayout tabLayout = (TabLayout) findViewById(R.id.tablayout);
if (tabLayout != null && viewPager != null) {
tabLayout.addTab(
@@ -133,7 +133,7 @@ public void onTabReselected(TabLayout.Tab tab) {
* Bottom navigation bar - Luas Map.
*/
RelativeLayout relativeLayoutBottomNavMap =
findViewById(R.id.relativelayout_bottomnav_map);
(RelativeLayout) findViewById(R.id.relativelayout_bottomnav_map);
if (relativeLayoutBottomNavMap != null) {
relativeLayoutBottomNavMap.setOnClickListener(new View.OnClickListener() {
@Override
@@ -178,13 +178,13 @@ public void onClick(View v) {
* Bottom navigation bar - Favourites.
*/
RelativeLayout relativeLayoutBottomNavFavourites =
findViewById(R.id.relativelayout_bottomnav_favourites);
(RelativeLayout) findViewById(R.id.relativelayout_bottomnav_favourites);
if (relativeLayoutBottomNavFavourites != null) {
relativeLayoutBottomNavFavourites.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
TutorialCardView tutorialCardViewFavourites =
findViewById(R.id.tutorialcardview_favourites);
(TutorialCardView) findViewById(R.id.tutorialcardview_favourites);
if (tutorialCardViewFavourites != null) {
tutorialCardViewFavourites.setVisibility(View.GONE);
}
@@ -210,7 +210,7 @@ public void onClick(View v) {
* Bottom navigation bar - Fares.
*/
RelativeLayout relativeLayoutBottomNavFares =
findViewById(R.id.relativelayout_bottomnav_fares);
(RelativeLayout) findViewById(R.id.relativelayout_bottomnav_fares);
if (relativeLayoutBottomNavFares != null) {
relativeLayoutBottomNavFares.setOnClickListener(new View.OnClickListener() {
@Override
@@ -236,7 +236,7 @@ public void onClick(View v) {
* Bottom navigation bar - Alerts.
*/
RelativeLayout relativeLayoutBottomNavAlerts =
findViewById(R.id.relativelayout_bottomnav_alerts);
(RelativeLayout) findViewById(R.id.relativelayout_bottomnav_alerts);
if (relativeLayoutBottomNavAlerts != null) {
relativeLayoutBottomNavAlerts.setOnClickListener(new View.OnClickListener() {
@Override
@@ -257,8 +257,8 @@ public void onClick(View v) {
});
}
imageViewBottomNavAlerts = findViewById(R.id.imageview_bottomnav_alerts);
textViewBottomNavAlerts = findViewById(R.id.textview_bottomnav_alerts);
imageViewBottomNavAlerts = (ImageView) findViewById(R.id.imageview_bottomnav_alerts);
textViewBottomNavAlerts = (TextView) findViewById(R.id.textview_bottomnav_alerts);
showWhatsNewDialog();
}
@@ -284,10 +284,14 @@ private void adjustBottomNavByScreen() {
Log.i(LOG_TAG, "Screen density is " + DENSITY_DPI + " DPI.");
textViewBottomNavMap = findViewById(R.id.textview_bottomnav_map);
textViewBottomNavFavourites = findViewById(R.id.textview_bottomnav_favourites);
textViewBottomNavFares = findViewById(R.id.textview_bottomnav_fares);
textViewBottomNavAlerts = findViewById(R.id.textview_bottomnav_alerts);
textViewBottomNavMap =
(TextView) findViewById(R.id.textview_bottomnav_map);
textViewBottomNavFavourites =
(TextView) findViewById(R.id.textview_bottomnav_favourites);
textViewBottomNavFares =
(TextView) findViewById(R.id.textview_bottomnav_fares);
textViewBottomNavAlerts =
(TextView) findViewById(R.id.textview_bottomnav_alerts);
/*
* If the screen density is particularly low, or if the number of lines in the bottom
@@ -71,7 +71,7 @@ protected void onCreate(Bundle savedInstanceState) {
* Create a new WebView and explicitly set the WebViewClient. Otherwise, an external
* browser is liable to open.
*/
WebView webViewNews = findViewById(R.id.webview_news);
WebView webViewNews = (WebView) findViewById(R.id.webview_news);
webViewNews.setWebViewClient(new WebViewClient());
/*
@@ -74,7 +74,7 @@ protected void onCreate(Bundle savedInstanceState) {
mapNotifyTimes = new NotifyTimesMap(localeDefault, DIALOG);
final Spinner spinnerNotifyTime = findViewById(R.id.spinner_notifytime);
final Spinner spinnerNotifyTime = (Spinner) findViewById(R.id.spinner_notifytime);
ArrayAdapter adapterNotifyTime = ArrayAdapter.createFromResource(
getApplicationContext(), R.array.array_notifytime_mins, R.layout.spinner_notify_time
);
@@ -90,7 +90,7 @@ protected void onCreate(Bundle savedInstanceState) {
);
spinnerNotifyTime.setBackground(spinnerDrawable);
Button buttonNotifyTime = findViewById(R.id.button_notifytime);
Button buttonNotifyTime = (Button) findViewById(R.id.button_notifytime);
buttonNotifyTime.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
@@ -49,7 +49,7 @@ public static void displayTutorial(View rootView, String line, String tutorial,
switch (tutorial) {
case Constant.TUTORIAL_SELECT_STOP:
TutorialCardView tutorialCardViewSelectStop =
rootView.findViewById(
(TutorialCardView) rootView.findViewById(
R.id.tutorialcardview_select_stop
);
@@ -84,7 +84,7 @@ public static void displayTutorial(View rootView, String line, String tutorial,
case Constant.TUTORIAL_NOTIFICATIONS:
TutorialCardView tutorialCardViewNotifications =
rootView.findViewById(
(TutorialCardView) rootView.findViewById(
R.id.tutorialcardview_notifications
);
@@ -117,7 +117,7 @@ public static void displayTutorial(View rootView, String line, String tutorial,
case Constant.TUTORIAL_FAVOURITES:
TutorialCardView tutorialCardViewFavourites =
rootView.findViewById(
(TutorialCardView) rootView.findViewById(
R.id.tutorialcardview_favourites
);
@@ -65,7 +65,7 @@ public SpinnerCardView(Context context, AttributeSet attrs, int defStyleAttr) {
public void init(Context context) {
inflate(context, R.layout.cardview_spinner, this);
spinnerStops = findViewById(R.id.card_view_spinner);
spinnerStops = (Spinner) findViewById(R.id.card_view_spinner);
/*
* Set the Spinner's colour to Luas purple.
@@ -60,12 +60,12 @@ public StatusCardView(Context context, AttributeSet attrs, int defStyleAttr) {
public void init(Context context) {
inflate(context, R.layout.cardview_status, this);
textViewStatusTitle = findViewById(R.id.textview_status_title);
textViewStatus = findViewById(R.id.textview_status);
textViewStatusTitle = (TextView) findViewById(R.id.textview_status_title);
textViewStatus = (TextView) findViewById(R.id.textview_status);
}
public void setStatus(String status) {
textViewStatus = findViewById(R.id.textview_status);
textViewStatus = (TextView) findViewById(R.id.textview_status);
textViewStatus.setText(status);
}
Oops, something went wrong.

0 comments on commit daebb90

Please sign in to comment.