integration lib and demo

This commit is contained in:
Dominik
2012-04-11 19:29:27 +02:00
parent e092016518
commit 2f58c3d86b
39 changed files with 1048 additions and 606 deletions

View File

@@ -2,8 +2,8 @@
<!-- Copyright (C) 2010 Thialfihar <thi@thialfihar.org> Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
android:installLocation="auto"
package="org.apg"
android:installLocation="auto"
android:versionCode="50"
android:versionName="1.1" >
@@ -80,7 +80,8 @@
android:name=".ui.SelectPublicKeyListActivity"
android:configChanges="keyboardHidden|orientation|keyboard"
android:label="@string/title_selectRecipients"
android:launchMode="singleTop" >
android:launchMode="singleTop"
android:uiOptions="splitActionBarWhenNarrow" >
<intent-filter>
<action android:name="org.apg.intent.SELECT_PUBLIC_KEYS" />

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="APG" default="help">
<project name="MainActivity" default="help">
<!-- The local.properties file is created and updated by the 'android' tool.
It contains the path to the SDK. It should *NOT* be checked into
@@ -45,21 +45,19 @@
unless="sdk.dir"
/>
<!-- extension targets. Uncomment the ones where you want to do custom work
in between standard targets -->
<!--
<target name="-pre-build">
</target>
<target name="-pre-compile">
</target>
/* This is typically used for code obfuscation.
Compiled code location: ${out.classes.absolute.dir}
If this is not done in place, override ${out.dex.input.absolute.dir} */
<target name="-post-compile">
</target>
-->
<!--
Import per project custom build rules if present at the root of the project.
This is the place to put custom intermediary targets such as:
-pre-build
-pre-compile
-post-compile (This is typically used for code obfuscation.
Compiled code location: ${out.classes.absolute.dir}
If this is not done in place, override ${out.dex.input.absolute.dir})
-post-package
-post-build
-pre-clean
-->
<import file="custom_rules.xml" optional="true" />
<!-- Import the actual build file.

View File

@@ -0,0 +1,20 @@
# To enable ProGuard in your project, edit project.properties
# to define the proguard.config property as described in that file.
#
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in ${sdk.dir}/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the ProGuard
# include property in project.properties.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

View File

@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2010 Thialfihar <thi@thialfihar.org>
<!--
Copyright (C) 2010 Thialfihar <thi@thialfihar.org>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -14,42 +15,21 @@
limitations under the License.
-->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:fillViewport="true">
android:fillViewport="true"
android:orientation="vertical" >
<include android:id="@+id/layout_filter" layout="@layout/filter_info"/>
<include
android:id="@+id/layout_filter"
layout="@layout/filter_info" />
<ListView
android:id="@+id/list"
android:choiceMode="multipleChoice"
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="1"/>
android:layout_weight="1"
android:choiceMode="multipleChoice" />
<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
style="@android:style/ButtonBar">
<Button
android:text="@android:string/ok"
android:id="@+id/btn_ok"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1"/>
<Button
android:text="@android:string/cancel"
android:id="@+id/btn_cancel"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>

View File

@@ -47,7 +47,7 @@
<string name="title_signKey">Sign Key</string>
<string name="title_about">About</string>
<string name="title_help">Help</string>
<!-- section_lowerCase: capitalized words, no punctuation -->
<string name="section_userIds">User IDs</string>
<string name="section_keys">Keys</string>
@@ -74,6 +74,7 @@
<string name="btn_doNotSave">Cancel</string>
<string name="btn_delete">Delete</string>
<string name="btn_noDate">None</string>
<string name="btn_okay">Okay</string>
<string name="btn_clearFilter">Clear Filter</string>
<string name="btn_changePassPhrase">Change Pass Phrase</string>
<string name="btn_setPassPhrase">Set Pass Phrase</string>

View File

@@ -50,6 +50,7 @@ public final class Id {
public static final int reply = 0x21070016;
public static final int cancel = 0x21070017;
public static final int save = 0x21070018;
public static final int okay = 0x21070019;
}
}

View File

