Search in sources :

Example 1 with WebViewFragment

use of app.insti.fragment.WebViewFragment in project IITB-App by wncc.

the class MainActivity method onNavigationItemSelected.

@Override
public boolean onNavigationItemSelected(MenuItem item) {
    // Handle navigation view item clicks here.
    int id = item.getItemId();
    switch(id) {
        case R.id.nav_feed:
            feedFragment = new FeedFragment();
            updateFragment(feedFragment);
            break;
        case R.id.nav_explore:
            updateFragment(ExploreFragment.newInstance());
            break;
        case R.id.nav_news:
            updateFragment(new NewsFragment());
            break;
        case R.id.nav_placement_blog:
            openPlacementBlog();
            break;
        case R.id.nav_training_blog:
            openTrainingBlog();
            break;
        case R.id.nav_mess_menu:
            MessMenuFragment messMenuFragment = new MessMenuFragment();
            updateFragment(messMenuFragment);
            break;
        case R.id.nav_calendar:
            CalendarFragment calendarFragment = new CalendarFragment();
            updateFragment(calendarFragment);
            break;
        case R.id.nav_qlinks:
            QuickLinksFragment quickLinksFragment = new QuickLinksFragment();
            updateFragment(quickLinksFragment);
            break;
        case R.id.nav_map:
            MapFragment mapFragment = new MapFragment();
            updateFragment(mapFragment);
            break;
        case R.id.nav_achievements:
            WebViewFragment webViewFragment = new WebViewFragment();
            Bundle bundle = new Bundle();
            bundle.putString(Constants.WV_TYPE, Constants.WV_TYPE_ACHIEVEMENTS);
            webViewFragment.setArguments(bundle);
            updateFragment(webViewFragment);
            break;
        case R.id.nav_complaint:
            if (session.isLoggedIn()) {
                ComplaintsFragment complaintsFragment = new ComplaintsFragment();
                updateFragment(complaintsFragment);
            } else {
                Toast.makeText(this, Constants.LOGIN_MESSAGE, Toast.LENGTH_LONG).show();
            }
            break;
        case R.id.nav_settings:
            SettingsFragment settingsFragment = new SettingsFragment();
            updateFragment(settingsFragment);
            break;
        default:
            break;
    }
    DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
    drawer.closeDrawer(GravityCompat.START);
    return true;
}
Also used : SettingsFragment(app.insti.fragment.SettingsFragment) ComplaintsFragment(app.insti.fragment.ComplaintsFragment) WebViewFragment(app.insti.fragment.WebViewFragment) CalendarFragment(app.insti.fragment.CalendarFragment) Bundle(android.os.Bundle) MapFragment(app.insti.fragment.MapFragment) NewsFragment(app.insti.fragment.NewsFragment) DrawerLayout(androidx.drawerlayout.widget.DrawerLayout) MessMenuFragment(app.insti.fragment.MessMenuFragment) QuickLinksFragment(app.insti.fragment.QuickLinksFragment) SuppressLint(android.annotation.SuppressLint) FeedFragment(app.insti.fragment.FeedFragment)

Example 2 with WebViewFragment

use of app.insti.fragment.WebViewFragment in project IITB-App by wncc.

the class GenericAdapter method onClick.

@Override
public void onClick(CardInterface cardInterface, Fragment fragment, View view) {
    if (cardInterface instanceof Event) {
        Utils.openEventFragment((Event) cardInterface, fragment, view.findViewById(R.id.object_picture));
    } else if (cardInterface instanceof Body) {
        Utils.openBodyFragment((Body) cardInterface, fragment, view.findViewById(R.id.object_picture));
    } else if (cardInterface instanceof User) {
        Utils.openUserFragment((User) cardInterface, fragment, view.findViewById(R.id.object_picture));
    } else if (cardInterface instanceof Role) {
        Utils.openBodyFragment(((Role) cardInterface).getRoleBodyDetails(), fragment, view.findViewById(R.id.object_picture));
    } else if (cardInterface instanceof Achievement) {
        Achievement a = (Achievement) cardInterface;
        if (a.getAchievementEvent() != null) {
            a.getAchievementEvent().setEventBodies(new ArrayList<>());
            a.getAchievementEvent().getEventBodies().add(a.getAchievementBody());
            Utils.openEventFragment(a.getAchievementEvent(), fragment, view.findViewById(R.id.object_picture));
        } else {
            Utils.openBodyFragment(a.getAchievementBody(), fragment, view.findViewById(R.id.object_picture));
        }
    } else if (cardInterface instanceof OfferedAchievement) {
        WebViewFragment webViewFragment = new WebViewFragment();
        Bundle bundle = new Bundle();
        bundle.putString(Constants.WV_TYPE, Constants.WV_TYPE_NEW_OFFERED_ACHIEVEMENT);
        bundle.putString(Constants.WV_ID, ((OfferedAchievement) cardInterface).getAchievementID());
        webViewFragment.setArguments(bundle);
        Utils.updateFragment(webViewFragment, fragment.getActivity());
    }
}
Also used : Role(app.insti.api.model.Role) WebViewFragment(app.insti.fragment.WebViewFragment) User(app.insti.api.model.User) OfferedAchievement(app.insti.api.model.OfferedAchievement) Bundle(android.os.Bundle) Event(app.insti.api.model.Event) Achievement(app.insti.api.model.Achievement) OfferedAchievement(app.insti.api.model.OfferedAchievement) Body(app.insti.api.model.Body)

Aggregations

Bundle (android.os.Bundle)2 WebViewFragment (app.insti.fragment.WebViewFragment)2 SuppressLint (android.annotation.SuppressLint)1 DrawerLayout (androidx.drawerlayout.widget.DrawerLayout)1 Achievement (app.insti.api.model.Achievement)1 Body (app.insti.api.model.Body)1 Event (app.insti.api.model.Event)1 OfferedAchievement (app.insti.api.model.OfferedAchievement)1 Role (app.insti.api.model.Role)1 User (app.insti.api.model.User)1 CalendarFragment (app.insti.fragment.CalendarFragment)1 ComplaintsFragment (app.insti.fragment.ComplaintsFragment)1 FeedFragment (app.insti.fragment.FeedFragment)1 MapFragment (app.insti.fragment.MapFragment)1 MessMenuFragment (app.insti.fragment.MessMenuFragment)1 NewsFragment (app.insti.fragment.NewsFragment)1 QuickLinksFragment (app.insti.fragment.QuickLinksFragment)1 SettingsFragment (app.insti.fragment.SettingsFragment)1