/*
 * Copyright (C) 2015 Willi Ye
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.kunalkene1797.blackboxkit.fragments.information;

import android.os.Bundle;

import com.kunalkene1797.blackboxkit.R;
import com.kunalkene1797.blackboxkit.elements.CardViewItem;
import com.kunalkene1797.blackboxkit.fragments.RecyclerViewFragment;
import com.kunalkene1797.blackboxkit.utils.Utils;
import com.kunalkene1797.blackboxkit.utils.kernel.Info;
/**
 * Created by willi on 20.12.14.
 */
public class KernelInformationFragment extends RecyclerViewFragment {

    private final String UPDATE_SOURCE = "http://kunalkene1797.in/downloads/";
    @Override
    public boolean showApplyOnBoot() {
        return false;
    }

    /**
     * called when we want to inflate the menu
     */

    @Override

    public void init(Bundle savedInstanceState) {

        super.init(savedInstanceState);

        CardViewItem.DCardView kernelVersionCard = new CardViewItem.DCardView();
        kernelVersionCard.setTitle(getString(R.string.kernel_version));
        kernelVersionCard.setDescription(Info.getKernelVersion());

        CardViewItem.DCardView deviceNameCard = new CardViewItem.DCardView();
        deviceNameCard.setTitle(getString(R.string.device_name));
        deviceNameCard.setDescription(Info.getDeviceName());

        CardViewItem.DCardView kernelUpdateCard = new CardViewItem.DCardView();
        kernelUpdateCard.setTitle(getString(R.string.update_version));
        kernelUpdateCard.setDescription(getString(R.string.update_version_information));
        kernelUpdateCard.setOnDCardListener(new CardViewItem.DCardView.OnDCardListener() {
            @Override
            public void onClick(CardViewItem.DCardView dCardView) {
                Utils.launchUrl(getActivity(), UPDATE_SOURCE);
            }
        });

        CardViewItem.DCardView cpuCard = new CardViewItem.DCardView();
        cpuCard.setTitle(getString(R.string.cpu_information));
        cpuCard.setDescription(Info.getCpuInfo());

        CardViewItem.DCardView memCard = new CardViewItem.DCardView();
        memCard.setTitle(getString(R.string.memory_information));
        memCard.setDescription(Info.getMemInfo());

        addView(kernelVersionCard);
        addView(deviceNameCard);
        addView(kernelUpdateCard);
        addView(cpuCard);
        addView(memCard);
    }

}

@@ -780,16 +780,77 @@
 ewItem;%0A
+import com.kunalkene1797.blackboxkit.elements.UsageCardView;%0A
 import c
@@ -951,19 +951,141 @@
 kit.
-utils.Utils
+fragments.kernel.CPUFragment;%0Aimport com.kunalkene1797.blackboxkit.utils.Utils;%0Aimport com.kunalkene1797.blackboxkit.utils.kernel.CPU
 ;%0Aim
@@ -1138,16 +1138,17 @@
 l.Info;%0A
+%0A
 /**%0A * C
@@ -1249,16 +1249,164 @@
 agment %7B
+%0A    private CardViewItem.DCardView mTempCard;%0A    private static CPUFragment cpuFragment;%0A    private static CPUFragment.GovernorPart governorPart;
 %0A%0A    pr
@@ -1478,16 +1478,17 @@
 oads/%22;%0A
+%0A
     @Ove
@@ -1565,72 +1565,8 @@
  %7D%0A%0A
-    /**%0A     * called when we want to inflate the menu%0A     */%0A%0A
     
@@ -1627,16 +1627,17 @@
 ate) %7B%0A%0A
+%0A
         
@@ -1667,16 +1667,55 @@
 eState);
+%0A        if (CPU.hasTemp()) tempInit();
 %0A%0A      
@@ -3082,32 +3082,60 @@
 eviceNameCard);%0A
+        addView(mTempCard);%0A
         addView(
@@ -3212,10 +3212,205 @@
 %0A    %7D%0A%0A
+    private void tempInit() %7B%0A        mTempCard = new CardViewItem.DCardView();%0A        mTempCard.setTitle(getString(R.string.cpu_temp));%0A        mTempCard.setDescription(CPU.getTemp());%0A%0A    %7D%0A%0A
 %7D%0A

Enable CPU Temperature in Dashboard Activity