no message

This commit is contained in:
wanjian
2017-04-08 11:50:55 +08:00
parent 1220d583ce
commit 526f478996
26 changed files with 0 additions and 1070 deletions

1
app/.gitignore vendored
View File

@@ -1 +0,0 @@
/build

View File

@@ -1,30 +0,0 @@
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "24.0.2"
defaultConfig {
applicationId "sharescreen.wanjian.com.a"
minSdkVersion 9
targetSdkVersion 24
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:24.2.1'
// compile 'com.mogujie:screenshare:0.0.1-SNAPSHOT'
testCompile 'junit:junit:4.12'
}

View File

@@ -1,17 +0,0 @@
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /Users/wanjian/Library/Android/sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

View File

@@ -1,26 +0,0 @@
package sharescreen.wanjian.com.a;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumentation test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("sharescreen.wanjian.com.a", appContext.getPackageName());
}
}

View File

@@ -1,22 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="sharescreen.wanjian.com.a">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name="sharescreen.wanjian.com.server.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity android:name="sharescreen.wanjian.com.server.SecondActivity"/>
</application>
<uses-permission android:name="android.permission.INTERNET"/>
</manifest>

View File

@@ -1,49 +0,0 @@
package sharescreen.wanjian.com.server;
import android.app.Activity;
import android.app.Application;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.RequiresApi;
/**
* Created by wanjian on 2016/11/19.
*/
@RequiresApi(api = Build.VERSION_CODES.ICE_CREAM_SANDWICH)
public class ActivityLifecycleCallbacksAdapter implements Application.ActivityLifecycleCallbacks {
@Override
public void onActivityCreated(Activity activity, Bundle savedInstanceState) {
}
@Override
public void onActivityStarted(Activity activity) {
}
@Override
public void onActivityResumed(Activity activity) {
}
@Override
public void onActivityPaused(Activity activity) {
}
@Override
public void onActivityStopped(Activity activity) {
}
@Override
public void onActivitySaveInstanceState(Activity activity, Bundle outState) {
}
@Override
public void onActivityDestroyed(Activity activity) {
}
}

View File

