Search in sources :

Example 36 with CardView

use of android.support.v7.widget.CardView in project Rashr by DsLNeXuS.

the class FlashFragment method FlashSupportedKernel.

/**
     * Flash Kernels provided by Rashr like stock kernels for Nexus Devices
     *
     * @param card CardView that contains the Kernel type should be flashed for example: stock,
     *             bricked...
     */
public void FlashSupportedKernel(Card card) {
    final File path;
    final ArrayList<String> Versions;
    ArrayAdapter<String> VersionsAdapter = new ArrayAdapter<>(mContext, R.layout.custom_list_item);
    /**
         * If there files be needed to flash download it and listing device specified recovery
         * file for example stock-boot-grouper-4.4.img (read out from kernel_sums)
         */
    String SYSTEM = card.getData().toString();
    if (SYSTEM.equals(Device.KER_SYS_STOCK)) {
        Versions = RashrApp.DEVICE.getStockKernelVersions();
        path = Const.PathToStockKernel;
        for (String i : Versions) {
            try {
                String version = i.split("-")[3].replace(RashrApp.DEVICE.getRecoveryExt(), "");
                String deviceName = i.split("-")[2];
                /** Readable name for user */
                VersionsAdapter.add("Stock Kernel " + version + " (" + deviceName + ")");
            } catch (ArrayIndexOutOfBoundsException e) {
                /** Add the normal filename if something went wrong */
                VersionsAdapter.add(i);
            }
        }
    } else {
        /** Only stock kernel is supported at the moment, why are you here?
             * Something went wrong better return :)
             */
        return;
    }
    final AlertDialog.Builder KernelDialog = new AlertDialog.Builder(mContext);
    KernelDialog.setTitle(SYSTEM);
    KernelDialog.setAdapter(VersionsAdapter, new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            final File kernel = new File(path, Versions.get(which));
            if (!kernel.exists()) {
                try {
                    URL url = new URL(Const.KERNEL_URL + "/" + kernel.getName());
                    Downloader downloader = new Downloader(url, kernel);
                    final DownloadDialog KernelDownloader = new DownloadDialog(mContext, downloader);
                    KernelDownloader.setOnDownloadListener(new DownloadDialog.OnDownloadListener() {

                        @Override
                        public void onSuccess(File file) {
                            flashKernel(file);
                        }

                        @Override
                        public void onFail(Exception e) {
                            KernelDownloader.retry();
                        }
                    });
                    KernelDownloader.setAskBeforeDownload(true);
                    downloader.setChecksumFile(Const.KernelCollectionFile);
                    KernelDownloader.ask();
                } catch (MalformedURLException ignored) {
                }
            } else {
                flashKernel(kernel);
            }
        }
    });
    KernelDialog.show();
//}
}
Also used : AlertDialog(android.support.v7.app.AlertDialog) MalformedURLException(java.net.MalformedURLException) DialogInterface(android.content.DialogInterface) Downloader(de.mkrtchyan.utils.Downloader) DownloadDialog(de.mkrtchyan.utils.DownloadDialog) SuppressLint(android.annotation.SuppressLint) URL(java.net.URL) MalformedURLException(java.net.MalformedURLException) IOException(java.io.IOException) File(java.io.File) ArrayAdapter(android.widget.ArrayAdapter)

Example 37 with CardView

use of android.support.v7.widget.CardView in project android_frameworks_base by DirtyUnicorns.

the class RecentsTvView method launchTaskFomRecents.

/**
     * Launch the given task from recents with animation. If the task is not focused, this will
     * attempt to scroll to focus the task before launching.
     * @param task
     */
private void launchTaskFomRecents(final Task task, boolean animate) {
    if (!animate) {
        SystemServicesProxy ssp = Recents.getSystemServices();
        ssp.startActivityFromRecents(getContext(), task.key, task.title, null);
        return;
    }
    mTaskStackHorizontalView.requestFocus();
    Task focusedTask = mTaskStackHorizontalView.getFocusedTask();
    if (focusedTask != null && task != focusedTask) {
        if (mScrollListener != null) {
            mTaskStackHorizontalView.removeOnScrollListener(mScrollListener);
        }
        mScrollListener = new OnScrollListener() {

            @Override
            public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
                super.onScrollStateChanged(recyclerView, newState);
                if (newState == RecyclerView.SCROLL_STATE_IDLE) {
                    TaskCardView cardView = mTaskStackHorizontalView.getChildViewForTask(task);
                    if (cardView != null) {
                        mTransitionHelper.launchTaskFromRecents(mStack, task, mTaskStackHorizontalView, cardView, null, INVALID_STACK_ID);
                    } else {
                        // This should not happen normally. If this happens then the data in
                        // the grid view was altered during the scroll. Log error and launch
                        // task with no animation.
                        Log.e(TAG, "Card view for task : " + task + ", returned null.");
                        SystemServicesProxy ssp = Recents.getSystemServices();
                        ssp.startActivityFromRecents(getContext(), task.key, task.title, null);
                    }
                    mTaskStackHorizontalView.removeOnScrollListener(mScrollListener);
                }
            }
        };
        mTaskStackHorizontalView.addOnScrollListener(mScrollListener);
        mTaskStackHorizontalView.setSelectedPositionSmooth(((TaskStackHorizontalViewAdapter) mTaskStackHorizontalView.getAdapter()).getPositionOfTask(task));
    } else {
        mTransitionHelper.launchTaskFromRecents(mStack, task, mTaskStackHorizontalView, mTaskStackHorizontalView.getChildViewForTask(task), null, INVALID_STACK_ID);
    }
}
Also used : SystemServicesProxy(com.android.systemui.recents.misc.SystemServicesProxy) Task(com.android.systemui.recents.model.Task) OnScrollListener(android.support.v7.widget.RecyclerView.OnScrollListener) RecyclerView(android.support.v7.widget.RecyclerView)

