Skip to content

Commit 23e486d

Browse files
authored
Merge pull request #7 from jeffshee/1.3.2
1.3.2
2 parents f7b353f + 18d81a0 commit 23e486d

20 files changed

Lines changed: 598 additions & 91 deletions
0 Bytes
Binary file not shown.

app/build.gradle

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ android {
77
minSdkVersion 15
88
targetSdkVersion 28
99
versionCode 3
10-
versionName "1.3.1"
10+
versionName "1.3.2"
1111
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
1212
vectorDrawables.useSupportLibrary = true
1313
}
@@ -39,5 +39,4 @@ dependencies {
3939
implementation 'com.google.code.gson:gson:2.8.5'
4040
implementation 'org.jsoup:jsoup:1.11.3'
4141
implementation 'io.github.jeffshee.apng2gif:apng2gif:1.2'
42-
implementation "com.github.nekocode:Badge:2.0"
4342
}

app/src/main/java/io/github/jeffshee/linestickerkeyboard/FetchService.java

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
package io.github.jeffshee.linestickerkeyboard;
22

33
import android.app.IntentService;
4+
import android.app.NotificationChannel;
5+
import android.app.NotificationManager;
46
import android.content.Context;
57
import android.content.Intent;
8+
import android.os.Build;
69
import android.support.v4.app.NotificationCompat;
7-
import android.support.v4.app.NotificationManagerCompat;
810
import android.support.v4.content.LocalBroadcastManager;
911
import android.util.Log;
1012

@@ -33,7 +35,7 @@ public class FetchService extends IntentService {
3335
private static final String ACTION_FETCH = "io.github.jeffshee.linestickerkeyboard.action.FETCH";
3436
private static final String EXTRA_PARAM1 = "io.github.jeffshee.linestickerkeyboard.extra.PARAM1";
3537

36-
private static final String CHANNEL_ID = "DOWNLOAD";
38+
private static final String CHANNEL_ID = "io.github.jeffshee.linestickerkeyboard.DOWNLOAD";
3739
private static final int NOTIFICATION_ID = 0;
3840

3941
private static final String URL_COMMON = "https://stickershop.line-scdn.net/stickershop/v1/sticker/";
@@ -46,8 +48,8 @@ public class FetchService extends IntentService {
4648
int firstId = 0, count = 0, storeId = 0;
4749
String title = "";
4850
Sticker.Type type;
51+
NotificationManager notificationManager;
4952
NotificationCompat.Builder builder;
50-
NotificationManagerCompat notificationManager;
5153
File pngDir;
5254
File gifDir;
5355
Apng2GifCustom apng2GifCustom;
@@ -73,8 +75,15 @@ public static void startActionFetchManual(Context context, int storeId) {
7375

7476
@Override
7577
protected void onHandleIntent(Intent intent) {
78+
notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
7679
builder = new NotificationCompat.Builder(this, CHANNEL_ID);
77-
notificationManager = NotificationManagerCompat.from(this);
80+
81+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
82+
NotificationChannel notificationChannel = new NotificationChannel(CHANNEL_ID,
83+
getString(R.string.channel_name), NotificationManager.IMPORTANCE_LOW);
84+
85+
notificationManager.createNotificationChannel(notificationChannel);
86+
}
7887
pngDir = new File(getFilesDir(), "png");
7988
gifDir = new File(getFilesDir(), "gif");
8089
apng2GifCustom = new Apng2GifCustom();
@@ -260,4 +269,4 @@ private void send() {
260269
LocalBroadcastManager.getInstance(this).sendBroadcast(intent);
261270
}
262271

263-
}
272+
}

app/src/main/java/io/github/jeffshee/linestickerkeyboard/IMService.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,20 @@ public void onClick(DialogInterface dialogInterface, int i) {
200200
//
201201
}
202202

203+
public void launchMainMenu(){
204+
Intent intent = new Intent(IMService.this, MainActivity.class);
205+
// Flag needed by older Android
206+
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
207+
IMService.this.startActivity(intent);
208+
}
209+
210+
public void showIMPicker(){
211+
InputMethodManager im = (InputMethodManager) IMService.this.getSystemService(INPUT_METHOD_SERVICE);
212+
if (im != null) {
213+
im.showInputMethodPicker();
214+
}
215+
}
216+
203217
@Override
204218
public void onCreate() {
205219
super.onCreate();

app/src/main/java/io/github/jeffshee/linestickerkeyboard/MainActivity.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,11 @@
1313
import android.view.inputmethod.InputMethodManager;
1414
import android.widget.AdapterView;
1515
import android.widget.ArrayAdapter;
16-
import android.widget.ImageView;
1716
import android.widget.ListView;
1817
import android.widget.Toast;
1918

2019
import java.util.ArrayList;
2120

22-
import cn.nekocode.badge.BadgeDrawable;
2321
import io.github.jeffshee.linestickerkeyboard.Model.HistoryPack;
2422
import io.github.jeffshee.linestickerkeyboard.Model.Sticker;
2523
import io.github.jeffshee.linestickerkeyboard.Util.SharedPrefHelper;
@@ -43,14 +41,6 @@ protected void onCreate(Bundle savedInstanceState) {
4341
listView.setAdapter(new ArrayAdapter<>(this,
4442
android.R.layout.simple_list_item_1, getResources().getStringArray(R.array.main_activity_list)));
4543
listView.setOnItemClickListener(this);
46-
ImageView footer = findViewById(R.id.footer);
47-
footer.setImageDrawable(new
48-
BadgeDrawable.Builder()
49-
.type(BadgeDrawable.TYPE_WITH_TWO_TEXT_COMPLEMENTARY)
50-
.badgeColor(getResources().getColor(R.color.md_deep_purple_900))
51-
.text1(getString(R.string.app_name))
52-
.text2(BuildConfig.VERSION_NAME)
53-
.build());
5444
}
5545

5646
@Override

0 commit comments

Comments
 (0)