Java Code Examples for com.gianlu.commonutils.analytics.AnalyticsApplication#sendAnalytics()

The following examples show how to use com.gianlu.commonutils.analytics.AnalyticsApplication#sendAnalytics() . 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: FilesFragment.java    From Aria2App with GNU General Public License v3.0 6 votes vote down vote up
private void shouldDownload(@NonNull MultiProfile profile, @NonNull OptionsMap global, @NonNull AriaFile file, boolean share) {
    AnalyticsApplication.sendAnalytics(Utils.ACTION_DOWNLOAD_FILE);

    if (Prefs.getBoolean(PK.DD_USE_EXTERNAL) || share) {
        MultiProfile.DirectDownload dd = profile.getProfile(getContext()).directDownload;
        HttpUrl base;
        if (dd == null || (base = dd.getUrl()) == null) return;

        Intent intent = new Intent(Intent.ACTION_VIEW);
        intent.setData(Uri.parse(file.getDownloadUrl(global, base).toString()));

        if (dd.auth) {
            Bundle headers = new Bundle();
            headers.putString("Authorization", dd.getAuthorizationHeader());
            intent.putExtra(Browser.EXTRA_HEADERS, headers);
        }

        startActivity(intent);
    } else {
        startDownloadInternal(profile, file, null);
    }
}
 
Example 2
Source File: FilesFragment.java    From Aria2App with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void onDownloadDirectory(@NonNull MultiProfile profile, @NonNull AriaDirectory dir) {
    if (dirSheet != null) {
        dirSheet.dismiss();
        dirSheet = null;
        dismissDialog();
    }

    AnalyticsApplication.sendAnalytics(Utils.ACTION_DOWNLOAD_DIRECTORY);

    if (Prefs.getBoolean(PK.DD_USE_EXTERNAL)) {
        AlertDialog.Builder builder = new MaterialAlertDialogBuilder(requireContext());
        builder.setTitle(R.string.cannotDownloadDirWithExternal)
                .setMessage(R.string.cannotDownloadDirWithExternal_message)
                .setPositiveButton(android.R.string.yes, (dialog, which) -> startDownloadInternal(profile, null, dir))
                .setNegativeButton(android.R.string.no, null);

        showDialog(builder);
    } else {
        startDownloadInternal(profile, null, dir);
    }
}
 
Example 3
Source File: AddUriActivity.java    From Aria2App with GNU General Public License v3.0 6 votes vote down vote up
@Nullable
@Override
public AddDownloadBundle createBundle() {
    AnalyticsApplication.sendAnalytics(Utils.ACTION_NEW_URI);

    ArrayList<String> uris = urisFragment.getUris();
    if (uris == null || uris.isEmpty()) {
        Toaster.with(this).message(R.string.noUris).show();
        pager.setCurrentItem(0, true);
        return null;
    }

    OptionsMap options = optionsFragment.getOptions();
    String filename = optionsFragment.getFilename();
    if (filename != null) options.put("out", filename);
    return new AddUriBundle(uris, optionsFragment.getPosition(), options);
}
 
Example 4
Source File: AddTorrentActivity.java    From Aria2App with GNU General Public License v3.0 6 votes vote down vote up
@Nullable
@Override
public AddDownloadBundle createBundle() {
    AnalyticsApplication.sendAnalytics(Utils.ACTION_NEW_TORRENT);

    String base64;
    try {
        base64 = base64Fragment.getBase64();
    } catch (Base64Fragment.NoFileException ex) {
        pager.setCurrentItem(0, true);
        return null;
    }

    String filename = base64Fragment.getFilenameOnDevice();
    Uri fileUri = base64Fragment.getFileUri();
    if (base64 == null || filename == null || fileUri == null) {
        pager.setCurrentItem(0, true);
        return null;
    }

    return new AddTorrentBundle(base64, filename, fileUri, urisFragment.getUris(), optionsFragment.getPosition(), optionsFragment.getOptions());
}
 
Example 5
Source File: AddMetalinkActivity.java    From Aria2App with GNU General Public License v3.0 6 votes vote down vote up
@Nullable
@Override
public AddDownloadBundle createBundle() {
    AnalyticsApplication.sendAnalytics(Utils.ACTION_NEW_METALINK);

    String base64;
    try {
        base64 = base64Fragment.getBase64();
    } catch (Base64Fragment.NoFileException ex) {
        pager.setCurrentItem(0, true);
        return null;
    }

    String filename = base64Fragment.getFilenameOnDevice();
    Uri fileUri = base64Fragment.getFileUri();
    if (base64 == null || filename == null || fileUri == null) {
        pager.setCurrentItem(0, true);
        return null;
    }

    return new AddMetalinkBundle(base64, filename, fileUri, optionsFragment.getPosition(), optionsFragment.getOptions());
}
 
