update version codes and application id throughout the codebase
This commit is contained in:
parent
469b99fd90
commit
2b7d7308d3
11 changed files with 30 additions and 43 deletions
|
|
@ -50,7 +50,7 @@ public class App extends Application {
|
||||||
ThemeStore.editTheme(this).primaryColorRes(R.color.md_indigo_500).accentColorRes(R.color.md_pink_A400).commit();
|
ThemeStore.editTheme(this).primaryColorRes(R.color.md_indigo_500).accentColorRes(R.color.md_pink_A400).commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||||
new DynamicShortcutManager(this).initDynamicShortcuts();
|
new DynamicShortcutManager(this).initDynamicShortcuts();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -72,7 +72,7 @@ public class SettingsActivity extends AbsBaseActivity implements ColorChooserDia
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||||
new DynamicShortcutManager(this).updateDynamicShortcuts();
|
new DynamicShortcutManager(this).updateDynamicShortcuts();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -160,7 +160,7 @@ public class SettingsActivity extends AbsBaseActivity implements ColorChooserDia
|
||||||
setSummary(generalTheme, o);
|
setSummary(generalTheme, o);
|
||||||
|
|
||||||
ThemeStore.markChanged(requireActivity());
|
ThemeStore.markChanged(requireActivity());
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||||
// set the new theme so that updateAppShortcuts can pull it
|
// set the new theme so that updateAppShortcuts can pull it
|
||||||
requireActivity().setTheme(PreferenceUtil.getThemeResource(themeName));
|
requireActivity().setTheme(PreferenceUtil.getThemeResource(themeName));
|
||||||
new DynamicShortcutManager(getActivity()).updateDynamicShortcuts();
|
new DynamicShortcutManager(getActivity()).updateDynamicShortcuts();
|
||||||
|
|
@ -219,7 +219,7 @@ public class SettingsActivity extends AbsBaseActivity implements ColorChooserDia
|
||||||
}
|
}
|
||||||
|
|
||||||
final TwoStatePreference colorAppShortcuts = findPreference(PreferenceUtil.COLORED_SHORTCUTS);
|
final TwoStatePreference colorAppShortcuts = findPreference(PreferenceUtil.COLORED_SHORTCUTS);
|
||||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N_MR1) {
|
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
|
||||||
colorAppShortcuts.setVisible(false);
|
colorAppShortcuts.setVisible(false);
|
||||||
} else {
|
} else {
|
||||||
colorAppShortcuts.setChecked(PreferenceUtil.getInstance(getActivity()).getColoredShortcuts());
|
colorAppShortcuts.setChecked(PreferenceUtil.getInstance(getActivity()).getColoredShortcuts());
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,7 @@ import com.bumptech.glide.RequestBuilder;
|
||||||
import com.bumptech.glide.request.target.CustomTarget;
|
import com.bumptech.glide.request.target.CustomTarget;
|
||||||
import com.bumptech.glide.request.transition.Transition;
|
import com.bumptech.glide.request.transition.Transition;
|
||||||
import com.dkanada.gramophone.App;
|
import com.dkanada.gramophone.App;
|
||||||
|
import com.dkanada.gramophone.BuildConfig;
|
||||||
import com.dkanada.gramophone.R;
|
import com.dkanada.gramophone.R;
|
||||||
import com.dkanada.gramophone.glide.BlurTransformation;
|
import com.dkanada.gramophone.glide.BlurTransformation;
|
||||||
import com.dkanada.gramophone.glide.CustomGlideRequest;
|
import com.dkanada.gramophone.glide.CustomGlideRequest;
|
||||||
|
|
@ -74,7 +75,7 @@ import static com.google.android.exoplayer2.Player.MEDIA_ITEM_TRANSITION_REASON_
|
||||||
import static com.google.android.exoplayer2.Player.PLAY_WHEN_READY_CHANGE_REASON_END_OF_MEDIA_ITEM;
|
import static com.google.android.exoplayer2.Player.PLAY_WHEN_READY_CHANGE_REASON_END_OF_MEDIA_ITEM;
|
||||||
|
|
||||||
public class MusicService extends Service implements SharedPreferences.OnSharedPreferenceChangeListener, Playback.PlaybackCallbacks {
|
public class MusicService extends Service implements SharedPreferences.OnSharedPreferenceChangeListener, Playback.PlaybackCallbacks {
|
||||||
public static final String PACKAGE_NAME = "com.dkanada.gramophone";
|
public static final String PACKAGE_NAME = BuildConfig.APPLICATION_ID;
|
||||||
|
|
||||||
public static final String ACTION_TOGGLE = PACKAGE_NAME + ".toggle";
|
public static final String ACTION_TOGGLE = PACKAGE_NAME + ".toggle";
|
||||||
public static final String ACTION_PLAY = PACKAGE_NAME + ".play";
|
public static final String ACTION_PLAY = PACKAGE_NAME + ".play";
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,6 @@ import androidx.annotation.Nullable;
|
||||||
import com.dkanada.gramophone.R;
|
import com.dkanada.gramophone.R;
|
||||||
|
|
||||||
public class Util {
|
public class Util {
|
||||||
|
|
||||||
public static int getActionBarSize(@NonNull Context context) {
|
public static int getActionBarSize(@NonNull Context context) {
|
||||||
TypedValue typedValue = new TypedValue();
|
TypedValue typedValue = new TypedValue();
|
||||||
int[] textSizeAttr = new int[]{R.attr.actionBarSize};
|
int[] textSizeAttr = new int[]{R.attr.actionBarSize};
|
||||||
|
|
@ -76,12 +75,4 @@ public class Util {
|
||||||
a.recycle();
|
a.recycle();
|
||||||
return dimensionPixelSize;
|
return dimensionPixelSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
|
|
||||||
public static boolean isRTL(@NonNull Context context) {
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
|
|
||||||
Configuration config = context.getResources().getConfiguration();
|
|
||||||
return config.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL;
|
|
||||||
} else return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ import com.dkanada.gramophone.R;
|
||||||
import com.dkanada.gramophone.util.ImageUtil;
|
import com.dkanada.gramophone.util.ImageUtil;
|
||||||
import com.dkanada.gramophone.util.PreferenceUtil;
|
import com.dkanada.gramophone.util.PreferenceUtil;
|
||||||
|
|
||||||
@RequiresApi(Build.VERSION_CODES.N_MR1)
|
@RequiresApi(Build.VERSION_CODES.O)
|
||||||
public final class AppShortcutIconGenerator {
|
public final class AppShortcutIconGenerator {
|
||||||
|
|
||||||
public static Icon generateThemedIcon(Context context, int iconId) {
|
public static Icon generateThemedIcon(Context context, int iconId) {
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import android.app.Activity;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
|
import com.dkanada.gramophone.BuildConfig;
|
||||||
import com.dkanada.gramophone.views.shortcuts.shortcuttype.LatestShortcutType;
|
import com.dkanada.gramophone.views.shortcuts.shortcuttype.LatestShortcutType;
|
||||||
import com.dkanada.gramophone.views.shortcuts.shortcuttype.ShuffleShortcutType;
|
import com.dkanada.gramophone.views.shortcuts.shortcuttype.ShuffleShortcutType;
|
||||||
import com.dkanada.gramophone.views.shortcuts.shortcuttype.FrequentShortcutType;
|
import com.dkanada.gramophone.views.shortcuts.shortcuttype.FrequentShortcutType;
|
||||||
|
|
@ -11,24 +12,23 @@ import com.dkanada.gramophone.model.Playlist;
|
||||||
import com.dkanada.gramophone.service.MusicService;
|
import com.dkanada.gramophone.service.MusicService;
|
||||||
|
|
||||||
public class AppShortcutLauncherActivity extends Activity {
|
public class AppShortcutLauncherActivity extends Activity {
|
||||||
public static final String KEY_SHORTCUT_TYPE = "com.dkanada.gramophone.views.shortcuts.ShortcutType";
|
public static final String EXTRA_SHORTCUT = BuildConfig.APPLICATION_ID + ".extra.shortcut";
|
||||||
|
|
||||||
public static final int SHORTCUT_TYPE_SHUFFLE = 0;
|
public static final int SHORTCUT_TYPE_SHUFFLE = 0;
|
||||||
public static final int SHORTCUT_TYPE_FREQUENT = 1;
|
public static final int SHORTCUT_TYPE_FREQUENT = 1;
|
||||||
public static final int SHORTCUT_TYPE_LATEST = 2;
|
public static final int SHORTCUT_TYPE_LATEST = 2;
|
||||||
public static final int SHORTCUT_TYPE_NONE = 3;
|
public static final int SHORTCUT_TYPE_DEFAULT = 3;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
int shortcutType = SHORTCUT_TYPE_NONE;
|
int shortcutType = SHORTCUT_TYPE_DEFAULT;
|
||||||
|
|
||||||
// Set shortcutType from the intent extras
|
|
||||||
Bundle extras = getIntent().getExtras();
|
Bundle extras = getIntent().getExtras();
|
||||||
if (extras != null) {
|
if (extras != null) {
|
||||||
// noinspection WrongConstant
|
// noinspection WrongConstant
|
||||||
shortcutType = extras.getInt(KEY_SHORTCUT_TYPE, SHORTCUT_TYPE_NONE);
|
shortcutType = extras.getInt(EXTRA_SHORTCUT, SHORTCUT_TYPE_DEFAULT);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (shortcutType) {
|
switch (shortcutType) {
|
||||||
|
|
|
||||||
|
|
@ -15,11 +15,11 @@ import com.dkanada.gramophone.views.shortcuts.shortcuttype.FrequentShortcutType;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@TargetApi(Build.VERSION_CODES.N_MR1)
|
@TargetApi(Build.VERSION_CODES.O)
|
||||||
public class DynamicShortcutManager {
|
public class DynamicShortcutManager {
|
||||||
|
|
||||||
private Context context;
|
private final Context context;
|
||||||
private ShortcutManager shortcutManager;
|
private final ShortcutManager shortcutManager;
|
||||||
|
|
||||||
public DynamicShortcutManager(Context context) {
|
public DynamicShortcutManager(Context context) {
|
||||||
this.context = context;
|
this.context = context;
|
||||||
|
|
@ -46,11 +46,11 @@ public class DynamicShortcutManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ShortcutInfo> getDefaultShortcuts() {
|
public List<ShortcutInfo> getDefaultShortcuts() {
|
||||||
return (Arrays.asList(
|
return Arrays.asList(
|
||||||
new ShuffleShortcutType(context).getShortcutInfo(),
|
new ShuffleShortcutType(context).getShortcutInfo(),
|
||||||
new FrequentShortcutType(context).getShortcutInfo(),
|
new FrequentShortcutType(context).getShortcutInfo(),
|
||||||
new LatestShortcutType(context).getShortcutInfo()
|
new LatestShortcutType(context).getShortcutInfo()
|
||||||
));
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void reportShortcutUsed(Context context, String shortcutId){
|
public static void reportShortcutUsed(Context context, String shortcutId){
|
||||||
|
|
|
||||||
|
|
@ -7,12 +7,13 @@ import android.content.pm.ShortcutInfo;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
|
import com.dkanada.gramophone.BuildConfig;
|
||||||
import com.dkanada.gramophone.views.shortcuts.AppShortcutLauncherActivity;
|
import com.dkanada.gramophone.views.shortcuts.AppShortcutLauncherActivity;
|
||||||
|
|
||||||
@TargetApi(Build.VERSION_CODES.N_MR1)
|
@TargetApi(Build.VERSION_CODES.O)
|
||||||
public abstract class BaseShortcutType {
|
public abstract class BaseShortcutType {
|
||||||
|
|
||||||
static final String ID_PREFIX = "com.dkanada.gramophone.views.shortcuts.id.";
|
static final String PREFIX = BuildConfig.APPLICATION_ID + ".views.shortcut";
|
||||||
|
|
||||||
Context context;
|
Context context;
|
||||||
|
|
||||||
|
|
@ -21,25 +22,19 @@ public abstract class BaseShortcutType {
|
||||||
}
|
}
|
||||||
|
|
||||||
static public String getId() {
|
static public String getId() {
|
||||||
return ID_PREFIX + "invalid";
|
return PREFIX + ".base";
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract ShortcutInfo getShortcutInfo();
|
abstract ShortcutInfo getShortcutInfo();
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates an Intent that will launch MainActivtiy and immediately play {@param songs} in either shuffle or normal mode
|
|
||||||
*
|
|
||||||
* @param shortcutType Describes the type of shortcut to create (ShuffleAll, TopTracks, custom playlist, etc.)
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
Intent getPlaySongsIntent(int shortcutType) {
|
Intent getPlaySongsIntent(int shortcutType) {
|
||||||
Intent intent = new Intent(context, AppShortcutLauncherActivity.class);
|
Intent intent = new Intent(context, AppShortcutLauncherActivity.class);
|
||||||
intent.setAction(Intent.ACTION_VIEW);
|
intent.setAction(Intent.ACTION_VIEW);
|
||||||
|
|
||||||
Bundle b = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
b.putInt(AppShortcutLauncherActivity.KEY_SHORTCUT_TYPE, shortcutType);
|
bundle.putInt(AppShortcutLauncherActivity.EXTRA_SHORTCUT, shortcutType);
|
||||||
|
|
||||||
intent.putExtras(b);
|
intent.putExtras(bundle);
|
||||||
|
|
||||||
return intent;
|
return intent;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,14 +9,14 @@ import com.dkanada.gramophone.R;
|
||||||
import com.dkanada.gramophone.views.shortcuts.AppShortcutIconGenerator;
|
import com.dkanada.gramophone.views.shortcuts.AppShortcutIconGenerator;
|
||||||
import com.dkanada.gramophone.views.shortcuts.AppShortcutLauncherActivity;
|
import com.dkanada.gramophone.views.shortcuts.AppShortcutLauncherActivity;
|
||||||
|
|
||||||
@TargetApi(Build.VERSION_CODES.N_MR1)
|
@TargetApi(Build.VERSION_CODES.O)
|
||||||
public final class FrequentShortcutType extends BaseShortcutType {
|
public final class FrequentShortcutType extends BaseShortcutType {
|
||||||
public FrequentShortcutType(Context context) {
|
public FrequentShortcutType(Context context) {
|
||||||
super(context);
|
super(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getId() {
|
public static String getId() {
|
||||||
return ID_PREFIX + "top_tracks";
|
return PREFIX + ".frequent";
|
||||||
}
|
}
|
||||||
|
|
||||||
public ShortcutInfo getShortcutInfo() {
|
public ShortcutInfo getShortcutInfo() {
|
||||||
|
|
|
||||||
|
|
@ -9,14 +9,14 @@ import com.dkanada.gramophone.R;
|
||||||
import com.dkanada.gramophone.views.shortcuts.AppShortcutIconGenerator;
|
import com.dkanada.gramophone.views.shortcuts.AppShortcutIconGenerator;
|
||||||
import com.dkanada.gramophone.views.shortcuts.AppShortcutLauncherActivity;
|
import com.dkanada.gramophone.views.shortcuts.AppShortcutLauncherActivity;
|
||||||
|
|
||||||
@TargetApi(Build.VERSION_CODES.N_MR1)
|
@TargetApi(Build.VERSION_CODES.O)
|
||||||
public final class LatestShortcutType extends BaseShortcutType {
|
public final class LatestShortcutType extends BaseShortcutType {
|
||||||
public LatestShortcutType(Context context) {
|
public LatestShortcutType(Context context) {
|
||||||
super(context);
|
super(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getId() {
|
public static String getId() {
|
||||||
return ID_PREFIX + "last_added";
|
return PREFIX + ".latest";
|
||||||
}
|
}
|
||||||
|
|
||||||
public ShortcutInfo getShortcutInfo() {
|
public ShortcutInfo getShortcutInfo() {
|
||||||
|
|
|
||||||
|
|
@ -9,14 +9,14 @@ import com.dkanada.gramophone.R;
|
||||||
import com.dkanada.gramophone.views.shortcuts.AppShortcutIconGenerator;
|
import com.dkanada.gramophone.views.shortcuts.AppShortcutIconGenerator;
|
||||||
import com.dkanada.gramophone.views.shortcuts.AppShortcutLauncherActivity;
|
import com.dkanada.gramophone.views.shortcuts.AppShortcutLauncherActivity;
|
||||||
|
|
||||||
@TargetApi(Build.VERSION_CODES.N_MR1)
|
@TargetApi(Build.VERSION_CODES.O)
|
||||||
public final class ShuffleShortcutType extends BaseShortcutType {
|
public final class ShuffleShortcutType extends BaseShortcutType {
|
||||||
public ShuffleShortcutType(Context context) {
|
public ShuffleShortcutType(Context context) {
|
||||||
super(context);
|
super(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getId() {
|
public static String getId() {
|
||||||
return ID_PREFIX + "shuffle_all";
|
return PREFIX + ".shuffle";
|
||||||
}
|
}
|
||||||
|
|
||||||
public ShortcutInfo getShortcutInfo() {
|
public ShortcutInfo getShortcutInfo() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue