-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
183 changed files
with
4,031 additions
and
1,464 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
|
||
*.iml | ||
.gradle | ||
/local.properties | ||
/.idea/* | ||
.DS_Store | ||
/build | ||
/captures | ||
gradle.properties | ||
gradle.properties |
This file was deleted.
Oops, something went wrong.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
app/src/androidTest/java/appteam/nith/hillffair/ExampleInstrumentedTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package appteam.nith.hillffair; | ||
|
||
import android.content.Context; | ||
import android.support.test.InstrumentationRegistry; | ||
import android.support.test.runner.AndroidJUnit4; | ||
|
||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
|
||
import static org.junit.Assert.*; | ||
|
||
/** | ||
* Instrumentation test, which will execute on an Android device. | ||
* | ||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a> | ||
*/ | ||
@RunWith(AndroidJUnit4.class) | ||
public class ExampleInstrumentedTest { | ||
@Test | ||
public void useAppContext() throws Exception { | ||
// Context of the app under test. | ||
Context appContext = InstrumentationRegistry.getTargetContext(); | ||
|
||
assertEquals("appteam.nith.hillffair", appContext.getPackageName()); | ||
} | ||
} |
13 changes: 0 additions & 13 deletions
13
app/src/androidTest/java/com/appteamnith/hillffair/ApplicationTest.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
143 changes: 143 additions & 0 deletions
143
app/src/main/java/appteam/nith/hillffair/Notification/DbHelper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,143 @@ | ||
package appteam.nith.hillffair.Notification; | ||
|
||
import android.content.ContentValues; | ||
import android.content.Context; | ||
import android.database.Cursor; | ||
import android.database.sqlite.SQLiteDatabase; | ||
import android.database.sqlite.SQLiteOpenHelper; | ||
import android.util.Log; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import appteam.nith.hillffair.activities.Home_posts_gns; | ||
|
||
import static android.R.attr.tag; | ||
|
||
/** | ||
* Created by root on 19/10/16. | ||
*/ | ||
|
||
public class DbHelper extends SQLiteOpenHelper { | ||
|
||
|
||
|
||
SQLiteDatabase mdb; | ||
|
||
private static final int DATABASE_VERSION = 2; | ||
|
||
private static final String DB_NAME = "onesignalnotiication"; | ||
// HOME POSTS TABLE | ||
private static final String TABLE_HOMEPOST= "notification"; | ||
private static final String NOTIFICATION_ID="id"; | ||
private static final String NOTIFICATION_small_icon="smallicon"; | ||
private static final String NOTIFICATION_TITLE="title"; | ||
private static final String NOTIFICATION_TIMESTAMP="timestamp"; | ||
private static final String NOTIFICATION_LARGE_ICON="largeicon"; | ||
private static final String NOTIFICATION_BODY="body"; | ||
private static final String NOTIFICATION_BIG_PICTURE="bigpicture"; | ||
private static final String NOTIFICATION_LAUNCH_URL="launchurl"; | ||
|
||
|
||
public DbHelper(Context context) { | ||
super(context, DB_NAME, null, DATABASE_VERSION); | ||
mdb=getWritableDatabase(); | ||
} | ||
|
||
|
||
|
||
|
||
@Override | ||
public void onCreate(SQLiteDatabase sqLiteDatabase) { | ||
sqLiteDatabase.execSQL("create table " +TABLE_HOMEPOST+ "( " | ||
+NOTIFICATION_ID+ " text , " | ||
+NOTIFICATION_small_icon+ " text , " | ||
+NOTIFICATION_TITLE+ " text , " | ||
+NOTIFICATION_BODY+" text , " | ||
+NOTIFICATION_LARGE_ICON+" text , " | ||
+NOTIFICATION_BIG_PICTURE+" text , " | ||
+NOTIFICATION_LAUNCH_URL+" text )"); | ||
} | ||
@Override | ||
public void onUpgrade(SQLiteDatabase sqLiteDatabase, int old_version, int new_version) { | ||
|
||
if (old_version < new_version) { | ||
|
||
// sqLiteDatabase.execSQL(DATABASE_ALTER_TEAM_1); | ||
sqLiteDatabase.execSQL("drop table if exists " + TABLE_HOMEPOST); | ||
onCreate(sqLiteDatabase); | ||
} | ||
} | ||
|
||
public boolean truncate(String tablename) { | ||
SQLiteDatabase db = getWritableDatabase(); | ||
if (tablename.equals("homeposts")) { | ||
db.execSQL("delete from " + TABLE_HOMEPOST); | ||
return true; | ||
} | ||
return false; | ||
} | ||
|
||
public boolean insert_2_homeposts(String id, String smallicon, String title, String body, String bigpicture, String largeicon,String launchurl) { | ||
SQLiteDatabase db = getWritableDatabase(); | ||
ContentValues contentValues = new ContentValues(); | ||
contentValues.put(NOTIFICATION_ID, id); | ||
contentValues.put(NOTIFICATION_small_icon, smallicon); | ||
contentValues.put(NOTIFICATION_TITLE, title); | ||
contentValues.put(NOTIFICATION_BODY, body); | ||
contentValues.put(NOTIFICATION_BIG_PICTURE, bigpicture); | ||
contentValues.put(NOTIFICATION_LARGE_ICON, largeicon); | ||
contentValues.put(NOTIFICATION_LAUNCH_URL, launchurl); | ||
db.insert(TABLE_HOMEPOST, null, contentValues); | ||
return true; | ||
} | ||
|
||
public List gethomedata() { | ||
|
||
Log.d("TAGGGGG", "insideeeeeee gethomedata"); | ||
List<Home_posts_gns> homedetails = new ArrayList<>(); | ||
String query = "select * from " + TABLE_HOMEPOST; | ||
SQLiteDatabase db = getReadableDatabase(); | ||
mdb = getReadableDatabase(); | ||
Cursor cursor = db.rawQuery(query, null); | ||
Log.d("LOG", "cursorr" + cursor.toString()); | ||
if (cursor != null) { | ||
try { | ||
if (cursor.moveToFirst()) { | ||
do { | ||
Home_posts_gns homeposts = new Home_posts_gns(); | ||
String id = cursor.getString(cursor.getColumnIndex(NOTIFICATION_ID)); | ||
String title = cursor.getString(cursor.getColumnIndex(NOTIFICATION_TITLE)); | ||
String small_icon = cursor.getString(cursor.getColumnIndex(NOTIFICATION_small_icon)); | ||
|
||
Log.d("TAG", "valuesss" +id+title+small_icon); | ||
homeposts.setNotification_id(id); | ||
homeposts.setTitle(title); | ||
homeposts.setSmall_icon(small_icon); | ||
homedetails.add(homeposts); | ||
} while (cursor.moveToNext()); | ||
|
||
for (int i = 0; i < homedetails.size(); i++) { | ||
Log.d("LOG", "arrryyyy" + homedetails.get(i).toString()); | ||
} | ||
cursor.close(); | ||
} | ||
} catch (Exception e) { | ||
Log.d("TAG", "Error while trying to get posts from database"); | ||
} | ||
|
||
} else { | ||
Log.d("DB", "cursor emptyyyy"); | ||
} | ||
|
||
return homedetails; | ||
} | ||
|
||
|
||
public Cursor homeposteinnerdata(String id) { | ||
String query = "select * from " + TABLE_HOMEPOST + " where id = '" + id+"'" ; | ||
SQLiteDatabase db = getReadableDatabase(); | ||
Cursor cursor = db.rawQuery(query, null); | ||
return cursor; | ||
} | ||
} |
Oops, something went wrong.