Browse Source

Nav close on item click

master
preyearegmi 6 years ago
parent
commit
70005031f8
  1. BIN
      .idea/caches/build_file_checksums.ser
  2. 24
      app/build.gradle
  3. 10
      app/src/main/java/com/gmeremit/online/gmeremittance_native/homeV2/view/HomeActivityV2.java
  4. 65
      app/src/main/java/com/gmeremit/online/gmeremittance_native/static_pages/view/AboutGME.java
  5. 44
      app/src/main/java/com/gmeremit/online/gmeremittance_native/utils/Utils.java
  6. 1
      app/src/main/res/layout/activity_about_gme.xml

BIN
.idea/caches/build_file_checksums.ser

24
app/build.gradle

@ -16,11 +16,11 @@ repositories {
apply plugin: 'io.fabric'
android {
compileSdkVersion 27
compileSdkVersion 28
defaultConfig {
applicationId "com.gmeremit.online.gmeremittance_native"
minSdkVersion 15
targetSdkVersion 27
targetSdkVersion 28
versionCode 1
versionName "1.0.0"
multiDexEnabled true
@ -85,17 +85,17 @@ android {
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:support-vector-drawable:27.1.1'
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.android.support:support-vector-drawable:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.squareup.retrofit2:retrofit:2.4.0'
implementation 'com.squareup.retrofit2:converter-gson:2.4.0'
implementation 'com.github.yalantis:ucrop:2.2.2'
implementation 'com.google.firebase:firebase-core:11.8.0'
implementation 'com.google.firebase:firebase-messaging:11.8.0'
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.3'
implementation 'com.google.firebase:firebase-core:16.0.4'
implementation 'com.google.firebase:firebase-messaging:17.3.3'
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'
@ -118,8 +118,8 @@ dependencies {
implementation 'io.reactivex.rxjava2:rxandroid:2.0.1'
implementation 'io.reactivex.rxjava2:rxjava:2.1.0'
implementation 'org.greenrobot:eventbus:3.1.1'
implementation 'com.android.support:percent:27.1.1'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.theartofdev.edmodo:android-image-cropper:2.7.+'
implementation 'com.android.support:percent:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.theartofdev.edmodo:android-image-cropper:2.7.0'
}
apply plugin: 'com.google.gms.google-services'

10
app/src/main/java/com/gmeremit/online/gmeremittance_native/homeV2/view/HomeActivityV2.java

@ -156,26 +156,30 @@ public class HomeActivityV2 extends BaseActivity implements HomeParentViewContra
case R.id.iv_help:
CustomerSupportFragment newFragment = CustomerSupportFragment.newInstance();
newFragment.show(getSupportFragmentManager(), "dialog");
showDrawer(false);
break;
case R.id.iv_nav:
showDrawer(true);
break;
case R.id.btn_withdraw:
showDrawer(false);
startActivity(new Intent(this, WithDrawActivity.class));
break;
case R.id.view_about_gme:
showDrawer(false);
startActivity(new Intent(this, AboutGME.class));
break;
case R.id.view_support:
showDrawer(false);
startActivity(new Intent(this, SupportActivity.class));
break;
case R.id.view_setting:
showDrawer(false);
startActivity(new Intent(this, SettingsView.class));
// showDrawer(false);
break;
case R.id.view_logout:
showDrawer(false);
showLogoutConfirmationDialog();
// showDrawer(false);
break;
case R.id.iv_close:
showDrawer(false);
@ -189,6 +193,8 @@ public class HomeActivityV2 extends BaseActivity implements HomeParentViewContra
}
}
private void showLogoutConfirmationDialog() {
AlertDialog.Builder builder = new AlertDialog.Builder(this);

65
app/src/main/java/com/gmeremit/online/gmeremittance_native/static_pages/view/AboutGME.java

@ -1,8 +1,12 @@
package com.gmeremit.online.gmeremittance_native.static_pages.view;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.net.Uri;
import android.os.Bundle;
import android.support.annotation.Nullable;
@ -11,11 +15,14 @@ import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import com.gmeremit.online.gmeremittance_native.BuildConfig;
import com.gmeremit.online.gmeremittance_native.R;
import com.gmeremit.online.gmeremittance_native.static_pages.StaticPagesContract;
import com.gmeremit.online.gmeremittance_native.static_pages.presenter.StaticPagesPresenter;
import com.gmeremit.online.gmeremittance_native.utils.Utils;
import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
@ -53,17 +60,59 @@ public class AboutGME extends AppCompatActivity implements StaticPagesContract.I
private void init() {
ButterKnife.bind(this);
try {
PackageInfo pinfo = getPackageManager().getPackageInfo(getPackageName(), 0);
String version = String.valueOf(pinfo.versionName);
txt_app_version.setText(version);
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
}
String version = BuildConfig.VERSION_NAME;
String versionCode=" ("+BuildConfig.VERSION_CODE+")";
txt_app_version.setText(version+versionCode);
presenter = new StaticPagesPresenter(this);
}
public static void openAppRating(Context context) {
// you can also use BuildConfig.APPLICATION_ID
String appId = context.getPackageName();
Intent rateIntent = new Intent(Intent.ACTION_VIEW,
Uri.parse("market://details?id=" + appId));
boolean marketFound = false;
// find all applications able to handle our rateIntent
final List<ResolveInfo> otherApps = context.getPackageManager()
.queryIntentActivities(rateIntent, 0);
for (ResolveInfo otherApp: otherApps) {
// look for Google Play application
if (otherApp.activityInfo.applicationInfo.packageName
.equals("com.android.vending")) {
ActivityInfo otherAppActivity = otherApp.activityInfo;
ComponentName componentName = new ComponentName(
otherAppActivity.applicationInfo.packageName,
otherAppActivity.name
);
// make sure it does NOT open in the stack of your activity
rateIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
// task reparenting if needed
rateIntent.addFlags(Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
// if the Google Play was already open in a search result
// this make sure it still go to the app page you requested
rateIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
// this make sure only the Google Play app is allowed to
// intercept the intent
rateIntent.setComponent(componentName);
context.startActivity(rateIntent);
marketFound = true;
break;
}
}
// if GP not present on device, open web browser
if (!marketFound) {
Intent webIntent = new Intent(Intent.ACTION_VIEW,
Uri.parse("https://play.google.com/store/apps/details?id="+appId));
context.startActivity(webIntent);
}
}
@OnClick({R.id.iv_back, R.id.btn_check_update, R.id.iv_fb, R.id.iv_linkedin})
public void onClick(View view) {
@ -72,7 +121,7 @@ public class AboutGME extends AppCompatActivity implements StaticPagesContract.I
finish();
break;
case R.id.btn_check_update:
openAppRating(this);
break;
case R.id.iv_fb:
presenter.onLinkClicked(FACEBOOK);

44
app/src/main/java/com/gmeremit/online/gmeremittance_native/utils/Utils.java

@ -85,28 +85,28 @@ public class Utils {
return Settings.Secure.getString(context.getContentResolver(), Settings.Secure.ANDROID_ID);
}
@SuppressLint("RestrictedApi")
public static void disableShiftMode(BottomNavigationView view) {
BottomNavigationMenuView menuView = (BottomNavigationMenuView) view.getChildAt(0);
try {
Field shiftingMode = menuView.getClass().getDeclaredField("mShiftingMode");
shiftingMode.setAccessible(true);
shiftingMode.setBoolean(menuView, false);
shiftingMode.setAccessible(false);
for (int i = 0; i < menuView.getChildCount(); i++) {
BottomNavigationItemView item = (BottomNavigationItemView) menuView.getChildAt(i);
//noinspection RestrictedApi
item.setShiftingMode(false);
// set once again checked value, so view will be updated
//noinspection RestrictedApi
item.setChecked(item.getItemData().isChecked());
}
} catch (NoSuchFieldException e) {
Log.e("BNVHelper", "Unable to get shift mode field", e);
} catch (IllegalAccessException e) {
Log.e("BNVHelper", "Unable to change value of shift mode", e);
}
}
// @SuppressLint("RestrictedApi")
// public static void disableShiftMode(BottomNavigationView view) {
// BottomNavigationMenuView menuView = (BottomNavigationMenuView) view.getChildAt(0);
// try {
// Field shiftingMode = menuView.getClass().getDeclaredField("mShiftingMode");
// shiftingMode.setAccessible(true);
// shiftingMode.setBoolean(menuView, false);
// shiftingMode.setAccessible(false);
// for (int i = 0; i < menuView.getChildCount(); i++) {
// BottomNavigationItemView item = (BottomNavigationItemView) menuView.getChildAt(i);
// //noinspection RestrictedApi
// item.setShiftingMode(false);
// // set once again checked value, so view will be updated
// //noinspection RestrictedApi
// item.setChecked(item.getItemData().isChecked());
// }
// } catch (NoSuchFieldException e) {
// Log.e("BNVHelper", "Unable to get shift mode field", e);
// } catch (IllegalAccessException e) {
// Log.e("BNVHelper", "Unable to change value of shift mode", e);
// }
// }
/**
* TODO

1
app/src/main/res/layout/activity_about_gme.xml

@ -143,6 +143,7 @@
android:src="@drawable/ic_fb" />
<ImageView
android:visibility="gone"
android:id="@+id/iv_linkedin"
android:layout_width="24dp"
android:layout_height="24dp"

Loading…
Cancel
Save