Ejemplo n.º 1
0
  public void onToggleTabs(View v) {
    final ActionBar bar = getActionBar();

    if (bar.getNavigationMode() == ActionBar.NAVIGATION_MODE_TABS) {
      bar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
      bar.setDisplayOptions(ActionBar.DISPLAY_SHOW_TITLE, ActionBar.DISPLAY_SHOW_TITLE);
    } else {
      bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
      bar.setDisplayOptions(0, ActionBar.DISPLAY_SHOW_TITLE);
    }
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    addPreferencesFromResource(R.xml.settings_special_list);
    Bundle b = getArguments();
    if (b != null) {
      Log.d(TAG, "id= " + getArguments().getInt("id"));
      final SpecialList specialList = SpecialList.getSpecialList(getArguments().getInt("id") * -1);
      ((SpecialListsSettingsActivity) getActivity()).setSpecialList(specialList);

      ActionBar actionbar = getActivity().getActionBar();
      if (specialList == null) actionbar.setTitle("No list");
      else actionbar.setTitle(specialList.getName());
      if (!MirakelCommonPreferences.isTablet()) {
        ImageButton delList = new ImageButton(getActivity());
        delList.setBackgroundResource(android.R.drawable.ic_menu_delete);
        actionbar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM, ActionBar.DISPLAY_SHOW_CUSTOM);
        actionbar.setCustomView(
            delList,
            new ActionBar.LayoutParams(
                LayoutParams.WRAP_CONTENT,
                LayoutParams.WRAP_CONTENT,
                Gravity.CENTER_VERTICAL | DefinitionsHelper.GRAVITY_RIGHT));
        delList.setOnClickListener(((ListSettings) getActivity()).getDelOnClickListener());
      }
      try {
        new SpecialListSettings(this, specialList).setup();
      } catch (NoSuchListException e) {
        getActivity().finish();
      }
    } else {
      Log.d(TAG, "bundle null");
    }
  }
Ejemplo n.º 3
0
  @Override
  public void setDisplayOptions(int options) {
    mActionBar.setDisplayOptions(options);

    // Fixes issue #746
    mActionBar.setHomeButtonEnabled((options & DISPLAY_HOME_AS_UP) != 0);
  }
Ejemplo n.º 4
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    overridePendingTransition(R.anim.fadein, R.anim.fadeout);

    // ....................................
    // Load state of filter from Bundle
    if (savedInstanceState != null) {
      mSeriesFilter = savedInstanceState.getString("mSeriesFilter");
      mFilterMode = savedInstanceState.getInt("mFilterMode");
      if (mSeriesFilter == null) mSeriesFilter = ""; // if no filter found
    } else {
      // if no state, load in default pref.
      SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
      String tmp = prefs.getString("libraryFilter", "0");
      this.mFilterMode = Integer.parseInt(tmp);
    } // if

    // ....................................
    mThumbPath =
        Environment.getExternalStorageDirectory().getAbsolutePath() + "/OpenComicReader/thumbs/";
    mSpinAdapter =
        new ArrayAdapter<String>(
            this,
            android.R.layout.simple_spinner_dropdown_item,
            this.getResources().getStringArray(R.array.libraryFilter));

    // ....................................
    // Setup Actionbar
    ActionBar mActionBar = this.getActionBar();
    mActionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
    mActionBar.setDisplayShowTitleEnabled(false);
    mActionBar.setListNavigationCallbacks(mSpinAdapter, this);
    mActionBar.setSelectedNavigationItem(mFilterMode);
    mActionBar.setDisplayOptions(
        ActionBar.DISPLAY_SHOW_CUSTOM | ActionBar.DISPLAY_USE_LOGO | ActionBar.DISPLAY_SHOW_HOME);
    mActionBar.setCustomView(R.layout.activity_main_actionbar);
    mCountLbl = (TextView) mActionBar.getCustomView().findViewById(R.id.lblCount);
    mSeriesLbl = (TextView) mActionBar.getCustomView().findViewById(R.id.lblSeries);

    // ....................................
    // Setup Main View Area
    mAdapter = new SqlCursorAdapter(this);
    mAdapter.setItemLayout(R.layout.listitem_main);

    mGridView = (GridView) findViewById(R.id.lvMain);
    mGridView.setAdapter(mAdapter);
    mGridView.setOnItemClickListener(this);

    registerForContextMenu(mGridView); // Route event from Activity to View

    // ....................................
    // Start DB and Data Loader
    mDb = new Sqlite(this);
    mDb.openRead();

    getSupportLoaderManager().initLoader(0, null, this);
  } // func
 @Override
 protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.activity_main);
   ActionBar actionBar = getActionBar();
   actionBar.setDisplayOptions(
       ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_SHOW_CUSTOM);
 }
 /** Removes the back button from being shown */
 public void removeBackButton() {
   if (mActionBar == null) {
     return;
   }
   // Remove the back button but continue showing an icon.
   final int mask = ActionBar.DISPLAY_HOME_AS_UP | ActionBar.DISPLAY_SHOW_HOME;
   mActionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_HOME, mask);
   mActivity.getActionBar().setHomeButtonEnabled(false);
 }
