Started using ActionBarSherlock

This commit is contained in:
Dominik
2012-03-11 17:33:40 +01:00
parent e9c0d7a711
commit 9b32cf87e2
368 changed files with 31904 additions and 184 deletions

View File

@@ -8,7 +8,7 @@
android:versionName="1.1" >
<uses-sdk
android:minSdkVersion="7"
android:minSdkVersion="4"
android:targetSdkVersion="14" />
<uses-permission android:name="android.permission.INTERNET" />
@@ -29,7 +29,8 @@
<application
android:hardwareAccelerated="true"
android:icon="@drawable/icon"
android:label="@string/app_name" >
android:label="@string/app_name"
android:theme="@style/Theme.Sherlock.Light" >
<activity
android:name=".ui.MainActivity"
android:configChanges="keyboardHidden|orientation|keyboard"

View File

@@ -9,3 +9,4 @@
# Project target.
target=android-15
android.library.reference.1=../com_actionbarsherlock

View File

@@ -18,7 +18,6 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@color/background_primary"
android:orientation="vertical" >
<org.apg.ui.widget.DashboardLayout

View File

@@ -1,82 +0,0 @@
<!--
Copyright 2011 Google Inc.
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.
-->
<resources>
<!-- <color name="textColorIconOverlay">#fff</color> -->
<!-- <color name="textColorIconOverlayShadow">#000</color> -->
<!-- <color name="shortcut_overlay_text_background">#7f000000</color> -->
<!-- <color name="quickcontact_list_divider">#ffcdcdcd</color> -->
<!-- <color name="quickcontact_list_background">#ffe2e2e2</color> -->
<!-- <color name="quickcontact_tab_indicator">#ff33b5e6</color> -->
<color name="background_primary">#FFFFFF</color>
<color name="text_primary">#333</color>
<!-- <color name="background_social_updates">#ffeeeeee</color> -->
<!-- Color used for the letter in the A-Z section header -->
<color name="section_header_text_color">#ff999999</color>
<!-- Color of the text in the updates tab in the tab carousel on the contact detail page -->
<!-- <color name="detail_update_tab_text_color">#777777</color> -->
<!-- Color of the text describing an unconsumed missed call. -->
<!-- <color name="call_log_missed_call_highlight_color">#FF0000</color> -->
<!-- Color of the text describing an unconsumed voicemail. -->
<!-- <color name="call_log_voicemail_highlight_color">#33b5e5</color> -->
<!-- Colour background for the voicemail playback ui. -->
<!-- <color name="voicemail_playback_ui_background">@android:color/black</color> -->
<!-- Colour of voicemail progress bar to the right of position indicator. -->
<!-- <color name="voicemail_playback_seek_bar_yet_to_play">#44ffffff</color> -->
<!-- Colour of voicemail progress bar to the left of position indicator. -->
<!-- <color name="voicemail_playback_seek_bar_already_played">#ccffffff</color> -->
<!-- Colour of text that appears on the voicemail ui. -->
<!-- <color name="voicemail_playback_ui_text">#cc696969</color> -->
<!-- Color of the theme of the People app -->
<!-- <color name="people_app_theme_color">#33B5E5</color> -->
<!-- Secondary text color in the Phone app -->
<!-- <color name="dialtacts_secondary_text_color">#888888</color> -->
<!-- Colors in the contact browser list -->
<!-- <color name="contact_count_text_color">#AAAAAA</color> -->
<!-- Color of the text of the tab carousel in the contact details -->
<!-- <color name="detail_tab_carousel_tab_label_color">#EEEEEE</color> -->
<!-- Color of the text for buttons in the action bar -->
<!-- <color name="action_bar_button_text_color">#FFFFFF</color> -->
<!-- Color of the status message for starred contacts in the People app -->
<!-- <color name="people_contact_tile_status_color">#CCCCCC</color> -->
<!-- Color of the semi-transparent shadow box on contact tiles -->
<!-- <color name="contact_tile_shadow_box_color">#7F000000</color> -->
<!-- Color of the vertical stripe that goes on the left of a block quote inside a stream item -->
<!-- <color name="stream_item_stripe_color">#CCCCCC</color> -->
<!-- Color of image view placeholder. -->
<!-- <color name="image_placeholder">#DDDDDD</color> -->
</resources>

