Skip to content
This repository was archived by the owner on May 30, 2023. It is now read-only.

Commit bbcbd90

Browse files
committed
Initial code commit. Release version on Play Store: r17
1 parent 3d068d1 commit bbcbd90

32 files changed

+1021
-0
lines changed

Files/author.bal

1.99 KB
Binary file not shown.

Files/author.png

2.89 KB
Loading

Files/author2.png

2.89 KB
Loading

Files/curation.bal

1.95 KB
Binary file not shown.

Files/curation.png

2.29 KB
Loading

Files/curation2.png

2.29 KB
Loading

Files/incoming.png

2.19 KB
Loading

Files/incoming2.png

2.19 KB
Loading

Files/main.bal

6.22 KB
Binary file not shown.

Files/outgoing.png

1.55 KB
Loading

Files/outgoing2.png

1.55 KB
Loading

Files/post-blank-pic.png

18.8 KB
Loading

Files/post-bootstrap.bundle.min.js

+7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Files/post-bootstrap.min.css

+7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Files/post-custom.css

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
img {
2+
max-width: 99%;
3+
}
4+
5+
img:before {
6+
content: ' ';
7+
display: block;
8+
position: absolute;
9+
height: 48px;
10+
width: 48px;
11+
background-image: url(file:///android_asset/post-blank-pic.png);
12+
}

Files/post-custom.js

+74
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
function changeBrTag(html) {
2+
return html.replace(/(\r\n\|\r|\n)/gi, "\<br\/\>");
3+
}
4+
5+
function changeYouTubeTag(html) {
6+
var regExp = /^.*(youtu.be\/|v\/|e\/|u\/\w+\/|embed\/|v=)([^#\&\?]*).*/;
7+
return html.replace(regExp, '\<p\>\<iframe width="50%" src="https:\/\/www.youtube.com\/embed\/$1"\>\<\/iframe\>\<\/p\>');
8+
}
9+
10+
function imageSetting(html) {
11+
var html_change = html;
12+
var regex = /(<([^>]+)>)/ig
13+
var result = html_change.replace(regex, "");
14+
regex = /(https?:\/\/.*\.(?:png|jpg|jpeg))/ig;
15+
var arrMatch = result.match(regex);
16+
if (arrMatch != null) {
17+
console.log(arrMatch);
18+
for (var i = 0; i < arrMatch.length; i++) {
19+
re = new RegExp(arrMatch[i], "g");
20+
html_change = html_change.replace(re, "<img src='" + arrMatch[i] + "'/>");
21+
if (i != arrMatch.lenght - 1) {
22+
for (var j = i + 1; j < arrMatch.length; j++) {
23+
if (arrMatch[j] == arrMatch[i]) {
24+
arrMatch.splice(j, 1);
25+
}
26+
}
27+
}
28+
}
29+
}
30+
return html_change;
31+
}
32+
33+
createYoutubeEmbed = (key) => {
34+
return '<br><iframe width="420" height="345" src="https://www.youtube.com/embed/' + key + '" frameborder="0" allowfullscreen></iframe><br/>';
35+
};
36+
37+
transformYoutubeLinks = (text) => {
38+
if (!text) return text;
39+
const self = this;
40+
41+
const linkreg = /(?:)<a([^>]+)>(.+?)<\/a>/g;
42+
const fullreg = /(https?:\/\/)?(www\.)?(youtube\.com\/watch\?v=|youtu\.be\/)([^& \n<]+)(?:[^ \n<]+)?/g;
43+
const regex = /(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/watch\?v=|youtu\.be\/)([^& \n<]+)(?:[^ \n<]+)?/g;
44+
45+
let resultHtml = text;
46+
47+
// get all the matches for youtube links using the first regex
48+
const match = text.match(fullreg);
49+
if (match && match.length > 0) {
50+
// get all links and put in placeholders
51+
const matchlinks = text.match(linkreg);
52+
if (matchlinks && matchlinks.length > 0) {
53+
for (var i=0; i < matchlinks.length; i++) {
54+
resultHtml = resultHtml.replace(matchlinks[i], "#placeholder" + i + "#");
55+
}
56+
}
57+
58+
// now go through the matches one by one
59+
for (var i=0; i < match.length; i++) {
60+
// get the key out of the match using the second regex
61+
let matchParts = match[i].split(regex);
62+
// replace the full match with the embedded youtube code
63+
resultHtml = resultHtml.replace(match[i], self.createYoutubeEmbed(matchParts[1]));
64+
}
65+
66+
// ok now put our links back where the placeholders were.
67+
if (matchlinks && matchlinks.length > 0) {
68+
for (var i=0; i < matchlinks.length; i++) {
69+
resultHtml = resultHtml.replace("#placeholder" + i + "#", matchlinks[i]);
70+
}
71+
}
72+
}
73+
return resultHtml;
74+
};

Files/post-jquery.min.js

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Files/post-showdown.min.js

+3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Files/post.html

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
4+
<head>
5+
6+
<meta charset="utf-8">
7+
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
8+
<meta name="description" content="">
9+
<meta name="author" content="">
10+
<!-- Bootstrap core CSS -->
11+
<link href="file:///android_asset/post-bootstrap.min.css" rel="stylesheet">
12+
<link href="file:///android_asset/post-custom.css" rel="stylesheet">
13+
14+
15+
</head>
16+
17+
<body>
18+
<!-- Page Content -->
19+
<div class="container">
20+
21+
<div class="row">
22+
23+
<!-- Post Content Column -->
24+
<div class="col-lg-12">
25+
26+
<!-- Author -->
27+
<p class="lead">
28+
<img src="https://cdn.steemitimages.com/u/%postusername%/avatar" style="display: inline-block;background-size: cover;background-repeat: no-repeat;background-position: 50% 50%;border-radius: 50%;width: 48px;height: 48px;">
29+
by <a href="#">%postusername%</a> <small><a href="#">%posttime%</a></small>
30+
</p>
31+
32+
<hr>
33+
34+
<!-- Post Content -->
35+
<span id="markdown">%postcontent%</span>
36+
37+
<hr>
38+
Rewards so far: %totalpp%<br><span class="Icon chevron-up-circle" style="display: inline-block; width: 1.12rem; height: 1.12rem;"><svg enable-background="new 0 0 33 33" version="1.1" viewBox="0 0 33 33" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><g id="Chevron_Up_Circle"><circle cx="16" cy="16" r="15" stroke="#121313" fill="none"></circle><path d="M16.699,11.293c-0.384-0.38-1.044-0.381-1.429,0l-6.999,6.899c-0.394,0.391-0.394,1.024,0,1.414 c0.395,0.391,1.034,0.391,1.429,0l6.285-6.195l6.285,6.196c0.394,0.391,1.034,0.391,1.429,0c0.394-0.391,0.394-1.024,0-1.414 L16.699,11.293z" fill="#121313"></path></g></svg></span> %totalupvotes%
39+
</div>
40+
41+
</div>
42+
<!-- /.row -->
43+
44+
</div>
45+
<!-- /.container -->
46+
47+
<!-- Bootstrap core JavaScript -->
48+
<script src="file:///android_asset/post-jquery.min.js"></script>
49+
<script src="file:///android_asset/post-bootstrap.bundle.min.js"></script>
50+
<script src="file:///android_asset/post-showdown.min.js"></script>
51+
<script src="file:///android_asset/post-custom.js"></script>
52+
<script>var converter = new showdown.Converter(/*{simplifiedAutoLink: 'true'}*/),
53+
//converter.setOption('', 'true'),
54+
text = document.getElementById('markdown').innerHTML,
55+
//html_body = changeYouTubeTag(changeBrTag(imageSetting(text)));
56+
html_body = converter.makeHtml(text);
57+
html_body = transformYoutubeLinks(html_body);
58+
document.getElementById('markdown').innerHTML = html_body;</script>
59+
</body>
60+
61+
</html>

Files/posts.bal

1.99 KB
Binary file not shown.

Files/posts.png

2.48 KB
Loading

Files/posts2.png

2.48 KB
Loading

Files/showpost.bal

2.83 KB
Binary file not shown.

Files/upvotes.bal

1.23 KB
Binary file not shown.

Files/upvotes2.bal

1.23 KB
Binary file not shown.

Objects/AndroidManifest.xml

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest
3+
xmlns:android="http://schemas.android.com/apk/res/android"
4+
package="eu.dimitrisp.steenfo"
5+
android:versionCode="17"
6+
android:versionName="Amberdawn"
7+
android:installLocation="preferExternal">
8+
9+
<uses-sdk android:minSdkVersion="5" android:targetSdkVersion="26"/>
10+
<supports-screens android:largeScreens="true"
11+
android:normalScreens="true"
12+
android:smallScreens="true"
13+
android:anyDensity="true"/>
14+
<uses-permission android:name="android.permission.INTERNET"/>
15+
<uses-permission android:name="android.permission.WAKE_LOCK"/>
16+
<application
17+
android:icon="@drawable/icon"
18+
android:label="SteemiAPP"
19+
android:theme="@style/DarkTheme">
20+
21+
<activity android:name="de.amberhome.objects.preferenceactivity"/>
22+
<activity
23+
android:windowSoftInputMode="stateHidden"
24+
android:launchMode="singleTop"
25+
android:name=".main"
26+
android:label="SteemiAPP"
27+
android:screenOrientation="portrait">
28+
<intent-filter>
29+
<action android:name="android.intent.action.MAIN" />
30+
<category android:name="android.intent.category.LAUNCHER" />
31+
</intent-filter>
32+
33+
</activity>
34+
<activity
35+
android:windowSoftInputMode="stateHidden"
36+
android:launchMode="singleTop"
37+
android:name=".showpost"
38+
android:label="SteemiAPP"
39+
android:screenOrientation="portrait">
40+
</activity>
41+
<service android:name="anywheresoftware.b4a.samples.httputils2.httputils2service">
42+
</service>
43+
<receiver android:name="anywheresoftware.b4a.samples.httputils2.httputils2service$httputils2service_BR">
44+
</receiver>
45+
</application>
46+
</manifest>

Objects/bin/extra/opt.jar

22 Bytes
Binary file not shown.

Objects/res/drawable/icon.png

17 KB
Loading

README.md

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# SteemiAPP
2+
3+
SteemiAPP is a free (and now open source) app to check how you are doin' on Steemit!
4+
5+
## Getting Started with the project
6+
7+
This project is developed using the latest B4A version (at the time of commiting this README, it is v8.00)
8+
9+
### Prerequisites/Libraries
10+
11+
To succesfully compile this project, you need the following B4A libraries:
12+
13+
- AHPreferenceAbility (you can download it [here](https://www.b4x.com/android/forum/threads/ahpreferenceactivity-library.12666/) for free, if you have a valid B4A license)
14+
- JSON (included in B4A)
15+
- OkHttpUtils2 (included in B4A)
16+
- Phone (included in B4A)
17+
18+
### Installing & Testing
19+
20+
To test the codebase, you need an android phone (v4.0+ required, v8.1 recommended) and B4A Bridge (you can find it on Play Store). If you just want the app as a user, find [SteemiAPP on Play Store](https://play.google.com/store/apps/details?id=eu.dimitrisp.steenfo)
21+
22+
## Versioning
23+
24+
I'm using incremental release numbers instead of semantic versioning while the app is in beta. As soon as it is out of beta, I will be following semantic versioning, starting as 1.0.0, and there will be a codename for each minor version (major.minor.release). For example, the first public non-beta version will be SteemiAPP Amberdawn v1.0.0
25+
26+
## Author
27+
28+
* **Dimitris P.** [steemit](https://steemit.com/@dimitrisp) [github](https://github.com/dimitrisp2)
29+
30+
A list of contributors and testers will be added here!
31+
32+
## License
33+
34+
This project is licensed under GPLv3 - see the [LICENSE.md](LICENSE.md) file for details
35+
36+
## Acknowledgments
37+
38+
* Thanks to the [@greek-trail](https://steemit.com/@greek-trail) community that helped me test the app in the early steps.
39+
* Bigger thanks to [@amadeus](https://steemit.com/@amadeus) & [@steliosfan](https://steemit.com/@steliosfan) for reporting bugs

ShowPost.bas

+72
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
B4A=true
2+
Group=Default Group
3+
ModulesStructureVersion=1
4+
Type=Activity
5+
Version=8
6+
@EndOfDesignText@
7+
#Region Activity Attributes
8+
#FullScreen: False
9+
#IncludeTitle: False
10+
#End Region
11+
12+
Sub Process_Globals
13+
'These global variables will be declared once when the application starts.
14+
'These variables can be accessed from all modules.
15+
16+
End Sub
17+
18+
Sub Globals
19+
'These global variables will be redeclared each time the activity is created.
20+
'These variables can only be accessed from this module.
21+
Private wvPost As WebView
22+
Private lblTitle As Label
23+
Private lblBack As Label
24+
Private lblShare As Label
25+
End Sub
26+
27+
Sub Activity_Create(FirstTime As Boolean)
28+
'Do not forget to load the layout file created with the visual designer. For example:
29+
Activity.LoadLayout("ShowPost")
30+
lblTitle.Text = Main.ChosenPostTitle
31+
'Log(Main.ChosenPostBody)
32+
Dim ThisHTML As String
33+
'AuthorIMG = "https://cdn.steemitimages.com/u/"& Main.ChosenPostAuthor &"/avatar"
34+
ThisHTML = File.ReadString(File.DirAssets, "post.html").Replace("%postusername%", Main.ChosenPostAuthor).Replace("%postcontent%", Main.ChosenPostBody).Replace("%posttime%", Main.ChosenPostCreated).Replace("%totalpp%", Main.ChosenPostPPV).Replace("%totalupvotes%", Main.ChosenUpvotedBy)
35+
'Log(AuthorIMG)
36+
'Log(ThisHTML)
37+
wvPost.LoadHtml(ThisHTML)
38+
End Sub
39+
40+
Sub Activity_Resume
41+
42+
End Sub
43+
44+
Sub Activity_Pause (UserClosed As Boolean)
45+
'wvPost.LoadHtml("")
46+
End Sub
47+
48+
49+
Sub lblBack_Click
50+
Activity.Finish
51+
End Sub
52+
53+
Sub lblShare_Click
54+
Dim i As Intent
55+
i.Initialize(i.ACTION_SEND, "")
56+
i.SetType("text/plain")
57+
i.PutExtra("android.intent.extra.TEXT", Main.ChosenPostURL)
58+
i.WrapAsIntentChooser("Share Post")
59+
StartActivity(i)
60+
End Sub
61+
62+
Sub wvPost_OverrideUrl (Url As String) As Boolean'ignore
63+
Log(Url)
64+
If Url.StartsWith("https://steemiapp.dimitrisp.eu") Or Url.StartsWith("https://steemi.app") Then
65+
' These should be shown inside the app
66+
Else
67+
Dim i As Intent
68+
i.Initialize(i.ACTION_VIEW, Url)
69+
StartActivity(i)
70+
End If
71+
Return True
72+
End Sub

0 commit comments

Comments
 (0)