Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .idea/.name

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/render.experimental.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.example.mynav
package com.example.SMSManager

import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4
Expand Down
14 changes: 7 additions & 7 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.mynav">
package="com.example.SMSManager">

<uses-permission android:name="android.permission.READ_SMS" />
<uses-permission android:name="android.permission.SEND_SMS" />
Expand All @@ -10,24 +10,24 @@
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:label="SMS Manager"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:background="#ffffff"
android:theme="@style/AppTheme">
<activity android:name=".util.MessageScreen"></activity>
<activity android:name=".util.MainActivity">
<activity android:name="com.example.SMSManager.util.MessageScreen"></activity>
<activity android:name="com.example.SMSManager.util.MainActivity" android:configChanges="orientation|screenSize|keyboardHidden" android:label="SMS Manager">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".util.AddCategory" />
<activity android:name=".util.AddFilter" />
<activity android:name="com.example.SMSManager.util.AddCategory" android:label="ADD SMS BOX"/>
<activity android:name="com.example.SMSManager.util.AddFilter" android:label="ADD A FILTER"/>

<receiver
android:name=".receiver.SMSRecvd"
android:name="com.example.SMSManager.receiver.SMSRecvd"
android:enabled="true"
android:exported="true">
<intent-filter>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
package com.example.mynav
package com.example.SMSManager

import android.content.Context
import android.database.sqlite.SQLiteDatabase
import android.database.sqlite.SQLiteOpenHelper

