Révision | b7a3f86ec13a6291a5ef408f6c5abcac4012e896 (tree) |
---|---|
l'heure | 2012-09-07 22:06:29 |
Auteur | Kodakana <kodakana@user...> |
Commiter | Kodakana |
撮らずに送信する場合の動作の改善。ファイルを開く場合に拡張子が大文字だと失敗する問題の修正。ファイルを開く場合にパスにマルチバイト文字が含まれていると正しく動作しない問題の改善。日本語リソースを追加。
@@ -1,11 +1,11 @@ | ||
1 | 1 | <manifest xmlns:android="http://schemas.android.com/apk/res/android" |
2 | 2 | package="org.pulpdust.snappingcamera" |
3 | 3 | android:versionCode="1" |
4 | - android:versionName="0.3" | |
4 | + android:versionName="0.4" | |
5 | 5 | android:installLocation="auto" > |
6 | 6 | |
7 | 7 | <uses-sdk |
8 | - android:minSdkVersion="8" | |
8 | + android:minSdkVersion="4" | |
9 | 9 | android:targetSdkVersion="8" /> |
10 | 10 | <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> |
11 | 11 |
@@ -14,7 +14,8 @@ | ||
14 | 14 | android:label="@string/app_name" > |
15 | 15 | <activity |
16 | 16 | android:name=".MainActivity" |
17 | - android:label="@string/app_name" > | |
17 | + android:label="@string/app_name" | |
18 | + android:windowSoftInputMode="stateUnchanged|adjustResize" > | |
18 | 19 | <intent-filter> |
19 | 20 | <action android:name="android.intent.action.MAIN" /> |
20 | 21 |
@@ -1,11 +1,11 @@ | ||
1 | 1 | <manifest xmlns:android="http://schemas.android.com/apk/res/android" |
2 | 2 | package="org.pulpdust.snappingcamera" |
3 | 3 | android:versionCode="1" |
4 | - android:versionName="0.3" | |
4 | + android:versionName="0.4" | |
5 | 5 | android:installLocation="auto" > |
6 | 6 | |
7 | 7 | <uses-sdk |
8 | - android:minSdkVersion="8" | |
8 | + android:minSdkVersion="4" | |
9 | 9 | android:targetSdkVersion="8" /> |
10 | 10 | <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> |
11 | 11 |
@@ -14,7 +14,8 @@ | ||
14 | 14 | android:label="@string/app_name" > |
15 | 15 | <activity |
16 | 16 | android:name=".MainActivity" |
17 | - android:label="@string/app_name" > | |
17 | + android:label="@string/app_name" | |
18 | + android:windowSoftInputMode="stateUnchanged|adjustResize" > | |
18 | 19 | <intent-filter> |
19 | 20 | <action android:name="android.intent.action.MAIN" /> |
20 | 21 |
@@ -28,6 +28,7 @@ | ||
28 | 28 | android:id="@+id/button2" |
29 | 29 | android:layout_width="wrap_content" |
30 | 30 | android:layout_height="wrap_content" |
31 | + android:layout_alignBottom="@+id/editText1" | |
31 | 32 | android:layout_alignParentRight="true" |
32 | 33 | android:layout_alignParentTop="true" |
33 | 34 | android:text="@string/kigo" /> |
@@ -0,0 +1,22 @@ | ||
1 | +<resources> | |
2 | + | |
3 | + <string name="app_name">Snapping Camera</string> | |
4 | + <string name="hello_world">またお会いしましたね。</string> | |
5 | + <string name="menu_notake">撮らない</string> | |
6 | + <string name="menu_open">ファイルから…</string> | |
7 | + <string name="menu_settings">設定…</string> | |
8 | + <string name="title_activity_main">MainActivity</string> | |
9 | + <string name="to">To:</string> | |
10 | + <string name="sub">Subject:</string> | |
11 | + <string name="cc">CC:</string> | |
12 | + <string name="bcc">BCC:</string> | |
13 | + <string name="shot">写真を撮る</string> | |
14 | + <string name="err_not_cam">カメラが見つかりません。</string> | |
15 | + <string name="err_not_mail">送信できません。</string> | |
16 | + <string name="err_not_sd">拡張記憶領域が見つかりません。</string> | |
17 | + <string name="err_den_sd">拡張記憶領域と連絡がとれません。</string> | |
18 | + <string name="err_not_act">アクティビティが見つかりません。</string> | |
19 | + <string name="err_not_file">ファイルを選択してください。</string> | |
20 | + <string name="kigo">Kigo</string> | |
21 | + | |
22 | +</resources> | |
\ No newline at end of file |
@@ -50,7 +50,7 @@ public class MainActivity extends Activity { | ||
50 | 50 | setContentView(R.layout.activity_main); |
51 | 51 | // snpcmrvw = (SnappingCameraView) findViewById(R.id.surfaceView1); |
52 | 52 | if (Intent.ACTION_SEND.equals(getIntent().getAction())){ |
53 | - Intent throwint = buildSender(); | |
53 | + Intent throwint = buildSender(0); | |
54 | 54 | String type = getIntent().getType(); |
55 | 55 | throwint.setType(type); |
56 | 56 | Uri uri = getIntent().getParcelableExtra(Intent.EXTRA_STREAM); |
@@ -76,9 +76,9 @@ public class MainActivity extends Activity { | ||
76 | 76 | @Override |
77 | 77 | public void onClick(View v) { |
78 | 78 | Intent intent = new Intent("org.pulpdust.kigo.action.PICK_KEYWORD"); |
79 | - if (subject != null){ | |
80 | - intent.putExtra("org.pulpdust.kigo.extra.WORD", subject); | |
81 | - } | |
79 | +// if (subject != null){ | |
80 | +// intent.putExtra("org.pulpdust.kigo.extra.WORD", subject); | |
81 | +// } | |
82 | 82 | try { |
83 | 83 | startActivityForResult(intent, 4); |
84 | 84 | } catch (ActivityNotFoundException e){ |
@@ -128,9 +128,10 @@ public class MainActivity extends Activity { | ||
128 | 128 | Toast.makeText(this, R.string.err_not_sd, Toast.LENGTH_LONG).show(); |
129 | 129 | return; |
130 | 130 | } |
131 | - File path = | |
132 | - Environment.getExternalStoragePublicDirectory( | |
133 | - Environment.DIRECTORY_PICTURES + "/snapping"); | |
131 | +// File path = | |
132 | +// Environment.getExternalStoragePublicDirectory( | |
133 | +// Environment.DIRECTORY_PICTURES + "/snapping"); | |
134 | + File path = new File(Environment.getExternalStorageDirectory(), "/Pictures/snapping"); | |
134 | 135 | if (!path.exists()){ |
135 | 136 | path.mkdirs(); |
136 | 137 | } |
@@ -148,6 +149,7 @@ public class MainActivity extends Activity { | ||
148 | 149 | |
149 | 150 | Intent intent = new Intent(); |
150 | 151 | intent.setAction(MediaStore.ACTION_IMAGE_CAPTURE); |
152 | +// intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | |
151 | 153 | intent.putExtra(MediaStore.EXTRA_OUTPUT, imguri); |
152 | 154 | try { |
153 | 155 | startActivityForResult(intent, 1); |
@@ -157,13 +159,25 @@ public class MainActivity extends Activity { | ||
157 | 159 | } |
158 | 160 | } |
159 | 161 | |
160 | - public Intent buildSender(){ | |
161 | - Intent intent = new Intent(Intent.ACTION_SEND); | |
162 | + public Intent buildSender(int mode){ | |
163 | + Intent intent = new Intent(); | |
164 | + if (mode == 1){ | |
165 | + intent.setAction(Intent.ACTION_SENDTO); | |
166 | + } else if (mode == 0){ | |
167 | + intent.setAction(Intent.ACTION_SEND); | |
168 | + } else { | |
169 | + intent.setAction(Intent.ACTION_SEND); | |
170 | + } | |
171 | + intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | |
162 | 172 | if (!subject.equalsIgnoreCase("")){ |
163 | 173 | intent.putExtra(Intent.EXTRA_SUBJECT, subject); |
164 | 174 | } |
165 | 175 | if (!send_to[0].equalsIgnoreCase("")){ |
166 | - intent.putExtra(Intent.EXTRA_EMAIL, send_to); | |
176 | + if (mode == 1){ | |
177 | + intent.setData(Uri.parse("mailto:" + send_to[0])); | |
178 | + } else { | |
179 | + intent.putExtra(Intent.EXTRA_EMAIL, send_to); | |
180 | + } | |
167 | 181 | } |
168 | 182 | if (!cc[0].equalsIgnoreCase("")){ |
169 | 183 | intent.putExtra(Intent.EXTRA_CC, cc); |
@@ -178,7 +192,7 @@ public class MainActivity extends Activity { | ||
178 | 192 | switch (requestCode){ |
179 | 193 | case 1: |
180 | 194 | if (resultCode == RESULT_OK){ |
181 | - Intent mailint = buildSender(); | |
195 | + Intent mailint = buildSender(0); | |
182 | 196 | mailint.setType("image/jpeg"); |
183 | 197 | mailint.putExtra(Intent.EXTRA_STREAM, imguri); |
184 | 198 | try { |
@@ -208,16 +222,18 @@ public class MainActivity extends Activity { | ||
208 | 222 | String suri = data.getDataString(); |
209 | 223 | File file = new File(suri); |
210 | 224 | if (!file.isDirectory()){ |
211 | - Intent mailint = buildSender(); | |
225 | + Intent mailint = buildSender(0); | |
212 | 226 | String ext = MimeTypeMap.getFileExtensionFromUrl(suri); |
213 | 227 | String mime = null; |
214 | 228 | if (ext != null){ |
215 | - mime = MimeTypeMap.getSingleton().getMimeTypeFromExtension(ext); | |
229 | + mime = MimeTypeMap.getSingleton().getMimeTypeFromExtension(ext.toLowerCase()); | |
216 | 230 | } else { |
217 | - mime = "all/all"; | |
231 | + mime = "application/octet-stream"; | |
218 | 232 | } |
219 | 233 | if (mime != null){ |
220 | 234 | mailint.setType(mime); |
235 | + } else { | |
236 | + mailint.setType("application/octet-stream"); | |
221 | 237 | } |
222 | 238 | mailint.putExtra(Intent.EXTRA_STREAM, Uri.parse(suri)); |
223 | 239 | try { |
@@ -274,9 +290,7 @@ public class MainActivity extends Activity { | ||
274 | 290 | startActivityForResult(prefint, 2); |
275 | 291 | return true; |
276 | 292 | case R.id.menu_notake: |
277 | - Intent ntint = buildSender(); | |
278 | - ntint.setType("text/plain"); | |
279 | - ntint.putExtra(Intent.EXTRA_TEXT, ""); | |
293 | + Intent ntint = buildSender(1); | |
280 | 294 | try { |
281 | 295 | startActivity(ntint); |
282 | 296 | } catch (ActivityNotFoundException e){ |