Example 6
Source File: EditProfileActivity.java    From Aria2App with GNU General Public License v3.0 5 votes vote down vote up
private void deleteProfile() {
    if (editProfile == null) return;

    AnalyticsApplication.sendAnalytics(Utils.ACTION_DELETE_PROFILE);

    ProfilesManager.get(this).delete(editProfile);
    onBackPressed();
}
 
Example 7
Source File: SearchActivity.java    From Aria2App with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean onQueryTextSubmit(@NotNull String query) {
    message.setVisibility(View.GONE);
    rmv.startLoading();
    this.query = query;

    searchApi.search(query.trim(), SearchApi.RESULTS_PER_REQUEST, Prefs.getSet(PK.A2_SEARCH_ENGINES, null), null, this);

    AnalyticsApplication.sendAnalytics(Utils.ACTION_SEARCH);
    return true;
}
 
Example 8
Source File: WebViewActivity.java    From Aria2App with GNU General Public License v3.0 5 votes vote down vote up
private void interceptedDownload(@NonNull InterceptedRequest req) {
    AlertDialog.Builder builder = new MaterialAlertDialogBuilder(this);
    builder.setTitle(R.string.isThisToDownload)
            .setMessage(getString(R.string.isThisToDownload_message, req.url()))
            .setPositiveButton(android.R.string.yes, (dialog, which) -> launchAddUri(req))
            .setNegativeButton(android.R.string.no, null);

    showDialog(builder);
    AnalyticsApplication.sendAnalytics(Utils.ACTION_INTERCEPTED_WEBVIEW);
}
 
Example 9
Source File: ChatFragment.java    From PretendYoureXyzzyAndroid with GNU General Public License v3.0 5 votes vote down vote up
private void send(@NonNull String msg, boolean emote, boolean wall, @NonNull Pyx.OnSuccess listener) {
    if (gid == -1) {
        pyx.request(PyxRequests.sendMessage(msg, emote, wall), getActivity(), listener);
        AnalyticsApplication.sendAnalytics(Utils.ACTION_SENT_MSG);
    } else {
        pyx.request(PyxRequests.sendGameMessage(gid, msg, emote), getActivity(), listener);
        AnalyticsApplication.sendAnalytics(Utils.ACTION_SENT_GAME_MSG);
    }
}
 
Example 10
Source File: GameLayout.java    From PretendYoureXyzzyAndroid with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onCardAction(@NonNull GameCardView.Action action, @NonNull CardsGroup group, @NonNull BaseCard card) {
    if (action == GameCardView.Action.SELECT) {
        if (listener != null) listener.onCardSelected(card);
    } else if (action == GameCardView.Action.TOGGLE_STAR) {
        AnalyticsApplication.sendAnalytics(Utils.ACTION_STARRED_CARD_ADD);

        BaseCard bc = blackCard();
        if (bc != null && starredCards.addCard(new StarredCardsManager.StarredCard(bc, group)))
            Toaster.with(getContext()).message(R.string.addedCardToStarred).show();
    } else if (action == GameCardView.Action.SELECT_IMG) {
        listener.showDialog(CardImageZoomDialog.get(card));
    }
}
 
Example 11
Source File: MainActivity.java    From PretendYoureXyzzyAndroid with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onLeftGame() {
    currentGame = null;
    ongoingGameFragment = null;
    gameChatFragment = null;
    AnalyticsApplication.sendAnalytics(Utils.ACTION_LEFT_GAME);

    inflateNavigation(Layout.LOBBY);
    navigation.setSelectedItem(Item.GAMES);

    synchronized (fragmentsLock) {
        FragmentManager manager = getSupportFragmentManager();
        FragmentTransaction transaction = manager.beginTransaction();

        try {
            Fragment ongoingGame = manager.findFragmentByTag(Item.ONGOING_GAME.tag);
            if (ongoingGame != null) transaction.remove(ongoingGame);

            Fragment gameChat = manager.findFragmentByTag(Item.GAME_CHAT.tag);
            if (gameChat != null) transaction.remove(gameChat);

            transaction.commit();
        } catch (IllegalStateException ex) {
            Log.d(TAG, "Failed fragments transaction on left game.", ex);
        }
    }
}
 
Example 12
Source File: TutorialActivity.java    From PretendYoureXyzzyAndroid with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void onSkipPressed(Fragment currentFragment) {
    AnalyticsApplication.sendAnalytics(Utils.ACTION_SKIP_TUTORIAL);
    done();
}
 
Example 13
Source File: TutorialActivity.java    From PretendYoureXyzzyAndroid with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void onDonePressed(Fragment currentFragment) {
    AnalyticsApplication.sendAnalytics(Utils.ACTION_DONE_TUTORIAL);
    done();
}