class Database(context: Context) : SQLiteOpenHelper(context, DATABASE_NAME, null, DATABASE_VERSION) {
class Database(context: Context) : SQLiteOpenHelper(context,
DATABASE_NAME, null,
DATABASE_VERSION
) {
companion object {
// If you change the database schema, you must increment the database version.
const val DATABASE_VERSION = 1
const val DATABASE_NAME = "SMSFilters.db"
}
private val CREATE_ENTRIES="CREATE TABLE "+"CATEGORIES_TABLE"+"( ID INTEGER PRIMARY KEY, "+"CATEGORY TEXT , "+"FILTER TEXT)"
private val DROP_TABLE="DROP TABLE IF EXISTS CATEGORIES_TABLE"
private val createEntries="CREATE TABLE "+"CATEGORIES_TABLE"+"( ID INTEGER PRIMARY KEY , "+"CATEGORY TEXT , "+"FILTER TEXT)"
private val dropTable="DROP TABLE IF EXISTS CATEGORIES_TABLE"
override fun onCreate(db: SQLiteDatabase?) {
db?.execSQL(CREATE_ENTRIES)
db?.execSQL(createEntries)
}

override fun onUpgrade(db: SQLiteDatabase?, oldVersion: Int, newVersion: Int) {
db?.execSQL(DROP_TABLE)
db?.execSQL(dropTable)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package com.example.SMSManager.adapters

import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.example.SMSManager.Database
import com.example.SMSManager.R
import kotlinx.android.synthetic.main.cat_recyclerview.view.*

class CategoryAdapter(var category:String,var size:Int): RecyclerView.Adapter<ViewHolder>() {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
val view= LayoutInflater.from(parent.context).inflate(R.layout.cat_recyclerview,parent,false)
return ViewHolder(view)
}

override fun getItemCount(): Int {
return size
}

override fun onBindViewHolder(holder: ViewHolder, position: Int) {
holder.itemView.apply {
tv_catrv.text=category
remove_cat.setOnClickListener {
val dbHelper =
Database(holder.itemView.context)
val db = dbHelper.writableDatabase
var new= arrayOf<String>(category)
db.delete("CATEGORIES_TABLE","CATEGORY = ? ",new)
notifyItemRemoved(position)
notifyDataSetChanged()
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
package com.example.mynav.adapters
package com.example.SMSManager.adapters

import android.content.Intent
import android.util.Log
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.example.mynav.Database
import com.example.mynav.R
import com.example.mynav.util.AddFilter
import kotlinx.android.synthetic.main.add_filter.view.*
import com.example.SMSManager.Database
import com.example.SMSManager.R
import kotlinx.android.synthetic.main.filter_recyclerview.view.*
import kotlinx.android.synthetic.main.individual_card.view.*
import kotlinx.android.synthetic.main.recyclerviewobj.view.*

class FilterAdapter (var category:String,var list:MutableList<String>): RecyclerView.Adapter<ViewHolder>(){

class FilterAdapter(var category:String, var list: MutableList<String>): RecyclerView.Adapter<ViewHolder>(){
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
val view= LayoutInflater.from(parent.context).inflate(R.layout.filter_recyclerview,parent,false)
return ViewHolder(view)
Expand All @@ -26,11 +23,15 @@ class FilterAdapter (var category:String,var list:MutableList<String>): Recycler
holder.itemView.apply {
tv_indfilter.text=list[position]
remove_filter.setOnClickListener {
val dbHelper = Database(holder.itemView.context)
notifyDataSetChanged()
val dbHelper =
Database(holder.itemView.context)
val db = dbHelper.writableDatabase
var new= arrayOf<String>(category,list[position])
Log.d("list","removing $category 's "+list[position])
db.delete("CATEGORIES_TABLE","CATEGORY = ? AND FILTER = ?",new)
list.removeAt(position)
Log.d("list",list.count().toString())
notifyItemRemoved(position)
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package com.example.mynav.adapters
package com.example.SMSManager.adapters

import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.example.mynav.R
import com.example.SMSManager.R
import kotlinx.android.synthetic.main.individual_card.view.*

public class IndividualAdapter(var list:List<String>): RecyclerView.Adapter<ViewHolder>() {
class IndividualAdapter(var list:List<String>): RecyclerView.Adapter<ViewHolder>() {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
val view= LayoutInflater.from(parent.context).inflate(R.layout.individual_card,parent,false)
return ViewHolder(view)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,29 +1,27 @@
package com.example.mynav.adapters
package com.example.SMSManager.adapters

import android.content.Intent
import android.os.Build
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Toast
import androidx.annotation.RequiresApi
import androidx.core.content.ContextCompat.startActivity
import androidx.recyclerview.widget.RecyclerView
import com.example.mynav.objects.MsgObj
import com.example.mynav.R
import com.example.mynav.objects.MsgList
import com.example.mynav.util.MainActivity
import com.example.mynav.util.MessageScreen
import com.example.SMSManager.R
import com.example.SMSManager.objects.MsgObj
import com.example.SMSManager.util.MessageScreen
import kotlinx.android.synthetic.main.recyclerviewobj.view.*


public class MsgAdapter (
var msglist:List<MsgObj>
): RecyclerView.Adapter<ViewHolder>() {


override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {

val view= LayoutInflater.from(parent.context).inflate(R.layout.recyclerviewobj,parent,false)

val view =
LayoutInflater.from(parent.context).inflate(R.layout.recyclerviewobj, parent, false)

return ViewHolder(view)
}

Expand All @@ -35,24 +33,20 @@ public class MsgAdapter (

override fun onBindViewHolder(holder: ViewHolder, position: Int) {
holder.itemView.apply {
contact.text = msglist[position].name
contact.text = msglist[position].name
msg_content.text = msglist[position].message
contact.contentDescription=msglist[position].num
contact.contentDescription = msglist[position].num
}
holder.itemView.setOnClickListener{
//Toast.makeText(holder.itemView.context,"CLICKED ON ${msglist[position].name}",Toast.LENGTH_SHORT).show()
var intent = Intent(holder.itemView.context, MessageScreen::class.java)
intent.putExtra("NAME_EXTRA","${msglist[position].name}")
intent.putExtra("LAST_MESSAGE","${msglist[position].message}")
intent.putExtra("NUMBER_EXTRA","${msglist[position].num}")
intent.putExtra("NAME_EXTRA", msglist[position].name)
intent.putExtra("LAST_MESSAGE", msglist[position].message)
intent.putExtra("NUMBER_EXTRA", msglist[position].num)
startActivity(holder.itemView.context,intent,null)
}
}
}


interface OnClickListener {
fun onClick(msgList: MsgList)
}

public class ViewHolder (itemView: View) : RecyclerView.ViewHolder(itemView)
public class ViewHolder (itemView: View) : RecyclerView.ViewHolder(itemView)
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
package com.example.mynav.adapters
package com.example.SMSManager.adapters

import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.lifecycle.Lifecycle
import androidx.viewpager2.adapter.FragmentStateAdapter
import com.example.mynav.fragments.KnownFrag
import com.example.mynav.fragments.UnknownFrag
import com.example.mynav.objects.MsgList
import com.example.mynav.util.MainActivity
import com.example.SMSManager.fragments.KnownFrag
import com.example.SMSManager.fragments.UnknownFrag
import com.example.SMSManager.util.MainActivity

class ViewPagerAdapter (fm:FragmentManager?, lifecycle: Lifecycle): FragmentStateAdapter(fm!!,lifecycle){
override fun getItemCount(): Int {
Expand All @@ -23,10 +22,12 @@ class ViewPagerAdapter (fm:FragmentManager?, lifecycle: Lifecycle): FragmentStat
override fun createFragment(position: Int): Fragment {

when(position){
0-> fragment=
0-> fragment =
KnownFrag(MainActivity.knownlist)
1-> fragment=
UnknownFrag(MainActivity.unknownlist)
1-> fragment =
UnknownFrag(
MainActivity.unknownlist2
)
}
return fragment!!
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
package com.example.mynav.fragments
package com.example.SMSManager.fragments

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import androidx.recyclerview.widget.DividerItemDecoration
import androidx.recyclerview.widget.LinearLayoutManager
import com.example.mynav.R
import com.example.mynav.adapters.MsgAdapter
import com.example.mynav.objects.MsgObj
import com.example.SMSManager.R
import com.example.SMSManager.adapters.MsgAdapter
import com.example.SMSManager.objects.MsgObj
import kotlinx.android.synthetic.main.known_frag.*

class KnownFrag(var mslist:MutableList<MsgObj>): Fragment() {


public lateinit var msgAdapter: MsgAdapter
lateinit var msgAdapter: MsgAdapter


override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,20 @@
package com.example.mynav.fragments
package com.example.SMSManager.fragments

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Toast
import androidx.fragment.app.Fragment
import androidx.recyclerview.widget.DividerItemDecoration
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.example.mynav.R
import com.example.mynav.adapters.MsgAdapter
import com.example.mynav.objects.MsgObj
import com.example.SMSManager.R
import com.example.SMSManager.adapters.MsgAdapter
import com.example.SMSManager.objects.MsgObj
import kotlinx.android.synthetic.main.unknown_frag.*

class UnknownFrag(var mslist:MutableList<MsgObj>) :Fragment() {


public lateinit var msgAdapter: MsgAdapter
lateinit var msgAdapter: MsgAdapter


override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.example.mynav.objects
package com.example.SMSManager.objects

class Contact(val name:String,val phno:String) {
override fun toString(): String {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.example.mynav.objects
package com.example.SMSManager.objects

class MsgList(var known_msglist:MutableList<MsgObj>, var unknown_msglist:MutableList<MsgObj>) {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.example.mynav.objects
package com.example.SMSManager.objects

class MsgObj (
var name:String ,
Expand Down
Loading