Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
JasonQS committed Jun 7, 2018
1 parent 2aa083a commit b7c6a8e
Show file tree
Hide file tree
Showing 30 changed files with 311 additions and 1,029 deletions.
42 changes: 24 additions & 18 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 26
compileSdkVersion 27
defaultConfig {
applicationId "com.qsboy.antirecall"
minSdkVersion 19
targetSdkVersion 26
versionCode 6
versionName 'v5.1.0'
targetSdkVersion 27
versionCode 7
versionName 'v5.1.1'
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}
Expand All @@ -38,23 +38,29 @@ android {
}

dependencies {
// recyclerViewAdapter helper
implementation 'com.github.CymChad:BaseRecyclerViewAdapterHelper:2.9.36'
// folding cell
implementation 'com.ramotion.foldingcell:folding-cell:1.2.1'
// navigation tab bar
implementation 'devlight.io:navigationtabbar:1.2.5'
implementation 'com.zzhoujay.richtext:richtext:3.0.0'
implementation 'br.com.simplepass:loading-button-android:1.12.1'
// loading button
implementation 'br.com.simplepass:loading-button-android:1.14.0'
// overlay permission
implementation 'com.github.czy1121:settingscompat:1.1.4'
// implementation 'com.github.dmytrodanylyk.circular-progress-button:library:1.1.3'
// implementation 'com.kyleduo.switchbutton:library:2.0.0'
// implementation 'com.github.PhilJay:MPAndroidChart:v3.0.3'
// implementation 'com.squareup.okhttp3:okhttp:3.9.1'
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.volley:volley:1.1.0'
// markdown
implementation 'com.zzhoujay.richtext:richtext:3.0.0'
// check update
implementation 'com.allenliu.versionchecklib:library:2.0.5'

// implementation 'com.github.PhilJay:MPAndroidChart:v3.0.3'
// gson
implementation 'com.google.code.gson:gson:2.8.5'
implementation 'com.android.support:support-vector-drawable:27.1.1'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation 'com.android.support:design:26.1.0'
implementation 'com.android.support:support-vector-drawable:26.1.0'
implementation 'com.android.support:support-v4:26.1.0'
implementation 'com.android.support:cardview-v7:26.1.0'
implementation 'com.android.support:preference-v7:26.1.0'
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation fileTree(include: ['*.jar'], dir: 'libs')
}
15 changes: 0 additions & 15 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -69,21 +69,6 @@
</intent-filter>
</service>

<receiver android:name=".ui.LaunchReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>

<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="com.qsboy.provider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_paths" />
</provider>
</application>

</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@

package com.qsboy.antirecall.access;

import android.app.KeyguardManager;
import android.app.Notification;
import android.content.Context;
import android.os.Bundle;
import android.os.PowerManager;
import android.service.notification.NotificationListenerService;
Expand Down
4 changes: 0 additions & 4 deletions app/src/main/java/com/qsboy/antirecall/db/Dao.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.nfc.Tag;
import android.util.Log;

import java.util.ArrayList;
Expand Down Expand Up @@ -262,7 +261,6 @@ public List<Messages> queryAllRecalls() {
}

public List<String> queryAllTables() {
Log.e(TAG, "queryAllTables: " + db.getPath());
List<String> list = new ArrayList<>();
cursor = db.rawQuery("SELECT name FROM sqlite_master WHERE type = 'table'", null);
if (!cursor.moveToFirst())
Expand All @@ -272,14 +270,12 @@ public List<String> queryAllTables() {
if (name != null)
list.add(name);
} while (cursor.moveToNext());
Log.w(TAG, "queryAllTables: tables: " + list);
return list;
}

