diff --git a/app/build.gradle b/app/build.gradle index 4a5447f..e9899c5 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -11,7 +11,7 @@ android { minSdkVersion 16 targetSdkVersion 34 versionCode 2 - versionName "1.1" + versionName "2" testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner' multiDexEnabled = true vectorDrawables.useSupportLibrary = true @@ -58,7 +58,10 @@ dependencies { implementation files('libs/poi-3.12-android-a.jar') implementation files('libs/poi-ooxml-schemas-3.12-20150511-a.jar') implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" + implementation 'com.google.android.material:material:1.9.0' + implementation 'com.github.daniel-stoneuk:material-about-library:3.1.2' } repositories { mavenCentral() + maven { url 'https://jitpack.io' } } diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index b290ec8..444bbcc 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -12,31 +12,38 @@ android:label="@string/app_name" android:supportsRtl="true" android:theme="@style/AppTheme"> - + + android:exported="true" + android:windowSoftInputMode="adjustPan"> + - - - - - - - - - + android:name=".CompareActivity" + android:exported="true" /> + + + + - \ No newline at end of file + diff --git a/app/src/main/java/org/phenoapps/verify/AboutActivity.java b/app/src/main/java/org/phenoapps/verify/AboutActivity.java new file mode 100644 index 0000000..6f05bba --- /dev/null +++ b/app/src/main/java/org/phenoapps/verify/AboutActivity.java @@ -0,0 +1,83 @@ +package org.phenoapps.verify; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.appcompat.app.AppCompatActivity; +import androidx.swiperefreshlayout.widget.CircularProgressDrawable; + +import android.content.Context; +import android.net.Uri; +import android.os.Bundle; + +import com.danielstone.materialaboutlibrary.ConvenienceBuilder; +import com.danielstone.materialaboutlibrary.MaterialAboutActivity; +import com.danielstone.materialaboutlibrary.items.MaterialAboutActionItem; +import com.danielstone.materialaboutlibrary.items.MaterialAboutTitleItem; +import com.danielstone.materialaboutlibrary.model.MaterialAboutCard; +import com.danielstone.materialaboutlibrary.model.MaterialAboutList; + +public class AboutActivity extends MaterialAboutActivity { + + + private CircularProgressDrawable progress; + private MaterialAboutActionItem updateCheckItem; + + + + + @NonNull + @Override + protected MaterialAboutList getMaterialAboutList(@NonNull Context context) { + + MaterialAboutCard.Builder appCardBuilder = new MaterialAboutCard.Builder(); + + appCardBuilder.addItem(new MaterialAboutTitleItem.Builder().text("CheckList").icon(R.mipmap.ic_launcher).build()); + + appCardBuilder.addItem(ConvenienceBuilder.createVersionActionItem(this, + getResources().getDrawable(R.drawable.ic_about), + "Version", + false)); + + MaterialAboutCard.Builder authorCardBuilder = new MaterialAboutCard.Builder(); + authorCardBuilder.title("Developers"); + + authorCardBuilder.addItem(new MaterialAboutActionItem.Builder() + .text(getString(R.string.dev_chaney)) + .subText("\t\t"+getString(R.string.ksu)) + .icon(R.drawable.ic_person_profile) + .build()); + authorCardBuilder.addItem(new MaterialAboutActionItem.Builder() + .text(getString(R.string.dev_trevor)) + .subText("\t\t"+getString(R.string.ksu)+"\n\t\t"+getString(R.string.dev_trevor_email)) + .icon(R.drawable.ic_person_profile) + .build()); + authorCardBuilder.addItem(new MaterialAboutActionItem.Builder() + .text(getString(R.string.dev_jesse)) + .subText("\t\t"+getString(R.string.ksu)+"\n\t\t"+getString(R.string.dev_jesse_email)+ + "\n\t\t"+"http://wheatgenetics.org") + .icon(R.drawable.ic_person_profile) + .build()); + + MaterialAboutCard.Builder descriptionCard = new MaterialAboutCard.Builder(); + descriptionCard.title("Description"); + descriptionCard.addItem(new MaterialAboutActionItem.Builder() + .text("Verify is an Android application that imports a list of entries, scans barcodes, and " + + "identifies whether it exists in the list of entries along with audio/visual notifications.").build()); + + return new MaterialAboutList(appCardBuilder.build(),authorCardBuilder.build(), descriptionCard.build()); + } + + @Nullable + @Override + protected CharSequence getActivityTitle() { + return "About"; + } + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + progress = new CircularProgressDrawable(this); + progress.setStyle(CircularProgressDrawable.DEFAULT); + progress.start(); + } +} \ No newline at end of file diff --git a/app/src/main/java/org/phenoapps/verify/MainActivity.java b/app/src/main/java/org/phenoapps/verify/MainActivity.java index c9d424b..f98a6e9 100644 --- a/app/src/main/java/org/phenoapps/verify/MainActivity.java +++ b/app/src/main/java/org/phenoapps/verify/MainActivity.java @@ -19,6 +19,9 @@ import androidx.annotation.NonNull; import com.google.android.material.navigation.NavigationView; + +import androidx.appcompat.widget.ActionMenuView; +import androidx.appcompat.widget.Toolbar; import androidx.core.app.ActivityCompat; import androidx.core.view.GravityCompat; import androidx.drawerlayout.widget.DrawerLayout; @@ -34,6 +37,7 @@ import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; +import android.view.ViewGroup; import android.view.inputmethod.InputMethodManager; import android.widget.AbsListView; import android.widget.AdapterView; @@ -72,9 +76,6 @@ public class MainActivity extends AppCompatActivity { private SparseArray mIds; - //Verify UI variables - private ActionBarDrawerToggle mDrawerToggle; - //global variable to track matching order private int mMatchingOrder; @@ -86,6 +87,8 @@ public class MainActivity extends AppCompatActivity { private String mFileName = ""; + private Toolbar navigationToolBar; + @Override protected void onCreate(Bundle savedInstanceState) { @@ -97,29 +100,29 @@ protected void onCreate(Bundle savedInstanceState) { SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this); - final View auxInfo = findViewById(R.id.auxScrollView); - final View auxValue = findViewById(R.id.auxValueView); +final View auxInfo = findViewById(R.id.auxScrollView); +final View auxValue = findViewById(R.id.auxValueView); if (sharedPref.getBoolean(SettingsActivity.AUX_INFO, false)) { - auxInfo.setVisibility(View.VISIBLE); - auxValue.setVisibility(View.VISIBLE); +auxInfo.setVisibility(View.VISIBLE); +auxValue.setVisibility(View.VISIBLE); } else { - auxInfo.setVisibility(View.GONE); - auxValue.setVisibility(View.GONE); - } +auxInfo.setVisibility(View.GONE); +auxValue.setVisibility(View.GONE); +} mPrefListener = new SharedPreferences.OnSharedPreferenceChangeListener() { @Override public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String s) { - if (sharedPreferences.getBoolean(SettingsActivity.AUX_INFO, false)) { - auxInfo.setVisibility(View.VISIBLE); - auxValue.setVisibility(View.VISIBLE); - } else { - auxInfo.setVisibility(View.GONE); - auxValue.setVisibility(View.GONE); - } +if (sharedPreferences.getBoolean(SettingsActivity.AUX_INFO, false)) { +auxInfo.setVisibility(View.VISIBLE); +auxValue.setVisibility(View.VISIBLE); +} else { +auxInfo.setVisibility(View.GONE); +auxValue.setVisibility(View.GONE); +} } }; @@ -208,18 +211,11 @@ private void prepareStatements() { private void initializeUIVariables() { if (getSupportActionBar() != null){ - getSupportActionBar().setTitle(null); + getSupportActionBar().setTitle("CheckList"); getSupportActionBar().getThemedContext(); - getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setHomeButtonEnabled(true); } - final NavigationView nvDrawer = (NavigationView) findViewById(R.id.nvView); - - // Setup drawer view - setupDrawerContent(nvDrawer); - setupDrawer(); - final EditText scannerTextView = ((EditText) findViewById(R.id.scannerTextView)); scannerTextView.setSelectAllOnFocus(true); scannerTextView.setOnKeyListener(new View.OnKeyListener() { @@ -237,25 +233,25 @@ public boolean onKey(View v, int keyCode, KeyEvent event) { ListView idTable = ((ListView) findViewById(R.id.idTable)); idTable.setChoiceMode(AbsListView.CHOICE_MODE_MULTIPLE); - idTable.setOnItemClickListener(new AdapterView.OnItemClickListener() { +idTable.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView parent, View view, int position, long id) { - scannerTextView.setText(((TextView) view).getText().toString()); +scannerTextView.setText(((TextView) view).getText().toString()); scannerTextView.setSelection(scannerTextView.getText().length()); scannerTextView.requestFocus(); scannerTextView.selectAll(); checkScannedItem(); - } + } }); - idTable.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() { - @Override - public boolean onItemLongClick(AdapterView parent, View view, int position, long id) { - //get app settings - insertNoteIntoDb(((TextView) view).getText().toString()); - return true; - } +idTable.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() { +@Override +public boolean onItemLongClick(AdapterView parent, View view, int position, long id) { +//get app settings +insertNoteIntoDb(((TextView) view).getText().toString()); +return true; +} }); TextView valueView = (TextView) findViewById(R.id.valueView); @@ -273,7 +269,7 @@ private synchronized void checkScannedItem() { SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(MainActivity.this); int scanMode = Integer.valueOf(sharedPref.getString(SettingsActivity.SCAN_MODE_LIST, "-1")); - boolean displayAux = sharedPref.getBoolean(SettingsActivity.AUX_INFO, true); +boolean displayAux = sharedPref.getBoolean(SettingsActivity.AUX_INFO, true); String scannedId = ((EditText) findViewById(org.phenoapps.verify.R.id.scannerTextView)) .getText().toString(); @@ -318,10 +314,10 @@ private synchronized void checkScannedItem() { } } } - cursor.close(); - ((TextView) findViewById(org.phenoapps.verify.R.id.valueView)).setText(values.toString()); - ((TextView) findViewById(R.id.auxValueView)).setText(auxValues.toString()); - ((EditText) findViewById(R.id.scannerTextView)).setText(""); + cursor.close(); +((TextView) findViewById(org.phenoapps.verify.R.id.valueView)).setText(values.toString()); +((TextView) findViewById(R.id.auxValueView)).setText(auxValues.toString()); +((EditText) findViewById(R.id.scannerTextView)).setText(""); } else { if (scanMode != 2) { ringNotification(false); @@ -808,6 +804,19 @@ final public boolean onCreateOptionsMenu(Menu m) { final MenuInflater inflater = getMenuInflater(); inflater.inflate(org.phenoapps.verify.R.menu.activity_main_toolbar, m); + + ActionMenuView bottomToolBar = (ActionMenuView) findViewById(R.id.bottom_toolbar); + Menu bottomMenu = bottomToolBar.getMenu(); + inflater.inflate(R.menu.activity_main_bottom_toolbar, bottomMenu); + + for (int i = 0; i < bottomMenu.size(); i++) { + bottomMenu.getItem(i).setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() { + @Override + public boolean onMenuItemClick(MenuItem item) { + return onOptionsItemSelected(item); + } + }); + } return true; } @@ -815,25 +824,81 @@ final public boolean onCreateOptionsMenu(Menu m) { final public boolean onOptionsItemSelected(MenuItem item) { DrawerLayout dl = (DrawerLayout) findViewById(R.id.drawer_layout); int actionCamera = R.id.action_camera; - int actionCompare = R.id.action_compare; - if (mDrawerToggle.onOptionsItemSelected(item)) { - return true; - } + int actionImport = R.id.action_import; + int actionHome = R.id.Home; + int actionCompare = R.id.Compare; + int actionSettings = R.id.Settings; + + if (item.getItemId() == actionImport){ + final SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(MainActivity.this); + final int scanMode = Integer.valueOf(sharedPref.getString(SettingsActivity.SCAN_MODE_LIST, "-1")); + final Intent i; + File verifyDirectory = new File(getExternalFilesDir(null), "/Verify"); + + File[] files = verifyDirectory.listFiles(); + + + AlertDialog.Builder builder = new AlertDialog.Builder(this); + builder.setTitle("Select files from?"); + builder.setPositiveButton("Storage", + new DialogInterface.OnClickListener() + { + public void onClick(DialogInterface dialog, int id) + { + Intent i; + if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT) { + i = new Intent(Intent.ACTION_OPEN_DOCUMENT); + }else{ + i = new Intent(Intent.ACTION_GET_CONTENT); + } + i.setType("*/*"); + startActivityForResult(Intent.createChooser(i, "Choose file to import."), VerifyConstants.DEFAULT_CONTENT_REQ); + } + }); + + builder.setNegativeButton("Verify Directory", + new DialogInterface.OnClickListener() + { + public void onClick(DialogInterface dialog, int id) + { + + AlertDialog.Builder fileBuilder = new AlertDialog.Builder(MainActivity.this); + fileBuilder.setTitle("Select the sample file"); + final int[] checkedItem = {-1}; + String[] listItems = verifyDirectory.list(); + fileBuilder.setSingleChoiceItems(listItems, checkedItem[0],(fileDialog, which) -> { + checkedItem[0] = which; + + Intent i = new Intent(MainActivity.this, LoaderDBActivity.class); + i.setData(Uri.fromFile(files[which])); + startActivityForResult(i, VerifyConstants.LOADER_INTENT_REQ); + fileDialog.dismiss(); + }); + + fileBuilder.show(); - if (item.getItemId() == android.R.id.home){ + } + }); + builder.show(); + } else if (item.getItemId() == android.R.id.home){ dl.openDrawer(GravityCompat.START); } - else if(item.getItemId() == actionCamera){ - final Intent cameraIntent = new Intent(this, ScanActivity.class); - startActivityForResult(cameraIntent, VerifyConstants.CAMERA_INTENT_REQ); + else if (item.getItemId() == actionHome){ + } - else if(item.getItemId() == actionCompare){ + else if ( item.getItemId() == actionCompare) { final Intent compareIntent = new Intent(MainActivity.this, CompareActivity.class); runOnUiThread(new Runnable() { @Override public void run() { startActivity(compareIntent); } }); + } else if (item.getItemId() == actionSettings) { + final Intent settingsIntent = new Intent(this, SettingsActivity.class); + startActivityForResult(settingsIntent, VerifyConstants.SETTINGS_INTENT_REQ); + } else if(item.getItemId() == actionCamera){ + final Intent cameraIntent = new Intent(this, ScanActivity.class); + startActivityForResult(cameraIntent, VerifyConstants.CAMERA_INTENT_REQ); } else{ return super.onOptionsItemSelected(item); @@ -912,131 +977,23 @@ final protected void onActivityResult(int requestCode, int resultCode, Intent in private void buildListView() { ListView idTable = (ListView) findViewById(org.phenoapps.verify.R.id.idTable); - ArrayAdapter idAdapter = - new ArrayAdapter<>(this, org.phenoapps.verify.R.layout.row); +ArrayAdapter idAdapter = +new ArrayAdapter<>(this, org.phenoapps.verify.R.layout.row); int size = mIds.size(); for (int i = 0; i < size; i++) { - idAdapter.add(this.mIds.get(this.mIds.keyAt(i))); +idAdapter.add(this.mIds.get(this.mIds.keyAt(i))); } - idTable.setAdapter(idAdapter); +idTable.setAdapter(idAdapter); } private void clearListView() { ListView idTable = (ListView) findViewById(org.phenoapps.verify.R.id.idTable); - final ArrayAdapter adapter = - new ArrayAdapter<>(this, org.phenoapps.verify.R.layout.row); +final ArrayAdapter adapter = +new ArrayAdapter<>(this, org.phenoapps.verify.R.layout.row); idTable.setAdapter(adapter); - adapter.notifyDataSetChanged(); - } - - private void setupDrawer() { - - DrawerLayout dl = (DrawerLayout) findViewById(org.phenoapps.verify.R.id.drawer_layout); - mDrawerToggle = new ActionBarDrawerToggle(this, dl, - org.phenoapps.verify.R.string.drawer_open, org.phenoapps.verify.R.string.drawer_close) { - - public void onDrawerOpened(View drawerView) { - View view = MainActivity.this.getCurrentFocus(); - if (view != null) { - InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); - imm.hideSoftInputFromWindow(view.getWindowToken(), 0); - } - } - - public void onDrawerClosed(View view) { - } - - }; - - mDrawerToggle.setDrawerIndicatorEnabled(true); - dl.addDrawerListener(mDrawerToggle); - } - - private void setupDrawerContent(NavigationView navigationView) { - navigationView.setNavigationItemSelectedListener( - new NavigationView.OnNavigationItemSelectedListener() { - @Override - public boolean onNavigationItemSelected(@NonNull MenuItem menuItem) { - selectDrawerItem(menuItem); - return true; - } - }); - } - - private void selectDrawerItem(MenuItem menuItem) { - int itemId = menuItem.getItemId(); - // constants like id in R class are no longer final, thus can't use switch here - - if (itemId == R.id.nav_import){ - final SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(MainActivity.this); - final int scanMode = Integer.valueOf(sharedPref.getString(SettingsActivity.SCAN_MODE_LIST, "-1")); - final Intent i; - File verifyDirectory = new File(getExternalFilesDir(null), "/Verify"); - - File[] files = verifyDirectory.listFiles(); - - - AlertDialog.Builder builder = new AlertDialog.Builder(this); - builder.setTitle("Select files from?"); - builder.setPositiveButton("Storage", - new DialogInterface.OnClickListener() - { - public void onClick(DialogInterface dialog, int id) - { - Intent i; - if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT) { - i = new Intent(Intent.ACTION_OPEN_DOCUMENT); - }else{ - i = new Intent(Intent.ACTION_GET_CONTENT); - } - i.setType("*/*"); - startActivityForResult(Intent.createChooser(i, "Choose file to import."), VerifyConstants.DEFAULT_CONTENT_REQ); - } - }); - - builder.setNegativeButton("Verify Directory", - new DialogInterface.OnClickListener() - { - public void onClick(DialogInterface dialog, int id) - { - - AlertDialog.Builder fileBuilder = new AlertDialog.Builder(MainActivity.this); - fileBuilder.setTitle("Select the sample file"); - final int[] checkedItem = {-1}; - String[] listItems = verifyDirectory.list(); - fileBuilder.setSingleChoiceItems(listItems, checkedItem[0],(fileDialog, which) -> { - checkedItem[0] = which; - - Intent i = new Intent(MainActivity.this, LoaderDBActivity.class); - i.setData(Uri.fromFile(files[which])); - startActivityForResult(i, VerifyConstants.LOADER_INTENT_REQ); - fileDialog.dismiss(); - }); - - fileBuilder.show(); - - } - }); - builder.show(); - } else if (itemId == R.id.nav_settings) { - final Intent settingsIntent = new Intent(this, SettingsActivity.class); - startActivityForResult(settingsIntent, VerifyConstants.SETTINGS_INTENT_REQ); - } else if (itemId == R.id.nav_export) { - askUserExportFileName(); - } else if (itemId == R.id.nav_about) { - showAboutDialog(); - } else if (itemId == R.id.nav_intro) { - final Intent intro_intent = new Intent(MainActivity.this, IntroActivity.class); - runOnUiThread(new Runnable() { - @Override public void run() { - startActivity(intro_intent); - } - }); - } - DrawerLayout dl = (DrawerLayout) findViewById(org.phenoapps.verify.R.id.drawer_layout); - dl.closeDrawers(); +adapter.notifyDataSetChanged(); } private void showPairDialog() { @@ -1065,73 +1022,14 @@ public void onClick(DialogInterface dialogInterface, int i) { builder.show(); } - private void showAboutDialog() - { - android.app.AlertDialog.Builder builder = new android.app.AlertDialog.Builder(this); - { - android.view.View personView = this.getLayoutInflater().inflate( - org.phenoapps.verify.R.layout.about, new android.widget.LinearLayout(this), - false); - - { - assert personView != null; - android.widget.TextView versionTextView = (android.widget.TextView) - personView.findViewById(org.phenoapps.verify.R.id.tvVersion); - try - { - android.content.pm.PackageInfo packageInfo = - this.getPackageManager().getPackageInfo(this.getPackageName(), 0); - assert packageInfo != null; - assert versionTextView != null; - versionTextView.setText(this.getResources().getString( - org.phenoapps.verify.R.string.versiontitle) + - ' ' + packageInfo.versionName); - } - catch (android.content.pm.PackageManager.NameNotFoundException e) - { e.printStackTrace(); } - versionTextView.setOnClickListener(new android.view.View.OnClickListener() - { - @java.lang.Override - public void onClick(android.view.View v) - { MainActivity.this.showChangeLog(); } - }); - } - - builder.setCancelable(true); - builder.setTitle (this.getResources().getString( - org.phenoapps.verify.R.string.about)); - builder.setView(personView); - } - - builder.setNegativeButton( - this.getResources().getString(org.phenoapps.verify.R.string.ok), - new android.content.DialogInterface.OnClickListener() - { - @java.lang.Override - public void onClick(android.content.DialogInterface dialog, int which) - { - assert dialog != null; - dialog.dismiss(); - } - }); - - builder.show(); - } - - private void showChangeLog() { - - } - @Override final protected void onPostCreate(Bundle savedInstanceState) { super.onPostCreate(savedInstanceState); - mDrawerToggle.syncState(); } @Override final public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); - mDrawerToggle.onConfigurationChanged(newConfig); } private void launchIntro() { diff --git a/app/src/main/java/org/phenoapps/verify/SettingsActivity.java b/app/src/main/java/org/phenoapps/verify/SettingsActivity.java index fb5a18f..f12ff6e 100644 --- a/app/src/main/java/org/phenoapps/verify/SettingsActivity.java +++ b/app/src/main/java/org/phenoapps/verify/SettingsActivity.java @@ -8,6 +8,10 @@ public class SettingsActivity extends AppCompatActivity { public static String FILE_NAME = "org.phenoapps.verify.FILE_NAME"; + public static String INTRO_BUTTON = "org.phenoapps.verify.INTRO"; + + public static String ABOUT_BUTTON = "org.phenoapps.verify.ABOUT"; + public static String SCAN_MODE_LIST = "org.phenoapps.verify.SCAN_MODE"; public static String AUDIO_ENABLED = "org.phenoapps.verify.AUDIO_ENABLED"; public static String TUTORIAL_MODE = "org.phenoapps.verify.TUTORIAL_MODE"; diff --git a/app/src/main/java/org/phenoapps/verify/SettingsFragment.java b/app/src/main/java/org/phenoapps/verify/SettingsFragment.java index 577aa32..0092384 100644 --- a/app/src/main/java/org/phenoapps/verify/SettingsFragment.java +++ b/app/src/main/java/org/phenoapps/verify/SettingsFragment.java @@ -1,14 +1,31 @@ package org.phenoapps.verify; +import android.content.Context; +import android.content.Intent; import android.content.SharedPreferences; +import android.os.Build; import android.os.Bundle; import android.preference.ListPreference; import android.preference.Preference; import android.preference.PreferenceFragment; import android.widget.Toast; +import java.util.prefs.Preferences; + public class SettingsFragment extends PreferenceFragment { + + private void showChangeLog() { + + } + private void showAboutDialog(Context ctx) + { + if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) { + Intent i = new Intent(getContext(), AboutActivity.class); + startActivity(i); + } + } + @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -17,7 +34,34 @@ public void onCreate(Bundle savedInstanceState) { final SharedPreferences sharedPrefs = super.getPreferenceManager().getSharedPreferences(); ListPreference mode = (ListPreference) findPreference(SettingsActivity.SCAN_MODE_LIST); + Preference introButton = (Preference) findPreference(SettingsActivity.INTRO_BUTTON); + Preference aboutButton = (Preference) findPreference(SettingsActivity.ABOUT_BUTTON); + aboutButton.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { + @Override + public boolean onPreferenceClick(Preference preference) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { + showAboutDialog(getContext()); + } + return true; + } + }); + + introButton.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { + @Override + public boolean onPreferenceClick(Preference preference) { + if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) { + final Intent intro_intent = new Intent(getContext(), IntroActivity.class); + getActivity().runOnUiThread(new Runnable() { + @Override + public void run() { + startActivity(intro_intent); + } + }); + } + return true; + } + }); mode.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { //check if Pair mode is chosen, if it's disabled then show a message and switch //back to default mode. diff --git a/app/src/main/java/org/phenoapps/verify/UriHandler.java b/app/src/main/java/org/phenoapps/verify/UriHandler.java index 51c7d5f..851c11c 100644 --- a/app/src/main/java/org/phenoapps/verify/UriHandler.java +++ b/app/src/main/java/org/phenoapps/verify/UriHandler.java @@ -55,7 +55,7 @@ public static String getFileName(@NonNull Context context, Uri uri) { return fileName; } -//test + /** * Returns the effective file name from the provided Uri. * @param fileName diff --git a/app/src/main/res/drawable-anydpi/ic_home.xml b/app/src/main/res/drawable-anydpi/ic_home.xml new file mode 100644 index 0000000..3eb8fe0 --- /dev/null +++ b/app/src/main/res/drawable-anydpi/ic_home.xml @@ -0,0 +1,16 @@ + + + + + diff --git a/app/src/main/res/drawable-hdpi/ic_home.png b/app/src/main/res/drawable-hdpi/ic_home.png new file mode 100644 index 0000000..bfbbd81 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_home.png differ diff --git a/app/src/main/res/drawable-hdpi/ic_import_white.png b/app/src/main/res/drawable-hdpi/ic_import_white.png new file mode 100644 index 0000000..f90b07a Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_import_white.png differ diff --git a/app/src/main/res/drawable-hdpi/ic_settings.png b/app/src/main/res/drawable-hdpi/ic_settings.png index 4cb8e41..bda5e85 100644 Binary files a/app/src/main/res/drawable-hdpi/ic_settings.png and b/app/src/main/res/drawable-hdpi/ic_settings.png differ diff --git a/app/src/main/res/drawable-mdpi/ic_home.png b/app/src/main/res/drawable-mdpi/ic_home.png new file mode 100644 index 0000000..5c6b248 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_home.png differ diff --git a/app/src/main/res/drawable-mdpi/ic_import_white.png b/app/src/main/res/drawable-mdpi/ic_import_white.png new file mode 100644 index 0000000..f90b07a Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_import_white.png differ diff --git a/app/src/main/res/drawable-mdpi/ic_settings.png b/app/src/main/res/drawable-mdpi/ic_settings.png index cf6c63e..bda5e85 100644 Binary files a/app/src/main/res/drawable-mdpi/ic_settings.png and b/app/src/main/res/drawable-mdpi/ic_settings.png differ diff --git a/app/src/main/res/drawable-xhdpi/ic_home.png b/app/src/main/res/drawable-xhdpi/ic_home.png new file mode 100644 index 0000000..00ba157 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_home.png differ diff --git a/app/src/main/res/drawable-xhdpi/ic_import_white.png b/app/src/main/res/drawable-xhdpi/ic_import_white.png new file mode 100644 index 0000000..f90b07a Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_import_white.png differ diff --git a/app/src/main/res/drawable-xhdpi/ic_settings.png b/app/src/main/res/drawable-xhdpi/ic_settings.png index 3170916..bda5e85 100644 Binary files a/app/src/main/res/drawable-xhdpi/ic_settings.png and b/app/src/main/res/drawable-xhdpi/ic_settings.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_home.png b/app/src/main/res/drawable-xxhdpi/ic_home.png new file mode 100644 index 0000000..35d7634 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_home.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_import_white.png b/app/src/main/res/drawable-xxhdpi/ic_import_white.png new file mode 100644 index 0000000..f90b07a Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_import_white.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_settings.png b/app/src/main/res/drawable-xxhdpi/ic_settings.png index 55d0279..bda5e85 100644 Binary files a/app/src/main/res/drawable-xxhdpi/ic_settings.png and b/app/src/main/res/drawable-xxhdpi/ic_settings.png differ diff --git a/app/src/main/res/drawable/ic_person_profile.xml b/app/src/main/res/drawable/ic_person_profile.xml new file mode 100644 index 0000000..d21debf --- /dev/null +++ b/app/src/main/res/drawable/ic_person_profile.xml @@ -0,0 +1,10 @@ + + + \ No newline at end of file diff --git a/app/src/main/res/layout-land/activity_main.xml b/app/src/main/res/layout-land/activity_main.xml index 08a56bf..c483435 100644 --- a/app/src/main/res/layout-land/activity_main.xml +++ b/app/src/main/res/layout-land/activity_main.xml @@ -95,14 +95,24 @@ + + + + + - \ No newline at end of file diff --git a/app/src/main/res/layout-xlarge/activity_main.xml b/app/src/main/res/layout-xlarge/activity_main.xml index bf2bde7..cd45fdd 100644 --- a/app/src/main/res/layout-xlarge/activity_main.xml +++ b/app/src/main/res/layout-xlarge/activity_main.xml @@ -94,15 +94,25 @@ + + + + - \ No newline at end of file diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 6ed3db9..81e3cdf 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -15,7 +15,7 @@ android:id="@+id/idTable" android:layout_width="0dp" android:layout_height="200dp" - android:visibility="visible" + android:visibility="visible" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" app:layout_constraintTop_toTopOf="parent" /> @@ -88,36 +88,46 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> - + - + - + + + + + - \ No newline at end of file diff --git a/app/src/main/res/menu/activity_main_bottom_toolbar.xml b/app/src/main/res/menu/activity_main_bottom_toolbar.xml new file mode 100644 index 0000000..6c2fa92 --- /dev/null +++ b/app/src/main/res/menu/activity_main_bottom_toolbar.xml @@ -0,0 +1,23 @@ + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/menu/activity_main_toolbar.xml b/app/src/main/res/menu/activity_main_toolbar.xml index 4d217d2..53a2b3d 100644 --- a/app/src/main/res/menu/activity_main_toolbar.xml +++ b/app/src/main/res/menu/activity_main_toolbar.xml @@ -1,14 +1,16 @@ + xmlns:app="http://schemas.android.com/apk/res-auto" + > + + - \ No newline at end of file diff --git a/app/src/main/res/values/about_styles.xml b/app/src/main/res/values/about_styles.xml new file mode 100644 index 0000000..55344e5 --- /dev/null +++ b/app/src/main/res/values/about_styles.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index dfd0a57..855819f 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -15,4 +15,11 @@ @color/colorAccent + + + + diff --git a/app/src/main/res/xml/preferences.xml b/app/src/main/res/xml/preferences.xml index 60d2fe0..285561f 100644 --- a/app/src/main/res/xml/preferences.xml +++ b/app/src/main/res/xml/preferences.xml @@ -36,4 +36,13 @@ android:key="org.phenoapps.verify.TUTORIAL_MODE" android:summary="Always display the tutorial when Verify is opened." android:title="Tutorial" /> + + \ No newline at end of file