@Override
  public void onCreate(Bundle savedInstanceState) {
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
      setTheme(R.style.Theme_Sherlock_Light);
    }

    super.onCreate(savedInstanceState);
    setContentView(R.layout.footer);

    viewPager = (ViewPager) findViewById(R.id.pager);
    viewPager.setOnPageChangeListener(onPageChangeListener);
    viewPager.setAdapter(new PagerAdapters(getSupportFragmentManager()));

    actionBar = getSupportActionBar();
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);

    actionBar.setDisplayShowTitleEnabled(true);

    Tab tab = actionBar.newTab().setText("Categories").setTabListener(new TabListnr());

    actionBar.addTab(tab);

    tab = actionBar.newTab().setText("My Posts").setTabListener(new TabListnr());

    actionBar.addTab(tab);
  }
  @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);
          }
        });
  }
Beispiel #3
0
 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) {

    requestWindowFeature(Window.FEATURE_PROGRESS);

    super.onCreate(savedInstanceState);

    setContentView(R.layout.webview);

    ActionBar ab = getSupportActionBar();
    ab.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
    ab.setDisplayShowTitleEnabled(true);
    ab.setDisplayHomeAsUpEnabled(true);

    mWebView = (WebView) findViewById(R.id.webView);
    mWebView.getSettings().setUserAgentString(Constants.USER_AGENT);
    mWebView.getSettings().setBuiltInZoomControls(true);
    mWebView.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);

    // load URL if one was provided in the intent
    String url = getIntent().getStringExtra("url");
    if (url != null) {
      loadUrl(url);
    }
  }
Beispiel #5
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    ThemeService.applyTheme(this);
    super.onCreate(savedInstanceState);
    setContentView(R.layout.tag_updates_activity);

    ActionBar actionBar = getSupportActionBar();
    actionBar.setDisplayHomeAsUpEnabled(true);
    actionBar.setDisplayShowTitleEnabled(false);

    actionBar.setDisplayShowCustomEnabled(true);
    actionBar.setCustomView(R.layout.header_title_view);
    ((TextView) actionBar.getCustomView().findViewById(R.id.title))
        .setText(R.string.TAd_contextEditTask);

    Fragment fragment;
    String tag;
    if (getIntent().getExtras().containsKey(TaskCommentsFragment.EXTRA_TASK)) {
      fragment = new TaskCommentsFragment();
      tag = "taskupdates_fragment"; // $NON-NLS-1$
    } else {
      fragment = new TagCommentsFragment();
      tag = "tagupdates_fragment"; // $NON-NLS-1$
    }

    FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
    transaction.add(R.id.comments_fragment_container, fragment, tag);
    transaction.commit();
  }
  // 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);
    setContentView(R.layout.about_screen);

    stylefont = Typeface.createFromAsset(getAssets(), AppConstants.fontStyle);
    actionBar = getSupportActionBar();
    actionBar.setDisplayHomeAsUpEnabled(true);
    actionBar.setDisplayShowTitleEnabled(true);
    actionBar.setTitle("About");

    fontActionBar(actionBar.getTitle().toString());

    actionBar.setIcon(android.R.drawable.ic_menu_info_details);

    if (isNetworkAvailable()) {
      new GetAbout(this).execute();
    } else {
      Toast.makeText(this, "Please check your internet connection", Toast.LENGTH_SHORT).show();
    }
    about = (TextView) findViewById(R.id.about_text);
    developed = (TextView) findViewById(R.id.developed);
    developed.setTypeface(stylefont);
    about.setTypeface(stylefont);
  }
 public void initActionBar() {
   mActionBar = getSupportActionBar();
   mActionBar.setDisplayHomeAsUpEnabled(true);
   mActionBar.setDisplayShowTitleEnabled(true);
   mActionBar.setTitle(stockName);
   mActionBar.setSubtitle(stockCode);
 }
Beispiel #9
0
  @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);
  }
Beispiel #10
0
  @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();
  }
  /** Called when the activity is first created. */
  private void initActionBar(String titlebarText) {

    ActionBar mActionBar = getSupportActionBar();
    mActionBar.setDisplayShowHomeEnabled(false);
    mActionBar.setDisplayShowTitleEnabled(false);
    LayoutInflater mInflater = LayoutInflater.from(this);
    View mCustomView = mInflater.inflate(R.layout.custom_titlebar, null);
    TextView mTitleTextView = (TextView) mCustomView.findViewById(R.id.titlebarText);
    mTitleTextView.setText(
        ApplicationSettings.translationSettings.GetTranslation(
            "and_lbl_registerAccount", titlebarText));

    mActionBar.setCustomView(mCustomView);
    mActionBar.setDisplayShowCustomEnabled(true);

    HideKeyboard.setupUI(
        mCustomView.findViewById(R.id.custom_action_bar), UsersInformation.this); // set
    // view
    // to
    // hide
    // keyboard
    // on
    // its
    // touch
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    createMenuDrawer(R.layout.comments);

    ActionBar actionBar = getSupportActionBar();
    actionBar.setDisplayShowTitleEnabled(true);
    setTitle(getString(R.string.tab_comments));

    Bundle extras = getIntent().getExtras();
    if (extras != null) {
      fromNotification = extras.getBoolean("fromNotification");
      if (fromNotification) {
        try {
          WordPress.currentBlog = new Blog(extras.getInt("id"));
        } catch (Exception e) {
          Toast.makeText(this, getResources().getText(R.string.blog_not_found), Toast.LENGTH_SHORT)
              .show();
          finish();
        }
      }
    }

    FragmentManager fm = getSupportFragmentManager();
    fm.addOnBackStackChangedListener(mOnBackStackChangedListener);
    commentList = (CommentsListFragment) fm.findFragmentById(R.id.commentList);

    WordPress.currentComment = null;

    attemptToSelectComment();
    if (fromNotification) commentList.refreshComments(false, false, false);
  }
 private void setupActionBar() {
   ActionBar ab = getSupportActionBar();
   ab.setDisplayHomeAsUpEnabled(true);
   ab.setDisplayShowCustomEnabled(true);
   ab.setDisplayShowHomeEnabled(true);
   ab.setDisplayShowTitleEnabled(true);
   View v = getLayoutInflater().inflate(R.layout.actionbar_change_pwd, null);
   ab.setCustomView(v);
   btnConfirm = (ToggleButton) v.findViewById(R.id.btn_on_confirm);
   btnConfirm.setOnCheckedChangeListener(this);
 }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.show_info);

    final ActionBar actionBar = getSupportActionBar();
    actionBar.setTitle(getString(R.string.context_showinfo));
    actionBar.setDisplayShowTitleEnabled(true);
    actionBar.setDisplayHomeAsUpEnabled(true);

    fillData();
  }
  /**
   * Sets the activity that is enhanced with a tab bar
   *
   * <p>This method must be run on the UI thread!
   */
  public void setSherlock(ActionBarSherlock sherlock) {
    if (this.sherlock != null && this.sherlock != sherlock)
      throw new IllegalStateException("May only set ActionBarSherlock instance of tab bar once");

    this.sherlock = sherlock;

    final ActionBar actionBar = sherlock.getActionBar();

    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
    actionBar.setDisplayShowHomeEnabled(false);
    actionBar.setDisplayShowTitleEnabled(false);
  }
