egeniq / android-tv-program-guide

Android TV Program Guide
Apache License 2.0
164 stars 66 forks source link

Code Available in Java #18

Closed langaliamayank closed 4 years ago

langaliamayank commented 4 years ago

Hi. My dear friend,

I am trying to convert kotlin to java. Do you have same code in java (android) platform?

From last 1-2 month i am searching for the same but still not getting any proper solution. Stuck totally. Please help me for the same. If you have any idea pls share with me, mayanklangalia@gmail.com

dzolnai commented 4 years ago

Hello Mayank,

Sorry the code is only available in Kotlin. But porting it to Java shouldn't be too complicated.

langaliamayank commented 4 years ago

Hello dzolnai,

Is it possible only EPGFragment convert into java. library remain kotlin.

dzolnai commented 4 years ago

Yes, but what would be the benefit? Either way, you need to include the Kotlin library in your app.

langaliamayank commented 4 years ago

Dear Dániel Zolnai,

I want to implement live API but having some timeslot & program time issue. i dont know how to achieve this. could you please help me for the same.

"programstart": "09/09/2020 03:00:00",
"programend": "09/09/2020 06:00:00",

I want to set dynamic time. instead of random time. 24 hours getting data from API.

dzolnai commented 4 years ago

You should parse the dates using DateTimeFormatter.ofPattern("<your pattern>") which will give you a ZonedDateTime. Then you can get the epochMillis of that datetime to set the required values.

langaliamayank commented 4 years ago

channels.forEach { channel -> val scheduleList = mutableListOf<ProgramGuideSchedule>() var nextTime = randomTimeBetween(MIN_CHANNEL_START_TIME, MAX_CHANNEL_START_TIME) while (nextTime.isBefore(MIN_CHANNEL_END_TIME)) { val endTime = ZonedDateTime.ofInstant(Instant.ofEpochSecond(nextTime.toEpochSecond() + Random.nextLong(MIN_SHOW_LENGTH_SECONDS, MAX_SHOW_LENGTH_SECONDS)), ZoneOffset.UTC) val schedule = createSchedule(channel, showNames.random(), nextTime, endTime) scheduleList.add(schedule) nextTime = endTime } val endTime = if (nextTime.isBefore(MAX_CHANNEL_END_TIME)) randomTimeBetween(nextTime, MAX_CHANNEL_END_TIME) else MAX_CHANNEL_END_TIME val finalSchedule = createSchedule(channel, showNames.random(), nextTime, endTime) scheduleList.add(finalSchedule) channelMap[channel.id] = scheduleList }

Thank you, But could you please make it and send it to me. because i have no idea how to do it. randomTimeBetween function is return random value.

dzolnai commented 4 years ago

Hello Mayan,

I will gladly fix issues which are related to the library itself, but I don't have the time to fix everyone's code. If you have questions about the workings of the library, I can answer those.

langaliamayank commented 4 years ago

Ok actually getting this error : kotlin.UninitializedPropertyAccessException: lateinit property programGuideManager has not been initialized

dzolnai commented 4 years ago

That means that you have not set the programGuideManager in your fragment

dzolnai commented 4 years ago

Closing because of inactivity.