当前位置: 首页>>代码示例>>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;未经允许,请勿转载。