@@ -1,135 +0,0 @@
/*
* Copyright (C) 2012 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
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package sharescreen.wanjian.com.server;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.LinkedList;
import java.util.List;
/**
* ByteArrayPool is a source and repository of <code>byte[]</code> objects. Its purpose is to
* supply those buffers to consumers who need to use them for a short period of time and then
* dispose of them. Simply creating and disposing such buffers in the conventional manner can
* considerable heap churn and garbage collection delays on Android, which lacks good management of
* short-lived heap objects. It may be advantageous to trade off some memory in the form of a
* permanently allocated pool of buffers in order to gain heap performance improvements; that is
* what this class does.
* <p>
* A good candidate user for this class is something like an I/O system that uses large temporary
* <code>byte[]</code> buffers to copy data around. In these use cases, often the consumer wants
* the buffer to be a certain minimum size to ensure good performance (e.g. when copying data chunks
* off of a stream), but doesn't mind if the buffer is larger than the minimum. Taking this into
* account and also to maximize the odds of being able to reuse a recycled buffer, this class is
* free to return buffers larger than the requested size. The caller needs to be able to gracefully
* deal with getting buffers any size over the minimum.
* <p>
* If there is not a suitably-sized buffer in its recycling pool when a buffer is requested, this
* class will allocate a new buffer and return it.
* <p>
* This class has no special ownership of buffers it creates; the caller is free to take a buffer
* it receives from this pool, use it permanently, and never return it to the pool; additionally,
* it is not harmful to return to this pool a buffer that was allocated elsewhere, provided there
* are no other lingering references to it.
* <p>
* This class ensures that the total size of the buffers in its recycling pool never exceeds a
* certain byte limit. When a buffer is returned that would cause the pool to exceed the limit,
* least-recently-used buffers are disposed.
*/
public class ByteArrayPool {
/** The buffer pool, arranged both by last use and by buffer size */
private List<byte[]> mBuffersByLastUse = new LinkedList<byte[]>();
private List<byte[]> mBuffersBySize = new ArrayList<byte[]>(64);
/** The total size of the buffers in the pool */
private int mCurrentSize = 0;
/**
* The maximum aggregate size of the buffers in the pool. Old buffers are discarded to stay
* under this limit.
*/
private final int mSizeLimit;
/** Compares buffers by size */
protected static final Comparator<byte[]> BUF_COMPARATOR = new Comparator<byte[]>() {
@Override
public int compare(byte[] lhs, byte[] rhs) {
return lhs.length - rhs.length;
}
};
/**
* @param sizeLimit the maximum size of the pool, in bytes
*/
public ByteArrayPool(int sizeLimit) {
mSizeLimit = sizeLimit;
}
/**
* Returns a buffer from the pool if one is available in the requested size, or allocates a new
* one if a pooled one is not available.
*
* @param len the minimum size, in bytes, of the requested buffer. The returned buffer may be
* larger.
* @return a byte[] buffer is always returned.
*/
public synchronized byte[] getBuf(int len) {
for (int i = 0; i < mBuffersBySize.size(); i++) {
byte[] buf = mBuffersBySize.get(i);
if (buf.length >= len) {
mCurrentSize -= buf.length;
mBuffersBySize.remove(i);
mBuffersByLastUse.remove(buf);
return buf;
}
}
return new byte[len];
}
/**
* Returns a buffer to the pool, throwing away old buffers if the pool would exceed its allotted
* size.
*
* @param buf the buffer to return to the pool.
*/
public synchronized void returnBuf(byte[] buf) {
if (buf == null || buf.length > mSizeLimit) {
return;
}
mBuffersByLastUse.add(buf);
int pos = Collections.binarySearch(mBuffersBySize, buf, BUF_COMPARATOR);
if (pos < 0) {
pos = -pos - 1;
}
mBuffersBySize.add(pos, buf);
mCurrentSize += buf.length;
trim();
}
/**
* Removes buffers from the pool until it is under its size limit.
*/
private synchronized void trim() {
while (mCurrentSize > mSizeLimit) {
byte[] buf = mBuffersByLastUse.remove(0);
mBuffersBySize.remove(buf);
mCurrentSize -= buf.length;
}
}
}

View File

@@ -1,82 +0,0 @@
package sharescreen.wanjian.com.server;
import android.os.Handler;
import android.os.Message;
import android.util.Log;
import java.io.BufferedOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.net.Socket;
/**
* Created by wanjian on 2016/11/20.
*/
public class ClientHandler extends Handler {
private BufferedOutputStream outputStream;
private final int MSG = 1;
private void writeInt(OutputStream outputStream, int v) throws IOException {
outputStream.write(v >> 24);
outputStream.write(v >> 16);
outputStream.write(v >> 8);
outputStream.write(v);
}
public void sendData(byte[] datas) {
removeMessages(MSG);
Message message = obtainMessage();
message.what = MSG;
message.obj = datas;
sendMessage(message);
}
@Override
public void handleMessage(Message msg) {
super.handleMessage(msg);
if (outputStream != null) {
try {
byte[] data = (byte[]) msg.obj;
Log.d("RecorderManager", "length : " + data.length);
long s = System.currentTimeMillis();
outputStream.write(RecorderManager.VERSION);
writeInt(outputStream, data.length);
outputStream.write(data);
outputStream.flush();
Log.d("RecorderManager", "write : " + (System.currentTimeMillis() - s));
} catch (IOException e) {
try {
outputStream.close();
} catch (IOException e1) {
}
outputStream = null;
}
}
}
public ClientHandler(Socket socket) {
try {
outputStream = new BufferedOutputStream(socket.getOutputStream(), 1024 * 200);
} catch (IOException e) {
e.printStackTrace();
}
}
public void close() {
post(new Runnable() {
@Override
public void run() {
try {
outputStream.close();
} catch (Exception e) {
}
getLooper().quit();
}
});
}
}

View File