Beispiel #16
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    ActionBar actionBar = getSupportActionBar();
    actionBar.setDisplayShowTitleEnabled(true);

    User user = (User) getIntent().getSerializableExtra("user");
    setContentView(R.layout.main);
    getSupportActionBar().setTitle(user.getScreenName() + "的微博");
    FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
    fragmentTransaction.replace(R.id.mainframe, new WeiboListFragment(user.getId()));
    fragmentTransaction.commit();
  }
 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);
 }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Log.d(TAG, "onCreate");

    requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
    setSupportProgressBarIndeterminateVisibility(false);
    getSupportActionBar().setDisplayShowTitleEnabled(false);
    setContentView(R.layout.activity_multipane);

    // FragmentManager.enableDebugLogging(true);

    if (savedInstanceState != null) executeState(savedInstanceState);
    else executeDefaultInstanceState();

    ActionBar actionBar = getSupportActionBar();
    actionBar.setDisplayShowTitleEnabled(false);
    createSearchModeCustomView(actionBar);

    mResizeButton.setOnClickListener(this);

    FragmentManager fm = getSupportFragmentManager();
    FragmentTransaction t = fm.beginTransaction();

    mWorkerFragment = (CombinedWorkerFragment) fm.findFragmentByTag(CombinedWorkerFragment.TAG);
    if (mWorkerFragment == null) {
      mWorkerFragment = new CombinedWorkerFragment();
      t.add(mWorkerFragment, CombinedWorkerFragment.TAG);
    }

    mListFragment = (POIsListFragment) fm.findFragmentById(R.id.list_layout);
    if (mListFragment == null) {
      mListFragment = POIsListFragment.newInstance(false, true);
      t.add(R.id.list_layout, mListFragment, POIsListFragment.TAG);
    }

    mMapFragment = (POIsMapsforgeFragment) fm.findFragmentById(R.id.map_layout);
    if (mMapFragment == null) {
      mMapFragment = POIsMapsforgeFragment.newInstance(false, true);
      t.add(R.id.map_layout, mMapFragment, POIsMapsforgeFragment.TAG);
    }

    mDetailFragment = (POIDetailFragment) fm.findFragmentById(R.id.detail_layout);
    if (mDetailFragment == null) {
      mDetailFragment = POIDetailFragment.newInstance();
      t.add(R.id.detail_layout, mDetailFragment);
    }

    t.commit();
  }
  private void initActionBar(String titlebarText) {

    ActionBar mActionBar = getSupportActionBar();
    mActionBar.setDisplayShowHomeEnabled(false);
    mActionBar.setDisplayShowTitleEnabled(false);
    LayoutInflater mInflater = LayoutInflater.from(this);
    View mCustomView = mInflater.inflate(R.layout.custom_titlebar, null);
    TextView mTitleTextView = (TextView) mCustomView.findViewById(R.id.titlebarText);
    mTitleTextView.setText(
        ApplicationSettings.translationSettings.GetTranslation(
            "and_lbl_recoverPassword", titlebarText));
    mActionBar.setCustomView(mCustomView);
    mActionBar.setDisplayShowCustomEnabled(true);

    HideKeyboard.setupUI(mCustomView, ForgetPassword.this);
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    if (savedInstanceState != null) {
      mCount = savedInstanceState.getInt(STATE_COUNT);
      mSortName = savedInstanceState.getString(STATE_SORT_NAME);
    }

    final ActionBar actionBar = getSupportActionBar();
    actionBar.setDisplayShowTitleEnabled(false);
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
    ArrayAdapter<CharSequence> mSpinnerAdapter =
        ArrayAdapter.createFromResource(this, R.array.plays_filter, R.layout.sherlock_spinner_item);
    mSpinnerAdapter.setDropDownViewResource(R.layout.sherlock_spinner_dropdown_item);
    actionBar.setListNavigationCallbacks(mSpinnerAdapter, this);
  }
  @Override
  protected void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // Action bar Sherlock
    ActionBar actionBar = getSupportActionBar();
    actionBar.setDisplayHomeAsUpEnabled(true);
    actionBar.setDisplayShowTitleEnabled(false);
    actionBar.setTitle("Preferences");

    try {
      getClass().getMethod("getFragmentManager");
      AddResourceApi11AndGreater();
    } catch (NoSuchMethodException e) { // Api < 11
      AddResourceApiLessThan11();
    }
  }
  private void prepareActionBar() {
    ActionBar actionBar = getSupportActionBar();
    actionBar.setDisplayHomeAsUpEnabled(true);
    actionBar.setDisplayShowTitleEnabled(false);

    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
    mSpinnerAdapter =
        new ArrayAdapter<CharSequence>(
            this, android.R.layout.simple_spinner_dropdown_item, locations);
    actionBar.setListNavigationCallbacks(
        mSpinnerAdapter,
        new ActionBar.OnNavigationListener() {
          @Override
          public boolean onNavigationItemSelected(int itemPosition, long itemId) {
            return true;
          }
        });
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.movies_activity);

    final ActionBar actionBar = getSupportActionBar();
    actionBar.setDisplayShowTitleEnabled(false);
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
    ArrayAdapter<CharSequence> mActionBarList =
        ArrayAdapter.createFromResource(this, R.array.movie_lists, R.layout.sherlock_spinner_item);
    mActionBarList.setDropDownViewResource(R.layout.sherlock_spinner_dropdown_item);
    actionBar.setListNavigationCallbacks(mActionBarList, this);

    // try to restore previously set nav item
    final SharedPreferences prefs =
        PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
    final int navItem = prefs.getInt(AppPreferences.KEY_NAVSELECTION, 0);
    actionBar.setSelectedNavigationItem(navItem);
  }
  @Override
  public void onCreate(Bundle state) {
    super.onCreate(state);
    setContentView(R.layout.search);

    mImageCache = new ImageCache();

    final ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
      actionBar.setDisplayShowTitleEnabled(true);
    }

    mQuery = getIntent().getStringExtra(SearchManager.QUERY);
    if (mQuery != null) {
      new SearchTask().execute((Void) null);

      setTitle(mQuery);
    }
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.create_layout);
    // ActionBar gets initiated
    actionBar = getSupportActionBar();
    actionBar = getSupportActionBar();
    actionBar.setDisplayShowHomeEnabled(true);
    actionBar.setDisplayShowTitleEnabled(true);
    actionBar.setTitle("Compose");
    myDataBase = new TaskDataBaseSQL(this);

    drawer = new SlidingMenu(this);
    drawer.setMode(SlidingMenu.LEFT);
    drawer.setShadowDrawable(R.drawable.shadow);
    drawer.setShadowWidthRes(R.dimen.shadow_width);
    drawer.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
    drawer.setFadeDegree(0.35f);
    drawer.setBehindOffsetRes(R.dimen.slidingmenu_offset);
    drawer.attachToActivity(this, SlidingMenu.SLIDING_CONTENT);
    drawer.offsetTopAndBottom(25);
    drawer.setMenu(R.layout.alarmslidingmenu);
    drawer.setSlidingEnabled(false);
    positionOftaskToEdit = -1;
    initilizeViewVariables();
    coder = new Geocoder(this);
    myGPSManager = new TaskGPSManager(this);
    myalarmmanager = new MyAlarmManager(this);
    timepicker.setCurrentHour(myalarmmanager.getHourOfDay());

    if (getIntent().hasExtra("ob")) {
      positionOftaskToEdit = getIntent().getIntExtra("ob", 0);
      taskBeforeEdit = TaskList.getTasksList().get(positionOftaskToEdit);
      initilizeViewForExistingTask();
      actionBar.setTitle("Edit");
      Log.d(getClass().getSimpleName(), "Editing A Task" + "id: " + taskBeforeEdit.getTaskId());
    } else {
      initilizeForNewTask();
      Log.d(getClass().getSimpleName(), "Creating New Task");
    }
  }
