最终实现效果:
- 无版本概念,任何本地文件均可增量升级到最新.服务器不用管理多版本
- 内存小,100M文件升级时只占用500KB内存.
使用流程:
- 制作新版本,上传HTTP File Server.
- Client自动计算差异,下载差异,合并差异.
- done!
#0.起源
| /* | |
| * Copyright (C) 2022 The Android Open Source Project | |
| * | |
| * Licensed under the Apache License, Version 2.0 (the "License"); | |
| * you may not use this file except in compliance with the License. | |
| * You may obtain a copy of the License at | |
| * | |
| * http://www.apache.org/licenses/LICENSE-2.0 | |
| * | |
| * Unless required by applicable law or agreed to in writing, software |
| #! /usr/bin/env python | |
| # Client and server for udp (datagram) echo. | |
| # | |
| # Usage: udpecho -s [port] (to start a server) | |
| # or: udpecho -c host [port] <file (client) | |
| import sys | |
| from socket import * |
| package org.yeshen.download; | |
| import android.os.Handler; | |
| import android.os.HandlerThread; | |
| import android.os.Looper; | |
| import android.support.annotation.Nullable; | |
| import android.support.annotation.UiThread; | |
| import android.support.annotation.WorkerThread; | |
| import android.util.Log; |
| import android.content.Context; | |
| import android.util.AttributeSet; | |
| import android.util.Xml; | |
| import android.webkit.JavascriptInterface; | |
| import android.webkit.WebView; | |
| import android.webkit.WebViewClient; | |
| public class HtmlTextEditor extends WebView { | |
| class JsObject { |
| /* | |
| * Copyright (c) 2018 Zhang Hai <Dreaming.in.Code.ZH@Gmail.com> | |
| * | |
| * Licensed under the Apache License, Version 2.0 (the "License"); | |
| * you may not use this file except in compliance with the License. | |
| * You may obtain a copy of the License at | |
| * | |
| * http://www.apache.org/licenses/LICENSE-2.0 | |
| * | |
| * Unless required by applicable law or agreed to in writing, software |
| RelativeLayout layout = (RelativeLayout) findViewById(R.id.rel); | |
| GradientDrawable drawable = new GradientDrawable(); | |
| drawable.setColors(new int[] { | |
| Color.parseColor("#FFF6B7"), | |
| Color.parseColor("#F6416C") | |
| }); | |
| drawable.setGradientType(GradientDrawable.LINEAR_GRADIENT); | |
| drawable.setOrientation(GradientDrawable.Orientation.LEFT_RIGHT); |
| #!/bin/sh | |
| # Usage: ./watch-fds.sh <application_id> [delay_secs = 5] | |
| APP_ID=${1:?missing application id} | |
| DELAY=$(( ${2:-5} )) | |
| DEVICE_LIMIT=$(( $(adb shell ulimit -n) )) | |
| WARN_THRESHOLD=$(( ${DEVICE_LIMIT} / 3 )) | |
| echo "Will warn at ${WARN_THRESHOLD}" |
| //DNS Query Program on Linux | |
| //Author : Silver Moon ([email protected]) | |
| //Dated : 29/4/2009 | |
| //Header Files | |
| #include<stdio.h> //printf | |
| #include<string.h> //strlen | |
| #include<stdlib.h> //malloc | |
| #include<sys/socket.h> //you know what this is for | |
| #include<arpa/inet.h> //inet_addr , inet_ntoa , ntohs etc |
| import android.content.Context; | |
| import android.graphics.Bitmap; | |
| import android.graphics.BitmapShader; | |
| import android.graphics.Canvas; | |
| import android.graphics.PorterDuff; | |
| import android.graphics.Shader; | |
| import android.graphics.drawable.BitmapDrawable; | |
| import android.graphics.drawable.ClipDrawable; | |
| import android.graphics.drawable.Drawable; | |
| import android.graphics.drawable.LayerDrawable; |
最终实现效果:
使用流程:
#0.起源