Skip to content
This repository has been archived by the owner on Feb 3, 2020. It is now read-only.

Refactor startFloatingViewService method #95

Merged
merged 1 commit into from
Oct 4, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.app.Activity;
import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.content.res.Configuration;
Expand Down Expand Up @@ -155,14 +156,9 @@ private static void startFloatingViewService(Activity activity, boolean isCustom
}

// launch service
if (isCustomFloatingView) {
final Intent intent = new Intent(activity, CustomFloatingViewService.class);
intent.putExtra(CustomFloatingViewService.EXTRA_CUTOUT_SAFE_AREA, FloatingViewManager.findCutoutSafeArea(activity));
ContextCompat.startForegroundService(activity, intent);
} else {
final Intent intent = new Intent(activity, ChatHeadService.class);
intent.putExtra(ChatHeadService.EXTRA_CUTOUT_SAFE_AREA, FloatingViewManager.findCutoutSafeArea(activity));
ContextCompat.startForegroundService(activity, intent);
}
final Class<? extends Service> service = isCustomFloatingView ? CustomFloatingViewService.class : ChatHeadService.class;
final Intent intent = new Intent(activity, service);
intent.putExtra(CustomFloatingViewService.EXTRA_CUTOUT_SAFE_AREA, FloatingViewManager.findCutoutSafeArea(activity));
ContextCompat.startForegroundService(activity, intent);
}
}