Merge branch 'FongMi:dev' into dev

pull/368/head
okcaptain 2 years ago committed by GitHub
commit bc3d4f07eb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 4
      app/src/leanback/java/com/fongmi/android/tv/ui/activity/HomeActivity.java
  2. 2
      app/src/main/java/com/fongmi/android/tv/bean/Device.java
  3. 11
      app/src/main/java/com/fongmi/android/tv/utils/Util.java

@ -563,7 +563,7 @@ public class HomeActivity extends BaseActivity implements CustomTitleView.Listen
public Fragment getItem(int position) {
if (position == 0) return new HomeFragment();
Class type = (Class) mAdapter.get(position);
return VodFragment.newInstance(getHome().getKey(), type.getTypeId(), type.getStyle(), type.getExtend(false), type.getTypeFlag().equals("1"));
return VodFragment.newInstance(getHome().getKey(), type.getTypeId(), type.getStyle(), type.getExtend(false), "1".equals(type.getTypeFlag()));
}
@Override
@ -575,4 +575,4 @@ public class HomeActivity extends BaseActivity implements CustomTitleView.Listen
public void destroyItem(@NonNull ViewGroup container, int position, @NonNull Object object) {
}
}
}
}

@ -34,7 +34,7 @@ public class Device {
public static Device get() {
Device device = new Device();
device.setUuid(Util.getDeviceId());
device.setUuid(Util.getAndroidId());
device.setName(Util.getDeviceName());
device.setIp(Server.get().getAddress());
device.setType(Product.getDeviceType());

@ -14,6 +14,7 @@ import android.os.Build;
import android.os.IBinder;
import android.os.Parcelable;
import android.provider.Settings;
import android.text.TextUtils;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
@ -83,8 +84,14 @@ public class Util {
}
}
public static String getDeviceId() {
return Settings.Secure.getString(Init.context().getContentResolver(), Settings.Secure.ANDROID_ID);
public static String getAndroidId() {
try {
String id = Settings.Secure.getString(Init.context().getContentResolver(), Settings.Secure.ANDROID_ID);
if (TextUtils.isEmpty(id)) throw new NullPointerException();
return id;
} catch (Exception e) {
return "0200000000000000";
}
}
public static String getDeviceName() {

Loading…
Cancel
Save