Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
8a8564c
Remove experimental features
tretdm Apr 16, 2024
962f432
Update DebugMenuActivity.java
tretdm Apr 16, 2024
74bb4dc
fix(auth): Gap when using `minvk.ru` proxy
tretdm Apr 16, 2024
8b2607e
Update OvkAPIReceiver.java
tretdm Apr 16, 2024
8ead44d
Update OvkAPIReceiver.java
tretdm Apr 16, 2024
bc3c005
fix(auth): Finally
tretdm Apr 16, 2024
2200c9f
Update AuthActivity.java
tretdm Apr 16, 2024
794b1a2
fix(auth): 2FA for `minvk.ru` proxy
tretdm Apr 16, 2024
32315e4
Update Authorization.java
tretdm Apr 16, 2024
a63e511
fix(auth): Test 2FA auth
tretdm Apr 16, 2024
0eb238e
imrpove(debug): Remove experimental features
tretdm Apr 16, 2024
56a4211
fix(ui): Special for Honeycomb
tretdm Apr 16, 2024
fdbc9e2
improve(readme): Add 4PDA link
tretdm Apr 16, 2024
8705eec
Upgrade to Android Studio 3.3.1
tretdm May 11, 2024
48921f6
feat(notes): Add notes editor (works only if note exist)
tretdm May 11, 2024
a0cc5da
prerel: Build 241
tretdm May 11, 2024
ea35ba7
Update default config
tretdm May 11, 2024
d59e567
Replace JCenter to MVN Repository (some dependencies were lost)
tretdm Sep 14, 2024
fc4a377
Add Vriska Maven repository to return non-existent dependencies to JC…
tretdm Sep 14, 2024
a85d2f0
Update dependencies list
tretdm Sep 14, 2024
203a4fa
Fix
tretdm Sep 14, 2024
891ea6c
gradle: Resumes work on the application, build it is possible again
tretdm Dec 23, 2024
01dbd05
Replace Takisoft's PreferenceCompat improved library to original Goog…
tretdm Dec 23, 2024
5cdd572
Merge branch 'experimental' of https://github.com/openvk/mobile-andro…
tretdm Dec 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
136 changes: 63 additions & 73 deletions app/app.iml

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ android {
minSdkVersion 7
//noinspection GradleDependency,OldTargetApi
targetSdkVersion 29
versionCode 240
versionName "1.2.240-u"
versionCode 242
versionName "1.2.242-u"
}
buildTypes {
release {
Expand All @@ -106,16 +106,16 @@ android {
minSdkVersion 7
//noinspection OldTargetApi
targetSdkVersion 29
versionCode 240
versionName "1.2.240-d"
versionCode 242
versionName "1.2.242-d"
signingConfig signingConfigs.debug
}
releaseConfig {
minSdkVersion 7
applicationId 'uk.openvk.android.legacy'
targetSdkVersion 29
versionCode 240
versionName '1.2.240'
versionCode 242
versionName '1.2.242'
if (file('.signing/app-release.prop').exists()) {
signingConfig signingConfigs.release
}
Expand All @@ -126,8 +126,8 @@ android {
minSdkVersion 7
//noinspection OldTargetApi
targetSdkVersion 29
versionCode 240
versionName "1.2.240-f"
versionCode 242
versionName "1.2.242-f"
if (file('.signing/app-fdroid.prop').exists()) {
signingConfig signingConfigs.fdroid
}
Expand Down Expand Up @@ -176,8 +176,8 @@ dependencies {
compile 'com.android.support:support-v4:24.0.0'
//noinspection GradleDependency,GradleCompatible
compile 'com.android.support:appcompat-v7:24.0.0'
//noinspection GradleDependency
compile 'com.takisoft.fix:preference-v7:24.0.0.1'
//noinspection GradleCompatible,GradleDependency
compile 'com.android.support:preference-v7:24.0.0'
compile 'com.readystatesoftware.systembartint:systembartint:1.0.3'
compile project(':modules:actionbar')
compile project(':modules:popupmenu')
Expand Down
12 changes: 2 additions & 10 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
android:theme="@style/BaseStyleNoTitle"
android:largeHeap="true"
tools:ignore="UnusedAttribute"
android:usesCleartextTraffic="true">
android:usesCleartextTraffic="true"
android:installLocation="auto">

<activity android:name=".core.activities.MainActivity"
android:label="@string/app_name"
Expand Down Expand Up @@ -306,15 +307,6 @@
android:resizeableActivity="false"
/>

<activity
android:name=".core.activities.settings.ExperimentalFeaturesActivity"
android:label="@string/experimental_features"
android:theme="@style/BaseStyle"
android:exported="true"
android:configChanges="orientation|screenSize|screenLayout|keyboardHidden|mcc|mnc|uiMode"
android:resizeableActivity="false"
/>

<activity android:name=".core.activities.QuickSearchActivity"
android:label="@string/search_global"
android:theme="@style/BaseStyle.NoActionBar.NoShadow"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,44 @@ protected void attachBaseContext(Context newBase) {

private void setView() {
ImageView logo = findViewById(R.id.logo);

/* OpenVK Easter Egg Types in "About Application" activity
*
* 0 - not a easter egg
* 2 - adrod 13 installer, ovksome people or freakbarinov
*/

final int[] easterEggType = {0};

logo.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
if(logo_longclicks == 2) {
Intent intent = new Intent(getApplicationContext(), DebugMenuActivity.class);
startActivity(intent);
switch (easterEggType[0]) {
default:
Intent intent = new Intent(getApplicationContext(), DebugMenuActivity.class);
startActivity(intent);
break;
case 2:
findViewById(R.id.easter_egg_page).setVisibility(View.VISIBLE);
findViewById(R.id.about_app_page).setVisibility(View.GONE);
if(Build.VERSION.SDK_INT == 33) {
findViewById(R.id.about_app_page).setVisibility(View.GONE);
} else if(Build.VERSION.SDK_INT < 11) {
((ImageView) findViewById(R.id.easter_egg_imageview))
.setImageDrawable(
getResources().getDrawable(R.drawable.ee_freakbarinov)
);
} else {
((ImageView) findViewById(R.id.easter_egg_imageview))
.setImageDrawable(
getResources().getDrawable(R.drawable.ee_ovksome_people)
);
}
break;
}
logo_longclicks = 0;
easterEggType[0]++;
} else {
logo_longclicks++;
}
Expand All @@ -141,7 +172,6 @@ public boolean onLongClick(View v) {
TextView app_links = findViewById(R.id.app_links_text);
TextView app_license_label = findViewById(R.id.app_license_text);
TextView app_disclaimer_label = findViewById(R.id.app_disclaimer_text);
OvkApplication app = ((OvkApplication) getApplicationContext());

app_title.setText(getResources().getString(R.string.full_app_name));
app_version_label.setText(getResources().getString(R.string.app_version_text,
Expand Down Expand Up @@ -243,8 +273,13 @@ public void onClick(DialogInterface dialog, int which) {

@Override
public boolean onOptionsItemSelected(MenuItem item) {
if(item.getItemId() == android.R.id.home) {
onBackPressed();
if(findViewById(R.id.easter_egg_page).getVisibility() == View.GONE) {
if (item.getItemId() == android.R.id.home) {
onBackPressed();
}
} else {
findViewById(R.id.easter_egg_page).setVisibility(View.GONE);
findViewById(R.id.about_app_page).setVisibility(View.VISIBLE);
}
return super.onOptionsItemSelected(item);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ private void createAttachmentsAdapter() {
private void setUiListeners() {
findViewById(R.id.newpost_btn_photo).setOnClickListener(
new View.OnClickListener() {
@SuppressLint("IntentReset")
@Override
public void onClick(View v) {
Intent intent =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,23 +28,35 @@
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.annotation.Nullable;
import android.text.Html;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.webkit.WebResourceRequest;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;

import uk.openvk.android.client.enumerations.HandlerMessages;
import uk.openvk.android.legacy.OvkApplication;
import uk.openvk.android.legacy.R;
import uk.openvk.android.legacy.core.activities.base.NetworkActivity;
import uk.openvk.android.legacy.core.activities.base.TranslucentActivity;
import uk.openvk.android.legacy.core.methods.CustomLinkMovementMethod;

public class NoteActivity extends TranslucentActivity {
public class NoteActivity extends NetworkActivity {
private WebView webView;
private SharedPreferences global_prefs;
private String page;
private long note_id;
private Menu menu;
private boolean editor_mode;
private long owner_id;


@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
Expand All @@ -63,8 +75,30 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
getResources().getDrawable(R.drawable.bg_actionbar_black));
}
}
((TextView) findViewById(R.id.note_some_xhtml_features)).setText(
Html.fromHtml(getResources().getString(R.string.some_xhtml_features_text))
);
webView = findViewById(R.id.webview);
loadNote();
Bundle data = getIntent().getExtras();
if(data != null) {
if (data.containsKey("id")) {
note_id = data.getLong("id");
} else {
finish();
}

if (data.containsKey("owner_id")) {
owner_id = data.getLong("owner_id");
} else {
finish();
}
ovk_api.notes.getById(ovk_api.wrapper, owner_id, note_id);
findViewById(R.id.note_viewer).setVisibility(View.GONE);
findViewById(R.id.note_editor).setVisibility(View.GONE);
findViewById(R.id.progress_layout).setVisibility(View.VISIBLE);
} else {
finish();
}
forceBrowserForExternalLinks();
}

Expand Down Expand Up @@ -97,15 +131,29 @@ public boolean shouldOverrideUrlLoading(WebView view, String url) {
}
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
this.menu = menu;
getMenuInflater().inflate(R.menu.note, menu);
return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
if(item.getItemId() == android.R.id.home) {
onBackPressed();
} else if(item.getItemId() == R.id.edit){
switchToEditorMode(true);
} else if(item.getItemId() == R.id.note_save) {
switchToEditorMode(false);
String new_title = ((EditText) findViewById(R.id.note_title_editor)).getText().toString();
String new_content = ((EditText) findViewById(R.id.note_content_editor)).getText().toString();
ovk_api.notes.edit(ovk_api.wrapper, note_id, new_title, new_content);
}
return super.onOptionsItemSelected(item);
}

private void loadNote() {
private void loadNote(String text) {
Bundle data = getIntent().getExtras();
String instance = ((OvkApplication) getApplication()).getCurrentInstance();
if(data != null) {
Expand All @@ -120,7 +168,7 @@ private void loadNote() {
" </head>" +
" <body bgcolor=\"#d5e8fe\" style=\"margin: 0\">" +
" <div>" +
data.getString("content")
text
.replace("&amp;", "&")
.replace("<a href=\"/",
String.format("<a href=\"http://%s/", instance)
Expand All @@ -138,15 +186,67 @@ private void loadNote() {
} else {
webView.loadData(page, "text/html; charset=UTF-8", "UTF-8");
}

((EditText) findViewById(R.id.note_content_editor)).setText(data.getString("content"));
}
if(data.containsKey("title")) {
((TextView) findViewById(R.id.note_title)).setText(data.getString("title"));
((EditText) findViewById(R.id.note_title_editor)).setText(data.getString("title"));
}
if(data.containsKey("author")) {
((TextView) findViewById(R.id.note_author)).setText(data.getString("author"));
((TextView) findViewById(R.id.note_author_2)).setText(data.getString("author"));
}
} else {
finish();
}
}

@Override
public void onBackPressed() {
if(editor_mode) {
switchToEditorMode(false);
} else {
finish();
}
}

public void switchToEditorMode(boolean value) {
editor_mode = value;
menu.findItem(R.id.edit).setVisible(!value);
menu.findItem(R.id.note_save).setVisible(value);
findViewById(R.id.note_viewer).setVisibility(value ? View.GONE : View.VISIBLE);
findViewById(R.id.note_editor).setVisibility(value ? View.VISIBLE : View.GONE);
}

public void receiveState(int message, Bundle data) {
try {
if (data.containsKey("address")) {
String activityName = data.getString("address");
if (activityName == null) {
return;
}
boolean isCurrentActivity = activityName.equals(
String.format("%s_%s", getLocalClassName(), getSessionId())
);
if (!isCurrentActivity) {
return;
}
}
if (message == HandlerMessages.NOTES_GET_BY_ID) {
findViewById(R.id.progress_layout).setVisibility(View.GONE);
loadNote(ovk_api.notes.list.get(0).content);
switchToEditorMode(false);
((TextView) findViewById(R.id.note_title)).setText(ovk_api.notes.list.get(0).title);
((EditText) findViewById(R.id.note_title_editor)).setText(ovk_api.notes.list.get(0).title);
} else if (message == HandlerMessages.NOTES_EDIT) {
ovk_api.notes.getById(ovk_api.wrapper, owner_id, note_id);
switchToEditorMode(editor_mode);
} else if (message < 0) {
Toast.makeText(this, R.string.connection_error, Toast.LENGTH_LONG).show();
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public class PhotoAlbumActivity extends NetworkActivity {
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_photo_album);
ProgressLayout progressLayout = ((ProgressLayout) findViewById(R.id.progress_layout));
ProgressLayout progressLayout = findViewById(R.id.progress_layout);
progressLayout.setVisibility(View.VISIBLE);
progressLayout.enableDarkTheme(true);
if (savedInstanceState == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.content.res.Configuration;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
Expand All @@ -45,7 +44,6 @@
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.TextView;
import android.widget.Toast;

import dev.tinelix.twemojicon.EmojiconEditText;
import dev.tinelix.twemojicon.EmojiconGridFragment;
Expand All @@ -61,10 +59,7 @@
import uk.openvk.android.legacy.OvkApplication;
import uk.openvk.android.legacy.R;
import uk.openvk.android.client.attachments.Attachment;
import uk.openvk.android.client.entities.Video;
import uk.openvk.android.client.entities.Photo;
import uk.openvk.android.client.models.Wall;
import uk.openvk.android.client.entities.Poll;
import uk.openvk.android.client.enumerations.HandlerMessages;
import uk.openvk.android.client.entities.Comment;
import uk.openvk.android.legacy.core.activities.base.NetworkFragmentActivity;
Expand Down Expand Up @@ -105,7 +100,7 @@ protected void onCreate(Bundle savedInstanceState) {
setContentView(R.layout.activity_wall_post);
instance = instance_prefs.getString("server", "");
((XLinearLayout) findViewById(R.id.comments_view)).setOnKeyboardStateListener(this);
setEmojiconFragment(false);
setEmojiconFragment();
postViewLayout = findViewById(R.id.comments_layout);
postViewLayout.adjustLayoutSize(getResources().getConfiguration().orientation);
commentPanel = findViewById(R.id.comment_panel);
Expand Down Expand Up @@ -467,10 +462,10 @@ public void addAuthorMention(int position) {
}


private void setEmojiconFragment(boolean useSystemDefault) {
private void setEmojiconFragment() {
getSupportFragmentManager()
.beginTransaction()
.replace(R.id.emojicons, EmojiconsFragment.newInstance(useSystemDefault))
.replace(R.id.emojicons, EmojiconsFragment.newInstance(false))
.commit();
}

Expand Down
Loading
Loading