OSDN Git Service

Add "tb_" prefix to all resources
[android-x86/packages-apps-Taskbar.git] / app / src / playstore / java / com / farmerbb / taskbar / util / DependencyUtils.java
1 /* Copyright 2017 Braden Farmer
2  *
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
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
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.
14  */
15
16 package com.farmerbb.taskbar.util;
17
18 import android.content.Context;
19 import android.content.Intent;
20 import android.os.Build;
21
22 import com.farmerbb.taskbar.R;
23 import com.farmerbb.taskbar.activity.TaskerConditionActivity;
24 import com.mikepenz.iconics.Iconics;
25
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.
29
30 public class DependencyUtils {
31
32     private DependencyUtils() {}
33
34     public static CharSequence getKeyboardShortcutSummary(Context context) {
35         return new Iconics.IconicsBuilder()
36                 .ctx(context)
37                 .on(context.getString(R.string.tb_pref_description_keyboard_shortcut))
38                 .build();
39     }
40
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);
44         else
45             return new ToastCompatImpl(context, message, length);
46     }
47
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);
52     }
53 }