@@ -1,64 +0,0 @@
package sharescreen.wanjian.com.server;
import android.content.Intent;
import android.graphics.Bitmap;
import android.os.Handler;
import android.os.Message;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;
import com.wanjian.puppet.Main;
import java.util.Date;
import sharescreen.wanjian.com.a.R;
public class MainActivity extends AppCompatActivity {
private static final String TAG = "ScreeenSend";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final TextView tv = (TextView) findViewById(R.id.tv);
findViewById(R.id.ok).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
RecorderManager.getInstance(MainActivity.this)
.startRecorder(MainActivity.this, 0.5f);
}
});
findViewById(R.id.jieshu).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
RecorderManager.getInstance(MainActivity.this)
.stopRecorder();
}
});
findViewById(R.id.act2).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(getApplicationContext(), SecondActivity.class));
}
});
new Handler(){
@Override
public void handleMessage(Message msg) {
super.handleMessage(msg);
tv.setText(new Date().toLocaleString());
sendEmptyMessageDelayed(0,1000);
}
}.sendEmptyMessage(0);
}
}

View File

@@ -1,93 +0,0 @@
/*
* Copyright (C) 2012 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
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package sharescreen.wanjian.com.server;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
/**
* A variation of {@link ByteArrayOutputStream} that uses a pool of byte[] buffers instead
* of always allocating them fresh, saving on heap churn.
*/
public class PoolingByteArrayOutputStream extends ByteArrayOutputStream {
/**
* If the {@link #PoolingByteArrayOutputStream(ByteArrayPool)} constructor is called, this is
* the default size to which the underlying byte array is initialized.
*/
private static final int DEFAULT_SIZE = 256;
private final ByteArrayPool mPool;
/**
* Constructs a new PoolingByteArrayOutputStream with a default size. If more bytes are written
* to this instance, the underlying byte array will expand.
*/
public PoolingByteArrayOutputStream(ByteArrayPool pool) {
this(pool, DEFAULT_SIZE);
}
/**
* Constructs a new {@code ByteArrayOutputStream} with a default size of {@code size} bytes. If
* more than {@code size} bytes are written to this instance, the underlying byte array will
* expand.
*
* @param size initial size for the underlying byte array. The value will be pinned to a default
* minimum size.
*/
public PoolingByteArrayOutputStream(ByteArrayPool pool, int size) {
mPool = pool;
buf = mPool.getBuf(Math.max(size, DEFAULT_SIZE));
}
@Override
public void close() throws IOException {
mPool.returnBuf(buf);
buf = null;
super.close();
}
@Override
public void finalize() {
mPool.returnBuf(buf);
}
/**
* Ensures there is enough space in the buffer for the given number of additional bytes.
*/
private void expand(int i) {
/* Can the buffer handle @i more bytes, if not expand it */
if (count + i <= buf.length) {
return;
}
byte[] newbuf = mPool.getBuf((count + i) * 2);
System.arraycopy(buf, 0, newbuf, 0, count);
mPool.returnBuf(buf);
buf = newbuf;
}
@Override
public synchronized void write(byte[] buffer, int offset, int len) {
expand(len);
super.write(buffer, offset, len);
}
@Override
public synchronized void write(int oneByte) {
expand(1);
super.write(oneByte);
}
}

View File