View File

@@ -331,8 +331,8 @@
<!-- Dashboard -->
<string name="dashboard_manage_keys">Manage Keys</string>
<string name="dashboard_my_keys">My Keys</string>
<string name="dashboard_encrypt_decrypt_file">Encrypt File</string>
<string name="dashboard_encrypt_decrypt_text">Encrypt Text</string>
<string name="dashboard_encrypt_decrypt_file">Encrypt/Decrypt File</string>
<string name="dashboard_encrypt_decrypt_text">Encrypt/Decrypt Text</string>
<string name="dashboard_help">Help</string>
</resources>

View File

@@ -35,7 +35,6 @@
<item name="android:drawablePadding">2dp</item>
<item name="android:textSize">14sp</item>
<item name="android:textStyle">bold</item>
<item name="android:textColor">@color/text_primary</item>
<item name="android:background">@android:color/transparent</item>
</style>

View File

@@ -31,6 +31,10 @@ import org.apg.ProgressDialogUpdater;
import org.apg.Service;
import org.apg.R;
import com.actionbarsherlock.app.SherlockActivity;
import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuItem;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
@@ -44,13 +48,11 @@ import android.os.Environment;
import android.os.Handler;
import android.os.Message;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;
public class BaseActivity extends Activity implements Runnable, ProgressDialogUpdater,
public class BaseActivity extends SherlockActivity implements Runnable, ProgressDialogUpdater,
AskForSecretKeyPassPhrase.PassPhraseCallbackInterface {
private ProgressDialog mProgressDialog = null;

View File

@@ -28,6 +28,8 @@ import org.spongycastle.openpgp.PGPSecretKey;
import org.spongycastle.openpgp.PGPSecretKeyRing;
import org.apg.R;
import com.actionbarsherlock.view.Menu;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Context;
@@ -36,7 +38,6 @@ import android.content.Intent;
import android.os.Bundle;
import android.os.Message;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

View File

@@ -29,6 +29,8 @@ import org.spongycastle.openpgp.PGPPublicKeyRing;
import org.spongycastle.openpgp.PGPSecretKeyRing;
import org.apg.R;
import com.actionbarsherlock.view.MenuItem;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.SearchManager;
@@ -42,7 +44,6 @@ import android.net.Uri;
import android.os.Bundle;
import android.os.Message;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
@@ -163,7 +164,7 @@ public class KeyListActivity extends BaseActivity {
}
@Override
public boolean onContextItemSelected(MenuItem menuItem) {
public boolean onContextItemSelected(android.view.MenuItem menuItem) {
ExpandableListContextMenuInfo info = (ExpandableListContextMenuInfo) menuItem.getMenuInfo();
int type = ExpandableListView.getPackedPositionType(info.packedPosition);
int groupPosition = ExpandableListView.getPackedPositionGroup(info.packedPosition);

View File

@@ -24,19 +24,20 @@ import org.apg.ui.widget.KeyServerEditor;
import org.apg.ui.widget.Editor.EditorListener;
import org.apg.R;
import com.actionbarsherlock.view.Menu;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;
public class KeyServerPreferenceActivity extends BaseActivity
implements OnClickListener, EditorListener {
public class KeyServerPreferenceActivity extends BaseActivity implements OnClickListener,
EditorListener {
private LayoutInflater mInflater;
private ViewGroup mEditors;
private View mAdd;
@@ -63,7 +64,8 @@ public class KeyServerPreferenceActivity extends BaseActivity
String servers[] = intent.getStringArrayExtra(Apg.EXTRA_KEY_SERVERS);
if (servers != null) {
for (int i = 0; i < servers.length; ++i) {
KeyServerEditor view = (KeyServerEditor) mInflater.inflate(R.layout.key_server_editor, mEditors, false);
KeyServerEditor view = (KeyServerEditor) mInflater.inflate(
R.layout.key_server_editor, mEditors, false);
view.setEditorListener(this);
view.setValue(servers[i]);
mEditors.addView(view);
@@ -90,7 +92,8 @@ public class KeyServerPreferenceActivity extends BaseActivity
}
public void onClick(View v) {
KeyServerEditor view = (KeyServerEditor) mInflater.inflate(R.layout.key_server_editor, mEditors, false);
KeyServerEditor view = (KeyServerEditor) mInflater.inflate(R.layout.key_server_editor,
mEditors, false);
view.setEditorListener(this);
mEditors.addView(view);
}

View File

@@ -25,6 +25,10 @@ import org.apg.Id;
import org.spongycastle.jce.provider.BouncyCastleProvider;
import org.apg.R;
import com.actionbarsherlock.app.SherlockActivity;
import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuItem;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Context;
@@ -36,8 +40,6 @@ import android.text.util.Linkify.TransformFilter;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
@@ -83,88 +85,88 @@ public class MainActivity extends BaseActivity {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
if (!mPreferences.hasSeenHelp()) {
showDialog(Id.dialog.help);
}
if (Apg.isReleaseVersion(this) && !mPreferences.hasSeenChangeLog(Apg.getVersion(this))) {
showDialog(Id.dialog.change_log);
}
// if (!mPreferences.hasSeenHelp()) {
// showDialog(Id.dialog.help);
// }
//
// if (Apg.isReleaseVersion(this) && !mPreferences.hasSeenChangeLog(Apg.getVersion(this))) {
// showDialog(Id.dialog.change_log);
// }
}
@Override
protected Dialog onCreateDialog(int id) {
switch (id) {
case Id.dialog.change_log: {
AlertDialog.Builder alert = new AlertDialog.Builder(this);
// case Id.dialog.change_log: {
// AlertDialog.Builder alert = new AlertDialog.Builder(this);
//
// alert.setTitle("Changes " + Apg.getFullVersion(this));
// LayoutInflater inflater = (LayoutInflater) this
// .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
// View layout = inflater.inflate(R.layout.info, null);
// TextView message = (TextView) layout.findViewById(R.id.message);
//
// message.setText("Changes:\n" + "* \n" + "\n"
// + "WARNING: be careful editing your existing keys, as they "
// + "WILL be stripped of certificates right now.\n" + "\n"
// + "Also: key cross-certification is NOT supported, so signing "
// + "with those keys will get a warning when the signature is " + "checked.\n"
// + "\n" + "I hope APG continues to be useful to you, please send "
// + "bug reports, feature wishes, feedback.");
// alert.setView(layout);
//
// alert.setCancelable(false);
// alert.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
// public void onClick(DialogInterface dialog, int id) {
// MainActivity.this.removeDialog(Id.dialog.change_log);
// mPreferences.setHasSeenChangeLog(Apg.getVersion(MainActivity.this), true);
// }
// });
//
// return alert.create();
// }
alert.setTitle("Changes " + Apg.getFullVersion(this));
LayoutInflater inflater = (LayoutInflater) this
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View layout = inflater.inflate(R.layout.info, null);
TextView message = (TextView) layout.findViewById(R.id.message);
message.setText("Changes:\n" + "* \n" + "\n"
+ "WARNING: be careful editing your existing keys, as they "
+ "WILL be stripped of certificates right now.\n" + "\n"
+ "Also: key cross-certification is NOT supported, so signing "
+ "with those keys will get a warning when the signature is " + "checked.\n"
+ "\n" + "I hope APG continues to be useful to you, please send "
+ "bug reports, feature wishes, feedback.");
alert.setView(layout);
alert.setCancelable(false);
alert.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
MainActivity.this.removeDialog(Id.dialog.change_log);
mPreferences.setHasSeenChangeLog(Apg.getVersion(MainActivity.this), true);
}
});
return alert.create();
}
case Id.dialog.help: {
AlertDialog.Builder alert = new AlertDialog.Builder(this);
alert.setTitle(R.string.title_help);
LayoutInflater inflater = (LayoutInflater) this
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View layout = inflater.inflate(R.layout.info, null);
TextView message = (TextView) layout.findViewById(R.id.message);
message.setText(R.string.text_help);
TransformFilter packageNames = new TransformFilter() {
public final String transformUrl(final Matcher match, String url) {
String name = match.group(1).toLowerCase();
if (name.equals("astro")) {
return "com.metago.astro";
} else if (name.equals("k-9 mail")) {
return "com.fsck.k9";
} else {
return "org.openintents.filemanager";
}
}
};
Pattern pattern = Pattern.compile("(OI File Manager|ASTRO|K-9 Mail)");
String scheme = "market://search?q=pname:";
message.setAutoLinkMask(0);
Linkify.addLinks(message, pattern, scheme, null, packageNames);
alert.setView(layout);
alert.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
MainActivity.this.removeDialog(Id.dialog.help);
mPreferences.setHasSeenHelp(true);
}
});
return alert.create();
}
// case Id.dialog.help: {
// AlertDialog.Builder alert = new AlertDialog.Builder(this);
//
// alert.setTitle(R.string.title_help);
//
// LayoutInflater inflater = (LayoutInflater) this
// .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
// View layout = inflater.inflate(R.layout.info, null);
// TextView message = (TextView) layout.findViewById(R.id.message);
// message.setText(R.string.text_help);
//
// TransformFilter packageNames = new TransformFilter() {
// public final String transformUrl(final Matcher match, String url) {
// String name = match.group(1).toLowerCase();
// if (name.equals("astro")) {
// return "com.metago.astro";
// } else if (name.equals("k-9 mail")) {
// return "com.fsck.k9";
// } else {
// return "org.openintents.filemanager";
// }
// }
// };
//
// Pattern pattern = Pattern.compile("(OI File Manager|ASTRO|K-9 Mail)");
// String scheme = "market://search?q=pname:";
// message.setAutoLinkMask(0);
// Linkify.addLinks(message, pattern, scheme, null, packageNames);
//
// alert.setView(layout);
//
// alert.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
// public void onClick(DialogInterface dialog, int id) {
// MainActivity.this.removeDialog(Id.dialog.help);
// mPreferences.setHasSeenHelp(true);
// }
// });
//
// return alert.create();
// }
default: {
return super.onCreateDialog(id);

View File

@@ -27,12 +27,13 @@ import org.apg.Id.menu.option;
import org.spongycastle.openpgp.PGPPublicKeyRing;
import org.apg.R;
import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuItem;
import android.content.Intent;
import android.os.Bundle;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.ExpandableListView;
import android.widget.ExpandableListView.ExpandableListContextMenuInfo;
@@ -79,7 +80,7 @@ public class PublicKeyListActivity extends KeyListActivity {
}
@Override
public boolean onContextItemSelected(MenuItem menuItem) {
public boolean onContextItemSelected(android.view.MenuItem menuItem) {
ExpandableListContextMenuInfo info = (ExpandableListContextMenuInfo) menuItem.getMenuInfo();
int type = ExpandableListView.getPackedPositionType(info.packedPosition);
int groupPosition = ExpandableListView.getPackedPositionGroup(info.packedPosition);

View File

@@ -28,13 +28,15 @@ import org.apg.Id.type;
import org.apg.Id.menu.option;
import org.apg.R;
import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuItem;
import android.app.Dialog;
import android.content.Intent;
import android.os.Bundle;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.ExpandableListView;
import android.widget.ExpandableListView.ExpandableListContextMenuInfo;
@@ -99,7 +101,7 @@ public class SecretKeyListActivity extends KeyListActivity implements OnChildCli
}
@Override
public boolean onContextItemSelected(MenuItem menuItem) {
public boolean onContextItemSelected(android.view.MenuItem menuItem) {
ExpandableListContextMenuInfo info = (ExpandableListContextMenuInfo) menuItem.getMenuInfo();
int type = ExpandableListView.getPackedPositionType(info.packedPosition);
int groupPosition = ExpandableListView.getPackedPositionGroup(info.packedPosition);

View File

@@ -24,10 +24,12 @@ import org.apg.Id.menu;
import org.apg.Id.menu.option;
import org.apg.R;
import com.actionbarsherlock.view.Menu;
import android.app.SearchManager;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

View File

@@ -22,10 +22,12 @@ import org.apg.Id.menu;
import org.apg.Id.menu.option;
import org.apg.R;
import com.actionbarsherlock.view.Menu;
import android.app.SearchManager;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.AdapterView;