Ejemplo n.º 7
0
  protected void onCreate(Bundle savedInstanceState, int layoutResID) {
    super.onCreate(savedInstanceState);
    setContentView(layoutResID);

    AppUtils.initTrineaInfo(this, trineaInfoTv, getClass());

    ActionBar bar = getActionBar();
    bar.setDisplayOptions(ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_HOME_AS_UP);
  }
 public void setBackButton() {
   if (mActionBar == null) {
     return;
   }
   // Show home as up, and show an icon.
   final int mask = ActionBar.DISPLAY_HOME_AS_UP | ActionBar.DISPLAY_SHOW_HOME;
   mActionBar.setDisplayOptions(mask, mask);
   mActivity.getActionBar().setHomeButtonEnabled(true);
 }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    mContext = getApplicationContext();
    super.onCreate(savedInstanceState);

    requestWindowFeature(Window.FEATURE_ACTION_BAR);
    requestWindowFeature(Window.FEATURE_ACTION_BAR_OVERLAY);

    ActionBar actionBar = getActionBar();
    int displayOptions = ActionBar.DISPLAY_SHOW_HOME;
    actionBar.setDisplayOptions(0, displayOptions);
    displayOptions = ActionBar.DISPLAY_SHOW_CUSTOM;
    actionBar.setDisplayOptions(displayOptions, displayOptions);
    actionBar.setCustomView(R.layout.trim_menu);

    mSaveVideoTextView = (TextView) findViewById(R.id.start_trim);
    mSaveVideoTextView.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View arg0) {
            trimVideo();
          }
        });
    mSaveVideoTextView.setEnabled(false);

    Intent intent = getIntent();
    mUri = intent.getData();
    mSrcVideoPath = intent.getStringExtra(PhotoPage.KEY_MEDIA_ITEM_PATH);
    setContentView(R.layout.trim_view);
    View rootView = findViewById(R.id.trim_view_root);

    mVideoView = (VideoView) rootView.findViewById(R.id.surface_view);

    mController = new TrimControllerOverlay(mContext);
    ((ViewGroup) rootView).addView(mController.getView());
    mController.setListener(this);
    mController.setCanReplay(true);

    mVideoView.setOnErrorListener(this);
    mVideoView.setOnCompletionListener(this);
    mVideoView.setVideoURI(mUri);

    playVideo();
  }
  public void setDisplayOptions(boolean displayHomeAsUp, boolean showTitle) {
    if (mActionBar == null) return;
    int options = 0;
    if (displayHomeAsUp) options |= ActionBar.DISPLAY_HOME_AS_UP;
    if (showTitle) options |= ActionBar.DISPLAY_SHOW_TITLE;

    mActionBar.setDisplayOptions(
        options, ActionBar.DISPLAY_HOME_AS_UP | ActionBar.DISPLAY_SHOW_TITLE);
    mActionBar.setHomeButtonEnabled(displayHomeAsUp);
  }
 private void setupActionBar() {
   ActionBar actionBar = getActionBar();
   if (actionBar != null) {
     actionBar.setDisplayOptions(
         ActionBar.DISPLAY_HOME_AS_UP
             | ActionBar.DISPLAY_SHOW_TITLE
             | ActionBar.DISPLAY_SHOW_CUSTOM,
         ActionBar.DISPLAY_HOME_AS_UP
             | ActionBar.DISPLAY_SHOW_TITLE
             | ActionBar.DISPLAY_SHOW_CUSTOM);
     actionBar.setTitle("");
     actionBar.setCustomView(R.layout.conversation_list_multi_actionbar);
     mActionButton = (Button) findViewById(R.id.multi_action_done);
     if (mManageMode == MessageUtils.FORWARD_MODE) {
       mActionButton.setText(R.string.menu_forward);
     } else if (mManageMode == MessageUtils.SIM_MESSAGE_MODE) {
       mActionButton.setText(R.string.done_delete);
     } else if (mManageMode == MessageUtils.BATCH_DELETE_MODE) {
       mActionButton.setText(R.string.menu_batch_delete);
     }
     mActionButton.setEnabled(false);
     mActionButton.setOnClickListener(
         new View.OnClickListener() {
           @Override
           public void onClick(View v) {
             confirmMultiAction();
           }
         });
     Button mSelectionMenuButton = (Button) findViewById(R.id.select_menu);
     mSelectionMenu =
         new SelectionMenu(
             this,
             mSelectionMenuButton,
             new PopupList.OnPopupItemClickListener() {
               @Override
               public boolean onPopupItemClick(int itemId) {
                 if (itemId == SelectionMenu.SELECT_OR_DESELECT) {
                   if (mHasSelectAll) {
                     clearSelect();
                     mHasSelectAll = false;
                   } else {
                     allSelect();
                     mHasSelectAll = true;
                   }
                   mSelectionMenu.updateSelectAllMode(mHasSelectAll);
                 }
                 return true;
               }
             });
     mSelectionMenu.setTitle(getString(R.string.selected_count, 0));
   }
 }
