Skip to content

Commit cef2917

Browse files
committed
Release 1.3.0
2 parents b796332 + eed4d81 commit cef2917

77 files changed

Lines changed: 1964 additions & 1910 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ build/
55
# Local configuration file (sdk path, etc)
66
local.properties
77
release.properties
8-
android_keystore.jks
8+
*.jks
99

1010
# Gradle generated files
1111
.gradle/

.idea/gradle.xml

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/kotlinc.xml

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,15 @@ Licensed under the MIT License. For complete licensing information see [LICENSE.
1010
* v1.1.2
1111

1212
### Build Tools ###
13+
<<<<<<< HEAD
1314
* JDK 1.8
1415
* Android Studio 2.1.2 (Gradle 2.1.0)
1516
* Android build tools 24.0.1
17+
=======
18+
* Android Studio 3.0.1 (Gradle 3.4.1)
19+
>>>>>>> develop
1620
* Android support library 24.1.1
17-
* Android 4.1 (API 16) or above (built against 7.0/API 23)
21+
* Android 4.0 (API 14) or above (built against 8.1/API 27)
1822
* Built on a Windows PC, but should be OS agnostic
1923

2024
### Bugs and Features ###

app/build.gradle

Lines changed: 43 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,26 @@
11
apply plugin: 'com.android.application'
2+
apply plugin: 'kotlin-android'
3+
apply plugin: 'kotlin-kapt' //For Kotlin Annotation Processing with libraries (i.e. data binding)
24

3-
android {
4-
compileSdkVersion 25
5-
buildToolsVersion "25.0.2"
5+
kotlin {
6+
experimental {
7+
coroutines 'enable'
8+
}
9+
}
610

11+
android {
12+
compileSdkVersion 27
713
dataBinding {
814
enabled = true
915
}
1016

1117
defaultConfig {
1218
vectorDrawables.useSupportLibrary = true
1319
applicationId "com.cwlarson.deviceid"
14-
minSdkVersion 16
15-
targetSdkVersion 25
16-
versionCode 9
17-
versionName "1.2.0"
20+
minSdkVersion 14
21+
targetSdkVersion 27
22+
versionCode 10
23+
versionName "1.3.0"
1824
}
1925

2026
signingConfigs {
@@ -31,18 +37,40 @@ android {
3137
}
3238
buildTypes {
3339
release {
40+
postprocessing {
41+
removeUnusedCode true
42+
removeUnusedResources false
43+
obfuscate true
44+
optimizeCode true
45+
proguardFile 'proguard-rules.pro'
46+
}
3447
signingConfig signingConfigs.release
35-
minifyEnabled true
36-
shrinkResources true
37-
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
3848
}
3949
}
4050
}
4151

52+
ext.support_library_version = '27.0.2'
4253
dependencies {
43-
compile fileTree(include: ['*.jar'], dir: 'libs')
44-
compile 'com.android.support:appcompat-v7:25.3.1'
45-
compile 'com.android.support:recyclerview-v7:25.3.1'
46-
compile 'com.android.support:design:25.3.1'
47-
compile 'com.android.support:cardview-v7:25.3.1'
54+
implementation fileTree(include: ['*.jar'], dir: 'libs')
55+
implementation "com.android.support:appcompat-v7:$support_library_version"
56+
implementation "com.android.support:recyclerview-v7:$support_library_version"
57+
implementation "com.android.support:design:$support_library_version"
58+
implementation "com.android.support:cardview-v7:$support_library_version"
59+
implementation 'com.android.support.constraint:constraint-layout:1.1.0-beta4'
60+
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
61+
//Kotlin coroutines experimental libraries (for DiffUtilAdapter)
62+
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:0.21"
63+
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:0.21"
64+
//Data Binding support for Kotlin
65+
kapt "com.android.databinding:compiler:3.0.1"
66+
// ViewModel and LiveData
67+
implementation "android.arch.lifecycle:extensions:1.0.0"
68+
kapt "android.arch.lifecycle:compiler:1.0.0"
69+
// Room
70+
implementation "android.arch.persistence.room:runtime:1.0.0"
71+
kapt "android.arch.persistence.room:compiler:1.0.0"
72+
//Debug bridge for Android applications, enabling the powerful Chrome Developer Tools
73+
debugImplementation "com.facebook.stetho:stetho:1.5.0"
74+
//LeakCanary
75+
debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.5.4'
4876
}

app/src/androidTest/java/com/cwlarson/deviceid/ApplicationTest.java

Lines changed: 0 additions & 13 deletions
This file was deleted.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package com.cwlarson.deviceid;
2+
3+
import android.app.Application;
4+
5+
import com.facebook.stetho.Stetho;
6+
import com.squareup.leakcanary.LeakCanary;
7+
8+
public class MyApplication extends Application {
9+
10+
@Override
11+
public void onCreate() {
12+
super.onCreate();
13+
if (LeakCanary.isInAnalyzerProcess(this)) {
14+
// This process is dedicated to LeakCanary for heap analysis.
15+
// You should not init your app in this process.
16+
return;
17+
}
18+
LeakCanary.install(this);
19+
// Normal app init code...
20+
Stetho.initializeWithDefaults(this);
21+
}
22+
}

app/src/main/AndroidManifest.xml

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3-
xmlns:tools="http://schemas.android.com/tools"
4-
package="com.cwlarson.deviceid">
3+
xmlns:tools="http://schemas.android.com/tools"
4+
package="com.cwlarson.deviceid">
55

66
<!-- To read IMEI & Voicemail number -->
77
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
@@ -13,36 +13,41 @@
1313
<uses-permission android:name="android.permission.BLUETOOTH" />
1414

1515
<application
16+
android:name=".MyApplication"
1617
android:allowBackup="false"
1718
android:icon="@mipmap/ic_launcher"
1819
android:roundIcon="@mipmap/ic_launcher_round"
1920
android:label="@string/app_name"
2021
android:resizeableActivity="true"
2122
android:supportsRtl="true"
22-
android:theme="@style/AppTheme">
23+
android:theme="@style/AppTheme"
24+
tools:targetApi="n">
2325
<activity
2426
android:name=".MainActivity"
2527
android:label="@string/app_name"
2628
android:launchMode="singleTop"
27-
android:theme="@style/SplashTheme">
29+
android:theme="@style/AppTheme.SplashTheme">
2830
<intent-filter>
2931
<action android:name="android.intent.action.MAIN" />
3032

3133
<category android:name="android.intent.category.LAUNCHER" />
3234
</intent-filter>
33-
35+
<!-- enable the search dialog to send searches to SearchableActivity -->
36+
<meta-data android:name="android.app.default_searchable"
37+
android:value=".SearchActivity" />
3438
<meta-data
3539
android:name="android.app.shortcuts"
3640
android:resource="@xml/shortcuts" />
3741
</activity>
38-
<activity
39-
android:name=".SearchActivity"
40-
android:label="@string/title_activity_search"
41-
android:parentActivityName=".MainActivity"
42-
tools:ignore="UnusedAttribute">
43-
<meta-data
44-
android:name="android.support.PARENT_ACTIVITY"
45-
android:value="com.cwlarson.deviceid.MainActivity" />
42+
<activity android:name=".SearchActivity"
43+
android:parentActivityName=".MainActivity"
44+
android:launchMode="singleTop">
45+
<intent-filter>
46+
<action android:name="android.intent.action.SEARCH" />
47+
</intent-filter>
48+
<!-- SearchView for MainActivity -->
49+
<meta-data android:name="android.app.searchable"
50+
android:resource="@xml/searchable_items"/>
4651
</activity>
4752
</application>
4853

Lines changed: 16 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,85 +1,61 @@
11
package com.cwlarson.deviceid;
22

3-
import android.content.Intent;
3+
import android.app.SearchManager;
4+
import android.content.Context;
45
import android.content.SharedPreferences;
56
import android.databinding.DataBindingUtil;
67
import android.os.Bundle;
78
import android.preference.PreferenceManager;
8-
import android.support.design.widget.AppBarLayout;
9-
import android.support.v4.view.MotionEventCompat;
9+
import android.support.v7.widget.SearchView;
1010
import android.view.Menu;
1111
import android.view.MenuInflater;
1212
import android.view.MenuItem;
13-
import android.view.MotionEvent;
1413

14+
import com.cwlarson.deviceid.database.AppDatabase;
1515
import com.cwlarson.deviceid.databinding.ActivityMainBinding;
1616
import com.cwlarson.deviceid.util.TabsViewPagerAdapter;
1717

1818

19-
public class MainActivity extends PermissionsActivity implements AppBarLayout.OnOffsetChangedListener {
19+
public class MainActivity extends PermissionsActivity {
2020
@SuppressWarnings({"FieldCanBeLocal", "unused"})
2121
private final String TAG = MainActivity.class.getSimpleName();
2222
private TabsViewPagerAdapter mAdapter;
23-
private ActivityMainBinding binding;
24-
private int index = 0;
25-
26-
@Override
27-
public boolean dispatchTouchEvent(MotionEvent ev) {
28-
final int action = MotionEventCompat.getActionMasked(ev);
29-
switch(action){
30-
case MotionEvent.ACTION_DOWN:
31-
case MotionEvent.ACTION_UP:
32-
case MotionEvent.ACTION_CANCEL:
33-
TabFragment tabFragment = mAdapter.getFragment(binding.viewpager.getCurrentItem());
34-
if(tabFragment!=null) {
35-
if(index==0)
36-
tabFragment.setSwipeToRefreshEnabled(true);
37-
else
38-
tabFragment.setSwipeToRefreshEnabled(false);
39-
}
40-
}
41-
42-
return super.dispatchTouchEvent(ev);
43-
}
4423

4524
@Override
4625
protected void onCreate(Bundle savedInstanceState) {
47-
setTheme(R.style.AppTheme); //Removes splash screen
26+
setTheme(R.style.AppTheme_MainTheme); //Removes splash screen
4827
super.onCreate(savedInstanceState);
49-
binding = DataBindingUtil.setContentView(this,R.layout.activity_main);
28+
ActivityMainBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_main);
29+
setSupportActionBar(binding.myToolbar);
5030

5131
// Get the ViewPager and set it's PagerAdapter so that it can display items
5232
mAdapter = new TabsViewPagerAdapter(getSupportFragmentManager(), this);
5333
binding.viewpager.setAdapter(mAdapter);
5434
binding.viewpager.setOffscreenPageLimit(mAdapter.getCount()); //Prevent reloading of views on tab switching
5535
// Give the TabLayout the ViewPager
5636
binding.tabs.setupWithViewPager(binding.viewpager);
57-
setSupportActionBar(binding.myToolbar);
5837
}
5938

6039
@Override
6140
public boolean onCreateOptionsMenu(Menu menu) {
6241
MenuInflater inflater = getMenuInflater();
6342
inflater.inflate(R.menu.base_menu, menu);
43+
inflater.inflate(R.menu.search_menu, menu);
6444
// Get checkable menu item value
6545
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
6646
menu.findItem(R.id.action_hide_unables).setChecked(sharedPreferences.getBoolean("hide_unables",false));
67-
return true;
68-
}
6947

70-
@Override
71-
protected void onStart() {
72-
super.onStart();
73-
binding.myToolbarLayout.addOnOffsetChangedListener(this);
48+
// Associate searchable configuration with the SearchView
49+
SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
50+
SearchView searchView = (SearchView) menu.findItem(R.id.search).getActionView();
51+
if(searchManager!=null)
52+
searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
53+
return true;
7454
}
7555

7656
@Override
7757
public boolean onOptionsItemSelected(MenuItem item) {
7858
switch (item.getItemId()) {
79-
case R.id.action_search:
80-
Intent intent = new Intent(this,SearchActivity.class);
81-
startActivity(intent);
82-
return true;
8359
case R.id.action_hide_unables:
8460
item.setChecked(!item.isChecked());
8561
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
@@ -94,20 +70,10 @@ public boolean onOptionsItemSelected(MenuItem item) {
9470
}
9571
}
9672

97-
@Override
98-
protected void onStop() {
99-
binding.myToolbarLayout.removeOnOffsetChangedListener(this);
100-
super.onStop();
101-
}
102-
10373
@Override
10474
protected void onDestroy() {
10575
mAdapter.destroy();
76+
AppDatabase.destroyInstance();
10677
super.onDestroy();
10778
}
108-
109-
@Override
110-
public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset) {
111-
index=verticalOffset;
112-
}
11379
}

0 commit comments

Comments
 (0)