Skip to content

Commit d96b709

Browse files
authored
Merge pull request #8 from KingsMentor/dev
addind file, image and time utils. Improvement on device utils and u…
2 parents f8846da + bddd8f1 commit d96b709

16 files changed

+693
-42
lines changed

.idea/workspace.xml

Lines changed: 71 additions & 36 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Plugin.jar

7.82 KB
Binary file not shown.

out/production/Plugin/META-INF/plugin.xml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<idea-plugin>
22
<id>xyz.belvi.droid_snippet</id>
33
<name>Droid Snippet</name>
4-
<version>1.0.0-beta</version>
4+
<version>1.0.1</version>
55
<vendor email="nosakharebelvi@gmail.com" url="http://belvi.xyz">Nosakhare Belvi</vendor>
66

77
<description><![CDATA[
@@ -34,9 +34,20 @@
3434
<li>Intent Utils</li>
3535
</ul>
3636
37-
<h2>1.0.1</h2>
37+
<h3>1.0.1</h3>
38+
39+
<h4>Enhanced Utils</h4>
40+
41+
<li>Device Utils</li>
42+
<li>Utils</li>
43+
44+
<h4>New Entries</h4>
3845
<ul>
46+
47+
<li>File Utils</li>
48+
<li>Image Utils</li>
3949
<li>Service Utils</li>
50+
<li>Time Utils</li>
4051
4152
</ul>
4253
]]>

out/production/Plugin/liveTemplates/DroidSnippet_DeviceUtils.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<option name="JAVA_DECLARATION" value="true" />
1010
</context>
1111
</template>
12-
<template name="deviceUtils_getAndroidID" value="public static String getAndroidID() {&#10; return Settings.Secure.getString(Utils.getApp().getContentResolver(), Settings.Secure.ANDROID_ID);&#10; }" description="get ID of the device" toReformat="false" toShortenFQNames="true">
12+
<template name="deviceUtils_getAndroidID" value="public String getAndroidID(Context context) {&#10; return Settings.Secure.getString(context.getContentResolver(), Settings.Secure.ANDROID_ID);&#10; }" description="get ID of the device" toReformat="false" toShortenFQNames="true">
1313
<context>
1414
<option name="JAVA_DECLARATION" value="true" />
1515
</context>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<templateSet group="DroidSnippet_FileUtils">
2+
<template name="fileUtils_createFileByDeleteOldFile" value=" private boolean createFileByDeleteOldFile(final File file) {&#10; if (file == null) return false;&#10; if (file.exists() &amp;&amp; !file.delete()) return false;&#10; if (!createOrExistsDir(file.getParentFile())) return false;&#10; try {&#10; return file.createNewFile();&#10; } catch (IOException e) {&#10; e.printStackTrace();&#10; return false;&#10; }&#10; }" description="create or delete old file" toReformat="false" toShortenFQNames="true">
3+
<context>
4+
<option name="JAVA_DECLARATION" value="true" />
5+
</context>
6+
</template>
7+
<template name="fileUtils_createOrExistsDir" value="private boolean createOrExistsDir(final File file) {&#10; &#10; return file != null &amp;&amp; (file.exists() ? file.isDirectory() : file.mkdirs());&#10; }" description="create directory if not exist" toReformat="false" toShortenFQNames="true">
8+
<context>
9+
<option name="JAVA_DECLARATION" value="true" />
10+
</context>
11+
</template>
12+
<template name="fileUtils_getFileByPath" value=" private File getFileByPath( String filePath) {&#10; return isSpace(filePath) ? null : new File(filePath);&#10; }&#10;" description="get file by path" toReformat="false" toShortenFQNames="true">
13+
<context>
14+
<option name="JAVA_DECLARATION" value="true" />
15+
</context>
16+
</template>
17+
</templateSet>

out/production/Plugin/liveTemplates/DroidSnippet_ImageUtils.xml