@@ -1,303 +0,0 @@
package sharescreen.wanjian.com.server;
import android.app.Activity;
import android.app.Application;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Point;
import android.os.Build;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.Looper;
import android.os.SystemClock;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.widget.Toast;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.ArrayList;
import java.util.List;
/**
* Created by wanjian on 2016/11/20.
*/
public class RecorderManager {
private static final String TAG = RecorderManager.class.getName();
public static final byte VERSION = 1;
private static RecorderManager sManager;
private Context mContext;
private Handler mCompressHandler;
private List<ClientHandler> mClientHandlers = new ArrayList<>();
private Bitmap mDrawingBoard;
private Canvas mCanvas = new Canvas();
private View rootView;
private Handler mUIHandler = new Handler(Looper.getMainLooper());
private Runnable mDrawTask = new DrawTask();
private Runnable mCompressTask = new CompressTask();
private final int MAX_CLIENT_COUNT = 10;
// private final float fps = 60f;
// private final int delay = (int) (1000 / fps);
public static synchronized RecorderManager getInstance(Context context) {
if (sManager == null) {
sManager = new RecorderManager(context);
}
return sManager;
}
private RecorderManager(Context context) {
this.mContext = context.getApplicationContext();
new HandlerThread("Compress-Thread") {
@Override
protected void onLooperPrepared() {
super.onLooperPrepared();
mCompressHandler = new Handler();
}
}.start();
startListen();
}
private void startListen() {
new Thread() {
@Override
public void run() {
super.run();
ServerSocket serverSocket = null;
for (int i = 8080; i < 65535; i++) {
try {
serverSocket = new ServerSocket(i);
final int port = i;
mUIHandler.post(new Runnable() {
@Override
public void run() {
Toast.makeText(mContext, "端口: " + port, Toast.LENGTH_SHORT).show();
}
});
break;
} catch (IOException e) {
}
}
for (int i = 0; i < MAX_CLIENT_COUNT; ) {
try {
final Socket socket = serverSocket.accept();
new HandlerThread("Client-Thread") {
@Override
protected void onLooperPrepared() {
super.onLooperPrepared();
mClientHandlers.add(new ClientHandler(socket));
}
}.start();
listenRemoteTouchEvent(socket);
i++;
} catch (IOException e) {
return;
}
}
}
}.start();
}
private void listenRemoteTouchEvent(final Socket socket) {
new Thread() {
private final String DOWN = "DOWN";
private final String MOVE = "MOVE";
private final String UP = "UP";
@Override
public void run() {
super.run();
try {
MotionEvent motionEvent = null;
BufferedReader reader = new BufferedReader(new InputStreamReader(socket.getInputStream()));
while (true) {
String line;
try {
line = reader.readLine();
} catch (Exception e) {
return;
}
try {
if (line.startsWith(DOWN)) {
hanlerDown(line.substring(DOWN.length()));
} else if (line.startsWith(MOVE)) {
float[] xy = getXY(line.substring(MOVE.length()));
if (motionEvent == null) {
motionEvent = MotionEvent.obtain(SystemClock.uptimeMillis(), SystemClock.uptimeMillis(), MotionEvent.ACTION_DOWN, xy[0], xy[1], 0);
} else {
motionEvent.setAction(MotionEvent.ACTION_MOVE);
// motionEvent.setLocation(xy[0], xy[1]);
}
sendTouchEvent(motionEvent, motionEvent.getAction(), xy[0], xy[1]);
} else if (line.startsWith(UP)) {
float[] xy = getXY(line.substring(UP.length()));
sendTouchEvent(motionEvent, MotionEvent.ACTION_UP, xy[0], xy[1]);
motionEvent = null;
}
} catch (Exception e) {
}
}
} catch (Exception e) {
}
}
private void sendTouchEvent(final MotionEvent motionEvent, final int action, final float x, final float y) {
mUIHandler.post(new Runnable() {
@Override
public void run() {
try {
motionEvent.setAction(action);
motionEvent.setLocation(x, y);
rootView.dispatchTouchEvent(motionEvent);
Log.d(TAG, "touch event " + motionEvent.getAction() + " " + motionEvent.getX() + " " + motionEvent.getY());
} catch (Exception e) {
}
}
});
}
private float[] getXY(String nums) {
try {
String[] s = nums.split("#");
float scaleX = Float.parseFloat(s[0]);
float scaleY = Float.parseFloat(s[1]);
return new float[]{rootView.getWidth() * scaleX, rootView.getHeight() * scaleY};
} catch (Exception e) {
}
return new float[2];
}
private void hanlerDown(String line) {
try {
float xy[] = getXY(line);
MotionEvent motionEvent = MotionEvent.obtain(SystemClock.uptimeMillis(), SystemClock.uptimeMillis(), MotionEvent.ACTION_DOWN, xy[0], xy[1], 0);
sendTouchEvent(motionEvent, MotionEvent.ACTION_DOWN, xy[0], xy[1]);
sendTouchEvent(motionEvent, MotionEvent.ACTION_UP, xy[0], xy[1]);
} catch (Exception e) {
}
}
}.start();
}
public void stopRecorder() {
rootView = null;
mUIHandler.removeCallbacks(mDrawTask);
if (mCompressHandler != null) {
mCompressHandler.getLooper().quit();
}
for (ClientHandler clientHandler : mClientHandlers) {
clientHandler.close();
}
// try {
// socket.close();
// } catch (Exception e) {
//
// }
sManager = null;
}
/**
* API14(ICE_CREAM_SANDWICH)及以上版本全局初始化一次即可,context任意,可以是activity也可以是其他。
* 以下版本需在每个activity的onResume中初始化,context需要传当前activity。
*
* @param context API14(ICE_CREAM_SANDWICH)以下传当前activty,其他版本建议传当前activty也可以是任意context
* @param scale 实际传输图像尺寸与手机屏幕比例
*/
public void startRecorder(final Context context, float scale) {
Point point = getScreenSize(context);
int exceptW = (int) (point.x * scale);
int exceptH = (int) (point.y * scale);
if (mDrawingBoard == null) {
mDrawingBoard = Bitmap.createBitmap(exceptW, exceptH, Bitmap.Config.RGB_565);
}
if (mDrawingBoard.getWidth() != exceptW || mDrawingBoard.getHeight() != exceptH) {
mDrawingBoard.recycle();
mDrawingBoard = Bitmap.createBitmap(exceptW, exceptH, Bitmap.Config.RGB_565);
}
mCanvas.setBitmap(mDrawingBoard);
mCanvas.scale(scale, scale);
if (context instanceof Activity) {
startRecorderActivity(((Activity) context));
} else {
Toast.makeText(context, "请下拉一下通知栏试试", Toast.LENGTH_SHORT).show();
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
((Application) context.getApplicationContext()).registerActivityLifecycleCallbacks(new ActivityLifecycleCallbacksAdapter() {
@Override
public void onActivityResumed(Activity activity) {
startRecorderActivity(activity);
}
});
}
}
private static Point getScreenSize(Context context) {
int w = context.getResources().getDisplayMetrics().widthPixels;
int h = context.getResources().getDisplayMetrics().heightPixels;
return new Point(w, h);
}
private void startRecorderActivity(Activity activity) {
rootView = activity.getWindow().getDecorView();
mUIHandler.removeCallbacks(mDrawTask);
mUIHandler.post(mDrawTask);
}
private class DrawTask implements Runnable {
@Override
public void run() {
if (rootView == null) {
return;
}
mUIHandler.removeCallbacks(mDrawTask);
rootView.draw(mCanvas);
mCompressHandler.removeCallbacks(mCompressTask);
mCompressHandler.post(mCompressTask);
}
}
private class CompressTask implements Runnable {
ByteArrayPool mByteArrayPool = new ByteArrayPool(1024 * 30);
PoolingByteArrayOutputStream mByteArrayOutputStream = new PoolingByteArrayOutputStream(mByteArrayPool);
@Override
public void run() {
try {//动态改变缩放比例时,由于不在该线程,可能导致bitmap被回收
mByteArrayOutputStream.reset();
long s = System.currentTimeMillis();
mDrawingBoard.compress(Bitmap.CompressFormat.JPEG, 60, mByteArrayOutputStream);
byte[] jpgBytes = mByteArrayOutputStream.toByteArray();
Log.d(TAG, "compress " + (System.currentTimeMillis() - s));
for (ClientHandler clientHandler : mClientHandlers) {
clientHandler.sendData(jpgBytes);
}
mUIHandler.post(mDrawTask);
} catch (Exception e) {
}
// mUIHandler.postDelayed(mDrawTask, delay);
}
}
}