Beispiel #26
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    if (getSupportFragmentManager().findFragmentById(android.R.id.content) != null) {
      FragmentManager fragMgr = getSupportFragmentManager();
      FragmentTransaction ft = fragMgr.beginTransaction();
      ft.detach(getSupportFragmentManager().findFragmentById(android.R.id.content));
      ft.commit();
    }

    tracker = GoogleAnalyticsTracker.getInstance();

    // Start the tracker in manual dispatch mode...
    tracker.startNewSession(Keys.ANALYTICS_KEY, this);
    // setup action bar for tabs
    ActionBar actionBar = getSupportActionBar();
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
    actionBar.setDisplayShowTitleEnabled(true);
    actionBar.setDisplayHomeAsUpEnabled(true);

    Tab friendsTab =
        actionBar
            .newTab()
            .setText(R.string.friends_tabtitle)
            .setTabListener(
                new TabListenerList<FriendListFragment>(this, "friends", FriendListFragment.class));
    actionBar.addTab(friendsTab, true);

    Tab groupsTab =
        actionBar
            .newTab()
            .setText(R.string.groups_tabtitle)
            .setTabListener(
                new TabListenerList<GroupListFragment>(this, "groups", GroupListFragment.class));
    actionBar.addTab(groupsTab, true);

    actionBar.setSelectedNavigationItem(0);
  }
  private void setupActionBar() {
    ActionBar actionBar = getActionBar();
    if (actionBar == null) return;

    actionBar.setDisplayShowTitleEnabled(false);
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);

    ActionBar.OnNavigationListener navigationListener =
        new ActionBar.OnNavigationListener() {
          @Override
          public boolean onNavigationItemSelected(int itemPosition, long itemId) {
            ReaderTag tag = (ReaderTag) getActionBarAdapter().getItem(itemPosition);
            if (tag != null) {
              setCurrentTag(tag.getTagName());
              AppLog.d(T.READER, "tag chosen from actionbar: " + tag.getTagName());
            }
            return true;
          }
        };

    actionBar.setListNavigationCallbacks(getActionBarAdapter(), navigationListener);
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    ActionBar bar = getSupportActionBar();
    bar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
    bar.setDisplayShowHomeEnabled(false);
    bar.setDisplayShowTitleEnabled(false);

    String state = Environment.getExternalStorageState();
    if (!(Environment.MEDIA_MOUNTED.equals(state)
        || Environment.MEDIA_MOUNTED_READ_ONLY.equals(state))) {
      setResult(-1);
      finish();
    }

    setContentView(R.layout.directory);

    list = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, android.R.id.text1);
    filter = (FileFilter) getIntent().getExtras().getParcelable("filter");
    setupUI();
    setDirView();
  }
Beispiel #29
0
  @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();
    }
  }
Beispiel #30
0
  @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();
  }