Permalink
Browse files

Initial Version

  • Loading branch information...
0 parents commit c21a114691773a85e25ded0ca432cac296944348 @masui committed Sep 27, 2010
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.pitecan.helloime"
+ android:versionCode="1"
+ android:versionName="1.0">
+ <application android:label="@string/app_name" android:icon="@drawable/icon">
+ <service android:name="HelloIME"
+ android:permission="android.permission.BIND_INPUT_METHOD">
+ <intent-filter>
+ <action android:name="android.view.InputMethod" />
+ </intent-filter>
+ <meta-data android:name="android.view.im" android:resource="@xml/method" />
+ </service>
+ </application>
+ </manifest>
+<!-- IMEでもiconは必要なのだろうか? -->
@@ -0,0 +1,12 @@
+all:
+ ruby tangle
+ ant debug
+install:
+ adb install -r bin/HelloIME-debug.apk
+uninstall:
+ adb uninstall com.pitecan.helloime
+debug:
+ adb logcat | grep HelloIME
+clean:
+ /bin/rm -r -f bin gen src
+
@@ -0,0 +1,17 @@
+# This file is used to override default values used by the Ant build system.
+#
+# This file must be checked in Version Control Systems, as it is
+# integral to the build system of your project.
+
+# This file is only used by the Ant script.
+
+# You can use this to override default values such as
+# 'source.dir' for the location of your java source folder and
+# 'out.dir' for the location of your output folder.
+
+# You can also use it define how the release builds are signed by declaring
+# the following properties:
+# 'key.store' for the location of your keystore and
+# 'key.alias' for the name of the key to use.
+# The password will be asked during the build when you use the 'release' target.
+
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project name="HelloIME" default="help">
+ <!-- The local.properties file is created and updated by the 'android' tool.
+ It contains the path to the SDK. It should *NOT* be checked in in Version
+ Control Systems. -->
+ <property file="local.properties" />
+ <!-- The build.properties file can be created by you and is never touched
+ by the 'android' tool. This is the place to change some of the default property values
+ used by the Ant rules.
+ Here are some properties you may want to change/update:
+
+ application.package
+ the name of your application package as defined in the manifest. Used by the
+ 'uninstall' rule.
+ source.dir
+ the name of the source directory. Default is 'src'.
+ out.dir
+ the name of the output directory. Default is 'bin'.
+
+ Properties related to the SDK location or the project target should be updated
+ using the 'android' tool with the 'update' action.
+
+ This file is an integral part of the build system for your application and
+ should be checked in in Version Control Systems.
+
+ -->
+ <property file="build.properties" />
+
+ <!-- The default.properties file is created and updated by the 'android' tool, as well
+ as ADT.
+ This file is an integral part of the build system for your application and
+ should be checked in in Version Control Systems. -->
+ <property file="default.properties" />
+
+ <!-- Custom Android task to deal with the project target, and import the proper rules.
+ This requires ant 1.6.0 or above. -->
+ <path id="android.antlibs">
+ <pathelement path="${sdk.dir}/tools/lib/anttasks.jar" />
+ <pathelement path="${sdk.dir}/tools/lib/sdklib.jar" />
+ <pathelement path="${sdk.dir}/tools/lib/androidprefs.jar" />
+ <pathelement path="${sdk.dir}/tools/lib/apkbuilder.jar" />
+ <pathelement path="${sdk.dir}/tools/lib/jarutils.jar" />
+ </path>
+
+ <taskdef name="setup"
+ classname="com.android.ant.SetupTask"
+ classpathref="android.antlibs" />
+
+ <!-- Execute the Android Setup task that will setup some properties specific to the target,
+ and import the build rules files.
+
+ The rules file is imported from
+ <SDK>/platforms/<target_platform>/templates/android_rules.xml
+
+ To customize some build steps for your project:
+ - copy the content of the main node <project> from android_rules.xml
+ - paste it in this build.xml below the <setup /> task.
+ - disable the import by changing the setup task below to <setup import="false" />
+
+ This will ensure that the properties are setup correctly but that your customized
+ build steps are used.
+ -->
+ <setup />
+
+</project>
@@ -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,
+# "build.properties", and override values to adapt the script to your
+# project structure.
+
+# Project target.
+target=android-8
@@ -0,0 +1,10 @@
+# This file is automatically generated by Android Tools.
+# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
+#
+# This file must *NOT* be checked in Version Control Systems,
+# as it contains information specific to your local configuration.
+
+# location of the SDK. This is only used by Ant
+# For customization when using a Version Control System, please read the
+# header note.
+sdk.dir=/Developer/SDKs/android-sdk-mac_86
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -0,0 +1,7 @@
+<com.pitecan.helloime.HelloIMEView
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/keyboard"
+ android:layout_alignParentBottom="true"
+ android:layout_width="fill_parent"
+ android:layout_height="80dip"
+ />
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <string name="app_name">HelloIME</string>
+ </resources>
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="utf-8"?>
+<input-method xmlns:android="http://schemas.android.com/apk/res/android" />
@@ -0,0 +1,27 @@
+// [[http://gyazo.com/55d3cfae7cd3ccdf7489b2dfc50b7530.png]]
+//
+// タ ッチすると常に「Hello, World」という文字が入力されるネタIME
+//
+// [[http://www.techdoctranslator.com/resources/articles/articles-index/creating-input-method IMEドキュメント]]に書かれているようなメソッドを普通はいろいろ使うのだがaaaaaaa
+//
+// このサンプルでは絶対必要なものだけ使っている。
+//
+// [[http://gyazo.com/eb908e4ab8dff1c269577ef52d30f008.png]]
+package com.pitecan.helloime;
+//
+import android.inputmethodservice.InputMethodService;
+import android.view.View;
+//
+public class HelloIME extends InputMethodService
+{
+ HelloIMEView helloIMEView;
+ @Override public View onCreateInputView() {
+ helloIMEView = (HelloIMEView) getLayoutInflater().inflate(R.layout.input, null);
+ helloIMEView.setIME(this);
+ return helloIMEView;
+ }
+ public void input(String s){
+ getCurrentInputConnection().commitText(s,1); // 入力貼り付け
+ }
+ }
+// [[http://gyazo.com/741eca3c91b94ac27785d8e0e93978f9.png]]
@@ -0,0 +1,32 @@
+//
+// IMEのメイン画面
+//
+package com.pitecan.helloime;
+//
+import android.view.View;
+import android.view.MotionEvent;
+import android.graphics.Canvas;
+import android.content.Context;
+import android.util.AttributeSet;
+//
+public class HelloIMEView extends View {
+ HelloIME helloIME;
+ public HelloIMEView(Context context, AttributeSet attrs) {
+ super(context,attrs);
+ }
+ @Override public void onDraw(Canvas canvas) {
+ canvas.drawColor(0xffe0e0e0 /* [[http://gyazo.com/299bbb92a11833c1d2a6bfff1285659f.png]] */);
+ }
+ @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
+ setMeasuredDimension(widthMeasureSpec,80);
+ }
+ public boolean onTouchEvent(MotionEvent ev) {
+ if((ev.getAction() & MotionEvent.ACTION_MASK) == MotionEvent.ACTION_DOWN) {
+ helloIME.input("ミサワ! "); // [[http://gyazo.com/e9c5df96c6303572844834fa8588b60e.png]]
+ }
+ return true;
+ }
+ public void setIME(HelloIME _helloIME){
+ helloIME = _helloIME;
+ }
+ }
@@ -0,0 +1,42 @@
+#
+# Gyazzからソースファイルを取得する
+# [[http://ja.wikipedia.org/wiki/%E6%96%87%E8%8A%B8%E7%9A%84%E3%83%97%E3%83%AD%E3%82%B0%E3%83%A9%E3%83%9F%E3%83%B3%E3%82%B0 文芸的プログラミング]]をWikiで実現する!
+#
+require 'fileutils'
+require 'open-uri'
+wiki = 'http://Gyazz.com/HelloIME'
+rootpage = 'Index'
+def valid(path) # 拡張子があるもの
+ path =~ /\.[a-zA-Z]+$/
+end
+def create(wiki,path)
+ STDERR.puts path
+ if path =~ /^(.*)\/([^\/]+)$/ then
+ FileUtils.mkdir_p($1)
+ end
+ if path =~ /(png|jpg)/i then # 画像の場合はページ内の画像を取得
+ open("#{wiki}/#{path}/text").each{ |line|
+ if line =~ /\[\[(.*\.(png|jpg))\]\]/ then
+ imagefile = $1
+ image = open(imagefile).read
+ File.open(path,"w"){ |outfile|
+ outfile.print image
+ }
+ end
+ }
+ else
+ File.open(path,"w"){ |outfile|
+ open("#{wiki}/#{path}/text").each{ |line|
+ outfile.puts line
+ }
+ }
+ end
+end
+open("#{wiki}/#{rootpage}/text").each{ |line|
+ if line =~ /\[\[([^\[]+)\]\]/ then
+ path = $1
+ if path !~ /^http/ then
+ create(wiki,path) if valid(path)
+ end
+ end
+}

0 comments on commit c21a114

Please sign in to comment.