Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Open Source License 

import android.net.Uri;

public class Main {
    public static final String ROUTE_COURSES = "/" + "courses";
    public static final String SLASH = "/";
    public static final String ROUTE_RESUME = "/" + "resume";
    public static final String ROUTE_PINBOARD = "/" + "pinboard";
    public static final String ROUTE_PROGRESS = "/" + "progress";
    public static final String ROUTE_LEARNING_ROOMS = "/" + "learning_rooms";
    public static final String ROUTE_ANNOUNCEMENTS = "/" + "announcements";
    private static String path;

    public static String getCourseIdentifierFromResumeUri(Uri uri) {

        path = uri.getPath();

        if (path.matches(ROUTE_COURSES + SLASH + ".*")) {

            path = path.replace(ROUTE_COURSES, "").replace(ROUTE_RESUME, "").replace(ROUTE_PINBOARD, "")
                    .replace(ROUTE_PROGRESS, "").replace(ROUTE_LEARNING_ROOMS, "").replace(ROUTE_ANNOUNCEMENTS, "")
                    .replace(SLASH, "");

            return path;
        }

        return path;
    }
}