Commit c375752b authored by mengcuiguang's avatar mengcuiguang

更新穿山甲sdk,代码优化

parent aa29a42b
package com.mints.goodmoney.call.accessibility;
import android.content.Context;
import android.content.Intent;
import android.provider.Settings;
import android.text.TextUtils;
public class AccessibilityHelper {
private static boolean hasAccessibility(Context context, Class serviceClass) {
if (context == null || serviceClass == null) {
return false;
}
int ok = 0;
try {
ok = Settings.Secure.getInt(context.getContentResolver(), Settings.Secure.ACCESSIBILITY_ENABLED);
} catch (Settings.SettingNotFoundException e) {
}
TextUtils.SimpleStringSplitter ms = new TextUtils.SimpleStringSplitter(':');
if (ok == 1) {
String settingValue = Settings.Secure.getString(context.getContentResolver(), Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES);
if (settingValue != null) {
ms.setString(settingValue);
while (ms.hasNext()) {
String accessibilityService = ms.next();
if (accessibilityService.contains(serviceClass.getSimpleName())) {
return true;
}
}
}
}
return false;
}
public static void openAccessibility(Context context, Class service) {
if (context == null || service == null) {
return;
}
if (hasAccessibility(context, service)) {
return;
}
Intent intent = new Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent);
}
}
package com.mints.goodmoney.call.accessibility;
import android.accessibilityservice.AccessibilityService;
import android.util.Log;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityNodeInfo;
import java.util.List;
public class CallAccessibilityService extends AccessibilityService {
private static final String TAG = "CallAccessibility";
@Override
public void onAccessibilityEvent(AccessibilityEvent event) {
Log.d(TAG, "onAccessibilityEvent: " + event.toString());
if (event.getEventType() == AccessibilityEvent.TYPE_VIEW_CLICKED) {
AccessibilityNodeInfo nodeInfo = getRootInActiveWindow();
if (nodeInfo != null) {
List<AccessibilityNodeInfo> infos = nodeInfo.findAccessibilityNodeInfosByText("选择来电秀视频");
for (AccessibilityNodeInfo info : infos) {
info.performAction(AccessibilityNodeInfo.ACTION_CLICK);
}
}
}
}
@Override
public void onInterrupt() {
Log.d(TAG, "onInterrupt");
}
}
package com.mints.goodmoney.call.business;
import android.content.ContentResolver;
import android.content.Context;
import android.database.Cursor;
import android.net.Uri;
import android.provider.ContactsContract;
import android.text.TextUtils;
import android.util.Log;
public class ContactHelper {
private static final String TAG = "LLL";
private ContactHelper() {
}
private static class SingleTon {
private static ContactHelper sInstance = new ContactHelper();
}
public static ContactHelper getInstance() {
return SingleTon.sInstance;
}
/**
* 根据uri查找电话号码
*
* @param context
* @param contactUri
* @return
*/
public String getContacts(Context context, Uri contactUri) {
String phoneNumber = "";
if (context == null || contactUri == null) {
return "";
}
Cursor cursor = context.getContentResolver().query(contactUri, null, null, null, null);
if (cursor != null && cursor.moveToFirst()) {
String id = cursor.getString(cursor.getColumnIndex(ContactsContract.Contacts._ID));
Cursor phones = context.getContentResolver().query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI,
null, ContactsContract.CommonDataKinds.Phone.CONTACT_ID
+ "=" + id, null, null);
if (phones != null && phones.moveToNext()) {
phoneNumber = phones.getString(phones.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER));
phones.close();
}
cursor.close();
}
Log.d(TAG, "number = " + phoneNumber);
return phoneNumber;
}
/**
* 根据号码查找联系人姓名
*
* @param context
* @param number
* @return
*/
public String getContactName(Context context, String number) {
if (context == null || TextUtils.isEmpty(number)) {
return null;
}
final ContentResolver resolver = context.getContentResolver();
Uri lookupUri;
String[] projection = new String[]{ContactsContract.PhoneLookup._ID, ContactsContract.PhoneLookup.DISPLAY_NAME};
Cursor cursor = null;
try {
lookupUri = Uri.withAppendedPath(ContactsContract.PhoneLookup.CONTENT_FILTER_URI, Uri.encode(number));
cursor = resolver.query(lookupUri, projection, null, null, null);
} catch (Exception ex) {
ex.printStackTrace();
try {
lookupUri = Uri.withAppendedPath(android.provider.Contacts.Phones.CONTENT_FILTER_URL,
Uri.encode(number));
cursor = resolver.query(lookupUri, projection, null, null, null);
} catch (Exception e) {
e.printStackTrace();
}
}
String ret = "未知来电";
if (cursor != null && cursor.getCount() > 0 && cursor.moveToFirst()) {
ret = cursor.getString(1);
cursor.close();
}
return ret;
}
}
......@@ -12,47 +12,19 @@ import android.text.TextUtils;
import android.util.Log;
import android.widget.Toast;
import com.mints.goodmoney.utils.ToastUtil;
import java.io.File;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
/**
* Ringtone设置来电秀
* 作者:孟崔广
*/
public class RingtoneHelper {
private static final String TAG = "LLL";
public static final String NO_PATH = "/";
/**
* 通过Ringtone类播放铃声
*
* @param context
* @param uri
*/
public static void playRingtone(Context context, Uri uri) {
RingtoneManager manager = new RingtoneManager(context);
manager.stopPreviousRingtone();
RingtoneManager.getValidRingtoneUri(context);
try {
Ringtone ringtone = null;
Class cls = Ringtone.class;
Constructor[] constructors = cls.getDeclaredConstructors();
for (Constructor constructor : constructors) {
if (constructor.getModifiers() == Modifier.PUBLIC) {
ringtone = (Ringtone) constructor.newInstance(context, true);
}
}
if (ringtone != null) {
Method method = cls.getDeclaredMethod("setUri", Uri.class);
method.invoke(ringtone, uri);
ringtone.play();
}
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* 设置铃声为null
*
......@@ -88,7 +60,6 @@ public class RingtoneHelper {
Uri uri = MediaStore.Audio.Media.getContentUriForPath(sdFile.getAbsolutePath());
if (uri == null) {
Log.d(TAG, "uri is null");
return;
}
......@@ -108,53 +79,7 @@ public class RingtoneHelper {
newUri = context.getContentResolver().insert(uri, values);
}
Log.d(TAG, "uri = " + uri);
Log.d(TAG, "new uri = " + newUri);
RingtoneManager.setActualDefaultRingtoneUri(context, RingtoneManager.TYPE_RINGTONE, newUri);
Toast.makeText(context, "设置来电铃声成功!", Toast.LENGTH_SHORT).show();
}
/**
* 给不同联系人设置铃声
*
* @param context
* @param path
* @param number
*/
public static void setRing(Context context, String path, String number) {
final Uri lookupUri = Uri.withAppendedPath(ContactsContract.PhoneLookup.CONTENT_FILTER_URI, number);
final String[] projection = new String[]{
ContactsContract.Contacts._ID, ContactsContract.Contacts.LOOKUP_KEY
};
final Cursor data = context.getContentResolver().query(lookupUri, projection, null, null, null);
try {
if (data != null && data.moveToFirst()) {
final long contactId = data.getLong(0);
final String lookupKey = data.getString(1);
final Uri contactUri = ContactsContract.Contacts.getLookupUri(contactId, lookupKey);
if (contactUri == null) {
Log.d(TAG, "Invalid arguments");
return;
}
final File file = new File(path);
final String value = Uri.fromFile(file).toString();
Log.d(TAG, "uri = " + contactUri);
Log.d(TAG, "value = " + value);
final ContentValues values = new ContentValues(1);
values.put(ContactsContract.Contacts.CUSTOM_RINGTONE, value);
context.getContentResolver().update(contactUri, values, null, null);
Toast.makeText(context, "设置联系人铃声成功!", Toast.LENGTH_SHORT).show();
}
} catch (Exception e) {
e.printStackTrace();
} finally {
if (data != null) {
data.close();
}
}
ToastUtil.show(context,"设置来电铃声成功!");
}
}
......@@ -14,8 +14,9 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* @author liujiadong
* @since 2020/1/8
* 来电秀数据库操作
*
* 作者:孟崔广
*/
public class VideoDBHelper {
......@@ -23,7 +24,6 @@ public class VideoDBHelper {
private static final String AUTHORITY = "content://" + Constant.MINTS_PKG_NAME + ".provider";
private static final Uri VIDEO_URI = Uri.parse(AUTHORITY);
private VideoDBHelper() {
}
......
package com.mints.goodmoney.call.call;
import android.app.Notification;
import android.content.Context;
public class WeChatCallCore extends CallCore {
WeChatCallCore(Context context, String pkg) {
super(context, pkg);
}
@Override
protected void acceptCall() {
}
@Override
protected void endCall() {
}
@Override
public void onNotificationPosted(Notification notification) {
}
@Override
public void onNotificationRemoved(Notification notification) {
}
@Override
public void onDestroy() {
}
}
package com.mints.goodmoney.call.call;
import android.app.Notification;
import android.content.Context;
import android.graphics.drawable.Icon;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Log;
import com.mints.goodmoney.call.business.VideoDBHelper;
public class WhatsAppCallCore extends CallCore {
WhatsAppCallCore(Context context, String pkg) {
super(context, pkg);
}
@Override
protected void acceptCall() {
sendAction(1);
}
@Override
protected void endCall() {
sendAction(0);
}
@Override
public void onNotificationPosted(Notification notification) {
Log.d(TAG, "onNotificationPosted: " + notification);
if (mContext == null || notification == null || mFloatingView == null) {
return;
}
if (isCall(notification)) {
Bundle bundle = notification.extras;
if (bundle != null) {
mFloatingView.setPerson(String.valueOf(bundle.getCharSequence(Notification.EXTRA_TITLE)), null);
}
mActions = notification.actions;
mFloatingView.show(VideoDBHelper.UNKNOWN_NUMBER);
Icon small = notification.getSmallIcon();
if (small != null) {
mFloatingView.setHead(small.loadDrawable(mContext));
}
Icon large = notification.getLargeIcon();
if (large != null) {
mFloatingView.setHead(large.loadDrawable(mContext));
}
if (isLocked()) {
mStatus = STATUS_RINGING;
}
} else if (isAnswer(notification)) {
if (mStatus == STATUS_RINGING) {
mStatus = STATUS_NONE;
showLockGuide();
}
}
}
@Override
public void onNotificationRemoved(Notification notification) {
Log.d(TAG, "onNotificationRemoved: " + notification);
if (isCall(notification)) {
mActions = null;
if (mFloatingView != null) {
mFloatingView.hide();
}
}
}
@Override
public void onDestroy() {
}
private boolean isCall(Notification notification) {
return notification != null && "call".equals(notification.category)
&& "call_notification_group".equals(notification.getGroup())
&& notification.actions != null;
}
private boolean isAnswer(Notification notification) {
return notification != null && "call".equals(notification.category)
&& TextUtils.isEmpty(notification.getGroup());
}
}
package com.mints.goodmoney.call.call;
package com.mints.goodmoney.call.callcore;
import android.app.KeyguardManager;
import android.app.Notification;
......@@ -8,13 +8,15 @@ import android.text.TextUtils;
import com.mints.goodmoney.call.widget.FloatingView;
import com.mints.goodmoney.call.widget.LockGuideView;
/**
* 来电秀核心设置
* 作者:孟崔广
*/
public abstract class CallCore {
protected static final String TAG = "CallCore";
public static final String SYSTEM_CALL_PKG = "system_call";
public static final String WHATS_APP_CALL_PKG = "com.whatsapp";
public static final String WE_CHAT_CALL_PKG = "com.tencent.mm";
protected static final int STATUS_NONE = 0;
protected static final int STATUS_RINGING = 1;
......@@ -119,10 +121,6 @@ public abstract class CallCore {
switch (pkg) {
case SYSTEM_CALL_PKG:
return new SystemCallCore(context, pkg);
case WHATS_APP_CALL_PKG:
return new WhatsAppCallCore(context, pkg);
case WE_CHAT_CALL_PKG:
return new WeChatCallCore(context, pkg);
default:
return null;
}
......
package com.mints.goodmoney.call.call;
package com.mints.goodmoney.call.callcore;
import android.Manifest;
import android.app.Notification;
......@@ -24,13 +24,16 @@ import android.view.KeyCharacterMap;
import android.view.KeyEvent;
import com.android.internal.telephony.ITelephony;
import com.mints.goodmoney.call.business.ContactHelper;
import com.mints.goodmoney.call.service.PhoneListenService;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
/**
* 监听处理来电
* 作者:孟崔广
*/
public class SystemCallCore extends CallCore {
private static final List<String> mCallPkgs = new ArrayList<>();
......@@ -56,9 +59,6 @@ public class SystemCallCore extends CallCore {
mStatus = STATUS_RINGING;
}
mFloatingView.show(number);
if (canReadContact()) {
mFloatingView.setPerson(ContactHelper.getInstance().getContactName(mContext, number), number);
}
} else {
mFloatingView.hide();
if (TelephonyManager.EXTRA_STATE_OFFHOOK.equalsIgnoreCase(state) && mStatus == STATUS_RINGING) {
......
......@@ -14,14 +14,16 @@ import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import com.mints.goodmoney.R;
import com.mints.goodmoney.call.business.ContactHelper;
import com.mints.goodmoney.call.business.VideoDBHelper;
import com.mints.goodmoney.call.permission.PermissionActivity;
import com.mints.goodmoney.call.permission.PermissionManager;
/**
* 设置来电秀
* 作者:孟崔广
*/
public class DetailActivity extends AppCompatActivity {
private static final String TAG = "LLL";
public static final String KEY_VIDEO_PATH = "video_path";
public static final String KEY_SET_RINGTONE = "key_set_ringtone";
......@@ -77,9 +79,6 @@ public class DetailActivity extends AppCompatActivity {
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == REQUEST_ID_PICK_VIDEO_CONTACT) {
if (data != null) {
mContact = ContactHelper.getInstance().getContacts(this, data.getData());
}
}
}
......@@ -92,19 +91,6 @@ public class DetailActivity extends AppCompatActivity {
}
}
public void setRingtone(View view) {
mSetRingtone = !mSetRingtone;
((ImageView) view).setImageResource(mSetRingtone ? R.mipmap.ringtone_set : R.mipmap.ringtone_close);
}
public void setContact(View view) {
if (PermissionManager.getInstance().isContactEnabled(this)) {
selectVideoContact();
} else {
PermissionManager.getInstance().requestContact(this);
}
}
public void setShow(View view) {
if (PermissionManager.getInstance().checkEssential(this)) {
VideoDBHelper.getInstance().setSelectVideo(this, mContact, mVideoPath);
......
......@@ -12,12 +12,15 @@ import androidx.appcompat.app.AppCompatActivity;
import com.mints.goodmoney.R;
import com.mints.goodmoney.call.business.RingtoneHelper;
import com.mints.goodmoney.call.business.VideoDBHelper;
import com.mints.goodmoney.call.permission.PermissionActivity;
import com.mints.goodmoney.call.permission.PermissionManager;
import com.mints.goodmoney.ui.activitys.MainActivity;
/**
* @author liujiadong
* @since 2020/1/20
* 设置成功
* 作者:孟崔广
*/
public class DetailApplyActivity extends AppCompatActivity {
......@@ -79,4 +82,10 @@ public class DetailApplyActivity extends AppCompatActivity {
}
}
}
public void tvSucFinish(View view) {
Intent intent = new Intent(this, MainActivity.class);
startActivity(intent);
finish();
}
}
......@@ -13,6 +13,10 @@ import androidx.appcompat.app.AppCompatActivity;
import com.mints.goodmoney.R;
/**
* 权限申请界面
* 作者:孟崔广
*/
public class PermissionActivity extends AppCompatActivity {
private ImageView mSdcardIv;
......@@ -48,14 +52,14 @@ public class PermissionActivity extends AppCompatActivity {
}
private void updateUI() {
// mSdcardIv.setImageResource(PermissionManager.getInstance().isSdcardEnabled(this)
// ? R.drawable.get_permission : R.drawable.no_permission);
// mPhoneIv.setImageResource(PermissionManager.getInstance().isPhoneEnabled(this)
// ? R.drawable.get_permission : R.drawable.no_permission);
// mFloatIv.setImageResource(PermissionManager.getInstance().isFloatEnabled(this)
// ? R.drawable.get_permission : R.drawable.no_permission);
// mNotificationIv.setImageResource(PermissionManager.getInstance().isNotificationEnabled(this)
// ? R.drawable.get_permission : R.drawable.no_permission);
mSdcardIv.setImageResource(PermissionManager.getInstance().isSdcardEnabled(this)
? R.mipmap.get_permission : R.mipmap.no_permission);
mPhoneIv.setImageResource(PermissionManager.getInstance().isPhoneEnabled(this)
? R.mipmap.get_permission : R.mipmap.no_permission);
mFloatIv.setImageResource(PermissionManager.getInstance().isFloatEnabled(this)
? R.mipmap.get_permission : R.mipmap.no_permission);
mNotificationIv.setImageResource(PermissionManager.getInstance().isNotificationEnabled(this)
? R.mipmap.get_permission : R.mipmap.no_permission);
if (PermissionManager.getInstance().checkEssential(this)) {
finish();
}
......
......@@ -104,13 +104,6 @@ public class PermissionManager {
return isPermissionsEnabled(context, mContactPermissions);
}
public void requestContact(Activity activity) {
if (activity == null) {
return;
}
ActivityCompat.requestPermissions(activity, mContactPermissions, REQUEST_ID_CONTACT_PERMISSION);
}
public void requestSettings(Activity activity) {
try {
if (isSettingsEnabled(activity)) {
......
package com.mints.goodmoney.call.permission;
import android.content.Context;
import android.content.SharedPreferences;
public class PermissionSpHelper {
private static final String PERMISSION_SP = "permission_sp";
private static final String LOCK_PERMISSION_OPEN = "lock_permission_open";
private static final String LAUNCH_PERMISSION_OPEN = "launch_permission_open";
private static final String SETTING_PERMISSION_OPEN = "setting_permission_open";
private PermissionSpHelper() {
}
private static class SingleTon {
private static PermissionSpHelper sInstance = new PermissionSpHelper();
}
public static PermissionSpHelper getInstance() {
return SingleTon.sInstance;
}
private SharedPreferences getSP(Context context) {
return context.getSharedPreferences(PERMISSION_SP, Context.MODE_PRIVATE);
}
public boolean isLockOpen(Context context) {
if (context == null) {
return false;
}
return getSP(context).getBoolean(LOCK_PERMISSION_OPEN, false);
}
public void setLockOpen(Context context) {
if (context == null) {
return;
}
SharedPreferences.Editor editor = getSP(context).edit();
editor.putBoolean(LOCK_PERMISSION_OPEN, true);
editor.apply();
}
public boolean isLaunchOpen(Context context) {
if (context == null) {
return false;
}
return getSP(context).getBoolean(LAUNCH_PERMISSION_OPEN, false);
}
public void setLaunchOpen(Context context) {
if (context == null) {
return;
}
SharedPreferences.Editor editor = getSP(context).edit();
editor.putBoolean(LAUNCH_PERMISSION_OPEN, true);
editor.apply();
}
public boolean isSettingOpen(Context context) {
if (context == null) {
return false;
}
return getSP(context).getBoolean(SETTING_PERMISSION_OPEN, false);
}
public void setSettingOpen(Context context) {
if (context == null) {
return;
}
SharedPreferences.Editor editor = getSP(context).edit();
editor.putBoolean(SETTING_PERMISSION_OPEN, true);
editor.apply();
}
}
......@@ -7,6 +7,10 @@ import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Build;
/**
* 手机厂商权限兼容
* 作者:孟崔广
*/
public class PermissionUtil {
private static final String sManufacturer = Build.MANUFACTURER.toLowerCase();
......
......@@ -17,13 +17,4 @@ public class PreferenceUtil {
public static final String METHOD_EIDIT_VALUE = "method_edit";
public static final String METHOD_QUERY_PID = "method_query_pid";
public static final String KEY_VALUES = "key_result";
public static final Uri sContentCreate = Uri.withAppendedPath(URI, "create");
public static final Uri sContentChanged = Uri.withAppendedPath(URI, "changed");
public static SharedPreferences getSharedPreference(@NonNull Context ctx, String preferName) {
return SharedPreferenceProxy.getSharedPreferences(ctx, preferName);
}
}
package com.mints.goodmoney.call.preference;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.os.Process;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.collection.ArrayMap;
import java.util.ArrayList;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger;
public class SharedPreferenceProxy implements SharedPreferences {
private static Map<String, SharedPreferenceProxy> sharedPreferenceProxyMap;
/**
* Flag whether caller process is the same with provider
* 0: unknown
* 1: the same
* -1: not the same
*/
private static AtomicInteger processFlag = new AtomicInteger(0);
private Context ctx;
private String preferName;
private SharedPreferenceProxy(Context ctx, String name) {
this.ctx = ctx.getApplicationContext();
this.preferName = name;
}
@Override
public Map<String, ?> getAll() {
throw new UnsupportedOperationException("Not support method getAll");
}
@Nullable
@Override
public String getString(String key, @Nullable String defValue) {
OpEntry result = getResult(OpEntry.obtainGetOperation(key).setStringValue(defValue));
return result == null ? defValue : result.getStringValue(defValue);
}
@Nullable
@Override
public Set<String> getStringSet(String key, @Nullable Set<String> defValues) {
OpEntry result = getResult(OpEntry.obtainGetOperation(key).setStringSettingsValue(defValues));
if (result == null) {
return defValues;
}
Set<String> set = result.getStringSet();
if (set == null) {
return defValues;
}
return set;
}
@Override
public int getInt(String key, int defValue) {
OpEntry result = getResult(OpEntry.obtainGetOperation(key).setIntValue(defValue));
return result == null ? defValue : result.getIntValue(defValue);
}
@Override
public long getLong(String key, long defValue) {
OpEntry result = getResult(OpEntry.obtainGetOperation(key).setLongValue(defValue));
return result == null ? defValue : result.getLongValue(defValue);
}
@Override
public float getFloat(String key, float defValue) {
OpEntry result = getResult(OpEntry.obtainGetOperation(key).setFloatValue(defValue));
return result == null ? defValue : result.getFloatValue(defValue);
}
@Override
public boolean getBoolean(String key, boolean defValue) {
OpEntry result = getResult(OpEntry.obtainGetOperation(key).setBooleanValue(defValue));
return result == null ? defValue : result.getBooleanValue(defValue);
}
@Override
public boolean contains(String key) {
Bundle input = new Bundle();
input.putString(OpEntry.KEY_KEY, key);
try {
Bundle res = ctx.getContentResolver().call(PreferenceUtil.URI
, PreferenceUtil.METHOD_CONTAIN_KEY
, preferName
, input);
return res.getBoolean(PreferenceUtil.KEY_VALUES);
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
@Override
public Editor edit() {
return new EditorImpl();
}
@Override
public void registerOnSharedPreferenceChangeListener(OnSharedPreferenceChangeListener listener) {
throw new UnsupportedOperationException();
}
@Override
public void unregisterOnSharedPreferenceChangeListener(OnSharedPreferenceChangeListener listener) {
throw new UnsupportedOperationException();
}
private OpEntry getResult(@NonNull OpEntry input) {
try {
Bundle res = ctx.getContentResolver().call(PreferenceUtil.URI
, PreferenceUtil.METHOD_QUERY_VALUE
, preferName
, input.getBundle());
return new OpEntry(res);
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
public class EditorImpl implements Editor {
private ArrayList<OpEntry> mModified = new ArrayList<>();
@Override
public Editor putString(String key, @Nullable String value) {
OpEntry entry = OpEntry.obtainPutOperation(key).setStringValue(value);
return addOps(entry);
}
@Override
public Editor putStringSet(String key, @Nullable Set<String> values) {
OpEntry entry = OpEntry.obtainPutOperation(key).setStringSettingsValue(values);
return addOps(entry);
}
@Override
public Editor putInt(String key, int value) {
OpEntry entry = OpEntry.obtainPutOperation(key).setIntValue(value);
return addOps(entry);
}
@Override
public Editor putLong(String key, long value) {
OpEntry entry = OpEntry.obtainPutOperation(key).setLongValue(value);
return addOps(entry);
}
@Override
public Editor putFloat(String key, float value) {
OpEntry entry = OpEntry.obtainPutOperation(key).setFloatValue(value);
return addOps(entry);
}
@Override
public Editor putBoolean(String key, boolean value) {
OpEntry entry = OpEntry.obtainPutOperation(key).setBooleanValue(value);
return addOps(entry);
}
@Override
public Editor remove(String key) {
OpEntry entry = OpEntry.obtainRemoveOperation(key);
return addOps(entry);
}
@Override
public Editor clear() {
return addOps(OpEntry.obtainClear());
}
@Override
public boolean commit() {
Bundle input = new Bundle();
input.putParcelableArrayList(PreferenceUtil.KEY_VALUES, convertBundleList());
input.putInt(OpEntry.KEY_OP_TYPE, OpEntry.OP_TYPE_COMMIT);
Bundle res = null;
try {
res = ctx.getContentResolver().call(PreferenceUtil.URI, PreferenceUtil.METHOD_EIDIT_VALUE, preferName, input);
} catch (Exception e) {
e.printStackTrace();
}
if (res == null) {
return false;
}
return res.getBoolean(PreferenceUtil.KEY_VALUES, false);
}
@Override
public void apply() {
Bundle intput = new Bundle();
intput.putParcelableArrayList(PreferenceUtil.KEY_VALUES, convertBundleList());
intput.putInt(OpEntry.KEY_OP_TYPE, OpEntry.OP_TYPE_APPLY);
try {
ctx.getContentResolver().call(PreferenceUtil.URI, PreferenceUtil.METHOD_EIDIT_VALUE, preferName, intput);
} catch (Exception e) {
e.printStackTrace();
}
}
private Editor addOps(OpEntry op) {
synchronized (this) {
mModified.add(op);
return this;
}
}
private ArrayList<Bundle> convertBundleList() {
synchronized (this) {
ArrayList<Bundle> bundleList = new ArrayList<>(mModified.size());
for (OpEntry entry : mModified) {
bundleList.add(entry.getBundle());
}
return bundleList;
}
}
}
public static SharedPreferences getSharedPreferences(@NonNull Context ctx, String preferName) {
//First check if the same process
if (processFlag.get() == 0) {
Bundle bundle = ctx.getContentResolver().call(PreferenceUtil.URI, PreferenceUtil.METHOD_QUERY_PID, "", null);
int pid = 0;
if (bundle != null) {
pid = bundle.getInt(PreferenceUtil.KEY_VALUES);
}
//Can not get the pid, something wrong!
if (pid == 0) {
return getFromLocalProcess(ctx, preferName);
}
processFlag.set(Process.myPid() == pid ? 1 : -1);
return getSharedPreferences(ctx, preferName);
} else if (processFlag.get() > 0) {
return getFromLocalProcess(ctx, preferName);
} else {
return getFromRemoteProcess(ctx, preferName);
}
}
private static SharedPreferences getFromRemoteProcess(@NonNull Context ctx, String preferName) {
synchronized (SharedPreferenceProxy.class) {
if (sharedPreferenceProxyMap == null) {
sharedPreferenceProxyMap = new ArrayMap<>();
}
SharedPreferenceProxy preferenceProxy = sharedPreferenceProxyMap.get(preferName);
if (preferenceProxy == null) {
preferenceProxy = new SharedPreferenceProxy(ctx.getApplicationContext(), preferName);
sharedPreferenceProxyMap.put(preferName, preferenceProxy);
}
return preferenceProxy;
}
}
private static SharedPreferences getFromLocalProcess(@NonNull Context ctx, String preferName) {
return ctx.getSharedPreferences(preferName, Context.MODE_PRIVATE);
}
}
......@@ -10,7 +10,10 @@ import android.util.Log;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
/**
* 初始化数据库
* 作者:孟崔广
*/
public class CallProvider extends ContentProvider {
private static final String TAG = "LLL";
......
......@@ -12,14 +12,17 @@ import android.service.notification.StatusBarNotification;
import android.util.Log;
import com.mints.goodmoney.R;
import com.mints.goodmoney.call.call.CallCore;
import com.mints.goodmoney.call.call.SystemCallCore;
import com.mints.goodmoney.call.callcore.CallCore;
import com.mints.goodmoney.call.callcore.SystemCallCore;
import com.mints.goodmoney.ui.activitys.MainActivity;
import java.util.HashMap;
import java.util.Map;
/**
* 通知核心
* 作者:孟崔广
*/
public class PhoneListenService extends NotificationListenerService {
public static final String TAG = "PhoneListenService";
......
package com.mints.goodmoney.call.util;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
/**
* @author liujiadong
* @since 2020/1/10
*/
public class DialogUtil {
public static void showDialog(Context context, String msg, String pos, String neg,
DialogInterface.OnClickListener posListener, DialogInterface.OnClickListener negListener) {
new AlertDialog.Builder(context)
.setMessage(msg)
.setPositiveButton(pos, posListener)
.setNegativeButton(neg, negListener)
.create()
.show();
}
}
package com.mints.goodmoney.mvp.model;
import com.bytedance.sdk.openadsdk.TTFeedAd;
import java.io.Serializable;
import java.util.List;
public class KylBean implements Serializable {
private List<Data> data;
public static class Data implements Serializable {
private String pvurl;
private String url;
private String nm;
private TTFeedAd adBean;
public String getPvurl() {
return pvurl;
}
public void setPvurl(String pvurl) {
this.pvurl = pvurl;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getNm() {
return nm;
}
public void setNm(String nm) {
this.nm = nm;
}
public TTFeedAd getAdBean() {
return adBean;
}
public void setAdBean(TTFeedAd adBean) {
this.adBean = adBean;
}
}
public List<Data> getData() {
return data;
}
public void setData(List<Data> data) {
this.data = data;
}
}
package com.mints.goodmoney.mvp.model
import java.io.Serializable
/**
* 酷音乐视频列表
*/
data class KylVedioBean(
val `data`: List<Data>,
val desc: String,
val more: String,
val px: String,
val retcode: String,
val retdesc: String,
val total: Int
): Serializable
data class Data(
val charge: String,
val duration: String,
val height: String,
val id: String,
val labels: List<String>,
val nm: String,
val price: String,
val pvurl: String,
val seton: String,
val size: String,
val song: Song,
val tp: String,
val url: String,
val videos: List<Video>,
val width: String
): Serializable
data class Song(
val name: String,
val singer: String
): Serializable
data class Video(
val height: String,
val size: String,
val url: String,
val width: String
): Serializable
\ No newline at end of file
package com.mints.goodmoney.mvp.presenters
import com.google.gson.JsonObject
import com.mints.goodmoney.common.Constant
import com.mints.goodmoney.manager.AppHttpManager
import com.mints.goodmoney.mvp.model.BaseResponse
import com.mints.goodmoney.mvp.model.KylVedioBean
import com.mints.goodmoney.mvp.views.BookView
import com.mints.goodmoney.mvp.model.KylBean
import com.mints.goodmoney.mvp.views.KuYinYuePageView
import com.mints.goodmoney.utils.LogUtil
import com.mints.library.net.neterror.BaseSubscriber
import com.mints.library.net.neterror.Throwable
import com.mints.library.utils.json.JsonUtil
import java.util.*
class KuYinYuePagePresenter : BasePresenter<KuYinYuePageView>() {
......@@ -22,7 +17,7 @@ class KuYinYuePagePresenter : BasePresenter<KuYinYuePageView>() {
vo["size"] = pageCount
AppHttpManager.getInstance(loanApplication)
.call(loanService.getXfPageMsg(vo),
object : BaseSubscriber<BaseResponse<KylVedioBean>>() {
object : BaseSubscriber<BaseResponse<KylBean>>() {
override fun onCompleted() {
}
......@@ -32,7 +27,7 @@ class KuYinYuePagePresenter : BasePresenter<KuYinYuePageView>() {
view.getXfPageMsgFail()
}
override fun onNext(baseResponse: BaseResponse<KylVedioBean>) {
override fun onNext(baseResponse: BaseResponse<KylBean>) {
if (isLinkView) return
val code = baseResponse.getStatus()
when (code) {
......
package com.mints.goodmoney.mvp.views
import com.mints.goodmoney.mvp.model.KylVedioBean
import com.mints.goodmoney.mvp.model.KylBean
interface KuYinYuePageView : BaseView {
fun getXfPageMsgSuc(data: KylVedioBean)
fun getXfPageMsgSuc(data: KylBean)
fun getXfPageMsgFail()
}
......@@ -10,10 +10,9 @@ import com.mints.goodmoney.mvp.model.BaseResponse;
import com.mints.goodmoney.mvp.model.DrawcashBean;
import com.mints.goodmoney.mvp.model.DrawcashRecordBean;
import com.mints.goodmoney.mvp.model.FriendHallMsgBean;
import com.mints.goodmoney.mvp.model.FriendsTaskBean;
import com.mints.goodmoney.mvp.model.GoldRecordBean;
import com.mints.goodmoney.mvp.model.KylBean;
import com.mints.goodmoney.mvp.model.KylTabBean;
import com.mints.goodmoney.mvp.model.KylVedioBean;
import com.mints.goodmoney.mvp.model.MainVedioMsgBean;
import com.mints.goodmoney.mvp.model.MealBean;
import com.mints.goodmoney.mvp.model.MorningClockBean;
......@@ -501,7 +500,7 @@ public interface LoanService {
* @return
*/
@POST("api/getXfPageMsg")
Observable<BaseResponse<KylVedioBean>> getXfPageMsg(@Body Map<String, Object> vo);
Observable<BaseResponse<KylBean>> getXfPageMsg(@Body Map<String, Object> vo);
/**
* 默认http工厂
......@@ -516,29 +515,29 @@ public interface LoanService {
builder.readTimeout(20, TimeUnit.SECONDS);
builder.writeTimeout(20, TimeUnit.SECONDS);
if (BuildConfig.DEBUG) {
HttpLoggingInterceptor logging = new HttpLoggingInterceptor();
logging.setLevel(HttpLoggingInterceptor.Level.BODY);
builder.interceptors().add(logging);
}
// if (BuildConfig.DEBUG) {
// HttpLoggingInterceptor logging = new HttpLoggingInterceptor(message -> {
// if (TextUtils.isEmpty(message)) return;
// String s = message.substring(0, 1);
// String request = message.substring(0, 4);
// if ("{".equals(s) || "[".equals(s)) {
// Logger.json(message);
// } else if (request.contains("-->") || request.contains("<--")) {
// Logger.d("Method" + message);
// } else {
// Logger.d("params:" + message);
// }
// });
// HttpLoggingInterceptor logging = new HttpLoggingInterceptor();
// logging.setLevel(HttpLoggingInterceptor.Level.BODY);
// builder.interceptors().add(logging);
// }
if (BuildConfig.DEBUG) {
HttpLoggingInterceptor logging = new HttpLoggingInterceptor(message -> {
if (TextUtils.isEmpty(message)) return;
String s = message.substring(0, 1);
String request = message.substring(0, 4);
if ("{".equals(s) || "[".equals(s)) {
Logger.json(message);
} else if (request.contains("-->") || request.contains("<--")) {
Logger.d("Method" + message);
} else {
Logger.d("params:" + message);
}
});
logging.setLevel(HttpLoggingInterceptor.Level.BODY);
builder.interceptors().add(logging);
}
OkHttpInterceptor okHttpInterceptor = new OkHttpInterceptor(AESUtils.getDefaultKey());
builder.interceptors().add(okHttpInterceptor);
......
package com.mints.goodmoney.ui.activitys
import android.Manifest
import android.os.Bundle
import android.text.TextUtils
import android.view.View
import cn.jzvd.Jzvd
import cn.sharesdk.wechat.friends.Wechat
import com.dingmouren.videowallpaper.VideoWallpaper
import com.downloader.Error
import com.downloader.OnDownloadListener
......@@ -21,6 +23,7 @@ import com.mints.goodmoney.ui.activitys.base.BaseActivity
import com.mints.goodmoney.utils.CacheUtil
import com.mints.goodmoney.utils.LogUtil
import com.mints.goodmoney.utils.MD5
import com.tbruyelle.rxpermissions.RxPermissions
import kotlinx.android.synthetic.main.activity_kyl_vedio.*
/**
......@@ -43,10 +46,6 @@ class KylVedioActivity : BaseActivity(), View.OnClickListener, KylVedioView {
private val videoWallpaper by lazy { VideoWallpaper() }
private var downloadId: Int = -1//vedio下载id
private var downloadVedioSucFlag = false// 下载视频成功
private var cachePath = ""// cache路径
private var vedioPath = ""// vedio路径
private var vedioName = ""// 视频名称
override fun getContentViewLayoutID() = R.layout.activity_kyl_vedio
......@@ -65,12 +64,6 @@ class KylVedioActivity : BaseActivity(), View.OnClickListener, KylVedioView {
finish()
return
}
cachePath = cacheDir.path + "/"
try {
vedioPath = getExternalFilesDir(null)!!.absolutePath + "/video/"
} catch (e: java.lang.Exception) {
vedioPath = filesDir.absolutePath + "/video/"
}
vedioAdingManager = VedioAdingManager.getInstance(this)
initListener()
loadVedio(vedioUrl)
......@@ -130,30 +123,42 @@ class KylVedioActivity : BaseActivity(), View.OnClickListener, KylVedioView {
when (v?.id) {
R.id.ivBack -> finish()
R.id.ivSetting -> {
awardVedio()
downloadVedioToCacheFile()
RxPermissions(this)
.request(Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE)
.subscribe { granted: Boolean ->
if (granted) {
// downloadVedioToCacheFile()
} else {
showMissingPermissionDialog("存储")
}
}
// awardVedio()
}
}
}
private fun downloadVedioToCacheFile() {
vedioName = MD5.GetMD5Code(System.currentTimeMillis().toString() + UserManager.getInstance().userID) + ".mp4"
downloadId = PRDownloader.download(vedioUrl, cachePath, vedioName)
showLoading("加载中...")
var vedioPath = ""
try {
vedioPath = getExternalFilesDir(null)!!.absolutePath + "/video/"
} catch (e: java.lang.Exception) {
vedioPath = filesDir.absolutePath + "/video/"
}
val vedioName = MD5.GetMD5Code(System.currentTimeMillis().toString() + UserManager.getInstance().userID + vedioUrl) + ".mp4"
downloadId = PRDownloader.download(vedioUrl, vedioPath, vedioName)
.build()
// .setOnStartOrResumeListener { }
// .setOnPauseListener {
// }
// .setOnCancelListener {
// }
// .setOnProgressListener { progress ->
// }
.start(object : OnDownloadListener {
override fun onDownloadComplete() {
downloadVedioSucFlag = true
hideLoading()
// downloadVedioSucFlag = true
val vedioName = vedioPath + vedioName
DetailActivity.startSelf(this@KylVedioActivity, vedioName)
}
override fun onError(error: Error) {
showToast("加载失败")
hideLoading()
}
})
}
......@@ -215,16 +220,7 @@ class KylVedioActivity : BaseActivity(), View.OnClickListener, KylVedioView {
private fun vedioAdingSuccess(adType: String) {
if (downloadVedioSucFlag) {
LogUtil.d("KylVedioActivity", "name:-->" + cachePath + vedioName)
try {
// showToast("设置壁纸成功")
videoWallpaper.setToWallPaper(this, cachePath + vedioName)
// val cacheName = cachePath + vedioName
// val vedioName = vedioPath + vedioName
// Thread(Runnable {
// Util.CopyAssets(this, cacheName, vedioName)
// }).start()
// DetailActivity.startSelf(this, vedioName)
} catch (e: Exception) {
e.printStackTrace()
}
......
......@@ -2,19 +2,19 @@ package com.mints.goodmoney.ui.fragment
import android.os.Bundle
import androidx.recyclerview.widget.GridLayoutManager
import com.bytedance.sdk.openadsdk.*
import com.mints.goodmoney.R
import com.mints.goodmoney.mvp.model.Data
import com.mints.goodmoney.mvp.model.KylVedioBean
import com.mints.goodmoney.manager.TtCsjAdManager
import com.mints.goodmoney.mvp.model.KylBean
import com.mints.goodmoney.mvp.presenters.KuYinYuePagePresenter
import com.mints.goodmoney.mvp.views.KuYinYuePageView
import com.mints.goodmoney.ui.activitys.KylVedioActivity
import com.mints.goodmoney.ui.activitys.XmlyPlayActivity
import com.mints.goodmoney.ui.adapter.KylPageAdapter
import com.mints.goodmoney.ui.fragment.base.LazyLoadBaseFragment
import com.mints.goodmoney.utils.LogUtil
import com.scwang.smartrefresh.layout.api.RefreshLayout
import com.scwang.smartrefresh.layout.listener.OnLoadMoreListener
import com.scwang.smartrefresh.layout.listener.OnRefreshListener
import com.ximalaya.ting.android.opensdk.model.album.Album
import kotlinx.android.synthetic.main.fragment_main_kyl_page.*
/**
......@@ -26,13 +26,16 @@ class KuYinYuePageFragment(private val targetid: String) : LazyLoadBaseFragment(
OnRefreshListener,
OnLoadMoreListener,
KylPageAdapter.OnItemClickListener {
private var mTTAdNative: TTAdNative? = null
private val kuYinYuePagePresenter by lazy { KuYinYuePagePresenter() }
private lateinit var kylPageAdapter: KylPageAdapter
private var kylData: MutableList<Data> = mutableListOf()
private var kylData: MutableList<KylBean.Data> = mutableListOf()
private var curPage = 1 // 分页
private val PAGE_SIZE = 20
private val PAGE_SIZE = 6
private var feedAd: TTFeedAd? = null
override fun getContentViewLayoutID() = R.layout.fragment_main_kyl_page
......@@ -43,10 +46,13 @@ class KuYinYuePageFragment(private val targetid: String) : LazyLoadBaseFragment(
super.onFragmentFirstVisible()
kuYinYuePagePresenter.attachView(this)
mTTAdNative = TTAdSdk.getAdManager().createAdNative(context)
initRvView()
initListener()
kuYinYuePagePresenter.getXfPageMsg(targetid, curPage, PAGE_SIZE)
// loadListAd()
getXfPageMsg()
}
override fun onDestroy() {
......@@ -61,23 +67,41 @@ class KuYinYuePageFragment(private val targetid: String) : LazyLoadBaseFragment(
bundle.putString(KylVedioActivity.VEDIO_URL, kylData[position].url)
readyGo(KylVedioActivity::class.java, bundle)
}
}
override fun onRefresh(refreshLayout: RefreshLayout) {
curPage = 1
kylData.clear()
srl_kyl.resetNoMoreData()
kuYinYuePagePresenter.getXfPageMsg(targetid, curPage, PAGE_SIZE)
// loadListAd()
getXfPageMsg()
}
override fun onLoadMore(refreshLayout: RefreshLayout) {
curPage = ++curPage
kuYinYuePagePresenter.getXfPageMsg(targetid, curPage, PAGE_SIZE)
// loadListAd()
getXfPageMsg()
}
override fun getXfPageMsgSuc(data: KylVedioBean) {
override fun getXfPageMsgSuc(data: KylBean) {
if (::kylPageAdapter.isInitialized) {
// if (feedAd != null) {
// for (i in 0..data.data.size - 1) {
// if (i == 4) {
// val data1 = KylBean.Data()
// data1.adBean = feedAd
// kylData.add(data1)
// continue
// }
// kylData.add(data.data[i])
// }
// } else {
// kylData.addAll(data.data)
// }
kylData.addAll(data.data)
if (curPage == 1) {
srl_kyl.finishRefresh(true)
kylPageAdapter.notifyDataSetChanged()
......@@ -110,4 +134,42 @@ class KuYinYuePageFragment(private val targetid: String) : LazyLoadBaseFragment(
srl_kyl.setOnRefreshListener(this)
srl_kyl.setOnLoadMoreListener(this)
}
/**
* 加载feed广告
*/
private fun loadListAd() {
feedAd = null
val adSlot = AdSlot.Builder()
.setCodeId(TtCsjAdManager.TT_AD_NATIVEEXPRESS_AWARD)
.setImageAcceptedSize(640, 320)
//[start支持模板样式]:需要支持模板广告和原生广告样式的切换,需要调用supportRenderControl和setExpressViewAcceptedSize
.supportRenderControl()
.setExpressViewAcceptedSize(500f, 500f)//设置模板宽高(dp)
.setAdCount(1) //请求广告数量为1到3条
.build()
mTTAdNative?.loadFeedAd(adSlot, object : TTAdNative.FeedAdListener {
override fun onError(code: Int, message: String) {
LogUtil.d("KuYinYuePageFragment", "code:${code} message:${message}")
getXfPageMsg()
}
override fun onFeedAdLoad(ads: List<TTFeedAd>) {
if (ads == null || ads.isEmpty()) {
getXfPageMsg()
return
}
for (ad in ads) {
if (ad.imageMode == TTAdConstant.IMAGE_MODE_LARGE_IMG) {
feedAd = ad
}
}
getXfPageMsg()
}
})
}
private fun getXfPageMsg() {
kuYinYuePagePresenter.getXfPageMsg(targetid, curPage, PAGE_SIZE)
}
}
\ No newline at end of file
......@@ -9,38 +9,18 @@
android:layout_height="match_parent"
android:layout_centerInParent="true" />
<RelativeLayout
<TextView
android:id="@+id/set_show_tv"
android:layout_width="match_parent"
android:layout_height="82dp"
android:layout_alignParentBottom="true">
<ImageView
android:visibility="gone"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_centerVertical="true"
android:layout_marginEnd="45dp"
android:layout_toStartOf="@+id/set_show_tv"
android:onClick="setRingtone"
android:src="@mipmap/ic_launcher" />
<TextView
android:id="@+id/set_show_tv"
android:layout_width="120dp"
android:layout_height="45dp"
android:layout_centerInParent="true"
android:gravity="center"
android:text="设置"
android:onClick="setShow"/>
<ImageView
android:visibility="gone"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_centerVertical="true"
android:layout_marginStart="45dp"
android:layout_toEndOf="@+id/set_show_tv"
android:onClick="setContact"
android:src="@mipmap/ic_launcher" />
</RelativeLayout>
android:layout_height="40dp"
android:layout_alignParentBottom="true"
android:layout_marginLeft="50dp"
android:layout_marginTop="10dp"
android:layout_marginRight="50dp"
android:layout_marginBottom="10dp"
android:background="@drawable/shape_tv_gold"
android:gravity="center"
android:onClick="setShow"
android:text="设置来电秀"
android:textColor="@color/white" />
</RelativeLayout>
\ No newline at end of file
......@@ -2,7 +2,7 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/black"
android:background="@color/white"
android:orientation="vertical">
<TextView
......@@ -11,8 +11,22 @@
android:layout_gravity="center"
android:layout_marginTop="200dp"
android:gravity="center"
android:textColor="@color/colorAccent"
android:textSize="26sp" />
android:text="应用来电秀设置成功"
android:textColor="@color/color_FF9837"
android:textSize="20sp" />
<TextView
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_marginLeft="150dp"
android:layout_marginTop="100dp"
android:layout_marginRight="150dp"
android:layout_marginBottom="10dp"
android:background="@drawable/shape_tv_gold"
android:gravity="center"
android:onClick="tvSucFinish"
android:text="我知道了"
android:textColor="@color/white" />
<TextView
android:id="@+id/ringtone_apply_tv"
......@@ -20,7 +34,7 @@
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="40dp"
android:textColor="@color/colorAccent"
android:textColor="@color/color_FF9837"
android:textSize="26sp"
android:visibility="gone" />
</LinearLayout>
\ No newline at end of file
......@@ -16,7 +16,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="4dp"
android:layout_marginTop="4dp"
android:layout_marginTop="14dp"
android:padding="20dp"
android:src="@mipmap/ic_left_arrow"
app:layout_constraintLeft_toLeftOf="parent"
......
......@@ -2,15 +2,14 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/black"
android:background="@color/white"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="120dp"
android:layout_gravity="center"
android:layout_marginStart="40dp"
android:layout_marginEnd="40dp"
android:layout_marginTop="20dp"
android:gravity="center"
android:text="@string/permission_tip"
android:textColor="@color/colorAccent"
......@@ -30,7 +29,7 @@
android:layout_gravity="center"
android:layout_weight="0.7"
android:text="@string/sdcard_permission"
android:textColor="@color/white"
android:textColor="@color/color_FF9837"
android:textSize="20sp" />
<ImageView
......@@ -55,7 +54,7 @@
android:layout_gravity="center"
android:layout_weight="0.7"
android:text="@string/phone_permission"
android:textColor="@color/white"
android:textColor="@color/color_FF9837"
android:textSize="20sp" />
<ImageView
......@@ -80,7 +79,7 @@
android:layout_gravity="center"
android:layout_weight="0.7"
android:text="@string/float_permission"
android:textColor="@color/white"
android:textColor="@color/color_FF9837"
android:textSize="20sp" />
<ImageView
......@@ -105,7 +104,7 @@
android:layout_gravity="center"
android:layout_weight="0.7"
android:text="@string/notification_permission"
android:textColor="@color/white"
android:textColor="@color/color_FF9837"
android:textSize="20sp" />
<ImageView
......@@ -118,16 +117,16 @@
</LinearLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="20dp"
android:paddingStart="30dp"
android:paddingTop="10dp"
android:paddingEnd="30dp"
android:paddingBottom="10dp"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_marginLeft="60dp"
android:layout_marginTop="30dp"
android:layout_marginRight="60dp"
android:layout_marginBottom="10dp"
android:background="@drawable/shape_tv_gold"
android:gravity="center"
android:onClick="getPermission"
android:text="@string/get_permission"
android:textColor="@color/white"
android:textSize="20sp"
android:onClick="getPermission"/>
android:textSize="20sp" />
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="340dp"
android:layout_margin="4dp"
android:background="@color/white"
android:orientation="vertical">
<include
android:id="@+id/icon_source_layout"
layout="@layout/listitem_ad_icon_source_layout" />
<TextView
android:id="@+id/tvKylPageContent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="6dp"
android:text="123213112321311232131123213112321311232131123213112321311232131123213112321311232131"
android:textColor="@color/black"
android:textSize="14sp"
android:textStyle="bold" />
<com.shehuan.niv.NiceImageView
android:id="@+id/ivKylPage"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:scaleType="fitXY"
android:src="@mipmap/bg_eat" />
<TextView
android:id="@+id/tvKylPagecount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="6dp"
android:layout_marginBottom="6dp"
android:drawableLeft="@mipmap/ic_headset"
android:drawablePadding="6dp"
android:gravity="center_vertical"
android:text="7.2亿"
android:textColor="@color/color_AAA"
android:textSize="12sp"
android:visibility="gone" />
<include
android:id="@+id/ad_title_creative_btn_layout"
layout="@layout/listitem_ad_title_creative_btn_layout"
android:layout_width="match_parent"
android:layout_height="45dp"
android:layout_below="@+id/iv_listitem_image" />
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="340dp"
android:layout_margin="4dp"
android:background="@color/white"
android:orientation="vertical">
......@@ -10,7 +10,8 @@
<com.shehuan.niv.NiceImageView
android:id="@+id/ivKylPage"
android:layout_width="match_parent"
android:layout_height="300dp"
android:layout_height="0dp"
android:layout_weight="1"
android:scaleType="fitXY"
android:src="@mipmap/bg_eat" />
......@@ -28,7 +29,6 @@
android:textStyle="bold" />
<TextView
android:visibility="gone"
android:id="@+id/tvKylPagecount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
......@@ -39,5 +39,6 @@
android:gravity="center_vertical"
android:text="7.2亿"
android:textColor="@color/color_AAA"
android:textSize="12sp" />
android:textSize="12sp"
android:visibility="gone" />
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/icon_source_layout"
android:layout_width="match_parent"
android:layout_height="30dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="5dp">
<ImageView
android:id="@+id/iv_listitem_icon"
android:layout_width="30dp"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_centerVertical="true"
android:layout_marginEnd="10dp"
android:layout_marginRight="10dp"
android:src="@drawable/tt_mute" />
<TextView
android:id="@+id/tv_listitem_ad_source"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerVertical="true"
android:layout_toEndOf="@+id/iv_listitem_icon"
android:layout_toLeftOf="@+id/iv_listitem_dislike"
android:layout_toRightOf="@+id/iv_listitem_icon"
android:layout_toStartOf="@+id/iv_listitem_dislike"
android:ellipsize="end"
android:gravity="center_vertical"
android:singleLine="true"
android:text="着陆无双"
android:textColor="#70000000"
android:textSize="16sp" />
<ImageView
android:id="@+id/iv_listitem_dislike"
android:layout_width="20dp"
android:layout_height="match_parent"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_gravity="center_vertical"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:layout_marginRight="0dp"
android:clickable="true"
android:focusable="true"
android:src="@drawable/tt_dislike" />
</RelativeLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/ad_title_creative_btn_layout"
android:layout_width="match_parent"
android:layout_height="45dp"
android:layout_below="@+id/iv_listitem_image"
android:layout_marginBottom="2dp"
android:background="#F4F5F7">
<TextView
android:id="@+id/tv_listitem_ad_title"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_centerVertical="true"
android:layout_toLeftOf="@+id/btn_listitem_creative"
android:layout_toStartOf="@+id/btn_listitem_creative"
android:gravity="center_vertical"
android:singleLine="true"
android:text="计策略,才真三国!"
android:textSize="18sp" />
<Button
android:id="@+id/btn_listitem_creative"
android:layout_width="68dp"
android:layout_height="28dp"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginEnd="8dp"
android:layout_marginLeft="3dp"
android:layout_marginRight="8dp"
android:layout_marginStart="3dp"
android:background="@drawable/shape_jd_selected"
android:gravity="center"
android:text="立即下载"
android:textColor="@color/black"
android:textSize="14sp" />
</RelativeLayout>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment