當前位置: 首頁>>代碼示例>>Java>>正文


Java SurveyActivity類代碼示例

本文整理匯總了Java中com.mixpanel.android.surveys.SurveyActivity的典型用法代碼示例。如果您正苦於以下問題:Java SurveyActivity類的具體用法?Java SurveyActivity怎麽用?Java SurveyActivity使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


SurveyActivity類屬於com.mixpanel.android.surveys包,在下文中一共展示了SurveyActivity類的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: checkSurveyActivityAvailable

import com.mixpanel.android.surveys.SurveyActivity; //導入依賴的package包/類
public static boolean checkSurveyActivityAvailable(Context context) {
    if (Build.VERSION.SDK_INT < MPConfig.UI_FEATURES_MIN_API) {
        // No need to log, SurveyActivity doesn't work on this platform.
        return false;
    }

    final Intent surveyIntent = new Intent(context, SurveyActivity.class);
    surveyIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    surveyIntent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);

    final PackageManager packageManager = context.getPackageManager();
    final List<ResolveInfo> intentActivities = packageManager.queryIntentActivities(surveyIntent, 0);
    if (intentActivities.size() == 0) {
        Log.w(LOGTAG, SurveyActivity.class.getName() + " is not registered as an activity in your application, so surveys can't be shown.");
        Log.i(LOGTAG, "Please add the child tag <activity android:name=\"com.mixpanel.android.surveys.SurveyActivity\" /> to your <application> tag.");
        return false;
    }

    return true;
}
 
開發者ID:perludem,項目名稱:DPR-KITA,代碼行數:21,代碼來源:ConfigurationChecker.java

示例2: checkSurveyActivityAvailable

import com.mixpanel.android.surveys.SurveyActivity; //導入依賴的package包/類
public static boolean checkSurveyActivityAvailable(Context context) {
    if (Build.VERSION.SDK_INT < 14) {
        // No need to log, SurveyActivity doesn't work on this platform.
        return false;
    }

    final Intent surveyIntent = new Intent(context, SurveyActivity.class);
    surveyIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    surveyIntent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);

    final PackageManager packageManager = context.getPackageManager();
    final List<ResolveInfo> intentActivities = packageManager.queryIntentActivities(surveyIntent, 0);
    if (intentActivities.size() == 0) {
        Log.w(LOGTAG, SurveyActivity.class.getName() + " is not registered as an activity in your application, so surveys can't be shown.");
        Log.i(LOGTAG, "Please add the child tag <activity android:name=\"com.mixpanel.android.surveys.SurveyActivity\" /> to your <application> tag.");
        return false;
    }

    return true;
}
 
開發者ID:benbek,項目名稱:HereAStory-Android,代碼行數:21,代碼來源:ConfigurationChecker.java

示例3: checkSurveyActivityAvailable

import com.mixpanel.android.surveys.SurveyActivity; //導入依賴的package包/類
public static boolean checkSurveyActivityAvailable(Context paramContext)
{
  Intent localIntent = new Intent(paramContext, SurveyActivity.class);
  localIntent.addFlags(268435456);
  localIntent.addFlags(131072);
  return paramContext.getPackageManager().queryIntentActivities(localIntent, 0).size() != 0;
}
 
開發者ID:mmmsplay10,項目名稱:QuizUpWinner,代碼行數:8,代碼來源:ConfigurationChecker.java

示例4: showGivenOrAvailableSurvey

