Skip to content

Commit

Permalink
fix: fix support for Tizen 4 and above
Browse files Browse the repository at this point in the history
  • Loading branch information
GramingFoxTeam committed Jul 16, 2023
1 parent 94a87fe commit b72a548
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,14 @@
import android.content.pm.PackageManager;
import android.content.res.AssetManager;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.EditText;
import android.widget.Switch;
import android.widget.TextView;


import org.java_websocket.client.WebSocketClient;
import org.java_websocket.handshake.ServerHandshake;
import org.json.JSONException;
import org.json.JSONObject;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
Expand Down Expand Up @@ -68,9 +65,11 @@ protected void onCreate(Bundle savedInstanceState) {
JSONObject object = readConfig();
EditText appIdText = (EditText) findViewById(R.id.appIdTextField);
EditText tvIpText = (EditText) findViewById(R.id.tvIpTextField);
Switch isTizen3 = (Switch) findViewById(R.id.isTizen3);
try {
appIdText.setText(object.getString("appId"));
tvIpText.setText(object.getString("tvIP"));
isTizen3.setChecked(object.getBoolean("isTizen3"));
} catch (JSONException e) {
e.printStackTrace();
}
Expand Down Expand Up @@ -239,8 +238,10 @@ public void saveConfig(View v)
JSONObject object = readConfig();
EditText appIdText = (EditText) findViewById(R.id.appIdTextField);
EditText tvIpText = (EditText) findViewById(R.id.tvIpTextField);
Switch isTizen3 = (Switch) findViewById(R.id.isTizen3);
object.put("appId", appIdText.getText());
object.put("tvIP", tvIpText.getText());
object.put("isTizen3", isTizen3.isChecked());
writeConfig(object);
} catch (JSONException ex) {
ex.printStackTrace();
Expand Down
14 changes: 14 additions & 0 deletions androidApp/app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -97,4 +97,18 @@
app:layout_constraintTop_toBottomOf="@+id/button"
app:layout_constraintVertical_bias="0.0" />

<Switch
android:id="@+id/isTizen3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="96dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="88dp"
android:layout_marginBottom="9dp"
android:text="Tizen 3 (2017) Compatability"
app:layout_constraintBottom_toTopOf="@+id/button"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tvIpTextField" />

</androidx.constraintlayout.widget.ConstraintLayout>
1 change: 1 addition & 0 deletions apps/TizenTube/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@
<tizen:privilege name="http://tizen.org/privilege/application.launch"/>
<tizen:profile name="tv-samsung"/>
<tizen:setting screen-orientation="landscape" context-menu="enable" background-support="disable" encryption="disable" install-location="auto" hwkey-event="enable"/>
<access origin="https://www.youtube.com" subdomains="true"/>
</widget>
1 change: 0 additions & 1 deletion apps/TizenTube/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
<body>
<a style="color: white;" id="text">Why did this happen...?</a>
<script>
tizen.tvinputdevice.registerKeyBatch(['MediaPlayPause', 'ColorF1Green']);
window.location.href = "https://www.youtube.com/tv";
</script>
</body>
Expand Down
3 changes: 2 additions & 1 deletion config.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"appId": "Ad6NutHP8l.TizenTube",
"tvIP": "192.168.1.2",
"debug": false
"debug": false,
"isTizen3": false
}
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ wss.on('connection', ws => {
// Launch the app with a debugger. Executes "sdb shell 0 debug app.id 0" (The last argument
// is for timeout, but timeout doesn't exist. And when you dont supply it, it just says
// "closed". Took me a little too long to figure out.).
sendData(`4f50454e250000000000000021000000f60a0000b0afbab17368656c6c3a3020646562756720${appId}203000`)
sendData(`4f50454e250000000000000021000000f60a0000b0afbab17368656c6c3a3020646562756720${appId}${Config.isTizen3 ? '2030' : ''}00`)
break;
}

Expand Down

0 comments on commit b72a548

Please sign in to comment.