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.
|
|
|
|
|
*/
|
|
|
|
|
|
2012-04-14 16:18:06 +02:00
|
|
|
package org.thialfihar.android.apg.ui;
|
2010-04-06 19:54:51 +00:00
|
|
|
|
2012-04-14 16:18:06 +02:00
|
|
|
import org.thialfihar.android.apg.Id;
|
|
|
|
|
import org.thialfihar.android.apg.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
|
|
|
|
2012-03-11 16:33:47 +01: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);
|
2012-03-11 16:33:47 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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-11 16:33:47 +01:00
|
|
|
}
|
|
|
|
|
|
2012-03-12 00:12:19 +01:00
|
|
|
public void encryptOnClick(View view) {
|
2012-03-11 16:33:47 +01:00
|
|
|
Intent intent = new Intent(MainActivity.this, EncryptActivity.class);
|
2012-06-20 15:27:45 +03:00
|
|
|
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-11 16:33:47 +01:00
|
|
|
}
|
|
|
|
|
|
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);
|
2012-06-20 15:27:45 +03:00
|
|
|
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-11 16:33:47 +01:00
|
|
|
|
2012-03-12 00:12:19 +01:00
|
|
|
public void scanQrcodeOnClick(View view) {
|
|
|
|
|
Intent intent = new Intent(this, ImportFromQRCodeActivity.class);
|
2012-06-20 15:27:45 +03:00
|
|
|
intent.setAction(ImportFromQRCodeActivity.IMPORT_FROM_QR_CODE);
|
2012-03-12 00:12:19 +01:00
|
|
|
startActivityForResult(intent, Id.request.import_from_qr_code);
|
2012-03-11 16:33:47 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void helpOnClick(View view) {
|
2012-03-12 15:10:26 +01:00
|
|
|
startActivity(new Intent(this, HelpActivity.class));
|
2012-03-11 16:33:47 +01:00
|
|
|
}
|
|
|
|
|
|
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()) {
|
2010-04-28 23:35:11 +00:00
|
|
|
|
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));
|
2012-03-10 21:36:08 +01:00
|
|
|
return true;
|
2010-08-17 01:02:39 +00:00
|
|
|
|
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
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|