59 changed files with 109 additions and 620 deletions
@ -1,47 +0,0 @@ |
|||
/* |
|||
* ************************************************************************ |
|||
* AppUtils.kt |
|||
* ************************************************************************* |
|||
* Copyright © 2022 VLC authors and VideoLAN |
|||
* Author: Nicolas POMEPUY |
|||
* This program 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 2 of the License, or |
|||
* (at your option) any later version. |
|||
* |
|||
* This program 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 this program; if not, write to the Free Software |
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. |
|||
* ************************************************************************** |
|||
* |
|||
* |
|||
*/ |
|||
package org.videolan.tools |
|||
|
|||
import android.content.Context |
|||
import android.os.Build |
|||
import android.os.Environment |
|||
import android.os.StatFs |
|||
|
|||
@Suppress("DEPRECATION") |
|||
object AppUtils { |
|||
|
|||
fun totalMemory(): Long { |
|||
val statFs = StatFs(Environment.getRootDirectory().absolutePath) |
|||
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) |
|||
statFs.blockCountLong * statFs.blockSizeLong |
|||
else (statFs.blockCount * statFs.blockSize).toLong() |
|||
} |
|||
|
|||
fun freeMemory(): Long { |
|||
val statFs = StatFs(Environment.getRootDirectory().absolutePath) |
|||
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) |
|||
statFs.availableBlocksLong * statFs.blockSizeLong |
|||
else (statFs.availableBlocks * statFs.blockSize).toLong() |
|||
} |
|||
} |
|||
@ -1,32 +0,0 @@ |
|||
package org.videolan.vlc.gui.view |
|||
|
|||
import android.content.Context |
|||
import android.view.View |
|||
import androidx.appcompat.widget.SwitchCompat |
|||
import androidx.preference.PreferenceViewHolder |
|||
import androidx.preference.TwoStatePreference |
|||
|
|||
class ClickableSwitchPreference(context: Context) : TwoStatePreference(context, null, androidx.preference.R.attr.switchPreferenceCompatStyle, 0) { |
|||
|
|||
private var switchView: View? = null |
|||
private var switchClickListener: View.OnClickListener? = null |
|||
|
|||
override fun onBindViewHolder(holder: PreferenceViewHolder) { |
|||
super.onBindViewHolder(holder) |
|||
switchView = holder.findViewById(androidx.preference.R.id.switchWidget) |
|||
switchView!!.setOnClickListener(switchClickListener) |
|||
|
|||
//for some reason, it does not initialize itself; |
|||
(switchView as SwitchCompat).isChecked = isChecked |
|||
|
|||
(switchView as SwitchCompat).setOnCheckedChangeListener { _, _ -> } |
|||
} |
|||
|
|||
fun setOnSwitchClickListener(listener: View.OnClickListener) { |
|||
switchClickListener = listener |
|||
} |
|||
|
|||
override fun onClick() { |
|||
//Do not call super.onClick(); |
|||
} |
|||
} |
|||
@ -1,25 +0,0 @@ |
|||
/***************************************************************************** |
|||
* OnExpandableListener.java |
|||
* |
|||
* Copyright © 2013 VLC authors and VideoLAN |
|||
* |
|||
* This program 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 2 of the License, or |
|||
* (at your option) any later version. |
|||
* |
|||
* This program 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 this program; if not, write to the Free Software |
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. |
|||
*/ |
|||
|
|||
package org.videolan.vlc.interfaces |
|||
|
|||
interface OnExpandableListener { |
|||
fun onDismiss() |
|||
} |
|||
Loading…
Reference in new issue