Skip to content

Commit

Permalink
stable release v2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
xavier-gz committed Nov 14, 2021
1 parent 8b2e86e commit f89eb61
Show file tree
Hide file tree
Showing 11 changed files with 33 additions and 116 deletions.
8 changes: 4 additions & 4 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ android {
applicationId "gal.sli.singal"
minSdk 16
targetSdk 30
versionCode 20
versionName "2.0"
versionCode 21
versionName "2.1"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
android.defaultConfig.vectorDrawables.useSupportLibrary = true
Expand All @@ -33,8 +33,8 @@ dependencies {

implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.0'
testImplementation 'junit:junit:4.+'
implementation 'androidx.constraintlayout:constraintlayout:2.1.1'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}
Binary file modified app/release/app-release.apk
Binary file not shown.
4 changes: 2 additions & 2 deletions app/release/output-metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"type": "SINGLE",
"filters": [],
"attributes": [],
"versionCode": 20,
"versionName": "2.0",
"versionCode": 21,
"versionName": "2.1",
"outputFile": "app-release.apk"
}
],
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
package="gal.sli.singal">

<application
android:allowBackup="true"
android:allowBackup="false"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
Expand Down
55 changes: 5 additions & 50 deletions app/src/main/java/gal/sli/singal/DataBaseHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,10 @@
import java.io.OutputStream;
import java.util.ArrayList;

import static android.content.ContentValues.TAG;

public class DataBaseHelper extends SQLiteOpenHelper {

private static String DB_PATH = "/data/data/gal.sli.singal/databases/";
//private static String DB_PATH = "/data/data/gal.sli.singal/databases/";
private static String DB_PATH;

private static final String DB_NAME = "singal.db"; //en assets

Expand All @@ -35,28 +34,7 @@ public DataBaseHelper(Context context) {

super(context, DB_NAME, null, DATABASE_VERSION);
this.myContext = context;
}

public void createDataBase_ori() throws IOException {

boolean dbExist = checkDataBase();

if (dbExist) {
} else {

this.getReadableDatabase();

try {

copyDataBase();

} catch (IOException e) {

throw new Error("Error copying database");

}
}

DB_PATH = myContext.getDatabasePath(DB_NAME).getPath();
}


Expand All @@ -81,31 +59,6 @@ public void createDataBase() throws IOException {
}
}

public void createDataBase_test() throws IOException {

boolean dbExist = checkDataBase();

if (dbExist) {
Log.d(TAG, "db exists");

this.getWritableDatabase();
}

dbExist = checkDataBase();

if (!dbExist) {

this.getReadableDatabase();

try {
copyDataBase();

} catch (IOException e) {
throw new Error("Error copying database");
}
}
}


