Revision 71a5ef30
| AndroidManifest.xml | ||
|---|---|---|
| 8 | 8 |
android:minSdkVersion="7" |
| 9 | 9 |
android:targetSdkVersion="19" /> |
| 10 | 10 |
|
| 11 |
<uses-permission android:name="android.permission.INTERNET" /> |
|
| 12 |
|
|
| 11 | 13 |
<application |
| 12 | 14 |
android:allowBackup="true" |
| 13 | 15 |
android:icon="@drawable/ic_launcher" |
| ... | ... | |
| 22 | 24 |
<category android:name="android.intent.category.LAUNCHER" /> |
| 23 | 25 |
</intent-filter> |
| 24 | 26 |
</activity> |
| 27 |
<activity |
|
| 28 |
android:name=".WebViewActivity" |
|
| 29 |
android:parentActivityName=".MainActivity" > |
|
| 30 |
|
|
| 31 |
<!-- Parent activity meta-data to support 4.0 and lower --> |
|
| 32 |
<meta-data |
|
| 33 |
android:name="android.support.PARENT_ACTIVITY" |
|
| 34 |
android:value=".MainActivity" /> |
|
| 35 |
</activity> |
|
| 25 | 36 |
</application> |
| 26 | 37 |
|
| 27 |
</manifest> |
|
| 38 |
</manifest> |
|
| res/layout/activity_webview.xml | ||
|---|---|---|
| 1 |
<?xml version="1.0" encoding="utf-8"?> |
|
| 2 |
<WebView xmlns:android="http://schemas.android.com/apk/res/android" |
|
| 3 |
android:id="@+id/webview" |
|
| 4 |
android:layout_width="fill_parent" |
|
| 5 |
android:layout_height="fill_parent" > |
|
| 6 |
|
|
| 7 |
</WebView> |
|
| res/values/strings.xml | ||
|---|---|---|
| 5 | 5 |
<string name="icon">icon</string> |
| 6 | 6 |
<string name="action_settings">Settings</string> |
| 7 | 7 |
<string name="no_applications_found">No applications found</string> |
| 8 |
<string name="by_package_name">By Package Name</string> |
|
| 9 |
<string name="by_apk_hash">By APK Hash</string> |
|
| 10 |
<string name="by_signing_certificate">By Signing Certificate</string> |
|
| 8 | 11 |
|
| 9 | 12 |
</resources> |
| src/info/guardianproject/checkey/AppListFragment.java | ||
|---|---|---|
| 21 | 21 |
package info.guardianproject.checkey; |
| 22 | 22 |
|
| 23 | 23 |
import android.annotation.TargetApi; |
| 24 |
import android.content.Intent; |
|
| 25 |
import android.net.Uri; |
|
| 24 | 26 |
import android.os.Bundle; |
| 25 | 27 |
import android.support.v4.app.ListFragment; |
| 26 | 28 |
import android.support.v4.app.LoaderManager.LoaderCallbacks; |
| 27 | 29 |
import android.support.v4.content.Loader; |
| 28 | 30 |
import android.view.View; |
| 31 |
import android.webkit.WebView; |
|
| 29 | 32 |
import android.widget.ListView; |
| 30 | 33 |
|
| 31 | 34 |
import java.util.List; |
| ... | ... | |
| 33 | 36 |
public class AppListFragment extends ListFragment implements LoaderCallbacks<List<AppEntry>> {
|
| 34 | 37 |
|
| 35 | 38 |
private AppListAdapter adapter; |
| 39 |
WebView androidObservatoryView; |
|
| 36 | 40 |
|
| 37 | 41 |
@Override |
| 38 | 42 |
public void onActivityCreated(Bundle savedInstanceState) {
|
| ... | ... | |
| 54 | 58 |
@Override |
| 55 | 59 |
public void onListItemClick(ListView l, View v, int position, long id) {
|
| 56 | 60 |
AppEntry appEntry = (AppEntry) adapter.getItem(position); |
| 57 |
// TODO search androidobs here |
|
| 61 |
Intent intent = new Intent(getActivity(), WebViewActivity.class); |
|
| 62 |
String urlString = "https://androidobservatory.org/?searchby=pkg&q=" + appEntry.getPackageName(); |
|
| 63 |
intent.setData(Uri.parse(urlString)); |
|
| 64 |
intent.putExtra(Intent.EXTRA_TITLE, R.string.by_package_name); |
|
| 65 |
startActivity(intent); |
|
| 58 | 66 |
} |
| 59 | 67 |
|
| 60 | 68 |
@Override |
| src/info/guardianproject/checkey/WebViewActivity.java | ||
|---|---|---|
| 1 |
|
|
| 2 |
package info.guardianproject.checkey; |
|
| 3 |
|
|
| 4 |
import android.content.Intent; |
|
| 5 |
import android.os.Bundle; |
|
| 6 |
import android.support.v7.app.ActionBar; |
|
| 7 |
import android.support.v7.app.ActionBarActivity; |
|
| 8 |
import android.util.Log; |
|
| 9 |
import android.webkit.WebView; |
|
| 10 |
|
|
| 11 |
public class WebViewActivity extends ActionBarActivity {
|
|
| 12 |
|
|
| 13 |
@Override |
|
| 14 |
protected void onCreate(Bundle savedInstanceState) {
|
|
| 15 |
super.onCreate(savedInstanceState); |
|
| 16 |
setContentView(R.layout.activity_webview); |
|
| 17 |
ActionBar actionBar = getSupportActionBar(); |
|
| 18 |
actionBar.setDisplayHomeAsUpEnabled(true); |
|
| 19 |
|
|
| 20 |
Intent intent = getIntent(); |
|
| 21 |
int resid = intent.getIntExtra(Intent.EXTRA_TITLE, 0); |
|
| 22 |
if (resid != 0) |
|
| 23 |
actionBar.setTitle(resid); |
|
| 24 |
|
|
| 25 |
WebView webView = (WebView) findViewById(R.id.webview); |
|
| 26 |
webView.loadUrl(intent.getData().toString()); |
|
| 27 |
Log.i("WebViewActivity", intent.getData().toString());
|
|
| 28 |
} |
|
| 29 |
|
|
| 30 |
} |
|
Also available in: Unified diff