|
7 | 7 | import android.content.res.ColorStateList; |
8 | 8 | import android.content.res.Configuration; |
9 | 9 | import android.graphics.Color; |
10 | | -import android.os.Build; |
11 | 10 | import android.os.Bundle; |
12 | 11 | import android.provider.Settings; |
13 | 12 | import android.util.TypedValue; |
14 | 13 | import android.view.View; |
15 | 14 |
|
16 | 15 | import androidx.annotation.NonNull; |
17 | | -import androidx.fragment.app.FragmentActivity; |
18 | 16 | import androidx.preference.DropDownPreference; |
19 | 17 | import androidx.preference.Preference; |
20 | 18 | import androidx.preference.PreferenceFragmentCompat; |
|
27 | 25 | import de.dlyt.yanndroid.dualwallpaper.R; |
28 | 26 | import de.dlyt.yanndroid.dualwallpaper.WallpaperService; |
29 | 27 | import de.dlyt.yanndroid.dualwallpaper.WallpaperUtil; |
30 | | -import de.dlyt.yanndroid.dualwallpaper.ui.activity.MainActivity; |
31 | 28 | import de.dlyt.yanndroid.dualwallpaper.ui.adapter.ViewPagerAdapter; |
32 | 29 | import dev.oneuiproject.oneui.preference.LayoutPreference; |
33 | 30 | import dev.oneuiproject.oneui.preference.internal.PreferenceRelatedCard; |
@@ -56,7 +53,7 @@ public void onCreate(Bundle bundle) { |
56 | 53 | super.onCreate(bundle); |
57 | 54 |
|
58 | 55 | LayoutPreference layoutPreference = findPreference("preview_pref"); |
59 | | - if (adapter != null && wallpaperUtil != null ) { |
| 56 | + if (adapter != null && wallpaperUtil != null) { |
60 | 57 | ViewPager2 viewPager = layoutPreference.findViewById(R.id.viewPager); |
61 | 58 | viewPager.seslGetListView().setNestedScrollingEnabled(false); |
62 | 59 | viewPager.setAdapter(adapter); |
@@ -153,9 +150,12 @@ private void setRelativeLinkCard() { |
153 | 150 | mRelativeLinkCard = PreferenceUtils.createRelatedCard(mContext); |
154 | 151 | mRelativeLinkCard.addButton(mContext.getString(R.string.service_notification), v -> startActivity(new Intent(Settings.ACTION_CHANNEL_NOTIFICATION_SETTINGS).putExtra(Settings.EXTRA_APP_PACKAGE, mContext.getPackageName()).putExtra(Settings.EXTRA_CHANNEL_ID, "4000"))); |
155 | 152 | mRelativeLinkCard.addButton(mContext.getString(R.string.live_wallpaper), v -> startActivity(new Intent(WallpaperManager.ACTION_LIVE_WALLPAPER_CHOOSER))); |
156 | | - if (Build.MANUFACTURER.equals("samsung")) { |
157 | | - mRelativeLinkCard.addButton(mContext.getString(R.string.wallpaper_and_style), v -> startActivity(new Intent("com.samsung.intent.action.WALLPAPER_SETTING"))); |
| 153 | + |
| 154 | + Intent samsungWallpaperIntent = new Intent("com.samsung.intent.action.WALLPAPER_SETTING"); |
| 155 | + if (samsungWallpaperIntent.resolveActivity(mContext.getPackageManager()) != null) { |
| 156 | + mRelativeLinkCard.addButton(mContext.getString(R.string.wallpaper_and_style), v -> startActivity(samsungWallpaperIntent)); |
158 | 157 | } |
| 158 | + |
159 | 159 | mRelativeLinkCard.show(this); |
160 | 160 | } |
161 | 161 | } |
|
0 commit comments