Browse Source

Patch 2.7.1 updated

master
Preyea Regmi 5 years ago
parent
commit
18864419cd
  1. BIN
      .idea/caches/build_file_checksums.ser
  2. 3
      app/build.gradle
  3. 4
      app/src/main/java/com/gmeremit/online/gmeremittance_native/base/UIStateHandler.java
  4. 48
      app/src/main/java/com/gmeremit/online/gmeremittance_native/gme_branches/GMEBranchesContract.java
  5. 174
      app/src/main/java/com/gmeremit/online/gmeremittance_native/gme_branches/adapter/GmeBranchAdapter.java
  6. 37
      app/src/main/java/com/gmeremit/online/gmeremittance_native/gme_branches/model/GMEBranchesModel.java
  7. 51
      app/src/main/java/com/gmeremit/online/gmeremittance_native/gme_branches/model/data/Branch.java
  8. 45
      app/src/main/java/com/gmeremit/online/gmeremittance_native/gme_branches/model/data/PayoutLocationData.java
  9. 70
      app/src/main/java/com/gmeremit/online/gmeremittance_native/gme_branches/presenter/GmeBranchesPresenter.java
  10. 174
      app/src/main/java/com/gmeremit/online/gmeremittance_native/gme_branches/view/GmeBranchesActivity.java
  11. 4
      app/src/main/java/com/gmeremit/online/gmeremittance_native/homeV2/gateway/HomeV2Gateway.java
  12. 94
      app/src/main/java/com/gmeremit/online/gmeremittance_native/homeV2/presenter/HomeV2Presenter.java
  13. 164
      app/src/main/java/com/gmeremit/online/gmeremittance_native/homeV2/view/HomeFragmentV2.java
  14. 3
      app/src/main/java/com/gmeremit/online/gmeremittance_native/reward_points/view/RewardPointsShippingActivity.java
  15. 40
      app/src/main/java/com/gmeremit/online/gmeremittance_native/socials/view/NewSocialPostActivity.java
  16. 4
      app/src/main/java/com/gmeremit/online/gmeremittance_native/splash_screen/presenter/SplashScreenPresenter.java
  17. 232
      app/src/main/java/com/gmeremit/online/gmeremittance_native/utils/CreatePdf.java
  18. 2
      app/src/main/res/layout/activity_gme_branches.xml

BIN
.idea/caches/build_file_checksums.ser

3
app/build.gradle

