Skip to content

Commit 101880e

Browse files
committed
Improve external links for author
Add big info view for author.
1 parent 440e395 commit 101880e

File tree

2 files changed

+92
-5
lines changed

2 files changed

+92
-5
lines changed
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
/*
2+
* Copyright 2018-2024 Pranav Pandey
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.pranavpandey.android.dynamic.support.view;
18+
19+
import android.content.Context;
20+
import android.util.AttributeSet;
21+
22+
import androidx.annotation.AttrRes;
23+
import androidx.annotation.LayoutRes;
24+
import androidx.annotation.NonNull;
25+
import androidx.annotation.Nullable;
26+
27+
import com.pranavpandey.android.dynamic.support.R;
28+
import com.pranavpandey.android.dynamic.support.theme.DynamicTheme;
29+
import com.pranavpandey.android.dynamic.support.view.base.DynamicInfoView;
30+
import com.pranavpandey.android.dynamic.util.DynamicDeviceUtils;
31+
import com.pranavpandey.android.dynamic.util.product.DynamicFlavor;
32+
33+
/**
34+
* A {@link DynamicInfoView} with bigger fallback icon.
35+
* <p>Showing author info according to the product flavor.
36+
*
37+
* @see DynamicFlavor
38+
*/
39+
public class DynamicInfoViewBigAuthor extends DynamicInfoView {
40+
41+
public DynamicInfoViewBigAuthor(@NonNull Context context) {
42+
super(context);
43+
}
44+
45+
public DynamicInfoViewBigAuthor(@NonNull Context context, @Nullable AttributeSet attrs) {
46+
super(context, attrs);
47+
}
48+
49+
public DynamicInfoViewBigAuthor(@NonNull Context context,
50+
@Nullable AttributeSet attrs, @AttrRes int defStyleAttr) {
51+
super(context, attrs, defStyleAttr);
52+
}
53+
54+
@Override
55+
protected @LayoutRes int getLayoutRes() {
56+
return R.layout.ads_info_view_big;
57+
}
58+
59+
@Override
60+
protected void onInflate() {
61+
super.onInflate();
62+
63+
if (DynamicFlavor.EXTERNAL.equals(
64+
DynamicTheme.getInstance().getProductFlavor())
65+
&& DynamicDeviceUtils.isSamsungOneUI()) {
66+
setLinksSubtitles(new CharSequence[] {
67+
getContext().getString(R.string.ads_info_website_me_desc),
68+
String.format(getContext().getString(R.string.ads_info_apps_desc),
69+
getContext().getString(R.string.adu_store_samsung_galaxy_store))
70+
});
71+
setLinksUrls(new CharSequence[] {
72+
getContext().getString(R.string.adu_url_me_website),
73+
getContext().getString(R.string.adu_url_me_samsung_galaxy_store)
74+
});
75+
} else {
76+
setLinksSubtitles(new CharSequence[] {
77+
getContext().getString(R.string.ads_info_website_me_desc),
78+
String.format(getContext().getString(R.string.ads_info_apps_desc),
79+
getContext().getString(R.string.adu_store_google_play))
80+
});
81+
setLinksUrls(new CharSequence[] {
82+
getContext().getString(R.string.adu_url_me_website),
83+
getContext().getString(R.string.adu_url_me_google_play)
84+
});
85+
}
86+
}
87+
}

dynamic-support/src/main/res/values/arrays.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<!--
3-
Copyright 2018-2022 Pranav Pandey
3+
Copyright 2018-2024 Pranav Pandey
44
55
Licensed under the Apache License, Version 2.0 (the "License");
66
you may not use this file except in compliance with the License.
@@ -55,19 +55,19 @@
5555
<!-- String array with with subtitles for author links. -->
5656
<string-array name="ads_about_author_links_subtitles">
5757
<item>@string/ads_info_website_me_desc</item>
58-
<item>@string/ads_info_apps_desc</item>
58+
<item>@string/ads_info_apps_desc_google_play</item>
5959
</string-array>
6060

6161
<!-- String array with with urls for author links. -->
6262
<string-array name="ads_about_author_links_urls">
63-
<item>https://pranavpandey.com</item>
64-
<item>https://play.google.com/store/apps/dev?id=6608630615059087491</item>
63+
<item>@string/adu_url_me_website</item>
64+
<item>@string/adu_url_me_google_play</item>
6565
</string-array>
6666

6767
<!-- Integer array with with drawables for author links. -->
6868
<integer-array name="ads_about_author_links_icons">
6969
<item>@drawable/ads_ic_public</item>
70-
<item>@drawable/ads_ic_shop</item>
70+
<item>@drawable/ads_ic_open_alt</item>
7171
</integer-array>
7272

7373
<!-- Integer array with with colors for author links. -->

0 commit comments

Comments
 (0)