2012-03-22 15:38:50 -04:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2012 Dominik Schürmann <dominik@dominikschuermann.de>
|
|
|
|
*
|
|
|
|
* 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 08:31:16 -05:00
|
|
|
package org.sufficientlysecure.keychain.demo;
|
2012-03-22 15:38:50 -04:00
|
|
|
|
2013-01-16 08:31:16 -05:00
|
|
|
import org.sufficientlysecure.keychain.demo.R;
|
2012-03-22 15:38:50 -04:00
|
|
|
|
|
|
|
import android.app.Activity;
|
|
|
|
import android.content.Intent;
|
|
|
|
import android.os.Bundle;
|
|
|
|
import android.preference.Preference;
|
|
|
|
import android.preference.Preference.OnPreferenceClickListener;
|
|
|
|
import android.preference.PreferenceActivity;
|
|
|
|
|
|
|
|
public class BaseActivity extends PreferenceActivity {
|
|
|
|
private Activity mActivity;
|
|
|
|
|
|
|
|
private Preference mIntentDemo;
|
2012-11-19 16:18:25 -05:00
|
|
|
private Preference mContentProviderDemo;
|
2012-12-14 12:22:03 -05:00
|
|
|
private Preference mAidlDemo;
|
|
|
|
private Preference mAidlDemo2;
|
2012-03-22 15:38:50 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Called when the activity is first created.
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
|
|
super.onCreate(savedInstanceState);
|
|
|
|
|
|
|
|
mActivity = this;
|
|
|
|
|
|
|
|
// load preferences from xml
|
|
|
|
addPreferencesFromResource(R.xml.base_preference);
|
|
|
|
|
|
|
|
// find preferences
|
2012-04-11 13:29:27 -04:00
|
|
|
mIntentDemo = (Preference) findPreference("intent_demo");
|
2012-11-19 16:18:25 -05:00
|
|
|
mContentProviderDemo = (Preference) findPreference("content_provider_demo");
|
2012-12-14 12:22:03 -05:00
|
|
|
mAidlDemo = (Preference) findPreference("aidl_demo");
|
|
|
|
mAidlDemo2 = (Preference) findPreference("aidl_demo2");
|
2012-03-22 15:38:50 -04:00
|
|
|
|
|
|
|
mIntentDemo.setOnPreferenceClickListener(new OnPreferenceClickListener() {
|
|
|
|
@Override
|
|
|
|
public boolean onPreferenceClick(Preference preference) {
|
2012-04-11 13:29:27 -04:00
|
|
|
startActivity(new Intent(mActivity, IntentDemoActivity.class));
|
2012-03-22 15:38:50 -04:00
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2012-12-14 12:22:03 -05:00
|
|
|
mContentProviderDemo.setOnPreferenceClickListener(new OnPreferenceClickListener() {
|
|
|
|
@Override
|
|
|
|
public boolean onPreferenceClick(Preference preference) {
|
|
|
|
startActivity(new Intent(mActivity, ContentProviderDemoActivity.class));
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2012-04-11 13:29:27 -04:00
|
|
|
mAidlDemo.setOnPreferenceClickListener(new OnPreferenceClickListener() {
|
|
|
|
@Override
|
|
|
|
public boolean onPreferenceClick(Preference preference) {
|
2012-11-14 10:02:11 -05:00
|
|
|
startActivity(new Intent(mActivity, AidlDemoActivity.class));
|
2012-04-11 13:29:27 -04:00
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
});
|
2012-11-19 16:18:25 -05:00
|
|
|
|
2012-12-14 12:22:03 -05:00
|
|
|
mAidlDemo2.setOnPreferenceClickListener(new OnPreferenceClickListener() {
|
2012-11-19 16:18:25 -05:00
|
|
|
@Override
|
|
|
|
public boolean onPreferenceClick(Preference preference) {
|
2012-12-14 12:22:03 -05:00
|
|
|
startActivity(new Intent(mActivity, AidlDemoActivity2.class));
|
2012-11-19 16:18:25 -05:00
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
});
|
2012-12-14 12:22:03 -05:00
|
|
|
|
2012-03-22 15:38:50 -04:00
|
|
|
}
|
2012-04-11 13:29:27 -04:00
|
|
|
|
2012-03-22 15:38:50 -04:00
|
|
|
}
|