More mods for damn share stuff!

master
Chris Baughman 2014-02-09 15:25:22 -05:00
parent b031de7903
commit 5d1d559c8a
3 changed files with 21 additions and 25 deletions

View File

@ -10,3 +10,4 @@
# Project target. # Project target.
target=android-19 target=android-19
android.library.reference.1=../../workspace/gridlayout_v7 android.library.reference.1=../../workspace/gridlayout_v7
android.library.reference.1=/storage/emulated/0/Download/android-support-v7-appcompat-master/android-support-v7-appcompat-master

View File

@ -1,11 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android" > <menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:GoogleDorks="http://schemas.android.com/apk/res-auto">
<!-- Refresh -->
<group android:id="@+id/group1" android:enabled="true" android:menuCategory="container" android:visible="true">
<item android:id="@+id/settings" android:actionLayout="@layout/settings_activity" android:title="@string/action_settings" android:menuCategory="secondary" android:enabled="true" android:showAsAction="ifRoom"></item>
</group>
<!-- Location Found -->
<item android:id="@+id/action_help" <item android:id="@+id/action_help"
android:icon="@drawable/ic_action_help" android:icon="@drawable/ic_action_help"
android:title="@string/action_help" android:title="@string/action_help"
@ -15,7 +11,7 @@
<item android:id="@+id/action_share" <item android:id="@+id/action_share"
android:icon="@drawable/ic_action_share" android:icon="@drawable/ic_action_share"
android:title="@string/action_share" android:title="@string/action_share"
android:showAsAction="ifRoom" GoogleDorks:showAsAction="always"
android:actionProviderClass="android.support.v7.widget.ShareActionProvider" /> GoogleDorks:actionProviderClass="android.support.v7.widget.ShareActionProvider" />
</menu> </menu>

View File

@ -2,7 +2,10 @@ package com.cmb.googledorks;
import android.app.*; import android.app.*;
import android.os.*; import android.os.*;
import android.view.*; import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.*; import android.widget.*;
import android.view.View.*; import android.view.View.*;
import java.util.*; import java.util.*;
@ -10,6 +13,8 @@ import android.widget.AdapterView.*;
import java.net.*; import java.net.*;
import android.content.*; import android.content.*;
import android.net.*; import android.net.*;
import android.support.v4.view.*;
import android.support.v7.widget.ShareActionProvider;
public class MainActivity extends Activity public class MainActivity extends Activity
{ {
@ -25,11 +30,9 @@ public class MainActivity extends Activity
@Override @Override
public boolean onCreateOptionsMenu(Menu menu) { public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflator = getMenuInflater(); getMenuInflater().inflate(R.menu.menu, menu);
inflator.inflate(R.menu.menu, menu);
// Set up shareactionprovider
MenuItem shareItem = menu.findItem(R.id.action_share); MenuItem shareItem = menu.findItem(R.id.action_share);
mShare = (ShareActionProvider)shareItem.getActionProvider(); mShare = (android.support.v7.widget.ShareActionProvider)MenuItemCompat.getActionProvider(shareItem);
mShare.setShareIntent(getShareItem()); mShare.setShareIntent(getShareItem());
return super.onCreateOptionsMenu(menu); return super.onCreateOptionsMenu(menu);
} }
@ -88,14 +91,16 @@ public class MainActivity extends Activity
}); });
listV.setOnItemLongClickListener(new OnItemLongClickListener() { listV.setOnItemLongClickListener(new OnItemLongClickListener() {
@Override @Override
public boolean onItemLongClick(AdapterView<?> arg0, View view, public boolean onItemLongClick(AdapterView<?> arg0, View view,
int pos, long arg3) { int pos, long arg3) {
dorkSelected = list.get(pos).toString(); dorkSelected = list.get(pos).toString();
return false; Intent inten = new Intent(Intent.ACTION_SEND);
inten.putExtra(Intent.EXTRA_TEXT, dorkSelected);
inten.setType("text/plain");
setShareIntent(inten);
return false;
} }
}); });
listV.setOnItemClickListener(new OnItemClickListener() { listV.setOnItemClickListener(new OnItemClickListener() {
@ -124,11 +129,6 @@ public class MainActivity extends Activity
public boolean onOptionsItemSelected(MenuItem item) { public boolean onOptionsItemSelected(MenuItem item) {
// Take appropriate action for each action item click // Take appropriate action for each action item click
switch (item.getItemId()) { switch (item.getItemId()) {
case R.id.settings:
// search action
Intent intent_settings = new Intent(this, SettingsActivity.class);
this.startActivity(intent_settings);
return true;
case R.id.action_help: case R.id.action_help:
// location found // location found
ShowHelp sh = new ShowHelp(this); ShowHelp sh = new ShowHelp(this);
@ -156,9 +156,8 @@ public class MainActivity extends Activity
private Intent getShareItem() { private Intent getShareItem() {
Intent inten = new Intent(Intent.ACTION_SEND); Intent inten = new Intent(Intent.ACTION_SEND);
inten.putExtra(Intent.EXTRA_TEXT, dorkSelected); inten.setType("image/*");
inten.setType("text/plain");
return inten; return inten;
} }
} }