Files
open-keychain/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/MainActivity.java

101 lines
3.4 KiB
Java
Raw Normal View History

2010-04-06 19:54:51 +00:00
/*
2012-06-11 03:26:15 +03:00
* Copyright (C) 2012 Dominik Schürmann <dominik@dominikschuermann.de>
2010-04-06 19:54:51 +00:00
* 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.
*/
2013-01-16 14:31:16 +01:00
package org.sufficientlysecure.keychain.ui;
2010-04-06 19:54:51 +00:00
2013-01-16 14:31:16 +01:00
import org.sufficientlysecure.keychain.Id;
import org.sufficientlysecure.keychain.R;
2010-04-06 19:54:51 +00:00
2012-03-12 00:12:19 +01:00
import com.actionbarsherlock.app.ActionBar;
2012-06-11 02:45:56 +03:00
import com.actionbarsherlock.app.SherlockActivity;
2012-03-11 17:33:40 +01:00
import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuItem;
2010-04-06 19:54:51 +00:00
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
2012-06-11 02:45:56 +03:00
public class MainActivity extends SherlockActivity {
2010-04-06 19:54:51 +00:00
public void manageKeysOnClick(View view) {
2012-09-11 15:27:32 +02:00
// used instead of startActivity set actionbar based on callingPackage
2012-10-28 23:51:03 +01:00
startActivityForResult(new Intent(this, KeyListPublicActivity.class), 0);
}
public void myKeysOnClick(View view) {
2012-09-11 15:27:32 +02:00
// used instead of startActivity set actionbar based on callingPackage
2012-10-28 23:51:03 +01:00
startActivityForResult(new Intent(this, KeyListSecretActivity.class), 0);
}
2012-03-12 00:12:19 +01:00
public void encryptOnClick(View view) {
Intent intent = new Intent(MainActivity.this, EncryptActivity.class);
intent.setAction(EncryptActivity.ACTION_ENCRYPT);
2012-09-11 15:27:32 +02:00
// used instead of startActivity set actionbar based on callingPackage
startActivityForResult(intent, 0);
}
2012-03-12 00:12:19 +01:00
public void decryptOnClick(View view) {
2012-03-12 01:58:24 +01:00
Intent intent = new Intent(MainActivity.this, DecryptActivity.class);
intent.setAction(DecryptActivity.ACTION_DECRYPT);
2012-09-11 15:27:32 +02:00
// used instead of startActivity set actionbar based on callingPackage
startActivityForResult(intent, 0);
2012-03-12 00:12:19 +01:00
}
2012-03-12 00:12:19 +01:00
public void scanQrcodeOnClick(View view) {
Intent intent = new Intent(this, ImportKeysActivity.class);
startActivityForResult(intent, 0);
}
public void helpOnClick(View view) {
2012-03-12 15:10:26 +01:00
startActivity(new Intent(this, HelpActivity.class));
}
2010-04-06 19:54:51 +00:00
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
2012-03-12 00:12:19 +01:00
final ActionBar actionBar = getSupportActionBar();
actionBar.setDisplayShowTitleEnabled(true);
actionBar.setDisplayHomeAsUpEnabled(false);
2012-04-11 19:29:27 +02:00
actionBar.setHomeButtonEnabled(false);
2010-04-06 19:54:51 +00:00
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
2012-03-12 00:12:19 +01:00
menu.add(0, Id.menu.option.preferences, 0, R.string.menu_preferences)
2012-03-12 14:28:35 +01:00
.setIcon(R.drawable.ic_menu_settings)
.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
2010-04-06 19:54:51 +00:00
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
2012-06-11 03:26:15 +03:00
case Id.menu.option.preferences:
2012-03-12 00:12:19 +01:00
startActivity(new Intent(this, PreferencesActivity.class));
return true;
2012-06-11 03:26:15 +03:00
default:
2012-03-12 00:12:19 +01:00
break;
2010-04-06 19:54:51 +00:00
}
2012-06-11 03:26:15 +03:00
return false;
2010-04-06 19:54:51 +00:00
}
}