Skip to content
This repository has been archived by the owner on Jan 6, 2019. It is now read-only.

Landscape #104

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .idea/copyright/Apache2.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions .idea/copyright/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 19 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,26 @@
/*
* Copyright (c) 2015-2017 Hayai Software
*
* 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.
*/

apply plugin: 'com.android.application'

android {
compileSdkVersion 25
buildToolsVersion '25.0.2'
buildToolsVersion '25.0.3'
defaultConfig {
applicationId 'com.hayaisoftware.launcher'
minSdkVersion 15
targetSdkVersion 22
targetSdkVersion 25
versionCode 10405
versionName "1.4.5"
}
Expand All @@ -18,10 +32,12 @@ android {
'proguard-rules.txt'
}
}
dependencies {
compile 'com.android.support:support-annotations:25.3.1'
}
productFlavors {
}
}

dependencies {

}
3 changes: 0 additions & 3 deletions app/lint.xml

This file was deleted.

26 changes: 18 additions & 8 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,26 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (c) 2015-2017 Hayai Software
~
~ 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.
-->

<manifest
xmlns:tools="http://schemas.android.com/tools"
package="com.hayaisoftware.launcher"
xmlns:android="http://schemas.android.com/apk/res/android">

<uses-sdk
android:minSdkVersion="15"
android:targetSdkVersion="22" />

<!-- <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> -->

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppBaseTheme" >
android:theme="@style/AppBaseTheme"
android:resizeableActivity="true"
tools:targetApi="n">

<activity
android:name="com.hayaisoftware.launcher.activities.SearchActivity"
android:alwaysRetainTaskState="true"
android:label="@string/title_activity_search"
android:launchMode="singleTask"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustResize"
>

Expand Down
24 changes: 10 additions & 14 deletions app/src/main/java/com/hayaisoftware/launcher/ImageLoadingTask.java
Original file line number Diff line number Diff line change
@@ -1,23 +1,21 @@
/* Copyright 2015 Hayai Software
/*
* Copyright (c) 2015-2017 Hayai Software
*
* 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
* 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
* 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.hayaisoftware.launcher;

import android.app.Activity;
import android.content.Context;
import android.content.pm.PackageManager;
import android.graphics.drawable.Drawable;
import android.widget.ImageView;

Expand All @@ -38,7 +36,7 @@ public ImageLoadingTask(final ImageView imageView, final LaunchableActivity laun

public boolean doTask() {
final Drawable activityIcon =
mLaunchableActivity.getActivityIcon(mSharedData.mPackageManager, mSharedData.mContext,
mLaunchableActivity.getActivityIcon(mSharedData.mContext,
mSharedData.mIconSizePixels);
mSharedData.mActivity.runOnUiThread(new Runnable() {

Expand All @@ -53,14 +51,12 @@ public void run() {

public static class SharedData {
private final Activity mActivity;
private final PackageManager mPackageManager;
private final Context mContext;
private final int mIconSizePixels;

public SharedData(final Activity activity, final PackageManager packageManager,
final Context context, final int iconSizePixels) {
public SharedData(final Activity activity, final Context context,
final int iconSizePixels) {
this.mActivity = activity;
this.mPackageManager = packageManager;
this.mContext = context;
this.mIconSizePixels = iconSizePixels;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
/* Copyright 2015 Hayai Software
/*
* Copyright (c) 2015-2017 Hayai Software
*
* 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
* 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
* 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.
*/

Expand All @@ -25,13 +24,15 @@
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.support.annotation.DrawableRes;

import com.hayaisoftware.launcher.util.ContentShare;


public class LaunchableActivity{

private final ActivityInfo mActivityInfo;
@DrawableRes
private final int mIconResource;
private final String mActivityLabel;
private final ComponentName mComponentName;
private Intent mLaunchIntent;
Expand All @@ -43,18 +44,19 @@ public class LaunchableActivity{

public LaunchableActivity(final ActivityInfo activityInfo, final String activityLabel,
final boolean isShareable) {
this.mActivityInfo = activityInfo;
mIconResource = activityInfo.getIconResource();
this.mActivityLabel = activityLabel;
mComponentName = new ComponentName(activityInfo.packageName, activityInfo.name);
this.mShareable = isShareable;
}

public LaunchableActivity(final ComponentName componentName, final String label,
final Drawable activityIcon, final Intent launchIntent){
this.mComponentName = componentName;
this.mActivityLabel = label;
this.mLaunchIntent = launchIntent;
this.mActivityIcon = activityIcon;
this.mActivityInfo = null;
mIconResource = -1;
}

public Intent getLaunchIntent(final String searchString) {
Expand Down Expand Up @@ -104,18 +106,27 @@ public synchronized void deleteActivityIcon(){
mActivityIcon=null;
}

public synchronized Drawable getActivityIcon(final PackageManager pm, final Context context,
final int iconSizePixels) {
public synchronized Drawable getActivityIcon(final Context context, final int iconSizePixels) {
if (!isIconLoaded()) {
Drawable _activityIcon = null;
final ActivityManager activityManager =
(ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
final int iconDpi = activityManager.getLauncherLargeIconDensity();
try {
final PackageManager pm = context.getPackageManager();
final Resources resources = pm.getResourcesForActivity(mComponentName);
@DrawableRes
final int iconRes;

if (mIconResource == -1) {
iconRes = pm.getActivityInfo(mComponentName, 0).getIconResource();
} else {
iconRes = mIconResource;
}

//noinspection deprecation
_activityIcon =
pm.getResourcesForActivity(mComponentName).getDrawableForDensity(
mActivityInfo.getIconResource(), iconDpi);
resources.getDrawableForDensity(iconRes, iconDpi);

} catch (PackageManager.NameNotFoundException | Resources.NotFoundException e) {
//if we get here, there's no icon to load.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
/* Copyright 2015 Hayai Software
/*
* Copyright (c) 2015-2017 Hayai Software
*
* 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
* 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
* 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.
*/

Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
/* Copyright 2015 Hayai Software
/*
* Copyright (c) 2015-2017 Hayai Software
*
* 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
* 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
* 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.
*/

Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
/* Copyright 2015 Hayai Software
/*
* Copyright (c) 2015-2017 Hayai Software
*
* 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
* 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
* 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.
*/

Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
/* Copyright 2015 Hayai Software
/*
* Copyright (c) 2015-2017 Hayai Software
*
* 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
* 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
* 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.
*/

Expand Down
Loading