Skip to content

Commit d265c0e

Browse files
committed
version 1.3
1 parent 7c84579 commit d265c0e

File tree

152 files changed

+4714
-4749
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

152 files changed

+4714
-4749
lines changed
0 Bytes
Binary file not shown.
300 Bytes
Binary file not shown.
594 Bytes
Binary file not shown.
Binary file not shown.
Binary file not shown.
19.3 KB
Binary file not shown.
0 Bytes
Binary file not shown.
23.7 KB
Binary file not shown.
Binary file not shown.
4.9 KB
Binary file not shown.

.gradle/file-system.probe

0 Bytes
Binary file not shown.

.idea/assetWizardSettings.xml

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules/app/Free_TV.app.main.iml

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#### Open-Source application that does not require registration and all content is free for users. It is possible to play international as well as local channels using a simple player. The player supports gesture control. Add favorite channels to the favorites list and then play them. There is also the option to play your own links. And much more.
1212

1313
## Available for download
14-
[![Google Play](https://img.shields.io/badge/Google_Play-414141?style=for-the-badge&logo=google-play&logoColor=white)](https://play.google.com/store/apps/details?id=com.phstudio.freetv) [![Galaxy Store](https://shields.io/badge/Galaxy%20Store-e013a0?style=for-the-badge&logo=samsung&logoColor=white)](https://galaxystore.samsung.com/detail/com.phstudio.freetv) [![APK](https://shields.io/badge/APK-7MB-58a6ff?style=for-the-badge&logo=github&logoColor=white)](https://github.com/phstudio2/FreeTV/releases/download/1.2/FreeTV1-2.apk)
14+
[![Google Play](https://img.shields.io/badge/Google_Play-414141?style=for-the-badge&logo=google-play&logoColor=white)](https://play.google.com/store/apps/details?id=com.phstudio.freetv) [![Galaxy Store](https://shields.io/badge/Galaxy%20Store-e013a0?style=for-the-badge&logo=samsung&logoColor=white)](https://galaxystore.samsung.com/detail/com.phstudio.freetv) [![APK](https://shields.io/badge/APK-7MB-58a6ff?style=for-the-badge&logo=github&logoColor=white)](https://github.com/phstudio2/FreeTV/releases/download/1.3/FreeTV1-3.apk)
1515

1616
## Screenshot preview
1717
<div style="display:flex;">

app/build.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ android {
1111
applicationId "com.phstudio.freetv"
1212
minSdk 21
1313
targetSdk 33
14-
versionCode 3
15-
versionName "1.2"
14+
versionCode 4
15+
versionName "1.3"
1616

1717
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
1818
}

app/src/main/AndroidManifest.xml

+4-23
Original file line numberDiff line numberDiff line change
@@ -41,29 +41,10 @@
4141
android:configChanges="orientation|screenSize"
4242
android:hardwareAccelerated="true" />
4343

44-
<activity android:name=".ui.new_channels.FreeTVActivity" />
45-
<activity android:name=".ui.new_channels.Albania" />
46-
<activity android:name=".ui.new_channels.Andorra" />
47-
<activity android:name=".ui.new_channels.Argentina" />
48-
<activity android:name=".ui.new_channels.Australia" />
49-
<activity android:name=".ui.new_channels.Austria" />
50-
<activity android:name=".ui.new_channels.Azerbaijan" />
51-
<activity android:name=".ui.new_channels.Belarus" />
52-
<activity android:name=".ui.new_channels.Belgium" />
53-
<activity android:name=".ui.new_channels.BosniaAndHerzegovina" />
54-
<activity android:name=".ui.new_channels.Brazil" />
55-
<activity android:name=".ui.new_channels.Bulgaria" />
56-
<activity android:name=".ui.new_channels.Canada" />
57-
<activity android:name=".ui.new_channels.Chad" />
58-
<activity android:name=".ui.new_channels.Chile" />
59-
<activity android:name=".ui.new_channels.China" />
60-
<activity android:name=".ui.new_channels.CostaRica" />
61-
<activity android:name=".ui.new_channels.Croatia" />
62-
<activity android:name=".ui.new_channels.Cyprus" />
63-
<activity android:name=".ui.new_channels.CzechRepublic" />
64-
<activity android:name=".ui.new_channels.Denmark" />
65-
<activity android:name=".ui.new_channels.DominicanRepublic" />
66-
<activity android:name=".ui.new_channels.Estonia" />
44+
<activity android:name=".ui.git1.CountryActivity" />
45+
<activity android:name=".ui.git1.LinkActivity" />
46+
47+
<activity android:name=".ui.git2.CountryActivity" />
6748

6849
<activity android:name=".ui.channels.PHstudio" />
6950
<activity android:name=".ui.channels.Czech" />

app/src/main/java/com/phstudio/freetv/favorite/Database.kt

+82-51
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,22 @@
11
package com.phstudio.freetv.favorite
22

33
import android.annotation.SuppressLint
4+
import android.app.Activity
45
import android.content.ContentValues
56
import android.content.Context
7+
import android.content.Intent
68
import android.database.Cursor
79
import android.database.sqlite.SQLiteDatabase
810
import android.database.sqlite.SQLiteOpenHelper
11+
import android.graphics.drawable.BitmapDrawable
12+
import android.graphics.drawable.Drawable
913
import android.os.Environment
14+
import android.os.Environment.getExternalStoragePublicDirectory
15+
import android.widget.Button
16+
import android.widget.Toast
17+
import androidx.core.app.ActivityCompat.startActivityForResult
18+
import com.phstudio.freetv.R
19+
import com.squareup.picasso.Picasso
1020
import java.io.File
1121
import java.io.FileWriter
1222
import java.io.IOException
@@ -27,47 +37,34 @@ class Database(context: Context, factory: SQLiteDatabase.CursorFactory?) :
2737

2838
companion object {
2939
private const val DATABASE_NAME = "PH studio"
30-
private const val DATABASE_VERSION = 2
40+
private const val DATABASE_VERSION = 3
3141
const val TABLE_NAME = "Favorite"
3242
const val ID_COL = "id"
33-
const val COL1 = "source"
34-
const val COL2 = "number"
35-
const val COL3 = "playlist"
36-
const val COL4 = "picture"
37-
const val COL5 = "string"
43+
const val COL1 = "name"
44+
const val COL2 = "logo"
45+
const val COL3 = "url"
3846
}
3947

4048
override fun onCreate(db: SQLiteDatabase) {
4149
val query = ("CREATE TABLE if not exists " + TABLE_NAME + " ("
4250
+ ID_COL + " INTEGER PRIMARY KEY, " +
4351
COL1 + " TEXT," +
4452
COL2 + " TEXT," +
45-
COL3 + " TEXT," +
46-
COL4 + " TEXT," +
47-
COL5 + " TEXT" + ")")
53+
COL3 + " TEXT" + ")")
4854
db.execSQL(query)
4955
}
5056

5157
@SuppressLint("Recycle", "Range", "DiscouragedApi")
5258
fun getData(context: Context): ArrayList<HashMap<String, Any>> {
5359
val db = this.writableDatabase
5460
val userList: ArrayList<HashMap<String, Any>> = ArrayList()
55-
val cursor = db.rawQuery("SELECT picture, string FROM $TABLE_NAME", null)
61+
val cursor = db.rawQuery("SELECT name, logo, url FROM $TABLE_NAME", null)
5662

5763
while (cursor.moveToNext()) {
5864
val user: HashMap<String, Any> = HashMap()
59-
val picture = (cursor.getString(cursor.getColumnIndex(COL4)))
60-
user["picture"] =
61-
context.resources.getIdentifier(picture, "drawable", context.packageName)
62-
val text = cursor.getString(cursor.getColumnIndex(COL5))
63-
user["string"] = text
64-
/* user["string"] = context.getString(
65-
context.resources.getIdentifier(
66-
text,
67-
"string",
68-
context.packageName
69-
)
70-
)*/
65+
user["name"] = cursor.getString(cursor.getColumnIndex(COL1))
66+
user["logo"] = cursor.getString(cursor.getColumnIndex(COL2))
67+
user["url"] = cursor.getString(cursor.getColumnIndex(COL3))
7168
userList.add(user)
7269
}
7370
cursor.close()
@@ -76,18 +73,14 @@ class Database(context: Context, factory: SQLiteDatabase.CursorFactory?) :
7673
}
7774

7875
fun writeToDb(
79-
source: String,
80-
number: String,
81-
playlist: String,
82-
picture: String,
83-
string: String
76+
name: String,
77+
logo: String,
78+
url: String,
8479
) {
8580
val values = ContentValues()
86-
values.put(COL1, source)
87-
values.put(COL2, number)
88-
values.put(COL3, playlist)
89-
values.put(COL4, picture)
90-
values.put(COL5, string)
81+
values.put(COL1, name)
82+
values.put(COL2, logo)
83+
values.put(COL3, url)
9184

9285
val db = this.writableDatabase
9386
db.insert(TABLE_NAME, null, values)
@@ -121,47 +114,85 @@ class Database(context: Context, factory: SQLiteDatabase.CursorFactory?) :
121114
}
122115

123116
@SuppressLint("Range")
124-
fun exportDb(): Boolean {
117+
fun exportDb14(context: Context): Boolean {
118+
val exportDir =
119+
getExternalStoragePublicDirectory(Environment.DIRECTORY_DOCUMENTS)
120+
if (!exportDir.exists()) {
121+
exportDir.mkdirs()
122+
}
123+
val file: File
124+
var printWriter: PrintWriter? = null
125+
try {
126+
file = File(exportDir, "Database_FREETV.csv")
127+
file.createNewFile()
128+
printWriter = PrintWriter(FileWriter(file))
129+
130+
val db = this.readableDatabase
131+
var id: Int
132+
var name: String
133+
var logo: String
134+
var url: String
135+
136+
val curCSV: Cursor = db.rawQuery("SELECT * FROM $TABLE_NAME", null)
137+
printWriter.println("id,name,logo,url")
138+
while (curCSV.moveToNext()) {
139+
id = curCSV.getInt(curCSV.getColumnIndex(ID_COL))
140+
name = curCSV.getString(curCSV.getColumnIndex("name"))
141+
logo = curCSV.getString(curCSV.getColumnIndex("logo"))
142+
url = curCSV.getString(curCSV.getColumnIndex("url"))
143+
144+
val record = "$id,$name,$logo,$url"
145+
146+
printWriter.println(record)
147+
}
148+
curCSV.close()
149+
db.close()
150+
} catch (e: IOException) {
151+
return false
152+
} finally {
153+
printWriter?.close()
154+
}
155+
return true
156+
}
157+
158+
@SuppressLint("Range")
159+
fun exportDb(context: Context): Boolean {
125160
val state = Environment.getExternalStorageState()
126161
if (Environment.MEDIA_MOUNTED != state) {
127162
return false
128163
} else {
129-
val exportDir =
130-
Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS)
131-
if (!exportDir.exists()) {
132-
exportDir.mkdirs()
133-
}
164+
val fileDir = context.getExternalFilesDir(null)
165+
134166
val file: File
135167
var printWriter: PrintWriter? = null
136168
try {
137-
file = File(exportDir, "Database_FREETV.csv")
169+
file = File(fileDir, "Database_FREETV.csv")
138170
file.createNewFile()
139171
printWriter = PrintWriter(FileWriter(file))
140172

141173
val db = this.readableDatabase
142174
var id: Int
143-
var source: String
144-
var number: String
145-
var playlist: String
146-
var picture: String
147-
var string: String
175+
var name: String
176+
var logo: String
177+
var url: String
148178

149179
val curCSV: Cursor = db.rawQuery("SELECT * FROM $TABLE_NAME", null)
150-
printWriter.println("id,source,number,playlist,picture,string")
180+
printWriter.println("id,name,logo,url")
151181
while (curCSV.moveToNext()) {
152182
id = curCSV.getInt(curCSV.getColumnIndex(ID_COL))
153-
source = curCSV.getString(curCSV.getColumnIndex("source"))
154-
number = curCSV.getString(curCSV.getColumnIndex("number"))
155-
playlist = curCSV.getString(curCSV.getColumnIndex("playlist"))
156-
picture = curCSV.getString(curCSV.getColumnIndex("picture"))
157-
string = curCSV.getString(curCSV.getColumnIndex("string"))
183+
name = curCSV.getString(curCSV.getColumnIndex("name"))
184+
logo = curCSV.getString(curCSV.getColumnIndex("logo"))
185+
url = curCSV.getString(curCSV.getColumnIndex("url"))
158186

159-
val record = "$id,$source,$number,$playlist,$picture,$string"
187+
val record = "$id,$name,$logo,$url"
160188

161189
printWriter.println(record)
162190
}
163191
curCSV.close()
164192
db.close()
193+
Toast.makeText(context, context.getString(R.string.saveFolder), Toast.LENGTH_SHORT).show()
194+
Toast.makeText(context, file.absolutePath, Toast.LENGTH_LONG).show()
195+
165196
} catch (e: IOException) {
166197
return false
167198
} finally {

0 commit comments

Comments
 (0)