View File

@@ -1,19 +0,0 @@
package sharescreen.wanjian.com.server;
import android.app.Activity;
import android.os.Bundle;
import sharescreen.wanjian.com.a.R;
/**
* Created by wanjian on 2016/11/19.
*/
public class SecondActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_2);
}
}

View File

@@ -1,117 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:orientation="vertical"
tools:context="sharescreen.wanjian.com.a.sharescreen.wanjian.com.server.MainActivity">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<ImageView
android:layout_width="match_parent"
android:layout_height="100dp"
android:src="@mipmap/ic_launcher"
android:background="#e1e1e1"/>
<ImageView
android:layout_width="match_parent"
android:layout_height="100dp"
android:src="@mipmap/ic_launcher"
android:background="#e1e"/>
<ImageView
android:layout_width="match_parent"
android:layout_height="100dp"
android:src="@mipmap/ic_launcher"
android:background="#dea"/>
<ImageView
android:layout_width="match_parent"
android:layout_height="100dp"
android:src="@mipmap/ic_launcher"
android:background="#a38"/>
<ImageView
android:layout_width="match_parent"
android:layout_height="100dp"
android:src="@mipmap/ic_launcher"
android:background="#390"/>
<ImageView
android:layout_width="match_parent"
android:layout_height="100dp"
android:src="@mipmap/ic_launcher"
android:background="#e1e1e1"/>
<ImageView
android:layout_width="match_parent"
android:layout_height="100dp"
android:src="@mipmap/ic_launcher"
android:background="#e1e"/>
<ImageView
android:layout_width="match_parent"
android:layout_height="100dp"
android:src="@mipmap/ic_launcher"
android:background="#dea"/>
<ImageView
android:layout_width="match_parent"
android:layout_height="100dp"
android:src="@mipmap/ic_launcher"
android:background="#a38"/>
<ImageView
android:layout_width="match_parent"
android:layout_height="100dp"
android:src="@mipmap/ic_launcher"
android:background="#390"/>
<ImageView
android:layout_width="match_parent"
android:layout_height="100dp"
android:src="@mipmap/ic_launcher"
android:background="#e1e1e1"/>
<ImageView
android:layout_width="match_parent"
android:layout_height="100dp"
android:src="@mipmap/ic_launcher"
android:background="#e1e"/>
<ImageView
android:layout_width="match_parent"
android:layout_height="100dp"
android:src="@mipmap/ic_launcher"
android:background="#dea"/>
<ImageView
android:layout_width="match_parent"
android:layout_height="100dp"
android:src="@mipmap/ic_launcher"
android:background="#a38"/>
<ImageView
android:layout_width="match_parent"
android:layout_height="100dp"
android:src="@mipmap/ic_launcher"
android:background="#390"/>
</LinearLayout>
</ScrollView>
</LinearLayout>

