Releasing 1.0.0
This commit is contained in:
commit
60ebb68e76
@ -147,7 +147,7 @@
|
||||
<PersistentState>
|
||||
<option name="values">
|
||||
<map>
|
||||
<entry key="url" value="jar:file:/home/chronosx/%D0%94%D0%BE%D0%BA%D1%83%D0%BC%D0%B5%D0%BD%D1%82%D1%8B/bin/Android%20Studio/plugins/android/lib/android.jar!/images/material_design_icons/action/ic_favorite_black_24dp.xml" />
|
||||
<entry key="url" value="jar:file:/home/chronosx/%D0%94%D0%BE%D0%BA%D1%83%D0%BC%D0%B5%D0%BD%D1%82%D1%8B/bin/Android%20Studio/plugins/android/lib/android.jar!/images/material_design_icons/content/ic_clear_black_24dp.xml" />
|
||||
</map>
|
||||
</option>
|
||||
</PersistentState>
|
||||
@ -157,7 +157,8 @@
|
||||
</option>
|
||||
<option name="values">
|
||||
<map>
|
||||
<entry key="outputName" value="ic_favorite_black_24dp" />
|
||||
<entry key="color" value="d3d3d3" />
|
||||
<entry key="outputName" value="ic_clear_gray_24dp" />
|
||||
<entry key="sourceFile" value="$USER_HOME$" />
|
||||
</map>
|
||||
</option>
|
||||
|
Binary file not shown.
@ -2,6 +2,5 @@
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
@ -1,14 +1,18 @@
|
||||
apply plugin: 'com.android.application'
|
||||
|
||||
android {
|
||||
compileSdkVersion 27
|
||||
compileSdkVersion 28
|
||||
defaultConfig {
|
||||
applicationId "ru.volgorobot.vrcatalog"
|
||||
minSdkVersion 19
|
||||
targetSdkVersion 27
|
||||
versionCode 7
|
||||
versionName "0.5.0"
|
||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||
javaCompileOptions {
|
||||
annotationProcessorOptions {
|
||||
arguments = ["room.schemaLocation": "$projectDir/schemas".toString()]
|
||||
}
|
||||
}
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
@ -24,15 +28,19 @@ android {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
def room_version = "2.1.0-alpha04"
|
||||
implementation fileTree(include: ['*.jar'], dir: 'libs')
|
||||
implementation 'com.android.support:appcompat-v7:27.1.1'
|
||||
implementation 'com.android.support:design:27.1.1'
|
||||
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
|
||||
implementation 'androidx.appcompat:appcompat:1.0.2'
|
||||
implementation 'com.google.android.material:material:1.0.0'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:1.1.2'
|
||||
implementation 'me.texy.treeview:treeview_lib:1.0.4'
|
||||
implementation 'com.google.code.gson:gson:2.8.2'
|
||||
implementation 'com.squareup.retrofit2:retrofit:2.4.0'
|
||||
implementation 'com.squareup.retrofit2:converter-gson:2.4.0'
|
||||
implementation 'com.android.support:recyclerview-v7:27.1.1'
|
||||
implementation 'androidx.recyclerview:recyclerview:1.0.0-beta01'
|
||||
implementation 'com.squareup.picasso:picasso:2.71828'
|
||||
implementation 'com.github.chrisbanes:PhotoView:2.1.4'
|
||||
|
||||
implementation "androidx.room:room-runtime:$room_version"
|
||||
annotationProcessor "androidx.room:room-compiler:$room_version"
|
||||
}
|
||||
|
@ -0,0 +1,46 @@
|
||||
{
|
||||
"formatVersion": 1,
|
||||
"database": {
|
||||
"version": 1,
|
||||
"identityHash": "b484b5731c959dea19f42d92a1fccfcd",
|
||||
"entities": [
|
||||
{
|
||||
"tableName": "favorites",
|
||||
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `itemID` INTEGER NOT NULL, `itemName` TEXT)",
|
||||
"fields": [
|
||||
{
|
||||
"fieldPath": "id",
|
||||
"columnName": "id",
|
||||
"affinity": "INTEGER",
|
||||
"notNull": true
|
||||
},
|
||||
{
|
||||
"fieldPath": "itemID",
|
||||
"columnName": "itemID",
|
||||
"affinity": "INTEGER",
|
||||
"notNull": true
|
||||
},
|
||||
{
|
||||
"fieldPath": "itemName",
|
||||
"columnName": "itemName",
|
||||
"affinity": "TEXT",
|
||||
"notNull": false
|
||||
}
|
||||
],
|
||||
"primaryKey": {
|
||||
"columnNames": [
|
||||
"id"
|
||||
],
|
||||
"autoGenerate": true
|
||||
},
|
||||
"indices": [],
|
||||
"foreignKeys": []
|
||||
}
|
||||
],
|
||||
"views": [],
|
||||
"setupQueries": [
|
||||
"CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
|
||||
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, \"b484b5731c959dea19f42d92a1fccfcd\")"
|
||||
]
|
||||
}
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
{
|
||||
"formatVersion": 1,
|
||||
"database": {
|
||||
"version": 1,
|
||||
"identityHash": "b484b5731c959dea19f42d92a1fccfcd",
|
||||
"entities": [
|
||||
{
|
||||
"tableName": "favorites",
|
||||
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `itemID` INTEGER NOT NULL, `itemName` TEXT)",
|
||||
"fields": [
|
||||
{
|
||||
"fieldPath": "id",
|
||||
"columnName": "id",
|
||||
"affinity": "INTEGER",
|
||||
"notNull": true
|
||||
},
|
||||
{
|
||||
"fieldPath": "itemID",
|
||||
"columnName": "itemID",
|
||||
"affinity": "INTEGER",
|
||||
"notNull": true
|
||||
},
|
||||
{
|
||||
"fieldPath": "itemName",
|
||||
"columnName": "itemName",
|
||||
"affinity": "TEXT",
|
||||
"notNull": false
|
||||
}
|
||||
],
|
||||
"primaryKey": {
|
||||
"columnNames": [
|
||||
"id"
|
||||
],
|
||||
"autoGenerate": true
|
||||
},
|
||||
"indices": [],
|
||||
"foreignKeys": []
|
||||
}
|
||||
],
|
||||
"views": [],
|
||||
"setupQueries": [
|
||||
"CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
|
||||
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, \"b484b5731c959dea19f42d92a1fccfcd\")"
|
||||
]
|
||||
}
|
||||
}
|
@ -1,5 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<manifest
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
package="ru.volgorobot.vrcatalog">
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
@ -10,7 +12,8 @@
|
||||
android:label="@string/app_name"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/AppTheme">
|
||||
android:theme="@style/AppTheme"
|
||||
android:name=".App">
|
||||
<activity android:name=".view.FavoritesActivity"></activity>
|
||||
<activity
|
||||
android:name=".view.MainActivity"
|
||||
|
25
app/src/main/java/ru/volgorobot/vrcatalog/App.java
Normal file
25
app/src/main/java/ru/volgorobot/vrcatalog/App.java
Normal file
@ -0,0 +1,25 @@
|
||||
package ru.volgorobot.vrcatalog;
|
||||
|
||||
import android.app.Application;
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.room.Room;
|
||||
import ru.volgorobot.vrcatalog.additional.DatabaseHelper;
|
||||
|
||||
public class App extends Application {
|
||||
private static Application instance;
|
||||
private static DatabaseHelper db;
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
instance = this;
|
||||
db = Room.databaseBuilder(getApplicationContext(), DatabaseHelper.class, "mainDatabase")
|
||||
.allowMainThreadQueries()
|
||||
.build();
|
||||
}
|
||||
|
||||
public static Context getContext() { return instance.getApplicationContext(); }
|
||||
|
||||
public static DatabaseHelper getDatabaseInstance() { return db; }
|
||||
}
|
@ -6,8 +6,10 @@ import java.util.ArrayList;
|
||||
|
||||
import me.texy.treeview.TreeNode;
|
||||
import ru.volgorobot.vrcatalog.additional.NetworkErrorException;
|
||||
import ru.volgorobot.vrcatalog.additional.adapters.FavoritesListAdapter;
|
||||
import ru.volgorobot.vrcatalog.model.CoreModel;
|
||||
import ru.volgorobot.vrcatalog.model.DetailModel;
|
||||
import ru.volgorobot.vrcatalog.model.FavoritesModel;
|
||||
import ru.volgorobot.vrcatalog.model.FirstLevelModel;
|
||||
import ru.volgorobot.vrcatalog.model.ImageItemModel;
|
||||
import ru.volgorobot.vrcatalog.model.SecondLevelModel;
|
||||
@ -34,12 +36,15 @@ public interface MainContract {
|
||||
}
|
||||
|
||||
interface FavoritesPresenter {
|
||||
void getAllItems();
|
||||
void removeItem(int id);
|
||||
void fetchItem(int itemID);
|
||||
}
|
||||
|
||||
interface FavoritesActivityView {
|
||||
void onFailruleAnswer(int errorCode);
|
||||
void onFailureAnswer(int errorCode);
|
||||
void startActivityByIntent(Intent intent);
|
||||
void updateListView(ArrayList<FavoritesModel> data);
|
||||
}
|
||||
|
||||
interface ViewBinder {
|
||||
@ -71,6 +76,10 @@ public interface MainContract {
|
||||
|
||||
interface ItemPresenter {
|
||||
void getImagesByItemID(int id);
|
||||
boolean checkFavoriteListed(int itemID);
|
||||
int getFavoriteID(int itemID);
|
||||
void addToFavorites(int itemID, String itemName);
|
||||
void removeFromFavorites(int favID);
|
||||
}
|
||||
|
||||
interface ItemView {
|
||||
|
@ -17,11 +17,11 @@ package ru.volgorobot.vrcatalog.additional;
|
||||
import android.content.res.Configuration;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceActivity;
|
||||
import android.support.annotation.LayoutRes;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v7.app.ActionBar;
|
||||
import android.support.v7.app.AppCompatDelegate;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import androidx.annotation.LayoutRes;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.ActionBar;
|
||||
import androidx.appcompat.app.AppCompatDelegate;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
@ -0,0 +1,11 @@
|
||||
package ru.volgorobot.vrcatalog.additional;
|
||||
|
||||
import androidx.room.Database;
|
||||
import androidx.room.RoomDatabase;
|
||||
import ru.volgorobot.vrcatalog.model.FavoritesDaoModel;
|
||||
import ru.volgorobot.vrcatalog.model.FavoritesModel;
|
||||
|
||||
@Database(entities = {FavoritesModel.class}, version = 1)
|
||||
public abstract class DatabaseHelper extends RoomDatabase {
|
||||
public abstract FavoritesDaoModel getFavoritesDaoModel();
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
package ru.volgorobot.vrcatalog.additional;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.MotionEvent;
|
||||
|
||||
import androidx.viewpager.widget.ViewPager;
|
||||
|
||||
/**
|
||||
* ViewPager fixer class (which fix bug with zooming)
|
||||
*/
|
||||
|
||||
public class HackyViewPager extends ViewPager {
|
||||
|
||||
public HackyViewPager(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public HackyViewPager(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onTouchEvent(MotionEvent ev) {
|
||||
try {
|
||||
return super.onTouchEvent(ev);
|
||||
} catch (IllegalArgumentException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onInterceptTouchEvent(MotionEvent ev) {
|
||||
try {
|
||||
return super.onInterceptTouchEvent(ev);
|
||||
} catch (IllegalArgumentException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
@ -23,9 +23,9 @@ public class SearchableNodeViewFactory extends BaseNodeViewFactory {
|
||||
public BaseNodeViewBinder getNodeViewBinder(View view, int level) {
|
||||
switch (level) {
|
||||
case 0:
|
||||
return new FirstLevelNodeViewBinder(view);
|
||||
return new FirstLevelNodeViewBinder(view, mView);
|
||||
case 1:
|
||||
return new SecondLevelNodeViewBinder(view);
|
||||
return new SecondLevelNodeViewBinder(view, mView);
|
||||
case 2:
|
||||
return new ThirdLevelNodeViewBinder(view, context, mView);
|
||||
default:
|
||||
|
@ -3,25 +3,22 @@ package ru.volgorobot.vrcatalog.additional.adapters;
|
||||
import android.content.Context;
|
||||
import android.widget.ArrayAdapter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import ru.volgorobot.vrcatalog.model.FavoritesListModel;
|
||||
import ru.volgorobot.vrcatalog.presenters.FavoritesDBPresenter;
|
||||
import ru.volgorobot.vrcatalog.model.FavoritesModel;
|
||||
|
||||
public class FavoritesListAdapter extends ArrayAdapter<FavoritesListModel> {
|
||||
private FavoritesDBPresenter db;
|
||||
|
||||
public FavoritesListAdapter(Context context, int resource, List<FavoritesListModel> objects) {
|
||||
public class FavoritesListAdapter extends ArrayAdapter<FavoritesModel> {
|
||||
public FavoritesListAdapter(Context context, int resource, List<FavoritesModel> objects) {
|
||||
super(context, resource, objects);
|
||||
db = new FavoritesDBPresenter(context);
|
||||
}
|
||||
|
||||
public void updateData() {
|
||||
public void updateData(ArrayList<FavoritesModel> data) {
|
||||
super.clear();
|
||||
super.addAll(db.selectAll());
|
||||
super.addAll(data);
|
||||
}
|
||||
|
||||
public int getArraySize() {
|
||||
return db.selectAll().size();
|
||||
return super.getCount();
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,9 @@
|
||||
package ru.volgorobot.vrcatalog.additional.adapters;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v4.view.PagerAdapter;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.viewpager.widget.PagerAdapter;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.animation.AccelerateInterpolator;
|
||||
|
@ -5,8 +5,8 @@ import android.content.Intent;
|
||||
import android.graphics.Bitmap;
|
||||
import android.net.Uri;
|
||||
import android.provider.MediaStore;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v4.view.PagerAdapter;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.viewpager.widget.PagerAdapter;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
|
@ -0,0 +1,22 @@
|
||||
package ru.volgorobot.vrcatalog.model;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import androidx.room.Dao;
|
||||
import androidx.room.Insert;
|
||||
import androidx.room.Query;
|
||||
|
||||
@Dao
|
||||
public interface FavoritesDaoModel {
|
||||
@Query("SELECT * FROM favorites")
|
||||
List<FavoritesModel> getAll();
|
||||
|
||||
@Query("SELECT * FROM favorites WHERE itemID = :itemID")
|
||||
List<FavoritesModel> getFavoriteByItemID(int itemID);
|
||||
|
||||
@Insert
|
||||
void add(FavoritesModel model);
|
||||
|
||||
@Query("DELETE FROM favorites WHERE id = :id")
|
||||
void remove(int id);
|
||||
}
|
@ -1,17 +1,21 @@
|
||||
package ru.volgorobot.vrcatalog.model;
|
||||
|
||||
public class FavoritesListModel {
|
||||
private int id;
|
||||
private int itemID;
|
||||
private String itemName;
|
||||
import androidx.room.ColumnInfo;
|
||||
import androidx.room.Entity;
|
||||
import androidx.room.PrimaryKey;
|
||||
|
||||
public FavoritesListModel(int itemID, String itemName) {
|
||||
this.itemID = itemID;
|
||||
this.itemName = itemName;
|
||||
}
|
||||
@Entity(tableName = "favorites")
|
||||
public class FavoritesModel {
|
||||
@PrimaryKey(autoGenerate = true)
|
||||
public int id;
|
||||
|
||||
public FavoritesListModel(int id, int itemID, String itemName) {
|
||||
this.id = id;
|
||||
@ColumnInfo
|
||||
public int itemID;
|
||||
|
||||
@ColumnInfo
|
||||
public String itemName;
|
||||
|
||||
public FavoritesModel(int itemID, String itemName) {
|
||||
this.itemID = itemID;
|
||||
this.itemName = itemName;
|
||||
}
|
@ -32,6 +32,7 @@ public class FirstLevelNodeViewBinder extends BaseNodeViewBinder implements Main
|
||||
@Override
|
||||
public void bindView(TreeNode treeNode) {
|
||||
textView.setText(treeNode.getValue().toString());
|
||||
imageView.setRotation(treeNode.isExpanded() ? 90 : 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -48,4 +49,5 @@ public class FirstLevelNodeViewBinder extends BaseNodeViewBinder implements Main
|
||||
public void rotateImageView() {
|
||||
imageView.animate().rotation(90).setDuration(200).start();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,8 +1,10 @@
|
||||
package ru.volgorobot.vrcatalog.nodeViewBinders;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import me.texy.treeview.TreeNode;
|
||||
|
@ -1,7 +1,9 @@
|
||||
package ru.volgorobot.vrcatalog.nodeViewBinders;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.view.View;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import me.texy.treeview.TreeNode;
|
||||
|
@ -1,83 +0,0 @@
|
||||
package ru.volgorobot.vrcatalog.presenters;
|
||||
|
||||
import android.content.ContentValues;
|
||||
import android.content.Context;
|
||||
import android.database.Cursor;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import ru.volgorobot.vrcatalog.additional.DatabaseProperties;
|
||||
import ru.volgorobot.vrcatalog.additional.SqliteHelper;
|
||||
import ru.volgorobot.vrcatalog.model.FavoritesListModel;
|
||||
|
||||
public class FavoritesDBPresenter {
|
||||
private SqliteHelper mHelper;
|
||||
private SQLiteDatabase mDB;
|
||||
|
||||
public FavoritesDBPresenter(Context context) {
|
||||
this.mHelper = new SqliteHelper(context);
|
||||
this.mDB = mHelper.getWritableDatabase();
|
||||
}
|
||||
|
||||
public ArrayList<FavoritesListModel> selectAll() {
|
||||
ArrayList<FavoritesListModel> models = new ArrayList<>();
|
||||
|
||||
String[] columns = {
|
||||
DatabaseProperties.FAVORITES_COLUMN_ID,
|
||||
DatabaseProperties.FAVORITES_COLUMN_ITEM_ID,
|
||||
DatabaseProperties.FAVORITES_COLUMN_ITEM_NAME
|
||||
};
|
||||
|
||||
Cursor cursor = mDB.query(DatabaseProperties.FAVORITES_TABLE_NAME, columns, null, null, null, null, null);
|
||||
|
||||
if(cursor == null)
|
||||
return new ArrayList<>();
|
||||
|
||||
while(cursor.moveToNext()) {
|
||||
models.add(new FavoritesListModel(
|
||||
cursor.getInt(cursor.getColumnIndex(DatabaseProperties.FAVORITES_COLUMN_ID)),
|
||||
cursor.getInt(cursor.getColumnIndex(DatabaseProperties.FAVORITES_COLUMN_ITEM_ID)),
|
||||
cursor.getString(cursor.getColumnIndex(DatabaseProperties.FAVORITES_COLUMN_ITEM_NAME))));
|
||||
}
|
||||
|
||||
cursor.close();
|
||||
|
||||
return models;
|
||||
}
|
||||
|
||||
public void add(FavoritesListModel model) {
|
||||
ContentValues contentValues = new ContentValues();
|
||||
contentValues.put(DatabaseProperties.FAVORITES_COLUMN_ITEM_ID, model.getItemID());
|
||||
contentValues.put(DatabaseProperties.FAVORITES_COLUMN_ITEM_NAME, model.getItemName());
|
||||
mDB.insert(DatabaseProperties.FAVORITES_TABLE_NAME, null, contentValues);
|
||||
}
|
||||
|
||||
public void removeItem(int id) {
|
||||
mDB.delete(DatabaseProperties.FAVORITES_TABLE_NAME, "_id = " + id, null);
|
||||
}
|
||||
|
||||
public boolean inFavoritesList(int itemID) {
|
||||
String[] columns = { DatabaseProperties.FAVORITES_COLUMN_ITEM_ID };
|
||||
String[] selectionArgs = { Integer.toString(itemID) };
|
||||
Cursor cursor = mDB.query(DatabaseProperties.FAVORITES_TABLE_NAME, columns, DatabaseProperties.FAVORITES_COLUMN_ITEM_ID + " = ?", selectionArgs, null, null, null);
|
||||
while(cursor.moveToNext()) {
|
||||
if(cursor.getInt(cursor.getColumnIndex(DatabaseProperties.FAVORITES_COLUMN_ITEM_ID)) == itemID)
|
||||
return true;
|
||||
}
|
||||
cursor.close();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public int getFavoriteID(int itemID) {
|
||||
String[] columns = { DatabaseProperties.FAVORITES_COLUMN_ID, DatabaseProperties.FAVORITES_COLUMN_ITEM_ID };
|
||||
Cursor cursor = mDB.query(DatabaseProperties.FAVORITES_TABLE_NAME, columns, DatabaseProperties.FAVORITES_COLUMN_ITEM_ID + " = " + Integer.toString(itemID), null, null, null, null);
|
||||
int id = 0;
|
||||
if( cursor != null && cursor.moveToFirst() ){
|
||||
id = cursor.getInt(cursor.getColumnIndex(DatabaseProperties.FAVORITES_COLUMN_ID));
|
||||
cursor.close();
|
||||
}
|
||||
return id;
|
||||
}
|
||||
}
|
@ -1,16 +1,21 @@
|
||||
package ru.volgorobot.vrcatalog.presenters;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.AsyncTask;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import androidx.room.Room;
|
||||
import ru.volgorobot.vrcatalog.App;
|
||||
import ru.volgorobot.vrcatalog.MainContract;
|
||||
import ru.volgorobot.vrcatalog.additional.DatabaseHelper;
|
||||
import ru.volgorobot.vrcatalog.additional.NetworkErrorException;
|
||||
import ru.volgorobot.vrcatalog.additional.ResultWithErrorCode;
|
||||
import ru.volgorobot.vrcatalog.model.CoreModel;
|
||||
import ru.volgorobot.vrcatalog.model.DetailModel;
|
||||
import ru.volgorobot.vrcatalog.model.FavoritesModel;
|
||||
import ru.volgorobot.vrcatalog.view.FavoritesActivity;
|
||||
import ru.volgorobot.vrcatalog.view.ItemActivity;
|
||||
|
||||
@ -18,13 +23,16 @@ public class FavoritesPresenter implements MainContract.FavoritesPresenter {
|
||||
private Context mContext;
|
||||
private MainContract.MainModel mainModel;
|
||||
private MainContract.FavoritesActivityView mView;
|
||||
private DatabaseHelper db;
|
||||
|
||||
public FavoritesPresenter(Context context, FavoritesActivity view) {
|
||||
this.mContext = context;
|
||||
this.mainModel = new CoreModel(context);
|
||||
public FavoritesPresenter(FavoritesActivity view) {
|
||||
this.mContext = App.getContext();
|
||||
this.mainModel = new CoreModel(mContext);
|
||||
this.mView = view;
|
||||
this.db = App.getDatabaseInstance();
|
||||
}
|
||||
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
@Override
|
||||
public void fetchItem(int itemID) {
|
||||
new AsyncTask<Integer, Void, ResultWithErrorCode<DetailModel>>() {
|
||||
@ -59,19 +67,30 @@ public class FavoritesPresenter implements MainContract.FavoritesPresenter {
|
||||
break;
|
||||
}
|
||||
case 1: {
|
||||
mView.onFailruleAnswer(1);
|
||||
mView.onFailureAnswer(1);
|
||||
break;
|
||||
}
|
||||
case 2: {
|
||||
mView.onFailruleAnswer(2);
|
||||
mView.onFailureAnswer(2);
|
||||
break;
|
||||
}
|
||||
case 3: {
|
||||
mView.onFailruleAnswer(3);
|
||||
mView.onFailureAnswer(3);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}.execute(itemID);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getAllItems() {
|
||||
mView.updateListView((ArrayList<FavoritesModel>) db.getFavoritesDaoModel().getAll());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeItem(int id) {
|
||||
db.getFavoritesDaoModel().remove(id);
|
||||
mView.updateListView((ArrayList<FavoritesModel>) db.getFavoritesDaoModel().getAll());
|
||||
}
|
||||
}
|
||||
|
@ -15,21 +15,27 @@ import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.UUID;
|
||||
|
||||
import androidx.room.Room;
|
||||
import ru.volgorobot.vrcatalog.App;
|
||||
import ru.volgorobot.vrcatalog.MainContract;
|
||||
import ru.volgorobot.vrcatalog.additional.DatabaseHelper;
|
||||
import ru.volgorobot.vrcatalog.additional.NetworkErrorException;
|
||||
import ru.volgorobot.vrcatalog.additional.ResultWithErrorCode;
|
||||
import ru.volgorobot.vrcatalog.model.CoreModel;
|
||||
import ru.volgorobot.vrcatalog.model.FavoritesModel;
|
||||
import ru.volgorobot.vrcatalog.model.ImageItemModel;
|
||||
|
||||
public class ItemPresenter implements MainContract.ItemPresenter {
|
||||
private MainContract.ItemView mView;
|
||||
private Context context;
|
||||
private MainContract.MainModel coreModel;
|
||||
private DatabaseHelper db;
|
||||
|
||||
public ItemPresenter(Context context, MainContract.ItemView itemView) {
|
||||
public ItemPresenter(MainContract.ItemView itemView) {
|
||||
this.mView = itemView;
|
||||
this.context = context;
|
||||
this.context = App.getContext();
|
||||
this.coreModel = new CoreModel(context);
|
||||
this.db = App.getDatabaseInstance();
|
||||
}
|
||||
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
@ -101,4 +107,27 @@ public class ItemPresenter implements MainContract.ItemPresenter {
|
||||
}
|
||||
return Uri.fromFile(cacheObject);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkFavoriteListed(int itemID) {
|
||||
return db.getFavoritesDaoModel().getFavoriteByItemID(itemID).size() != 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFavoriteID(int itemID) {
|
||||
ArrayList<FavoritesModel> models = (ArrayList<FavoritesModel>) db.getFavoritesDaoModel().getFavoriteByItemID(itemID);
|
||||
if(models.size() != 0)
|
||||
return models.get(0).getID();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addToFavorites(int itemID, String itemName) {
|
||||
db.getFavoritesDaoModel().add(new FavoritesModel(itemID, itemName));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeFromFavorites(int favID) {
|
||||
db.getFavoritesDaoModel().remove(favID);
|
||||
}
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ public class ViewBinderPresenter implements MainContract.LevelLoaderPresenter {
|
||||
|
||||
@Override
|
||||
public void fetchSecondLevel(FirstLevelModel firstLevelModel, TreeNode treeNode) {
|
||||
new AsyncTask<FirstLevelModel, Void, ResultWithErrorCode<ArrayList<SecondLevelModel>>>() {
|
||||
new AsyncTask<FirstLevelModel, Void, ResultWithErrorCode<ArrayList<TreeNode>>>() {
|
||||
@Override
|
||||
protected void onPreExecute() {
|
||||
super.onPreExecute();
|
||||
@ -40,31 +40,32 @@ public class ViewBinderPresenter implements MainContract.LevelLoaderPresenter {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResultWithErrorCode<ArrayList<SecondLevelModel>> doInBackground(FirstLevelModel... firstLevelModel) {
|
||||
protected ResultWithErrorCode<ArrayList<TreeNode>> doInBackground(FirstLevelModel... firstLevelModel) {
|
||||
ArrayList<SecondLevelModel> secondLevelModels = null;
|
||||
ArrayList<TreeNode> treeNodes = new ArrayList<>();
|
||||
try {
|
||||
secondLevelModels = coreModel.fetchSecondLevelByParentID(firstLevelModel[0].getID());
|
||||
} catch (NetworkErrorException networkErrorException) {
|
||||
return new ResultWithErrorCode<>(secondLevelModels, networkErrorException.getErrorCode());
|
||||
return new ResultWithErrorCode<>(null, networkErrorException.getErrorCode());
|
||||
} catch (NullPointerException nullPointerException) {
|
||||
return new ResultWithErrorCode<>(secondLevelModels, 3);
|
||||
return new ResultWithErrorCode<>(null, 3);
|
||||
}
|
||||
|
||||
return new ResultWithErrorCode<>(secondLevelModels, 0);
|
||||
for (int i = 0; i < secondLevelModels.size(); i++) {
|
||||
TreeNode treeNode = new TreeNode(secondLevelModels.get(i));
|
||||
treeNode.setLevel(1);
|
||||
treeNodes.add(treeNode);
|
||||
}
|
||||
|
||||
return new ResultWithErrorCode<>(treeNodes, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(ResultWithErrorCode<ArrayList<SecondLevelModel>> result) {
|
||||
protected void onPostExecute(ResultWithErrorCode<ArrayList<TreeNode>> result) {
|
||||
super.onPostExecute(result);
|
||||
switch (result.getErrorCode()) {
|
||||
case 0: {
|
||||
ArrayList<TreeNode> treeNodes = new ArrayList<>();
|
||||
for (int i = 0; i < result.getData().size(); i++) {
|
||||
TreeNode treeNode1 = new TreeNode(result.getData().get(i));
|
||||
treeNode1.setLevel(1);
|
||||
treeNodes.add(treeNode1);
|
||||
}
|
||||
treeNode.setChildren(treeNodes);
|
||||
treeNode.setChildren(result.getData());
|
||||
mView.refreshTree();
|
||||
viewBinder.rotateImageView();
|
||||
break;
|
||||
@ -89,7 +90,7 @@ public class ViewBinderPresenter implements MainContract.LevelLoaderPresenter {
|
||||
|
||||
@Override
|
||||
public void fetchThirdLevel(SecondLevelModel secondLevelModel, TreeNode treeNode) {
|
||||
new AsyncTask<SecondLevelModel, Void, ResultWithErrorCode<ArrayList<ThirdLevelModel>>>() {
|
||||
new AsyncTask<SecondLevelModel, Void, ResultWithErrorCode<ArrayList<TreeNode>>>() {
|
||||
@Override
|
||||
protected void onPreExecute() {
|
||||
super.onPreExecute();
|
||||
@ -97,30 +98,32 @@ public class ViewBinderPresenter implements MainContract.LevelLoaderPresenter {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResultWithErrorCode<ArrayList<ThirdLevelModel>> doInBackground(SecondLevelModel... secondLevelModel) {
|
||||
protected ResultWithErrorCode<ArrayList<TreeNode>> doInBackground(SecondLevelModel... secondLevelModel) {
|
||||
ArrayList<ThirdLevelModel> thirdLevelModels = null;
|
||||
ArrayList<TreeNode> treeNodes = new ArrayList<>();
|
||||
try {
|
||||
thirdLevelModels = coreModel.fetchThirdLevelByParentID(secondLevelModel[0].getID());
|
||||
} catch (NetworkErrorException networkErrorException) {
|
||||
return new ResultWithErrorCode<>(thirdLevelModels, networkErrorException.getErrorCode());
|
||||
return new ResultWithErrorCode<>(null, networkErrorException.getErrorCode());
|
||||
} catch (NullPointerException nullPointerException) {
|
||||
return new ResultWithErrorCode<>(thirdLevelModels, 3);
|
||||
return new ResultWithErrorCode<>(null, 3);
|
||||
}
|
||||
return new ResultWithErrorCode<>(thirdLevelModels, 0);
|
||||
|
||||
for (int i = 0; i < thirdLevelModels.size(); i++) {
|
||||
TreeNode treeNode1 = new TreeNode(thirdLevelModels.get(i));
|
||||
treeNode1.setLevel(2);
|
||||
treeNodes.add(treeNode1);
|
||||
}
|
||||
|
||||
return new ResultWithErrorCode<>(treeNodes, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(ResultWithErrorCode<ArrayList<ThirdLevelModel>> result) {
|
||||
protected void onPostExecute(ResultWithErrorCode<ArrayList<TreeNode>> result) {
|
||||
super.onPostExecute(result);
|
||||
switch (result.getErrorCode()) {
|
||||
case 0: {
|
||||
ArrayList<TreeNode> treeNodes = new ArrayList<>();
|
||||
for (int i = 0; i < result.getData().size(); i++) {
|
||||
TreeNode treeNode1 = new TreeNode(result.getData().get(i));
|
||||
treeNode1.setLevel(2);
|
||||
treeNodes.add(treeNode1);
|
||||
}
|
||||
treeNode.setChildren(treeNodes);
|
||||
treeNode.setChildren(result.getData());
|
||||
mView.refreshTree();
|
||||
viewBinder.rotateImageView();
|
||||
break;
|
||||
|
@ -1,18 +1,21 @@
|
||||
package ru.volgorobot.vrcatalog.searchNodeViewBinders;
|
||||
|
||||
import android.graphics.Color;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import me.texy.treeview.TreeNode;
|
||||
import me.texy.treeview.base.BaseNodeViewBinder;
|
||||
import ru.volgorobot.vrcatalog.MainContract;
|
||||
import ru.volgorobot.vrcatalog.R;
|
||||
|
||||
public class FirstLevelNodeViewBinder extends BaseNodeViewBinder {
|
||||
TextView textView;
|
||||
ImageView imageView;
|
||||
|
||||
public FirstLevelNodeViewBinder(View itemView) {
|
||||
public FirstLevelNodeViewBinder(View itemView, MainContract.MainActivityView mView) {
|
||||
super(itemView);
|
||||
textView = (TextView) itemView.findViewById(R.id.node_name_view);
|
||||
imageView = (ImageView) itemView.findViewById(R.id.arrow_img);
|
||||
@ -26,6 +29,7 @@ public class FirstLevelNodeViewBinder extends BaseNodeViewBinder {
|
||||
@Override
|
||||
public void bindView(TreeNode treeNode) {
|
||||
textView.setText(treeNode.getValue().toString());
|
||||
imageView.setRotation(treeNode.isExpanded() ? 90 : 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,18 +1,21 @@
|
||||
package ru.volgorobot.vrcatalog.searchNodeViewBinders;
|
||||
|
||||
import android.graphics.Color;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import me.texy.treeview.TreeNode;
|
||||
import me.texy.treeview.base.BaseNodeViewBinder;
|
||||
import ru.volgorobot.vrcatalog.MainContract;
|
||||
import ru.volgorobot.vrcatalog.R;
|
||||
|
||||
public class SecondLevelNodeViewBinder extends BaseNodeViewBinder {
|
||||
TextView textView;
|
||||
ImageView imageView;
|
||||
|
||||
public SecondLevelNodeViewBinder(View itemView) {
|
||||
public SecondLevelNodeViewBinder(View itemView, MainContract.MainActivityView mView) {
|
||||
super(itemView);
|
||||
textView = (TextView) itemView.findViewById(R.id.node_name_view);
|
||||
imageView = (ImageView) itemView.findViewById(R.id.arrow_img);
|
||||
@ -26,6 +29,7 @@ public class SecondLevelNodeViewBinder extends BaseNodeViewBinder {
|
||||
@Override
|
||||
public void bindView(TreeNode treeNode) {
|
||||
textView.setText(treeNode.getValue().toString());
|
||||
imageView.setRotation(treeNode.isExpanded() ? 90 : 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,7 +1,7 @@
|
||||
package ru.volgorobot.vrcatalog.view;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import android.view.MenuItem;
|
||||
|
||||
import ru.volgorobot.vrcatalog.R;
|
||||
|
@ -1,8 +1,8 @@
|
||||
package ru.volgorobot.vrcatalog.view;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.support.v7.app.ActionBar;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import androidx.appcompat.app.ActionBar;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.ContextMenu;
|
||||
@ -19,12 +19,10 @@ import java.util.ArrayList;
|
||||
import ru.volgorobot.vrcatalog.MainContract;
|
||||
import ru.volgorobot.vrcatalog.R;
|
||||
import ru.volgorobot.vrcatalog.additional.adapters.FavoritesListAdapter;
|
||||
import ru.volgorobot.vrcatalog.model.FavoritesListModel;
|
||||
import ru.volgorobot.vrcatalog.presenters.FavoritesDBPresenter;
|
||||
import ru.volgorobot.vrcatalog.model.FavoritesModel;
|
||||
import ru.volgorobot.vrcatalog.presenters.FavoritesPresenter;
|
||||
|
||||
public class FavoritesActivity extends AppCompatActivity implements MainContract.FavoritesActivityView {
|
||||
private FavoritesDBPresenter db;
|
||||
private FavoritesListAdapter adapter;
|
||||
private MainContract.FavoritesPresenter mPresenter;
|
||||
|
||||
@ -37,15 +35,13 @@ public class FavoritesActivity extends AppCompatActivity implements MainContract
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_favorites);
|
||||
|
||||
mPresenter = new FavoritesPresenter(FavoritesActivity.this, this);
|
||||
mPresenter = new FavoritesPresenter(this);
|
||||
|
||||
ActionBar actionBar = getSupportActionBar();
|
||||
actionBar.setDisplayHomeAsUpEnabled(true);
|
||||
actionBar.setHomeButtonEnabled(true);
|
||||
actionBar.setTitle("Избранное");
|
||||
|
||||
db = new FavoritesDBPresenter(FavoritesActivity.this);
|
||||
|
||||
initViews();
|
||||
}
|
||||
|
||||
@ -55,16 +51,14 @@ public class FavoritesActivity extends AppCompatActivity implements MainContract
|
||||
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
|
||||
FavoritesListModel model = (FavoritesListModel) listView.getItemAtPosition(i);
|
||||
FavoritesModel model = (FavoritesModel) listView.getItemAtPosition(i);
|
||||
mPresenter.fetchItem(model.getItemID());
|
||||
}
|
||||
});
|
||||
adapter = new FavoritesListAdapter(FavoritesActivity.this, android.R.layout.simple_list_item_1, new ArrayList<>());
|
||||
listView.setAdapter(adapter);
|
||||
favoritesEmptyImage = findViewById(R.id.favorites_empty_image);
|
||||
favoritesEmptyText = findViewById(R.id.favorites_empty_text);
|
||||
ArrayList<FavoritesListModel> models = db.selectAll();
|
||||
adapter = new FavoritesListAdapter(FavoritesActivity.this, android.R.layout.simple_list_item_1, models);
|
||||
listView.setAdapter(adapter);
|
||||
checkForEmptyContent();
|
||||
}
|
||||
|
||||
public void checkForEmptyContent() {
|
||||
@ -84,17 +78,18 @@ public class FavoritesActivity extends AppCompatActivity implements MainContract
|
||||
AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo();
|
||||
switch (item.getItemId()) {
|
||||
case 0: {
|
||||
FavoritesListModel model = (FavoritesListModel) listView.getItemAtPosition(info.position);
|
||||
db.removeItem(model.getID());
|
||||
updateListView();
|
||||
FavoritesModel model = (FavoritesModel) listView.getItemAtPosition(info.position);
|
||||
mPresenter.removeItem(model.getID());
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void updateListView() {
|
||||
adapter.updateData();
|
||||
@Override
|
||||
public void updateListView(ArrayList<FavoritesModel> data) {
|
||||
adapter.updateData(data);
|
||||
adapter.notifyDataSetChanged();
|
||||
checkForEmptyContent();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -115,7 +110,7 @@ public class FavoritesActivity extends AppCompatActivity implements MainContract
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailruleAnswer(int errorCode) {
|
||||
public void onFailureAnswer(int errorCode) {
|
||||
switch (errorCode) {
|
||||
case 1: {
|
||||
Toast.makeText(FavoritesActivity.this, "Ошибка сети. Проверьте подключение к сети или данные подключения к API!", Toast.LENGTH_LONG).show();
|
||||
@ -143,7 +138,6 @@ public class FavoritesActivity extends AppCompatActivity implements MainContract
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
updateListView();
|
||||
checkForEmptyContent();
|
||||
mPresenter.getAllItems();
|
||||
}
|
||||
}
|
||||
|
@ -4,11 +4,11 @@ import android.graphics.Color;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v4.view.ViewPager;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.viewpager.widget.ViewPager;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
|
@ -4,10 +4,11 @@ import android.content.Intent;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
import android.support.design.widget.TabLayout;
|
||||
import android.support.v4.view.ViewPager;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import com.google.android.material.tabs.TabLayout;
|
||||
|
||||
import androidx.viewpager.widget.ViewPager;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import android.util.Log;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
@ -17,10 +18,7 @@ import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import ru.volgorobot.vrcatalog.model.FavoritesListModel;
|
||||
import ru.volgorobot.vrcatalog.presenters.FavoritesDBPresenter;
|
||||
import ru.volgorobot.vrcatalog.presenters.ItemPresenter;
|
||||
import ru.volgorobot.vrcatalog.MainContract;
|
||||
import ru.volgorobot.vrcatalog.R;
|
||||
@ -33,9 +31,9 @@ public class ItemActivity extends AppCompatActivity implements MainContract.Item
|
||||
private ListView propertiesList;
|
||||
private ImagePagerAdapter imagePagerAdapter;
|
||||
private boolean inFavorites;
|
||||
private FavoritesDBPresenter db;
|
||||
private int itemID;
|
||||
private String itemName;
|
||||
private int favoriteID;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
@ -47,7 +45,7 @@ public class ItemActivity extends AppCompatActivity implements MainContract.Item
|
||||
getSupportActionBar().setHomeButtonEnabled(true);
|
||||
getSupportActionBar().setDisplayShowTitleEnabled(false);
|
||||
initializeViews();
|
||||
mPresenter = new ItemPresenter(ItemActivity.this, this);
|
||||
mPresenter = new ItemPresenter(this);
|
||||
Intent intent = getIntent();
|
||||
|
||||
itemName = intent.getStringExtra("detailName");
|
||||
@ -63,7 +61,6 @@ public class ItemActivity extends AppCompatActivity implements MainContract.Item
|
||||
LinkedHashMap<String, String> intentDataForListView = getIntentExtras(intent);
|
||||
itemID = Integer.parseInt(intent.getStringExtra("itemID"));
|
||||
intentDataForListView.get("detailName");
|
||||
db = new FavoritesDBPresenter(ItemActivity.this);
|
||||
|
||||
propertiesList = findViewById(R.id.propertiesList);
|
||||
PropertiesListAdapter propertiesListAdapter = new PropertiesListAdapter(intentDataForListView);
|
||||
@ -71,7 +68,8 @@ public class ItemActivity extends AppCompatActivity implements MainContract.Item
|
||||
|
||||
mPresenter.getImagesByItemID(Integer.parseInt(intent.getStringExtra("itemID")));
|
||||
|
||||
inFavorites = db.inFavoritesList(itemID);
|
||||
inFavorites = mPresenter.checkFavoriteListed(itemID);
|
||||
favoriteID = mPresenter.getFavoriteID(itemID);
|
||||
}
|
||||
|
||||
void initializeViews() {
|
||||
@ -229,13 +227,13 @@ public class ItemActivity extends AppCompatActivity implements MainContract.Item
|
||||
MenuItem deleteFromFavorites = menu.findItem(R.id.action_unfavorite);
|
||||
|
||||
addToFavorites.setOnMenuItemClickListener((MenuItem menuItem) -> {
|
||||
db.add(new FavoritesListModel(0, itemID, itemName));
|
||||
mPresenter.addToFavorites(itemID, itemName);
|
||||
inFavorites = true;
|
||||
this.invalidateOptionsMenu();
|
||||
return true;
|
||||
});
|
||||
deleteFromFavorites.setOnMenuItemClickListener((MenuItem menuItem) -> {
|
||||
db.removeItem(db.getFavoriteID(itemID));
|
||||
mPresenter.removeFromFavorites(favoriteID);
|
||||
inFavorites = false;
|
||||
this.invalidateOptionsMenu();
|
||||
return true;
|
||||
|
@ -5,16 +5,15 @@ import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.support.design.widget.NavigationView;
|
||||
import android.support.v4.view.GravityCompat;
|
||||
import android.support.v4.view.MenuItemCompat;
|
||||
import android.support.v4.widget.DrawerLayout;
|
||||
import android.support.v4.widget.SwipeRefreshLayout;
|
||||
import android.support.v7.app.ActionBarDrawerToggle;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.support.v7.widget.DefaultItemAnimator;
|
||||
import android.support.v7.widget.SearchView;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import androidx.drawerlayout.widget.DrawerLayout;
|
||||
import androidx.core.view.GravityCompat;
|
||||
import androidx.core.view.MenuItemCompat;
|
||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||
import androidx.appcompat.app.ActionBarDrawerToggle;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.recyclerview.widget.DefaultItemAnimator;
|
||||
import androidx.appcompat.widget.SearchView;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import android.util.Log;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
@ -25,6 +24,8 @@ import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.google.android.material.navigation.NavigationView;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import me.texy.treeview.TreeNode;
|
||||
@ -205,7 +206,6 @@ public class MainActivity extends AppCompatActivity
|
||||
search.setQueryHint("Имя детали");
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -4,14 +4,13 @@ import android.app.SearchManager;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.provider.SearchRecentSuggestions;
|
||||
import android.support.v4.widget.NestedScrollView;
|
||||
import android.support.v4.widget.SwipeRefreshLayout;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.support.v7.widget.DefaultItemAnimator;
|
||||
import androidx.core.widget.NestedScrollView;
|
||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.recyclerview.widget.DefaultItemAnimator;
|
||||
import android.util.Log;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
@ -35,6 +34,9 @@ public class SearchableActivity extends AppCompatActivity implements MainContrac
|
||||
private ImageView mConnectionErrorImageView;
|
||||
private NestedScrollView mTreeViewContainer;
|
||||
private TextView mErrorTextView;
|
||||
private ImageView mEmptySearchImageView;
|
||||
private TextView mEmptySearchTextView;
|
||||
private boolean isInErrorState = false;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
@ -53,9 +55,12 @@ public class SearchableActivity extends AppCompatActivity implements MainContrac
|
||||
mTreeViewContainer = findViewById(R.id.searchableTreeViewContainer);
|
||||
mErrorTextView = findViewById(R.id.searchableErrorTextView);
|
||||
|
||||
mEmptySearchImageView = findViewById(R.id.emptySearchImage);
|
||||
mEmptySearchTextView = findViewById(R.id.emptySearchText);
|
||||
|
||||
treeView = new TreeView(rootNode, SearchableActivity.this, new SearchableNodeViewFactory(SearchableActivity.this, this));
|
||||
treeView.setItemAnimator(new DefaultItemAnimator());
|
||||
((ViewGroup) findViewById(R.id.searchableTreeViewContainer)).addView(treeView.getView());
|
||||
mTreeViewContainer.addView(treeView.getView());
|
||||
Intent intent = getIntent();
|
||||
if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
|
||||
detailName = intent.getStringExtra(SearchManager.QUERY);
|
||||
@ -72,6 +77,15 @@ public class SearchableActivity extends AppCompatActivity implements MainContrac
|
||||
rootNode.setChildren(children);
|
||||
treeView.expandAll();
|
||||
treeView.refreshTreeView();
|
||||
if(children.size() == 0 && !isInErrorState) {
|
||||
mEmptySearchImageView.setVisibility(View.VISIBLE);
|
||||
mEmptySearchTextView.setVisibility(View.VISIBLE);
|
||||
mTreeViewContainer.setVisibility(View.GONE);
|
||||
} else {
|
||||
mEmptySearchImageView.setVisibility(View.INVISIBLE);
|
||||
mEmptySearchTextView.setVisibility(View.INVISIBLE);
|
||||
mTreeViewContainer.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
public void onFailureAnswer(int errorCode) {
|
||||
@ -84,6 +98,7 @@ public class SearchableActivity extends AppCompatActivity implements MainContrac
|
||||
mTreeViewContainer.setVisibility(View.GONE);
|
||||
mConnectionErrorImageView.setVisibility(View.VISIBLE);
|
||||
mErrorTextView.setVisibility(View.VISIBLE);
|
||||
isInErrorState = true;
|
||||
break;
|
||||
}
|
||||
case 2: {
|
||||
@ -94,6 +109,7 @@ public class SearchableActivity extends AppCompatActivity implements MainContrac
|
||||
mTreeViewContainer.setVisibility(View.GONE);
|
||||
mConnectionErrorImageView.setVisibility(View.VISIBLE);
|
||||
mErrorTextView.setVisibility(View.VISIBLE);
|
||||
isInErrorState = true;
|
||||
break;
|
||||
}
|
||||
case 3: {
|
||||
@ -103,6 +119,7 @@ public class SearchableActivity extends AppCompatActivity implements MainContrac
|
||||
mTreeViewContainer.setVisibility(View.GONE);
|
||||
mConnectionErrorImageView.setVisibility(View.VISIBLE);
|
||||
mErrorTextView.setVisibility(View.VISIBLE);
|
||||
isInErrorState = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -116,6 +133,7 @@ public class SearchableActivity extends AppCompatActivity implements MainContrac
|
||||
rootNode.setChildren(new ArrayList<TreeNode>());
|
||||
treeView.refreshTreeView();
|
||||
searchablePresenter.fetchDetailsTreeByName(detailName);
|
||||
isInErrorState = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
5
app/src/main/res/drawable/ic_clear_gray_24dp.xml
Normal file
5
app/src/main/res/drawable/ic_clear_gray_24dp.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<vector android:height="24dp" android:tint="#D3D3D3"
|
||||
android:viewportHeight="24.0" android:viewportWidth="24.0"
|
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#FF000000" android:pathData="M19,6.41L17.59,5 12,10.59 6.41,5 5,6.41 10.59,12 5,17.59 6.41,19 12,13.41 17.59,19 19,17.59 13.41,12z"/>
|
||||
</vector>
|
@ -1,25 +1,25 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<android.support.design.widget.AppBarLayout
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fitsSystemWindows="true">
|
||||
<android.support.design.widget.CollapsingToolbarLayout
|
||||
<com.google.android.material.appbar.CollapsingToolbarLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_scrollFlags="scroll|enterAlways">
|
||||
|
||||
<android.support.v4.view.ViewPager
|
||||
<androidx.viewpager.widget.ViewPager
|
||||
android:id="@+id/viewPager"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="311dp"
|
||||
app:layout_collapseMode="parallax" />
|
||||
<android.support.design.widget.TabLayout
|
||||
<com.google.android.material.tabs.TabLayout
|
||||
android:id="@+id/tabDots"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="62dp"
|
||||
@ -27,7 +27,7 @@
|
||||
app:tabBackground="@drawable/tab_selector"
|
||||
app:tabGravity="center"
|
||||
app:tabIndicatorHeight="0dp" />
|
||||
<android.support.v7.widget.Toolbar
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
android:id="@+id/itemactivity_toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
@ -35,10 +35,10 @@
|
||||
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
|
||||
android:theme="@style/ItemActionBar"/>
|
||||
|
||||
</android.support.design.widget.CollapsingToolbarLayout>
|
||||
</android.support.design.widget.AppBarLayout>
|
||||
</com.google.android.material.appbar.CollapsingToolbarLayout>
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
<android.support.v4.widget.NestedScrollView
|
||||
<androidx.core.widget.NestedScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="619dp"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
||||
@ -74,5 +74,5 @@
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
||||
android:nestedScrollingEnabled="false"/>
|
||||
</LinearLayout>
|
||||
</android.support.v4.widget.NestedScrollView>
|
||||
</android.support.design.widget.CoordinatorLayout>
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/linearLayout"
|
||||
@ -44,4 +44,4 @@
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/favorites_empty_image" />
|
||||
|
||||
</android.support.constraint.ConstraintLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -9,12 +9,12 @@
|
||||
tools:context="ru.volgorobot.vrcatalog.view.FullScreenImageActivity"
|
||||
android:background="@android:color/black">
|
||||
|
||||
<android.support.v4.view.ViewPager
|
||||
<ru.volgorobot.vrcatalog.additional.HackyViewPager
|
||||
android:id="@+id/fullscreen_mode_viewpager"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<android.support.v7.widget.Toolbar
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<androidx.drawerlayout.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/drawer_layout"
|
||||
@ -13,7 +13,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<android.support.design.widget.NavigationView
|
||||
<com.google.android.material.navigation.NavigationView
|
||||
android:id="@+id/nav_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
@ -22,4 +22,4 @@
|
||||
app:headerLayout="@layout/nav_header_main"
|
||||
app:menu="@menu/activity_main_drawer" />
|
||||
|
||||
</android.support.v4.widget.DrawerLayout>
|
||||
</androidx.drawerlayout.widget.DrawerLayout>
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.v4.widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
@ -10,16 +10,16 @@
|
||||
android:orientation="horizontal"
|
||||
android:id="@+id/searchableSwipeRefreshLayout">
|
||||
|
||||
<android.support.constraint.ConstraintLayout
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<android.support.v4.widget.NestedScrollView
|
||||
<androidx.core.widget.NestedScrollView
|
||||
android:id="@+id/searchableTreeViewContainer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:scrollbarAlwaysDrawVerticalTrack="true">
|
||||
</android.support.v4.widget.NestedScrollView>
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/searchableConnectionErrorImageView"
|
||||
@ -44,11 +44,42 @@
|
||||
android:text=""
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
|
||||
android:visibility="invisible"
|
||||
android:gravity="center"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/searchableConnectionErrorImageView" />
|
||||
|
||||
</android.support.constraint.ConstraintLayout>
|
||||
<ImageView
|
||||
android:id="@+id/emptySearchImage"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginTop="70dp"
|
||||
android:layout_marginBottom="52dp"
|
||||
android:src="@drawable/ic_clear_gray_24dp"
|
||||
android:visibility="invisible"
|
||||
app:layout_constraintBottom_toTopOf="@+id/emptySearchText"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</android.support.v4.widget.SwipeRefreshLayout>
|
||||
<TextView
|
||||
android:id="@+id/emptySearchText"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="77dp"
|
||||
android:layout_marginStart="9dp"
|
||||
android:layout_marginEnd="9dp"
|
||||
android:layout_marginBottom="68dp"
|
||||
android:text="@string/empty_search"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
|
||||
android:visibility="invisible"
|
||||
android:textSize="18sp"
|
||||
android:gravity="center"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/emptySearchImage" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
@ -1,27 +1,27 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".view.MainActivity">
|
||||
|
||||
<android.support.design.widget.AppBarLayout
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:theme="@style/AppTheme.AppBarOverlay">
|
||||
|
||||
<android.support.v7.widget.Toolbar
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
android:background="?attr/colorPrimary"
|
||||
android:theme="@style/CustomSearchStyle"
|
||||
android:theme="@style/MainActivity"
|
||||
app:titleTextColor="@android:color/white"
|
||||
app:popupTheme="@style/AppTheme.PopupOverlay" />
|
||||
|
||||
</android.support.design.widget.AppBarLayout>
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
<include layout="@layout/content_main" />
|
||||
|
||||
</android.support.design.widget.CoordinatorLayout>
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.v4.widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
@ -10,12 +10,12 @@
|
||||
android:orientation="horizontal"
|
||||
android:id="@+id/swipeRefreshLayout">
|
||||
|
||||
<android.support.constraint.ConstraintLayout
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/mainActivityConstraint"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<android.support.v4.widget.NestedScrollView
|
||||
<androidx.core.widget.NestedScrollView
|
||||
android:id="@+id/treeViewContainer"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
@ -27,7 +27,7 @@
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="1.0">
|
||||
|
||||
</android.support.v4.widget.NestedScrollView>
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/connectionErrorImageView"
|
||||
@ -59,6 +59,6 @@
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/connectionErrorImageView" />
|
||||
|
||||
</android.support.constraint.ConstraintLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</android.support.v4.widget.SwipeRefreshLayout>
|
||||
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
@ -1,9 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/parent_node_container_1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="80dp"
|
||||
android:layout_height="50dp"
|
||||
android:background="?android:selectableItemBackground">
|
||||
|
||||
<View android:background="#D3D3D3"
|
||||
android:layout_width = "match_parent"
|
||||
android:layout_height="1dp"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/node_container"
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -1,10 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/parent_node_container_2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="60dp"
|
||||
android:layout_height="50dp"
|
||||
android:orientation="vertical"
|
||||
android:background="?android:selectableItemBackground">
|
||||
|
||||
<View android:background="#D3D3D3"
|
||||
android:layout_width = "match_parent"
|
||||
android:layout_height="1dp"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/node_container"
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -1,10 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/parent_node_container_3"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:background="?android:selectableItemBackground">
|
||||
|
||||
<View android:background="#D3D3D3"
|
||||
android:layout_width = "match_parent"
|
||||
android:layout_height="1dp"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/node_container"
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -5,6 +5,6 @@
|
||||
android:id="@+id/action_search"
|
||||
android:icon="@drawable/ic_search_white_24dp"
|
||||
app:showAsAction="always|collapseActionView"
|
||||
app:actionViewClass="android.support.v7.widget.SearchView"
|
||||
app:actionViewClass="androidx.appcompat.widget.SearchView"
|
||||
android:title="Поиск"/>
|
||||
</menu>
|
||||
|
@ -25,7 +25,9 @@
|
||||
<item name="android:textColorPrimary">@android:color/black</item>
|
||||
<item name="android:textColorSecondary">@android:color/black</item>
|
||||
</style>
|
||||
<style name="CustomSearchStyle" parent="AppTheme">
|
||||
<style name="MainActivity" parent="AppTheme.NoActionBar">
|
||||
<item name="android:editTextColor">@android:color/white</item>
|
||||
<item name="android:textColorHint">@android:color/white</item>
|
||||
<item name="suggestionRowLayout">@layout/light_suggestion_hint</item>
|
||||
<item name="colorControlNormal">@android:color/white</item>
|
||||
<item name="android:colorControlNormal">@android:color/white</item>
|
||||
|
@ -3,4 +3,5 @@
|
||||
<string name="navigation_drawer_open">Open navigation drawer</string>
|
||||
<string name="navigation_drawer_close">Close navigation drawer</string>
|
||||
<string name="favorites_empty">Ваш список избранного пуст</string>
|
||||
<string name="empty_search">По вашему запросу ничего не найдено.</string>
|
||||
</resources>
|
||||
|
@ -8,9 +8,6 @@
|
||||
<style name="MainActivity" parent="AppTheme.NoActionBar">
|
||||
<item name="android:editTextColor">@android:color/white</item>
|
||||
<item name="android:textColorHint">@android:color/white</item>
|
||||
</style>
|
||||
|
||||
<style name="CustomSearchStyle" parent="AppTheme">
|
||||
<item name="suggestionRowLayout">@layout/light_suggestion_hint</item>
|
||||
<item name="colorControlNormal">@android:color/white</item>
|
||||
</style>
|
||||
|
@ -6,6 +6,8 @@
|
||||
# http://www.gradle.org/docs/current/userguide/build_environment.html
|
||||
# Specifies the JVM arguments used for the daemon process.
|
||||
# The setting is particularly useful for tweaking memory settings.
|
||||
android.enableJetifier=true
|
||||
android.useAndroidX=true
|
||||
org.gradle.jvmargs=-Xmx512m
|
||||
# When configured, Gradle will run in incubating parallel mode.
|
||||
# This option should only be used with decoupled projects. More details, visit
|
||||
|
Loading…
Reference in New Issue
Block a user