Skip to content
This repository was archived by the owner on Jul 28, 2023. It is now read-only.

Commit b62203a

Browse files
committed
match parent for listview
1 parent f984978 commit b62203a

File tree

6 files changed

+26
-13
lines changed

6 files changed

+26
-13
lines changed

LaLauncher/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ android {
33
compileSdkVersion 26
44
defaultConfig {
55
applicationId 'com.github.postapczuk.lalauncher'
6-
minSdkVersion 22
6+
minSdkVersion 5
77
targetSdkVersion 26
88
versionCode 12
99
versionName '1.7.0'

LaLauncher/src/main/java/com/github/postapczuk/lalauncher/FavouriteAppsActivity.java

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import android.content.pm.ApplicationInfo;
1111
import android.content.pm.PackageManager;
1212
import android.content.pm.ResolveInfo;
13+
import android.os.Build;
1314
import android.os.Bundle;
1415
import android.os.Handler;
1516
import android.text.TextUtils;
@@ -50,8 +51,10 @@ protected void onResume() {
5051
@Override
5152
protected void onCreate(Bundle savedInstanceState) {
5253
super.onCreate(savedInstanceState);
53-
getWindow().getDecorView().setSystemUiVisibility(
54-
SYSTEM_UI_FLAG_LOW_PROFILE);
54+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
55+
getWindow().getDecorView().setSystemUiVisibility(
56+
SYSTEM_UI_FLAG_LOW_PROFILE);
57+
}
5558
getWindow().setFlags(
5659
FLAG_LAYOUT_NO_LIMITS,
5760
FLAG_LAYOUT_NO_LIMITS);
@@ -200,7 +203,10 @@ public void onBackPressed() {
200203
}
201204

202205
private void showFavouriteModal(ListView listView) {
203-
AlertDialog.Builder builder = new AlertDialog.Builder(this, android.R.style.Theme_DeviceDefault_Dialog_Alert);
206+
AlertDialog.Builder builder = new AlertDialog.Builder(this);
207+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) {
208+
builder = new AlertDialog.Builder(this, android.R.style.Theme_DeviceDefault_Dialog_Alert);
209+
}
204210
builder.setTitle("Add favorite app");
205211

206212
List<String> smallAdapter = new ArrayList<>();
@@ -247,9 +253,9 @@ private void loadListView(ListView listView) {
247253

248254
private void updateFavouritesInPreferences() {
249255
if (packageNames.isEmpty()) {
250-
preferences.edit().putString(FAVS, "").apply();
256+
preferences.edit().putString(FAVS, "").commit();
251257
} else {
252-
preferences.edit().putString(FAVS, TextUtils.join(SEPARATOR, packageNames)).apply();
258+
preferences.edit().putString(FAVS, TextUtils.join(SEPARATOR, packageNames)).commit();
253259
}
254260
}
255261

LaLauncher/src/main/java/com/github/postapczuk/lalauncher/InstalledAppsActivity.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
package com.github.postapczuk.lalauncher;
22

33
import android.annotation.SuppressLint;
4+
import android.annotation.TargetApi;
45
import android.app.Activity;
56
import android.content.ActivityNotFoundException;
67
import android.content.Intent;
78
import android.content.pm.PackageManager;
89
import android.content.pm.ResolveInfo;
910
import android.net.Uri;
11+
import android.os.Build;
1012
import android.os.Bundle;
1113
import android.os.Handler;
1214
import android.provider.Settings;
@@ -30,8 +32,10 @@ public class InstalledAppsActivity extends Activity {
3032

3133
@Override
3234
protected void onCreate(Bundle savedInstanceState) {
33-
this.getWindow().requestFeature(
34-
FEATURE_ACTIVITY_TRANSITIONS);
35+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
36+
this.getWindow().requestFeature(
37+
FEATURE_ACTIVITY_TRANSITIONS);
38+
}
3539
this.getWindow().setFlags(
3640
FLAG_LAYOUT_NO_LIMITS,
3741
FLAG_LAYOUT_NO_LIMITS);
@@ -107,6 +111,7 @@ private void onClickHandler(ListView listView) {
107111
});
108112
}
109113

114+
@TargetApi(Build.VERSION_CODES.GINGERBREAD)
110115
private void onLongPressHandler(ListView listView) {
111116
listView.setOnItemLongClickListener((parent, view, position, id) -> {
112117
toggleTextviewBackground(view, 350L);

LaLauncher/src/main/res/layout/activity_installed.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
android:layout_width="match_parent"
55
android:layout_height="match_parent"
66
android:orientation="vertical"
7-
android:backgroundTint="@color/colorBackgroundPrimary"
7+
android:background="@color/colorBackgroundPrimary"
88
tools:context=".InstalledAppsActivity">
99
<ListView
1010
android:id="@+id/mobile_list"

LaLauncher/src/main/res/layout/activity_listview.xml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,11 @@
44
android:id="@+id/label"
55
android:layout_width="fill_parent"
66
android:layout_height="fill_parent"
7-
android:paddingVertical="20dip"
7+
android:paddingTop="20dip"
8+
android:paddingBottom="20dip"
89
android:paddingLeft="60dip"
910
android:paddingRight="21dip"
11+
android:paddingStart="60dip"
12+
android:paddingEnd="21dip"
1013
android:textSize="21sp">
1114
</TextView>

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,11 @@ Get it on:
2323

2424
Android version
2525
===============
26-
Works with each Android version from 5.1 (API 22)
27-
Separate "epaper-ready" branch will handle versions from 2.1 (API 5)
26+
Works with each Android version from 2.0 (API 5)
2827

2928
### E-paper version
3029
One of the goals of the app is to provide smooth experience for older e-paper devices like Nook Simple Touch (NST).
31-
There is a separate development branch for this kind of devices.
30+
There is a separate development branch "epaper-ready" for this kind of devices.
3231
The latest apk will always be under [this](https://www.dropbox.com/s/ci677hmb2s1la5w/LaLauncher-e-paper-unsigned.apk?dl=1) url.
3332

3433
Free & Open Source

0 commit comments

Comments
 (0)