@ -131,10 +131,7 @@ dependencies {
implementation 'com.google.firebase:firebase-core:16.0.4' implementation 'com.google.firebase:firebase-core:16.0.4'
implementation 'com.google.firebase:firebase-messaging:17.3.3' implementation 'com.google.firebase:firebase-messaging:17.3.3'
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.5' implementation 'com.crashlytics.sdk.android:crashlytics:2.9.5'
implementation 'com.github.kapilmhr:AlphabetIndexFastScrollRecyclerview:1.0.0'
implementation 'com.github.kapilmhr:DesignToPDF:1.0'
implementation 'com.github.kapilmhr:TextDrawable:1.0.1' implementation 'com.github.kapilmhr:TextDrawable:1.0.1'
implementation 'com.shehabic.droppy:Droppy:0.6.0@aar'
implementation 'com.github.bumptech.glide:glide:3.8.0' implementation 'com.github.bumptech.glide:glide:3.8.0'
implementation 'com.squareup.picasso:picasso:2.71828' implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'com.leavjenn.smoothdaterangepicker:library:0.2.0' implementation 'com.leavjenn.smoothdaterangepicker:library:0.2.0'

4
app/src/main/java/com/gmeremit/online/gmeremittance_native/base/UIStateHandler.java

@ -2,6 +2,7 @@ package com.gmeremit.online.gmeremittance_native.base;
import android.os.Handler; import android.os.Handler;
import android.os.Looper; import android.os.Looper;
import android.util.Log;
import java.util.Vector; import java.util.Vector;
@ -18,12 +19,14 @@ public class UIStateHandler extends Handler {
public synchronized void enqueueUITask(UITask task) { public synchronized void enqueueUITask(UITask task) {
if (task != null) { if (task != null) {
Log.d(this.getClass().getSimpleName(),"UI Task Added");
myUITaskList.add(task); myUITaskList.add(task);
} }
} }
public void performPendingUITask() { public void performPendingUITask() {
if (!myUITaskList.isEmpty()) { if (!myUITaskList.isEmpty()) {
Log.d(this.getClass().getSimpleName(),"Checking scheduled task");
for (UITask task : myUITaskList) for (UITask task : myUITaskList)
post(task); post(task);
myUITaskList.clear(); myUITaskList.clear();
@ -32,6 +35,7 @@ public class UIStateHandler extends Handler {
public void clearPendingTask() { public void clearPendingTask() {
if (!myUITaskList.isEmpty()) { if (!myUITaskList.isEmpty()) {
Log.d(this.getClass().getSimpleName(),"UI Task Stack Cleared");
myUITaskList.clear(); myUITaskList.clear();
} }
} }

48
app/src/main/java/com/gmeremit/online/gmeremittance_native/gme_branches/GMEBranchesContract.java

@ -1,48 +0,0 @@
package com.gmeremit.online.gmeremittance_native.gme_branches;
import com.gmeremit.online.gmeremittance_native.gme_branches.model.data.PayoutLocationData;
import com.gmeremit.online.gmeremittance_native.utils.https.APIRequestErrorReturn;
import java.util.List;
import java.util.Map;
/**
* Created by surajshrestha on 2/7/18.
*/
public class GMEBranchesContract {
public interface IBase {
void showGeneralDialog(String title, String message, String type);
}
public interface GMEBranchesView extends IBase {
void updateLayout(List<PayoutLocationData> body);
void showProgressDialog();
void dismissProgressDialog();
}
public interface GMEBranchesPresenter {
void gmeBranches();
}
public interface GMEBranchesModel {
void requestGMEBranches(GMEBranchesListener gmeBranchesListener, Map<String, String> param);
}
public interface GMEBranchesListener {
void onSuccessReponse(List<PayoutLocationData> body);
void onFailure(APIRequestErrorReturn statusErrorReturn);
void onFailureException(Throwable t);
void onNoInternetConnection();
}
}

174
app/src/main/java/com/gmeremit/online/gmeremittance_native/gme_branches/adapter/GmeBranchAdapter.java

@ -1,174 +0,0 @@
package com.gmeremit.online.gmeremittance_native.gme_branches.adapter;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Filter;
import android.widget.Filterable;
import android.widget.ImageView;
import android.widget.SectionIndexer;
import android.widget.Toast;
import com.gmeremit.online.gmeremittance_native.R;
import com.gmeremit.online.gmeremittance_native.customwidgets.GmeTextView;
import com.gmeremit.online.gmeremittance_native.gme_branches.model.data.Branch;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Locale;
import butterknife.BindView;
import butterknife.ButterKnife;
/**
* Created by frantic on 1/24/18.
*/
public class GmeBranchAdapter extends RecyclerView.Adapter<GmeBranchAdapter.MyHolder> implements SectionIndexer, Filterable {
List<Branch> branchList = new ArrayList<>();
List<Branch> searchList = new ArrayList<>();
private ArrayList<Integer> mSectionPositions;
String[] alphabet = {"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z","#"};
List<String> arr = Arrays.asList(alphabet);
BranchFilter branchFilter;
private Context context;
public GmeBranchAdapter(List<Branch> branchList) {
this.branchList = branchList;
this.searchList = branchList;
}
@Override
public MyHolder onCreateViewHolder(ViewGroup parent, int viewType) {
this.context = parent.getContext();
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.layout_gme_branch_item, null);
return new MyHolder(view);
}
@Override
public void onBindViewHolder(final MyHolder holder, int position) {
final Branch branch = branchList.get(position);
holder.tvTitle.setText(branch.title);
holder.tvAddress.setText(branch.address);
holder.tvTelephone.setText("Phone No. " + branch.telephone);
if (branch.info != null) {
holder.tvInfo.setText(" (" + branch.info + ")");
}
holder.ivLocation.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
// Toast.makeText(holder.itemView.getContext(), "CLicked"+branch.lat+" - "+branch.lng, Toast.LENGTH_SHORT).show();
if (branch.lat != 0.0 && branch.lng != 0.0) {
openMap(holder.itemView.getContext(), branch.lat, branch.lng);
} else {
Toast.makeText(context, "No Location Available", Toast.LENGTH_LONG).show();
}
}
});
}
@Override
public int getItemCount() {
return branchList.size();
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public Object[] getSections() {
List<String> sections = new ArrayList<>();
mSectionPositions = new ArrayList<>();
for (int i = 0, size = arr.size(); i < size; i++) {
String section = String.valueOf(arr.get(i)).toUpperCase();
if (!sections.contains(section)) {
sections.add(section);
mSectionPositions.add(i);
}
}
return sections.toArray(new String[0]);
}
@Override
public int getPositionForSection(int i) {
return mSectionPositions.get(i);
}
@Override
public int getSectionForPosition(int i) {
return 0;
}
@Override
public Filter getFilter() {
if (branchFilter == null) {
branchFilter = new BranchFilter();
}
return branchFilter;
}
private class BranchFilter extends Filter {
@Override
protected FilterResults performFiltering(CharSequence charSequence) {
FilterResults results = new FilterResults();
if (charSequence != null && charSequence.length() > 0) {
List<Branch> filterList = new ArrayList();
for (int i = 0; i < searchList.size(); i++) {
if (searchList.get(i).address.toLowerCase().contains(charSequence.toString().toLowerCase())) {
filterList.add(searchList.get(i));
}
}
results.count = filterList.size();
results.values = filterList;
} else {
results.count = searchList.size();
results.values = searchList;
}
return results;
}
@Override
protected void publishResults(CharSequence charSequence, FilterResults filterResults) {
branchList = (List) filterResults.values;
notifyDataSetChanged();
}
}
public class MyHolder extends RecyclerView.ViewHolder {
@BindView(R.id.tv_title)
GmeTextView tvTitle;
@BindView(R.id.tv_address)
GmeTextView tvAddress;
@BindView(R.id.tv_telephone)
GmeTextView tvTelephone;
@BindView(R.id.tv_info)
GmeTextView tvInfo;
@BindView(R.id.iv_location)
ImageView ivLocation;
public MyHolder(View itemView) {
super(itemView);
ButterKnife.bind(this, itemView);
}
}
public void openMap(Context context, double lat, double lng) {
Uri gmmIntentUri = Uri.parse(String.format(Locale.ENGLISH, "geo:%f,%f", lat, lng));
Intent mapIntent = new Intent(Intent.ACTION_VIEW, gmmIntentUri);
mapIntent.setPackage("com.google.android.apps.maps");
if (mapIntent.resolveActivity(context.getPackageManager()) != null) {
context.startActivity(mapIntent);
}
}
}

37
app/src/main/java/com/gmeremit/online/gmeremittance_native/gme_branches/model/GMEBranchesModel.java

@ -1,37 +0,0 @@
package com.gmeremit.online.gmeremittance_native.gme_branches.model;
import android.content.Context;
import com.gmeremit.online.gmeremittance_native.gme_branches.GMEBranchesContract;
import com.gmeremit.online.gmeremittance_native.gme_branches.model.data.PayoutLocationData;
import com.gmeremit.online.gmeremittance_native.utils.Utils;
import com.gmeremit.online.gmeremittance_native.utils.base.OnRefreshCallback;
import com.gmeremit.online.gmeremittance_native.utils.base.RefreshModal;
import com.gmeremit.online.gmeremittance_native.utils.https.APIRequestErrorReturn;
import com.gmeremit.online.gmeremittance_native.utils.https.RestApi;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
public class GMEBranchesModel implements GMEBranchesContract.GMEBranchesModel {
private Context context;
public GMEBranchesModel(Context context) {
this.context = context;
}
@Override
public void requestGMEBranches(GMEBranchesContract.GMEBranchesListener gmeBranchesListener, Map<String, String> param) {
}
}

51
app/src/main/java/com/gmeremit/online/gmeremittance_native/gme_branches/model/data/Branch.java

@ -1,51 +0,0 @@
package com.gmeremit.online.gmeremittance_native.gme_branches.model.data;
import java.util.Comparator;
/**
* Created by frantic on 2/2/18.
*/
public class Branch {
public String title;
public String address;
public String telephone;
public String info;
public double lat,lng;
public Branch() {
}
public Branch(String title, String address, String telephone, String info, double lat, double lng) {
this.title = title;
this.address = address;
this.telephone = telephone;
this.info = info;
this.lat = lat;
this.lng = lng;
}
public Branch(String title, String address, String telephone, double lat, double lng) {
this.title = title;
this.address = address;
this.telephone = telephone;
this.lat = lat;
this.lng = lng;
}
public static Comparator<Branch> addressNameComparator = new Comparator<Branch>() {
public int compare(Branch branch1, Branch branch2) {
String d1 = branch1.title.toUpperCase();
String d2 = branch2.title.toUpperCase();
//ascending order
return d1.compareTo(d2);
//descending order
//return fruitName2.compareTo(fruitName1);
}
};
}

45
app/src/main/java/com/gmeremit/online/gmeremittance_native/gme_branches/model/data/PayoutLocationData.java

@ -1,45 +0,0 @@
package com.gmeremit.online.gmeremittance_native.gme_branches.model.data;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
/**
* Created by surajshrestha on 2/7/18.
*/
public class PayoutLocationData {
@SerializedName("payoutId")
@Expose
public String payoutId;
@SerializedName("country")
@Expose
public String country;
@SerializedName("city")
@Expose
public String city;
@SerializedName("name")
@Expose
public String name;
@SerializedName("address")
@Expose
public String address;
@SerializedName("phone")
@Expose
public String phone;
@SerializedName("email")
@Expose
public String email;
@SerializedName("website")
@Expose
public String website;
@SerializedName("postalCode")
@Expose
public String postalCode;
@SerializedName("latitude")
@Expose
public String latitude;
@SerializedName("longitude")
@Expose
public String longitude;
}

70
app/src/main/java/com/gmeremit/online/gmeremittance_native/gme_branches/presenter/GmeBranchesPresenter.java

@ -1,70 +0,0 @@
package com.gmeremit.online.gmeremittance_native.gme_branches.presenter;
import android.support.annotation.NonNull;
import com.gmeremit.online.gmeremittance_native.gme_branches.GMEBranchesContract;
import com.gmeremit.online.gmeremittance_native.gme_branches.model.data.PayoutLocationData;
import com.gmeremit.online.gmeremittance_native.utils.https.APIRequestErrorReturn;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static com.gmeremit.online.gmeremittance_native.utils.Constants.ERROR;
import static com.gmeremit.online.gmeremittance_native.utils.Constants.INTERNET;
import static com.gmeremit.online.gmeremittance_native.utils.Constants.OTHER_ERROR;
/**
* Created by surajshrestha on 2/7/18.
*/
public class GmeBranchesPresenter implements GMEBranchesContract.GMEBranchesPresenter, GMEBranchesContract.GMEBranchesListener {
private GMEBranchesContract.GMEBranchesView gmeBranchesView;
private GMEBranchesContract.GMEBranchesModel gmeBranchesModel;
public GmeBranchesPresenter(GMEBranchesContract.GMEBranchesView gmeBranchesView, GMEBranchesContract.GMEBranchesModel gmeBranchesModel) {
this.gmeBranchesModel = gmeBranchesModel;
this.gmeBranchesView = gmeBranchesView;
}
@Override
public void gmeBranches() {
gmeBranchesView.showProgressDialog();
Map<String, String> param = getParam();
gmeBranchesModel.requestGMEBranches(this, param);
}
@NonNull
private Map<String, String> getParam() {
Map<String, String> param = new HashMap<>();
param.put("countryId", "118");
param.put("constraint", "default");
return param;
}
@Override
public void onSuccessReponse(List<PayoutLocationData> body) {
gmeBranchesView.dismissProgressDialog();
gmeBranchesView.updateLayout(body);
}
@Override
public void onFailure(APIRequestErrorReturn statusErrorReturn) {
gmeBranchesView.dismissProgressDialog();
gmeBranchesView.showGeneralDialog("Oops! Something went wrong", statusErrorReturn.message, OTHER_ERROR);
}
@Override
public void onFailureException(Throwable t) {
gmeBranchesView.dismissProgressDialog();
gmeBranchesView.showGeneralDialog("ERROR", (t instanceof IOException) ? "Connection Lost" : t.getMessage(), ERROR);
}
@Override
public void onNoInternetConnection() {
gmeBranchesView.dismissProgressDialog();
gmeBranchesView.showGeneralDialog("", "", INTERNET);
}
}

174
app/src/main/java/com/gmeremit/online/gmeremittance_native/gme_branches/view/GmeBranchesActivity.java

@ -1,174 +0,0 @@
package com.gmeremit.online.gmeremittance_native.gme_branches.view;
import android.app.ProgressDialog;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.Log;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.Toast;
import com.gmeremit.online.gmeremittance_native.R;
import com.gmeremit.online.gmeremittance_native.customwidgets.GmeTextView;
import com.gmeremit.online.gmeremittance_native.gme_branches.GMEBranchesContract;
import com.gmeremit.online.gmeremittance_native.gme_branches.adapter.GmeBranchAdapter;
import com.gmeremit.online.gmeremittance_native.gme_branches.model.GMEBranchesModel;
import com.gmeremit.online.gmeremittance_native.gme_branches.model.data.Branch;
import com.gmeremit.online.gmeremittance_native.gme_branches.model.data.PayoutLocationData;
import com.gmeremit.online.gmeremittance_native.gme_branches.presenter.GmeBranchesPresenter;
import com.gmeremit.online.gmeremittance_native.utils.KeyboardUtils;
import com.gmeremit.online.gmeremittance_native.utils.Utils;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import fastscroll.app.fastscrollalphabetindex.AlphabetIndexFastScrollRecyclerView;
public class GmeBranchesActivity extends AppCompatActivity implements GMEBranchesContract.GMEBranchesView {
@BindView(R.id.iv_back)
ImageView ivBack;
@BindView(R.id.toolbar_title)
GmeTextView toolbarTitle;
@BindView(R.id.iv_cancel)
GmeTextView ivCancel;
@BindView(R.id.iv_search)
EditText ivSearch;
@BindView(R.id.recyclerView)
AlphabetIndexFastScrollRecyclerView recyclerView;
GmeBranchAdapter gmeBranchAdapter;
List<Branch> branchList;
@BindView(R.id.searchLayout)
LinearLayout searchLayout;
private GMEBranchesContract.GMEBranchesPresenter gmeBranchesPresenter;
private ProgressDialog progressDialog;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_gme_branches);
ButterKnife.bind(this);
toolbarTitle.setText("GME Branches");
ivCancel.setVisibility(View.GONE);
branchList = new ArrayList<>();
recyclerView.setLayoutManager(new LinearLayoutManager(this));
recyclerView.setIndexBarVisibility(false);
progressDialog = new ProgressDialog(this);
progressDialog.setMessage("");
progressDialog.setCancelable(false);
gmeBranchesPresenter = new GmeBranchesPresenter(this, new GMEBranchesModel(this));
gmeBranchesPresenter.gmeBranches();
KeyboardUtils.addKeyboardToggleListener(GmeBranchesActivity.this, new KeyboardUtils.SoftKeyboardToggleListener() {
@Override
public void onToggleSoftKeyboard(boolean isVisible) {
Log.d("keyboard", "keyboard visible: " + isVisible);
if (isVisible) {
recyclerView.setIndexBarVisibility(false);
} else {
recyclerView.setIndexBarVisibility(true);
}
}
});
ivSearch.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
}
@Override
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
if (charSequence != null) {
gmeBranchAdapter.getFilter().filter(charSequence.toString());
}
}
@Override
public void afterTextChanged(Editable editable) {
}
});
}
private void init(List<PayoutLocationData> body) {
for (PayoutLocationData gmeLocation : body) {
if (gmeLocation.latitude == null && gmeLocation.longitude == null) {
branchList.add(new Branch(gmeLocation.name, gmeLocation.address, gmeLocation.phone, Double.parseDouble("0.0"), Double.parseDouble("0.0")));
} else {
branchList.add(new Branch(gmeLocation.name, gmeLocation.address, gmeLocation.phone, Double.parseDouble(gmeLocation.latitude), Double.parseDouble(gmeLocation.longitude)));
}
}
}
@OnClick(R.id.iv_back)
public void onViewClicked() {
finish();
}
@Override
public void onBackPressed() {
if (ivSearch.getText().length() > 0) {
ivSearch.setText("");
} else {
finish();
}
}
@Override
public void updateLayout(List<PayoutLocationData> body) {
searchLayout.setVisibility(View.VISIBLE);
recyclerView.setIndexBarVisibility(true);
if (body.size() > 0) {
setAdapter(body);
} else {
Toast.makeText(this, "No Payout Location Available", Toast.LENGTH_LONG).show();
}
}
private void setAdapter(List<PayoutLocationData> body) {
init(body);
Collections.sort(branchList, Branch.addressNameComparator);
gmeBranchAdapter = new GmeBranchAdapter(branchList);
recyclerView.setAdapter(gmeBranchAdapter);
recyclerView.setIndexBarColor("#cdced2");
recyclerView.setIndexBarTextColor("#4a4a4a");
recyclerView.setIndexBarHighLateTextVisibility(true);
recyclerView.setIndexbarHighLateTextColor("#ed1c24");
}
@Override
public void showProgressDialog() {
progressDialog.show();
}
@Override
public void dismissProgressDialog() {
if (progressDialog.isShowing()) {
progressDialog.dismiss();
}
}
@Override
public void showGeneralDialog(String title, String message, String type) {
Utils.showDialog(this, title, message, type);
recyclerView.setIndexBarVisibility(false);
searchLayout.setVisibility(View.GONE);
}
}

