diff --git a/src/android/AndroidManifest.xml b/src/android/AndroidManifest.xml new file mode 100644 index 0000000000000000000000000000000000000000..62cbe65a860b318ee09edbc1651c5265f9955659 --- /dev/null +++ b/src/android/AndroidManifest.xml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="utf-8"?> +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + package="project.alwaystry" + android:versionCode="1" + android:versionName="1.0" > + + <uses-sdk android:minSdkVersion="15" /> + + <application + android:icon="@drawable/starting_logo" + android:label="@string/app_name" > + <activity android:name=".BDTabWidget" android:label="@string/app_name"> + <intent-filter > + <action android:name="android.intent.action.MAIN" /> + + <category android:name="android.intent.category.LAUNCHER" /> + </intent-filter> + </activity> + <activity android:name="AlwaystryActivity"> + <intent-filter > + <action android:name="android.intent.action.MAIN" /> + </intent-filter> + </activity> + <activity android:name="AnotherTagActivity"> + <intent-filter > + <action android:name="android.intent.action.MAIN" /> + </intent-filter> + </activity> + </application> + +</manifest> \ No newline at end of file diff --git a/src/android/bin/alwaystry.apk b/src/android/bin/alwaystry.apk new file mode 100644 index 0000000000000000000000000000000000000000..cb10a3afe3d725950c6cff79794b101d3d465719 Binary files /dev/null and b/src/android/bin/alwaystry.apk differ diff --git a/src/android/bin/classes.dex b/src/android/bin/classes.dex new file mode 100644 index 0000000000000000000000000000000000000000..db64686a9d25b12e144b979f7e4bbaf8a4217585 Binary files /dev/null and b/src/android/bin/classes.dex differ diff --git a/src/android/bin/classes/project/alwaystry/AlwaystryActivity$1.class b/src/android/bin/classes/project/alwaystry/AlwaystryActivity$1.class new file mode 100644 index 0000000000000000000000000000000000000000..da0d0f34548d1146bed334b96fd07cc50ec7ea4f Binary files /dev/null and b/src/android/bin/classes/project/alwaystry/AlwaystryActivity$1.class differ diff --git a/src/android/bin/classes/project/alwaystry/AlwaystryActivity$2.class b/src/android/bin/classes/project/alwaystry/AlwaystryActivity$2.class new file mode 100644 index 0000000000000000000000000000000000000000..30d980d7d0f3845ade3f5fe322f5e3b3cf57f2c8 Binary files /dev/null and b/src/android/bin/classes/project/alwaystry/AlwaystryActivity$2.class differ diff --git a/src/android/bin/classes/project/alwaystry/AlwaystryActivity.class b/src/android/bin/classes/project/alwaystry/AlwaystryActivity.class new file mode 100644 index 0000000000000000000000000000000000000000..53a6e3aff1100860eca8c73358ce770a4fc30f24 Binary files /dev/null and b/src/android/bin/classes/project/alwaystry/AlwaystryActivity.class differ diff --git a/src/android/bin/classes/project/alwaystry/AnotherTagActivity.class b/src/android/bin/classes/project/alwaystry/AnotherTagActivity.class new file mode 100644 index 0000000000000000000000000000000000000000..9f958d234f1a358029c3686016534543a563aaf6 Binary files /dev/null and b/src/android/bin/classes/project/alwaystry/AnotherTagActivity.class differ diff --git a/src/android/bin/classes/project/alwaystry/BDTabWidget.class b/src/android/bin/classes/project/alwaystry/BDTabWidget.class new file mode 100644 index 0000000000000000000000000000000000000000..6b2f7c50108372b7a79ef9225409622a2e73ce3c Binary files /dev/null and b/src/android/bin/classes/project/alwaystry/BDTabWidget.class differ diff --git a/src/android/bin/classes/project/alwaystry/Blockrectangle.class b/src/android/bin/classes/project/alwaystry/Blockrectangle.class new file mode 100644 index 0000000000000000000000000000000000000000..d0a988dab19d0eab21e01f6da434c6a0cc80b1f6 Binary files /dev/null and b/src/android/bin/classes/project/alwaystry/Blockrectangle.class differ diff --git a/src/android/bin/classes/project/alwaystry/R$attr.class b/src/android/bin/classes/project/alwaystry/R$attr.class new file mode 100644 index 0000000000000000000000000000000000000000..48ddc676cbb8a9a1ef3672d6c0b5e94f056aa81c Binary files /dev/null and b/src/android/bin/classes/project/alwaystry/R$attr.class differ diff --git a/src/android/bin/classes/project/alwaystry/R$drawable.class b/src/android/bin/classes/project/alwaystry/R$drawable.class new file mode 100644 index 0000000000000000000000000000000000000000..8440375684d54bff038b15e25d9b96360799fb01 Binary files /dev/null and b/src/android/bin/classes/project/alwaystry/R$drawable.class differ diff --git a/src/android/bin/classes/project/alwaystry/R$id.class b/src/android/bin/classes/project/alwaystry/R$id.class new file mode 100644 index 0000000000000000000000000000000000000000..515a31aa11b378c766dcdfce422eb4a47c57fd22 Binary files /dev/null and b/src/android/bin/classes/project/alwaystry/R$id.class differ diff --git a/src/android/bin/classes/project/alwaystry/R$layout.class b/src/android/bin/classes/project/alwaystry/R$layout.class new file mode 100644 index 0000000000000000000000000000000000000000..c76e904836a24803893452eca19a7ca4a7c5a4d3 Binary files /dev/null and b/src/android/bin/classes/project/alwaystry/R$layout.class differ diff --git a/src/android/bin/classes/project/alwaystry/R$string.class b/src/android/bin/classes/project/alwaystry/R$string.class new file mode 100644 index 0000000000000000000000000000000000000000..1fb79b41e786314e1ca097186624ec2ba8b066f9 Binary files /dev/null and b/src/android/bin/classes/project/alwaystry/R$string.class differ diff --git a/src/android/bin/classes/project/alwaystry/R$styleable.class b/src/android/bin/classes/project/alwaystry/R$styleable.class new file mode 100644 index 0000000000000000000000000000000000000000..33810d4b2337b976b884d9133f06de0c19614101 Binary files /dev/null and b/src/android/bin/classes/project/alwaystry/R$styleable.class differ diff --git a/src/android/bin/classes/project/alwaystry/R.class b/src/android/bin/classes/project/alwaystry/R.class new file mode 100644 index 0000000000000000000000000000000000000000..63c63873e0e7b52c65e040ef72fb86dd24d4e718 Binary files /dev/null and b/src/android/bin/classes/project/alwaystry/R.class differ diff --git a/src/android/bin/classes/project/alwaystry/drageventblock$1.class b/src/android/bin/classes/project/alwaystry/drageventblock$1.class new file mode 100644 index 0000000000000000000000000000000000000000..7d61bb18c19d21091db303bd9de1b04a3bbf9065 Binary files /dev/null and b/src/android/bin/classes/project/alwaystry/drageventblock$1.class differ diff --git a/src/android/bin/classes/project/alwaystry/drageventblock$2.class b/src/android/bin/classes/project/alwaystry/drageventblock$2.class new file mode 100644 index 0000000000000000000000000000000000000000..4a8da2c4a1c3b3e5ac40e8ca7b9279f44954c601 Binary files /dev/null and b/src/android/bin/classes/project/alwaystry/drageventblock$2.class differ diff --git a/src/android/bin/classes/project/alwaystry/drageventblock$MyShadowBuilder.class b/src/android/bin/classes/project/alwaystry/drageventblock$MyShadowBuilder.class new file mode 100644 index 0000000000000000000000000000000000000000..49b3248eabf4708933cdd9bf3513eb277f03977f Binary files /dev/null and b/src/android/bin/classes/project/alwaystry/drageventblock$MyShadowBuilder.class differ diff --git a/src/android/bin/classes/project/alwaystry/drageventblock.class b/src/android/bin/classes/project/alwaystry/drageventblock.class new file mode 100644 index 0000000000000000000000000000000000000000..412811fc8c6f0112cba311b169b53468ffcf2704 Binary files /dev/null and b/src/android/bin/classes/project/alwaystry/drageventblock.class differ diff --git a/src/android/bin/res/drawable-hdpi/ic_launcher.png b/src/android/bin/res/drawable-hdpi/ic_launcher.png new file mode 100644 index 0000000000000000000000000000000000000000..882eb148ae9ed4d0283f226739560644923e1fee Binary files /dev/null and b/src/android/bin/res/drawable-hdpi/ic_launcher.png differ diff --git a/src/android/bin/res/drawable-ldpi/ic_launcher.png b/src/android/bin/res/drawable-ldpi/ic_launcher.png new file mode 100644 index 0000000000000000000000000000000000000000..18689f651c108f3ef9174b153b35799048266ee5 Binary files /dev/null and b/src/android/bin/res/drawable-ldpi/ic_launcher.png differ diff --git a/src/android/bin/res/drawable-mdpi/ic_launcher.png b/src/android/bin/res/drawable-mdpi/ic_launcher.png new file mode 100644 index 0000000000000000000000000000000000000000..02e96b96078eaf477369b48eea156f30d9651877 Binary files /dev/null and b/src/android/bin/res/drawable-mdpi/ic_launcher.png differ diff --git a/src/android/bin/resources.ap_ b/src/android/bin/resources.ap_ new file mode 100644 index 0000000000000000000000000000000000000000..19e161b7b113d4cc726dcc7bd112fd3e2cf3ff23 Binary files /dev/null and b/src/android/bin/resources.ap_ differ diff --git a/src/android/gen/project/alwaystry/R.java b/src/android/gen/project/alwaystry/R.java new file mode 100644 index 0000000000000000000000000000000000000000..17b7277bf0014e338b44a6a72d911f95420067cb --- /dev/null +++ b/src/android/gen/project/alwaystry/R.java @@ -0,0 +1,43 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * aapt tool from the resource data it found. It + * should not be modified by hand. + */ + +package project.alwaystry; + +public final class R { + public static final class attr { + } + public static final class drawable { + public static final int ic_launcher=0x7f020000; + public static final int starting_logo=0x7f020001; + } + public static final class id { + public static final int blockrectangle1=0x7f050002; + public static final int drageventblock1=0x7f050001; + public static final int relativeLayout1=0x7f050000; + } + public static final class layout { + public static final int anothertab=0x7f030000; + public static final int block=0x7f030001; + public static final int main=0x7f030002; + } + public static final class string { + public static final int app_name=0x7f040001; + public static final int hello=0x7f040000; + } + public static final class styleable { + /** These are the attributes that we want to retrieve from the theme + in app/PreferencesFromCode.java + These are the attributes that we want to retrieve from the theme + in view/Gallery1.java + These are attributes used with 'DraggableDot' drawables in + view/DragAndDropActivity.java and view/DraggableDot.java + */ + public static final int[] Blockretangle = { + + }; + }; +} diff --git a/src/android/proguard.cfg b/src/android/proguard.cfg new file mode 100644 index 0000000000000000000000000000000000000000..b1cdf17b5bb40b4839cfc80f7e91bbcf7b94f798 --- /dev/null +++ b/src/android/proguard.cfg @@ -0,0 +1,40 @@ +-optimizationpasses 5 +-dontusemixedcaseclassnames +-dontskipnonpubliclibraryclasses +-dontpreverify +-verbose +-optimizations !code/simplification/arithmetic,!field/*,!class/merging/* + +-keep public class * extends android.app.Activity +-keep public class * extends android.app.Application +-keep public class * extends android.app.Service +-keep public class * extends android.content.BroadcastReceiver +-keep public class * extends android.content.ContentProvider +-keep public class * extends android.app.backup.BackupAgentHelper +-keep public class * extends android.preference.Preference +-keep public class com.android.vending.licensing.ILicensingService + +-keepclasseswithmembernames class * { + native <methods>; +} + +-keepclasseswithmembers class * { + public <init>(android.content.Context, android.util.AttributeSet); +} + +-keepclasseswithmembers class * { + public <init>(android.content.Context, android.util.AttributeSet, int); +} + +-keepclassmembers class * extends android.app.Activity { + public void *(android.view.View); +} + +-keepclassmembers enum * { + public static **[] values(); + public static ** valueOf(java.lang.String); +} + +-keep class * implements android.os.Parcelable { + public static final android.os.Parcelable$Creator *; +} diff --git a/src/android/project.properties b/src/android/project.properties new file mode 100644 index 0000000000000000000000000000000000000000..8da376af8d49472521c33bad1d544b8755a62c16 --- /dev/null +++ b/src/android/project.properties @@ -0,0 +1,11 @@ +# This file is automatically generated by Android Tools. +# Do not modify this file -- YOUR CHANGES WILL BE ERASED! +# +# This file must be checked in Version Control Systems. +# +# To customize properties used by the Ant build system use, +# "ant.properties", and override values to adapt the script to your +# project structure. + +# Project target. +target=android-15 diff --git a/src/android/res/drawable-hdpi/ic_launcher.png b/src/android/res/drawable-hdpi/ic_launcher.png new file mode 100644 index 0000000000000000000000000000000000000000..8074c4c571b8cd19e27f4ee5545df367420686d7 Binary files /dev/null and b/src/android/res/drawable-hdpi/ic_launcher.png differ diff --git a/src/android/res/drawable-ldpi/ic_launcher.png b/src/android/res/drawable-ldpi/ic_launcher.png new file mode 100644 index 0000000000000000000000000000000000000000..1095584ec21f71cd0afc9e0993aa2209671b590c Binary files /dev/null and b/src/android/res/drawable-ldpi/ic_launcher.png differ diff --git a/src/android/res/drawable-mdpi/ic_launcher.png b/src/android/res/drawable-mdpi/ic_launcher.png new file mode 100644 index 0000000000000000000000000000000000000000..a07c69fa5a0f4da5d5efe96eea12a543154dbab6 Binary files /dev/null and b/src/android/res/drawable-mdpi/ic_launcher.png differ diff --git a/src/android/res/drawable-mdpi/starting_logo.gif b/src/android/res/drawable-mdpi/starting_logo.gif new file mode 100644 index 0000000000000000000000000000000000000000..60795fedf7e469e6acee036bcd6442267e00a17d Binary files /dev/null and b/src/android/res/drawable-mdpi/starting_logo.gif differ diff --git a/src/android/res/layout/anothertab.xml b/src/android/res/layout/anothertab.xml new file mode 100644 index 0000000000000000000000000000000000000000..9062fdfc3dcca751a4f984148d20abc43cd21467 --- /dev/null +++ b/src/android/res/layout/anothertab.xml @@ -0,0 +1,22 @@ +<?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:orientation="vertical" > + + <RelativeLayout + android:id="@+id/relativeLayout1" + android:layout_width="match_parent" + android:layout_height="match_parent" > + + <project.alwaystry.drageventblock + android:id="@+id/drageventblock1" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignParentTop="true" + android:layout_centerHorizontal="true" + android:layout_marginTop="124dp" /> + + </RelativeLayout> + +</LinearLayout> \ No newline at end of file diff --git a/src/android/res/layout/block.xml b/src/android/res/layout/block.xml new file mode 100644 index 0000000000000000000000000000000000000000..404fdf4e2bfc2972801949f7174e0d666b1f5d4f --- /dev/null +++ b/src/android/res/layout/block.xml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="utf-8"?> + <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:id="@+id/relativeLayout1" + android:layout_width="fill_parent" + android:layout_height="fill_parent" > + + <project.alwaystry.Blockrectangle + android:id="@+id/blockrectangle1" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignParentLeft="true" + android:layout_alignParentTop="true" + android:layout_marginLeft="65dp" + android:layout_marginTop="75dp" /> + + </RelativeLayout> diff --git a/src/android/res/layout/main.xml b/src/android/res/layout/main.xml new file mode 100644 index 0000000000000000000000000000000000000000..1d0e21b7da96770f55b708cfc65279f1bcccd963 --- /dev/null +++ b/src/android/res/layout/main.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="utf-8"?> +<TabHost xmlns:android="http://schemas.android.com/apk/res/android" + android:id="@android:id/tabhost" + android:layout_width="fill_parent" + android:layout_height="fill_parent"> + <LinearLayout + android:orientation="vertical" + android:layout_width="fill_parent" + android:layout_height="fill_parent" + android:padding="5dp"> + <TabWidget + android:id="@android:id/tabs" + android:layout_width="fill_parent" + android:layout_height="wrap_content" /> + <FrameLayout + android:id="@android:id/tabcontent" + android:layout_width="fill_parent" + android:layout_height="fill_parent" + android:padding="5dp" /> + </LinearLayout> +</TabHost> \ No newline at end of file diff --git a/src/android/res/values/attrs.xml b/src/android/res/values/attrs.xml new file mode 100644 index 0000000000000000000000000000000000000000..0d31153ef47af45cb08766e6565d5ac35d9aa4de --- /dev/null +++ b/src/android/res/values/attrs.xml @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2007 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. +--> + +<resources> + <!-- These are the attributes that we want to retrieve from the theme + in app/PreferencesFromCode.java --> + + <!-- These are the attributes that we want to retrieve from the theme + in view/Gallery1.java --> + + <!-- These are attributes used with 'DraggableDot' drawables in + view/DragAndDropActivity.java and view/DraggableDot.java --> + <declare-styleable name="Blockretangle"> + </declare-styleable> + + <!-- These are the attributes that we want to retrieve for + app/FragmentArguments.java --> + +</resources> diff --git a/src/android/res/values/strings.xml b/src/android/res/values/strings.xml new file mode 100644 index 0000000000000000000000000000000000000000..0b83729e71b049dba206ebb4b68fe363fc2c50d7 --- /dev/null +++ b/src/android/res/values/strings.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> + + <string name="hello">Hello World, AlwaystryActivity!</string> + <string name="app_name">Alwaystry</string> + +</resources> \ No newline at end of file diff --git a/src/android/src/project/alwaystry/AlwaystryActivity.java b/src/android/src/project/alwaystry/AlwaystryActivity.java new file mode 100644 index 0000000000000000000000000000000000000000..be98af2b89dca204059db3611cfa355641467903 --- /dev/null +++ b/src/android/src/project/alwaystry/AlwaystryActivity.java @@ -0,0 +1,111 @@ +package project.alwaystry; + +import android.app.Activity; +import android.app.AlertDialog; +import android.content.DialogInterface; +import android.os.Bundle; +import android.os.SystemClock; +import android.util.Log; +import android.view.MotionEvent; +import android.view.View; +import android.view.View.OnLongClickListener; +import android.view.View.OnTouchListener; +import android.view.ViewGroup; +import android.widget.EditText; +import android.widget.FrameLayout; +import android.widget.RelativeLayout; + +public class AlwaystryActivity extends Activity implements OnLongClickListener,OnTouchListener{ + /** Called when the activity is first created. */ + private boolean dragActive = false; + private int mx =0; + private int my =0; + private long click1time = 0; + private Blockrectangle br; + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.block); + br = (Blockrectangle)findViewById(R.id.blockrectangle1); + br.setOnLongClickListener(this); + br.setOnTouchListener(this); + + } + + + public boolean onLongClick(View v) { + // TODO Auto-generated method stub + dragActive = true; + /* + RelativeLayout.LayoutParams lParams = (RelativeLayout.LayoutParams)(v.getLayoutParams()); + Log.i("Alwaystry", "lparams : topmagin, leftmargin " +lParams.topMargin+" "+lParams.leftMargin ); + mx = lParams.leftMargin; + my = lParams.topMargin;*/ + return true; + } + + @Override + public boolean onTouch(View v, MotionEvent event) { + + // TODO Auto-generated method stub + final int X = (int)event.getRawX(); + final int Y = (int)event.getRawY(); + if(event.getAction() == MotionEvent.ACTION_DOWN){ + RelativeLayout.LayoutParams RlParams = (RelativeLayout.LayoutParams)(v.getLayoutParams()); + Log.i("Alwaystry", "lparams : topmagin, leftmargin " +RlParams.topMargin+" "+RlParams.leftMargin ); + mx = X - RlParams.leftMargin; + my = Y - RlParams.topMargin; + if(click1time == 0){ + click1time = SystemClock.uptimeMillis(); + Log.i("Alwaystry","time is "+click1time); + }else if(SystemClock.uptimeMillis()-click1time < 1000){ + Log.i("Alwaystry","double click!!"); + click1time = 0; + AlertDialog.Builder alert = new AlertDialog.Builder(this); + alert.setTitle("Modifying"); + final EditText input = new EditText(this); + input.setText(br.getmText()); + alert.setView(input); + alert.setPositiveButton("Ok", new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int whichButton) { + br.setmText(input.getText().toString()); + br.invalidate(); + } + }); + + alert.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int whichButton) { + // Canceled. + } + }); + + alert.show(); + + }else{ + click1time = SystemClock.uptimeMillis(); + Log.i("Alwaystry","just click!!"); + } + } + + if(!dragActive){ + return false; + }else{ + switch(event.getAction()){ + case MotionEvent.ACTION_UP: + Log.i("Alwaystry","stop dragging"); + dragActive = false; + break; + case MotionEvent.ACTION_MOVE: + Log.i("Alwaystry","it is dragging"); + + RelativeLayout.LayoutParams lParams = (RelativeLayout.LayoutParams)(v.getLayoutParams()); + lParams.leftMargin = X - mx; + lParams.topMargin = Y - my; + v.setLayoutParams(lParams); + break; + + } + return true; + } + + } +} \ No newline at end of file diff --git a/src/android/src/project/alwaystry/AnotherTagActivity.java b/src/android/src/project/alwaystry/AnotherTagActivity.java new file mode 100644 index 0000000000000000000000000000000000000000..46049e0c5ec5218c88b44733bef869a459c23384 --- /dev/null +++ b/src/android/src/project/alwaystry/AnotherTagActivity.java @@ -0,0 +1,31 @@ +package project.alwaystry; + +import android.app.Activity; +import android.app.AlertDialog; +import android.content.DialogInterface; +import android.os.Bundle; +import android.os.SystemClock; +import android.util.Log; +import android.view.MotionEvent; +import android.view.View; +import android.view.View.OnLongClickListener; +import android.view.View.OnTouchListener; +import android.view.ViewGroup; +import android.widget.EditText; +import android.widget.FrameLayout; +import android.widget.RelativeLayout; + +public class AnotherTagActivity extends Activity { + /** Called when the activity is first created. */ + + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.anothertab); + + + } + + + + +} \ No newline at end of file diff --git a/src/android/src/project/alwaystry/BDTabWidget.java b/src/android/src/project/alwaystry/BDTabWidget.java new file mode 100644 index 0000000000000000000000000000000000000000..69a5182074d2247647f01e51d106fedd24de5219 --- /dev/null +++ b/src/android/src/project/alwaystry/BDTabWidget.java @@ -0,0 +1,34 @@ +package project.alwaystry; + +import android.app.TabActivity; +import android.content.Intent; +import android.content.res.Resources; +import android.os.Bundle; +import android.view.LayoutInflater; +import android.widget.TabHost; + +public class BDTabWidget extends TabActivity{ + + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.main); + + // Resources res = getResources(); // Resource object to get Drawables + TabHost tabHost = getTabHost(); // The activity TabHost + TabHost.TabSpec spec; // Resusable TabSpec for each tab + Intent intent; // Reusable Intent for each tab + + // Create an Intent to launch an Activity for the tab (to be reused) + intent = new Intent().setClass(this, AlwaystryActivity.class); + + // Initialize a TabSpec for each tab and add it to the TabHost + spec = tabHost.newTabSpec("avatarbd").setIndicator("Avatar BD") + .setContent(intent); + tabHost.addTab(spec); + intent = new Intent().setClass(this, AnotherTagActivity.class); + spec = tabHost.newTabSpec("anotherTag").setIndicator("Another Tag") + .setContent(intent); + tabHost.addTab(spec); + + } +} diff --git a/src/android/src/project/alwaystry/Blockrectangle.java b/src/android/src/project/alwaystry/Blockrectangle.java new file mode 100644 index 0000000000000000000000000000000000000000..5e732e7ad30e18a51aaefed0d0a633af816b4c78 --- /dev/null +++ b/src/android/src/project/alwaystry/Blockrectangle.java @@ -0,0 +1,72 @@ +package project.alwaystry; + +import project.alwaystry.drageventblock.MyShadowBuilder; +import android.content.ClipData; +import android.content.Context; +import android.graphics.Canvas; +import android.graphics.Color; +import android.graphics.Paint; +import android.text.TextPaint; +import android.util.AttributeSet; +import android.util.Log; +import android.view.MotionEvent; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ImageView; +import android.widget.RelativeLayout; + +public class Blockrectangle extends View{ + static final String Tag = "blockrectangle"; + private Paint mPaint; + private TextPaint mTextPaint; + String mText; + + public Blockrectangle(Context context, AttributeSet attrs) { + super(context, attrs); + + // TODO Auto-generated constructor stub + setFocusable(true); + setClickable(true); + + mPaint = new Paint(); + mPaint.setAntiAlias(true); + mPaint.setStrokeWidth(6); + mPaint.setColor(Color.LTGRAY); + + mTextPaint = new TextPaint(); + mTextPaint.setAntiAlias(true); + mTextPaint.setTextAlign(Paint.Align.CENTER); + mTextPaint.setColor(Color.BLACK); + + mText = "Name"; + + // TODO Auto-generated constructor stub + } + + String getmText(){ + return mText; + } + + void setmText(String text){ + mText = text; + } + + + protected void onDraw(Canvas canvas) { + float wf = getWidth(); + float hf = getHeight(); + + canvas.drawRect(0, 0, wf, hf, mPaint); + + if (mText != null && mText.length() > 0) { + canvas.drawText(mText, 0, mText.length(), + 30, 10, + mTextPaint); + } + } + + protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { + setMeasuredDimension(100,100); + } + +} diff --git a/src/android/src/project/alwaystry/drageventblock.java b/src/android/src/project/alwaystry/drageventblock.java new file mode 100644 index 0000000000000000000000000000000000000000..b610f6c890695c45efc991dd5cb7d81fb61e2537 --- /dev/null +++ b/src/android/src/project/alwaystry/drageventblock.java @@ -0,0 +1,105 @@ +package project.alwaystry; + +import android.content.ClipData; +import android.content.Context; +import android.graphics.Canvas; +import android.graphics.Color; +import android.graphics.Paint; +import android.util.AttributeSet; +import android.util.Log; +import android.view.DragEvent; +import android.view.Gravity; +import android.view.View; +import android.view.View.DragShadowBuilder; +import android.view.ViewGroup; +import android.widget.Toast; + +public class drageventblock extends View{ + static final String Tag = "blockrectangle"; + private Paint mPaint; + + public drageventblock(Context context, AttributeSet attrs) { + super(context, attrs); + + // TODO Auto-generated constructor stub + setFocusable(true); + setClickable(true); + + mPaint = new Paint(); + mPaint.setAntiAlias(true); + mPaint.setStrokeWidth(6); + mPaint.setColor(Color.LTGRAY); + + setOnLongClickListener(new View.OnLongClickListener() { + public boolean onLongClick(View v) { + ClipData data = ClipData.newPlainText("BlockRectangle", "BRectangle : " + v.toString()); + Log.i("Blockrectangle0",""+data); + v.startDrag(data, new MyShadowBuilder(v), + (Object)v, 0); + + return true; + } + }); + + setOnDragListener(new View.OnDragListener() { + public boolean onDrag(View v, DragEvent event) { + final int action = event.getAction(); + View dragView = (View) event.getLocalState(); + switch (action) { + case DragEvent.ACTION_DRAG_STARTED: { + Log.i("Blockrectangle1", "left : "+dragView.getLeft()); + // Bring up a fourth draggable dot on the fly. Note that it + // is properly notified about the ongoing drag, and lights up + // to indicate that it can handle the current content. + v.setVisibility(View.INVISIBLE); + } break; + + case DragEvent.ACTION_DRAG_ENDED: { + Log.i("Blockrectangle2", "left : "+event.toString()); + // Hide the surprise again + ViewGroup owner = (ViewGroup) dragView.getParent(); + owner.removeView(dragView); + ClipData clipdata = event.getClipData(); + Log.i("Blockrectangle3",""+clipdata); + //v.addView(dragView); + //v.setGravity(Gravity.CENTER); + //v.showAsLanded(); + + // Report the drop/no-drop result to the user + + } break; + } + return false; + } + }); + + } + + class MyShadowBuilder extends DragShadowBuilder { + public MyShadowBuilder(View view) { + super(view); + + } + + @Override + public void onDrawShadow(Canvas canvas) { + super.onDrawShadow(canvas); + } + } + + protected void onDraw(Canvas canvas) { + float wf = getWidth(); + float hf = getHeight(); + + canvas.drawRect(0, 0, wf, hf, mPaint); + } + + protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { + setMeasuredDimension(100,100); + } + + + + + +}