BaseNotificationFactory.java
3.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
package com.arellomobile.android.push.utils.notification;
import android.app.Notification;
import android.content.Context;
import android.content.pm.PackageManager;
import android.content.res.Resources;
import android.media.AudioManager;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
import com.arellomobile.android.push.preference.SoundType;
import com.arellomobile.android.push.preference.VibrateType;
public abstract class BaseNotificationFactory
{
private Notification a;
private Context b;
private Bundle c;
private String d;
private String e;
private SoundType f;
private VibrateType g;
public BaseNotificationFactory(Context paramContext, Bundle paramBundle, String paramString1, String paramString2, SoundType paramSoundType, VibrateType paramVibrateType)
{
this.b = paramContext;
this.c = paramBundle;
this.d = paramString1;
this.e = paramString2;
this.f = paramSoundType;
this.g = paramVibrateType;
}
private static boolean a(Context paramContext)
{
PackageManager localPackageManager = paramContext.getPackageManager();
try
{
int i = localPackageManager.checkPermission("android.permission.VIBRATE", paramContext.getPackageName());
if (i == 0) {
return true;
}
}
catch (Exception paramContext)
{
Log.e("PushWoosh", "error in checking vibrate permission", paramContext);
}
return false;
}
abstract Notification a(Context paramContext, Bundle paramBundle, String paramString1, String paramString2, String paramString3);
public void addCancel()
{
Notification localNotification = this.a;
localNotification.flags |= 0x10;
}
public void addLED(boolean paramBoolean)
{
if (!paramBoolean) {
return;
}
this.a.ledARGB = -1;
Notification localNotification = this.a;
localNotification.flags |= 0x1;
this.a.ledOnMS = 100;
this.a.ledOffMS = 1000;
}
public void addSoundAndVibrate()
{
Object localObject = (String)this.c.get("s");
AudioManager localAudioManager = (AudioManager)this.b.getSystemService("audio");
Notification localNotification;
if ((this.f == SoundType.ALWAYS) || ((localAudioManager.getRingerMode() == 2) && (this.f == SoundType.DEFAULT_MODE)))
{
Context localContext = this.b;
localNotification = this.a;
if ((localObject == null) || (((String)localObject).length() == 0)) {
break label189;
}
int i = localContext.getResources().getIdentifier((String)localObject, "raw", localContext.getPackageName());
if (i == 0) {
break label189;
}
localNotification.sound = Uri.parse("android.resource://" + localContext.getPackageName() + "/" + i);
}
for (;;)
{
if (((this.g == VibrateType.ALWAYS) || ((localAudioManager.getRingerMode() == 1) && (this.g == VibrateType.DEFAULT_MODE))) && (a(this.b)))
{
localObject = this.a;
((Notification)localObject).defaults |= 0x2;
}
return;
label189:
localNotification.defaults |= 0x1;
}
}
public void generateNotification()
{
int i = getContext().getResources().getIdentifier("new_push_message", "string", getContext().getPackageName());
if (i != 0)
{
String str = getContext().getString(i);
this.a = a(getContext(), getData(), this.d, this.e, str);
return;
}
this.a = a(getContext(), getData(), this.d, this.e, this.e);
}
protected Context getContext()
{
return this.b;
}
protected Bundle getData()
{
return this.c;
}
public Notification getNotification()
{
return this.a;
}
protected SoundType getSoundType()
{
return this.f;
}
protected VibrateType getVibrateType()
{
return this.g;
}
}
/* Location: /home/merong/decompile/hackery-dex2jar.jar!/com/arellomobile/android/push/utils/notification/BaseNotificationFactory.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/