|
| 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 | +} |
0 commit comments