Ejemplo n.º 12
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    // Initilization
    setContentView(R.layout.activity_charts);
    viewPager = (ViewPager) findViewById(R.id.pager);
    actionBar = getActionBar();
    mAdapter = new TabsPagerAdapter(getSupportFragmentManager(), this);
    viewPager.setAdapter(mAdapter);
    viewPager.setOffscreenPageLimit(2);
    actionBar.setHomeButtonEnabled(false);
    actionBar.setDisplayShowHomeEnabled(false);
    actionBar.setDisplayShowTitleEnabled(true);
    actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM | ActionBar.DISPLAY_SHOW_HOME);
    Bundle bundle;
    bundle = getIntent().getExtras();
    tabs = bundle.getStringArrayList("tabs");
    Intent intent = new Intent(this, TabsPagerAdapter.class);
    intent.putExtras(bundle);
    try {
      ViewConfiguration config = ViewConfiguration.get(this);
      Field menuKeyField = ViewConfiguration.class.getDeclaredField("sHasPermanentMenuKey");
      if (menuKeyField != null) {
        menuKeyField.setAccessible(true);
        menuKeyField.setBoolean(config, false);
      }
    } catch (Exception ex) {
      // Ignore
    }

    viewPager.setOnPageChangeListener(
        new ViewPager.OnPageChangeListener() {

          @Override
          public void onPageSelected(int position) {
            // on changing the page
            // make respected tab selected
            // actionBar.setSelectedNavigationItem(position);
          }

          @Override
          public void onPageScrolled(int arg0, float arg1, int arg2) {}

          @Override
          public void onPageScrollStateChanged(int arg0) {}
        });
    /*Intent recintent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
    intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
    intent.putExtra(RecognizerIntent.EXTRA_PROMPT, "AndroidBite Voice Recognition...");
    startActivityForResult(recintent, 100);*/
  }
Ejemplo n.º 13
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    //		this.requestWindowFeature(Window.FEATURE_NO_TITLE);

    // set action bar stuff
    ActionBar ab = getActionBar();
    ab.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
    ab.setCustomView(R.layout.actionbar);

    // receive info
    Intent intent = getIntent();
    String fromAddress = intent.getStringExtra(SafewalkApplication.EXTRA_FROM);
    String toAddress = intent.getStringExtra(SafewalkApplication.EXTRA_TO);

    setContentView(R.layout.safewalk_map);

    // init javascript interface class
    mapJS = new MapJS(getApplication().getApplicationContext());
    mapJS.setFromAddress(fromAddress);
    mapJS.setToAddress(toAddress);

    // link android elements
    wv = (WebView) findViewById(R.id.wv_map);
    wv.getSettings().setJavaScriptEnabled(true);
    wv.setWebChromeClient(new WebChromeClient());
    wv.addJavascriptInterface(mapJS, "Safewalk");
    wv.getSettings().setRenderPriority(RenderPriority.HIGH);
    wv.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
    wv.getSettings().setAllowFileAccess(true);
    wv.setBackgroundColor(
        0x00000000); // must set background to zero for background to show through.
    wv.setLayerType(
        View.LAYER_TYPE_SOFTWARE, null); // solves a flickering issue of webview content.
    wv.loadUrl("file:///android_asset/index.html");

    this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);

    // get relative layout
    llRoutes = (LinearLayout) findViewById(R.id.ll_routes);

    //		TextView testFrom = (TextView) findViewById(R.id.test_from);
    //		TextView testTo = (TextView) findViewById(R.id.test_to);

    //		testFrom.setText(fromAddress);
    //		testTo.setText(toAddress);

  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.detailed_info);

    telephone = "10086";

    dpview = (TextView) findViewById(R.id.Description);
    dpview.setText("������ʾ��Ҫ��Ϣ...");

    call = (Button) findViewById(R.id.Call);
    join = (Button) findViewById(R.id.Join);
    // return_back = (TextView) findViewById(R.id.Return);
    open_close = (TextView) findViewById(R.id.OpenOrClose);
    open_close.setText("�鿴���� ��");

    call.setOnClickListener(this);
    join.setOnClickListener(this);
    // return_back.setOnClickListener(this);
    open_close.setOnClickListener(this);
    // �Զ���ActionBar
    final ActionBar actionBar = getActionBar();
    actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
    actionBar.setCustomView(R.layout.actionbar_detail_info); // �Զ���ActionBar����

    // ָ��״̬����ɫ
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
      setTranslucentStatus(true);
    }
    SystemBarTintManager tintManager = new SystemBarTintManager(this);
    tintManager.setStatusBarTintEnabled(true);
    tintManager.setStatusBarTintResource(R.color.blueviolet);
    mTVBack = (Button) findViewById(R.id.detailInfo_backBtn);
    mTVBack.setOnClickListener(this);

    itemList = new ArrayList<ParticipatorItem>();
    itemList.add(new ParticipatorItem(R.drawable.ghost, "����", "�����ܼ򵥣�"));
    itemList.add(new ParticipatorItem(R.drawable.ghost, "����", "�����ܼ򵥣�"));
    itemList.add(new ParticipatorItem(R.drawable.ghost, "����", "�����ܼ򵥣�"));
    itemList.add(new ParticipatorItem(R.drawable.ghost, "����", "�����ܼ򵥣�"));
    itemList.add(new ParticipatorItem(R.drawable.ghost, "����", "�����ܼ򵥣�"));
    adapter = new Adapter(this, R.layout.participator_item, itemList);

    lv = (ListView) findViewById(R.id.participatorListView);
    lv.setAdapter(adapter);
    lv.setOnItemClickListener(this);
  }
  @Override
  protected void handleResult(String jsonStr) {
    if (this.actioncode == 17) {
      try {
        JSONObject json = new JSONObject(jsonStr);
        if (json != null) {
          JSONArray jsonarray = json.getJSONArray("housebuilddata");
          for (int i = 0; i < jsonarray.length(); i++) {
            JSONObject rec = jsonarray.getJSONObject(i);
            JSONArray jarrayname = rec.getJSONArray("basebuildingflag");
            for (int j = 0; j < jarrayname.length(); j++) {
              aryBasicBuildingFlag[j] = jarrayname.getString(j).toString();
            }
            JSONArray jarrayname2 = rec.getJSONArray("militarybuildingflag");
            for (int y = 0; y < jarrayname2.length(); y++) {
              aryMilitaryBuildingFlag[y] = jarrayname2.getString(y).toString();
            }
          }
        }
      } catch (JSONException e) {
        for (int i = 0; i < 4; i++) {
          aryBasicBuildingFlag[i] = "0";
        }
        for (int i = 0; i < 8; i++) {
          aryMilitaryBuildingFlag[i] = "0";
        }
      }
      release();

      final ActionBar actionBar = getActionBar();
      actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
      actionBar.setDisplayOptions(0, ActionBar.DISPLAY_SHOW_TITLE);

      actionBar.addTab(
          actionBar
              .newTab()
              .setText("基本建筑")
              .setTabListener(new TabListener(new BaseInfoShowTabContentFragment())));

      actionBar.addTab(
          actionBar
              .newTab()
              .setText("军事建筑")
              .setTabListener(new TabListener(new MilitaryInfoShowTabContentFragment())));
    }
  }
