@@ -42,15 +42,15 @@ public class MainActivity extends Activity implements SensorEventListener, OnSha
4242 private GestureDetector gDetector ;
4343 private JavaGestureListener gestureListener ;
4444 private boolean enableLucky =false ;
45- private java .util .Random random ;
45+ private final java .util .Random random = new java . util . Random () ;
4646 private boolean enableShakeModulation =true ;
4747 private long counterDJ , counterPress , counterShake , counterVoice ;
48-
48+ private Intent shareIntent ;
49+ private String [] meigen ;
4950 @ Override
5051 protected void onCreate (Bundle savedInstanceState ) {
5152 super .onCreate (savedInstanceState );
5253 setContentView (R .layout .activity_main );
53- random =new java .util .Random ();
5454
5555 javaPool =new SoundPool (maxJavaSounds ,AudioManager .STREAM_MUSIC ,0 );
5656 javaSoundId =javaPool .load (this , R .raw .java22 , 1 );
@@ -78,7 +78,7 @@ private void loadPreferences(SharedPreferences shrPrefs) {
7878 }
7979 z =Math .max (1.f , Math .min (x , y ));
8080 v_min =density *z ;
81- w =Math .max (v_min + 1.f , Math .max (x , y ));
81+ w =Math .max (v_min + 1.f , Math .max (x , y ));
8282 v_max =density *w ;
8383 gestureListener .setMinMax (v_min , v_max );
8484
@@ -172,15 +172,18 @@ private boolean setupShareAction(Menu menu) {
172172 MenuItem shareItem =menu .findItem (R .id .menu_item_share );
173173 ShareActionProvider sap =(ShareActionProvider )shareItem .getActionProvider ();
174174 if (sap !=null ) {
175- Intent shareIntent = new Intent (Intent .ACTION_SEND );
175+ shareIntent = new Intent (Intent .ACTION_SEND );
176176 shareIntent .setType (ClipDescription .MIMETYPE_TEXT_PLAIN );
177- shareIntent .putExtra (Intent .EXTRA_TEXT , getResources ().getString (R .string .java_message ));
178-
179177 sap .setShareIntent (shareIntent );
178+ meigen =getResources ().getStringArray (R .array .meigen );
179+ refreshMeigen ();
180180 }
181-
182181 return true ;
183182 }
183+ private void refreshMeigen () {
184+ shareIntent .removeExtra (Intent .EXTRA_TEXT );
185+ shareIntent .putExtra (Intent .EXTRA_TEXT , meigen [random .nextInt (meigen .length )]);
186+ }
184187
185188 @ Override
186189 public boolean onMenuItemSelected (int featureId , MenuItem item ) {
@@ -199,6 +202,7 @@ public boolean onMenuItemSelected(int featureId, MenuItem item) {
199202 public void JavaButtonClick (View v ) {
200203 playJava (1.f );
201204 counterPress ++;
205+ refreshMeigen ();
202206 }
203207
204208 @ Override
0 commit comments