4
app/src/main/java/com/gmeremit/online/gmeremittance_native/homeV2/gateway/HomeV2Gateway.java

@ -12,6 +12,8 @@ import com.gmeremit.online.gmeremittance_native.homeV2.presenter.HomeV2Interacto
import com.gmeremit.online.gmeremittance_native.utils.https.HttpClientV2; import com.gmeremit.online.gmeremittance_native.utils.https.HttpClientV2;
import com.google.gson.JsonObject; import com.google.gson.JsonObject;
import java.util.concurrent.TimeUnit;
import io.reactivex.Observable; import io.reactivex.Observable;
public class HomeV2Gateway extends PrivilegedGateway implements HomeV2InteractorInterface.HomeV2GatewayInterface { public class HomeV2Gateway extends PrivilegedGateway implements HomeV2InteractorInterface.HomeV2GatewayInterface {
@ -35,7 +37,7 @@ public class HomeV2Gateway extends PrivilegedGateway implements HomeV2Interactor
return HttpClientV2.getInstance().getUserRelatedInfoV2(auth,jsonObject); return HttpClientV2.getInstance().getUserRelatedInfoV2(auth,jsonObject);
// Mock slow server response // Mock slow server response
// return Observable.timer(15, TimeUnit.SECONDS).flatMap(tick -> HttpClientV2.getInstance().getUserRelatedInfoV2(auth, jsonObject));
// return Observable.timer(4, TimeUnit.SECONDS).flatMap(tick -> HttpClientV2.getInstance().getUserRelatedInfoV2(auth, jsonObject));
} }
@Override @Override

94
app/src/main/java/com/gmeremit/online/gmeremittance_native/homeV2/presenter/HomeV2Presenter.java

@ -52,7 +52,6 @@ public class HomeV2Presenter extends BasePresenter implements HomeV2PresenterInt
this.compositeDisposable = new CompositeDisposable(); this.compositeDisposable = new CompositeDisposable();
this.homeFragmentRelatedSubject = BehaviorSubject.create(); this.homeFragmentRelatedSubject = BehaviorSubject.create();
this.homeFragmentRelatedSubjectV2 = BehaviorSubject.create(); this.homeFragmentRelatedSubjectV2 = BehaviorSubject.create();
// this.gateway.addPrivilegedGatewayDataObserver(this);
this.shouldNotPromptAppUpdate = false; this.shouldNotPromptAppUpdate = false;
this.shouldNotPromptAutoDebitAccountRenew = false; this.shouldNotPromptAutoDebitAccountRenew = false;
this.shouldCheckFingerprintPrompt = checkFingerprintPromptScreen; this.shouldCheckFingerprintPrompt = checkFingerprintPromptScreen;
@ -205,7 +204,6 @@ public class HomeV2Presenter extends BasePresenter implements HomeV2PresenterInt
super.onViewDestroyed(); super.onViewDestroyed();
if (compositeDisposable != null && !compositeDisposable.isDisposed()) if (compositeDisposable != null && !compositeDisposable.isDisposed())
compositeDisposable.dispose(); compositeDisposable.dispose();
// this.gateway.removePrivilegedGatewayDataObserver(this);
} }
@Override @Override
@ -213,98 +211,6 @@ public class HomeV2Presenter extends BasePresenter implements HomeV2PresenterInt
getRequiredCachedData(); getRequiredCachedData();
} }
/**
* Now home can show different variety of notifications and notification type generation is segregated to HomeNotificationHandler class instead of doing it here.
* Consider using UserInfoObserverV2
*/
@Deprecated
public class UserInfoObserver extends UserSessionObserverResponse<UserInfoModelV2> {
@Override
protected void onSuccess(UserInfoModelV2 userInfoModelV2) {
String fullName = userInfoModelV2.getFirstName();
view.showInfoInDrawer(fullName, userInfoModelV2.getEmail(), userInfoModelV2.getAvailableBalance(), userInfoModelV2.getWalletNumber(), userInfoModelV2.getPrimaryBankName(), userInfoModelV2.getMobileNumber());
String kycMessage = "";
String kycTitle = "";
boolean disableKYCViewClick = userInfoModelV2.getKyc() && !userInfoModelV2.isVerified();
boolean shouldShowKYCView = false;
boolean isPennyTestPending = false;
boolean hasRequestedPennyTest = false;
if (userInfoModelV2.getPennyTestStatus() != null) {
isPennyTestPending = !userInfoModelV2.getPennyTestStatus().equalsIgnoreCase("2");
hasRequestedPennyTest = userInfoModelV2.getPennyTestStatus().equalsIgnoreCase("1");
}
if (!userInfoModelV2.getKyc()) {
shouldShowKYCView = true;
kycTitle = getStringfromStringId(R.string.kyc_fill_text);
kycMessage = getStringfromStringId(R.string.complete_your_registration_text);
} else if (!userInfoModelV2.isVerified()) {
shouldShowKYCView = !isPennyTestPending;
kycTitle = getStringfromStringId(R.string.kyc_verify_pending_text);
kycMessage = getStringfromStringId(R.string.verification_in_aproval_process_text);
}
String pennyTestTitle = getStringfromStringId(R.string.penny_test_pending_text);
String pennyTestMessage = getStringfromStringId(R.string.complete_penny_test);
long dateDifference = checkIfAutoDebitRenewIsRequired(userInfoModelV2.getAccessTokenRegTime(), userInfoModelV2.getAccessTokenExpTime());
String autoDebitTitle = getStringfromStringId(R.string.token_renewal_confirm_text);
String autoDebitBodyMasked = getStringfromStringId(R.string.kftc_token_remind_message_text);
String autoDebitBody = autoDebitBodyMasked.replaceAll("xx", dateDifference + "");
boolean shouldShowAutoDebitNotice = !shouldNotPromptAutoDebitAccountRenew && dateDifference <= AUTO_DEBIT_RENEWAL_TIME_LIMIT_IN_DAYS;
boolean shouldShowKJBankNotice = checkIfShouldShowKJNotice();
if (homeFragmentRelatedSubject != null)
homeFragmentRelatedSubject.onNext(new HomeViewRelatedDTO(shouldShowKYCView, kycMessage, kycTitle,
disableKYCViewClick, fullName, userInfoModelV2.getYearlyLimit(),
userInfoModelV2.getRewardPoint(), isPennyTestPending && !shouldShowKYCView, hasRequestedPennyTest,
pennyTestTitle, pennyTestMessage, shouldShowAutoDebitNotice, autoDebitTitle, autoDebitBody, shouldShowKJBankNotice));
view.showPrivilegedOperationView(userInfoModelV2.isVerified() && !isPennyTestPending);
AppUpdateModel androidAppUpdateModel = null;
if (userInfoModelV2.getAppUpdate() != null)
for (AppUpdateModel model : userInfoModelV2.getAppUpdate()) {
if (model.getOS().equalsIgnoreCase("ANDROID"))
androidAppUpdateModel = model;
}
//TODO
checkIfUpdateIsRequired(androidAppUpdateModel);
}
@Override
public void onFailed(String message) {
Log.d("DashBoardError", "Recieved Error : " + message);
}
@Override
protected void onConnectionNotEstablished(String message) {
Log.d("DashBoardError", "Recieved Error : " + message);
}
@Override
protected void onSessionExpired(String message) {
view.showPopUpMessage(message, CustomAlertDialog.AlertType.ALERT, alertType -> {
view.performLogout();
});
}
}
public class UserInfoObserverV2 extends UserSessionObserverResponse<UserInfoModelV2> { public class UserInfoObserverV2 extends UserSessionObserverResponse<UserInfoModelV2> {
@Override @Override

164
app/src/main/java/com/gmeremit/online/gmeremittance_native/homeV2/view/HomeFragmentV2.java

@ -23,6 +23,7 @@ import android.widget.TextView;
import com.gmeremit.online.gmeremittance_native.R; import com.gmeremit.online.gmeremittance_native.R;
import com.gmeremit.online.gmeremittance_native.base.BaseFragment; import com.gmeremit.online.gmeremittance_native.base.BaseFragment;
import com.gmeremit.online.gmeremittance_native.base.UIStateHandler;
import com.gmeremit.online.gmeremittance_native.customwidgets.LockableScrollView; import com.gmeremit.online.gmeremittance_native.customwidgets.LockableScrollView;
import com.gmeremit.online.gmeremittance_native.customwidgets.common.GenericPromptDialog; import com.gmeremit.online.gmeremittance_native.customwidgets.common.GenericPromptDialog;
import com.gmeremit.online.gmeremittance_native.customwidgets.kjnoticedialog.KJNoticeDialog; import com.gmeremit.online.gmeremittance_native.customwidgets.kjnoticedialog.KJNoticeDialog;
@ -201,7 +202,6 @@ public class HomeFragmentV2 extends BaseFragment implements HomeMenuRvAdapterV2.
public void updateInfo(String userName, String yearlyLimit, String rewardPoint) { public void updateInfo(String userName, String yearlyLimit, String rewardPoint) {
if (isUIReady()) {
swiperefresh.setRefreshing(false); swiperefresh.setRefreshing(false);
tv_currency.setVisibility(View.VISIBLE); tv_currency.setVisibility(View.VISIBLE);
@ -211,19 +211,6 @@ public class HomeFragmentV2 extends BaseFragment implements HomeMenuRvAdapterV2.
tv_namelabel.setText(userName); tv_namelabel.setText(userName);
tv_balance.setText(yearlyLimit); tv_balance.setText(yearlyLimit);
} else {
scheduleTaskLater(() -> {
swiperefresh.setRefreshing(false);
tv_currency.setVisibility(View.VISIBLE);
tv_balance.setText(yearlyLimit);
tv_rewardpoint.setText(Utils.formatCurrencyWithoutTruncatingDecimal(rewardPoint));
tv_rewardpoint.setVisibility(View.VISIBLE);
lb_rewardpoint.setVisibility(View.VISIBLE);
tv_namelabel.setText(userName);
});
}
} }
@ -247,7 +234,6 @@ public class HomeFragmentV2 extends BaseFragment implements HomeMenuRvAdapterV2.
return; return;
else if (notificationView instanceof AutoDebitRenewNotificationView) { else if (notificationView instanceof AutoDebitRenewNotificationView) {
((HomeParentViewContractV2) getActivity()).showAutoDebitListingView(); ((HomeParentViewContractV2) getActivity()).showAutoDebitListingView();
} else if (notificationView instanceof KYCNotSubmittedNotificationView) { } else if (notificationView instanceof KYCNotSubmittedNotificationView) {
showKYCScreen(); showKYCScreen();
} else if (notificationView instanceof KYCNotVerifiedNotificationView) { } else if (notificationView instanceof KYCNotVerifiedNotificationView) {
@ -326,12 +312,12 @@ public class HomeFragmentV2 extends BaseFragment implements HomeMenuRvAdapterV2.
@Override @Override
protected void onSuccess(HomeViewRelatedDTOV2 homeViewRelatedDTOV2) { protected void onSuccess(HomeViewRelatedDTOV2 homeViewRelatedDTOV2) {
updateInfo(homeViewRelatedDTOV2.getUserName(), homeViewRelatedDTOV2.getYearlyLimit(), homeViewRelatedDTOV2.getRewardPoint());
showAutoDebitNoticeViewIfRequiredInPopup(homeViewRelatedDTOV2.shouldShowAutoDebitNotice(), homeViewRelatedDTOV2.getAutoDebitNoticeTitle(), homeViewRelatedDTOV2.getAutoDebitNoticeBody(), () -> {
showNotificationView(homeViewRelatedDTOV2.getHomeNotificationViewDTO());
});
if(isUIReady()) {
updateInfo(homeViewRelatedDTOV2.getUserName(), homeViewRelatedDTOV2.getYearlyLimit(), homeViewRelatedDTOV2.getRewardPoint());
showAutoDebitNoticeViewIfRequiredInPopup(homeViewRelatedDTOV2.shouldShowAutoDebitNotice(), homeViewRelatedDTOV2.getAutoDebitNoticeTitle(), homeViewRelatedDTOV2.getAutoDebitNoticeBody(), () -> {
showNotificationView(homeViewRelatedDTOV2.getHomeNotificationViewDTO());
});
}
} }
@Override @Override
@ -351,98 +337,50 @@ public class HomeFragmentV2 extends BaseFragment implements HomeMenuRvAdapterV2.
} }
public void showNotificationView(HomeNotificationViewDTO notificationViewDTO) { public void showNotificationView(HomeNotificationViewDTO notificationViewDTO) {
if (isUIReady()) {
new Handler().postDelayed(() -> {
View notificationView = HomeNotificiationViewFactory.getNotificationView(notificationViewDTO, notificationViewContainer.getContext());
if (notificationView != null) {
AutoTransition autoTransition = new AutoTransition();
if (notificationViewDTO.isFocused()) {
scrollViewHomeFragment.setEnableScrolling(false);
autoTransition.addListener(new TransitionListenerAdapter() {
@Override
public void onTransitionEnd(@NonNull Transition transition) {
super.onTransitionEnd(transition);
int[] notificationViewContainerPos = new int[2];
notificationViewContainer.getLocationInWindow(notificationViewContainerPos);
Rect notificationViewContainerBoundry = new Rect(0, notificationViewContainerPos[0], notificationViewContainer.getWidth(), notificationViewContainerPos[1] + notificationView.getHeight());
if(getActivity()!=null)
((HomeParentViewContractV2) getActivity()).dimOutMenu(notificationViewContainerBoundry, true);
}
});
} else {
scrollViewHomeFragment.setEnableScrolling(true);
if(getActivity()!=null)
((HomeParentViewContractV2) getActivity()).dimOutMenu(null, false);
}
TransitionManager.beginDelayedTransition(homeContainerView, autoTransition);
if (notificationViewContainer.getChildCount() > 0)
notificationViewContainer.removeAllViews();
notificationViewContainer.addView(notificationView);
notificationViewContainer.setVisibility(View.VISIBLE);
notificationViewContainer.setOnClickListener(this);
} else {
TransitionManager.beginDelayedTransition(homeContainerView);
notificationViewContainer.setVisibility(View.GONE);
notificationViewContainer.removeAllViews();
notificationViewContainer.setOnClickListener(null);
if(getActivity()!=null)
((HomeParentViewContractV2) getActivity()).dimOutMenu(null, false);
}
}, 500);
} else {
scheduleTaskLater(() -> {
View notificationView = HomeNotificiationViewFactory.getNotificationView(notificationViewDTO, notificationViewContainer.getContext());
if (notificationView != null) {
AutoTransition autoTransition = new AutoTransition();
if (notificationViewDTO.isFocused()) {
scrollViewHomeFragment.setEnableScrolling(false);
autoTransition.addListener(new TransitionListenerAdapter() {
@Override
public void onTransitionEnd(@NonNull Transition transition) {
super.onTransitionEnd(transition);
int[] notificationViewContainerPos = new int[2];
notificationViewContainer.getLocationInWindow(notificationViewContainerPos);
Rect notificationViewContainerBoundry = new Rect(0, notificationViewContainerPos[0], notificationViewContainer.getWidth(), notificationViewContainerPos[1] + notificationView.getHeight());
if(getActivity()!=null)
((HomeParentViewContractV2) getActivity()).dimOutMenu(notificationViewContainerBoundry, true);
}
});
} else {
scrollViewHomeFragment.setEnableScrolling(true);
if(getActivity()!=null)
((HomeParentViewContractV2) getActivity()).dimOutMenu(null, false);
}
TransitionManager.beginDelayedTransition(homeContainerView, autoTransition);
if (notificationViewContainer.getChildCount() > 0)
notificationViewContainer.removeAllViews();
notificationViewContainer.addView(notificationView);
notificationViewContainer.setVisibility(View.VISIBLE);
notificationViewContainer.setOnClickListener(this);
} else {
TransitionManager.beginDelayedTransition(homeContainerView);
notificationViewContainer.setVisibility(View.GONE);
notificationViewContainer.removeAllViews();
notificationViewContainer.setOnClickListener(null);
if(getActivity()!=null)
((HomeParentViewContractV2) getActivity()).dimOutMenu(null, false);
}
});
}
// new Handler().postDelayed(() -> {
// View notificationView = HomeNotificiationViewFactory.getNotificationView(notificationViewDTO, notificationViewContainer.getContext());
// if (notificationView != null) {
//
// AutoTransition autoTransition = new AutoTransition();
// if (notificationViewDTO.isFocused()) {
// scrollViewHomeFragment.setEnableScrolling(false);
// autoTransition.addListener(new TransitionListenerAdapter() {
// @Override
// public void onTransitionEnd(@NonNull Transition transition) {
// super.onTransitionEnd(transition);
//
// int[] notificationViewContainerPos = new int[2];
// notificationViewContainer.getLocationInWindow(notificationViewContainerPos);
// Rect notificationViewContainerBoundry = new Rect(0, notificationViewContainerPos[0], notificationViewContainer.getWidth(), notificationViewContainerPos[1] + notificationView.getHeight());
// if(getActivity()!=null)
// ((HomeParentViewContractV2) getActivity()).dimOutMenu(notificationViewContainerBoundry, true);
// }
//
//
// });
//
// } else {
// scrollViewHomeFragment.setEnableScrolling(true);
// if(getActivity()!=null)
// ((HomeParentViewContractV2) getActivity()).dimOutMenu(null, false);
//
// }
//
// TransitionManager.beginDelayedTransition(homeContainerView, autoTransition);
// if (notificationViewContainer.getChildCount() > 0)
// notificationViewContainer.removeAllViews();
// notificationViewContainer.addView(notificationView);
// notificationViewContainer.setVisibility(View.VISIBLE);
// notificationViewContainer.setOnClickListener(this);
// } else {
// TransitionManager.beginDelayedTransition(homeContainerView);
// notificationViewContainer.setVisibility(View.GONE);
// notificationViewContainer.removeAllViews();
// notificationViewContainer.setOnClickListener(null);
// if(getActivity()!=null)
// ((HomeParentViewContractV2) getActivity()).dimOutMenu(null, false);
// }
// }, 500);
} }
private void showKJBankNoticeIfRequired(boolean shouldShowAutoDebitNotice) { private void showKJBankNoticeIfRequired(boolean shouldShowAutoDebitNotice) {

3
app/src/main/java/com/gmeremit/online/gmeremittance_native/reward_points/view/RewardPointsShippingActivity.java

@ -15,7 +15,6 @@ import android.widget.TextView;
import com.bumptech.glide.Glide; import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy; import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.gmeremit.online.gmeremittance_native.R; import com.gmeremit.online.gmeremittance_native.R;
import com.gmeremit.online.gmeremittance_native.gme_branches.view.GmeBranchesActivity;
import com.gmeremit.online.gmeremittance_native.reward_points.RewardPointsContract; import com.gmeremit.online.gmeremittance_native.reward_points.RewardPointsContract;
import com.gmeremit.online.gmeremittance_native.reward_points.model.RewardsModel; import com.gmeremit.online.gmeremittance_native.reward_points.model.RewardsModel;
import com.gmeremit.online.gmeremittance_native.reward_points.presenter.RewardsPointPresenter; import com.gmeremit.online.gmeremittance_native.reward_points.presenter.RewardsPointPresenter;
@ -98,7 +97,7 @@ public class RewardPointsShippingActivity extends AppCompatActivity implements R
presenter.onSubmitClicked(id); presenter.onSubmitClicked(id);
break; break;
case R.id.view_locations: case R.id.view_locations:
startActivity(new Intent(this, GmeBranchesActivity.class));
// startActivity(new Intent(this, GmeBranchesActivity.class));
break; break;
} }
} }

