@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Bundle myextras = getIntent().getExtras(); contextualGDS = (GruppoDiStudio) myextras.getSerializable(Constants.GDS_SUBS); // questo carica la materia nel gruppo new GetRelatedCorsoAS(GDS_members_activity.this, contextualGDS).execute(); setContentView(R.layout.gds_members_activity); // customize layout ActionBar actionbar = getSupportActionBar(); actionbar.setTitle(getResources().getString(R.string.gds_show_users)); actionbar.setLogo(R.drawable.gruppistudio_icon_white); actionbar.setHomeButtonEnabled(true); actionbar.setDisplayHomeAsUpEnabled(true); // retrieving graphics from activity_layout TextView nome_gds = (TextView) findViewById(R.id.tv_nome_gds_detail_members); TextView materia_gds = (TextView) findViewById(R.id.tv_materia_gds_detail_members); ListView participants_gds = (ListView) findViewById(R.id.lv_partecipanti_gds_members); nome_gds.setText(contextualGDS.getNome()); materia_gds.setText(contextualGDS.getMateria()); if (contextualGDS.getStudentiGruppo() != null && !contextualGDS.getStudentiGruppo().isEmpty()) { Students_to_listview_adapter adapter = new Students_to_listview_adapter( GDS_members_activity.this, R.id.lv_partecipanti_gds_members, ((ArrayList<Studente>) contextualGDS.getStudentiGruppo())); participants_gds.setAdapter(adapter); } }
// cambiar el actionbar con iconos y fondo personalizado @TargetApi(Build.VERSION_CODES.HONEYCOMB) private void changeActionBar() { // typeface personalizadas robotoBoldCondensed = Typeface.createFromAsset(getActivity().getAssets(), "Roboto-BoldCondensed.ttf"); // boton de volver atras del boton home, e icono personalizado actionBar.setDisplayHomeAsUpEnabled(false); actionBar.setHomeButtonEnabled(true); actionBar.setIcon(R.drawable.ic_nav_menu); // cambiar el titulo por otro con subtitulo + layout actionBar.setDisplayShowTitleEnabled(false); // ocultar titulo normal // permitir el customizado actionBar.setDisplayShowCustomEnabled(true); // inflar un view con el layout de los titulos View customView = LayoutInflater.from(getActivity()).inflate(R.layout.actionbar_title, null); // identificar las etiquetas y setTypeface otra letra titulo = (TextView) customView.findViewById(R.id.tituloWeAreValencia); titulo.setTypeface(robotoBoldCondensed); /// center xml in actionbar ActionBar.LayoutParams lp = new ActionBar.LayoutParams( ActionBar.LayoutParams.MATCH_PARENT, ActionBar.LayoutParams.MATCH_PARENT); lp.gravity = Gravity.CENTER; customView.setLayoutParams(lp); /* http://stackoverflow.com/questions/11327210/setting-a-custom-text-in-the-center-actionbarsherlock */ // set inflate view to actionBarSherlock actionBar.setCustomView(customView); }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ActionBar actionBar = getSupportActionBar(); actionBar.setHomeButtonEnabled(true); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setIcon(android.R.color.transparent); actionBar.setLogo(R.drawable.up_icon); actionBar.setTitle(R.string.observation_photos); mApp = (INaturalistApp) getApplicationContext(); setContentView(R.layout.observation_photos); Intent intent = getIntent(); try { if (savedInstanceState == null) { String observationString = intent.getStringExtra("observation"); if (observationString != null) mObservation = new JSONObject(observationString); } else { mObservation = new JSONObject(savedInstanceState.getString("observation")); } } catch (JSONException e) { e.printStackTrace(); } mViewPager = (HackyViewPager) findViewById(R.id.id_pic_view_pager); if (mObservation != null) { mViewPager.setAdapter(new IdPicsPagerAdapter(mObservation)); } }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_script); setVolumeControlStream(AudioManager.STREAM_MUSIC); currentFragmentPosition = FRAGMENT_SCRIPTS; if (savedInstanceState == null) { Bundle bundle = this.getIntent().getExtras(); if (bundle != null) { currentFragmentPosition = bundle.getInt(EXTRA_FRAGMENT_POSITION, FRAGMENT_SCRIPTS); } } FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction(); updateCurrentFragment(currentFragmentPosition, fragmentTransaction); fragmentTransaction.commit(); final ActionBar actionBar = getSupportActionBar(); actionBar.setHomeButtonEnabled(true); actionBar.setDisplayShowTitleEnabled(true); String currentSprite = ProjectManager.getInstance().getCurrentSprite().getName(); actionBar.setTitle(currentSprite); buttonAdd = (ImageButton) findViewById(R.id.button_add); updateHandleAddButtonClickListener(); }
@Override public void onCreate(Bundle savedInstanceState) { setTheme(YaximApplication.getConfig(this).getTheme()); super.onCreate(savedInstanceState); mChatFontSize = Integer.valueOf(YaximApplication.getConfig(this).chatFontSize); requestWindowFeature(Window.FEATURE_ACTION_BAR); setContentView(R.layout.mainchat); getContentResolver() .registerContentObserver(RosterProvider.CONTENT_URI, true, mContactObserver); ActionBar actionBar = getSupportActionBar(); actionBar.setHomeButtonEnabled(true); actionBar.setDisplayHomeAsUpEnabled(true); registerForContextMenu(getListView()); setContactFromUri(); registerXMPPService(); setSendButton(); setUserInput(); String titleUserid; if (mUserScreenName != null) { titleUserid = mUserScreenName; } else { titleUserid = mWithJabberID; } setCustomTitle(titleUserid); setChatWindowAdapter(); }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setTheme(R.style.HOSTheme); ActionBar actionBar = getSupportActionBar(); actionBar.setHomeButtonEnabled(true); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setDisplayShowTitleEnabled(false); actionBar.setIcon(android.R.color.transparent); FadingHelper helper = new FadingHelper() .actionBarBackground(R.color.black_overlay) .headerLayout(R.layout.xmas_header) .parallax(true) .contentLayout(R.layout.xmas_miracles); setContentView(helper.createView(this)); helper.initActionBar(this); setUpMapIfNeeded(); forum = (XmasItem) findViewById(R.id.forum); forum.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { Intent i = new Intent(getApplicationContext(), HiddenWiki.class); i.putExtra("wikiLink", "http://forum.parkfans.net/thread-1673.html"); startActivity(i); } }); }
@Override public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.select_categories); setTitle(getResources().getString(R.string.select_categories)); ActionBar actionBar = getSupportActionBar(); actionBar.setHomeButtonEnabled(true); actionBar.setDisplayHomeAsUpEnabled(true); lv = getListView(); lv.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE); lv.setItemsCanFocus(false); Bundle extras = getIntent().getExtras(); if (extras != null) { id = extras.getInt("id"); try { blog = new Blog(id); } catch (Exception e) { Toast.makeText(this, getResources().getText(R.string.blog_not_found), Toast.LENGTH_SHORT) .show(); finish(); } checkedCategories = extras.getLongArray("checkedCategories"); categoriesCSV = extras.getString("categoriesCSV"); } loadCategories(); }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setTitle(R.string.backpack_title); setContentView(R.layout.activity_script); setVolumeControlStream(AudioManager.STREAM_MUSIC); currentFragmentPosition = FRAGMENT_BACKPACK_SCRIPTS; if (savedInstanceState == null) { Bundle bundle = this.getIntent().getExtras(); if (bundle != null) { currentFragmentPosition = bundle.getInt(EXTRA_FRAGMENT_POSITION, FRAGMENT_BACKPACK_SCRIPTS); backpackItem = bundle.getBoolean(BACKPACK_ITEM); } } FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction(); setCurrentFragment(currentFragmentPosition); fragmentTransaction.commit(); fragmentTransaction.add(R.id.script_fragment_container, currentFragment, currentFragmentTag); final ActionBar actionBar = getSupportActionBar(); actionBar.setHomeButtonEnabled(true); actionBar.setDisplayShowTitleEnabled(true); }
public void setupActionBar() { final ActionBar actionBar = getSupportActionBar(); actionBar.setHomeButtonEnabled(true); actionBar.setDisplayShowTitleEnabled(true); String currentSprite = ProjectManager.getInstance().getCurrentSprite().getName(); actionBar.setTitle(currentSprite); }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.data_layout); d_pb_ll = (LinearLayout) findViewById(R.id.data_progressbar_ll); dataUsedText = (TextView) findViewById(R.id.dataUsedText); mProgress = (ProgressBar) findViewById(R.id.percentDataUsed); dell = (LinearLayout) findViewById(R.id.data_error); detv = (TextView) findViewById(R.id.tv_failure); deb = (Button) findViewById(R.id.button_send_data); actionbar = getSupportActionBar(); actionbar.setTitle("Data Usage"); actionbar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); actionbar.setHomeButtonEnabled(true); actionbar.setDisplayHomeAsUpEnabled(true); graph = (XYPlot) findViewById(R.id.mySimpleXYPlot); graph.setOnTouchListener(this); graph.setMarkupEnabled(false); labels = new Long[288]; downdata = new Float[288]; totaldata = new Float[288]; httpclient = ConnectionHelper.getThreadSafeClient(); httpclient.getCookieStore().clear(); BasicClientCookie cookie = new BasicClientCookie("AUTHCOOKIE", ConnectionHelper.getPNAAuthCookie(this, httpclient)); cookie.setDomain(".pna.utexas.edu"); httpclient.getCookieStore().addCookie(cookie); new fetchDataTask(httpclient).execute(); new fetchProgressTask(httpclient).execute(); }
@Override protected void onCreate(Bundle arg0) { // TODO Auto-generated method stub super.onCreate(arg0); setContentView(R.layout.route); mHandler = new RouteHandler(this); ActionBar actionBar = getSupportActionBar(); actionBar.setTitle(getString(R.string.route)); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setHomeButtonEnabled(true); }
private void initActionBar() { actionBar = getSupportActionBar(); // actionBar.setIcon(R.drawable.ic_actionbar);// R.drawable.ic_actionbar actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setDisplayShowHomeEnabled(true); actionBar.setHomeButtonEnabled(true); actionBar.setDisplayShowTitleEnabled(false); actionBar.setDisplayShowCustomEnabled(true); View view = View.inflate(this, R.layout.actionbar_title, null); mActionBarTitle = (ShimmerTextView) view.findViewById(R.id.tv_shimmer); new Shimmer().start(mActionBarTitle); actionBar.setCustomView(view); }
/* * inicializa * (non-Javadoc) * @see android.app.Activity#onCreate(android.os.Bundle) */ @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.resultadostest); ActionBar bar = getSupportActionBar(); bar.setTitle("Recomendaciones"); bar.setIcon(R.drawable.home_icon_normal_invert); bar.setHomeButtonEnabled(true); if (savedInstanceState == null) { Recomendaciones.getResultados(this); } else { getContents(savedInstanceState.getString("json")); } }
@Override public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.routes_list); // Set up the Action Bar ActionBar actionBar = getSupportActionBar(); actionBar.setHomeButtonEnabled(true); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setTitle(R.string.routes); getExpandableListView() .setOnChildClickListener( new OnChildClickListener() { public boolean onChildClick( ExpandableListView parent, View v, int groupPosition, int childPosition, long id) { long destinationId = -1; Route route = routes.get(groupPosition); destinations = route.getDestinations(); destinationId = destinations.get(childPosition).getId(); Bundle bundle = new Bundle(); bundle.putLong("destinationId", destinationId); Intent stopsListIntent = new Intent(RoutesListActivity.this, StopsListActivity.class); stopsListIntent.putExtras(bundle); startActivityForResult(stopsListIntent, 1); return true; } }); displayRoutes(); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.modify_user); actionBar = getSupportActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setHomeButtonEnabled(true); mViewPager = (ViewPager) findViewById(R.id.modify_pager); titlePageIndicator = (TitlePageIndicator) findViewById(R.id.modify_indicator); titlePageIndicator.setTextColor(Color.BLACK); titlePageIndicator.setSelectedColor(Color.BLACK); userFunctions = new UserFunctions(getApplicationContext()); boolean isLogined = userFunctions.isUserLoggedIn(getApplicationContext()); if (!isLogined) { Toast.makeText( getApplicationContext(), getResources().getString(R.string.modify_userNotLogin), Toast.LENGTH_SHORT) .show(); finish(); } uID = String.valueOf(userFunctions.getUserUid(getApplicationContext())); setUpViewPager(); }
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main_holder); ActionBar actionBar = getSupportActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setHomeButtonEnabled(true); fm = getSupportFragmentManager(); FragmentTransaction ft = fm.beginTransaction(); ImageBucketsFragment fragment = new ImageBucketsFragment(); ft.add(R.id.layout_container, fragment); ft.commit(); mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mDrawerToggle = new ActionBarDrawerToggle( this, mDrawerLayout, R.drawable.back_caret, R.string.drawer_open, R.string.drawer_close) { public void onDrawerClosed(View v) {} public void onDrawerOpened(View v) {} }; String[] menuOptions = getResources().getStringArray(R.array.menu_options_array); ListView mDrawerList = (ListView) findViewById(R.id.left_drawer); // mDrawerList.setAdapter(new ArrayAdapter<String>(this , android.R.layout.simple_list_item_1 , // menuOptions)); String[] values = new String[] {"Choose", "Customize", "Checkout", "FAQ", "Settings", "Pricing"}; mDrawerList.setAdapter(new DrawerListArrayAdapter(this, values)); mDrawerList.setOnItemClickListener( new DrawerItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { switch (position) { case 0: // choose switchTo(ImageBucketsFragment.class, null); mDrawerLayout.closeDrawer(GravityCompat.END); break; case 1: // customize switchTo(EdittingGridFragment.class, null); mDrawerLayout.closeDrawer(GravityCompat.END); break; case 2: // order summary switchTo(OrderSummary.class, null); mDrawerLayout.closeDrawer(GravityCompat.END); break; case 3: // about us mDrawerLayout.closeDrawer(GravityCompat.END); Intent intent2 = new Intent(getBaseContext(), StaticWebview.class); intent2.putExtra("type", 1); startActivity(intent2); break; case 4: // settings mDrawerLayout.closeDrawer(GravityCompat.END); Intent intent = new Intent(getBaseContext(), SettingsActivity2.class); startActivity(intent); break; case 5: // Pricing tab mDrawerLayout.closeDrawer(GravityCompat.END); Intent intent3 = new Intent(getBaseContext(), StaticWebview.class); intent3.putExtra("type", 2); startActivity(intent3); break; } } }); mDrawerLayout.setDrawerListener(mDrawerToggle); }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.fw_setting); final ActionBar ab = getSupportActionBar(); ab.setDisplayHomeAsUpEnabled(false); ab.setDisplayShowCustomEnabled(true); ab.setDisplayShowTitleEnabled(false); ab.setHomeButtonEnabled(true); customViewForDictView = (ViewGroup) getLayoutInflater().inflate(R.layout.setting_bar, null); ab.setCustomView(customViewForDictView); m_head_text = (TextView) customViewForDictView.findViewById(R.id.setting_text); m_head_text.setText(N("FW_SETTING")); setting_scroll = (ScrollView) findViewById(R.id.setting_scroll); set_one_text(R.id.language_text, "FW_SEL_LANG"); set_one_text(R.id.home_page_text, "FW_HOME_PAGE"); set_one_text(R.id.mutil_dict_text, "FW_MUTIL_DICT_SET"); set_one_text(R.id.translate_need_text, "FW_NEED_TRANS"); set_one_text(R.id.translate_show_text, "FW_TRANS_SHOW_LINES"); set_one_text(R.id.translate_default_text, "FW_DEFAULT_TRANS_DICT"); set_one_text(R.id.full_screen, "FW_FULL_SCREEN"); set_one_text(R.id.random_text, "FW_RANDOM_ARTICLE"); String[] m = {N("FW_SEL_ENGLISH"), N("FW_SEL_CHINESE")}; Spinner language = new_spinner(R.id.language_sel, m, GetUseLanguage()); language.setOnItemSelectedListener( new OnItemSelectedListener() { public void onItemSelected(AdapterView<?> arg0, View arg1, int idx, long arg3) { SetUseLanguage(idx); show_short_msg(N("FW_SEL_LANG_MSG")); } public void onNothingSelected(AdapterView<?> arg0) {} }); String[] home_page_desc = {N("FW_HP_BLANK"), N("FW_HP_LAST_READ"), N("FW_HP_CURR_DATE")}; Spinner home_page = new_spinner(R.id.home_page_list, home_page_desc, GetHomePageFlag()); home_page.setOnItemSelectedListener( new OnItemSelectedListener() { public void onItemSelected(AdapterView<?> arg0, View arg1, int idx, long arg3) { SetHomePageFlag(idx); } public void onNothingSelected(AdapterView<?> arg0) {} }); String[] random_desc = { N("FW_RANDOM_HISTORY"), N("FW_RANDOM_FAVORITE"), N("FW_RANDOM_SELECTED_LANG"), N("FW_RANDOM_ALL_LANG") }; Spinner random = new_spinner(R.id.random_list, random_desc, GetRandomFlag()); random.setOnItemSelectedListener( new OnItemSelectedListener() { public void onItemSelected(AdapterView<?> arg0, View arg1, int idx, long arg3) { SetRandomFlag(idx); } public void onNothingSelected(AdapterView<?> arg0) {} }); m_full_screen_box = (CheckBox) findViewById(R.id.full_screen_box); if (WikiGetFullScreenFlag() == 0) { m_full_screen_box.setChecked(false); } else { m_full_screen_box.setChecked(true); } m_full_screen_box.setOnCheckedChangeListener( new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { switch_full_screen(); } }); String[] mutil_dict_desc = {N("FW_SORT_BY_TITLE"), N("FW_SORT_BY_DICT")}; Spinner mutil_dict = new_spinner(R.id.mutil_dict_list, mutil_dict_desc, GetMutilLangListMode()); mutil_dict.setOnItemSelectedListener( new OnItemSelectedListener() { public void onItemSelected(AdapterView<?> arg0, View arg1, int idx, long arg3) { SetMutilLangListMode(idx); } public void onNothingSelected(AdapterView<?> arg0) {} }); m_lang_list = WikiLangList(); String curr_default = TranslateDefault(); int default_pos = 0; for (int i = 0; i < m_lang_list.length; i++) { if (m_lang_list[i].equals(curr_default)) { default_pos = i; break; } } if (m_lang_list.length == 0) { m_lang_list = new String[1]; m_lang_list[0] = "No Dictionary"; } Spinner trans_default = new_spinner(R.id.translate_default_list, m_lang_list, default_pos); trans_default.setOnItemSelectedListener( new OnItemSelectedListener() { public void onItemSelected(AdapterView<?> arg0, View arg1, int idx, long arg3) { SetTranslateDefault(m_lang_list[idx]); } public void onNothingSelected(AdapterView<?> arg0) {} }); m_translate_box = (CheckBox) findViewById(R.id.translate_box); if (GetNeedTranslate() == 0) { m_translate_box.setChecked(false); } else { m_translate_box.setChecked(true); } m_translate_box.setOnCheckedChangeListener( new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if (isChecked) { SetNeedTranslate(1); show_short_msg(N("FW_TRANS_ALERT_MSG")); } else { SetNeedTranslate(0); } } }); translate_line(); set_body_image(); set_full_text(); set_audio_flag(); init_full_screen(); }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.edit_key); mActionBar = getSupportActionBar(); mActionBar.setDisplayShowTitleEnabled(true); // set actionbar without home button if called from another app if (getCallingPackage() != null && getCallingPackage().equals(Constants.PACKAGE_NAME)) { mActionBar.setDisplayHomeAsUpEnabled(true); mActionBar.setHomeButtonEnabled(true); } else { mActionBar.setDisplayHomeAsUpEnabled(false); mActionBar.setHomeButtonEnabled(false); } // find views mChangePassPhrase = (Button) findViewById(R.id.edit_key_btn_change_pass_phrase); mNoPassphrase = (CheckBox) findViewById(R.id.edit_key_no_passphrase); mUserIds = new Vector<String>(); mKeys = new Vector<PGPSecretKey>(); mKeysUsages = new Vector<Integer>(); // Catch Intents opened from other apps mIntent = getIntent(); // Handle intents Bundle extras = mIntent.getExtras(); if (ACTION_CREATE_KEY.equals(mIntent.getAction())) { mActionBar.setTitle(R.string.title_createKey); mCurrentPassPhrase = ""; if (extras != null) { // if userId is given, prefill the fields if (extras.containsKey(EXTRA_USER_IDS)) { Log.d(Constants.TAG, "UserIds are given!"); mUserIds.add(extras.getString(EXTRA_USER_IDS)); } // if no passphrase is given if (extras.containsKey(EXTRA_NO_PASSPHRASE)) { boolean noPassphrase = extras.getBoolean(EXTRA_NO_PASSPHRASE); if (noPassphrase) { // check "no passphrase" checkbox and remove button mNoPassphrase.setChecked(true); mChangePassPhrase.setVisibility(View.GONE); } } // generate key if (extras.containsKey(EXTRA_GENERATE_DEFAULT_KEYS)) { boolean generateDefaultKeys = extras.getBoolean(EXTRA_GENERATE_DEFAULT_KEYS); if (generateDefaultKeys) { // build layout in handler after generating keys not directly in onCreate mBuildLayout = false; // Send all information needed to service generate keys in other thread Intent intent = new Intent(this, ApgService.class); intent.putExtra(ApgService.EXTRA_ACTION, ApgService.ACTION_GENERATE_DEFAULT_RSA_KEYS); // fill values for this action Bundle data = new Bundle(); data.putString(ApgService.SYMMETRIC_PASSPHRASE, mCurrentPassPhrase); intent.putExtra(ApgService.EXTRA_DATA, data); // show progress dialog mGeneratingDialog = ProgressDialogFragment.newInstance( R.string.progress_generating, ProgressDialog.STYLE_SPINNER); // Message is received after generating is done in ApgService ApgHandler saveHandler = new ApgHandler(this, mGeneratingDialog) { public void handleMessage(Message message) { // handle messages by standard ApgHandler first super.handleMessage(message); if (message.arg1 == ApgHandler.MESSAGE_OKAY) { // get new key from data bundle returned from service Bundle data = message.getData(); PGPSecretKeyRing masterKeyRing = PGPConversionHelper.BytesToPGPSecretKeyRing( data.getByteArray(ApgService.RESULT_NEW_KEY)); PGPSecretKeyRing subKeyRing = PGPConversionHelper.BytesToPGPSecretKeyRing( data.getByteArray(ApgService.RESULT_NEW_KEY2)); // add master key Iterator<PGPSecretKey> masterIt = masterKeyRing.getSecretKeys(); mKeys.add(masterIt.next()); mKeysUsages.add(Id.choice.usage.sign_only); // add sub key Iterator<PGPSecretKey> subIt = subKeyRing.getSecretKeys(); subIt.next(); // masterkey mKeys.add(subIt.next()); mKeysUsages.add(Id.choice.usage.encrypt_only); buildLayout(); } }; }; // Create a new Messenger for the communication back Messenger messenger = new Messenger(saveHandler); intent.putExtra(ApgService.EXTRA_MESSENGER, messenger); mGeneratingDialog.show(getSupportFragmentManager(), "dialog"); // start service with intent startService(intent); } } } } else if (ACTION_EDIT_KEY.equals(mIntent.getAction())) { mActionBar.setTitle(R.string.title_editKey); mCurrentPassPhrase = PGPMain.getEditPassPhrase(); if (mCurrentPassPhrase == null) { mCurrentPassPhrase = ""; } if (mCurrentPassPhrase.equals("")) { // check "no passphrase" checkbox and remove button mNoPassphrase.setChecked(true); mChangePassPhrase.setVisibility(View.GONE); } if (extras != null) { if (extras.containsKey(EXTRA_KEY_ID)) { long keyId = mIntent.getExtras().getLong(EXTRA_KEY_ID); if (keyId != 0) { PGPSecretKey masterKey = null; mKeyRing = PGPMain.getSecretKeyRing(keyId); if (mKeyRing != null) { masterKey = PGPHelper.getMasterKey(mKeyRing); for (PGPSecretKey key : new IterableIterator<PGPSecretKey>(mKeyRing.getSecretKeys())) { mKeys.add(key); mKeysUsages.add(-1); // get usage when view is created } } if (masterKey != null) { for (String userId : new IterableIterator<String>(masterKey.getUserIDs())) { mUserIds.add(userId); } } } } } } mChangePassPhrase.setOnClickListener( new OnClickListener() { public void onClick(View v) { showDialog(Id.dialog.new_pass_phrase); } }); // disable passphrase when no passphrase checkobox is checked! mNoPassphrase.setOnCheckedChangeListener( new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if (isChecked) { // remove passphrase mNewPassPhrase = null; mChangePassPhrase.setVisibility(View.GONE); } else { mChangePassPhrase.setVisibility(View.VISIBLE); } } }); if (mBuildLayout) { buildLayout(); } }