View File

@@ -1,42 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:orientation="vertical"
tools:context="sharescreen.wanjian.com.a.sharescreen.wanjian.com.server.MainActivity">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="30sp"
android:text="0"
android:id="@+id/tv"
android:textColor="#ff0000"/>
<Button
android:id="@+id/ok"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="开启"/>
<Button
android:id="@+id/jieshu"
android:layout_marginTop="10dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="结束"/>
<Button
android:id="@+id/act2"
android:layout_marginTop="10dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="开启新Act"/>
</LinearLayout>

View File

@@ -1,22 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#e1e1e1"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="#fff"
android:weightSum="5">
<View
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="2"
android:background="#f00"
/>
</LinearLayout>
</LinearLayout>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

View File

@@ -1,6 +0,0 @@
<resources>
<!-- Example customization of dimensions originally defined in res/values/dimens.xml
(such as screen margins) for screens with more than 820dp of available width. This
would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively). -->
<dimen name="activity_horizontal_margin">64dp</dimen>
</resources>

View File

@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#3F51B5</color>
<color name="colorPrimaryDark">#303F9F</color>
<color name="colorAccent">#FF4081</color>
</resources>

View File

@@ -1,5 +0,0 @@
<resources>
<!-- Default screen margins, per the Android Design guidelines. -->
<dimen name="activity_horizontal_margin">16dp</dimen>
<dimen name="activity_vertical_margin">16dp</dimen>
</resources>

View File

@@ -1,3 +0,0 @@
<resources>
<string name="app_name">屏幕共享A</string>
</resources>

View File

@@ -1,11 +0,0 @@
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
</resources>

View File

@@ -1,17 +0,0 @@
package sharescreen.wanjian.com.a;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
}