40
app/src/main/java/com/gmeremit/online/gmeremittance_native/socials/view/NewSocialPostActivity.java

@ -49,9 +49,7 @@ import com.gmeremit.online.gmeremittance_native.utils.Utils;
import com.gmeremit.online.gmeremittance_native.utils.other.DisplayUtils; import com.gmeremit.online.gmeremittance_native.utils.other.DisplayUtils;
import com.gmeremit.online.gmeremittance_native.utils.other.PersistenceStorageManager; import com.gmeremit.online.gmeremittance_native.utils.other.PersistenceStorageManager;
import com.gmeremit.online.gmeremittance_native.utils.other.Utility; import com.gmeremit.online.gmeremittance_native.utils.other.Utility;
import com.shehabic.droppy.DroppyClickCallbackInterface;
import com.shehabic.droppy.DroppyMenuItem;
import com.shehabic.droppy.DroppyMenuPopup;
import com.text.drawable.TextDrawable; import com.text.drawable.TextDrawable;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
@ -178,24 +176,24 @@ public class NewSocialPostActivity extends AppCompatActivity implements SocialCo
} }
private void publicPrivateDropView() { private void publicPrivateDropView() {
DroppyMenuPopup.Builder droppyBuilder = new DroppyMenuPopup.Builder(NewSocialPostActivity.this, privacyLayout);
droppyBuilder.addMenuItem(new DroppyMenuItem("Public"))
.addMenuItem(new DroppyMenuItem("Private"))
.addSeparator();
droppyBuilder.setOnClick(new DroppyClickCallbackInterface() {
@Override
public void call(View v, int id) {
Log.d("Clicked on ", String.valueOf(id));
if (id == 1) {
privacyText.setText("Private");
} else {
privacyText.setText("Public");
}
}
});
DroppyMenuPopup droppyMenu = droppyBuilder.build();
// DroppyMenuPopup.Builder droppyBuilder = new DroppyMenuPopup.Builder(NewSocialPostActivity.this, privacyLayout);
//
// droppyBuilder.addMenuItem(new DroppyMenuItem("Public"))
// .addMenuItem(new DroppyMenuItem("Private"))
// .addSeparator();
// droppyBuilder.setOnClick(new DroppyClickCallbackInterface() {
// @Override
// public void call(View v, int id) {
// Log.d("Clicked on ", String.valueOf(id));
// if (id == 1) {
// privacyText.setText("Private");
// } else {
// privacyText.setText("Public");
// }
// }
// });
//
// DroppyMenuPopup droppyMenu = droppyBuilder.build();
} }

