Skip to content

Commit

Permalink
feat: add app links
Browse files Browse the repository at this point in the history
  • Loading branch information
Shouheng88 committed Feb 23, 2021
1 parent bab8280 commit 1a6f8da
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import android.support.annotation.NonNull;
import android.support.v7.app.ActionBar;
import android.text.Html;
import android.text.TextUtils;
import android.text.method.LinkMovementMethod;
import android.view.Menu;
import android.view.MenuItem;
Expand Down Expand Up @@ -34,6 +35,7 @@
import me.shouheng.notepal.Constants;
import me.shouheng.notepal.R;
import me.shouheng.notepal.databinding.ActivityAboutBinding;
import me.shouheng.utils.app.AppUtils;

import static me.shouheng.commons.event.UMEvent.*;
import static me.shouheng.notepal.Constants.EMAIL_DEVELOPER;
Expand Down Expand Up @@ -98,6 +100,46 @@ protected void doCreateView(Bundle savedInstanceState) {
} else {
aboutEntities.add(AboutEntity.getNormalText(Html.fromHtml(html)));
}
// App links
String channel = AppUtils.getMetaData("UMENG_CHANNEL");
aboutEntities.add(AboutEntity.getSectionTitle(PalmUtils.getStringCompact(R.string.about_other_apps)));
// leaf note
String leafNoteLink = "https://play.google.com/store/apps/details?id=me.shouheng.leafnote";
if (TextUtils.equals(channel, "google")) {
leafNoteLink = "https://play.google.com/store/apps/details?id=me.shouheng.leafnote";
} else if (TextUtils.equals(channel, "coolapk")) {
leafNoteLink = "http://www.coolapk.com/apk/280001";
} else if (TextUtils.equals(channel, "huawei")) {
leafNoteLink = "https://appgallery.huawei.com/#/app/C103452595";
}
aboutEntities.add(AboutEntity.getUser(PalmUtils.getStringCompact(R.string.about_other_leaf_note),
"https://meiyan.tech/rest/file/get/note_logo.png",
PalmUtils.fromHtml(PalmUtils.getStringCompact(R.string.about_other_leaf_note_desc)),
leafNoteLink));
// mobile box
String mobileBoxLink = "https://play.google.com/store/apps/details?id=me.shouheng.mobilebox";
if (TextUtils.equals(channel, "google")) {
mobileBoxLink = "https://play.google.com/store/apps/details?id=me.shouheng.mobilebox";
} else if (TextUtils.equals(channel, "huawei")) {
mobileBoxLink = "https://appgallery.huawei.com/#/app/C102887067";
}
aboutEntities.add(AboutEntity.getUser(PalmUtils.getStringCompact(R.string.about_other_mobile_box),
"https://meiyan.tech/rest/file/get/box.png",
PalmUtils.fromHtml(PalmUtils.getStringCompact(R.string.about_other_mobile_box_desc)),
mobileBoxLink));
// whats next
String whatsNextLink = "https://www.coolapk.com/apk/281574";
if (TextUtils.equals(channel, "google")) {
whatsNextLink = "https://play.google.com/store/apps/details?id=me.shouheng.whatsnext";
} else if (TextUtils.equals(channel, "huawei")) {
whatsNextLink = "https://appgallery.huawei.com/#/app/C103733873";
} else if (TextUtils.equals(channel, "coolapk")) {
whatsNextLink = "https://www.coolapk.com/apk/281574";
}
aboutEntities.add(AboutEntity.getUser(PalmUtils.getStringCompact(R.string.about_other_whatsnext),
"https://meiyan.tech/rest/file/get/whatsnext.png",
PalmUtils.fromHtml(PalmUtils.getStringCompact(R.string.about_other_whatsnext_desc)),
whatsNextLink));
}
aboutEntities.add(AboutEntity.getSectionTitle(PalmUtils.getStringCompact(R.string.about_section_open_sources)));
aboutEntities.add(AboutEntity.getLicense("Android-MVVMs", "WngShhng",
Expand Down Expand Up @@ -284,7 +326,7 @@ static AboutEntity getLicense(@NonNull String name,

static AboutEntity getUser(@NonNull String name,
@NonNull String avatarUrl,
@NonNull String description,
@NonNull CharSequence description,
@NonNull String website) {
AboutEntity aboutEntity = new AboutEntity(typeUser);
aboutEntity.user = new User(name, avatarUrl, description, website);
Expand Down Expand Up @@ -320,12 +362,12 @@ public static class License {
}

public static class User {
public final String name;
public final CharSequence name;
public final String avatarUrl;
public final String description;
public final CharSequence description;
public final String website;

User(@NonNull String name, @NonNull String avatarUrl, @NonNull String description, @NonNull String website) {
User(@NonNull CharSequence name, @NonNull String avatarUrl, @NonNull CharSequence description, @NonNull String website) {
this.name = name;
this.avatarUrl = avatarUrl;
this.description = description;
Expand Down
10 changes: 10 additions & 0 deletions commons/src/main/java/me/shouheng/commons/utils/PalmUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
import android.support.annotation.StringRes;
import android.support.v4.app.Fragment;
import android.text.ClipboardManager;
import android.text.Html;
import android.text.Spanned;

import me.shouheng.commons.BaseApplication;

Expand Down Expand Up @@ -98,6 +100,14 @@ public static String getPackageName() {
return BaseApplication.getContext().getApplicationContext().getPackageName();
}

public static Spanned fromHtml(String html) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
return Html.fromHtml(html, Html.FROM_HTML_MODE_LEGACY);
} else {
return Html.fromHtml(html);
}
}

public static void copy(Activity ctx, String content) {
ClipboardManager clipboardManager = (ClipboardManager) ctx.getSystemService(Context.CLIPBOARD_SERVICE);
assert clipboardManager != null;
Expand Down
7 changes: 7 additions & 0 deletions commons/src/main/res/values-zh-rCN/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,13 @@
4. <b>Compressor</b>:<a href="https://github.com/Shouheng88/Compressor">一款现代、高效的 Android 图片压缩框架,优雅设计,整合了多种图片压缩策略。</a><br/><br/>
5. <b>EasyMark</b>:<a href="https://github.com/Shouheng88/EasyMark">Markdown 解析、预览和编辑库,用来帮助用户快速开发基于 Markdown 预发的笔记应用。</a><br/><br/>
其他的库正在整理中…… ]]></string>
<string name="about_other_apps">作者的作品</string>
<string name="about_other_mobile_box">移动工具箱</string>
<string name="about_other_mobile_box_desc"><![CDATA[「移动工具箱」一个<b>丰富、强大</b>的工具合集应用。它可以帮助你提升生活和工作效率。]]></string>
<string name="about_other_leaf_note">言叶</string>
<string name="about_other_leaf_note_desc"><![CDATA[言叶是一个丰富、强大的笔记应用,<b>连接手机、电脑和其他终端,为跨平台而设计</b>]]></string>
<string name="about_other_whatsnext">今天干啥</string>
<string name="about_other_whatsnext_desc"><![CDATA[一个个人项目和时间管理应用,结合任务管理和番茄钟]]></string>

<!--donate -->
<string name="donate_wechat_title">捐赠·微信</string>
Expand Down
7 changes: 7 additions & 0 deletions commons/src/main/res/values-zh-rTW/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,13 @@
4. <b>Compressor</b>:<a href="https://github.com/Shouheng88/Compressor">一款現代、高效的 Android 圖片壓縮框架,優雅設計,整合了多種圖片壓縮策略。</a><br/><br/>
5. <b>EasyMark</b>:<a href="https://github.com/Shouheng88/EasyMark">Markdown 解析、預覽和編輯庫,用來幫助用戶快速開發基于 Markdown 預發的筆記應用。</a><br/><br/>
其他的庫正在整理中…… ]]></string>
<string name="about_other_apps">作者的作品</string>
<string name="about_other_mobile_box">移動工具箱</string>
<string name="about_other_mobile_box_desc"><![CDATA[「移動工具箱」一個<b>豐富、強大</b>的工具合集應用。它可以幫助你提升生活和工作效率。]]></string>
<string name="about_other_leaf_note">言葉</string>
<string name="about_other_leaf_note_desc"><![CDATA[言葉是一個豐富、強大的筆記應用,<b>連接手機、電腦和其他終端,為跨平臺而設計</b>]]></string>
<string name="about_other_whatsnext">今天干啥</string>
<string name="about_other_whatsnext_desc"><![CDATA[一個個人項目和時間管理應用,結合任務管理和番茄鐘]]></string>

<!--donate -->
<string name="donate_wechat_title">捐贈·微信</string>
Expand Down
7 changes: 7 additions & 0 deletions commons/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,13 @@
4. <b>Compressor</b>: <a href="https://github.com/Shouheng88/Compressor">Mordern and advanced: an easy to use and well designed image compress library for Android, based on Android native image library. </a><br/><br/>
5. <b>EasyMark</b>: <a href="https://github.com/Shouheng88/EasyMark">The markdown parser, editor and viewer for Android which is rather easy to integrate.</a><br/><br/>
Others are under developing.. ]]></string>
<string name="about_other_apps">Others</string>
<string name="about_other_mobile_box">Mobile Box</string>
<string name="about_other_leaf_note">Leaf Note</string>
<string name="about_other_mobile_box_desc"><![CDATA[A tools combination to help you improve your work and life efficiency.]]></string>
<string name="about_other_leaf_note_desc"><![CDATA[An advanced markdown note-taking application designed for cross platform.]]></string>
<string name="about_other_whatsnext">WhatsNext</string>
<string name="about_other_whatsnext_desc"><![CDATA[A personal time and project manager witch I developed to manage my daily life and work.]]></string>

<!--donate -->
<string name="donate_wechat_title">Donate·WeChat</string>
Expand Down

0 comments on commit 1a6f8da

Please sign in to comment.