Ejemplo n.º 1
0
 public void enableActionBarBackArrow(boolean enable) {
   final ActionBar actionBar = getSupportActionBar();
   if (actionBar != null) {
     actionBar.setHomeButtonEnabled(enable);
     actionBar.setDisplayHomeAsUpEnabled(enable);
   }
 }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // TODO: Use transparent action bar, fix location of my location btn.

    // requestWindowFeature(Window.FEATURE_ACTION_BAR_OVERLAY);
    setContentView(R.layout.map);

    Analytics.getInstance(this).registerScreen("Point on map");

    ActionBar actionBar = getSupportActionBar();
    // actionBar.setBackgroundDrawable(getResources().getDrawableColorInt(R.drawable.ab_bg_black));
    actionBar.setHomeButtonEnabled(true);
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
    actionBar.setDisplayShowHomeEnabled(true);
    actionBar.setDisplayHomeAsUpEnabled(true);
    actionBar.setTitle(R.string.point_on_map);

    Bundle extras = getIntent().getExtras();
    // TODO: Can we make this as a none member.
    mStop = (Site) extras.getParcelable(EXTRA_STOP);
    String helpText = extras.getString(EXTRA_HELP_TEXT);
    String markerText = extras.getString(EXTRA_MARKER_TEXT);

    showHelpToast(helpText);

    if (markerText == null) {
      markerText = getString(R.string.tap_to_select_this_point);
    }

    SupportMapFragment mapFragment =
        (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map);
    mapFragment.getMapAsync(this);
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    if (fullScreen()) {
      requestWindowFeature(Window.FEATURE_NO_TITLE);
      getWindow()
          .setFlags(
              WindowManager.LayoutParams.FLAG_FULLSCREEN,
              WindowManager.LayoutParams.FLAG_FULLSCREEN);
    }
    setContentView(resLayoutId());

    ButterKnife.inject(this);

    if (!fullScreen()) {
      ActionBar mActionBar = getSupportActionBar();
      if (mActionBar != null) {
        mActionBar.setDisplayShowTitleEnabled(displayTitle());
        mActionBar.setDisplayHomeAsUpEnabled(displayHomeUp());
        mActionBar.setHomeButtonEnabled(homeButton());
      }
    }

    provideOnCreate(savedInstanceState);
  }
Ejemplo n.º 4
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_main);
    final Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    final ActionBar actionBar = getSupportActionBar();
    actionBar.setDisplayShowTitleEnabled(true);

    final DrawerLayout drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
    mDrawerToggle =
        new ActionBarDrawerToggle(
            this,
            drawerLayout,
            toolbar,
            R.string.navigation_drawer_open,
            R.string.navigation_drawer_close);
    drawerLayout.setDrawerListener(mDrawerToggle);
    actionBar.setDisplayHomeAsUpEnabled(true);
    actionBar.setHomeButtonEnabled(true);

    messageReciever = new MessageReciever();
    IntentFilter filter = new IntentFilter(MESSAGE_EVENT);
    LocalBroadcastManager.getInstance(this).registerReceiver(messageReciever, filter);

    final NavigationDrawerFragment navigationDrawerFragment =
        (NavigationDrawerFragment)
            getSupportFragmentManager().findFragmentById(R.id.navigation_drawer);
    title = getTitle();

    navigationDrawerFragment.setUp(
        R.id.navigation_drawer, (DrawerLayout) findViewById(R.id.drawer_layout));
  }
Ejemplo n.º 5
0
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_add_member);
    // Initilization
    viewPager = (ViewPager) findViewById(R.id.pager);
    actionBar = getSupportActionBar();
    tabPagerAdapter = new TabPagerAdapter(getSupportFragmentManager());

    viewPager.setAdapter(tabPagerAdapter);
    actionBar.setHomeButtonEnabled(false);
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);

    // Adding Tabs
    for (String tab_name : tabs) {
      actionBar.addTab(actionBar.newTab().setText(tab_name).setTabListener(this));
    }
    viewPager.setOnPageChangeListener(
        new ViewPager.OnPageChangeListener() {
          @Override
          public void onPageScrolled(int i, float v, int i1) {}

          @Override
          public void onPageSelected(int i) {
            actionBar.setSelectedNavigationItem(i);
          }

          @Override
          public void onPageScrollStateChanged(int i) {}
        });
  }
Ejemplo n.º 6
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_settle_info);

    ActionBar mActionBar = getSupportActionBar();
    mActionBar.setHomeButtonEnabled(true);
    mActionBar.setDisplayHomeAsUpEnabled(true);
    mActionBar.setTitle("提现明细");

    mListView = (AutoRefreshListView) findViewById(R.id.settle_listview);
    mListView.setOnGetToButtomListener(
        new AutoRefreshListView.OnGetToButtomListener() {
          @Override
          public void onButtomAndNetOk() {
            fetchData();
          }
        });

    mListView.setIfAutoScroll(false);

    adapter = new MAdapter();
    mListView.setAdapter(adapter);

    if (CodeUtil.checkNetState(this)) {
      loadDate = DateUtil.getNowDate();
      fetchData();
    } else {
      mListView.setStateNoMoreData();
    }
  }
Ejemplo n.º 7
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_file_view);
    Intent intent = getIntent();
    subN = intent.getExtras().getString("subn");
    tt = intent.getExtras().getString("tt");

    arrayList_path = new ArrayList<String>();
    arrayList_time = new ArrayList<String>();
    arrayList_filecode = new ArrayList<String>();

    file_list = (ListView) findViewById(R.id.list_file);

    adapterFile = new CustomAdapterFile();

    final android.support.v7.app.ActionBar actionBar = getSupportActionBar();
    actionBar.setDisplayHomeAsUpEnabled(true);
    actionBar.setDisplayShowHomeEnabled(true);
    // actionBar.setDisplayUseLogoEnabled(true);
    actionBar.setHomeButtonEnabled(true);
    actionBar.setHomeAsUpIndicator(R.drawable.btnback);
    actionBar.setDisplayShowCustomEnabled(true);
    actionBar.setCustomView(R.layout.actionbar_layout);
    // actionBar.setLogo(R.drawable.btnback);

    TextView txt_subn = (TextView) findViewById(R.id.txt_actionbar);
    txt_subn.setText(subN);

    // Toast.makeText(getApplicationContext(),tt,Toast.LENGTH_SHORT).show();

    net = new Net();
    net.execute();
  }
Ejemplo n.º 8
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // let the actionbar look like Android's contact app
    ActionBar actionBar = getSupportActionBar();
    actionBar.setDisplayHomeAsUpEnabled(true);
    actionBar.setIcon(android.R.color.transparent);
    actionBar.setHomeButtonEnabled(true);

    setContentView(R.layout.api_app_settings_activity);

    mSettingsFragment =
        (AppSettingsFragment)
            getSupportFragmentManager().findFragmentById(R.id.api_app_settings_fragment);

    Intent intent = getIntent();
    mAppUri = intent.getData();
    if (mAppUri == null) {
      Log.e(Constants.TAG, "Intent data missing. Should be Uri of app!");
      finish();
      return;
    } else {
      Log.d(Constants.TAG, "uri: " + mAppUri);
      loadData(savedInstanceState, mAppUri);
    }
  }
Ejemplo n.º 9
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // Get common preferences
    preferences =
        getApplicationContext().getSharedPreferences(APP_SHARED_PREFS, Context.MODE_PRIVATE);

    // Set saved theme
    int themePos = preferences.getInt("theme", 0);
    this.setTheme(ThemePicker.getTheme(themePos));

    setContentView(R.layout.activity_maps);
    // Obtain the SupportMapFragment and get notified when the map is ready to be used.
    SupportMapFragment mapFragment =
        (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map);
    mapFragment.getMapAsync(this);

    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    ActionBar actionBar = getSupportActionBar();
    if (null != actionBar) {
      actionBar.setHomeButtonEnabled(true);
      actionBar.setDisplayHomeAsUpEnabled(true);
    }
  }
  private void initTitleBar() {
    mSpinnerAdapter = new MySpinnerAdapter(getLayoutInflater());

    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    ActionBar supportActionBar = getSupportActionBar();
    supportActionBar.setDisplayHomeAsUpEnabled(true);
    supportActionBar.setDisplayShowHomeEnabled(true);
    supportActionBar.setHomeButtonEnabled(true);
    supportActionBar.setTitle("");
    supportActionBar.setDisplayShowCustomEnabled(true);

    supportActionBar.setCustomView(R.layout.actionbar_custom_spinner);
    Spinner spinner = (Spinner) supportActionBar.getCustomView().findViewById(R.id.spinner);
    spinner.setAdapter(mSpinnerAdapter);
    spinner.setOnItemSelectedListener(
        new AdapterView.OnItemSelectedListener() {

          @Override
          public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
            mSpinnerAdapter.setCheckPos(position);
            changePageShow(position);
          }

          @Override
          public void onNothingSelected(AdapterView<?> parent) {}
        });
  }
Ejemplo n.º 11
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.review_laundry);

    ActionBar bar = getSupportActionBar();
    bar.setBackgroundDrawable(
        new ColorDrawable(Color.parseColor(getResources().getString(R.string.action_bar_color))));
    bar.setDisplayShowHomeEnabled(true);
    bar.setDisplayHomeAsUpEnabled(true);
    bar.setHomeButtonEnabled(true);

    Intent intent = getIntent();

    listView_laundry_review = (ListView) findViewById(R.id.listView_laundry_review);

    bar.setTitle(intent.getExtras().getString("LaundryName") + " Reviews");

    if (Network.HaveNetworkConnection(LaundryReview.this)) {
      getReview(intent.getExtras().getString("LaundryId"));
    } else {
      AlertUtil alert = new AlertUtil();
      alert.messageAlert(
          LaundryReview.this,
          getResources().getString(R.string.network_title),
          getResources().getString(R.string.network_message));
    }
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
      actionBar.setHomeButtonEnabled(true);
      actionBar.setDisplayHomeAsUpEnabled(true);
    }

    FragmentManager fragmentManager = getFragmentManager();
    mAppSettingsFragment =
        (AppSettingsFragment) fragmentManager.findFragmentByTag(KEY_APP_SETTINGS_FRAGMENT);
    mPasscodePreferenceFragment =
        (PasscodePreferenceFragment) fragmentManager.findFragmentByTag(KEY_PASSCODE_FRAGMENT);
    if (mAppSettingsFragment == null || mPasscodePreferenceFragment == null) {
      Bundle passcodeArgs = new Bundle();
      passcodeArgs.putBoolean(PasscodePreferenceFragment.KEY_SHOULD_INFLATE, false);
      mAppSettingsFragment = new AppSettingsFragment();
      mPasscodePreferenceFragment = new PasscodePreferenceFragment();
      mPasscodePreferenceFragment.setArguments(passcodeArgs);

      fragmentManager
          .beginTransaction()
          .replace(android.R.id.content, mPasscodePreferenceFragment, KEY_PASSCODE_FRAGMENT)
          .add(android.R.id.content, mAppSettingsFragment, KEY_APP_SETTINGS_FRAGMENT)
          .commit();
    }
  }
Ejemplo n.º 13
0
 public void setBackSupportToolbar(Toolbar toolbar) {
   setSupportActionBar(toolbar);
   ActionBar actionBar = getSupportActionBar();
   actionBar.setHomeButtonEnabled(true); // 左上角的图标是否可以点击
   actionBar.setDisplayShowTitleEnabled(true); // 显示标题
   actionBar.setDisplayHomeAsUpEnabled(true); // 给左上角图标的左边加上一个返回的图标
 }
Ejemplo n.º 14
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.fragment_main);

    toolbar = (Toolbar) findViewById(R.id.toolbar);

    setSupportActionBar(toolbar);
    drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
    drawerToggle =
        new ActionBarDrawerToggle(
            this, drawerLayout, toolbar, R.string.drawer_open, R.string.drawer_close);
    drawerLayout.setDrawerListener(drawerToggle);
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
      actionBar.setHomeButtonEnabled(true);
      actionBar.setDisplayHomeAsUpEnabled(false);
    }

    if (savedInstanceState == null) {
      getSupportFragmentManager()
          .beginTransaction()
          .replace(R.id.main_placeholder, new StartPageFragment())
          .commit();
    }
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    mContext = this;
    setContentView(R.layout.activity_account_book_custom_view);

    mViewPager = (MaterialViewPager) findViewById(R.id.materialViewPager);

    View view = mViewPager.getRootView();
    TextView title = (TextView) view.findViewById(R.id.logo_white);
    title.setTypeface(CoCoinUtil.getInstance().typefaceLatoLight);
    title.setText(SettingManager.getInstance().getAccountBookName());

    mViewPager.getPagerTitleStrip().setTypeface(CoCoinUtil.GetTypeface(), Typeface.NORMAL);
    mViewPager.getPagerTitleStrip().setVisibility(View.INVISIBLE);

    setTitle("");

    toolbar = mViewPager.getToolbar();

    if (toolbar != null) {
      setSupportActionBar(toolbar);

      final ActionBar actionBar = getSupportActionBar();
      if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setDisplayShowHomeEnabled(true);
        actionBar.setDisplayShowTitleEnabled(true);
        actionBar.setDisplayUseLogoEnabled(false);
        actionBar.setHomeButtonEnabled(true);
      }
    }

    View logo = findViewById(R.id.logo_white);
    if (logo != null) {
      logo.setOnClickListener(
          new View.OnClickListener() {
            @Override
            public void onClick(View v) {
              mViewPager.notifyHeaderChanged();
            }
          });
    }

    customViewFragmentAdapter = new CustomViewFragmentAdapter(getSupportFragmentManager());
    mViewPager.getViewPager().setOffscreenPageLimit(1);
    mViewPager.getViewPager().setAdapter(customViewFragmentAdapter);
    mViewPager.getPagerTitleStrip().setViewPager(mViewPager.getViewPager());

    mViewPager.setMaterialViewPagerListener(
        new MaterialViewPager.Listener() {
          @Override
          public HeaderDesign getHeaderDesign(int page) {
            return HeaderDesign.fromColorAndDrawable(
                CoCoinUtil.GetTagColor(-3), CoCoinUtil.GetTagDrawable(-3));
          }
        });
  }
Ejemplo n.º 16
0
 public void initTitle(Toolbar toolbar) {
   toolbar.setTitle("首页");
   setSupportActionBar(toolbar);
   ActionBar ab = getSupportActionBar();
   ab.setHomeAsUpIndicator(R.drawable.ic_menu);
   ab.setDisplayShowHomeEnabled(true);
   ab.setHomeButtonEnabled(true);
 }
  /** Sets the default configuration for the activity {@link android.support.v7.app.ActionBar}. */
  protected void onConfigureActionBar() {
    final ActionBar actionBar = getSupportActionBar();

    actionBar.setDisplayHomeAsUpEnabled(isHomeAsUpEnabled());
    actionBar.setDisplayShowTitleEnabled(isTitleEnabled());
    actionBar.setDisplayUseLogoEnabled(isLogoEnabled());
    actionBar.setHomeButtonEnabled(isHomeButtonEnabled());
  }
 private void setUpActionBar() {
   ActionBar mActionBar = getSupportActionBar();
   mActionBar.setDisplayShowHomeEnabled(false);
   mActionBar.setDisplayShowTitleEnabled(true);
   mActionBar.setDisplayHomeAsUpEnabled(true);
   mActionBar.setHomeButtonEnabled(true);
   mActionBar.setDisplayShowCustomEnabled(true);
 }
Ejemplo n.º 19
0
 @Override
 protected void initActionbar() {
   mActionBar = getSupportActionBar();
   mActionBar.setTitle(R.string.app_detail);
   mActionBar.setHomeButtonEnabled(true);
   mActionBar.setDisplayHomeAsUpEnabled(true);
   mActionBar.setDisplayShowHomeEnabled(true);
 }
Ejemplo n.º 20
0
  @Override
  protected void onResume() {
    // TODO Auto-generated method stub
    super.onResume();

    dataList = new ArrayList<Test_drawitem>();
    mTitle = mDrawerTitle = getTitle();
    draw_lay = (DrawerLayout) findViewById(R.id.drawl);
    draw_List = (ListView) findViewById(R.id.left_draw);
    // titles1=getResources().getStringArray(R.array.items1);
    ab = getSupportActionBar();
    draw_lay.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START);

    dataList.add(new Test_drawitem("Home", R.drawable.home));
    dataList.add(new Test_drawitem("Sell Books", R.drawable.sellbook));
    dataList.add(new Test_drawitem("Books Status", R.drawable.book4));
    dataList.add(new Test_drawitem("Exit", R.drawable.signout));

    adapter = new Test_custom_adap(this, R.layout.test_item, dataList);

    draw_List.setAdapter(adapter);

    draw_List.setOnItemClickListener(new DrawerItemClickListener());

    FragmentManager fm = getSupportFragmentManager();
    FragmentTransaction ft = fm.beginTransaction();
    fr = new NavDraw1_Frag1();
    ft.replace(R.id.fl1, fr).commit();
    draw_List.setItemChecked(0, true);
    // draw_List.setAdapter(new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1,
    // titles1));
    // draw_List.setOnItemClickListener(new Click());

    mDrawerToggle =
        new android.support.v4.app.ActionBarDrawerToggle(
            this, /* host Activity */
            draw_lay, /* DrawerLayout object */
            R.drawable.draw, /* nav_drawer image to replace 'Up' caret */
            R.string.open_draw, /* "open drawer" description for accessibility */
            R.string.close_draw /* "close drawer" description for accessibility */) {
          @TargetApi(Build.VERSION_CODES.HONEYCOMB)
          public void onDrawerClosed(View view) {
            getSupportActionBar().setTitle(mTitle);
            invalidateOptionsMenu();
          }

          @TargetApi(Build.VERSION_CODES.HONEYCOMB)
          public void onDrawerOpened(View drawerView) {
            getSupportActionBar().setTitle(mDrawerTitle);
            invalidateOptionsMenu();
          }
        };
    draw_lay.setDrawerListener(mDrawerToggle);
    ab.setHomeButtonEnabled(true);
    ab.setDisplayHomeAsUpEnabled(true); // for creating a back arrow for home
    ab.setHomeAsUpIndicator(getResources().getDrawable(R.drawable.draw));
  }
  /**
   * Users of this fragment must call this method to set up the navigation drawer interactions.
   *
   * @param fragmentId The android:id of this fragment in its activity's layout.
   * @param drawerLayout The DrawerLayout containing this fragment's UI.
   */
  public void setUp(int fragmentId, DrawerLayout drawerLayout) {
    mFragmentContainerView = getActivity().findViewById(fragmentId);
    mDrawerLayout = drawerLayout;

    // set a custom shadow that overlays the main content when the drawer
    // opens
    // 给DrawerLayout设置阴影
    mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START);
    // set up the drawer's list view with items and click listener

    ActionBar actionBar = getActionBar();
    // 设置返回按钮可以显示 (向左的小箭头)// 默认不显示
    actionBar.setDisplayHomeAsUpEnabled(true);
    // 设置返回按钮可以点击
    actionBar.setHomeButtonEnabled(true);

    // 创建自定义返回按钮内容
    drawerArrow =
        new DrawerArrowDrawable(getActivity()) {
          @Override
          public boolean isLayoutRtl() {
            return false;
          }
        };

    // 创建v7包下的返回按钮ActionBarDrawerToggle, (封装DrawerArrowDrawable)
    mDrawerToggle =
        new ActionBarDrawerToggle(
            getActivity(),
            mDrawerLayout,
            drawerArrow,
            R.string.navigation_drawer_open,
            R.string.navigation_drawer_close) {

          public void onDrawerClosed(View view) {
            super.onDrawerClosed(view);
            getActivity().invalidateOptionsMenu();
          }

          public void onDrawerOpened(View drawerView) {
            super.onDrawerOpened(drawerView);
            getActivity().invalidateOptionsMenu();
          }
        };

    mDrawerLayout.post(
        new Runnable() {
          @Override
          public void run() {
            // 同步开关状态
            mDrawerToggle.syncState();
          }
        });

    // 设置按钮监听, 点击之后, 或者拖拽过程中返回按钮可以实时更新其动画位置.
    mDrawerLayout.setDrawerListener(mDrawerToggle);
  }
 @Override
 protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   ActionBar actionBar = getSupportActionBar();
   actionBar.setDisplayHomeAsUpEnabled(true);
   actionBar.setHomeButtonEnabled(true);
   getFragmentManager()
       .beginTransaction()
       .replace(android.R.id.content, new SettingsFragment())
       .commit();
 }
Ejemplo n.º 23
0
 private void createToolbar() {
   assert getSupportActionBar() != null;
   Toolbar toolbar = (Toolbar) findViewById(R.id.main_toolbar);
   setSupportActionBar(toolbar);
   mActionBar = getSupportActionBar();
   mActionBar.setBackgroundDrawable(
       new ColorDrawable(ContextCompat.getColor(this, R.color.primary_color)));
   mActionBar.setDisplayShowTitleEnabled(true);
   mActionBar.setDisplayHomeAsUpEnabled(true);
   mActionBar.setHomeButtonEnabled(true);
   mActionBar.setTitle("Log Game");
 }
Ejemplo n.º 24
0
  @Override
  protected void initActionbar() {
    actionBar = getSupportActionBar();
    actionBar.setTitle(UIUtils.getString(R.string.app_name));
    actionBar.setDisplayHomeAsUpEnabled(true);
    actionBar.setHomeButtonEnabled(true);

    actionBarDrawerToggle =
        new ActionBarDrawerToggle(
            this, drawer_layout, R.drawable.ic_drawer, R.string.drawer_open, R.string.drawer_close);
    actionBarDrawerToggle.syncState();
  }
  private void initToolbar() {
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    toolbar.setTitle("Create HD Wallet");
    setSupportActionBar(toolbar);
    // Navigation Icon設定在 setSupoortActionBar後才有作用,否則會出現 back button_up
    toolbar.setNavigationIcon(R.mipmap.menu_3x);

    ActionBar actionBar = getSupportActionBar();
    // 打開 up button_up
    actionBar.setDisplayHomeAsUpEnabled(true);
    actionBar.setHomeButtonEnabled(true);
  }
Ejemplo n.º 26
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    pm = getPackageManager();

    device = new Device();

    viewPager = (ViewPager) findViewById(R.id.pager);
    actionBar = getSupportActionBar();
    pagerAdapter = new PagerAdapter(getSupportFragmentManager());

    viewPager.setAdapter(pagerAdapter);
    actionBar.setHomeButtonEnabled(false);
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);

    for (String tab_name : tabs) {
      actionBar.addTab(actionBar.newTab().setText(tab_name).setTabListener(this));
    }

    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) {}
        });

    List<PackageInfo> installedApplications =
        pm.getInstalledPackages(PackageManager.GET_PERMISSIONS);
    device.apps = App.scanApps(installedApplications, this.getApplicationContext());
    double sum = 0.0;
    for (App a : device.apps) {
      sum += a.getScore();
    }
    device.setAppScore(sum / device.apps.size());

    device.os = OS.scanOS(android.os.Build.VERSION.RELEASE, getApplicationContext());
    device.setOsScore(device.os.getScore());

    Securitometer securitometer = (Securitometer) getApplicationContext();
    securitometer.setDevice(device);
  }
Ejemplo n.º 27
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_action_bar_attempt);

    // setting the toolbar
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    final ActionBar actionBar = getSupportActionBar();
    actionBar.setDisplayHomeAsUpEnabled(true);
    actionBar.setHomeButtonEnabled(true);
    actionBar.setDisplayShowTitleEnabled(true);
    toolbar.setNavigationIcon(R.drawable.ic_action_menu);

    mTitle = mDrawerTitle = "About";
    options = getResources().getStringArray(R.array.options);
    mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
    // mDrawerList = (ListView) findViewById(R.id.left_drawer);

    // set up the drawer's list view with items and click listener
    //            mDrawerList.setAdapter(new CustomAdapter(this,options, optionIcons));
    //            mDrawerList.setOnItemClickListener(new DrawerItemClickListener());

    // enable ActionBar app icon to behave as action to toggle nav drawer

    // ActionBarDrawerToggle ties together the the proper interactions
    // between the sliding drawer and the action bar app icon
    //            mDrawerToggle = new ActionBarDrawerToggle(
    //                    this,                  /* host Activity */
    //                    mDrawerLayout,         /* DrawerLayout object */
    //                    R.drawable.ic_action_menu,  /* nav drawer image to replace 'Up' caret */
    //                    R.string.drawer_open,  /* "open drawer" description for accessibility */
    //                    R.string.drawer_close  /* "close drawer" description for accessibility */
    //            )
    //            {
    //                public void onDrawerClosed(View view) {
    //                    actionBar.setTitle(mTitle);
    //                    invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu()
    //                }
    //
    //                public void onDrawerOpened(View drawerView) {
    //                    actionBar.setTitle(mDrawerTitle);
    //                    invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu()
    //                }
    //            };
    //            mDrawerLayout.setDrawerListener(mDrawerToggle);

    if (savedInstanceState == null) {
      selectItem(0);
    }
  }
 private void initActionBar() {
   ActionBar actionBar = getSupportActionBar();
   actionBar.setDisplayHomeAsUpEnabled(true);
   actionBar.setHomeButtonEnabled(true);
   actionBar.setElevation(0f);
   SpannableString s = new SpannableString(getResources().getString(R.string.str_calorie_menu));
   s.setSpan(
       new TypefaceSpan(this, "ClementePDai-Regular.otf"),
       0,
       s.length(),
       Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
   actionBar.setTitle(s);
 }
Ejemplo n.º 29
0
  private void initToolbar() {
    mToolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(mToolbar);
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
      actionBar.setTitle("");
      actionBar.setDisplayHomeAsUpEnabled(true);
      actionBar.setHomeButtonEnabled(true);
    }
    //        actionBar.setHomeAsUpIndicator(R.drawable.ic_dehaze_black_24dp);

    ivToolbar = (ImageView) findViewById(R.id.ivToolbar);
    getCurrentMonthToShow();
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_payment_result);

    mItem = (ProductContent.ProductItem) getIntent().getSerializableExtra("product");

    ActionBar actionBar = getSupportActionBar();
    actionBar.setDisplayHomeAsUpEnabled(true);
    actionBar.setHomeButtonEnabled(true);

    Button buttonOk = (Button) findViewById(R.id.buttonOk);
    buttonOk.setOnClickListener(mOkButtonClickListener);
  }