mirror of
https://github.com/moparisthebest/Yaaic
synced 2025-02-16 23:10:11 -05:00
Set vibration pattern (default does not always work)
This commit is contained in:
parent
832a462bfd
commit
4b3e47c799
@ -17,7 +17,7 @@ GNU General Public License for more details.
|
|||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with Yaaic. If not, see <http://www.gnu.org/licenses/>.
|
along with Yaaic. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package org.yaaic.irc;
|
package org.yaaic.irc;
|
||||||
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
@ -51,8 +51,8 @@ import android.content.Intent;
|
|||||||
*/
|
*/
|
||||||
public class IRCService extends Service
|
public class IRCService extends Service
|
||||||
{
|
{
|
||||||
private IRCBinder binder;
|
private final IRCBinder binder;
|
||||||
private HashMap<Integer, IRCConnection> connections;
|
private final HashMap<Integer, IRCConnection> connections;
|
||||||
private boolean foreground = false;
|
private boolean foreground = false;
|
||||||
|
|
||||||
@SuppressWarnings("rawtypes")
|
@SuppressWarnings("rawtypes")
|
||||||
@ -66,8 +66,8 @@ public class IRCService extends Service
|
|||||||
private NotificationManager notificationManager;
|
private NotificationManager notificationManager;
|
||||||
private Method mStartForeground;
|
private Method mStartForeground;
|
||||||
private Method mStopForeground;
|
private Method mStopForeground;
|
||||||
private Object[] mStartForegroundArgs = new Object[2];
|
private final Object[] mStartForegroundArgs = new Object[2];
|
||||||
private Object[] mStopForegroundArgs = new Object[1];
|
private final Object[] mStopForegroundArgs = new Object[1];
|
||||||
private Notification notification;
|
private Notification notification;
|
||||||
private Settings settings;
|
private Settings settings;
|
||||||
|
|
||||||
@ -203,9 +203,12 @@ public class IRCService extends Service
|
|||||||
notification = new Notification(R.drawable.icon, text, System.currentTimeMillis());
|
notification = new Notification(R.drawable.icon, text, System.currentTimeMillis());
|
||||||
PendingIntent contentIntent = PendingIntent.getActivity(this, 0, new Intent(this, ServersActivity.class), 0);
|
PendingIntent contentIntent = PendingIntent.getActivity(this, 0, new Intent(this, ServersActivity.class), 0);
|
||||||
notification.setLatestEventInfo(this, getText(R.string.app_name), text, contentIntent);
|
notification.setLatestEventInfo(this, getText(R.string.app_name), text, contentIntent);
|
||||||
|
|
||||||
if (vibrate) {
|
if (vibrate) {
|
||||||
notification.defaults |= Notification.DEFAULT_VIBRATE;
|
long[] pattern = {0,100,200,300};
|
||||||
|
notification.vibrate = pattern;
|
||||||
}
|
}
|
||||||
|
|
||||||
notificationManager.notify(R.string.app_name, notification);
|
notificationManager.notify(R.string.app_name, notification);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -266,6 +269,7 @@ public class IRCService extends Service
|
|||||||
public void connect(final Server server)
|
public void connect(final Server server)
|
||||||
{
|
{
|
||||||
new Thread() {
|
new Thread() {
|
||||||
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
IRCConnection connection = getConnection(server.getId());
|
IRCConnection connection = getConnection(server.getId());
|
||||||
|
Loading…
Reference in New Issue
Block a user