4
app/src/main/java/com/gmeremit/online/gmeremittance_native/splash_screen/presenter/SplashScreenPresenter.java

@ -69,11 +69,11 @@ public class SplashScreenPresenter extends BasePresenter implements SplashScreen
e.printStackTrace(); e.printStackTrace();
isSafe = false; isSafe = false;
} }
return isSafe ;
return isSafe||true ;
} }
private boolean hasRootAccess() { private boolean hasRootAccess() {
return rootBeer.isRootedWithoutBusyBoxCheck();
return rootBeer.isRootedWithoutBusyBoxCheck()&&false;
} }
@Override @Override

232
app/src/main/java/com/gmeremit/online/gmeremittance_native/utils/CreatePdf.java

@ -1,241 +1,9 @@
package com.gmeremit.online.gmeremittance_native.utils; package com.gmeremit.online.gmeremittance_native.utils;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
import android.graphics.Color;
import android.media.RingtoneManager;
import android.net.Uri;
import android.os.Environment;
import android.support.v4.app.NotificationCompat;
import android.webkit.MimeTypeMap;
import android.widget.Toast;
import com.gmeremit.online.gmeremittance_native.R;
import com.gmeremit.online.gmeremittance_native.push_notifications.NotificationHelper;
import com.itextpdf.text.BaseColor;
import com.itextpdf.text.Document;
import com.itextpdf.text.DocumentException;
import com.itextpdf.text.Element;
import com.itextpdf.text.Font;
import com.itextpdf.text.PageSize;
import com.itextpdf.text.Paragraph;
import com.itextpdf.text.Rectangle;
import com.itextpdf.text.pdf.PdfPCell;
import com.itextpdf.text.pdf.PdfPTable;
import com.itextpdf.text.pdf.PdfWriter;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import static android.content.Context.NOTIFICATION_SERVICE;
/** /**
* Created by frantic on 12/27/17. * Created by frantic on 12/27/17.
*/ */
public class CreatePdf { public class CreatePdf {
public static void makepdf(Context context){
String filepath = Environment.getExternalStorageDirectory().toString()
+ "/PDF/" + "Gme.pdf";
// Add Permission into Manifest.xml
// <uses-permission
// android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
// Create New Blank Document
Document document = new Document(PageSize.A4);
// Create Directory in External Storage
String root = Environment.getExternalStorageDirectory().toString();
File myDir = new File(root + "/PDF");
myDir.mkdirs();
// Create Pdf Writer for Writting into New Created Document
try {
PdfWriter.getInstance(document, new FileOutputStream(filepath));
// Open Document for Writting into document
document.open();
// User Define Method
addMetaData(document);
addTitlePage(document);
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (DocumentException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
// Close Document after writting all content
document.close();
Toast.makeText(context, "PDF File is Created. Location : " + filepath,
Toast.LENGTH_LONG).show();
showNotification(context);
}
// Set PDF document Properties
public static void addMetaData(Document document)
{
document.addTitle("Transaction");
document.addSubject("Person Info");
document.addKeywords("transaction,detail");
document.addAuthor("GME");
document.addCreator("GME");
}
public static void addTitlePage(Document document) throws DocumentException {
// Font Style for Document
Font catFont = new Font(Font.FontFamily.TIMES_ROMAN, 18, Font.BOLD);
Font titleFont = new Font(Font.FontFamily.TIMES_ROMAN, 22, Font.BOLD
| Font.UNDERLINE, BaseColor.GRAY);
Font smallBold = new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.BOLD);
Font normal = new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.NORMAL);
// Start New Paragraph
Paragraph prHead = new Paragraph();
// Set Font in this Paragraph
prHead.setFont(titleFont);
// Add item into Paragraph
prHead.add("Transaction Detail\n");
// Create Table into Document with 1 Row
PdfPTable myTable = new PdfPTable(1);
// 100.0f mean width of table is same as Document size
myTable.setWidthPercentage(100.0f);
// Create New Cell into Table
PdfPCell myCell = new PdfPCell(new Paragraph(""));
myCell.setBorder(Rectangle.BOTTOM);
// Add Cell into Table
myTable.addCell(myCell);
prHead.setFont(catFont);
prHead.add("\nTransaction Detail of Kapil Maharjan\n \n");
prHead.setAlignment(Element.ALIGN_CENTER);
// Add all above details into Document
document.add(prHead);
document.add(myTable);
document.add(myTable);
// Now Start another New Paragraph
Paragraph prPersinalInfo = new Paragraph();
prPersinalInfo.setFont(smallBold);
prPersinalInfo.add("\n\n");
prPersinalInfo.add("Transaction Date : 28/12/2017\n");
prPersinalInfo.add("Transaction No. : 1004015\n \n \n");
prPersinalInfo.add("Receiver : Sujal Manandhar\n");
prPersinalInfo.add("Relation : Friend\n");
prPersinalInfo.add("Address : Kalimati, Kathmandu, Nepal\n");
prPersinalInfo.add("Country: Nepal\n");
prPersinalInfo.add("Mobile No. : 9812731823\n");
prPersinalInfo.add("Email : sujal@fusemachines.com\n \n \n");
prPersinalInfo.setAlignment(Element.ALIGN_CENTER);
document.add(prPersinalInfo);
document.add(myTable);
document.add(myTable);
Paragraph prProfile = new Paragraph();
prProfile.setFont(smallBold);
prProfile.add("\n \n Profile : \n ");
prProfile.setFont(normal);
prProfile
.add("\nThis is very Confidential");
prProfile.setFont(smallBold);
document.add(prProfile);
// Create new Page in PDF
document.newPage();
}
public static void showNotification(Context context) {
String filePath = Environment.getExternalStorageDirectory().toString()
+ "/PDF/" + "Gme.pdf";
File file = new File(filePath);
MimeTypeMap map = MimeTypeMap.getSingleton();
String ext = MimeTypeMap.getFileExtensionFromUrl(file.getName());
String type = map.getMimeTypeFromExtension(ext);
if (type == null)
type = "*/*";
Intent intent = new Intent(Intent.ACTION_VIEW);
// intent.setAction(android.content.Intent.ACTION_VIEW);
// File file = new File(files); // set your audio path
intent.setDataAndType(Uri.fromFile(file), type);
PendingIntent pIntent = PendingIntent.getActivity(context, 0, intent, 0);
Notification noti = new NotificationCompat.Builder(context)
.setContentTitle("Download completed")
.setContentText("Click her to view the file")
.setSmallIcon(R.drawable.ic_gme_logo_white)
.setContentIntent(pIntent).build();
noti.flags |= Notification.FLAG_AUTO_CANCEL;
NotificationManager notificationManager = (NotificationManager) context.getSystemService(NOTIFICATION_SERVICE);
notificationManager.notify(0, noti);
}
public static void showNotification(Context context,String filepath) {
File file = new File(filepath);
MimeTypeMap map = MimeTypeMap.getSingleton();
String ext = MimeTypeMap.getFileExtensionFromUrl(file.getName());
String type = map.getMimeTypeFromExtension(ext);
if (type == null)
type = "*/*";
Intent intent = new Intent(Intent.ACTION_VIEW);
// intent.setAction(android.content.Intent.ACTION_VIEW);
// File file = new File(files); // set your audio path
intent.setDataAndType(Uri.fromFile(file), type);
PendingIntent pIntent = PendingIntent.getActivity(context, 0, intent, 0);
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
NotificationHelper noti = new NotificationHelper(context);
Notification.Builder nb = noti.getNotification1("Download completed", "Click here to view the file",pIntent);
if (nb != null) {
noti.notify(0, nb);
}
}else {
Notification noti = new NotificationCompat.Builder(context)
.setContentTitle("Download completed")
.setContentText("Click her to view the file")
.setWhen(System.currentTimeMillis())
.setVibrate(new long[] { 1000, 1000, 1000, 1000, 1000 })
.setSound(RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION))
.setLights(Color.GREEN, 3000, 3000)
.setSmallIcon(R.drawable.ic_gme_logo_white)
.setContentIntent(pIntent).build();
noti.flags |= Notification.FLAG_AUTO_CANCEL;
noti.defaults |= Notification.DEFAULT_VIBRATE;
noti.defaults |= Notification.DEFAULT_SOUND;
NotificationManager notificationManager = (NotificationManager) context.getSystemService(NOTIFICATION_SERVICE);
notificationManager.notify(0, noti);
}
}
} }

2
app/src/main/res/layout/activity_gme_branches.xml

@ -32,7 +32,7 @@
android:background="@drawable/ic_rounded_stroke_darkgray"/> android:background="@drawable/ic_rounded_stroke_darkgray"/>
</LinearLayout> </LinearLayout>
<fastscroll.app.fastscrollalphabetindex.AlphabetIndexFastScrollRecyclerView
<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerView" android:id="@+id/recyclerView"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"

Loading…
Cancel
Save