-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 4d1497b
Showing
19 changed files
with
989 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
*.swp | ||
.gradle | ||
.idea | ||
build | ||
local.properties | ||
gradle.properties |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
PACKAGE = de.markusfisch.android.pielauncher | ||
APK = app/build/outputs/apk/app-debug.apk | ||
|
||
all: debug install start | ||
|
||
debug: | ||
./gradlew assembleDebug | ||
|
||
lint: | ||
./gradlew lintDebug | ||
|
||
findbugs: | ||
./gradlew findBugs | ||
|
||
release: | ||
@./gradlew \ | ||
assembleRelease \ | ||
-Pandroid.injected.signing.store.file=$(ANDROID_KEYFILE) \ | ||
-Pandroid.injected.signing.store.password=$(ANDROID_STORE_PASSWORD) \ | ||
-Pandroid.injected.signing.key.alias=$(ANDROID_KEY_ALIAS) \ | ||
-Pandroid.injected.signing.key.password=$(ANDROID_KEY_PASSWORD) | ||
|
||
install: | ||
adb $(TARGET) install -r $(APK) | ||
|
||
start: | ||
adb $(TARGET) shell 'am start -n $(PACKAGE)/.activity.HomeActivity' | ||
|
||
uninstall: | ||
adb $(TARGET) uninstall $(PACKAGE) | ||
|
||
clean: | ||
./gradlew clean |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
apply plugin: 'com.android.application' | ||
apply plugin: 'findbugs' | ||
|
||
android { | ||
compileSdkVersion 24 | ||
buildToolsVersion "23.0.3" | ||
|
||
defaultConfig { | ||
minSdkVersion 9 | ||
targetSdkVersion 24 | ||
} | ||
} | ||
|
||
dependencies { | ||
compile 'com.android.support:appcompat-v7:24.0.0' | ||
} | ||
|
||
task findbugs(type: FindBugs, dependsOn: assembleDebug) { | ||
excludeFilter = file('./findbugs-exclude.xml') | ||
source = fileTree('src/main/java/') | ||
classes = files("${project.rootDir}/app/build/intermediates/classes") | ||
classpath = files() | ||
|
||
effort = 'max' | ||
|
||
reports { | ||
xml.enabled = false | ||
html.enabled = true | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<FindBugsFilter> | ||
<Match> | ||
<Class name="~.*R\$.*"/> | ||
</Match> | ||
<Match> | ||
<Class name="~.*Manifest\$.*"/> | ||
</Match> | ||
<Match> | ||
<Class name="~.android.support.*"/> | ||
</Match> | ||
</FindBugsFilter> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<manifest | ||
xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
package="de.markusfisch.android.pielauncher" | ||
android:versionCode="1" | ||
android:versionName="0.0.0" | ||
android:installLocation="auto"> | ||
<supports-screens | ||
android:resizeable="true" | ||
android:smallScreens="true" | ||
android:normalScreens="true" | ||
android:largeScreens="true" | ||
android:xlargeScreens="true" | ||
android:anyDensity="true"/> | ||
<application | ||
tools:ignore="UnusedAttribute" | ||
android:allowBackup="true" | ||
android:fullBackupContent="true" | ||
android:label="@string/app_name" | ||
android:theme="@style/AppTheme"> | ||
<activity | ||
android:name=".activity.HomeActivity" | ||
android:label="@string/app_name" | ||
android:theme="@style/HomeTheme"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN"/> | ||
<category android:name="android.intent.category.DEFAULT"/> | ||
<category android:name="android.intent.category.HOME"/> | ||
</intent-filter> | ||
</activity> | ||
</application> | ||
</manifest> |
65 changes: 65 additions & 0 deletions
65
app/src/main/java/de/markusfisch/android/pielauncher/activity/HomeActivity.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
package de.markusfisch.android.pielauncher.activity; | ||
|
||
import de.markusfisch.android.pielauncher.content.AppMenu; | ||
import de.markusfisch.android.pielauncher.widget.PieLauncherSurfaceView; | ||
|
||
import android.annotation.TargetApi; | ||
import android.app.Activity; | ||
import android.os.Bundle; | ||
import android.os.Build; | ||
import android.view.View; | ||
import android.view.Window; | ||
|
||
public class HomeActivity extends Activity | ||
{ | ||
private PieLauncherSurfaceView surfaceView; | ||
|
||
@Override | ||
public void onBackPressed() | ||
{ | ||
// ignore back on home screen | ||
} | ||
|
||
@Override | ||
protected void onCreate( Bundle state ) | ||
{ | ||
super.onCreate( state ); | ||
|
||
surfaceView = new PieLauncherSurfaceView( | ||
new AppMenu( this ) ); | ||
|
||
setContentView( surfaceView ); | ||
setTransparentSystemBars( getWindow() ); | ||
} | ||
|
||
@Override | ||
protected void onResume() | ||
{ | ||
super.onResume(); | ||
surfaceView.onResume(); | ||
} | ||
|
||
@Override | ||
protected void onPause() | ||
{ | ||
super.onPause(); | ||
surfaceView.onPause(); | ||
} | ||
|
||
@TargetApi( Build.VERSION_CODES.LOLLIPOP ) | ||
private static boolean setTransparentSystemBars( Window window ) | ||
{ | ||
if( window == null || | ||
Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP ) | ||
return false; | ||
|
||
window.getDecorView().setSystemUiVisibility( | ||
View.SYSTEM_UI_FLAG_LAYOUT_STABLE | | ||
View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | | ||
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN ); | ||
window.setStatusBarColor( 0 ); | ||
window.setNavigationBarColor( 0 ); | ||
|
||
return true; | ||
} | ||
} |
95 changes: 95 additions & 0 deletions
95
app/src/main/java/de/markusfisch/android/pielauncher/content/AppMenu.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
package de.markusfisch.android.pielauncher.content; | ||
|
||
import android.content.Context; | ||
import android.content.pm.PackageInfo; | ||
import android.content.pm.PackageManager; | ||
import android.content.Intent; | ||
import android.graphics.Canvas; | ||
import android.graphics.drawable.Drawable; | ||
|
||
import java.util.List; | ||
|
||
public class AppMenu extends PieMenu | ||
{ | ||
private Context context; | ||
|
||
public AppMenu( Context context ) | ||
{ | ||
this.context = context; | ||
load(); | ||
} | ||
|
||
public Context getContext() | ||
{ | ||
return context; | ||
} | ||
|
||
public void fire() | ||
{ | ||
if( selectedIcon > -1 ) | ||
((AppMenu.Icon)icons.get( selectedIcon )).launch( context ); | ||
} | ||
|
||
private void load() | ||
{ | ||
icons.clear(); | ||
|
||
PackageManager pm = context.getPackageManager(); | ||
List<PackageInfo> packs = pm.getInstalledPackages( 0 ); | ||
|
||
for( int n = 0, len = packs.size(); | ||
n < len; | ||
++n ) | ||
{ | ||
PackageInfo p = packs.get( n ); | ||
Intent intent; | ||
|
||
if( p == null || | ||
(intent = pm.getLaunchIntentForPackage( | ||
p.packageName )) == null ) | ||
continue; | ||
|
||
Icon icon = new Icon(); | ||
|
||
icon.appName = p.applicationInfo.loadLabel( pm ).toString(); | ||
icon.packageName = p.packageName; | ||
icon.icon = p.applicationInfo.loadIcon( pm ); | ||
icon.intent = intent; | ||
|
||
icons.add( icon ); | ||
} | ||
|
||
numberOfIcons = icons.size(); | ||
} | ||
|
||
public static class Icon extends PieMenu.Icon | ||
{ | ||
public String appName; | ||
public String packageName; | ||
public Drawable icon; | ||
public Intent intent; | ||
|
||
public void launch( Context context ) | ||
{ | ||
if( intent == null ) | ||
return; | ||
|
||
context.startActivity( intent ); | ||
} | ||
|
||
public void draw( Canvas canvas ) | ||
{ | ||
int s = ((int)size)>>1<<1; | ||
|
||
if( s < 1 ) | ||
return; | ||
|
||
int half = s/2; | ||
int left = x-half; | ||
int top = y-half; | ||
|
||
icon.setBounds( left, top, left+s, top+s ); | ||
icon.draw( canvas ); | ||
} | ||
} | ||
} |
Oops, something went wrong.