Android: Fullscreen should be sticky immersive (Thanks fizzwhiz)

This means that if you tap at top or bottom of screen to get navigation/status bars to reappear, they should reappear only for a few seconds and as a translucent overlay instead. Also avoid using HttpRequest_Free in favour of Mem_Free
This commit is contained in:
UnknownShadow200 2020-11-07 15:05:30 +11:00
parent f344c9b096
commit 7150af4ab5
6 changed files with 11 additions and 11 deletions

View File

@ -603,7 +603,7 @@ public class MainActivity extends Activity implements SurfaceHolder.Callback2 {
public void enterFullscreen() {
runOnUiThread(new Runnable() {
public void run() {
curView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_IMMERSIVE);
curView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
}
});
}

View File

@ -77,7 +77,7 @@ static void RequestList_TryFree(struct RequestList* list, int id) {
int i = RequestList_Find(list, id, &req);
if (i < 0) return;
HttpRequest_Free(&req);
Mem_Free(req.data);
RequestList_RemoveAt(list, i);
}
@ -609,7 +609,7 @@ static cc_result Http_BackendDo(struct HttpRequest* req, cc_string* url) {
/* per curl docs, we must persist POST data until request finishes */
req->data = NULL;
HttpRequest_Free(req);
req->size = 0;
} else {
/* Undo POST/HEAD state */
_curl_easy_setopt(curl, CURLOPT_HTTPGET, 1L);

View File

@ -217,8 +217,10 @@ void LWebTask_Tick(struct LWebTask* task) {
task->working = false;
task->completed = true;
task->success = req.success;
if (task->success) task->Handle((cc_uint8*)req.data, req.size);
HttpRequest_Free(&req);
if (!req.success) return;
task->Handle((cc_uint8*)req.data, req.size);
Mem_Free(req.data);
}
void LWebTask_DisplayError(struct LWebTask* task, const char* action, cc_string* dst) {

View File

@ -305,7 +305,7 @@ static void WoM_Tick(void) {
if (!item.success) return;
WoM_ParseConfig(&item);
HttpRequest_Free(&item);
Mem_Free(item.data);
}

View File

@ -812,8 +812,6 @@ CC_NOINLINE static cc_bool Fetcher_Get(int reqID, struct HttpRequest* req) {
Fetcher_Failed = true;
Fetcher_Result = req->result;
Fetcher_StatusCode = req->statusCode;
HttpRequest_Free(req);
Fetcher_Finish();
return false;
}
@ -834,7 +832,7 @@ static void Fetcher_CheckMusic(struct MusicResource* music) {
music->downloaded = true;
MusicPatcher_Save(music->name, &req);
HttpRequest_Free(&req);
Mem_Free(req.data);
}
static void Fetcher_CheckSound(const struct SoundResource* sound) {
@ -842,7 +840,7 @@ static void Fetcher_CheckSound(const struct SoundResource* sound) {
if (!Fetcher_Get(sound->reqID, &req)) return;
SoundPatcher_Save(sound->name, &req);
HttpRequest_Free(&req);
Mem_Free(req.data);
}
/* TODO: Implement this.. */

View File

@ -56,7 +56,7 @@ static void Server_CheckAsyncResources(void) {
if (item.success) {
TexturePack_Apply(&item);
HttpRequest_Free(&item);
Mem_Free(item.data);
} else if (item.result) {
Logger_Warn(item.result, "trying to download texture pack", Http_DescribeError);
} else {