Ejemplo n.º 16
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_map);

    ActionBar actionBar = getActionBar();
    if (actionBar != null) {
      actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
      View cView = getLayoutInflater().inflate(R.layout.main_bar, null);
      actionBar.setCustomView(cView);
    }

    MapFragment mapFragment = (MapFragment) getFragmentManager().findFragmentById(R.id.map);
    mapFragment.getMapAsync(this);

    centered = false;
  }
Ejemplo n.º 17
0
  @AfterViews
  void loadLayout() {
    // Prepare for failure
    setResult(RESULT_CANCELED, new Intent());
    // Inflate a "Done/Discard" custom action bar view.
    LayoutInflater inflater =
        (LayoutInflater)
            getActionBar().getThemedContext().getSystemService(LAYOUT_INFLATER_SERVICE);
    final View customActionBarView =
        inflater.inflate(R.layout.actionbar_custom_view_done_discard, null);
    customActionBarView
        .findViewById(R.id.actionbar_done)
        .setOnClickListener(
            new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                // "Done"
                final Intent returnIntent = new Intent();
                returnIntent.putExtra(RESULT_TEXT_KEY, taskText.getText().toString());
                setResult(RESULT_OK, returnIntent);
                finish();
              }
            });
    customActionBarView
        .findViewById(R.id.actionbar_discard)
        .setOnClickListener(
            new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                // "Cancel result already set"
                finish();
              }
            });

    // Show the custom action bar view and hide the normal Home icon and
    // title.
    final ActionBar actionBar = getActionBar();
    actionBar.setDisplayOptions(
        ActionBar.DISPLAY_SHOW_CUSTOM,
        ActionBar.DISPLAY_SHOW_CUSTOM | ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_SHOW_TITLE);
    actionBar.setCustomView(
        customActionBarView,
        new ActionBar.LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
  }
  private void initUI() {
    mFileSettingsHelper = FileSettingsHelper.getInstance(this);
    FileOperationHelper fileOperationHelper = FileOperationHelper.getInstance(this);
    mFileSDCardHelper =
        FileSDCardHelper.getInstance(this, mFileSettingsHelper, fileOperationHelper);
    mViewPager = (ViewPager) findViewById(R.id.sdcard_viewPager);
    mViewPager.setOffscreenPageLimit(3);

    IntentFilter filter = new IntentFilter();
    filter.addAction(ACTION_LOCALE_CHANGED);
    // registerReceiver(mReceiver, filter);

    ActionBar actionBar = getActionBar();
    actionBar.setDisplayShowTitleEnabled(false);
    actionBar.setDisplayShowHomeEnabled(false);
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
    actionBar.setDisplayOptions(0, ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_SHOW_HOME);

    mFileSDCardPageAdapter = new FileSDCardPageAdapter(this, mViewPager);
    mFileSDCardPageAdapter.addTab(
        actionBar.newTab().setText(R.string.menu_sdcard_info), FileSDCardInfoFragment.class, null);
    mViewPager.setCurrentItem(0);

    ArrayList<SDCardInfo> roots = mFileSDCardHelper.getAllRoot(); // SD鍗′俊鎭�
    Bundle _args = null;
    for (int i = 0; i < roots.size(); i++) {
      SDCardInfo info = roots.get(i);
      _args = new Bundle();
      _args.putInt(KEY_SDTYPE, info.type);
      mFileSDCardPageAdapter.addTab(
          // Add SDCard tab
          actionBar
              .newTab()
              .setText(
                  info.type == SDCardInfo.INTERNAL_SD
                      ? R.string.title_internal_sdcard
                      : R.string.title_external_sdcard),
          FileSDCardFragment2.class,
          _args);
    }

    Button clearGarbage = (Button) findViewById(R.id.clear_garbage);
    clearGarbage.setOnClickListener(this);
  }
Ejemplo n.º 19
0
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    // TODO Auto-generated method stub
    switch (item.getItemId()) {
      case R.id.enterAmount:
        if (bar.getCustomView() != null) break;
        bar.setCustomView(R.layout.action_bar);
        bar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM | ActionBar.DISPLAY_SHOW_HOME);

        final EditText money = (EditText) bar.getCustomView().findViewById(R.id.moneyEditText);
        final Button go = (Button) bar.getCustomView().findViewById(R.id.goButton);

        go.setOnClickListener(
            new OnClickListener() {

              @Override
              public void onClick(View arg0) {
                // TODO Auto-generated method stub

                hideKeyboard();

                double price = 0;

                try {
                  price = Double.parseDouble(money.getText().toString());
                } catch (NumberFormatException e) {
                  Toast.makeText(getApplicationContext(), "Invalid number", Toast.LENGTH_SHORT)
                      .show();
                  return;
                }

                ll.setVisibility(View.VISIBLE);
                ll2.setVisibility(View.INVISIBLE);
                startService(
                    new Intent(FoodList.this, FoodListService.class)
                        .putExtra(UtilClass._basePrice, price));

                bar.setCustomView(null);
              }
            });
        break;
    }
    return super.onOptionsItemSelected(item);
  }
Ejemplo n.º 20
0
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.fragment_pager);
    mViewPager = (ViewPager) findViewById(R.id.pager);

    final ActionBar bar = getActionBar();
    bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
    bar.setDisplayOptions(0, ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_SHOW_HOME);

    mTabsAdapter = new TabsAdapter(this, mViewPager);
    mTabsAdapter.addTab(bar.newTab().setText(R.string.tab_sd), FileViewActivity.class, null);
    mTabsAdapter.addTab(bar.newTab().setText(R.string.tab_ftp), WebViewActivity.class, null);
    mTabsAdapter.addTab(
        bar.newTab().setText(R.string.tab_remote), ServerControlActivity.class, null);
    if (savedInstanceState != null) {
      bar.setSelectedNavigationItem(savedInstanceState.getInt(INSTANCESTATE_TAB, 0));
    }
  }
Ejemplo n.º 21
0
  /**
   * @brief This is the onCreate method
   * @param savedInstanceState
   * @details The onCreate method adds two switches to control the remember exit, and the show of
   *     the cursor
   */
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.configuration);

    Switch checkBox = (Switch) findViewById(R.id.checkbox_remember);

    Switch checkBoxHide = (Switch) findViewById(R.id.checkbox_hidemouse);

    checkBox.setChecked((Configuration.getInstance()).isRememberExit());

    checkBoxHide.setChecked((Configuration.getInstance()).isHideMouse());

    // efectos del actionBar
    final ActionBar actionBar = getActionBar();

    actionBar.setDisplayOptions(
        ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_HOME_AS_UP);
  }
Ejemplo n.º 22
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_register);

    mPreferences = getSharedPreferences("CurrentUser", MODE_PRIVATE);

    addItemsOnSpinner();

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
      getActionBar().setDisplayHomeAsUpEnabled(true);
      ActionBar actionBar_register = getActionBar();
      // �׼ǹ� ����
      actionBar_register.setDisplayOptions(
          ActionBar.DISPLAY_SHOW_CUSTOM
              | ActionBar.NAVIGATION_MODE_STANDARD
              | ActionBar.DISPLAY_HOME_AS_UP
              | ActionBar.DISPLAY_SHOW_HOME);
    }
  }
  private void initActionBar() {
    mActionBar = this.getActionBar();
    if (mActionBar == null) {
      throw new RuntimeException("BrowserPagerActivity should have an ActionBar");
    }
    mActionBar.setDisplayOptions(
        ActionBar.DISPLAY_SHOW_HOME
            | ActionBar.DISPLAY_SHOW_CUSTOM
            | ActionBar.DISPLAY_USE_LOGO
            | ActionBar.DISPLAY_HOME_AS_UP);

    //noinspection InflateParams
    final View custom =
        LayoutInflater.from(this).inflate(R.layout.activity_browser_actionbar, null);
    if (custom == null) {
      throw new RuntimeException("Inflated View is null");
    }
    mActionBar.setCustomView(custom);

    mBreadCrumbView = (BreadCrumbTextView) custom.findViewById(R.id.bread_crumb_view);
  }
Ejemplo n.º 24
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // Intent service = new Intent(this, LocationService.class);
    // startService(service);
    this.viewPager = new ScrollableViewPager(this);
    this.viewPager.setId(R.id.viewPager);
    setContentView(viewPager);

    final ActionBar actionBar = getActionBar();
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
    actionBar.setDisplayOptions(0, ActionBar.DISPLAY_SHOW_TITLE);

    tabsAdapter = new TabsAdapter(this, viewPager);
    tabsAdapter.addTab(
        actionBar.newTab().setIcon(android.R.drawable.ic_menu_mapmode),
        FragmentMapView.class,
        null);
    tabsAdapter.addTab(
        actionBar.newTab().setIcon(android.R.drawable.ic_menu_sort_by_size),
        FragmentListView.class,
        null);
    tabsAdapter.addTab(
        actionBar.newTab().setIcon(android.R.drawable.ic_menu_gallery),
        FragmentImageGridView.class,
        null);

    if (savedInstanceState != null) {
      actionBar.setSelectedNavigationItem(savedInstanceState.getInt("tab", 0));
      if (savedInstanceState.getBoolean("isSearching")) {
        this.onSearchRequested();
      }
    }

    // TODO Removed for now until better implementation
    // this.startService(new Intent(this, LocationService.class));
  }
Ejemplo n.º 25
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    mViewPager = new ViewPager(this);
    mViewPager.setId(R.id.pager);
    setContentView(mViewPager);

    final ActionBar bar = getActionBar();
    bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
    bar.setDisplayOptions(0, ActionBar.DISPLAY_SHOW_TITLE);

    mTabsAdapter = new TabsAdapter(this, mViewPager);
    mTabsAdapter.addTab(bar.newTab().setText("Network State"), NetworkStateFragment.class, null);

    mTabsAdapter.addTab(bar.newTab().setText("Connection"), ConnectionWatcher.class, null);

    mTabsAdapter.addTab(bar.newTab().setText("Upload Trace"), TraceExchangeFragment.class, null);

    if (savedInstanceState != null) {
      bar.setSelectedNavigationItem(savedInstanceState.getInt("tab", 0));
    }
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.project_picker);

    // Show action bar title only on large screens.
    final ActionBar actionBar = getActionBar();
    final DisplayMetrics displayMetrics = new DisplayMetrics();
    getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
    final int widthDip = (int) (displayMetrics.widthPixels / displayMetrics.scaledDensity);
    // Only show title on large screens (width >= 1000 dip).
    if (widthDip >= SHOW_TITLE_THRESHOLD_WIDTH_DIP) {
      actionBar.setDisplayOptions(actionBar.getDisplayOptions() | ActionBar.DISPLAY_SHOW_TITLE);
      actionBar.setTitle(R.string.full_app_name);
    }

    mGridView = (GridView) findViewById(R.id.projects);
    mGridView.setOnItemClickListener(
        new AdapterView.OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            // If user clicks on the last item, then create a new project.
            if (position == mProjects.size()) {
              showDialog(DIALOG_NEW_PROJECT_ID);
            } else {
              openProject(mProjects.get(position).getPath());
            }
          }
        });
    // Upon long press, pop up a menu with a removal option.
    mGridView.setOnItemLongClickListener(
        new AdapterView.OnItemLongClickListener() {
          @Override
          public boolean onItemLongClick(
              AdapterView<?> parent, View view, final int position, long id) {
            // Open new project dialog when user clicks on the "create new project" card.
            if (position == mProjects.size()) {
              showDialog(DIALOG_NEW_PROJECT_ID);
              return true;
            }
            // Otherwise, pop up a menu with a project removal option.
            final PopupMenu popupMenu = new PopupMenu(ProjectsActivity.this, view);
            popupMenu.getMenuInflater().inflate(R.menu.project_menu, popupMenu.getMenu());
            popupMenu.setOnMenuItemClickListener(
                new PopupMenu.OnMenuItemClickListener() {
                  @Override
                  public boolean onMenuItemClick(MenuItem menuItem) {
                    switch (menuItem.getItemId()) {
                      case R.id.action_remove_project:
                        final Bundle bundle = new Bundle();
                        bundle.putString(PARAM_DIALOG_PATH_ID, mProjects.get(position).getPath());
                        showDialog(DIALOG_REMOVE_PROJECT_ID, bundle);
                        break;
                      default:
                        break;
                    }
                    return true;
                  }
                });
            popupMenu.show();
            return true;
          }
        });
  }
  @Override
  protected void onCreate(Bundle icicle) {
    super.onCreate(icicle);

    // Get the info needed for the fragment
    Intent intent = getIntent();
    int attendeeResponse = 0;
    mEventId = -1;
    boolean isDialog = false;
    ArrayList<ReminderEntry> reminders = null;

    if (icicle != null) {
      mEventId = icicle.getLong(EventInfoFragment.BUNDLE_KEY_EVENT_ID);
      mStartMillis = icicle.getLong(EventInfoFragment.BUNDLE_KEY_START_MILLIS);
      mEndMillis = icicle.getLong(EventInfoFragment.BUNDLE_KEY_END_MILLIS);
      attendeeResponse = icicle.getInt(EventInfoFragment.BUNDLE_KEY_ATTENDEE_RESPONSE);
      isDialog = icicle.getBoolean(EventInfoFragment.BUNDLE_KEY_IS_DIALOG);

      reminders = Utils.readRemindersFromBundle(icicle);
    } else if (intent != null && Intent.ACTION_VIEW.equals(intent.getAction())) {
      mStartMillis = intent.getLongExtra(EXTRA_EVENT_BEGIN_TIME, 0);
      mEndMillis = intent.getLongExtra(EXTRA_EVENT_END_TIME, 0);
      attendeeResponse = intent.getIntExtra(ATTENDEE_STATUS, Attendees.ATTENDEE_STATUS_NONE);
      Uri data = intent.getData();
      if (data != null) {
        try {
          List<String> pathSegments = data.getPathSegments();
          int size = pathSegments.size();
          if (size > 2 && "EventTime".equals(pathSegments.get(2))) {
            // Support non-standard VIEW intent format:
            // dat = content://com.android.calendar/events/[id]/EventTime/[start]/[end]
            mEventId = Long.parseLong(pathSegments.get(1));
            if (size > 4) {
              mStartMillis = Long.parseLong(pathSegments.get(3));
              mEndMillis = Long.parseLong(pathSegments.get(4));
            }
          } else {
            mEventId = Long.parseLong(data.getLastPathSegment());
          }
        } catch (NumberFormatException e) {
          if (mEventId == -1) {
            // do nothing here , deal with it later
          } else if (mStartMillis == 0 || mEndMillis == 0) {
            // Parsing failed on the start or end time , make sure the times were not
            // pulled from the intent's extras and reset them.
            mStartMillis = 0;
            mEndMillis = 0;
          }
        }
      }
    }

    if (mEventId == -1) {
      Log.w(TAG, "No event id");
      Toast.makeText(this, R.string.event_not_found, Toast.LENGTH_SHORT).show();
      finish();
    }

    // If we do not support showing full screen event info in this configuration,
    // close the activity and show the event in AllInOne.
    Resources res = getResources();
    if (!res.getBoolean(R.bool.agenda_show_event_info_full_screen)
        && !res.getBoolean(R.bool.show_event_info_full_screen)) {
      CalendarController.getInstance(this)
          .launchViewEvent(mEventId, mStartMillis, mEndMillis, attendeeResponse);
      finish();
      return;
    }

    setContentView(R.layout.simple_frame_layout);

    // Get the fragment if exists
    mInfoFragment = (EventInfoFragment) getFragmentManager().findFragmentById(R.id.main_frame);

    // Remove the application title
    ActionBar bar = getActionBar();
    if (bar != null) {
      bar.setDisplayOptions(ActionBar.DISPLAY_HOME_AS_UP | ActionBar.DISPLAY_SHOW_HOME);
    }

    // Create a new fragment if none exists
    if (mInfoFragment == null) {
      FragmentManager fragmentManager = getFragmentManager();
      FragmentTransaction ft = fragmentManager.beginTransaction();
      mInfoFragment =
          new EventInfoFragment(
              this,
              mEventId,
              mStartMillis,
              mEndMillis,
              attendeeResponse,
              isDialog,
              (isDialog
                  ? EventInfoFragment.DIALOG_WINDOW_STYLE
                  : EventInfoFragment.FULL_WINDOW_STYLE),
              reminders);
      ft.replace(R.id.main_frame, mInfoFragment);
      ft.commit();
    }
  }
Ejemplo n.º 28
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_main);

    ctx = this;
    prefs = PreferenceManager.getDefaultSharedPreferences(ctx);

    adaptiveFragment = getFragmentManager().findFragmentById(R.id.frag_adaptive);
    gaugesFragment = getFragmentManager().findFragmentById(R.id.frag_gauges);
    fuelFragment = getFragmentManager().findFragmentById(R.id.frag_fuel);

    ActionBar bar = getActionBar();

    bar.addTab(bar.newTab().setText(R.string.tab_adaptive).setTabListener(this), false);
    bar.addTab(bar.newTab().setText(R.string.tab_gauges).setTabListener(this), false);
    bar.addTab(bar.newTab().setText("Fuel Map").setTabListener(this), false);

    mActionBarView = getLayoutInflater().inflate(R.layout.action_bar_custom, null);

    bar.setCustomView(mActionBarView);
    bar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM | ActionBar.DISPLAY_USE_LOGO);
    bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
    bar.setDisplayShowHomeEnabled(true);

    txtData = (TextView) findViewById(R.id.txtData);
    lvDevices = (ListView) findViewById(R.id.lvDevices);
    layoutDevices = (RelativeLayout) findViewById(R.id.layoutDevices);
    imgStatus = (ImageView) findViewById(R.id.imgStatus);

    txtFuelLearn = (TextView) findViewById(R.id.fuellearn);

    imgIWait = (ImageView) findViewById(R.id.imgIWait);
    imgIRpm = (ImageView) findViewById(R.id.imgIRpm);
    imgILoad = (ImageView) findViewById(R.id.imgILoad);

    imgFWait = (ImageView) findViewById(R.id.imgFWait);
    imgFRpm = (ImageView) findViewById(R.id.imgFRpm);
    imgFLoad = (ImageView) findViewById(R.id.imgFLoad);

    imgIat = (ImageView) findViewById(R.id.iat);

    gridData = (GridView) findViewById(R.id.gridData);

    dataArray = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1);
    dataArray.add("RPM\n ----");
    dataArray.add("MAP\n ---");
    dataArray.add("MAT\n ---\u00B0");
    dataArray.add("AFR\n --.-");
    dataArray.add("TAFR\n --.-");
    dataArray.add("WAT\n ---\u00B0");

    gridData.setAdapter(dataArray);

    lvDevices.setOnItemClickListener(DevicesClickListener);

    waterNeedle = (GaugeNeedle) findViewById(R.id.waterneedle);
    iatNeedle = (GaugeNeedle) findViewById(R.id.iatneedle);
    mapNeedle = (GaugeNeedle) findViewById(R.id.mapneedle);
    afrNeedle = (GaugeNeedle) findViewById(R.id.afrneedle);
    targetAfrNeedle = (GaugeNeedle) findViewById(R.id.targetafrneedle);
    rpmNeedle = (GaugeNeedle) findViewById(R.id.rpmneedle);

    waterNeedle.setPivotPoint(.65f);
    waterNeedle.setMinValue(100);
    waterNeedle.setMaxValue(240);
    waterNeedle.setMinDegrees(-50);
    waterNeedle.setMaxDegrees(55);

    afrNeedle.setPivotPoint(.5f);
    afrNeedle.setMinValue(AFR_MIN);
    afrNeedle.setMaxValue(AFR_MAX);
    afrNeedle.setMinDegrees(-180);
    afrNeedle.setMaxDegrees(90);

    targetAfrNeedle.setPivotPoint(.5f);
    targetAfrNeedle.setMinValue(AFR_MIN);
    targetAfrNeedle.setMaxValue(AFR_MAX);
    targetAfrNeedle.setMinDegrees(-180);
    targetAfrNeedle.setMaxDegrees(90);

    mapNeedle.setPivotPoint(.5f);
    mapNeedle.setMinValue(0);
    mapNeedle.setMaxValue(200);
    mapNeedle.setMinDegrees(-150);
    mapNeedle.setMaxDegrees(140);

    rpmNeedle.setPivotPoint(.5f);
    rpmNeedle.setMinValue(0);
    rpmNeedle.setMaxValue(9000);
    rpmNeedle.setMinDegrees(-130);
    rpmNeedle.setMaxDegrees(157);

    ChangeLog cl = new ChangeLog(this);
    if (cl.firstRun()) {
      cl.getLogDialog().show();
    }

    LinearLayout group = (LinearLayout) findViewById(R.id.linearLayoutTchart);
    chart = new TChart(this);
    chart.setAutoRepaint(false);

    group.addView(chart);

    ThemesList.applyTheme(chart.getChart(), 1);

    chart.removeAllSeries();
    ser = new Surface(chart.getChart());

    chart.getAspect().setView3D(true);
    ser.setIrregularGrid(true);

    ser.setUseColorRange(false);
    ser.setUsePalette(true);
    ser.setPaletteStyle(PaletteStyle.RAINBOW);

    chart.getPanel().setBorderRound(7);

    chart.getAspect().setView3D(true);
    chart.getAspect().setChart3DPercent(100);
    chart.getAspect().setOrthogonal(false);
    chart.getAspect().setZoom(75);
    chart.getAspect().setRotation(350);
    chart.getAspect().setElevation(350);
    chart.getAspect().setPerspective(37);

    chart.getAxes().getDepth().setVisible(true);
    chart.getLegend().setVisible(false);
    chart.getHeader().setText("Fuel Map #1 (VE)");
    chart.getHeader().getFont().setSize(18);
    chart.getHeader().getFont().setBold(true);

    ser.setColor(com.steema.teechart.drawing.Color.darkGray);
    new Rotate(chart.getChart());

    // EVAN
    mUsbDetachedFilter.addAction(UsbManager.ACTION_USB_DEVICE_DETACHED);
    registerReceiver(mUsbReceiver, mUsbDetachedFilter);
    // END EVAN

  }
