Skip to content

Commit

Permalink
Improve external links for author
Browse files Browse the repository at this point in the history
Add big info view for author.
  • Loading branch information
pranavpandey committed Jul 24, 2024
1 parent dae0637 commit 8a56416
Show file tree
Hide file tree
Showing 2 changed files with 92 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
/*
* Copyright 2018-2024 Pranav Pandey
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.pranavpandey.android.dynamic.support.view;

import android.content.Context;
import android.util.AttributeSet;

import androidx.annotation.AttrRes;
import androidx.annotation.LayoutRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.pranavpandey.android.dynamic.support.R;
import com.pranavpandey.android.dynamic.support.theme.DynamicTheme;
import com.pranavpandey.android.dynamic.support.view.base.DynamicInfoView;
import com.pranavpandey.android.dynamic.util.DynamicDeviceUtils;
import com.pranavpandey.android.dynamic.util.product.DynamicFlavor;

/**
* A {@link DynamicInfoView} with bigger fallback icon.
* <p>Showing author info according to the product flavor.
*
* @see DynamicFlavor
*/
public class DynamicInfoViewBigAuthor extends DynamicInfoView {

public DynamicInfoViewBigAuthor(@NonNull Context context) {
super(context);
}

public DynamicInfoViewBigAuthor(@NonNull Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
}

public DynamicInfoViewBigAuthor(@NonNull Context context,
@Nullable AttributeSet attrs, @AttrRes int defStyleAttr) {
super(context, attrs, defStyleAttr);
}

@Override
protected @LayoutRes int getLayoutRes() {
return R.layout.ads_info_view_big;
}

@Override
protected void onInflate() {
super.onInflate();

if (DynamicFlavor.EXTERNAL.equals(
DynamicTheme.getInstance().getProductFlavor())
&& DynamicDeviceUtils.isSamsungOneUI()) {
setLinksSubtitles(new CharSequence[] {
getContext().getString(R.string.ads_info_website_me_desc),
String.format(getContext().getString(R.string.ads_info_apps_desc),
getContext().getString(R.string.adu_store_samsung_galaxy_store))
});
setLinksUrls(new CharSequence[] {
getContext().getString(R.string.adu_url_me_website),
getContext().getString(R.string.adu_url_me_samsung_galaxy_store)
});
} else {
setLinksSubtitles(new CharSequence[] {
getContext().getString(R.string.ads_info_website_me_desc),
String.format(getContext().getString(R.string.ads_info_apps_desc),
getContext().getString(R.string.adu_store_google_play))
});
setLinksUrls(new CharSequence[] {
getContext().getString(R.string.adu_url_me_website),
getContext().getString(R.string.adu_url_me_google_play)
});
}
}
}
10 changes: 5 additions & 5 deletions dynamic-support/src/main/res/values/arrays.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2018-2022 Pranav Pandey
Copyright 2018-2024 Pranav Pandey
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -55,19 +55,19 @@
<!-- String array with with subtitles for author links. -->
<string-array name="ads_about_author_links_subtitles">
<item>@string/ads_info_website_me_desc</item>
<item>@string/ads_info_apps_desc</item>
<item>@string/ads_info_apps_desc_google_play</item>
</string-array>

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

<!-- Integer array with with drawables for author links. -->
<integer-array name="ads_about_author_links_icons">
<item>@drawable/ads_ic_public</item>
<item>@drawable/ads_ic_shop</item>
<item>@drawable/ads_ic_open_alt</item>
</integer-array>

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

0 comments on commit 8a56416

Please sign in to comment.