diff --git a/.idea/assetWizardSettings.xml b/.idea/assetWizardSettings.xml
new file mode 100644
index 0000000..ae12ad6
--- /dev/null
+++ b/.idea/assetWizardSettings.xml
@@ -0,0 +1,46 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/caches/build_file_checksums.ser b/.idea/caches/build_file_checksums.ser
index af2e6fc..ba15be3 100644
Binary files a/.idea/caches/build_file_checksums.ser and b/.idea/caches/build_file_checksums.ser differ
diff --git a/app/build.gradle b/app/build.gradle
index 5bd87b3..4c54bf0 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -9,6 +9,7 @@ android {
versionCode 6
versionName "0.0.6"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
+ vectorDrawables.useSupportLibrary = true
}
dataBinding {
@@ -54,6 +55,7 @@ dependencies {
implementation 'com.jmedeisis:draglinearlayout:1.1.0'
implementation 'com.applandeo:material-file-picker:1.0.0'
implementation 'com.daasuu:EasingInterpolator:1.0.0'
+ implementation 'com.android.support:support-vector-drawable:27.1.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index db8bb8b..6ad679a 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -2,8 +2,9 @@
-
+
@@ -17,11 +18,11 @@
android:supportsRtl="true"
android:theme="@style/AppTheme">
+ android:theme="@style/AppTheme.NoActionBar">
@@ -29,30 +30,30 @@
+ android:value="com.herbron.moodl.Activities.HomeActivity" />
+ android:value="com.herbron.moodl.Activities.HomeActivity" />
+ android:value="com.herbron.moodl.Activities.HomeActivity" />
diff --git a/app/src/main/java/com/herbron/moodl/Activities/HomeActivity.java b/app/src/main/java/com/herbron/moodl/Activities/HomeActivity.java
index 06a2b85..4375d55 100644
--- a/app/src/main/java/com/herbron/moodl/Activities/HomeActivity.java
+++ b/app/src/main/java/com/herbron/moodl/Activities/HomeActivity.java
@@ -3,6 +3,7 @@ package com.herbron.moodl.Activities;
import android.content.Intent;
import android.graphics.Bitmap;
import android.os.Bundle;
+import android.preference.PreferenceActivity;
import android.preference.PreferenceManager;
import android.support.annotation.NonNull;
import android.support.design.widget.NavigationView;
@@ -98,6 +99,8 @@ public class HomeActivity extends AppCompatActivity implements BalanceUpdateInte
break;
case R.id.navigation_settings:
Intent settingIntent = new Intent(getApplicationContext(), SettingsActivity.class);
+ settingIntent.putExtra(PreferenceActivity.EXTRA_SHOW_FRAGMENT, SettingsActivity.MainPreferenceFragment.class.getName() );
+ settingIntent.putExtra(PreferenceActivity.EXTRA_NO_HEADERS, true );
startActivity(settingIntent);
item.setChecked(false);
break;
diff --git a/app/src/main/java/com/herbron/moodl/Activities/HomeActivityFragments/Overview.java b/app/src/main/java/com/herbron/moodl/Activities/HomeActivityFragments/Overview.java
index 12c7f0e..4216e4e 100644
--- a/app/src/main/java/com/herbron/moodl/Activities/HomeActivityFragments/Overview.java
+++ b/app/src/main/java/com/herbron/moodl/Activities/HomeActivityFragments/Overview.java
@@ -2,6 +2,8 @@ package com.herbron.moodl.Activities.HomeActivityFragments;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
+import android.graphics.Canvas;
+import android.graphics.drawable.Drawable;
import android.os.AsyncTask;
import android.support.v4.app.Fragment;
import android.os.Bundle;
@@ -27,6 +29,8 @@ import com.herbron.moodl.R;
import java.util.List;
+import static com.herbron.moodl.MoodlBox.getDrawable;
+
/**
* Created by Administrator on 27/05/2018.
*/
@@ -185,7 +189,14 @@ public class Overview extends Fragment {
}
else
{
- Bitmap icon = BitmapFactory.decodeResource(getResources(), R.mipmap.ic_launcher_moodl);
+ Drawable drawable = getDrawable(R.drawable.ic_panorama_fish_eye_24dp, getContext());
+
+ Bitmap icon = Bitmap.createBitmap(drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight(), Bitmap.Config.ARGB_8888);
+
+ Canvas canvas = new Canvas(icon);
+ drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
+ drawable.draw(canvas);
+
icon = Bitmap.createScaledBitmap(icon, 50, 50, false);
currency.setIcon(icon);
diff --git a/app/src/main/java/com/herbron/moodl/Activities/HomeActivityFragments/Summary.java b/app/src/main/java/com/herbron/moodl/Activities/HomeActivityFragments/Summary.java
index 19aa676..d896b39 100644
--- a/app/src/main/java/com/herbron/moodl/Activities/HomeActivityFragments/Summary.java
+++ b/app/src/main/java/com/herbron/moodl/Activities/HomeActivityFragments/Summary.java
@@ -9,6 +9,8 @@ import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
+import android.graphics.drawable.BitmapDrawable;
+import android.graphics.drawable.Drawable;
import android.os.AsyncTask;
import android.os.Handler;
import android.os.Looper;
@@ -56,6 +58,7 @@ import java.util.List;
import java.util.Random;
import static com.herbron.moodl.MoodlBox.getColor;
+import static com.herbron.moodl.MoodlBox.getDrawable;
import static com.herbron.moodl.MoodlBox.numberConformer;
import static java.lang.Math.abs;
@@ -264,7 +267,7 @@ public class Summary extends Fragment implements BalanceSwitchManagerInterface,
while(cachedIcon == null || cachedIcon.isDirectory())
{
- cachedIcon = cacheFiles[random.nextInt(cacheFiles.length) + 1];
+ cachedIcon = cacheFiles[random.nextInt(cacheFiles.length)];
}
Bitmap icon = BitmapFactory.decodeFile(cachedIcon.getAbsolutePath());
@@ -766,7 +769,14 @@ public class Summary extends Fragment implements BalanceSwitchManagerInterface,
}
else
{
- Bitmap icon = BitmapFactory.decodeResource(getResources(), R.mipmap.ic_launcher_moodl);
+ Drawable drawable = getDrawable(R.drawable.ic_panorama_fish_eye_24dp, getContext());
+
+ Bitmap icon = Bitmap.createBitmap(drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight(), Bitmap.Config.ARGB_8888);
+
+ Canvas canvas = new Canvas(icon);
+ drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
+ drawable.draw(canvas);
+
icon = Bitmap.createScaledBitmap(icon, 50, 50, false);
localCurrency.setIcon(icon);
diff --git a/app/src/main/java/com/herbron/moodl/Activities/SettingsActivity.java b/app/src/main/java/com/herbron/moodl/Activities/SettingsActivity.java
index c3a342d..415b106 100644
--- a/app/src/main/java/com/herbron/moodl/Activities/SettingsActivity.java
+++ b/app/src/main/java/com/herbron/moodl/Activities/SettingsActivity.java
@@ -6,6 +6,7 @@ import android.app.AlertDialog;
import android.app.KeyguardManager;
import android.content.Context;
import android.content.DialogInterface;
+import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.content.res.Configuration;
@@ -159,223 +160,6 @@ public class SettingsActivity extends AppCompatPreferenceActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setupActionBar();
- addPreferencesFromResource(R.xml.pref_main);
-
- findPreference("version").setSummary(BuildConfig.VERSION_NAME);
-
- bindPreferenceSummaryToValue(findPreference("default_currency"));
- bindPreferenceSummaryToValue(findPreference("minimum_value_displayed"));
-
- findPreference("export").setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
- @Override
- public boolean onPreferenceClick(Preference preference) {
-
- Context context = SettingsActivity.this;
- AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(context);
- View dialogView = LayoutInflater.from(context).inflate(R.layout.dialog_export_data, null, true);
- dialogBuilder.setView(dialogView);
-
- File backupDirectory = new File(Environment.getExternalStorageDirectory(), getString(R.string.app_name));
-
- if (!backupDirectory.exists()) {
- if (!backupDirectory.mkdirs()) {
- Log.d("moodl", "Error while creating directory");
- }
- }
-
- final TextView textViewFilePath = dialogView.findViewById(R.id.textViewFilePath);
- textViewFilePath.setText(backupDirectory.getAbsolutePath());
- textViewFilePath.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View view) {
- new FilePicker.Builder(SettingsActivity.this, new OnSelectFileListener() {
- @Override
- public void onSelect(File file) {
- textViewFilePath.setText(file.getAbsolutePath());
- }
- }).fileType(".moodl")
- .hideFiles(true)
- .directory(backupDirectory.getAbsolutePath())
- .mainDirectory(Environment.getExternalStorageDirectory().getAbsolutePath())
- .show();
- }
- });
-
- final CheckBox enterPasswordCheckbox = dialogView.findViewById(R.id.checkboxEnterPassword);
- final TextInputLayout textInputLayoutPassword = dialogView.findViewById(R.id.textInputLayoutPassword);
-
- enterPasswordCheckbox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
- @Override
- public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
- if(b && textInputLayoutPassword.getVisibility() == View.GONE)
- {
- MoodlBox.expandH(textInputLayoutPassword);
- }
-
- if(!b && textInputLayoutPassword.getVisibility() == View.VISIBLE)
- {
- MoodlBox.collapseH(textInputLayoutPassword);
- }
- }
- });
-
- dialogBuilder.setTitle("Create backup");
- dialogBuilder.setPositiveButton("Confirm", new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int whichButton) {
-
- checkPermissions();
- SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd_HH-mm-ss", Locale.getDefault());
- Date currentDate = new Date();
- String fileName = getString(R.string.app_name) + "_" + formatter.format(currentDate) + ".backup";
- DatabaseManager databaseManager = new DatabaseManager(SettingsActivity.this);
-
- File backupFile = new File(textViewFilePath.getText() + "/" + fileName);
-
- try (PrintWriter printWriter = new PrintWriter(new FileWriter(backupFile, true))) {
-
- if(enterPasswordCheckbox.isChecked())
- {
- DataCrypter.updateKey(textInputLayoutPassword.getEditText().getText().toString());
- printWriter.write(DataCrypter.encrypt(SettingsActivity.this, databaseManager.getBackupData()));
- }
- else
- {
- printWriter.write(databaseManager.getBackupData());
- }
-
- printWriter.close();
- } catch (IOException e) {
- Log.d("moodl", "Error > " + e);
- }
-
- dialog.dismiss();
- }
- });
- dialogBuilder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int whichButton) {
- dialog.dismiss();
- }
- });
-
- AlertDialog alertDialog = dialogBuilder.create();
- alertDialog.show();
-
- return false;
- }
- });
-
- findPreference("import").setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
- @Override
- public boolean onPreferenceClick(Preference preference) {
-
- Context context = SettingsActivity.this;
- AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(context);
- View dialogView = LayoutInflater.from(context).inflate(R.layout.dialog_import_data, null, true);
- dialogBuilder.setView(dialogView);
-
- File backupDirectory = new File(Environment.getExternalStorageDirectory(), getString(R.string.app_name));
-
- if(!backupDirectory.exists())
- {
- if(!backupDirectory.mkdirs())
- {
- Log.d("moodl", "Error while creating directory");
- }
- }
-
- final TextView textViewFilePath = dialogView.findViewById(R.id.textViewFilePath);
- textViewFilePath.setText(backupDirectory.getAbsolutePath());
- textViewFilePath.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View view) {
- new FilePicker.Builder(SettingsActivity.this, new OnSelectFileListener() {
- @Override
- public void onSelect(File file) {
- textViewFilePath.setText(file.getAbsolutePath());
- }
- }).hideFiles(false)
- .directory(backupDirectory.getAbsolutePath())
- .mainDirectory(Environment.getExternalStorageDirectory().getAbsolutePath())
- .show();
- }
- });
-
- dialogBuilder.setTitle("Restore backup");
- dialogBuilder.setPositiveButton("Confirm", new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialogInterface, int whichButton) {
-
- checkPermissions();
-
- DatabaseManager databaseManager = new DatabaseManager(context);
-
- File backupFile = new File(textViewFilePath.getText().toString());
-
- try {
- FileReader fileReader = new FileReader(backupFile);
- BufferedReader bufferedReader = new BufferedReader(fileReader);
-
- String str;
- String completeFile = "";
-
- while ((str = bufferedReader.readLine()) != null) {
- completeFile += str;
- }
-
- String[] results = completeFile.split(Pattern.quote("]"));
-
- for(int i = 0; i < results.length; i++)
- {
- String[] columnValues = results[i].split(Pattern.quote(";@"));
-
- databaseManager.addRowTransaction(columnValues);
- }
-
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- });
-
- dialogBuilder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialogInterface, int i) {
- dialogInterface.dismiss();
- }
- });
-
- AlertDialog alertDialog = dialogBuilder.create();
- alertDialog.show();
-
- return false;
- }
- });
-
- EditTextPreference editTextPreference = (EditTextPreference) findPreference("minimum_value_displayed");
- editTextPreference.setPositiveButtonText("Save");
- editTextPreference.setNegativeButtonText("Cancel");
- }
-
- private boolean checkPermissions() {
-
- String[] permissions = new String[]{
- Manifest.permission.READ_EXTERNAL_STORAGE,
- Manifest.permission.WRITE_EXTERNAL_STORAGE,
- };
-
- int result;
- List listPermissionsNeeded = new ArrayList<>();
- for (String p : permissions) {
- result = ContextCompat.checkSelfPermission(this, p);
- if (result != PackageManager.PERMISSION_GRANTED) {
- listPermissionsNeeded.add(p);
- }
- }
- if (!listPermissionsNeeded.isEmpty()) {
- ActivityCompat.requestPermissions(this, listPermissionsNeeded.toArray(new String[listPermissionsNeeded.size()]), 100);
- return false;
- }
- return true;
}
/**
@@ -412,7 +196,8 @@ public class SettingsActivity extends AppCompatPreferenceActivity {
*/
protected boolean isValidFragment(String fragmentName) {
return PreferenceFragment.class.getName().equals(fragmentName)
- || ExchangePreferenceFragment.class.getName().equals(fragmentName);
+ || ExchangePreferenceFragment.class.getName().equals(fragmentName)
+ || MainPreferenceFragment.class.getName().equals(fragmentName);
}
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@@ -439,6 +224,14 @@ public class SettingsActivity extends AppCompatPreferenceActivity {
bindPreferenceSummaryToValue(findPreference("hitbtc_privatekey"));
bindPreferenceSummaryToValue(findPreference("binance_privatekey"));
+ findPreference("enable_fingerprint").setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
+ @Override
+ public boolean onPreferenceChange(Preference preference, Object o) {
+
+ return false;
+ }
+ });
+
findPreference("enable_hitbtc").setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
@@ -600,4 +393,243 @@ public class SettingsActivity extends AppCompatPreferenceActivity {
}
}
}
+
+ @TargetApi(Build.VERSION_CODES.HONEYCOMB)
+ public static class MainPreferenceFragment extends PreferenceFragment {
+
+ @Override
+ public void onCreate(Bundle savedInstanceState)
+ {
+ super.onCreate(savedInstanceState);
+ addPreferencesFromResource(R.xml.pref_main);
+
+ findPreference("version").setSummary(BuildConfig.VERSION_NAME);
+
+ bindPreferenceSummaryToValue(findPreference("default_currency"));
+ bindPreferenceSummaryToValue(findPreference("minimum_value_displayed"));
+
+ findPreference("export").setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
+ @Override
+ public boolean onPreferenceClick(Preference preference) {
+
+ Context context = getContext();
+ AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(context);
+ View dialogView = LayoutInflater.from(context).inflate(R.layout.dialog_export_data, null, true);
+ dialogBuilder.setView(dialogView);
+
+ File backupDirectory = new File(Environment.getExternalStorageDirectory(), getString(R.string.app_name));
+
+ if (!backupDirectory.exists()) {
+ if (!backupDirectory.mkdirs()) {
+ Log.d("moodl", "Error while creating directory");
+ }
+ }
+
+ final TextView textViewFilePath = dialogView.findViewById(R.id.textViewFilePath);
+ textViewFilePath.setText(backupDirectory.getAbsolutePath());
+ textViewFilePath.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ new FilePicker.Builder(getActivity(), new OnSelectFileListener() {
+ @Override
+ public void onSelect(File file) {
+ textViewFilePath.setText(file.getAbsolutePath());
+ }
+ }).fileType(".moodl")
+ .hideFiles(true)
+ .directory(backupDirectory.getAbsolutePath())
+ .mainDirectory(Environment.getExternalStorageDirectory().getAbsolutePath())
+ .show();
+ }
+ });
+
+ final CheckBox enterPasswordCheckbox = dialogView.findViewById(R.id.checkboxEnterPassword);
+ final TextInputLayout textInputLayoutPassword = dialogView.findViewById(R.id.textInputLayoutPassword);
+
+ enterPasswordCheckbox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
+ @Override
+ public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
+ if(b && textInputLayoutPassword.getVisibility() == View.GONE)
+ {
+ MoodlBox.expandH(textInputLayoutPassword);
+ }
+
+ if(!b && textInputLayoutPassword.getVisibility() == View.VISIBLE)
+ {
+ MoodlBox.collapseH(textInputLayoutPassword);
+ }
+ }
+ });
+
+ dialogBuilder.setTitle("Create backup");
+ dialogBuilder.setPositiveButton("Confirm", new DialogInterface.OnClickListener() {
+ public void onClick(DialogInterface dialog, int whichButton) {
+
+ checkPermissions();
+ SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd_HH-mm-ss", Locale.getDefault());
+ Date currentDate = new Date();
+ String fileName = getString(R.string.app_name) + "_" + formatter.format(currentDate) + ".backup";
+ DatabaseManager databaseManager = new DatabaseManager(getContext());
+
+ File backupFile = new File(textViewFilePath.getText() + "/" + fileName);
+
+ try (PrintWriter printWriter = new PrintWriter(new FileWriter(backupFile, true))) {
+
+ if(enterPasswordCheckbox.isChecked())
+ {
+ DataCrypter.updateKey(textInputLayoutPassword.getEditText().getText().toString());
+ printWriter.write(DataCrypter.encrypt(getActivity(), databaseManager.getBackupData()));
+ }
+ else
+ {
+ printWriter.write(databaseManager.getBackupData());
+ }
+
+ printWriter.close();
+ } catch (IOException e) {
+ Log.d("moodl", "Error > " + e);
+ }
+
+ dialog.dismiss();
+ }
+ });
+ dialogBuilder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
+ public void onClick(DialogInterface dialog, int whichButton) {
+ dialog.dismiss();
+ }
+ });
+
+ AlertDialog alertDialog = dialogBuilder.create();
+ alertDialog.show();
+
+ return false;
+ }
+ });
+
+ findPreference("import").setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
+ @Override
+ public boolean onPreferenceClick(Preference preference) {
+
+ Context context = getContext();
+ AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(context);
+ View dialogView = LayoutInflater.from(context).inflate(R.layout.dialog_import_data, null, true);
+ dialogBuilder.setView(dialogView);
+
+ File backupDirectory = new File(Environment.getExternalStorageDirectory(), getString(R.string.app_name));
+
+ if(!backupDirectory.exists())
+ {
+ if(!backupDirectory.mkdirs())
+ {
+ Log.d("moodl", "Error while creating directory");
+ }
+ }
+
+ final TextView textViewFilePath = dialogView.findViewById(R.id.textViewFilePath);
+ textViewFilePath.setText(backupDirectory.getAbsolutePath());
+ textViewFilePath.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ new FilePicker.Builder(getActivity(), new OnSelectFileListener() {
+ @Override
+ public void onSelect(File file) {
+ textViewFilePath.setText(file.getAbsolutePath());
+ }
+ }).hideFiles(false)
+ .directory(backupDirectory.getAbsolutePath())
+ .mainDirectory(Environment.getExternalStorageDirectory().getAbsolutePath())
+ .show();
+ }
+ });
+
+ dialogBuilder.setTitle("Restore backup");
+ dialogBuilder.setPositiveButton("Confirm", new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialogInterface, int whichButton) {
+
+ checkPermissions();
+
+ DatabaseManager databaseManager = new DatabaseManager(context);
+
+ File backupFile = new File(textViewFilePath.getText().toString());
+
+ try {
+ FileReader fileReader = new FileReader(backupFile);
+ BufferedReader bufferedReader = new BufferedReader(fileReader);
+
+ String str;
+ String completeFile = "";
+
+ while ((str = bufferedReader.readLine()) != null) {
+ completeFile += str;
+ }
+
+ String[] results = completeFile.split(Pattern.quote("]"));
+
+ for(int i = 0; i < results.length; i++)
+ {
+ String[] columnValues = results[i].split(Pattern.quote(";@"));
+
+ databaseManager.addRowTransaction(columnValues);
+ }
+
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ });
+
+ dialogBuilder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialogInterface, int i) {
+ dialogInterface.dismiss();
+ }
+ });
+
+ AlertDialog alertDialog = dialogBuilder.create();
+ alertDialog.show();
+
+ return false;
+ }
+ });
+
+ EditTextPreference editTextPreference = (EditTextPreference) findPreference("minimum_value_displayed");
+ editTextPreference.setPositiveButtonText("Save");
+ editTextPreference.setNegativeButtonText("Cancel");
+ }
+
+ private boolean checkPermissions() {
+
+ String[] permissions = new String[]{
+ Manifest.permission.READ_EXTERNAL_STORAGE,
+ Manifest.permission.WRITE_EXTERNAL_STORAGE,
+ };
+
+ int result;
+ List listPermissionsNeeded = new ArrayList<>();
+ for (String p : permissions) {
+ result = ContextCompat.checkSelfPermission(getContext(), p);
+ if (result != PackageManager.PERMISSION_GRANTED) {
+ listPermissionsNeeded.add(p);
+ }
+ }
+ if (!listPermissionsNeeded.isEmpty()) {
+ ActivityCompat.requestPermissions(getActivity(), listPermissionsNeeded.toArray(new String[listPermissionsNeeded.size()]), 100);
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ int id = item.getItemId();
+ if (id == android.R.id.home) {
+ //startActivity(new Intent(getActivity(), SettingsActivity.class));
+ return true;
+ }
+ return super.onOptionsItemSelected(item);
+ }
+ }
+
+
}
diff --git a/app/src/main/java/com/herbron/moodl/FingerprintToolkit/FingerprintDialogFragment.java b/app/src/main/java/com/herbron/moodl/FingerprintToolkit/FingerprintDialogFragment.java
index da39017..a36f7ec 100644
--- a/app/src/main/java/com/herbron/moodl/FingerprintToolkit/FingerprintDialogFragment.java
+++ b/app/src/main/java/com/herbron/moodl/FingerprintToolkit/FingerprintDialogFragment.java
@@ -35,7 +35,8 @@ public class FingerprintDialogFragment extends DialogFragment{
@Override
public void onClick(View view) {
dismiss();
- getActivity().finish();
+ getActivity().getFragmentManager().popBackStack();
+ //getActivity().finish();
}
});
diff --git a/app/src/main/java/com/herbron/moodl/HomeActivityPagerAdapter.java b/app/src/main/java/com/herbron/moodl/HomeActivityPagerAdapter.java
deleted file mode 100644
index 369949e..0000000
--- a/app/src/main/java/com/herbron/moodl/HomeActivityPagerAdapter.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package com.herbron.moodl;
-
-import android.support.v4.app.Fragment;
-import android.support.v4.app.FragmentManager;
-import android.support.v4.app.FragmentStatePagerAdapter;
-
-import com.herbron.moodl.Activities.HomeActivityFragments.MarketCapitalization;
-import com.herbron.moodl.Activities.HomeActivityFragments.Summary;
-import com.herbron.moodl.Activities.HomeActivityFragments.Watchlist;
-
-/**
- * Created by Tiji on 13/04/2018.
- */
-
-public class HomeActivityPagerAdapter extends FragmentStatePagerAdapter {
-
- private int numOfTabs;
-
- public HomeActivityPagerAdapter(FragmentManager fm, int numOfTabs)
- {
- super(fm);
- this.numOfTabs = numOfTabs;
- }
-
- @Override
- public Fragment getItem(int position) {
- switch (position)
- {
- case 0:
- return new Watchlist();
- case 1:
- return new Summary();
- case 2:
- return new MarketCapitalization();
- default:
- return null;
- }
- }
-
- @Override
- public int getCount() {
- return numOfTabs;
- }
-}
\ No newline at end of file
diff --git a/app/src/main/res/drawable/ic_panorama_fish_eye_24dp.xml b/app/src/main/res/drawable/ic_panorama_fish_eye_24dp.xml
new file mode 100644
index 0000000..9276b2a
--- /dev/null
+++ b/app/src/main/res/drawable/ic_panorama_fish_eye_24dp.xml
@@ -0,0 +1,9 @@
+
+
+
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 5f024da..74f8cf3 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -207,5 +207,73 @@
Restore API keys
Enter password
Password
+ Settings
+
+ Enable social recommendations
+ Recommendations for people to contact
+ based on your message history
+
+
+ Display name
+ John Smith
+
+ Add friends to messages
+
+ - Always
+ - When possible
+ - Never
+
+
+ - 1
+ - 0
+ - -1
+
+
+
+ Data & sync
+
+ Sync frequency
+
+ - 15 minutes
+ - 30 minutes
+ - 1 hour
+ - 3 hours
+ - 6 hours
+ - Never
+
+
+ - 15
+ - 30
+ - 60
+ - 180
+ - 360
+ - -1
+
+
+
+ - Entry 1
+ - Entry 2
+ - Entry 3
+
+
+
+ - 1
+ - 2
+ - 3
+
+
+
+
+ System sync settings
+
+
+ Notifications
+
+ New message notifications
+
+ Ringtone
+ Silent
+
+ Vibrate
diff --git a/app/src/main/res/xml/pref_main.xml b/app/src/main/res/xml/pref_main.xml
index 75adcd9..bd9495e 100644
--- a/app/src/main/res/xml/pref_main.xml
+++ b/app/src/main/res/xml/pref_main.xml
@@ -41,7 +41,7 @@
+ android:key="exchange"/>