Lines changed: 242 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<templateSet group="DroidSnippet_TimeUtils">
2+
<template name="timeUtils_millis2String" value="public String millis2String(final long millis, final DateFormat format) {&#10; return format.format(new Date(millis));&#10; }" description="time in miliseconds to string" toReformat="false" toShortenFQNames="true">
3+
<context>
4+
<option name="JAVA_DECLARATION" value="true" />
5+
</context>
6+
</template>
7+
<template name="timeUtils_string2Millis" value="public long string2Millis(final String time, final DateFormat format) {&#10; try {&#10; return format.parse(time).getTime();&#10; } catch (ParseException e) {&#10; e.printStackTrace();&#10; }&#10; return -1;&#10; }" description="convert time string to milliseconds" toReformat="false" toShortenFQNames="true">
8+
<context>
9+
<option name="JAVA_DECLARATION" value="true" />
10+
</context>
11+
</template>
12+
<template name="timeUtils_string2Date" value="public Date string2Date(final String time, final DateFormat format) {&#10; try {&#10; return format.parse(time);&#10; } catch (ParseException e) {&#10; e.printStackTrace();&#10; }&#10; return null;&#10; }" description="convert string time to data" toReformat="false" toShortenFQNames="true">
13+
<context>
14+
<option name="JAVA_DECLARATION" value="true" />
15+
</context>
16+
</template>
17+
<template name="timeUtils_date2String" value="public String date2String(final Date date, final DateFormat format) {&#10; return format.format(date);&#10; }&#10;" description="convert date to string" toReformat="false" toShortenFQNames="true">
18+
<context>
19+
<option name="JAVA_DECLARATION" value="true" />
20+
</context>
21+
</template>
22+
<template name="timeUtils_millis2Date" value=" public Date millis2Date(final long millis) {&#10; return new Date(millis);&#10; }" description="convert time in milliseconds to date" toReformat="false" toShortenFQNames="true">
23+
<context>
24+
<option name="JAVA_DECLARATION" value="true" />
25+
</context>
26+
</template>
27+
<template name="timeUtils_isLeapYear" value="public static boolean isLeapYear(final int year) {&#10; return year % 4 == 0 &amp;&amp; year % 100 != 0 || year % 400 == 0;&#10; }" description="check if a year is a leap year" toReformat="false" toShortenFQNames="true">
28+
<context>
29+
<option name="JAVA_DECLARATION" value="true" />
30+
</context>
31+
</template>
32+
</templateSet>

out/production/Plugin/liveTemplates/DroidSnippet_Utils.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,9 @@
44
<option name="JAVA_DECLARATION" value="true" />
55
</context>
66
</template>
7+
<template name="util_isSpace" value="&#10; private boolean isSpace String s) {&#10; if (s == null) return true;&#10; for (int i = 0, len = s.length(); i &lt; len; ++i) {&#10; if (!Character.isWhitespace(s.charAt(i))) {&#10; return false;&#10; }&#10; }&#10; return true;&#10; }" description="if string is whitespace" toReformat="false" toShortenFQNames="true">
8+
<context>
9+
<option name="JAVA_DECLARATION" value="true" />
10+
</context>
11+
</template>
712
</templateSet>
97 Bytes
Binary file not shown.

resources/META-INF/plugin.xml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<idea-plugin>
22
<id>xyz.belvi.droid_snippet</id>
33
<name>Droid Snippet</name>
4-
<version>1.0.0-beta</version>
4+
<version>1.0.1</version>
55
<vendor email="nosakharebelvi@gmail.com" url="http://belvi.xyz">Nosakhare Belvi</vendor>
66

77
<description><![CDATA[
@@ -34,9 +34,20 @@
3434
<li>Intent Utils</li>
3535
</ul>
3636
37-
<h2>1.0.1</h2>
37+
<h3>1.0.1</h3>
38+
39+
<h4>Enhanced Utils</h4>
40+
41+
<li>Device Utils</li>
42+
<li>Utils</li>
43+
44+
<h4>New Entries</h4>
3845
<ul>
46+
47+
<li>File Utils</li>
48+
<li>Image Utils</li>
3949
<li>Service Utils</li>
50+
<li>Time Utils</li>
4051
4152
</ul>
4253
]]>

0 commit comments

Comments
 (0)