Merge pull request #29 from m2049r/bugfix_fragment_v4

use v4 fragment support library to cater for android 5.1
This commit is contained in:
m2049r 2017-08-31 01:00:52 +02:00 committed by GitHub
commit 20dbaac4fa
9 changed files with 26 additions and 37 deletions

View File

@ -16,9 +16,9 @@
package com.m2049r.xmrwallet; package com.m2049r.xmrwallet;
import android.app.Fragment;
import android.content.Context; import android.content.Context;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.text.Editable; import android.text.Editable;
import android.text.InputType; import android.text.InputType;
import android.text.TextWatcher; import android.text.TextWatcher;

View File

@ -16,9 +16,9 @@
package com.m2049r.xmrwallet; package com.m2049r.xmrwallet;
import android.app.Fragment;
import android.content.Context; import android.content.Context;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;

View File

@ -17,9 +17,6 @@
package com.m2049r.xmrwallet; package com.m2049r.xmrwallet;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.app.Fragment;
import android.app.FragmentManager;
import android.app.FragmentTransaction;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
@ -27,6 +24,10 @@ import android.content.SharedPreferences;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.app.AppCompatActivity; import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar; import android.support.v7.widget.Toolbar;
import android.util.Log; import android.util.Log;
@ -281,7 +282,7 @@ public class LoginActivity extends AppCompatActivity
void startLoginFragment() { void startLoginFragment() {
Fragment fragment = new LoginFragment(); Fragment fragment = new LoginFragment();
getFragmentManager().beginTransaction() getSupportFragmentManager().beginTransaction()
.add(R.id.fragment_container, fragment).commit(); .add(R.id.fragment_container, fragment).commit();
Log.d(TAG, "LoginFragment added"); Log.d(TAG, "LoginFragment added");
} }
@ -300,7 +301,7 @@ public class LoginActivity extends AppCompatActivity
if (extras != null) { if (extras != null) {
newFragment.setArguments(extras); newFragment.setArguments(extras);
} }
FragmentTransaction transaction = getFragmentManager().beginTransaction(); FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
transaction.replace(R.id.fragment_container, newFragment); transaction.replace(R.id.fragment_container, newFragment);
transaction.addToBackStack(stackName); transaction.addToBackStack(stackName);
transaction.commit(); transaction.commit();
@ -317,7 +318,7 @@ public class LoginActivity extends AppCompatActivity
public void createWallet(final String name, final String password, final WalletCreator walletCreator) { public void createWallet(final String name, final String password, final WalletCreator walletCreator) {
final GenerateFragment genFragment = (GenerateFragment) final GenerateFragment genFragment = (GenerateFragment)
getFragmentManager().findFragmentById(R.id.fragment_container); getSupportFragmentManager().findFragmentById(R.id.fragment_container);
File newWalletFolder = new File(getStorageRoot(), ".new"); File newWalletFolder = new File(getStorageRoot(), ".new");
if (!newWalletFolder.exists()) { if (!newWalletFolder.exists()) {
if (!newWalletFolder.mkdir()) { if (!newWalletFolder.mkdir()) {

View File

@ -16,12 +16,12 @@
package com.m2049r.xmrwallet; package com.m2049r.xmrwallet;
import android.app.Fragment;
import android.content.Context; import android.content.Context;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.os.Bundle; import android.os.Bundle;
import android.os.StrictMode; import android.os.StrictMode;
import android.support.design.widget.FloatingActionButton; import android.support.design.widget.FloatingActionButton;
import android.support.v4.app.Fragment;
import android.util.Log; import android.util.Log;
import android.view.ContextMenu; import android.view.ContextMenu;
import android.view.KeyEvent; import android.view.KeyEvent;

View File

@ -16,10 +16,10 @@
package com.m2049r.xmrwallet; package com.m2049r.xmrwallet;
import android.app.Fragment;
import android.content.Context; import android.content.Context;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.support.v4.app.Fragment;
import android.util.Log; import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;

View File

@ -16,11 +16,11 @@
package com.m2049r.xmrwallet; package com.m2049r.xmrwallet;
import android.app.Fragment;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.support.v4.app.Fragment;
import android.support.v7.app.AlertDialog; import android.support.v7.app.AlertDialog;
import android.text.Editable; import android.text.Editable;
import android.text.InputType; import android.text.InputType;

View File

@ -16,28 +16,23 @@
package com.m2049r.xmrwallet; package com.m2049r.xmrwallet;
import android.app.Fragment;
import android.content.ClipData; import android.content.ClipData;
import android.content.ClipboardManager; import android.content.ClipboardManager;
import android.content.Context; import android.content.Context;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.text.InputType; import android.text.InputType;
import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.Button; import android.widget.Button;
import android.widget.ProgressBar;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import com.m2049r.xmrwallet.model.TransactionInfo; import com.m2049r.xmrwallet.model.TransactionInfo;
import com.m2049r.xmrwallet.model.Transfer; import com.m2049r.xmrwallet.model.Transfer;
import com.m2049r.xmrwallet.model.Wallet; import com.m2049r.xmrwallet.model.Wallet;
import com.m2049r.xmrwallet.model.WalletManager;
import com.m2049r.xmrwallet.service.MoneroHandlerThread;
import java.io.File;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Calendar; import java.util.Calendar;
import java.util.Date; import java.util.Date;

View File

@ -16,9 +16,6 @@
package com.m2049r.xmrwallet; package com.m2049r.xmrwallet;
import android.app.Fragment;
import android.app.FragmentManager;
import android.app.FragmentTransaction;
import android.content.ComponentName; import android.content.ComponentName;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
@ -28,6 +25,9 @@ import android.os.Bundle;
import android.os.IBinder; import android.os.IBinder;
import android.os.PowerManager; import android.os.PowerManager;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.app.AppCompatActivity; import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar; import android.support.v7.widget.Toolbar;
import android.util.Log; import android.util.Log;
@ -155,7 +155,7 @@ public class WalletActivity extends AppCompatActivity implements WalletFragment.
} }
Fragment walletFragment = new WalletFragment(); Fragment walletFragment = new WalletFragment();
getFragmentManager().beginTransaction() getSupportFragmentManager().beginTransaction()
.add(R.id.fragment_container, walletFragment).commit(); .add(R.id.fragment_container, walletFragment).commit();
Log.d(TAG, "fragment added"); Log.d(TAG, "fragment added");
@ -336,7 +336,7 @@ public class WalletActivity extends AppCompatActivity implements WalletFragment.
Log.d(TAG, "onRefreshed()"); Log.d(TAG, "onRefreshed()");
try { try {
final WalletFragment walletFragment = (WalletFragment) final WalletFragment walletFragment = (WalletFragment)
getFragmentManager().findFragmentById(R.id.fragment_container); getSupportFragmentManager().findFragmentById(R.id.fragment_container);
if (wallet.isSynchronized()) { if (wallet.isSynchronized()) {
Log.d(TAG, "onRefreshed() synced"); Log.d(TAG, "onRefreshed() synced");
releaseWakeLock(); // the idea is to stay awake until synced releaseWakeLock(); // the idea is to stay awake until synced
@ -401,7 +401,7 @@ public class WalletActivity extends AppCompatActivity implements WalletFragment.
public void onCreatedTransaction(final PendingTransaction pendingTransaction) { public void onCreatedTransaction(final PendingTransaction pendingTransaction) {
try { try {
final SendFragment sendFragment = (SendFragment) final SendFragment sendFragment = (SendFragment)
getFragmentManager().findFragmentById(R.id.fragment_container); getSupportFragmentManager().findFragmentById(R.id.fragment_container);
runOnUiThread(new Runnable() { runOnUiThread(new Runnable() {
public void run() { public void run() {
PendingTransaction.Status status = pendingTransaction.getStatus(); PendingTransaction.Status status = pendingTransaction.getStatus();
@ -440,7 +440,7 @@ public class WalletActivity extends AppCompatActivity implements WalletFragment.
public void onSetNotes(final boolean success) { public void onSetNotes(final boolean success) {
try { try {
final TxFragment txFragment = (TxFragment) final TxFragment txFragment = (TxFragment)
getFragmentManager().findFragmentById(R.id.fragment_container); getSupportFragmentManager().findFragmentById(R.id.fragment_container);
runOnUiThread(new Runnable() { runOnUiThread(new Runnable() {
public void run() { public void run() {
if (!success) { if (!success) {
@ -460,7 +460,7 @@ public class WalletActivity extends AppCompatActivity implements WalletFragment.
public void onProgress(final String text) { public void onProgress(final String text) {
try { try {
final WalletFragment walletFragment = (WalletFragment) final WalletFragment walletFragment = (WalletFragment)
getFragmentManager().findFragmentById(R.id.fragment_container); getSupportFragmentManager().findFragmentById(R.id.fragment_container);
runOnUiThread(new Runnable() { runOnUiThread(new Runnable() {
public void run() { public void run() {
walletFragment.onProgress(text); walletFragment.onProgress(text);
@ -477,7 +477,7 @@ public class WalletActivity extends AppCompatActivity implements WalletFragment.
public void onProgress(final int n) { public void onProgress(final int n) {
try { try {
final WalletFragment walletFragment = (WalletFragment) final WalletFragment walletFragment = (WalletFragment)
getFragmentManager().findFragmentById(R.id.fragment_container); getSupportFragmentManager().findFragmentById(R.id.fragment_container);
runOnUiThread(new Runnable() { runOnUiThread(new Runnable() {
public void run() { public void run() {
walletFragment.onProgress(n); walletFragment.onProgress(n);
@ -583,14 +583,14 @@ public class WalletActivity extends AppCompatActivity implements WalletFragment.
if (extras != null) { if (extras != null) {
newFragment.setArguments(extras); newFragment.setArguments(extras);
} }
FragmentTransaction transaction = getFragmentManager().beginTransaction(); FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
transaction.replace(R.id.fragment_container, newFragment); transaction.replace(R.id.fragment_container, newFragment);
transaction.addToBackStack(stackName); transaction.addToBackStack(stackName);
transaction.commit(); transaction.commit();
} }
private void onWalletDetails() { private void onWalletDetails() {
Fragment fragment = getFragmentManager().findFragmentById(R.id.fragment_container); Fragment fragment = getSupportFragmentManager().findFragmentById(R.id.fragment_container);
if (!(fragment instanceof GenerateReviewFragment)) { if (!(fragment instanceof GenerateReviewFragment)) {
Bundle extras = new Bundle(); Bundle extras = new Bundle();
extras.putString("type", GenerateReviewFragment.VIEW_WALLET); extras.putString("type", GenerateReviewFragment.VIEW_WALLET);
@ -605,7 +605,7 @@ public class WalletActivity extends AppCompatActivity implements WalletFragment.
private void startScanFragment() { private void startScanFragment() {
Fragment fragment = getFragmentManager().findFragmentById(R.id.fragment_container); Fragment fragment = getSupportFragmentManager().findFragmentById(R.id.fragment_container);
if (fragment instanceof SendFragment) { if (fragment instanceof SendFragment) {
Bundle extras = new Bundle(); Bundle extras = new Bundle();
replaceFragment(new ScannerFragment(), null, extras); replaceFragment(new ScannerFragment(), null, extras);

View File

@ -16,21 +16,16 @@
package com.m2049r.xmrwallet; package com.m2049r.xmrwallet;
import android.app.Fragment;
import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface;
import android.os.Bundle; import android.os.Bundle;
import android.support.constraint.ConstraintLayout; import android.support.constraint.ConstraintLayout;
import android.support.v7.app.AlertDialog; import android.support.v4.app.Fragment;
import android.support.v7.widget.DividerItemDecoration; import android.support.v7.widget.DividerItemDecoration;
import android.support.v7.widget.RecyclerView; import android.support.v7.widget.RecyclerView;
import android.util.Log; import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.animation.Interpolator;
import android.widget.Button; import android.widget.Button;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.ProgressBar; import android.widget.ProgressBar;
@ -38,9 +33,7 @@ import android.widget.TextView;
import com.m2049r.xmrwallet.layout.TransactionInfoAdapter; import com.m2049r.xmrwallet.layout.TransactionInfoAdapter;
import com.m2049r.xmrwallet.model.TransactionInfo; import com.m2049r.xmrwallet.model.TransactionInfo;
import com.m2049r.xmrwallet.model.Transfer;
import com.m2049r.xmrwallet.model.Wallet; import com.m2049r.xmrwallet.model.Wallet;
import com.m2049r.xmrwallet.model.WalletManager;
import java.text.NumberFormat; import java.text.NumberFormat;
import java.util.List; import java.util.List;