This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example.scalpeldrawer; | |
import android.app.Activity; | |
import android.content.Context; | |
import android.support.v4.widget.DrawerLayout; | |
import android.util.AttributeSet; | |
import android.view.LayoutInflater; | |
import android.view.View; | |
import android.view.ViewGroup; | |
import android.widget.CheckBox; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Copyright (C) 2006 The Android Open Source Project | |
* | |
* 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- You can change the parent around to whatever you normally use --> | |
<style name="DebugColors" parent="Theme.AppCompat"> | |
<!-- System colors --> | |
<item name="android:windowBackground">@color/__debugWindowBackground</item> | |
<item name="android:colorPressedHighlight">#FF4400</item> | |
<item name="android:colorLongPressedHighlight">#FF0044</item> | |
<item name="android:colorFocusedHighlight">#44FF00</item> | |
<item name="android:colorActivatedHighlight">#00FF44</item> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@TargetApi(Build.VERSION_CODES.LOLLIPOP) | |
public static String getForegroundProcess(Context context) { | |
String topPackageName = null; | |
UsageStatsManager usage = (UsageStatsManager) context.getSystemService(Context.USAGE_STATS_SERVICE); | |
long time = System.currentTimeMillis(); | |
List<UsageStats> stats = usage.queryUsageStats(UsageStatsManager.INTERVAL_DAILY, time - 1000*1000, time); | |
if (stats != null) { | |
SortedMap<Long, UsageStats> runningTask = new TreeMap<Long,UsageStats>(); | |
for (UsageStats usageStats : stats) { | |
runningTask.put(usageStats.getLastTimeUsed(), usageStats); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class BetterFileProvider extends android.support.v4.content.FileProvider { | |
@Override | |
public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) { | |
Cursor source = super.query(uri, projection, selection, selectionArgs, sortOrder); | |
String[] columnNames = source.getColumnNames(); | |
String[] newColumnNames = columnNamesWithData(columnNames); | |
MatrixCursor cursor = new MatrixCursor(newColumnNames, source.getCount()); |