本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}