com.gianlu.commonutils.tutorial.TutorialManager Java Examples

The following examples show how to use com.gianlu.commonutils.tutorial.TutorialManager. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PeersServersFragment.java    From Aria2App with GNU General Public License v3.0 6 votes vote down vote up
@Nullable
@Override
public final View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    if (getContext() == null) return null;

    LinearLayout layout = (LinearLayout) inflater.inflate(R.layout.fragment_peers_and_servers, container, false);
    topDownloadCountries = layout.findViewById(R.id.peersServersFragment_topDownloadCountries);
    topUploadCountries = layout.findViewById(R.id.peersServersFragment_topUploadCountries);
    rmv = layout.findViewById(R.id.peersServersFragment_rmv);
    rmv.linearLayoutManager(LinearLayoutManager.VERTICAL, false);
    adapter = getAdapter(getContext());
    rmv.loadListData(adapter);
    rmv.startLoading();

    rmv.enableSwipeRefresh(() -> refresh(() -> {
        adapter = getAdapter(getContext());
        rmv.loadListData(adapter);
        rmv.startLoading();
    }), R.color.colorAccent, R.color.colorMetalink, R.color.colorTorrent);

    layout.findViewById(R.id.peersServersFragment_topUploadCountriesContainer).setVisibility(showUpload() ? View.VISIBLE : View.GONE);

    tutorialManager = new TutorialManager(this, Discovery.PEERS_SERVERS);

    return layout;
}
 
Example #2
Source File: FilesFragment.java    From Aria2App with GNU General Public License v3.0 6 votes vote down vote up
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup parent, @Nullable Bundle savedInstanceState) {
    LinearLayout layout = (LinearLayout) inflater.inflate(R.layout.fragment_files, parent, false);
    breadcrumbs = layout.findViewById(R.id.filesFragment_breadcrumbs);
    breadcrumbs.setListener(this);
    rmv = layout.findViewById(R.id.filesFragment_rmv);
    rmv.linearLayoutManager(LinearLayoutManager.VERTICAL, false);
    rmv.dividerDecoration(RecyclerView.VERTICAL);

    tutorialManager = new TutorialManager(this, Discovery.FILES, Discovery.FOLDERS);

    rmv.startLoading();

    return layout;
}
 
Example #3
Source File: OngoingGameFragment.java    From PretendYoureXyzzyAndroid with GNU General Public License v3.0 5 votes vote down vote up
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup parent, @Nullable Bundle savedInstanceState) {
    FrameLayout layout = (FrameLayout) inflater.inflate(R.layout.fragment_ongoing_game, parent, false);
    loading = layout.findViewById(R.id.ongoingGame_loading);
    gameLayout = layout.findViewById(R.id.ongoingGame_gameLayout);
    gameLayout.attach(this);
    message = layout.findViewById(R.id.ongoingGame_message);

    Bundle args = getArguments();
    if (args == null || (perm = (GamePermalink) args.getSerializable("game")) == null) {
        loading.setVisibility(View.GONE);
        gameLayout.setVisibility(View.GONE);
        message.error(R.string.failedLoading);
        return layout;
    }

    tutorialManager = new TutorialManager(this, Discovery.CREATE_GAME, Discovery.HOW_TO_PLAY);

    try {
        pyx = RegisteredPyx.get();
        manager = new AnotherGameManager(perm, pyx, gameLayout, this);
    } catch (LevelMismatchException ex) {
        loading.setVisibility(View.GONE);
        gameLayout.setVisibility(View.GONE);
        message.error(R.string.failedLoading);
        return layout;
    }

    manager.begin();
    manager.setPlayerStateChangedListener(this);

    return layout;
}
 
Example #4
Source File: LoadingActivity.java    From PretendYoureXyzzyAndroid with GNU General Public License v3.0 4 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_loading);
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) actionBar.hide();

    getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE
            | View.SYSTEM_UI_FLAG_FULLSCREEN
            | View.SYSTEM_UI_FLAG_LAYOUT_STABLE
            | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
            | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
            | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);

    new Handler().postDelayed(() -> {
        finished = true;
        if (goTo != null) startActivity(goTo);
    }, 1000);

    if (Prefs.getBoolean(PK.FIRST_RUN, true)) {
        startActivity(new Intent(this, TutorialActivity.class)
                .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK));
        return;
    }

    Button preferences = findViewById(R.id.loading_preferences);
    preferences.setOnClickListener(v -> startActivity(new Intent(LoadingActivity.this, PreferenceActivity.class)));

    tutorialManager = new TutorialManager(this, Discovery.LOGIN);

    loading = findViewById(R.id.loading_loading);
    loading.getIndeterminateDrawable().setColorFilter(CommonUtils.resolveAttrAsColor(this, android.R.attr.textColorPrimary), PorterDuff.Mode.SRC_IN);
    currentServer = findViewById(R.id.loading_currentServer);
    register = findViewById(R.id.loading_register);
    registerNickname = findViewById(R.id.loading_registerNickname);
    registerSubmit = findViewById(R.id.loading_registerSubmit);
    registerIdCode = findViewById(R.id.loading_registerIdCode);
    welcomeMessage = findViewById(R.id.loading_welcomeMsg);

    changeServer = findViewById(R.id.loading_changeServer);
    changeServer.setOnClickListener(v -> changeServerDialog(true));

    registerIdCode.setEndIconOnClickListener(v -> CommonUtils.setText(registerIdCode, CommonUtils.randomString(100, new SecureRandom())));
    CommonUtils.clearErrorOnEdit(registerIdCode);

    if (Objects.equals(getIntent().getAction(), Intent.ACTION_VIEW) || Objects.equals(getIntent().getAction(), Intent.ACTION_SEND)) {
        Uri url = getIntent().getData();
        if (url != null) {
            Pyx.Server server = Pyx.Server.fromUrl(url);
            if (server != null) setServer(server);

            String fragment = url.getFragment();
            if (fragment != null) {
                List<NameValuePair> params = Utils.splitQuery(fragment);
                for (NameValuePair pair : params) {
                    if (Objects.equals(pair.key(), "game")) {
                        try {
                            launchGame = new GamePermalink(Integer.parseInt(pair.value("")), new JSONObject()); // A bit hacky
                        } catch (NumberFormatException ignored) {
                        }
                    } else if (Objects.equals(pair.key(), "password")) {
                        launchGamePassword = pair.value("");
                    }
                }

                launchGameShouldRequest = true;
            }
        }
    }

    discoveryApi = PyxDiscoveryApi.get();
    discoveryApi.getWelcomeMessage(this, new Pyx.OnResult<String>() {
        @Override
        public void onDone(@NonNull String result) {
            if (result.isEmpty()) {
                welcomeMessage.setVisibility(View.GONE);
            } else {
                welcomeMessage.setVisibility(View.VISIBLE);
                welcomeMessage.setHtml(result);
            }
        }

        @Override
        public void onException(@NonNull Exception ex) {
            Log.e(TAG, "Failed loading welcome message.", ex);
            welcomeMessage.setVisibility(View.GONE);
        }
    });
    discoveryApi.firstLoad(this, null, this);

    signInSilently();
}