import com.mixpanel.android.surveys.SurveyActivity; //導入依賴的package包/類
private void showGivenOrAvailableSurvey(final Survey surveyOrNull, final Activity parent) {
    // Showing surveys is not supported before Jelly Bean
    if (Build.VERSION.SDK_INT < MPConfig.UI_FEATURES_MIN_API) {
        if (MPConfig.DEBUG) {
            Log.v(LOGTAG, "Will not show survey, os version is too low.");
        }
        return;
    }

    if (! ConfigurationChecker.checkSurveyActivityAvailable(parent.getApplicationContext())) {
        if (MPConfig.DEBUG) {
            Log.v(LOGTAG, "Will not show survey, application isn't configured appropriately.");
        }
        return;
    }

    BackgroundCapture.OnBackgroundCapturedListener listener = null;
    final ReentrantLock lock = UpdateDisplayState.getLockObject();
    lock.lock();
    try {
        if (UpdateDisplayState.hasCurrentProposal()) {
            return; // Already being used.
        }
        Survey toShow = surveyOrNull;
        if (null == toShow) {
            toShow = getSurveyIfAvailable();
        }
        if (null == toShow) {
            return; // Nothing to show
        }

        final UpdateDisplayState.DisplayState.SurveyState surveyDisplay =
                new UpdateDisplayState.DisplayState.SurveyState(toShow);

        final int intentId = UpdateDisplayState.proposeDisplay(surveyDisplay, getDistinctId(), mToken);
        if (intentId <= 0) {
            Log.e(LOGTAG, "DisplayState Lock is in an inconsistent state! Please report this issue to Mixpanel");
            return;
        }

        listener = new BackgroundCapture.OnBackgroundCapturedListener() {
            @Override
            public void onBackgroundCaptured(Bitmap bitmapCaptured, int highlightColorCaptured) {
                surveyDisplay.setBackground(bitmapCaptured);
                surveyDisplay.setHighlightColor(highlightColorCaptured);

                final Intent surveyIntent = new Intent(parent.getApplicationContext(), SurveyActivity.class);
                surveyIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                surveyIntent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
                surveyIntent.putExtra(SurveyActivity.INTENT_ID_KEY, intentId);
                parent.startActivity(surveyIntent);
            }
        };
    } finally {
        lock.unlock();
    }

    BackgroundCapture.captureBackground(parent, listener);
}
 
開發者ID:perludem,項目名稱:DPR-KITA,代碼行數:60,代碼來源:MixpanelAPI.java

示例5: showGivenOrAvailableSurvey

import com.mixpanel.android.surveys.SurveyActivity; //導入依賴的package包/類
private void showGivenOrAvailableSurvey(final Survey surveyOrNull, final Activity parent) {
    // Showing surveys is not supported before Ice Cream Sandwich
    if (Build.VERSION.SDK_INT < 14) {
        return;
    }

    if (! ConfigurationChecker.checkSurveyActivityAvailable(parent.getApplicationContext())) {
        return;
    }

    BackgroundCapture.OnBackgroundCapturedListener listener = null;
    final ReentrantLock lock = UpdateDisplayState.getLockObject();
    lock.lock();
    try {
        if (UpdateDisplayState.hasCurrentProposal()) {
            return; // Already being used.
        }
        Survey toShow = surveyOrNull;
        if (null == toShow) {
            toShow = getSurveyIfAvailable();
        }
        if (null == toShow) {
            return; // Nothing to show
        }

        final UpdateDisplayState.DisplayState.SurveyState surveyDisplay =
                new UpdateDisplayState.DisplayState.SurveyState(toShow);

        final int intentId = UpdateDisplayState.proposeDisplay(surveyDisplay, getDistinctId(), mToken);
        if (intentId <= 0) {
            Log.e(LOGTAG, "DisplayState Lock is in an inconsistent state! Please report this issue to Mixpanel");
            return;
        }

        listener = new BackgroundCapture.OnBackgroundCapturedListener() {
            @Override
            public void onBackgroundCaptured(Bitmap bitmapCaptured, int highlightColorCaptured) {
                surveyDisplay.setBackground(bitmapCaptured);
                surveyDisplay.setHighlightColor(highlightColorCaptured);

                final Intent surveyIntent = new Intent(parent.getApplicationContext(), SurveyActivity.class);
                surveyIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                surveyIntent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
                surveyIntent.putExtra(SurveyActivity.INTENT_ID_KEY, intentId);
                parent.startActivity(surveyIntent);
            }
        };
    } finally {
        lock.unlock();
    }

    BackgroundCapture.captureBackground(parent, listener);
}
 
開發者ID:benbek,項目名稱:HereAStory-Android,代碼行數:54,代碼來源:MixpanelAPI.java


注:本文中的com.mixpanel.android.surveys.SurveyActivity類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。