public List<Messages> queryAllTheLastMessage(List<String> nameList) {
List<Messages> list = new ArrayList<>();
for (String name : nameList) {
Log.i(TAG, "queryAllTheLastMessage: name: " + name);
if ("android_metadata".equals(name) || "sqlite_sequence".equals(name))
continue;
cursor = db.query(getSafeName(name),
Expand Down
16 changes: 8 additions & 8 deletions app/src/main/java/com/qsboy/antirecall/db/Messages.java
Original file line number Diff line number Diff line change
Expand Up @@ -110,14 +110,6 @@ public String getImages() {
return images;
}

public Messages setImages(String images) {
if (images == null)
this.images = "";
else
this.images = images;
return this;
}

public Messages setImages(String[] images) {
StringBuilder builder = new StringBuilder();
if (images != null && images.length != 0) {
Expand All @@ -131,6 +123,14 @@ public Messages setImages(String[] images) {
return this;
}

public Messages setImages(String images) {
if (images == null)
this.images = "";
else
this.images = images;
return this;
}

public String getPkgName() {
return pkgName;
}
Expand Down
1 change: 0 additions & 1 deletion app/src/main/java/com/qsboy/antirecall/ui/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

import android.app.Application;
import android.content.Context;
import android.view.View;


public class App extends Application {
Expand Down
22 changes: 0 additions & 22 deletions app/src/main/java/com/qsboy/antirecall/ui/LaunchReceiver.java

This file was deleted.

55 changes: 23 additions & 32 deletions app/src/main/java/com/qsboy/antirecall/ui/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@

package com.qsboy.antirecall.ui;

import android.content.Context;
import android.content.Intent;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Bundle;
import android.provider.Settings;
import android.support.graphics.drawable.VectorDrawableCompat;
Expand All @@ -18,12 +21,11 @@
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.Toast;

import com.qsboy.antirecall.R;
import com.qsboy.antirecall.db.Dao;
import com.qsboy.antirecall.utils.CheckAuthority;
import com.qsboy.antirecall.utils.LogcatHelper;
import com.qsboy.antirecall.utils.UpdateHelper;

import java.util.ArrayList;
import java.util.Calendar;
Expand All @@ -34,16 +36,22 @@

public class MainActivity extends AppCompatActivity {

final String TAG = "Main Activity";
List<Fragment> fragmentList = new ArrayList<>();
private final String TAG = "Main Activity";
private List<Fragment> fragmentList = new ArrayList<>();

// TODO: 03/06/2018 顶部加filter

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// 记录log
LogcatHelper.getInstance().start();
Date in = new Date();

// 检查更新
if (!App.isCheckUpdateOnlyOnWiFi || isWifi())
new UpdateHelper(this).checkUpdate();

setContentView(R.layout.activity_horizontal_coordinator_ntb);

Toolbar toolbar = findViewById(R.id.toolbar);
Expand Down Expand Up @@ -101,32 +109,18 @@ public Fragment getItem(int position) {
navigationTabBar.setViewPager(viewPager, 0);
navigationTabBar.setBehaviorEnabled(true);

// initFab(navigationTabBar);

}

private void initFab(NavigationTabBar navigationTabBar) {
// final CoordinatorLayout coordinatorLayout = findViewById(R.id.parent);
// findViewById(R.id.fab).setOnClickListener(v -> {
// for (int i = 0; i < navigationTabBar.getModels().size(); i++) {
// final NavigationTabBar.Model model = navigationTabBar.getModels().get(i);
// navigationTabBar.postDelayed(() -> {
// final String title = String.valueOf(new Random().nextInt(15));
// if (!model.isBadgeShowed()) {
// model.setBadgeTitle(title);
// model.showBadge();
// } else model.updateBadgeTitle(title);
// }, i * 100);
// }
//
// coordinatorLayout.postDelayed(() -> {
// final Snackbar snackbar = Snackbar.make(navigationTabBar, "Coordinator NTB", Snackbar.LENGTH_SHORT);
// snackbar.getView().setBackgroundColor(Color.parseColor("#9b92b3"));
// ((TextView) snackbar.getView().findViewById(R.id.snackbar_text))
// .setTextColor(Color.parseColor("#423752"));
// snackbar.show();
// }, 1000);
// });
public boolean isWifi() {
ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
if (cm != null) {
NetworkInfo networkInfo = cm.getActiveNetworkInfo();
if (networkInfo != null && networkInfo.getType() == ConnectivityManager.TYPE_WIFI) {
Log.d(TAG, "isWifi");
return true;
}
}
return false;
}

@Override
Expand Down Expand Up @@ -157,10 +151,7 @@ public boolean onOptionsItemSelected(MenuItem item) {
protected void onResume() {
super.onResume();
Log.i(TAG, "onResume");
if (!new CheckAuthority(this).checkAlertWindowPermission()) {
Log.i(TAG, "authorized: show warning");
Toast.makeText(this, "请授予悬浮窗权限\n为了能正常显示撤回的消息 谢谢", Toast.LENGTH_LONG).show();
}
fragmentList.clear();
}

@Override
Expand Down
22 changes: 10 additions & 12 deletions app/src/main/java/com/qsboy/antirecall/ui/MessageAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
import android.content.Context;
import android.graphics.Canvas;
import android.support.annotation.Nullable;
import android.support.v4.content.ContextCompat;
import android.support.v7.widget.DividerItemDecoration;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.helper.ItemTouchHelper;
Expand All @@ -35,17 +33,17 @@

public class MessageAdapter extends BaseItemDraggableAdapter<Messages, BaseViewHolder> {

String TAG = "MessageAdapter";
Context context;
Dao dao;
private String TAG = "MessageAdapter";
private Context context;
private Dao dao;
private int theme;
Messages data;
Calendar now = Calendar.getInstance();
Calendar calendar = Calendar.getInstance();
SimpleDateFormat sdfDate = new SimpleDateFormat("MM - dd", Locale.getDefault());
SimpleDateFormat sdfL = new SimpleDateFormat("MM-dd\nHH:mm", Locale.getDefault());
SimpleDateFormat sdfS = new SimpleDateFormat("HH:mm", Locale.getDefault());
long down = 0;
private Messages data;
private Calendar now = Calendar.getInstance();
private Calendar calendar = Calendar.getInstance();
private SimpleDateFormat sdfDate = new SimpleDateFormat("MM - dd", Locale.getDefault());
private SimpleDateFormat sdfL = new SimpleDateFormat("MM-dd\nHH:mm", Locale.getDefault());
private SimpleDateFormat sdfS = new SimpleDateFormat("HH:mm", Locale.getDefault());
private long down = 0;

public MessageAdapter(Dao dao, @Nullable List<Messages> data, Context context, int theme) {
super(R.layout.cell, data);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,14 @@

public class MultiMessagesAdapter extends BaseItemDraggableAdapter<Messages, BaseViewHolder> {

String TAG = "MultiMessagesAdapter";

Context context;
private String TAG = "MultiMessagesAdapter";
private Context context;
private int theme;
int day;
Calendar calendar = Calendar.getInstance();
SimpleDateFormat sdfSec = new SimpleDateFormat("HH:mm:ss", Locale.getDefault());
SimpleDateFormat sdfDate = new SimpleDateFormat("MM - dd", Locale.getDefault());

OnDateChangeListener onDateChangeListener;
private int day;
private Calendar calendar = Calendar.getInstance();
private SimpleDateFormat sdfSec = new SimpleDateFormat("HH:mm:ss", Locale.getDefault());
private SimpleDateFormat sdfDate = new SimpleDateFormat("MM - dd", Locale.getDefault());
private OnDateChangeListener onDateChangeListener;

public MultiMessagesAdapter(List<Messages> data, Context context, int theme) {
super(R.layout.item_message, data);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public boolean dispatchTouchEvent(MotionEvent ev) {
// 如果是展开的 所有手势都交给自己处理
// 如果是收起的 在滑动一段后 (为了判断是真的想滑动) 就交给父 View 处理
// 否则自己处理 (点击之类)
// 实现父子View同方向滚动
if (!isUnfolded()) {
int historySize = ev.getHistorySize();
Log.v("MyFoldingCell", "dispatchTouchEvent: historySize: " + historySize);
Expand Down
32 changes: 0 additions & 32 deletions app/src/main/java/com/qsboy/antirecall/ui/MySwitch.java

This file was deleted.

Loading

0 comments on commit b7c6a8e

Please sign in to comment.