Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ private void updateNotification() {
// int newItemsCount = Integer.parseInt(dbConn.getUnreadItemsCountForSpecificFolder(SubscriptionExpandableListAdapter.SPECIAL_FOLDERS.ALL_UNREAD_ITEMS));

// If another app is not in foreground
if (!ForegroundListener.isInForeground()) {
if (!ForegroundListener.Companion.isInForeground()) {
NextcloudNotificationManager.showUnreadRssItemsNotification(getContext(), mPrefs, false);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,22 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package de.luhmer.owncloudnewsreader.chrometabs

package de.luhmer.owncloudnewsreader.chrometabs;

import android.app.Service;
import android.content.Intent;
import android.os.Binder;
import android.os.IBinder;
import android.app.Service
import android.content.Intent
import android.os.Binder
import android.os.IBinder

/**
* Empty service used by the custom tab to bind to, raising the application's importance.
*/
public class KeepAliveService extends Service {
private static final Binder sBinder = new Binder();
class KeepAliveService : Service() {
override fun onBind(intent: Intent): IBinder? {
return sBinder
}

@Override
public IBinder onBind(Intent intent) {
return sBinder;
companion object {
private val sBinder = Binder()
}
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package de.luhmer.owncloudnewsreader.helper

import android.app.Activity
import android.app.Application.ActivityLifecycleCallbacks
import android.os.Bundle

class ForegroundListener : ActivityLifecycleCallbacks {
override fun onActivityCreated(
activity: Activity,
savedInstanceState: Bundle?,
) {
// do nothing
}

override fun onActivityStarted(activity: Activity) {
numStarted++
}

override fun onActivityResumed(activity: Activity) {
// do nothing
}

override fun onActivityPaused(activity: Activity) {
// do nothing
}

override fun onActivityStopped(activity: Activity) {
numStarted--
}

override fun onActivitySaveInstanceState(
activity: Activity,
outState: Bundle,
) {
// do nothing
}

override fun onActivityDestroyed(activity: Activity) {
// do nothing
}

companion object {
private var numStarted = 0
val isInForeground: Boolean
get() = numStarted > 0
}
}

This file was deleted.

Comment thread
Unpublished marked this conversation as resolved.
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
@file:JvmName("URLConnectionReader")

package de.luhmer.owncloudnewsreader.helper

import java.io.BufferedReader
import java.io.IOException
import java.io.InputStreamReader
import java.net.URL

/**
* Created by David on 13.01.2016.
*/
@Throws(IOException::class)
fun getText(url: String?): String {
val website = URL(url)
val connection = website.openConnection()

val response = StringBuilder()
BufferedReader(InputStreamReader(connection.getInputStream())).use {
inReader ->
{
var inputLine: String?
while (inReader.readLine().also { inputLine = it } != null) response.append(inputLine)
}
}
return response.toString()
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
package de.luhmer.owncloudnewsreader.ssl

import java.io.IOException
import java.net.InetAddress
import java.net.Socket
import javax.net.ssl.SSLContext
import javax.net.ssl.SSLSocket
import javax.net.ssl.SSLSocketFactory

/* This class should enable TLSv1.1 and TLSv1.2 on devices where they are available but not enabled.
According to https://developer.android.com/reference/javax/net/ssl/SSLSocket.html
this should only affect API Level 16 - 20.

DISCLAIMER: The author is neither an Android/Java developer nor a software developer at all.
Since this class affects security it shouldn't be used unless it was reviewed and tested
by an qualified person.

*/
class TLSSocketFactory(sslContext: SSLContext) : SSLSocketFactory() {
private val socketFactory: SSLSocketFactory

init {
socketFactory = sslContext.socketFactory
}

@Throws(IOException::class)
override fun createSocket(
socket: Socket,
host: String,
port: Int,
autoClose: Boolean,
): Socket {
val sslSocket =
socketFactory.createSocket(
socket,
host,
port,
autoClose,
) as SSLSocket

// Enable all supported Protocols
sslSocket.enabledProtocols = sslSocket.supportedProtocols
return sslSocket
}

override fun getDefaultCipherSuites(): Array<String> {
return socketFactory.defaultCipherSuites
}

override fun getSupportedCipherSuites(): Array<String> {
return socketFactory.supportedCipherSuites
}

// NoTLS
override fun createSocket(
s: String,
i: Int,
): Socket {
return super.createSocket()
}

override fun createSocket(
s: String,
i: Int,
inetAddress: InetAddress,
i2: Int,
): Socket {
return super.createSocket()
}

override fun createSocket(
inetAddress: InetAddress,
i: Int,
): Socket {
return super.createSocket()
}

override fun createSocket(
inetAddress: InetAddress,
i: Int,
inetAddress2: InetAddress,
i2: Int,
): Socket {
return super.createSocket()
}
}