private boolean checkDataBase() {

Expand All @@ -117,6 +70,8 @@ private boolean checkDataBase() {

} catch (SQLiteException e) {

//database does't exist yet

}

if (checkDB != null) {
Expand Down
53 changes: 15 additions & 38 deletions app/src/main/java/gal/sli/singal/DisplayMessageActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import android.content.Context;
import android.content.Intent;
import android.database.SQLException;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.net.Uri;
Expand All @@ -13,7 +12,6 @@
import android.os.Bundle;

import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.RecyclerView;

import android.text.Html;
import android.text.SpannableString;
Expand All @@ -32,23 +30,11 @@

import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;



import java.util.Objects;


public class DisplayMessageActivity extends AppCompatActivity {

private List<String> listDataGroup;

private HashMap<String, List<String>> listDataChild;


private RecyclerView recyclerView;
private RecyclerView.Adapter mAdapter;
private RecyclerView.LayoutManager layoutManager;

@Override
protected void onCreate(Bundle savedInstanceState) {
Expand All @@ -72,32 +58,21 @@ protected void onCreate(Bundle savedInstanceState) {

}

try {

myDbHelper.openDataBase();

} catch (SQLException sqle) {

throw sqle;

}

String palabra = message;
myDbHelper.openDataBase();


ArrayList<String> resultado = myDbHelper.getOneItem(palabra);
ArrayList<String> resultado = myDbHelper.getOneItem(message);


if ((resultado.isEmpty()) ) {

Intent refresh = new Intent(this, MainActivity.class);
Toast toast = Toast.makeText(this, getString(R.string.recuncar), Toast.LENGTH_LONG);
toast.getView();
toast.show();

overridePendingTransition( 0, 0);
Intent refresh = new Intent(this, MainActivity.class);
refresh.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_NO_ANIMATION);
startActivity(refresh);
overridePendingTransition( 0, 0);

Toast toast = Toast.makeText(this.getBaseContext(), getString(R.string.recuncar), Toast.LENGTH_SHORT);
toast.show();
finish();

} else {

Expand All @@ -109,7 +84,9 @@ protected void onCreate(Bundle savedInstanceState) {
ColorDrawable colorDrawable
= new ColorDrawable(Color.parseColor("#933DB5"));

actionBar.setBackgroundDrawable(colorDrawable);
if (actionBar != null) {
actionBar.setBackgroundDrawable(colorDrawable);
}

ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, R.layout.list_row_child, resultado)
{
Expand All @@ -119,7 +96,7 @@ public View getView(int position, View convertView, ViewGroup parent)
View row;
LayoutInflater mInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
if (null == convertView) {
row = mInflater.inflate(R.layout.list_row_child, null);
row = mInflater.inflate(R.layout.list_row_child, parent, false);
} else {
row = convertView;
}
Expand Down Expand Up @@ -170,7 +147,7 @@ public boolean onOptionsItemSelected (MenuItem item){

e.show();

((TextView) e.findViewById(android.R.id.message)).setMovementMethod(LinkMovementMethod.getInstance());
((TextView) Objects.requireNonNull(e.findViewById(android.R.id.message))).setMovementMethod(LinkMovementMethod.getInstance());

return true;

Expand All @@ -189,7 +166,7 @@ public boolean onOptionsItemSelected (MenuItem item){

f.show();

((TextView) f.findViewById(android.R.id.message)).setMovementMethod(LinkMovementMethod.getInstance());
((TextView) Objects.requireNonNull(f.findViewById(android.R.id.message))).setMovementMethod(LinkMovementMethod.getInstance());

return true;

Expand Down
6 changes: 4 additions & 2 deletions app/src/main/java/gal/sli/singal/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
import android.widget.EditText;
import android.widget.TextView;

import java.util.Objects;

public class MainActivity extends AppCompatActivity {

@Override
Expand Down Expand Up @@ -61,7 +63,7 @@ public boolean onOptionsItemSelected(MenuItem item) {

f.show();

((TextView) f.findViewById(android.R.id.message)).setMovementMethod(LinkMovementMethod.getInstance());
((TextView) Objects.requireNonNull(f.findViewById(android.R.id.message))).setMovementMethod(LinkMovementMethod.getInstance());

return true;

Expand All @@ -82,7 +84,7 @@ public boolean onOptionsItemSelected(MenuItem item) {

e.show();

((TextView)e.findViewById(android.R.id.message)).setMovementMethod(LinkMovementMethod.getInstance());
((TextView) Objects.requireNonNull(e.findViewById(android.R.id.message))).setMovementMethod(LinkMovementMethod.getInstance());

return true;

Expand Down
9 changes: 0 additions & 9 deletions app/src/main/res/drawable/search.xml

This file was deleted.

2 changes: 0 additions & 2 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
tools:context=".MainActivity">

<ListView
android:id="@+id/entries_list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:ignore="MissingConstraints">
Expand Down Expand Up @@ -56,7 +55,6 @@
app:srcCompat="@drawable/ic_sli" />

<ImageView
android:id="@+id/imageView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
Expand Down
8 changes: 1 addition & 7 deletions app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,7 @@
<item name="windowNoTitle">true</item>
</style>

<style name="AppTheme.ActionBar">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>

<!-- <color name="colorPrimary">#3F51B5</color>-->
<!-- <color name="colorPrimary">#3F51B5</color>-->
<color name="colorPrimary">#933DB5</color>

<color name="colorPrimaryDark">#303F9F</color>
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath "com.android.tools.build:gradle:7.0.0"
classpath 'com.android.tools.build:gradle:7.0.3'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down

0 comments on commit f89eb61

Please sign in to comment.