1 /* Copyright 2017 Braden Farmer
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
7 * http://www.apache.org/licenses/LICENSE-2.0
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
16 package com.farmerbb.taskbar.util;
18 import android.content.Context;
19 import android.content.Intent;
20 import android.os.Build;
22 import com.farmerbb.taskbar.R;
23 import com.farmerbb.taskbar.activity.TaskerConditionActivity;
24 import com.mikepenz.iconics.Iconics;
26 // Utility class meant for abstracting out all third-party dependencies.
27 // This allows the Android-x86 version of Taskbar to be built purely from AOSP source.
28 // TODO Do not make changes to this file without making corresponding changes to the Android-x86 version.
30 public class DependencyUtils {
32 private DependencyUtils() {}
34 public static CharSequence getKeyboardShortcutSummary(Context context) {
35 return new Iconics.IconicsBuilder()
37 .on(context.getString(R.string.tb_pref_description_keyboard_shortcut))
41 static ToastInterface createToast(Context context, String message, int length) {
42 if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1)
43 return new ToastFrameworkImpl(context, message, length);
45 return new ToastCompatImpl(context, message, length);
48 public static void requestTaskerQuery(Context context) {
49 Intent query = new Intent(com.twofortyfouram.locale.api.Intent.ACTION_REQUEST_QUERY);
50 query.putExtra(com.twofortyfouram.locale.api.Intent.EXTRA_STRING_ACTIVITY_CLASS_NAME, TaskerConditionActivity.class.getName());
51 context.sendBroadcast(query);