ActionBar ShareActionProvider debugging

master
Chris Baughman 2014-02-13 16:04:15 -05:00
parent 5d1d559c8a
commit 31c6171a9e
10 changed files with 47 additions and 41 deletions

View File

@ -2,15 +2,18 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.cmb.googledorks"
android:versionCode="1"
android:versionName="1.0" >
android:versionName="1.0"
android:installLocation="auto">
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="11" />
android:minSdkVersion="11"
android:targetSdkVersion="19" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
android:allowBackup="true"
android:label="@string/app_name"
android:logo="@drawable/cube">
<activity
android:label="@string/app_name"
android:name=".MainActivity" >

5
lint.xml Normal file
View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<lint>
<issue id="MissingTranslation" severity="informational" />
<issue id="Orientation" severity="warning" />
</lint>

View File

@ -10,4 +10,5 @@
# Project target.
target=android-19
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
android.library.reference.1=../../workspace/gridlayout_v7
android.library.reference.2=../../workspace/android-support-v7-appcompat

View File

@ -1,17 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:GoogleDorks="http://schemas.android.com/apk/res-auto">
xmlns:support="http://schemas.android.com/apk/res-auto">
<item android:id="@+id/action_help"
android:icon="@drawable/ic_action_help"
android:title="@string/action_help"
android:showAsAction="ifRoom" />
support:showAsAction="ifRoom" />
<!-- Share / will display always -->
<item android:id="@+id/action_share"
android:icon="@drawable/ic_action_share"
android:title="@string/action_share"
GoogleDorks:showAsAction="always"
GoogleDorks:actionProviderClass="android.support.v7.widget.ShareActionProvider" />
support:showAsAction="always"
support:actionProviderClass="android.support.v7.widget.ShareActionProvider" />
</menu>

View File

@ -2,7 +2,7 @@
<resources>
<string name="app_name">Google Dorks</string>
<string name="rss_layout_urltext_text">http://rss.slashdot.org/Slashdot/slashdot</string>
<string name="rss_layout_statustext_text">Updating...</string>
<string name="rss_layout_statustext_text">Updating&#8230;</string>
<string name="rss_layout_download_text">Download</string>
<string name="dork_items_prompt">Choose a category</string>
<string-array name="dork_items">
@ -26,5 +26,5 @@
<string name="action_settings">Settings</string>
<string name="spinner_prompt">Select</string>
<string name="choose_source">Choose Source</string>
</resources>

View File

@ -0,0 +1,7 @@
package com.cmb.googledorks;
public interface Constants {
final String LOG = "com.cmb.googledorks";
final int ABOUT = 0;
}

View File

@ -1,11 +1,6 @@
package com.cmb.googledorks;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.*;
import org.xml.sax.*;
import android.content.*;
import java.io.*;
import android.content.res.*;

View File

@ -2,32 +2,34 @@ package com.cmb.googledorks;
import android.app.*;
import android.os.*;
import android.util.Log;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.*;
import android.view.View.*;
import java.util.*;
import android.widget.AdapterView.*;
import java.io.UnsupportedEncodingException;
import java.net.*;
import android.content.*;
import android.net.*;
import android.support.v4.view.*;
import android.support.v7.widget.ShareActionProvider;
public class MainActivity extends Activity
public class MainActivity extends Activity implements Constants
{
Spinner catSpin;
ListView listV;
final GetGoogleDorks dorks = new GetGoogleDorks();
final public int ABOUT = 0;
public final String TAG = "MainActivity";
ArrayAdapter<String> adapter;
List<String> list= null;
private ShareActionProvider mShare;
protected String dorkSelected = "";
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu, menu);
@ -43,6 +45,8 @@ public class MainActivity extends Activity
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
if (BuildConfig.DEBUG) { Log.d(TAG, LOG + " onCreate Called"); }
listV = (ListView)findViewById(R.id.listBox);
catSpin = (Spinner)findViewById(R.id.catSpin);
@ -86,7 +90,7 @@ public class MainActivity extends Activity
@Override
public void onNothingSelected(AdapterView<?> parent) {
//required implememt
//required to implement
}
});
@ -106,18 +110,22 @@ public class MainActivity extends Activity
listV.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int pos, long idt) {
Uri uuri = null;
if(list.get(pos).toString().startsWith("http")) {
startActivity(new Intent(Intent.ACTION_VIEW,
Uri.parse(list.get(pos))));
uuri = Uri.parse(list.get(pos).toString());
startActivity(new Intent(Intent.ACTION_VIEW, uuri));
}
else {
startActivity(new Intent(Intent.ACTION_VIEW,
Uri.parse("http://www.google.com/#q="
+ URLEncoder.encode(list.get(pos)))));
try {
uuri = Uri.parse("http://www.google.com/#q=" + URLEncoder.encode(list.get(pos), "UTF-8"));
}
catch(UnsupportedEncodingException uex) {
Log.e(TAG, LOG, uex);
}
startActivity(new Intent(Intent.ACTION_VIEW, uuri));
}
Toast.makeText(getBaseContext()
, "Opening http://google.com/#q=" + URLEncoder.encode(list.get(pos)), Toast.LENGTH_LONG).show();
Toast.makeText(getBaseContext(), uuri.toString(), Toast.LENGTH_LONG).show();
}
});
}
@ -139,14 +147,6 @@ public class MainActivity extends Activity
return super.onOptionsItemSelected(item);
}
}
/**
* Launching new activity
* */
private void ShowShare() {
Intent i = new Intent(MainActivity.this, ShowHelp.class);
startActivity(i);
}
private void setShareIntent(Intent shareIntent) {
if (mShare != null) {
@ -157,7 +157,6 @@ public class MainActivity extends Activity
private Intent getShareItem() {
Intent inten = new Intent(Intent.ACTION_SEND);
inten.setType("image/*");
return inten;
}
}

View File

@ -2,9 +2,6 @@ package com.cmb.googledorks;
import android.app.*;
import android.os.*;
import android.view.*;
import android.widget.*;
import android.view.View.*;
public class SettingsActivity extends Activity
{

View File

@ -11,7 +11,6 @@ import android.text.Html;
import android.text.util.Linkify;
import android.graphics.Color;
import android.widget.TextView;
import android.content.res.*;
public class ShowHelp extends Dialog
{