Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Mobile] Configured Kotlin. Converted three classes to Kotlin: Messag…
…ingService, NewsActivity, NotifyTimeActivity.
- Loading branch information
1 parent
fc256d1
commit a8ec524
Showing
9 changed files
with
304 additions
and
312 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
97 changes: 0 additions & 97 deletions
97
mobile/src/main/java/org/thecosmicfrog/luasataglance/activity/NewsActivity.java
This file was deleted.
Oops, something went wrong.
93 changes: 93 additions & 0 deletions
93
mobile/src/main/java/org/thecosmicfrog/luasataglance/activity/NewsActivity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
/** | ||
* @author Aaron Hastings | ||
* | ||
* Copyright 2015-2019 Aaron Hastings | ||
* | ||
* This file is part of Luas at a Glance. | ||
* | ||
* Luas at a Glance is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* Luas at a Glance is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with Luas at a Glance. If not, see <http:></http:>//www.gnu.org/licenses/>. | ||
*/ | ||
package org.thecosmicfrog.luasataglance.activity | ||
|
||
import android.graphics.drawable.ColorDrawable | ||
import android.os.Build | ||
import android.os.Bundle | ||
import android.view.WindowManager | ||
import android.webkit.WebSettings | ||
import android.webkit.WebView | ||
import android.webkit.WebViewClient | ||
import androidx.appcompat.app.AppCompatActivity | ||
import androidx.core.content.ContextCompat | ||
import org.thecosmicfrog.luasataglance.R | ||
import org.thecosmicfrog.luasataglance.util.Constant | ||
|
||
class NewsActivity : AppCompatActivity() { | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
|
||
val urlNews = "https://luas.ie/news/" | ||
val urlTravelUpdates = "https://luas.ie/travel-updates/" | ||
|
||
setContentView(R.layout.activity_news) | ||
|
||
/* | ||
* Set ActionBar colour. | ||
*/ | ||
supportActionBar!!.setBackgroundDrawable( | ||
ColorDrawable( | ||
ContextCompat.getColor(application, R.color.luas_purple) | ||
) | ||
) | ||
|
||
/* | ||
* Set status bar colour. | ||
*/ | ||
if (Build.VERSION.SDK_INT >= 21) { | ||
val window = window | ||
|
||
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS) | ||
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS) | ||
window.statusBarColor = ContextCompat.getColor( | ||
applicationContext, | ||
R.color.luas_purple_statusbar | ||
) | ||
} | ||
|
||
/* | ||
* Create a new WebView and explicitly set the WebViewClient. Otherwise, an external | ||
* browser is liable to open. | ||
* Ensure the information is fresh by using no app or web browser cache. | ||
*/ | ||
val webViewNews = findViewById<WebView>(R.id.webview_news) | ||
|
||
webViewNews.settings.setAppCacheEnabled(false) | ||
webViewNews.settings.cacheMode = WebSettings.LOAD_NO_CACHE | ||
webViewNews.webViewClient = WebViewClient() | ||
|
||
/* | ||
* Load either the "Travel Updates" or "News" section of the Luas mobile website. | ||
*/ | ||
if (intent.hasExtra(Constant.NEWS_TYPE)) { | ||
if (intent.getStringExtra(Constant.NEWS_TYPE) == Constant.NEWS_TYPE_TRAVEL_UPDATES) { | ||
title = getString(R.string.title_activity_news_travel_updates) | ||
webViewNews.loadUrl(urlTravelUpdates) | ||
} else { | ||
title = getString(R.string.title_activity_news_luas_news) | ||
webViewNews.loadUrl(urlNews) | ||
} | ||
} | ||
} | ||
} | ||
|
127 changes: 0 additions & 127 deletions
127
mobile/src/main/java/org/thecosmicfrog/luasataglance/activity/NotifyTimeActivity.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.