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_allow">Allow access</string>
<string name="api_register_disallow">Disallow access</string>
<string name="api_register_error_select_key">Please select a key!</string>
</resources>

View File

@ -12,7 +12,6 @@ import android.net.Uri;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import com.actionbarsherlock.app.ActionBar;
@ -22,22 +21,15 @@ import com.actionbarsherlock.view.MenuItem;
public class AppSettingsActivity extends SherlockFragmentActivity {
// model
Uri mAppUri;
String mPackageName;
private Uri mAppUri;
private String mPackageName;
// view
Button saveButton;
Button revokeButton;
AppSettingsFragment settingsFragment;
private AppSettingsFragment settingsFragment;
@Override
protected void onCreate(Bundle 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.
final LayoutInflater inflater = (LayoutInflater) getSupportActionBar().getThemedContext()
.getSystemService(LAYOUT_INFLATER_SERVICE);
@ -60,7 +52,6 @@ public class AppSettingsActivity extends SherlockFragmentActivity {
actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM, ActionBar.DISPLAY_SHOW_CUSTOM
| ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_SHOW_TITLE);
actionBar.setCustomView(customActionBarView);
// END_INCLUDE (inflate_set_custom_view)
setContentView(R.layout.api_app_settings_activity);

View File

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