Update share provider
parent
8d0e617893
commit
d820c3cf01
17
.classpath
17
.classpath
|
@ -1,8 +1,9 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="src" path="gen"/>
|
||||
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
|
||||
<classpathentry kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
|
||||
<classpathentry kind="output" path="bin/classes"/>
|
||||
</classpath>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
|
||||
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="src" path="gen"/>
|
||||
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
|
||||
<classpathentry kind="output" path="bin/classes"/>
|
||||
</classpath>
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
|
||||
org.eclipse.jdt.core.compiler.compliance=1.6
|
||||
org.eclipse.jdt.core.compiler.source=1.6
|
|
@ -1,11 +1,12 @@
|
|||
# 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,
|
||||
# "ant.properties", and override values to adapt the script to your
|
||||
# project structure.
|
||||
|
||||
# Project target.
|
||||
target=android-10
|
||||
# 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,
|
||||
# "ant.properties", and override values to adapt the script to your
|
||||
# project structure.
|
||||
|
||||
# Project target.
|
||||
target=android-19
|
||||
android.library.reference.1=../../workspace/gridlayout_v7
|
||||
|
|
|
@ -6,29 +6,22 @@
|
|||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Settings"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:layout_width="wrap_content"/>
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/action_settings"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:orientation="horizontal">
|
||||
<TextView
|
||||
android:id="@+id/textView1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/choose_source"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<CheckBox
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"/>
|
||||
|
||||
<TextView
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Check for updates"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:layout_width="wrap_content"
|
||||
android:padding="5dp"
|
||||
android:layout_marginStart="80dp"/>
|
||||
|
||||
</LinearLayout>
|
||||
<Spinner
|
||||
android:id="@+id/spinner1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
|
|
@ -2,11 +2,9 @@
|
|||
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
|
||||
<!-- Refresh -->
|
||||
<item android:id="@+id/action_refresh"
|
||||
android:icon="@drawable/ic_action_refresh"
|
||||
android:title="@string/action_refresh"
|
||||
android:showAsAction="ifRoom" />
|
||||
|
||||
<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"
|
||||
android:icon="@drawable/ic_action_help"
|
||||
|
@ -18,5 +16,6 @@
|
|||
android:icon="@drawable/ic_action_share"
|
||||
android:title="@string/action_share"
|
||||
android:showAsAction="ifRoom"
|
||||
android:actionProviderClass="android.widget.ShareActionProvider" />
|
||||
android:actionProviderClass="android.support.v7.widget.ShareActionProvider" />
|
||||
|
||||
</menu>
|
||||
|
|
|
@ -18,5 +18,8 @@
|
|||
<string name="action_refresh">Refresh</string>
|
||||
<string name="action_about">About</string>
|
||||
<string name="action_share">Share</string>
|
||||
<string name="action_settings">Settings</string>
|
||||
<string name="spinner_prompt">Select</string>
|
||||
<string name="choose_source">Choose Source</string>
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -21,12 +21,16 @@ public class MainActivity extends Activity
|
|||
ArrayAdapter<String> adapter;
|
||||
List<String> list= null;
|
||||
private ShareActionProvider mShare;
|
||||
|
||||
protected String dorkSelected = "";
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
MenuInflater inflator = getMenuInflater();
|
||||
inflator.inflate(R.menu.menu, menu);
|
||||
// Set up shareactionprovider
|
||||
MenuItem shareItem = menu.findItem(R.id.action_share);
|
||||
mShare = (ShareActionProvider)shareItem.getActionProvider();
|
||||
mShare.setShareIntent(getShareItem());
|
||||
return super.onCreateOptionsMenu(menu);
|
||||
}
|
||||
/** Called when the activity is first created. */
|
||||
|
@ -83,6 +87,17 @@ public class MainActivity extends Activity
|
|||
}
|
||||
});
|
||||
|
||||
listV.setOnItemLongClickListener(new OnItemLongClickListener() {
|
||||
|
||||
@Override
|
||||
public boolean onItemLongClick(AdapterView<?> arg0, View view,
|
||||
int pos, long arg3) {
|
||||
dorkSelected = list.get(pos).toString();
|
||||
return false;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
listV.setOnItemClickListener(new OnItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> parent, View view, int pos, long idt) {
|
||||
|
@ -109,7 +124,7 @@ public class MainActivity extends Activity
|
|||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
// Take appropriate action for each action item click
|
||||
switch (item.getItemId()) {
|
||||
case R.id.action_refresh:
|
||||
case R.id.settings:
|
||||
// search action
|
||||
Intent intent_settings = new Intent(this, SettingsActivity.class);
|
||||
this.startActivity(intent_settings);
|
||||
|
@ -120,9 +135,6 @@ public class MainActivity extends Activity
|
|||
sh.setTitle("About Google Dorks by CMB");
|
||||
sh.show();
|
||||
return true;
|
||||
case R.id.action_share:
|
||||
mShare = (ShareActionProvider)item.getActionProvider();
|
||||
return true;
|
||||
default:
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
@ -135,4 +147,18 @@ public class MainActivity extends Activity
|
|||
Intent i = new Intent(MainActivity.this, ShowHelp.class);
|
||||
startActivity(i);
|
||||
}
|
||||
|
||||
private void setShareIntent(Intent shareIntent) {
|
||||
if (mShare != null) {
|
||||
mShare.setShareIntent(shareIntent);
|
||||
}
|
||||
}
|
||||
|
||||
private Intent getShareItem() {
|
||||
Intent inten = new Intent(Intent.ACTION_SEND);
|
||||
inten.putExtra(Intent.EXTRA_TEXT, dorkSelected);
|
||||
inten.setType("text/plain");
|
||||
|
||||
return inten;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue