Search in sources :

Example 71 with ActionBarDrawerToggle

use of android.support.v7.app.ActionBarDrawerToggle in project vlc-android by GeoffreyMetais.

the class MainActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (!VLCInstance.testCompatibleCPU(this)) {
        finish();
        return;
    }
    Permissions.checkReadStoragePermission(this, false);
    /**
     * Start initializing the UI **
     */
    setContentView(R.layout.main);
    mDrawerLayout = findViewById(R.id.root_container);
    setupNavigationView();
    initAudioPlayerContainerActivity();
    mNavigator = new Navigator(this, mSettings, mExtensionManagerService, savedInstanceState);
    if (savedInstanceState == null) {
        if (getIntent().getBooleanExtra(Constants.EXTRA_UPGRADE, false)) {
            /*
             * The sliding menu is automatically opened when the user closes
             * the info dialog. If (for any reason) the dialog is not shown,
             * open the menu after a short delay.
             */
            mActivityHandler.postDelayed(new Runnable() {

                @Override
                public void run() {
                    mDrawerLayout.openDrawer(mNavigationView);
                }
            }, 500);
        }
        mNavigator.reloadPreferences();
    }
    /* Set up the action bar */
    prepareActionBar();
    mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, R.string.drawer_open, R.string.drawer_close);
    mDrawerLayout.addDrawerListener(mDrawerToggle);
    mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START);
    /* Reload the latest preferences */
    mScanNeeded = savedInstanceState == null && mSettings.getBoolean("auto_rescan", true);
    mExtensionsManager = ExtensionsManager.getInstance();
    mMediaLibrary = VLCApplication.getMLInstance();
}
Also used : Navigator(org.videolan.vlc.gui.helpers.Navigator) ActionBarDrawerToggle(android.support.v7.app.ActionBarDrawerToggle)

Example 72 with ActionBarDrawerToggle

use of android.support.v7.app.ActionBarDrawerToggle in project MPW by shineangelic.

the class MinersActivity method onStart.

@Override
protected void onStart() {
    super.onStart();
    Toolbar toolbar = findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    DrawerLayout drawer = findViewById(R.id.drawer_layout);
    ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
    drawer.setDrawerListener(toggle);
    toggle.syncState();
    NavigationView navigationViewInterna = findViewById(R.id.navigation_view);
    navigationViewInterna.setNavigationItemSelectedListener(this);
    NavigationView navigationView = findViewById(R.id.nav_view_miners);
    navigationView.setNavigationItemSelectedListener(this);
    navigationViewInterna.setCheckedItem(R.id.nav_miners);
    final RadioGroup radioGroupBackTo = findViewById(R.id.minerSortOrder);
    final RadioGroup.OnCheckedChangeListener mescola = new RadioGroup.OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(RadioGroup group, int checkedId) {
            radioGroupBackTo.post(new Runnable() {

                @Override
                public void run() {
                    issueRefresh();
                }
            });
        }
    };
    radioGroupBackTo.setOnCheckedChangeListener(mescola);
    Utils.fillEthereumStats(this, mDbHelper, navigationView, mPool, mCur);
}
Also used : NavigationView(android.support.design.widget.NavigationView) RadioGroup(android.widget.RadioGroup) ActionBarDrawerToggle(android.support.v7.app.ActionBarDrawerToggle) DrawerLayout(android.support.v4.widget.DrawerLayout) Toolbar(android.support.v7.widget.Toolbar)

Example 73 with ActionBarDrawerToggle

use of android.support.v7.app.ActionBarDrawerToggle in project Rutgers-332-452-Group-11-Project by YaochengTong.

the class status method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_status);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
    ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
    drawer.addDrawerListener(toggle);
    toggle.syncState();
    NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
    navigationView.setNavigationItemSelectedListener(this);
}
Also used : NavigationView(android.support.design.widget.NavigationView) ActionBarDrawerToggle(android.support.v7.app.ActionBarDrawerToggle) DrawerLayout(android.support.v4.widget.DrawerLayout) Toolbar(android.support.v7.widget.Toolbar)

Example 74 with ActionBarDrawerToggle

use of android.support.v7.app.ActionBarDrawerToggle in project wigle-wifi-wardriving by wiglenet.

the class MainActivity method setupMenuDrawer.

private void setupMenuDrawer() {
    // set up drawer menu
    final String[] menuTitles = new String[] { getString(R.string.tab_list), getString(R.string.tab_map), getString(R.string.tab_dash), getString(R.string.tab_data), getString(R.string.tab_news), getString(R.string.tab_rank), getString(R.string.tab_stats), getString(R.string.tab_uploads), getString(R.string.menu_settings), getString(R.string.menu_exit) };
    final int[] menuIcons = new int[] { android.R.drawable.ic_menu_sort_by_size, android.R.drawable.ic_menu_mapmode, android.R.drawable.ic_menu_directions, android.R.drawable.ic_menu_save, android.R.drawable.ic_menu_agenda, android.R.drawable.ic_menu_sort_alphabetically, android.R.drawable.ic_menu_today, android.R.drawable.ic_menu_upload, android.R.drawable.ic_menu_preferences, android.R.drawable.ic_delete };
    mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
    mDrawerList = (ListView) findViewById(R.id.left_drawer);
    // Set the adapter for the list view
    mDrawerList.setAdapter(new ArrayAdapter<String>(this, R.layout.drawer_list_item, R.id.drawer_list_text, menuTitles) {

        @Override
        public View getView(int position, View convertView, ViewGroup parent) {
            final LayoutInflater inflater = LayoutInflater.from(MainActivity.this);
            View view;
            if (convertView == null) {
                view = inflater.inflate(R.layout.drawer_list_item, parent, false);
            } else {
                view = convertView;
            }
            final TextView text = (TextView) view.findViewById(R.id.drawer_list_text);
            text.setText(menuTitles[position]);
            // If that's the Exit button, set the background to red
            if (position == EXIT_TAB_POS) {
                view.setBackgroundColor(Color.argb(200, 70, 0, 0));
            } else {
                view.setBackgroundColor(0);
            }
            final ImageView image = (ImageView) view.findViewById(R.id.drawer_list_icon);
            image.setImageResource(menuIcons[position]);
            return view;
        }
    });
    // Set the list's click listener
    mDrawerList.setOnItemClickListener(new DrawerItemClickListener());
    mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
    mDrawerToggle = new ActionBarDrawerToggle(this, /* host Activity */
    mDrawerLayout, /* DrawerLayout object */
    R.string.drawer_open, /* "open drawer" description */
    R.string.drawer_close) {

        /* "close drawer" description */
        /**
         * Called when a drawer has settled in a completely closed state.
         */
        public void onDrawerClosed(View view) {
            super.onDrawerClosed(view);
        }

        /**
         * Called when a drawer has settled in a completely open state.
         */
        public void onDrawerOpened(View drawerView) {
            super.onDrawerOpened(drawerView);
            final ActionBar actionBar = getSupportActionBar();
            if (actionBar != null)
                actionBar.setTitle("Menu");
        }
    };
    // Set the drawer toggle as the DrawerListener
    mDrawerLayout.setDrawerListener(mDrawerToggle);
    final ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setHomeButtonEnabled(true);
    }
// end drawer setup
}
Also used : ViewGroup(android.view.ViewGroup) ActionBarDrawerToggle(android.support.v7.app.ActionBarDrawerToggle) ImageView(android.widget.ImageView) View(android.view.View) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) ListView(android.widget.ListView) SuppressLint(android.annotation.SuppressLint) LayoutInflater(android.view.LayoutInflater) TextView(android.widget.TextView) ImageView(android.widget.ImageView) ActionBar(android.support.v7.app.ActionBar)

Example 75 with ActionBarDrawerToggle

use of android.support.v7.app.ActionBarDrawerToggle in project Passenger_Security by ujjwalagr.

the class HomeScreen method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_home_screen);
    Toolbar toolbar = findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    DrawerLayout drawer = findViewById(R.id.drawer_layout);
    ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
    drawer.addDrawerListener(toggle);
    toggle.syncState();
    NavigationView navigationView = findViewById(R.id.nav_view);
    navigationView.setNavigationItemSelectedListener(this);
    d1 = getSharedPreferences("sp", MODE_PRIVATE);
    View navHeaderView = navigationView.inflateHeaderView(R.layout.nav_header_home_screen);
    TextView nameText = navHeaderView.findViewById(R.id.nameText);
    TextView pnrText = navHeaderView.findViewById(R.id.pnrtext);
    TextView seatText = navHeaderView.findViewById(R.id.seatbooking);
    ImageView img = navHeaderView.findViewById(R.id.imageView);
    img.setImageResource(R.drawable.mytrain);
    nameText.setText(d1.getString("k1", null));
    pnrText.setText("Pnr = " + d1.getString("k2", null));
    seatText.setText(d1.getString("k5", null));
    Location location = GPSUtil.getInstance(this).getLastLocation();
    // Toast.makeText(this, location.toString(), Toast.LENGTH_SHORT).show();
    if (location != null) {
        // Log.d(TAG, "Location : "+location.getLatitude() + "," + location.getLongitude());
        Toast.makeText(this, "" + location.getLatitude() + "\n" + location.getLongitude(), Toast.LENGTH_LONG).show();
    } else {
        Toast.makeText(this, "Location is null", Toast.LENGTH_SHORT).show();
    }
}
Also used : NavigationView(android.support.design.widget.NavigationView) ActionBarDrawerToggle(android.support.v7.app.ActionBarDrawerToggle) TextView(android.widget.TextView) ImageView(android.widget.ImageView) DrawerLayout(android.support.v4.widget.DrawerLayout) NavigationView(android.support.design.widget.NavigationView) ImageView(android.widget.ImageView) View(android.view.View) TextView(android.widget.TextView) Toolbar(android.support.v7.widget.Toolbar) Location(android.location.Location)

Aggregations

ActionBarDrawerToggle (android.support.v7.app.ActionBarDrawerToggle)218 View (android.view.View)153 NavigationView (android.support.design.widget.NavigationView)118 Toolbar (android.support.v7.widget.Toolbar)98 DrawerLayout (android.support.v4.widget.DrawerLayout)96 TextView (android.widget.TextView)85 AdapterView (android.widget.AdapterView)51 ImageView (android.widget.ImageView)48 ListView (android.widget.ListView)48 Intent (android.content.Intent)45 ActionBarDrawerToggle (android.support.v4.app.ActionBarDrawerToggle)35 ActionBar (android.support.v7.app.ActionBar)31 SharedPreferences (android.content.SharedPreferences)30 RecyclerView (android.support.v7.widget.RecyclerView)23 Bundle (android.os.Bundle)20 FloatingActionButton (android.support.design.widget.FloatingActionButton)20 LinearLayout (android.widget.LinearLayout)19 MenuItem (android.view.MenuItem)17 BindView (butterknife.BindView)15 ArrayList (java.util.ArrayList)15