Skip to content

Commit

Permalink
Add Notification icon and fix delete record with search
Browse files Browse the repository at this point in the history
  • Loading branch information
KinJih committed May 12, 2018
1 parent 2984d0e commit ae8e623
Show file tree
Hide file tree
Showing 17 changed files with 21 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
.DS_Store
/build
/captures
.externalNativeBuild
.externalNativeBuild
Binary file modified .idea/caches/build_file_checksums.ser
Binary file not shown.
8 changes: 4 additions & 4 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ dependencies {
})
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation 'com.google.firebase:firebase-messaging:15.0.0'
implementation 'com.google.firebase:firebase-auth:15.0.0'
implementation 'com.google.firebase:firebase-core:15.0.0'
implementation 'com.google.firebase:firebase-database:15.0.0'
implementation 'com.google.firebase:firebase-messaging:15.0.2'
implementation 'com.google.firebase:firebase-auth:15.1.0'
implementation 'com.google.firebase:firebase-core:15.0.2'
implementation 'com.google.firebase:firebase-database:15.0.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.android.support:recyclerview-v7:27.1.1'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,9 @@ private void sendResetEmail(String Email) {
@Override
public void onComplete(@NonNull Task<Void> task) {
if (task.isSuccessful()) {
Toast.makeText(LoginActivity.this, "We have sent you instructions to reset your password!", Toast.LENGTH_SHORT).show();
Toast.makeText(LoginActivity.this, R.string.send_reset_email, Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(LoginActivity.this, "Failed to send reset email!", Toast.LENGTH_SHORT).show();
Toast.makeText(LoginActivity.this, R.string.reset_email_failed, Toast.LENGTH_SHORT).show();
}
}
});
Expand Down Expand Up @@ -239,7 +239,7 @@ public void onComplete(@NonNull Task<AuthResult> task) {
if (user != null) {
doVerify(user);
}else{
Toast.makeText(LoginActivity.this, R.string.auth_failed+'!', Toast.LENGTH_SHORT).show();
Toast.makeText(LoginActivity.this, R.string.auth_failed, Toast.LENGTH_SHORT).show();
}
showProgress(false);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,9 @@ public void onLongItemClick(View view, final int position) {
.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Record record = myDataSet.get(position);
Record record = myAdapter.getmFilterData().get(position);
reference_contacts.child("Records").child(record.getDate()+" "+record.getFullTime()).removeValue();
myAdapter.deleteRecord(position);
myAdapter.deleteRecord(record);
}
}).setNegativeButton(R.string.cancel, null)
.show();
Expand Down Expand Up @@ -360,7 +360,7 @@ public void onDataChange(DataSnapshot dataSnapshot) {
AdminData adminData = dataSnapshot.getValue(AdminData.class);
String pwdSha= EncryptUtil.pwd2sha(secPwd,adminData.getcellphone(),adminData.getbirthday());
if (pwdSha.equals(adminData.getsecondPassword())){

startActivity(new Intent(MainActivity.this,UpdatePasswordActivity.class));
}else{
Toast.makeText(MainActivity.this, R.string.error_incorrect_password, Toast.LENGTH_SHORT).show();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public void onClick(View v) {
View aboutPage = new AboutPage(this)
.isRTL(false)
.setDescription("Hi, we are CID_Notify team.")
.addItem(new Element().setTitle("Version 1.0-Release"))
.addItem(new Element().setTitle("Version 1.0B-Release"))
.addGroup("Connect with us")
.addEmail("u0424035@nkfust.edu.tw")
.addWebsite("https://github.com/KinJih/CID_Notify")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package com.cid_notify.cid_notify.Model;

import android.support.annotation.NonNull;

import com.cid_notify.cid_notify.Util.EncryptUtil;

public class AdminData {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,9 @@ public void onCancelled(DatabaseError databaseError) {
}
public ArrayList<Record> getmFilterData(){ return mFilterData;/*let stickyDecoration can change with Filter*/ }

public void deleteRecord(int position){
mData.remove(position);
public void deleteRecord(Record record){
mData.remove(mData.indexOf(record));
if(mData.size()!=mFilterData.size())mFilterData.remove(mFilterData.indexOf(record));
notifyDataSetChanged();
}
@NonNull
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ private void sendNotification(String body,String title) {
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0/*Request ID*/, intent, PendingIntent.FLAG_ONE_SHOT);

NotificationCompat.Builder builder = new NotificationCompat.Builder(this,"CID")
.setSmallIcon(R.mipmap.ic_launcher)
.setSmallIcon(R.mipmap.ic_notifictaion)
.setContentTitle(title)
.setContentText(body)
.setAutoCancel(true)
Expand Down
Binary file added app/src/main/res/mipmap-hdpi/ic_notifictaion.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/mipmap-mdpi/ic_notifictaion.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/mipmap-xhdpi/ic_notifictaion.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions app/src/main/res/values-zh-rTW/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,6 @@
<string name="im_ready">我準備好了!</string>
<string name="important">*重要通知*</string>
<string name="second_password_description">當您需要更改密碼或設定某些敏感功能時,您必須使用第二道密碼。 \n\n如果您不小心忘記了第二道密碼,您可以使用手機號碼和生日進行重置。</string>
<string name="reset_email_failed">密碼重設信寄送失敗</string>
<string name="send_reset_email">將會寄出密碼重設信至您的信箱</string>
</resources>
2 changes: 2 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,5 +64,7 @@
<string name="birthday">Birthday e.g.19701001</string>
<string name="im_ready">I\'m ready!</string>
<string name="important">*IMPORTANT*</string>
<string name="reset_email_failed">Failed to send reset email</string>
<string name="send_reset_email">We have sent you instructions to reset your password</string>
<string name="second_password_description">You must use a second password when you need to change your password or set some sensitive feature of an appliance. \\n\\nIf you accidentally forget the second password, you cna reset it through your cellphone number and birthday.</string>
</resources>
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
classpath 'com.google.gms:google-services:3.1.0'
classpath 'com.google.gms:google-services:3.3.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
Expand Down

0 comments on commit ae8e623

Please sign in to comment.