• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2017 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 package com.android.dialer.calllog.ui;
17 
18 import android.support.v7.widget.RecyclerView;
19 import android.view.View;
20 import android.widget.TextView;
21 import java.text.SimpleDateFormat;
22 import java.util.Locale;
23 
24 /** {@link RecyclerView.ViewHolder} for the new call log. */
25 final class NewCallLogViewHolder extends RecyclerView.ViewHolder {
26 
27   // TODO: Format correctly using current locale.
28   private final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm", Locale.US);
29 
30   private final TextView contactNameView;
31   private final TextView timestampView;
32 
NewCallLogViewHolder(View view)33   NewCallLogViewHolder(View view) {
34     super(view);
35     contactNameView = view.findViewById(R.id.contact_name);
36     timestampView = view.findViewById(R.id.timestamp);
37   }
38 
bind(long timestamp)39   void bind(long timestamp) {
40     contactNameView.setText("Contact Name Placeholder");
41     timestampView.setText(dateFormat.format(timestamp));
42   }
43 }
44