blob: e06d6a52e004979df541c825e591671e9fed1c18 [file] [log] [blame]
Steve McKayfefcd702015-08-20 16:19:38 +00001/*
2 * Copyright (C) 2015 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package com.android.documentsui;
18
Ben Kwac4693342015-09-30 10:00:10 -070019import static com.android.internal.util.Preconditions.checkNotNull;
20
21import android.app.Activity;
Ben Kwa91923182015-08-27 16:06:33 -070022import android.content.Context;
Ben Kwac4693342015-09-30 10:00:10 -070023import android.support.design.widget.Snackbar;
24import android.view.View;
Ben Kwa91923182015-08-27 16:06:33 -070025
Steve McKay4d0255f2015-09-25 16:02:56 -070026/** @hide */
Steve McKayfefcd702015-08-20 16:19:38 +000027public final class Shared {
Steve McKay459bc2b2015-09-16 15:07:31 -070028 public static final boolean DEBUG = true;
Steve McKayfefcd702015-08-20 16:19:38 +000029 public static final String TAG = "Documents";
Steve McKay4d0255f2015-09-25 16:02:56 -070030 public static final String EXTRA_STACK = "com.android.documentsui.STACK";
Ben Kwa91923182015-08-27 16:06:33 -070031
32 /**
33 * Generates a formatted quantity string.
34 */
35 public static final String getQuantityString(Context context, int resourceId, int quantity) {
36 return context.getResources().getQuantityString(resourceId, quantity, quantity);
37 }
Ben Kwac4693342015-09-30 10:00:10 -070038
39 public static final Snackbar makeSnackbar(Activity activity, int messageId, int duration) {
40 return makeSnackbar(activity, activity.getResources().getText(messageId), duration);
41 }
42
43 public static final Snackbar makeSnackbar(Activity activity, CharSequence message, int duration)
44 {
45 final View view = checkNotNull(activity.findViewById(R.id.coordinator_layout));
46 return Snackbar.make(view, message, duration);
47 }
Steve McKayfefcd702015-08-20 16:19:38 +000048}