Skip to content

Commit 003ec8c

Browse files
committed
tabs to spaces, sorry not sorry
1 parent cd5c383 commit 003ec8c

11 files changed

+624
-626
lines changed

client/build.gradle

+14-14
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@ apply plugin: 'com.android.application'
22

33
android
44
{
5-
compileSdkVersion 27
6-
buildToolsVersion "28.0.3"
7-
defaultConfig
8-
{
9-
applicationId "net.kzxiv.notify.client"
10-
minSdkVersion 21
11-
targetSdkVersion 21
12-
versionCode 2
13-
versionName "1.1"
14-
}
15-
lintOptions
16-
{
17-
abortOnError false
18-
}
5+
compileSdkVersion 27
6+
buildToolsVersion "28.0.3"
7+
defaultConfig
8+
{
9+
applicationId "net.kzxiv.notify.client"
10+
minSdkVersion 21
11+
targetSdkVersion 21
12+
versionCode 2
13+
versionName "1.1"
14+
}
15+
lintOptions
16+
{
17+
abortOnError false
18+
}
1919
}

client/src/main/AndroidManifest.xml

+26-26
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
11
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="net.kzxiv.notify.client">
2-
<uses-permission android:name="android.permission.INTERNET" />
3-
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
2+
<uses-permission android:name="android.permission.INTERNET" />
3+
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
44

5-
<application
6-
android:allowBackup="true"
7-
android:label="@string/app_name"
8-
android:icon="@drawable/icon"
9-
android:theme="@style/AppTheme">
10-
<service
11-
android:name=".NotificationService"
12-
android:permission="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE">
13-
<intent-filter>
14-
<action android:name="android.service.notification.NotificationListenerService" />
15-
</intent-filter>
16-
</service>
5+
<application
6+
android:allowBackup="true"
7+
android:label="@string/app_name"
8+
android:icon="@drawable/icon"
9+
android:theme="@style/AppTheme">
10+
<service
11+
android:name=".NotificationService"
12+
android:permission="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE">
13+
<intent-filter>
14+
<action android:name="android.service.notification.NotificationListenerService" />
15+
</intent-filter>
16+
</service>
1717

18-
<service
19-
android:name=".HttpTransportService"
20-
android:exported="false" />
18+
<service
19+
android:name=".HttpTransportService"
20+
android:exported="false" />
2121

22-
<activity android:name=".ConfigurationActivity">
23-
<intent-filter>
24-
<action android:name="android.intent.action.MAIN" />
25-
<action android:name="android.intent.action.MANAGE_NETWORK_USAGE" />
26-
<category android:name="android.intent.category.DEFAULT" />
27-
<category android:name="android.intent.category.LAUNCHER" />
28-
</intent-filter>
29-
</activity>
30-
</application>
22+
<activity android:name=".ConfigurationActivity">
23+
<intent-filter>
24+
<action android:name="android.intent.action.MAIN" />
25+
<action android:name="android.intent.action.MANAGE_NETWORK_USAGE" />
26+
<category android:name="android.intent.category.DEFAULT" />
27+
<category android:name="android.intent.category.LAUNCHER" />
28+
</intent-filter>
29+
</activity>
30+
</application>
3131
</manifest>

client/src/main/java/net/kzxiv/notify/client/BitmapHelper.java

+53-53
Original file line numberDiff line numberDiff line change
@@ -8,63 +8,63 @@
88

