removed log calls and dupes comments

remotes/origin/devel
yattoz 2020-01-12 02:22:29 +01:00
parent f133bea0ac
commit 4769b2f0bf
15 changed files with 51 additions and 51 deletions

View File

@ -13,7 +13,7 @@ class Async(val handler: (Any?) -> Any?, val post: (Any?) -> Unit = {},
execute()
} catch (e: Exception)
{
//[REMOVE LOG CALLS]//[REMOVE LOG CALLS]//[REMOVE LOG CALLS]Log.d(tag,e.toString())
//[REMOVE LOG CALLS]Log.d(tag,e.toString())
}
}
@ -46,14 +46,14 @@ class Async(val handler: (Any?) -> Any?, val post: (Any?) -> Unit = {},
}
//[REMOVE LOG CALLS]//[REMOVE LOG CALLS]Log.d(tag, "fallback for no network. Store reset : $storeReset")
//[REMOVE LOG CALLS]Log.d(tag, "fallback for no network. Store reset : $storeReset")
}
override fun doInBackground(vararg params: Any?): Any? {
try {
return handler(parameters)
} catch (e: Exception) {
//[REMOVE LOG CALLS]//[REMOVE LOG CALLS]Log.d(tag,e.toString())
//[REMOVE LOG CALLS]Log.d(tag,e.toString())
onException(e)
}
return null
@ -63,7 +63,7 @@ class Async(val handler: (Any?) -> Any?, val post: (Any?) -> Unit = {},
try {
post(result)
} catch (e: Exception) {
//[REMOVE LOG CALLS]//[REMOVE LOG CALLS]Log.d(tag,e.toString())
//[REMOVE LOG CALLS]Log.d(tag,e.toString())
onException(e)
}
}

View File

@ -21,7 +21,7 @@ abstract class BaseActivity : AppCompatActivity() {
val height = ((rootLayout?.height ?: 0))
val width = ((rootLayout?.width ?: 0))
//[REMOVE LOG CALLS]//[REMOVE LOG CALLS]Log.d(tag, "$viewWidth, $viewHeight, $width, $height, ${viewHeight.toDouble()/viewWidth.toDouble()}, ${height.toDouble()/width.toDouble()}")
//[REMOVE LOG CALLS]Log.d(tag, "$viewWidth, $viewHeight, $width, $height, ${viewHeight.toDouble()/viewWidth.toDouble()}, ${height.toDouble()/width.toDouble()}")
val broadcastManager = LocalBroadcastManager.getInstance(this@BaseActivity)
if(height <= viewHeight * 2 / 3 /*height.toDouble()/width.toDouble() < 1.20 */){
@ -49,14 +49,14 @@ abstract class BaseActivity : AppCompatActivity() {
// do things when keyboard is shown
val bottomNavigationView = findViewById<BottomNavigationView>(R.id.bottom_nav)
bottomNavigationView.visibility = View.GONE
//[REMOVE LOG CALLS]//[REMOVE LOG CALLS]Log.d(tag, "bottomNav visibility set to GONE (height $keyboardHeight)")
//[REMOVE LOG CALLS]Log.d(tag, "bottomNav visibility set to GONE (height $keyboardHeight)")
}
private fun onHideKeyboard() {
// do things when keyboard is hidden
val bottomNavigationView = findViewById<BottomNavigationView>(R.id.bottom_nav)
bottomNavigationView.visibility = View.VISIBLE
//[REMOVE LOG CALLS]//[REMOVE LOG CALLS]Log.d(tag, "bottomNav visibility set to VISIBLE")
//[REMOVE LOG CALLS]Log.d(tag, "bottomNav visibility set to VISIBLE")
}
protected fun attachKeyboardListeners() {

View File

@ -12,7 +12,7 @@ import fr.forum_thalie.tsumugi.playerstore.PlayerStore
class BootBroadcastReceiver : BroadcastReceiver(){
override fun onReceive(context: Context, arg1: Intent) {
//[REMOVE LOG CALLS]//[REMOVE LOG CALLS]//[REMOVE LOG CALLS]Log.d(tag, "Broadcast Receiver received $arg1")
//[REMOVE LOG CALLS]Log.d(tag, "Broadcast Receiver received $arg1")
// define preferenceStore for places of the program that needs to access Preferences without a context
preferenceStore = PreferenceManager.getDefaultSharedPreferences(context)

View File

@ -138,7 +138,7 @@ class MainActivity : BaseActivity() {
// Post-UI Launch
if (PlayerStore.instance.isInitialized)
{
//[REMOVE LOG CALLS]//[REMOVE LOG CALLS]Log.d(tag, "skipped initialization")
//[REMOVE LOG CALLS]Log.d(tag, "skipped initialization")
} else {
// if the service is not started, start it in STOP mode.
// It's not a dummy action : with STOP mode, the player does not buffer audio (and does not use data connection without the user's consent).
@ -196,7 +196,7 @@ class MainActivity : BaseActivity() {
val i = Intent(this, RadioService::class.java)
i.putExtra("action", a.name)
i.putExtra("value", v)
//[REMOVE LOG CALLS]//[REMOVE LOG CALLS]Log.d(tag, "Sending intent ${a.name}")
//[REMOVE LOG CALLS]Log.d(tag, "Sending intent ${a.name}")
startService(i)
}
@ -241,7 +241,7 @@ class MainActivity : BaseActivity() {
// File(getExternalFilesDir(Environment.DIRECTORY_DOCUMENTS) + "/MyPersonalAppFolder")
val logDirectory = File("$appDirectory/log")
val logFile = File(logDirectory, "logcat" + System.currentTimeMillis() + ".txt")
//[REMOVE LOG CALLS]//[REMOVE LOG CALLS]Log.d(
//[REMOVE LOG CALLS]Log.d(
tag,
"appDirectory : $appDirectory, logDirectory : $logDirectory, logFile : $logFile"
)
@ -249,20 +249,20 @@ class MainActivity : BaseActivity() {
// create app folder
if (!appDirectory.exists()) {
appDirectory.mkdir()
//[REMOVE LOG CALLS]//[REMOVE LOG CALLS]Log.d(tag, "$appDirectory created")
//[REMOVE LOG CALLS]Log.d(tag, "$appDirectory created")
}
// create log folder
if (!logDirectory.exists()) {
logDirectory.mkdir()
//[REMOVE LOG CALLS]//[REMOVE LOG CALLS]Log.d(tag, "$logDirectory created")
//[REMOVE LOG CALLS]Log.d(tag, "$logDirectory created")
}
// clear the previous logcat and then write the new one to the file
try {
Runtime.getRuntime().exec("logcat -c")
Runtime.getRuntime().exec("logcat -v time -f $logFile *:E $tag:V ")
//[REMOVE LOG CALLS]//[REMOVE LOG CALLS]Log.d(tag, "logcat started")
//[REMOVE LOG CALLS]Log.d(tag, "logcat started")
} catch (e: IOException) {
e.printStackTrace()
}

View File

@ -68,14 +68,14 @@ class RadioService : MediaBrowserServiceCompat() {
// This *should* work in any case...
when (intent.getIntExtra("state", -1)) {
0 -> {
//[REMOVE LOG CALLS]//[REMOVE LOG CALLS]Log.d(tag, radioTag + "Headset is unplugged")
//[REMOVE LOG CALLS]Log.d(tag, radioTag + "Headset is unplugged")
}
1 -> {
//[REMOVE LOG CALLS]//[REMOVE LOG CALLS]Log.d(tag, radioTag + "Headset is plugged")
//[REMOVE LOG CALLS]Log.d(tag, radioTag + "Headset is plugged")
headsetPluggedIn = true
}
else -> {
//[REMOVE LOG CALLS]//[REMOVE LOG CALLS]Log.d(tag, radioTag + "I have no idea what the headset state is")
//[REMOVE LOG CALLS]Log.d(tag, radioTag + "I have no idea what the headset state is")
}
}
/*
@ -91,7 +91,7 @@ class RadioService : MediaBrowserServiceCompat() {
}
else
{
//[REMOVE LOG CALLS]//[REMOVE LOG CALLS]Log.d(tag, radioTag + "Can't get state?")
//[REMOVE LOG CALLS]Log.d(tag, radioTag + "Can't get state?")
}
*/
@ -127,7 +127,7 @@ class RadioService : MediaBrowserServiceCompat() {
if (PlayerStore.instance.playbackState.value == PlaybackStateCompat.STATE_PLAYING)
{
Log.d(tag, radioTag + "SONG CHANGED AND PLAYING")
//[REMOVE LOG CALLS]Log.d((tag, radioTag + "SONG CHANGED AND PLAYING")
// we activate latency compensation only if it's been at least 2 songs...
when {
PlayerStore.instance.isStreamDown -> {
@ -233,7 +233,7 @@ class RadioService : MediaBrowserServiceCompat() {
startForeground(radioServiceId, nowPlayingNotification.notification)
PlayerStore.instance.isServiceStarted.value = true
//[REMOVE LOG CALLS]//[REMOVE LOG CALLS]Log.d(tag, radioTag + "created")
//[REMOVE LOG CALLS]Log.d(tag, radioTag + "created")
}
private val handler = Handler()
@ -274,7 +274,7 @@ class RadioService : MediaBrowserServiceCompat() {
Actions.CANCEL_FADE_OUT.name -> { handler.removeCallbacks(lowerVolumeRunnable) }
Actions.SNOOZE.name -> { RadioAlarm.instance.snooze(this) }
}
//[REMOVE LOG CALLS]//[REMOVE LOG CALLS]Log.d(tag, radioTag + "intent received : " + intent.getStringExtra("action"))
//[REMOVE LOG CALLS]Log.d(tag, radioTag + "intent received : " + intent.getStringExtra("action"))
super.onStartCommand(intent, flags, startId)
// The service must be re-created if it is destroyed by the system. This allows the user to keep actions like Bluetooth and headphones plug available.
return START_STICKY
@ -286,7 +286,7 @@ class RadioService : MediaBrowserServiceCompat() {
stopSelf()
}
super.onTaskRemoved(rootIntent)
//[REMOVE LOG CALLS]//[REMOVE LOG CALLS]Log.d(tag, radioTag + "task removed")
//[REMOVE LOG CALLS]Log.d(tag, radioTag + "task removed")
}
override fun onDestroy() {
@ -318,7 +318,7 @@ class RadioService : MediaBrowserServiceCompat() {
}
apiTicker.cancel() // stops the timer.
//[REMOVE LOG CALLS]//[REMOVE LOG CALLS]Log.d(tag, radioTag + "destroyed")
//[REMOVE LOG CALLS]Log.d(tag, radioTag + "destroyed")
// if the service is destroyed, the application had become useless.
exitProcess(0)
}
@ -389,10 +389,10 @@ class RadioService : MediaBrowserServiceCompat() {
for (i in 0 until it.length()) {
val entry = it.get(i)
if (entry is IcyHeaders) {
//[REMOVE LOG CALLS]//[REMOVE LOG CALLS]Log.d(tag, radioTag + "onMetadata: IcyHeaders $entry")
//[REMOVE LOG CALLS]Log.d(tag, radioTag + "onMetadata: IcyHeaders $entry")
}
if (entry is IcyInfo) {
//[REMOVE LOG CALLS]//[REMOVE LOG CALLS]Log.d(tag, radioTag + "onMetadata: Title ----> ${entry.title}")
//[REMOVE LOG CALLS]Log.d(tag, radioTag + "onMetadata: Title ----> ${entry.title}")
// Note : Kotlin supports UTF-8 by default.
numberOfSongs++
val data = entry.title!!
@ -467,7 +467,7 @@ class RadioService : MediaBrowserServiceCompat() {
{
Thread.sleep(1000)
i++
//[REMOVE LOG CALLS]//[REMOVE LOG CALLS]Log.d(tag, "$i, isAlarmStopped=$isAlarmStopped")
//[REMOVE LOG CALLS]Log.d(tag, "$i, isAlarmStopped=$isAlarmStopped")
}
}
val post: (Any?) -> Unit = {
@ -540,7 +540,7 @@ class RadioService : MediaBrowserServiceCompat() {
SystemClock.elapsedRealtime()
)
mediaSession.setPlaybackState(playbackStateBuilder.build())
//[REMOVE LOG CALLS]//[REMOVE LOG CALLS]Log.d(tag, radioTag + "begin playing")
//[REMOVE LOG CALLS]Log.d(tag, radioTag + "begin playing")
}
private fun pausePlaying()
@ -569,7 +569,7 @@ class RadioService : MediaBrowserServiceCompat() {
1.0f,
SystemClock.elapsedRealtime()
)
//[REMOVE LOG CALLS]//[REMOVE LOG CALLS]Log.d(tag, radioTag + "stopped")
//[REMOVE LOG CALLS]Log.d(tag, radioTag + "stopped")
mediaSession.setPlaybackState(playbackStateBuilder.build())
}
@ -657,7 +657,7 @@ class RadioService : MediaBrowserServiceCompat() {
Player.STATE_ENDED -> state = "Player.STATE_ENDED"
Player.STATE_READY -> state = "Player.STATE_READY"
}
//[REMOVE LOG CALLS]//[REMOVE LOG CALLS]Log.d(tag, radioTag + "Player changed state: ${state}. numberOfSongs reset.")
//[REMOVE LOG CALLS]Log.d(tag, radioTag + "Player changed state: ${state}. numberOfSongs reset.")
}
}

View File

@ -97,7 +97,7 @@ class RadioAlarm {
calendar.isLenient = true
calendar.set(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), calendar.get(Calendar.DAY_OF_MONTH) + i, hourOfDay, minute)
//[REMOVE LOG CALLS]//[REMOVE LOG CALLS]Log.d(tag, calendar.toString())
//[REMOVE LOG CALLS]Log.d(tag, calendar.toString())
return calendar.timeInMillis

View File

@ -61,7 +61,7 @@ class RadioSleeper {
AlarmManagerCompat.setExactAndAllowWhileIdle(alarmManager, AlarmManager.RTC_WAKEUP, currentMillis + (minutes * 60 * 1000) - (1 * 60 * 1000), fadeOutIntent)
sleepAtMillis.value = System.currentTimeMillis() + (minutes * 60 * 1000) - 1 // this -1 allows to round the division for display at the right integer
//[REMOVE LOG CALLS]//[REMOVE LOG CALLS]Log.d(tag, "set sleep to $minutes minutes")
//[REMOVE LOG CALLS]Log.d(tag, "set sleep to $minutes minutes")
}
}
@ -79,7 +79,7 @@ class RadioSleeper {
c.startService(cancelFadeOutIntent)
}
//[REMOVE LOG CALLS]//[REMOVE LOG CALLS]Log.d(tag, "cancelled sleep")
//[REMOVE LOG CALLS]Log.d(tag, "cancelled sleep")
sleepAtMillis.value = null
}
}

View File

@ -35,7 +35,7 @@ class Programme (val title: String, private val periodicity: Int, private val ho
val isSpanningOverNight =
(((0b1000000 shr ((currentDay - 1) % 7) and (periodicity)) != 0) && hourEnd < hourBegin)
//[REMOVE LOG CALLS]//[REMOVE LOG CALLS]Log.d(tag, "$title is today: $isToday or spanning $isSpanningOverNight")
//[REMOVE LOG CALLS]Log.d(tag, "$title is today: $isToday or spanning $isSpanningOverNight")
// shr = shift-right. It's a binary mask.
// if the program started yesterday, and spanned over night, it means that there could be a chance that it's still active.
@ -87,6 +87,6 @@ class Programme (val title: String, private val periodicity: Int, private val ho
*/
init {
//[REMOVE LOG CALLS]//[REMOVE LOG CALLS]Log.d(tag, this.toString())
//[REMOVE LOG CALLS]Log.d(tag, this.toString())
}
}

View File

@ -97,14 +97,14 @@ class PlayerStore {
if(isCompensatingLatency)
{
latencyCompensator = getTimestamp(res.getJSONObject("station").getString("schedulerTime")) - (currentSong.startTime.value ?: getTimestamp(res.getJSONObject("station").getString("schedulerTime")))
Log.d(tag, "latency compensator set to ${(latencyCompensator).toFloat()/1000} s")
//[REMOVE LOG CALLS]Log.d((tag, "latency compensator set to ${(latencyCompensator).toFloat()/1000} s")
}
currentTime.value = getTimestamp(res.getJSONObject("station").getString("schedulerTime")) - (latencyCompensator)
/*
val listeners = resMain.getInt("listeners")
listenersCount.value = listeners
Log.d(tag, playerStoreTag + "store updated")
//[REMOVE LOG CALLS]Log.d((tag, playerStoreTag + "store updated")
*/
}
@ -165,13 +165,13 @@ class PlayerStore {
fun updateQueue() {
if (queue.isNotEmpty()) {
queue.remove(queue.first())
Log.d(tag, queue.toString())
//[REMOVE LOG CALLS]Log.d((tag, queue.toString())
fetchLastRequest()
isQueueUpdated.value = true
} else if (isInitialized) {
fetchLastRequest()
} else {
Log.d(tag, "queue is empty! fetching anyway !!")
//[REMOVE LOG CALLS]Log.d((tag, "queue is empty! fetching anyway !!")
fetchLastRequest()
}
}
@ -185,7 +185,7 @@ class PlayerStore {
lp.add(0, n)
currentSongBackup.copy(currentSong)
isLpUpdated.value = true
//[REMOVE LOG CALLS]//[REMOVE LOG CALLS]Log.d(tag, playerStoreTag + lp.toString())
//[REMOVE LOG CALLS]Log.d(tag, playerStoreTag + lp.toString())
//}
}
@ -231,11 +231,11 @@ class PlayerStore {
val t = extractSong(queueJSON)
if (queue.isNotEmpty() && t == queue.last())
{
Log.d(tag, playerStoreTag + "Song already in there: $t")
//[REMOVE LOG CALLS]Log.d((tag, playerStoreTag + "Song already in there: $t")
Async(sleepScrape, post)
} else {
queue.add(queue.size, t)
Log.d(tag, playerStoreTag + "added last queue song: $t")
//[REMOVE LOG CALLS]Log.d(tag, playerStoreTag + "added last queue song: $t")
isQueueUpdated.value = true
}
}

View File

@ -43,9 +43,9 @@ class NewsFragment : Fragment() {
}
newsViewModel.isWebViewLoaded = true
//[REMOVE LOG CALLS]//[REMOVE LOG CALLS]Log.d(tag, "webview created")
//[REMOVE LOG CALLS]Log.d(tag, "webview created")
} else {
//[REMOVE LOG CALLS]//[REMOVE LOG CALLS]Log.d(tag, "webview already created!?")
//[REMOVE LOG CALLS]Log.d(tag, "webview already created!?")
}
newsViewModel.root.addOnLayoutChangeListener(orientationLayoutListener)
@ -101,7 +101,7 @@ class NewsFragment : Fragment() {
ViewModelProviders.of(this).get(NewsViewModel::class.java)
newsViewModel.fetch(c = context!!, isPreloading = true)
//[REMOVE LOG CALLS]//[REMOVE LOG CALLS]Log.d(tag, "news fetched onCreate")
//[REMOVE LOG CALLS]Log.d(tag, "news fetched onCreate")
super.onCreate(savedInstanceState)
}
}

View File

@ -43,14 +43,14 @@ class NewsViewModel : ViewModel() {
val maxNumberOfArticles = 5
coroutineScope.launch(Dispatchers.Main) {
//[REMOVE LOG CALLS]//[REMOVE LOG CALLS]Log.d(tag, "launching coroutine")
//[REMOVE LOG CALLS]Log.d(tag, "launching coroutine")
val parser = Parser()
try {
val articleList = parser.getArticles(urlToScrape)
newsArray.clear()
for (i in 0 until min(articleList.size, maxNumberOfArticles)) {
val item = articleList[i]
//[REMOVE LOG CALLS]//[REMOVE LOG CALLS]Log.d(tag, "i = $i / ${articleList.size}")
//[REMOVE LOG CALLS]Log.d(tag, "i = $i / ${articleList.size}")
val news = News()
news.title = item.title ?: ""
news.link = item.link ?: urlToScrape
@ -60,7 +60,7 @@ class NewsViewModel : ViewModel() {
val formatter6 = SimpleDateFormat(newsDateTimePattern, Locale.ENGLISH)
val dateString = item.pubDate.toString()
//[REMOVE LOG CALLS]//[REMOVE LOG CALLS]Log.d(tag, "$news --- $dateString")
//[REMOVE LOG CALLS]Log.d(tag, "$news --- $dateString")
news.date = formatter6.parse(dateString) ?: Date(0)

View File

@ -275,7 +275,7 @@ class NowPlayingFragment : Fragment() {
(viewHeight*100)/viewWidth
else
100
//[REMOVE LOG CALLS]//[REMOVE LOG CALLS]Log.d(tag, "orientation set")
//[REMOVE LOG CALLS]Log.d(tag, "orientation set")
}
override fun onResume() {

View File

@ -41,7 +41,7 @@ class ProgrammeFragment : Fragment() {
val tabLayout : TabLayout = root.findViewById(R.id.dayTabLayout)
tabLayout.setupWithViewPager(viewPager)
//[REMOVE LOG CALLS]//[REMOVE LOG CALLS]Log.d(tag, "SongFragment view created")
//[REMOVE LOG CALLS]Log.d(tag, "SongFragment view created")
return root
}

View File

@ -39,7 +39,7 @@ class SongsFragment : Fragment() {
val tabLayout : TabLayout = root.findViewById(R.id.tabLayout)
tabLayout.setupWithViewPager(viewPager)
//[REMOVE LOG CALLS]//[REMOVE LOG CALLS]Log.d(tag, "SongFragment view created")
//[REMOVE LOG CALLS]Log.d(tag, "SongFragment view created")
return root
}

View File

@ -31,7 +31,7 @@ class LastPlayedFragment : Fragment() {
private val queueObserver = Observer<Boolean> {
//[REMOVE LOG CALLS]//[REMOVE LOG CALLS]Log.d(tag, lastPlayedFragmentTag + "queue changed")
//[REMOVE LOG CALLS]Log.d(tag, lastPlayedFragmentTag + "queue changed")
viewAdapter.notifyDataSetChanged()
}