Skip to content

Commit cb4485a

Browse files
committed
init project
0 parents  commit cb4485a

34 files changed

+1016
-0
lines changed

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
*.iml
2+
.gradle
3+
/local.properties
4+
/.idea/workspace.xml
5+
/.idea/libraries
6+
.DS_Store
7+
/build
8+
/captures
9+
.externalNativeBuild

.idea/compiler.xml

Lines changed: 22 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/copyright/profiles_settings.xml

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/gradle.xml

Lines changed: 18 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

Lines changed: 62 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules.xml

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/runConfigurations.xml

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/vcs.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

app/build.gradle

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
apply plugin: 'com.android.application'
2+
3+
android {
4+
compileSdkVersion 24
5+
buildToolsVersion "24.0.2"
6+
defaultConfig {
7+
applicationId "com.wx.multiwindow"
8+
minSdkVersion 24
9+
targetSdkVersion 24
10+
versionCode 1
11+
versionName "1.0"
12+
}
13+
buildTypes {
14+
release {
15+
minifyEnabled false
16+
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
17+
}
18+
}
19+
}
20+
21+
dependencies {
22+
compile fileTree(dir: 'libs', include: ['*.jar'])
23+
compile 'com.android.support:appcompat-v7:24.2.0'
24+
compile 'com.wx.android.common:common:1.0.1'
25+
}

app/proguard-rules.pro

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Add project specific ProGuard rules here.
2+
# By default, the flags in this file are appended to flags specified
3+
# in D:\work\android-sdk-windows/tools/proguard/proguard-android.txt
4+
# You can edit the include path and order by changing the proguardFiles
5+
# directive in build.gradle.
6+
#
7+
# For more details, see
8+
# http://developer.android.com/guide/developing/tools/proguard.html
9+
10+
# Add any project specific keep options here:
11+
12+
# If your project uses WebView with JS, uncomment the following
13+
# and specify the fully qualified class name to the JavaScript interface
14+
# class:
15+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16+
# public *;
17+
#}

app/src/main/AndroidManifest.xml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
package="com.wx.multiwindow">
4+
5+
<uses-permission android:name="android.permission.VIBRATE" />
6+
7+
<application
8+
android:allowBackup="true"
9+
android:icon="@mipmap/ic_launcher"
10+
android:label="@string/app_name"
11+
android:resizeableActivity="true"
12+
android:supportsRtl="true"
13+
android:theme="@style/AppTheme">
14+
<activity android:name=".Activity1" android:resizeableActivity="true">
15+
<layout
16+
android:defaultHeight="500dp"
17+
android:defaultWidth="600dp"
18+
android:gravity="top|end"
19+
android:minHeight="150dp"
20+
android:minWidth="100dp" />
21+
<intent-filter>
22+
<action android:name="android.intent.action.MAIN" />
23+
24+
<category android:name="android.intent.category.LAUNCHER" />
25+
</intent-filter>
26+
</activity>
27+
<activity android:name=".Activity2" android:resizeableActivity="true">
28+
<layout
29+
android:defaultHeight="300dp"
30+
android:defaultWidth="300dp"
31+
android:gravity="top|end"
32+
android:minHeight="100dp"
33+
android:minWidth="100dp" />
34+
</activity>
35+
</application>
36+
37+
</manifest>
Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
/*
2+
* Copyright (C) 2016 [email protected]
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package com.wx.multiwindow;
17+
18+
import android.content.ClipData;
19+
import android.content.Intent;
20+
import android.net.Uri;
21+
import android.os.Bundle;
22+
import android.text.Html;
23+
import android.text.TextUtils;
24+
import android.view.View;
25+
import android.widget.ImageView;
26+
import android.widget.ScrollView;
27+
import android.widget.TextView;
28+
29+
import com.wx.android.common.util.VibratorUtils;
30+
31+
/**
32+
* First Activity
33+
*
34+
* @author venshine
35+
*/
36+
public class Activity1 extends BaseActivity {
37+
38+
private static StringBuilder mBuilder = new StringBuilder();
39+
private TextView mTextView;
40+
private ScrollView mScrollView;
41+
private ImageView mImageView;
42+
43+
@Override
44+
protected void onCreate(Bundle savedInstanceState) {
45+
super.onCreate(savedInstanceState);
46+
setContentView(R.layout.layout_activity1);
47+
setTitle("Frist Activity");
48+
mTextView = (TextView) findViewById(R.id.textview);
49+
mScrollView = (ScrollView) findViewById(R.id.scrollview);
50+
mScrollView.post(new Runnable() {
51+
@Override
52+
public void run() {
53+
mScrollView.fullScroll(View.FOCUS_DOWN);
54+
}
55+
});
56+
mImageView = (ImageView) findViewById(R.id.imageview);
57+
mImageView.setTag("Drag an ImageView from First Activity");
58+
mImageView.setOnLongClickListener(new View.OnLongClickListener() {
59+
60+
public boolean onLongClick(View view) {
61+
VibratorUtils.vibrate(mActivity, 100);
62+
Uri uri = getUri(mActivity, R.mipmap.ic_launcher);
63+
ClipData dragData = ClipData.newPlainText("", (CharSequence) view.getTag());
64+
ClipData.Item imageItem = new ClipData.Item(uri);
65+
dragData.addItem(imageItem);
66+
View.DragShadowBuilder shadow = new View.DragShadowBuilder(view);
67+
view.startDragAndDrop(dragData, shadow, view, View.DRAG_FLAG_GLOBAL);
68+
return true;
69+
}
70+
});
71+
print("onCreate", "#ff0000", false);
72+
}
73+
74+
/**
75+
* 打印信息
76+
*
77+
* @param msg
78+
*/
79+
public void print(String msg) {
80+
mBuilder.append(msg).append("<br />");
81+
mTextView.setText(Html.fromHtml(mBuilder.toString()));
82+
}
83+
84+
/**
85+
* 打印富文本信息
86+
*
87+
* @param msg
88+
* @param color
89+
* @param bold
90+
*/
91+
public void print(String msg, String color, boolean bold) {
92+
mBuilder.append(TextUtils.isEmpty(color) ? "" : "<font color='" + color + "'>").append(bold ? "<strong>" : "")
93+
.append(msg).append(bold ? "</strong>" : "").append(TextUtils.isEmpty(color) ? "" : "</font>")
94+
.append("<br />");
95+
mTextView.setText(Html.fromHtml(mBuilder.toString()));
96+
}
97+
98+
/**
99+
* 跳转Activity2
100+
*
101+
* @param v
102+
*/
103+
public void click(View v) {
104+
Intent intent = new Intent(this, Activity2.class);
105+
intent.setFlags(Intent.FLAG_ACTIVITY_LAUNCH_ADJACENT | Intent.FLAG_ACTIVITY_NEW_TASK);
106+
startActivity(intent);
107+
}
108+
109+
/**
110+
* 清理日志
111+
*
112+
* @param v
113+
*/
114+
public void clear(View v) {
115+
mBuilder.delete(0, mBuilder.length());
116+
mTextView.setText("");
117+
}
118+
}

0 commit comments

Comments
 (0)