@@ -66,10 +66,10 @@ public class EditKeyActivity extends BaseActivity {
@Override
public boolean onCreateOptionsMenu(Menu menu) {
menu.add(2, Id.menu.option.cancel, 0, R.string.btn_doNotSave)
menu.add(1, Id.menu.option.cancel, 0, R.string.btn_doNotSave)
// .setIcon(R.drawable.ic_menu_search_holo_light)
.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_WITH_TEXT);
menu.add(2, Id.menu.option.save, 1, R.string.btn_save)
menu.add(1, Id.menu.option.save, 1, R.string.btn_save)
// .setIcon(R.drawable.ic_suggestions_add)
.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_WITH_TEXT);
return true;

View File

@@ -78,6 +78,7 @@ public class MainActivity extends BaseActivity {
final ActionBar actionBar = getSupportActionBar();
actionBar.setDisplayShowTitleEnabled(true);
actionBar.setDisplayHomeAsUpEnabled(false);
actionBar.setHomeButtonEnabled(false);
// if (!mPreferences.hasSeenHelp()) {
// showDialog(Id.dialog.help);

View File

@@ -22,7 +22,9 @@ import org.apg.Apg;
import org.apg.Id;
import org.apg.R;
import com.actionbarsherlock.app.ActionBar;
import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuItem;
import android.app.SearchManager;
import android.content.Intent;
@@ -43,6 +45,12 @@ public class SelectPublicKeyListActivity extends BaseActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
final ActionBar actionBar = getSupportActionBar();
actionBar.setDisplayShowTitleEnabled(true);
actionBar.setDisplayHomeAsUpEnabled(false);
actionBar.setHomeButtonEnabled(false);
setContentView(R.layout.select_public_key);
setDefaultKeyMode(DEFAULT_KEYS_SEARCH_LOCAL);
@@ -51,20 +59,6 @@ public class SelectPublicKeyListActivity extends BaseActivity {
// needed in Android 1.5, where the XML attribute gets ignored
mList.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
Button okButton = (Button) findViewById(R.id.btn_ok);
okButton.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
okClicked();
}
});
Button cancelButton = (Button) findViewById(R.id.btn_cancel);
cancelButton.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
cancelClicked();
}
});
mFilterLayout = findViewById(R.id.layout_filter);
mFilterInfo = (TextView) mFilterLayout.findViewById(R.id.filterInfo);
mClearFilterButton = (Button) mFilterLayout.findViewById(R.id.btn_clear);
@@ -166,6 +160,29 @@ public class SelectPublicKeyListActivity extends BaseActivity {
public boolean onCreateOptionsMenu(Menu menu) {
menu.add(0, Id.menu.option.search, 0, R.string.menu_search).setIcon(
android.R.drawable.ic_menu_search);
menu.add(1, Id.menu.option.cancel, 0, R.string.btn_doNotSave).setShowAsAction(
MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_WITH_TEXT);
menu.add(1, Id.menu.option.okay, 1, R.string.btn_okay).setShowAsAction(
MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_WITH_TEXT);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case Id.menu.option.okay:
okClicked();
return true;
case Id.menu.option.cancel:
cancelClicked();
return true;
default:
break;
}
return false;
}
}

View File

@@ -20,6 +20,7 @@ import org.apg.Apg;
import org.apg.Id;
import org.apg.R;
import com.actionbarsherlock.app.ActionBar;
import com.actionbarsherlock.view.Menu;
import android.app.SearchManager;
@@ -46,10 +47,15 @@ public class SelectSecretKeyListActivity extends BaseActivity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setDefaultKeyMode(DEFAULT_KEYS_SEARCH_LOCAL);
final ActionBar actionBar = getSupportActionBar();
actionBar.setDisplayShowTitleEnabled(true);
actionBar.setDisplayHomeAsUpEnabled(false);
actionBar.setHomeButtonEnabled(false);
setContentView(R.layout.select_secret_key);
setDefaultKeyMode(DEFAULT_KEYS_SEARCH_LOCAL);
mList = (ListView) findViewById(R.id.list);
mList.setOnItemClickListener(new OnItemClickListener() {