Ejemplo n.º 29
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState, R.layout.search_view_demo);

    inputMethodManager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
    handler = new MyHandler();
    searchInfo = (TextView) findViewById(R.id.searchInfo);

    // set title style
    ActionBar bar = getActionBar();
    bar.setDisplayOptions(
        ActionBar.DISPLAY_SHOW_TITLE
            | ActionBar.DISPLAY_HOME_AS_UP
            | ActionBar.DISPLAY_SHOW_CUSTOM);
    setTitle(" ");
    LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View customActionBarView = inflater.inflate(R.layout.search_view_demo_title, null);

    searchView = (SearchView) customActionBarView.findViewById(R.id.search_view);
    searchView.setVisibility(View.VISIBLE);
    searchView.setIconifiedByDefault(true);
    searchView.setIconified(false);
    if (Build.VERSION.SDK_INT >= 14) {
      // when edittest is empty, don't show cancal button
      searchView.onActionViewExpanded();
    }
    searchView.setOnCloseListener(
        new OnCloseListener() {

          @Override
          public boolean onClose() {
            // to avoid click x button and the edittext hidden
            return true;
          }
        });
    searchView.setOnQueryTextListener(
        new SearchView.OnQueryTextListener() {

          public boolean onQueryTextSubmit(String query) {
            searchInfo.setText("search submit result");
            hideSoftInput();
            return true;
          }

          public boolean onQueryTextChange(String newText) {
            if (newText != null && newText.length() > 0) {
              currentSearchTip = newText;
              showSearchTip(newText);
            }
            return true;
          }
        });
    Display display = getWindowManager().getDefaultDisplay();
    LayoutParams params =
        new LayoutParams(
            display.getWidth()
                - getResources().getDimensionPixelSize(R.dimen.search_view_margin_left),
            LayoutParams.WRAP_CONTENT,
            Gravity.CENTER_VERTICAL | Gravity.RIGHT);
    bar.setCustomView(customActionBarView, params);

    // show keyboard
    getWindow()
        .setSoftInputMode(
            WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE
                | WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
  }
 private void setupActionBar() {
   ActionBar actionBar = getActionBar();
   actionBar.setDisplayOptions(ActionBar.DISPLAY_HOME_AS_UP, ActionBar.DISPLAY_HOME_AS_UP);
   actionBar.setTitle(R.string.quicklaunch_settings);
 }