remove dead code

This commit is contained in:
Dominik Schürmann 2013-09-06 10:03:25 +02:00
parent c9549befb2
commit c97c57d34e
3 changed files with 30 additions and 29 deletions

View File

@ -372,5 +372,6 @@
<string name="api_register_text">The following application requests access to OpenPGP Keychain\'s API.\n\nAllow permanent access?</string> <string name="api_register_text">The following application requests access to OpenPGP Keychain\'s API.\n\nAllow permanent access?</string>
<string name="api_register_allow">Allow access</string> <string name="api_register_allow">Allow access</string>
<string name="api_register_disallow">Disallow access</string> <string name="api_register_disallow">Disallow access</string>
<string name="api_register_error_select_key">Please select a key!</string>
</resources> </resources>

View File

@ -12,7 +12,6 @@ import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.widget.Button;
import android.widget.TextView; import android.widget.TextView;
import com.actionbarsherlock.app.ActionBar; import com.actionbarsherlock.app.ActionBar;
@ -22,22 +21,15 @@ import com.actionbarsherlock.view.MenuItem;
public class AppSettingsActivity extends SherlockFragmentActivity { public class AppSettingsActivity extends SherlockFragmentActivity {
// model // model
Uri mAppUri; private Uri mAppUri;
String mPackageName; private String mPackageName;
// view private AppSettingsFragment settingsFragment;
Button saveButton;
Button revokeButton;
AppSettingsFragment settingsFragment;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
// pm = getApplicationContext().getPackageManager();
// BEGIN_INCLUDE (inflate_set_custom_view)
// Inflate a "Done" custom action bar view to serve as the "Up" affordance. // Inflate a "Done" custom action bar view to serve as the "Up" affordance.
final LayoutInflater inflater = (LayoutInflater) getSupportActionBar().getThemedContext() final LayoutInflater inflater = (LayoutInflater) getSupportActionBar().getThemedContext()
.getSystemService(LAYOUT_INFLATER_SERVICE); .getSystemService(LAYOUT_INFLATER_SERVICE);
@ -60,7 +52,6 @@ public class AppSettingsActivity extends SherlockFragmentActivity {
actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM, ActionBar.DISPLAY_SHOW_CUSTOM actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM, ActionBar.DISPLAY_SHOW_CUSTOM
| ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_SHOW_TITLE); | ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_SHOW_TITLE);
actionBar.setCustomView(customActionBarView); actionBar.setCustomView(customActionBarView);
// END_INCLUDE (inflate_set_custom_view)
setContentView(R.layout.api_app_settings_activity); setContentView(R.layout.api_app_settings_activity);

View File

@ -17,16 +17,13 @@
package org.sufficientlysecure.keychain.remote_api; package org.sufficientlysecure.keychain.remote_api;
import org.sufficientlysecure.keychain.Constants; import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.Id;
import org.sufficientlysecure.keychain.R; import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.remote_api.IServiceActivityCallback;
import org.sufficientlysecure.keychain.helper.PgpMain; import org.sufficientlysecure.keychain.helper.PgpMain;
import org.sufficientlysecure.keychain.provider.ProviderHelper; import org.sufficientlysecure.keychain.provider.ProviderHelper;
import org.sufficientlysecure.keychain.ui.dialog.PassphraseDialogFragment; import org.sufficientlysecure.keychain.ui.dialog.PassphraseDialogFragment;
import org.sufficientlysecure.keychain.util.Log; import org.sufficientlysecure.keychain.util.Log;
import com.actionbarsherlock.app.ActionBar;
import com.actionbarsherlock.app.SherlockFragmentActivity;
import android.content.ComponentName; import android.content.ComponentName;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
@ -41,6 +38,10 @@ import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast;
import com.actionbarsherlock.app.ActionBar;
import com.actionbarsherlock.app.SherlockFragmentActivity;
public class ServiceActivity extends SherlockFragmentActivity { public class ServiceActivity extends SherlockFragmentActivity {
@ -53,6 +54,9 @@ public class ServiceActivity extends SherlockFragmentActivity {
private IServiceActivityCallback mServiceCallback; private IServiceActivityCallback mServiceCallback;
private boolean mServiceBound; private boolean mServiceBound;
// view
AppSettingsFragment settingsFragment;
private ServiceConnection mServiceActivityConnection = new ServiceConnection() { private ServiceConnection mServiceActivityConnection = new ServiceConnection() {
public void onServiceConnected(ComponentName name, IBinder service) { public void onServiceConnected(ComponentName name, IBinder service) {
mServiceCallback = IServiceActivityCallback.Stub.asInterface(service); mServiceCallback = IServiceActivityCallback.Stub.asInterface(service);
@ -132,7 +136,6 @@ public class ServiceActivity extends SherlockFragmentActivity {
if (ACTION_REGISTER.equals(action)) { if (ACTION_REGISTER.equals(action)) {
final String packageName = extras.getString(EXTRA_PACKAGE_NAME); final String packageName = extras.getString(EXTRA_PACKAGE_NAME);
// BEGIN_INCLUDE (inflate_set_custom_view)
// Inflate a "Done"/"Cancel" custom action bar view // Inflate a "Done"/"Cancel" custom action bar view
final LayoutInflater inflater = (LayoutInflater) getSupportActionBar() final LayoutInflater inflater = (LayoutInflater) getSupportActionBar()
.getThemedContext().getSystemService(LAYOUT_INFLATER_SERVICE); .getThemedContext().getSystemService(LAYOUT_INFLATER_SERVICE);
@ -146,6 +149,12 @@ public class ServiceActivity extends SherlockFragmentActivity {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
// Allow // Allow
if (settingsFragment.getSecretKeyId() == Id.key.none) {
Toast.makeText(ServiceActivity.this,
R.string.api_register_error_select_key, Toast.LENGTH_LONG)
.show();
} else {
ProviderHelper.addCryptoConsumer(ServiceActivity.this, packageName); ProviderHelper.addCryptoConsumer(ServiceActivity.this, packageName);
// Intent data = new Intent(); // Intent data = new Intent();
@ -156,6 +165,7 @@ public class ServiceActivity extends SherlockFragmentActivity {
} }
finish(); finish();
} }
}
}); });
((TextView) customActionBarView.findViewById(R.id.actionbar_cancel_text)) ((TextView) customActionBarView.findViewById(R.id.actionbar_cancel_text))
.setText(R.string.api_register_disallow); .setText(R.string.api_register_disallow);
@ -180,12 +190,11 @@ public class ServiceActivity extends SherlockFragmentActivity {
| ActionBar.DISPLAY_SHOW_TITLE); | ActionBar.DISPLAY_SHOW_TITLE);
actionBar.setCustomView(customActionBarView, new ActionBar.LayoutParams( actionBar.setCustomView(customActionBarView, new ActionBar.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
// END_INCLUDE (inflate_set_custom_view)
setContentView(R.layout.api_app_register_activity); setContentView(R.layout.api_app_register_activity);
AppSettingsFragment settingsFragment = (AppSettingsFragment) getSupportFragmentManager() settingsFragment = (AppSettingsFragment) getSupportFragmentManager().findFragmentById(
.findFragmentById(R.id.api_app_settings_fragment); R.id.api_app_settings_fragment);
settingsFragment.setPackage(packageName); settingsFragment.setPackage(packageName);