99
final class BitmapHelper
1010
{
11-
public final static Bitmap getPackageIcon(Context context, String packageName, int id)
12-
{
13-
if (id == 0)
14-
return null;
11+
public final static Bitmap getPackageIcon(Context context, String packageName, int id)
12+
{
13+
if (id == 0)
14+
return null;
1515

16-
try
17-
{
18-
Context remoteContext = context.createPackageContext(packageName, 0);
19-
Drawable icon = remoteContext.getResources().getDrawable(id);
20-
if (icon == null)
21-
return null;
16+
try
17+
{
18+
Context remoteContext = context.createPackageContext(packageName, 0);
19+
Drawable icon = remoteContext.getResources().getDrawable(id);
20+
if (icon == null)
21+
return null;
2222

23-
return ((BitmapDrawable)icon).getBitmap();
24-
}
25-
catch (Exception ex)
26-
{
27-
return null;
28-
}
29-
}
23+
return ((BitmapDrawable)icon).getBitmap();
24+
}
25+
catch (Exception ex)
26+
{
27+
return null;
28+
}
29+
}
3030

31-
public final static Bitmap ensureSize(Bitmap bitmap, int maxWidth, int maxHeight)
32-
{
33-
if (bitmap.getWidth() > maxWidth || bitmap.getHeight() > maxHeight)
34-
return Bitmap.createScaledBitmap(bitmap, maxWidth, maxHeight, true);
35-
else
36-
return bitmap;
37-
}
31+
public final static Bitmap ensureSize(Bitmap bitmap, int maxWidth, int maxHeight)
32+
{
33+
if (bitmap.getWidth() > maxWidth || bitmap.getHeight() > maxHeight)
34+
return Bitmap.createScaledBitmap(bitmap, maxWidth, maxHeight, true);
35+
else
36+
return bitmap;
37+
}
3838

39-
public final static byte[] getBytes(Bitmap bitmap)
40-
{
41-
ByteArrayOutputStream strm = null;
42-
try
43-
{
44-
strm = new ByteArrayOutputStream();
45-
bitmap.compress(Bitmap.CompressFormat.PNG, 0, strm);
46-
return strm.toByteArray();
47-
}
48-
finally
49-
{
50-
if (strm != null)
51-
{
52-
try
53-
{
54-
strm.close();
55-
}
56-
catch (IOException ex) {}
57-
}
58-
}
59-
}
39+
public final static byte[] getBytes(Bitmap bitmap)
40+
{
41+
ByteArrayOutputStream strm = null;
42+
try
43+
{
44+
strm = new ByteArrayOutputStream();
45+
bitmap.compress(Bitmap.CompressFormat.PNG, 0, strm);
46+
return strm.toByteArray();
47+
}
48+
finally
49+
{
50+
if (strm != null)
51+
{
52+
try
53+
{
54+
strm.close();
55+
}
56+
catch (IOException ex) {}
57+
}
58+
}
59+
}
6060

61-
public final static String getBase64(Bitmap bitmap)
62-
{
63-
return Base64.encodeToString(getBytes(bitmap), Base64.NO_WRAP);
64-
}
61+
public final static String getBase64(Bitmap bitmap)
62+
{
63+
return Base64.encodeToString(getBytes(bitmap), Base64.NO_WRAP);
64+
}
6565

66-
public final static String getDataUri(Bitmap bitmap)
67-
{
68-
return "data:image/png;base64," + getBase64(bitmap);
69-
}
66+
public final static String getDataUri(Bitmap bitmap)
67+
{
68+
return "data:image/png;base64," + getBase64(bitmap);
69+
}
7070
}

client/src/main/java/net/kzxiv/notify/client/ConfigurationActivity.java

+30-30
Original file line numberDiff line numberDiff line change
@@ -9,34 +9,34 @@
99

1010
public class ConfigurationActivity extends PreferenceActivity
1111
{
12-
protected void onCreate(Bundle savedInstanceState)
13-
{
14-
super.onCreate(savedInstanceState);
15-
16-
PreferenceManager.setDefaultValues(this, R.xml.preferences, false);
17-
addPreferencesFromResource(R.xml.preferences);
18-
}
19-
20-
public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference)
21-
{
22-
Resources res = getResources();
23-
if (res.getString(R.string.key_send).equals(preference.getKey()))
24-
{
25-
NotificationManager mgr = (NotificationManager) getSystemService(Service.NOTIFICATION_SERVICE);
26-
Notification.Builder nb = new Notification.Builder(this);
27-
28-
nb.setContentTitle(res.getString(R.string.notification_title));
29-
nb.setContentText(res.getString(R.string.notification_text));
30-
nb.setSmallIcon(R.drawable.mask);
31-
32-
BitmapDrawable largeIconDrawable = (BitmapDrawable) res.getDrawable(R.drawable.icon);
33-
Bitmap largeIconBitmap = largeIconDrawable.getBitmap();
34-
nb.setLargeIcon(largeIconBitmap);
35-
36-
mgr.notify(0, nb.build());
37-
return false;
38-
}
39-
40-
return super.onPreferenceTreeClick(preferenceScreen, preference);
41-
}
12+
protected void onCreate(Bundle savedInstanceState)
13+
{
14+
super.onCreate(savedInstanceState);
15+
16+
PreferenceManager.setDefaultValues(this, R.xml.preferences, false);
17+
addPreferencesFromResource(R.xml.preferences);
18+
}
19+
20+
public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference)
21+
{
22+
Resources res = getResources();
23+
if (res.getString(R.string.key_send).equals(preference.getKey()))
24+
{
25+
NotificationManager mgr = (NotificationManager) getSystemService(Service.NOTIFICATION_SERVICE);
26+
Notification.Builder nb = new Notification.Builder(this);
27+
28+
nb.setContentTitle(res.getString(R.string.notification_title));
29+
nb.setContentText(res.getString(R.string.notification_text));
30+
nb.setSmallIcon(R.drawable.mask);
31+
32+
BitmapDrawable largeIconDrawable = (BitmapDrawable) res.getDrawable(R.drawable.icon);
33+
Bitmap largeIconBitmap = largeIconDrawable.getBitmap();
34+
nb.setLargeIcon(largeIconBitmap);
35+
36+
mgr.notify(0, nb.build());
37+
return false;
38+
}
39+
40+
return super.onPreferenceTreeClick(preferenceScreen, preference);
41+
}
4242
}

