• R/O
  • HTTP
  • SSH
  • HTTPS

A01d: Commit

OPC(Olympus Air)用望遠鏡アプリ。


Commit MetaInfo

Révisionfc4a92db6bf50ac67b0127fafa78632c8ce9b2a9 (tree)
l'heure2018-06-17 00:23:39
AuteurMRSa <mrsa@myad...>
CommiterMRSa

Message de Log

内部的にタッチを拾うようにした。(API一覧)

Change Summary

Modification

--- a/app/src/main/java/net/osdn/gokigen/a01d/camera/sony/cameraproperty/SonyCameraApiListFragment.java
+++ b/app/src/main/java/net/osdn/gokigen/a01d/camera/sony/cameraproperty/SonyCameraApiListFragment.java
@@ -1,11 +1,13 @@
11 package net.osdn.gokigen.a01d.camera.sony.cameraproperty;
22
3-import android.content.Context;
3+import android.content.Intent;
44 import android.os.Bundle;
55 import android.support.annotation.NonNull;
66 import android.support.annotation.Nullable;
77 import android.support.v4.app.FragmentActivity;
88 import android.support.v4.app.ListFragment;
9+import android.support.v7.app.ActionBar;
10+import android.support.v7.app.AppCompatActivity;
911 import android.util.Log;
1012 import android.view.LayoutInflater;
1113 import android.view.Menu;
@@ -14,6 +16,7 @@ import android.view.MenuItem;
1416 import android.view.View;
1517 import android.view.ViewGroup;
1618 import android.widget.ArrayAdapter;
19+import android.widget.ListAdapter;
1720 import android.widget.ListView;
1821 import android.widget.Toast;
1922
@@ -65,21 +68,22 @@ public class SonyCameraApiListFragment extends ListFragment
6568 public void onCreateOptionsMenu(Menu menu, MenuInflater inflater)
6669 {
6770 inflater.inflate(R.menu.api_view, menu);
68-/*
69- String title = getString(R.string.app_name) + " " + getString(R.string.pref_degug_info);
71+ String title = getString(R.string.app_name) + " " + getString(R.string.pref_sony_api_list);
7072 try {
7173 AppCompatActivity activity = (AppCompatActivity) getActivity();
72- ActionBar bar = activity.getSupportActionBar();
73- if (bar != null)
74+ if (activity != null)
7475 {
75- bar.setTitle(title);
76+ ActionBar bar = activity.getSupportActionBar();
77+ if (bar != null)
78+ {
79+ bar.setTitle(title);
80+ }
7681 }
7782 }
7883 catch (Exception e)
7984 {
8085 e.printStackTrace();
8186 }
82-*/
8387 }
8488
8589 @Override
@@ -90,10 +94,51 @@ public class SonyCameraApiListFragment extends ListFragment
9094 update();
9195 return (true);
9296 }
97+ if (item.getItemId() == R.id.action_share)
98+ {
99+ share();
100+ return (true);
101+ }
93102 return super.onOptionsItemSelected(item);
94103 }
95104
96105 /**
106+ * API一覧の他アプリへ共有
107+ *
108+ */
109+ private void share()
110+ {
111+ if ((dataItems != null)&&(dataItems.size() > 0))
112+ {
113+ try
114+ {
115+ StringBuilder shareData = new StringBuilder();
116+ for (String item : dataItems)
117+ {
118+ shareData.append(item);
119+ shareData.append("\r\n");
120+ }
121+ String title = "; " + getString(R.string.pref_sony_api_list);
122+ Intent sendIntent = new Intent(android.content.Intent.ACTION_SEND);
123+ sendIntent.putExtra(Intent.EXTRA_SUBJECT, title);
124+ sendIntent.setType("text/plain");
125+ sendIntent.putExtra(Intent.EXTRA_TEXT, new String(shareData));
126+ FragmentActivity activity = getActivity();
127+ if (activity != null)
128+ {
129+ // Intent発行(ACTION_SEND)
130+ startActivity(sendIntent);
131+ Log.v(TAG, "<<< SEND INTENT >>> : " + title);
132+ }
133+ }
134+ catch (Exception e)
135+ {
136+ e.printStackTrace();
137+ }
138+ }
139+ }
140+
141+ /**
97142 * 表示データの更新
98143 *
99144 */
@@ -199,4 +244,19 @@ public class SonyCameraApiListFragment extends ListFragment
199244 setListAdapter(adapter);
200245 return (super.onCreateView(inflater, container, savedInstanceState));
201246 }
247+
248+ @Override
249+ public void onListItemClick (ListView l, View v, int position, long id)
250+ {
251+ try
252+ {
253+ ListAdapter listAdapter = l.getAdapter();
254+ String apiName = (String) listAdapter.getItem(position);
255+ Log.v(TAG, "onListItemClick() [" + position + "] " + apiName);
256+ }
257+ catch (Exception e)
258+ {
259+ e.printStackTrace();
260+ }
261+ }
202262 }
--- /dev/null
+++ b/app/src/main/res/drawable/ic_share_black_24dp.xml
@@ -0,0 +1,9 @@
1+<vector xmlns:android="http://schemas.android.com/apk/res/android"
2+ android:width="24dp"
3+ android:height="24dp"
4+ android:viewportWidth="24.0"
5+ android:viewportHeight="24.0">
6+ <path
7+ android:fillColor="#FF000000"
8+ android:pathData="M18,16.08c-0.76,0 -1.44,0.3 -1.96,0.77L8.91,12.7c0.05,-0.23 0.09,-0.46 0.09,-0.7s-0.04,-0.47 -0.09,-0.7l7.05,-4.11c0.54,0.5 1.25,0.81 2.04,0.81 1.66,0 3,-1.34 3,-3s-1.34,-3 -3,-3 -3,1.34 -3,3c0,0.24 0.04,0.47 0.09,0.7L8.04,9.81C7.5,9.31 6.79,9 6,9c-1.66,0 -3,1.34 -3,3s1.34,3 3,3c0.79,0 1.5,-0.31 2.04,-0.81l7.12,4.16c-0.05,0.21 -0.08,0.43 -0.08,0.65 0,1.61 1.31,2.92 2.92,2.92 1.61,0 2.92,-1.31 2.92,-2.92s-1.31,-2.92 -2.92,-2.92z"/>
9+</vector>
--- a/app/src/main/res/menu/api_view.xml
+++ b/app/src/main/res/menu/api_view.xml
@@ -3,8 +3,14 @@
33 xmlns:compat="http://schemas.android.com/apk/res-auto" >
44
55 <item
6- android:id="@+id/action_refresh"
6+ android:id="@+id/action_share"
77 compat:showAsAction="always"
8+ android:icon="@drawable/ic_share_black_24dp"
9+ android:title="@string/action_share"
10+ android:visible="true" />
11+ <item
12+ android:id="@+id/action_refresh"
13+ compat:showAsAction="ifRoom"
814 android:icon="@drawable/ic_refresh_black_24dp"
915 android:title="@string/action_refresh"
1016 android:visible="true" />
--- a/app/src/main/res/values-ja/strings.xml
+++ b/app/src/main/res/values-ja/strings.xml
@@ -103,6 +103,7 @@
103103 <string name="launch_fail_via_ble">Bluetooth経由のカメラ起動に失敗 : </string>
104104 <string name="ble_setting_is_off">BluetoothがOFFです</string>
105105 <string name="action_refresh">更新</string>
106+ <string name="action_share">共有</string>
106107 <string name="finish_refresh">更新終了</string>
107108
108109 <string name="pref_sony_api_list">カメラAPI一覧</string>
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -108,6 +108,7 @@
108108 <string name="ble_setting_is_off">Bluetooth is currently off.</string>
109109
110110 <string name="action_refresh">Refresh</string>
111+ <string name="action_share">Share</string>
111112 <string name="finish_refresh">Finished Refresh</string>
112113
113114 <string name="pref_sony_api_list">Sony Camera Api List</string>
Afficher sur ancien navigateur de dépôt.