Example 38 with CardView

use of android.support.v7.widget.CardView in project dobby-android by InceptAi.

the class WifiDocMainFragment method fetchViewInstances.

private void fetchViewInstances(View rootView) {
    mainFab = (FloatingActionButton) rootView.findViewById(R.id.main_fab_button);
    mainFab.setOnClickListener(this);
    yourNetworkCv = (CardView) rootView.findViewById(R.id.net_cardview);
    pingCv = (CardView) rootView.findViewById(R.id.ping_cardview);
    statusCv = (CardView) rootView.findViewById(R.id.status_cardview);
    View downloadView = rootView.findViewById(R.id.cg_download);
    downloadCircularGauge = (CircularGauge) downloadView.findViewById(R.id.bw_gauge);
    downloadGaugeTv = (TextView) downloadView.findViewById(R.id.gauge_tv);
    downloadGaugeTitleTv = (TextView) downloadView.findViewById(R.id.title_tv);
    downloadGaugeTitleTv.setText(R.string.download_bw);
    View uploadView = rootView.findViewById(R.id.cg_upload);
    uploadCircularGauge = (CircularGauge) uploadView.findViewById(R.id.bw_gauge);
    uploadGaugeTv = (TextView) uploadView.findViewById(R.id.gauge_tv);
    uploadGaugeTitleTv = (TextView) uploadView.findViewById(R.id.title_tv);
    uploadGaugeTitleTv.setText(R.string.upload_bw);
    View row1View = rootView.findViewById(R.id.ping_latency_row_inc1);
    pingRouterTitleTv = (TextView) row1View.findViewById(R.id.left_title_tv);
    pingRouterValueTv = (TextView) row1View.findViewById(R.id.left_value_tv);
    pingRouterGradeIv = (ImageView) row1View.findViewById(R.id.left_grade_iv);
    pingWebTitleTv = (TextView) row1View.findViewById(R.id.right_title_tv);
    pingWebValueTv = (TextView) row1View.findViewById(R.id.right_value_tv);
    pingWebGradeIv = (ImageView) row1View.findViewById(R.id.right_grade_iv);
    View row2View = rootView.findViewById(R.id.ping_latency_row_inc2);
    pingDnsPrimaryTitleTv = (TextView) row2View.findViewById(R.id.left_title_tv);
    pingDnsPrimaryValueTv = (TextView) row2View.findViewById(R.id.left_value_tv);
    pingDnsPrimaryGradeIv = (ImageView) row2View.findViewById(R.id.left_grade_iv);
    pingDnsSecondTitleTv = (TextView) row2View.findViewById(R.id.right_title_tv);
    pingDnsSecondValueTv = (TextView) row2View.findViewById(R.id.right_value_tv);
    pingDnsSecondGradeIv = (ImageView) row2View.findViewById(R.id.right_grade_iv);
    pingRouterTitleTv.setText(R.string.router_ping);
    pingDnsPrimaryTitleTv.setText(R.string.dns_primary_ping);
    pingDnsSecondTitleTv.setText(R.string.dns_second_ping);
    pingWebTitleTv.setText(R.string.web_ping);
    // Populate wifi card views
    wifiSsidTv = (TextView) rootView.findViewById(R.id.wifi_ssid_tv);
    wifiSignalValueTv = (TextView) rootView.findViewById(R.id.value_tv);
    wifiSignalIconIv = (ImageView) rootView.findViewById(R.id.icon_iv);
    ispNameTv = (TextView) rootView.findViewById(R.id.isp_name_tv);
    routerIpTv = (TextView) rootView.findViewById(R.id.router_ip_tv);
    statusTv = (TextView) rootView.findViewById(R.id.status_tv);
    aboutLayout = (LinearLayout) rootView.findViewById(R.id.about_ll);
    feedbackLayout = (LinearLayout) rootView.findViewById(R.id.feedback_ll);
    aboutLayout.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            showAboutAndPrivacyPolicy();
        }
    });
    feedbackLayout.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            showFeedbackForm();
        }
    });
// suggestionsValueTv = (TextView)rootView.findViewById(R.id.suggestion_value_tv);
}
Also used : ImageView(android.widget.ImageView) View(android.view.View) CardView(android.support.v7.widget.CardView) TextView(android.widget.TextView)

Aggregations

CardView (android.support.v7.widget.CardView)30 View (android.view.View)26 TextView (android.widget.TextView)24 ImageView (android.widget.ImageView)10 IconicsImageView (com.mikepenz.iconics.view.IconicsImageView)10 DialogInterface (android.content.DialogInterface)9 AlertDialog (android.support.v7.app.AlertDialog)9 RecyclerView (android.support.v7.widget.RecyclerView)9 ScrollView (android.widget.ScrollView)8 OnScrollListener (android.support.v7.widget.RecyclerView.OnScrollListener)5 SystemServicesProxy (com.android.systemui.recents.misc.SystemServicesProxy)5 Task (com.android.systemui.recents.model.Task)5 Intent (android.content.Intent)3 Nullable (android.support.annotation.Nullable)3 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)3 EditText (android.widget.EditText)3 SeekBar (android.widget.SeekBar)3 NonNull (android.support.annotation.NonNull)2 SwitchCompat (android.support.v7.widget.SwitchCompat)2 CompoundButton (android.widget.CompoundButton)2