client/src/main/java/net/kzxiv/notify/client/HttpHelper.java

+46-46
Original file line numberDiff line numberDiff line change
@@ -6,62 +6,62 @@
66

77
final class HttpHelper
88
{
9-
private static final char[] HEXCHARS = new char[]
10-
{ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };
9+
private static final char[] HEXCHARS = new char[]
10+
{ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };
1111

12-
public final static String generateMultipartSeparator()
13-
{
14-
final Random random = new Random();
15-
final StringBuilder builder = new StringBuilder(40);
12+
public final static String generateMultipartSeparator()
13+
{
14+
final Random random = new Random();
15+
final StringBuilder builder = new StringBuilder(40);
1616

17-
builder.append("------------------------");
18-
for (int i = 0; i < 16; ++i)
19-
builder.append(HEXCHARS[random.nextInt(16)]);
17+
builder.append("------------------------");
18+
for (int i = 0; i < 16; ++i)
19+
builder.append(HEXCHARS[random.nextInt(16)]);
2020

21-
return builder.toString();
22-
}
21+
return builder.toString();
22+
}
2323

24-
public final static byte[] generateMultipartBody(String separator, Object[] entries, Charset charset) throws IOException
25-
{
26-
ByteArrayOutputStream strm = null;
27-
try
28-
{
29-
final Charset ascii = Charset.forName("US-ASCII");
30-
final byte[] newlineBytes = "\r\n".getBytes(ascii);
31-
final byte[] binaryTypeBytes = "Content-Type: application/octet-stream\r\nContent-Transfer-Encoding: binary\r\n".getBytes(ascii);
32-
final byte[] textTypeBytes = "Content-Type: text/plain\r\n".getBytes(ascii);
33-
final byte[] separatorBytes = String.format("--%s\r\n", separator).getBytes(ascii);
24+
public final static byte[] generateMultipartBody(String separator, Object[] entries, Charset charset) throws IOException
25+
{
26+
ByteArrayOutputStream strm = null;
27+
try
28+
{
29+
final Charset ascii = Charset.forName("US-ASCII");
30+
final byte[] newlineBytes = "\r\n".getBytes(ascii);
31+
final byte[] binaryTypeBytes = "Content-Type: application/octet-stream\r\nContent-Transfer-Encoding: binary\r\n".getBytes(ascii);
32+
final byte[] textTypeBytes = "Content-Type: text/plain\r\n".getBytes(ascii);
33+
final byte[] separatorBytes = String.format("--%s\r\n", separator).getBytes(ascii);
3434

35-
strm = new ByteArrayOutputStream();
35+
strm = new ByteArrayOutputStream();
3636

37-
final int count = entries.length;
38-
for (int i = 0; i < count; i += 2)
39-
{
40-
final String key = (String)entries[i];
41-
final Object value = entries[i + 1];
37+
final int count = entries.length;
38+
for (int i = 0; i < count; i += 2)
39+
{
40+
final String key = (String)entries[i];
41+
final Object value = entries[i + 1];
4242

43-
if (value == null)
44-
continue;
43+
if (value == null)
44+
continue;
4545

46-
strm.write(separatorBytes);
46+
strm.write(separatorBytes);
4747

48-
final boolean binary = (value instanceof byte[]);
48+
final boolean binary = (value instanceof byte[]);
4949

50-
strm.write(String.format("Content-Disposition: form-data; name=\"%s\"\r\n", key).getBytes(ascii));
51-
strm.write(binary ? binaryTypeBytes : textTypeBytes);
52-
strm.write(newlineBytes);
53-
strm.write(binary ? (byte[])value : value.toString().getBytes(charset));
54-
strm.write(newlineBytes);
55-
}
50+
strm.write(String.format("Content-Disposition: form-data; name=\"%s\"\r\n", key).getBytes(ascii));
51+
strm.write(binary ? binaryTypeBytes : textTypeBytes);
52+
strm.write(newlineBytes);
53+
strm.write(binary ? (byte[])value : value.toString().getBytes(charset));
54+
strm.write(newlineBytes);
55+
}
5656

57-
strm.write(separatorBytes);
57+
strm.write(separatorBytes);
5858

59-
return strm.toByteArray();
60-
}
61-
finally
62-
{
63-
if (strm != null)
64-
strm.close();
65-
}
66-
}
59+
return strm.toByteArray();
60+
}
61+
finally
62+
{
63+
if (strm != null)
64+
strm.close();
65+
}
66+
}
6767
}

0 commit comments

Comments
 (0)