Home | History | Annotate | Download | only in calllog
      1 /*
      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 
     17 package com.android.dialer.calllog;
     18 
     19 import android.content.Context;
     20 import android.content.Intent;
     21 import android.support.v7.widget.RecyclerView;
     22 import android.view.LayoutInflater;
     23 import android.view.View;
     24 import android.view.ViewGroup;
     25 
     26 import com.android.dialer.R;
     27 
     28 public final class ShowCallHistoryViewHolder extends RecyclerView.ViewHolder {
     29 
     30     private ShowCallHistoryViewHolder(final Context context, View view) {
     31         super(view);
     32         view.setOnClickListener(new View.OnClickListener() {
     33             @Override
     34             public void onClick(View v) {
     35                 final Intent intent = new Intent(context, CallLogActivity.class);
     36                 context.startActivity(intent);
     37             }
     38         });
     39     }
     40 
     41     public static ShowCallHistoryViewHolder create(Context context, ViewGroup parent) {
     42         LayoutInflater inflater = LayoutInflater.from(context);
     43         View view = inflater.inflate(R.layout.show_call_history_list_item, parent, false);
     44         return new ShowCallHistoryViewHolder(context, view);
     45     }
     46 }
     47