Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 098828d8d5 | |||
| 56c5100557 | |||
| 6b65ec1bc4 |
@@ -12,8 +12,8 @@ android {
|
|||||||
applicationId "com.anabasis.vkchatmanager"
|
applicationId "com.anabasis.vkchatmanager"
|
||||||
minSdk 26
|
minSdk 26
|
||||||
targetSdk 36
|
targetSdk 36
|
||||||
versionCode 1
|
versionCode 3
|
||||||
versionName "1.0"
|
versionName "1.1.1"
|
||||||
|
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
}
|
}
|
||||||
@@ -25,17 +25,17 @@ android {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
compileOptions {
|
compileOptions {
|
||||||
sourceCompatibility JavaVersion.VERSION_11
|
sourceCompatibility JavaVersion.VERSION_17
|
||||||
targetCompatibility JavaVersion.VERSION_11
|
targetCompatibility JavaVersion.VERSION_17
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
|
||||||
implementation 'androidx.recyclerview:recyclerview:1.3.2'
|
implementation libs.recyclerview
|
||||||
implementation 'androidx.viewpager2:viewpager2:1.1.0'
|
implementation libs.viewpager2
|
||||||
implementation "com.google.android.material:material:1.12.0"
|
implementation libs.material
|
||||||
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0"
|
implementation libs.swiperefreshlayout
|
||||||
implementation 'com.squareup.okhttp3:okhttp:4.12.0'
|
implementation libs.okhttp
|
||||||
implementation 'org.json:json:20240303'
|
implementation libs.json
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,10 +42,13 @@ public class ChatListFragment extends Fragment {
|
|||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
chats = (ArrayList<VkChat>)
|
Bundle arguments = getArguments();
|
||||||
getArguments().getSerializable(ARG_CHATS);
|
if (arguments != null) {
|
||||||
|
chats = (ArrayList<VkChat>) arguments.getSerializable(ARG_CHATS);
|
||||||
|
}
|
||||||
if (chats == null) chats = new ArrayList<>();
|
if (chats == null) chats = new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -90,11 +93,4 @@ public class ChatListFragment extends Fragment {
|
|||||||
if (c.selected) res.add(c);
|
if (c.selected) res.add(c);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateChats() {
|
|
||||||
if (adapter != null) {
|
|
||||||
adapter.notifyDataSetChanged();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,13 +1,17 @@
|
|||||||
package com.anabasis.vkchatmanager;
|
package com.anabasis.vkchatmanager;
|
||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.content.pm.PackageInfo;
|
||||||
|
import android.content.pm.PackageManager;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
import android.text.Editable;
|
import android.text.Editable;
|
||||||
import android.text.TextWatcher;
|
import android.text.TextWatcher;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import androidx.activity.result.ActivityResultLauncher;
|
import androidx.activity.result.ActivityResultLauncher;
|
||||||
@@ -188,6 +192,11 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (id == R.id.action_about) {
|
||||||
|
showAboutDialog();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (id == R.id.action_sign_out) {
|
if (id == R.id.action_sign_out) {
|
||||||
TokenManager.clear(this);
|
TokenManager.clear(this);
|
||||||
recreate();
|
recreate();
|
||||||
@@ -207,6 +216,30 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
/* ===================== UI ===================== */
|
/* ===================== UI ===================== */
|
||||||
|
|
||||||
|
private void showAboutDialog() {
|
||||||
|
View dialogView = LayoutInflater.from(this).inflate(R.layout.dialog_about, null);
|
||||||
|
|
||||||
|
TextView appNameVersion = dialogView.findViewById(R.id.app_name_version);
|
||||||
|
TextView appDescription = dialogView.findViewById(R.id.app_description);
|
||||||
|
TextView appCreator = dialogView.findViewById(R.id.app_creator);
|
||||||
|
|
||||||
|
try {
|
||||||
|
PackageInfo pInfo = getPackageManager().getPackageInfo(getPackageName(), 0);
|
||||||
|
String version = pInfo.versionName;
|
||||||
|
appNameVersion.setText(getString(R.string.app_name_version_format, getString(R.string.app_name), version));
|
||||||
|
} catch (PackageManager.NameNotFoundException e) {
|
||||||
|
appNameVersion.setText(getString(R.string.app_name));
|
||||||
|
}
|
||||||
|
|
||||||
|
appDescription.setText(R.string.about_description);
|
||||||
|
appCreator.setText(R.string.about_creator);
|
||||||
|
|
||||||
|
new MaterialAlertDialogBuilder(this)
|
||||||
|
.setView(dialogView)
|
||||||
|
.setPositiveButton(R.string.ok_button, null)
|
||||||
|
.show();
|
||||||
|
}
|
||||||
|
|
||||||
private void showTokenStatus() {
|
private void showTokenStatus() {
|
||||||
long exp = TokenManager.expiration(this);
|
long exp = TokenManager.expiration(this);
|
||||||
String message;
|
String message;
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package com.anabasis.vkchatmanager.dialogs;
|
|||||||
|
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.LayoutInflater;
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
|
|
||||||
@@ -33,7 +32,7 @@ public class MultiLinkDialog extends DialogFragment {
|
|||||||
@Override
|
@Override
|
||||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||||
|
|
||||||
View view = LayoutInflater.from(requireContext()).inflate(R.layout.dialog_multilink, null);
|
View view = getLayoutInflater().inflate(R.layout.dialog_multilink, null);
|
||||||
EditText input = view.findViewById(R.id.linksInput);
|
EditText input = view.findViewById(R.id.linksInput);
|
||||||
|
|
||||||
return new MaterialAlertDialogBuilder(requireContext())
|
return new MaterialAlertDialogBuilder(requireContext())
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ public class VkApiClient {
|
|||||||
"&v=5.131";
|
"&v=5.131";
|
||||||
|
|
||||||
Request r = new Request.Builder().url(url).build();
|
Request r = new Request.Builder().url(url).build();
|
||||||
Response res = client.newCall(r).execute();
|
try (Response res = client.newCall(r).execute()) {
|
||||||
|
|
||||||
String body = res.body().string();
|
String body = res.body().string();
|
||||||
JSONObject json = new JSONObject(body);
|
JSONObject json = new JSONObject(body);
|
||||||
@@ -38,6 +38,7 @@ public class VkApiClient {
|
|||||||
|
|
||||||
return json;
|
return json;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public JSONArray getChats() throws Exception {
|
public JSONArray getChats() throws Exception {
|
||||||
return call("messages.getConversations", "count=200&filter=all")
|
return call("messages.getConversations", "count=200&filter=all")
|
||||||
|
|||||||
@@ -121,7 +121,9 @@
|
|||||||
<androidx.viewpager2.widget.ViewPager2
|
<androidx.viewpager2.widget.ViewPager2
|
||||||
android:id="@+id/pager"
|
android:id="@+id/pager"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent" />
|
android:layout_height="match_parent"
|
||||||
|
android:paddingStart="16dp"
|
||||||
|
android:paddingEnd="16dp" />
|
||||||
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|||||||
40
app/src/main/res/layout/dialog_about.xml
Normal file
40
app/src/main/res/layout/dialog_about.xml
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:padding="24dp"
|
||||||
|
android:gravity="center_horizontal">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/app_icon"
|
||||||
|
android:layout_width="72dp"
|
||||||
|
android:layout_height="72dp"
|
||||||
|
android:src="@mipmap/ic_launcher_round"
|
||||||
|
android:contentDescription="@string/app_name" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/app_name_version"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
android:textAppearance="?attr/textAppearanceTitleLarge"
|
||||||
|
tools:text="VK Chat Manager v1.0" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/app_description"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:textAppearance="?attr/textAppearanceBodyMedium" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/app_creator"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="24dp"
|
||||||
|
android:textAppearance="?attr/textAppearanceBodySmall" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
@@ -15,6 +15,9 @@
|
|||||||
<item
|
<item
|
||||||
android:id="@+id/action_token_status"
|
android:id="@+id/action_token_status"
|
||||||
android:title="@string/action_token_status" />
|
android:title="@string/action_token_status" />
|
||||||
|
<item
|
||||||
|
android:id="@+id/action_about"
|
||||||
|
android:title="@string/action_about" />
|
||||||
<item
|
<item
|
||||||
android:id="@+id/action_sign_out"
|
android:id="@+id/action_sign_out"
|
||||||
android:title="@string/action_sign_out" />
|
android:title="@string/action_sign_out" />
|
||||||
|
|||||||
@@ -42,5 +42,9 @@
|
|||||||
<string name="op_failure_format">❌ %1$s в %2$s: %3$s</string>
|
<string name="op_failure_format">❌ %1$s в %2$s: %3$s</string>
|
||||||
<string name="action_sign_out">Выйти</string>
|
<string name="action_sign_out">Выйти</string>
|
||||||
<string name="api_error">Ошибка API: %s</string>
|
<string name="api_error">Ошибка API: %s</string>
|
||||||
|
<string name="action_about">О приложении</string>
|
||||||
<string name="token_expired_message">Ваша сессия истекла. Пожалуйста, войдите снова.</string>
|
<string name="token_expired_message">Ваша сессия истекла. Пожалуйста, войдите снова.</string>
|
||||||
|
<string name="app_name_version_format">%1$s v%2$s</string>
|
||||||
|
<string name="about_description">Это приложение предназначено для управления чатами ВКонтакте.</string>
|
||||||
|
<string name="about_creator">Создатель: Александр Денисов</string>
|
||||||
</resources>
|
</resources>
|
||||||
@@ -42,5 +42,9 @@
|
|||||||
<string name="op_failure_format">❌ %1$s in %2$s: %3$s</string>
|
<string name="op_failure_format">❌ %1$s in %2$s: %3$s</string>
|
||||||
<string name="action_sign_out">Sign Out</string>
|
<string name="action_sign_out">Sign Out</string>
|
||||||
<string name="api_error">API error: %s</string>
|
<string name="api_error">API error: %s</string>
|
||||||
|
<string name="action_about">About</string>
|
||||||
<string name="token_expired_message">Your session has expired. Please log in again.</string>
|
<string name="token_expired_message">Your session has expired. Please log in again.</string>
|
||||||
|
<string name="app_name_version_format">%1$s v%2$s</string>
|
||||||
|
<string name="about_description">This application is designed for managing VK chats.</string>
|
||||||
|
<string name="about_creator">Created by: Alex Denisov</string>
|
||||||
</resources>
|
</resources>
|
||||||
@@ -1,20 +1,20 @@
|
|||||||
[versions]
|
[versions]
|
||||||
agp = "9.0.0"
|
agp = "9.0.0"
|
||||||
coreKtx = "1.17.0"
|
|
||||||
junit = "4.13.2"
|
|
||||||
junitVersion = "1.3.0"
|
|
||||||
espressoCore = "3.7.0"
|
|
||||||
appcompat = "1.7.1"
|
|
||||||
material = "1.13.0"
|
material = "1.13.0"
|
||||||
|
recyclerview = "1.4.0"
|
||||||
|
viewpager2 = "1.1.0"
|
||||||
|
swiperefreshlayout = "1.2.0"
|
||||||
|
okhttp = "5.3.2"
|
||||||
|
json = "20251224"
|
||||||
|
|
||||||
[libraries]
|
[libraries]
|
||||||
androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
|
|
||||||
junit = { group = "junit", name = "junit", version.ref = "junit" }
|
|
||||||
androidx-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitVersion" }
|
|
||||||
androidx-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCore" }
|
|
||||||
androidx-appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "appcompat" }
|
|
||||||
material = { group = "com.google.android.material", name = "material", version.ref = "material" }
|
material = { group = "com.google.android.material", name = "material", version.ref = "material" }
|
||||||
|
recyclerview = { group = "androidx.recyclerview", name = "recyclerview", version.ref = "recyclerview" }
|
||||||
|
viewpager2 = { group = "androidx.viewpager2", name = "viewpager2", version.ref = "viewpager2" }
|
||||||
|
swiperefreshlayout = { group = "androidx.swiperefreshlayout", name = "swiperefreshlayout", version.ref = "swiperefreshlayout" }
|
||||||
|
okhttp = { group = "com.squareup.okhttp3", name = "okhttp", version.ref = "okhttp" }
|
||||||
|
json = { group = "org.json", name = "json", version.ref = "json" }
|
||||||
|
|
||||||
|
|
||||||
[plugins]
|
[plugins]
|
||||||
android-application = { id = "com.android.application", version.ref = "agp" }
|
android-application = { id = "com.android.application", version.ref = "agp" }
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ pluginManagement {
|
|||||||
gradlePluginPortal()
|
gradlePluginPortal()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencyResolutionManagement {
|
dependencyResolutionManagement {
|
||||||
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
|
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
|
||||||
repositories {
|
repositories {
|
||||||
|
|||||||
Reference in New Issue
Block a user