Skip to content
This repository has been archived by the owner on Nov 6, 2022. It is now read-only.

Commit

Permalink
Version 2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ztimms73 committed May 28, 2021
1 parent 6319e7a commit 1d7a65e
Show file tree
Hide file tree
Showing 17 changed files with 151 additions and 116 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ android {
}
buildTypes {
release {
minifyEnabled false
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
applicationVariants.all { variant ->
variant.outputs.all {
Expand Down
56 changes: 50 additions & 6 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,53 @@
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
-keepattributes Signature
-keepattributes Annotation
-keep class de.galgtonold.jollydayandroid.*
-keep interface de.galgtonold.jollydayandroid.*
-dontwarn okhttp3.
-dontwarn okio.**

# Requred by Jollyday library to prevent warnings (as mentioned on Jollyday website)
-keepattributes EnclosingMethod
-keepattributes InnerClasses

# Requred by Jollyday library for APK minify
-keep class de.galgtonold.jollydayandroid.impl.XMLManager.** { *; }
-keep interface de.galgtonold.jollydayandroid.impl.XMLManager.** { *; }

-keep class de.galgtonold.jollydayandroid.impl.** { *; }
-keep interface de.galgtonold.jollydayandroid.impl.** { *; }

-keep class de.galgtonold.jollydayandroid.** { *; }
-keep interface de.galgtonold.jollydayandroid.** { *; }


-keep class de.galgtonold.jollydayandroid.util.XMLUtil.** { *; }
-keep interface de.galgtonold.jollydayandroid.util.XMLUtil.** { *; }

-keep class de.galgtonold.jollydayandroid.util.** { *; }
-keep interface de.galgtonold.jollydayandroid.util.** { *; }


-keep class javax.xml.stream.** { *; }
-keep interface javax.xml.stream.** { *; }

-keep class javax.xml.stream.events.** { *; }
-keep interface javax.xml.stream.events.** { *; }


-keep class org.simpleframework.xml.** { *; }
-keep interface org.simpleframework.xml.** { *; }

-keep class org.simpleframework.xml.core.** { *; }
-keep interface org.simpleframework.xml.core.** { *; }

-keep class org.simpleframework.xml.stream.** { *; }
-keep interface org.simpleframework.xml.stream.** { *; }


-keep class cz.jaro.alarmmorning.** { *; }

# Remove log messages
-assumenosideeffects class android.util.Log {
public static *** v(...);
public static *** d(...);
}
# public static *** i(...);
# public static *** w(...);
# public static *** e(...);
4 changes: 2 additions & 2 deletions app/release/output-metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
{
"type": "SINGLE",
"filters": [],
"versionCode": 69,
"versionCode": 76,
"versionName": "2.0.0",
"outputFile": "ridebus_v2.0.0-69.apk"
"outputFile": "ridebus_v2.0.0-76.apk"
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.ProgressBar;

import androidx.appcompat.widget.SearchView;
import androidx.appcompat.widget.Toolbar;
Expand All @@ -23,27 +25,30 @@ public class BookmarksActivity extends AppBaseActivity implements BookmarksActiv
public final static String REQUEST_RESULT = "request_result";
private BookmarksSearchAdapter mBookmarksSearchAdapter;
private RecyclerView mRecyclerView;

// {
// new DatabaseObjectsListAsyncTask(this).execute();
// }
private boolean mAdapterIsSet = false;
private ProgressBar mProgressBar;

public static Intent newIntent(Context context) {
return new Intent(context, BookmarksActivity.class);
}

@Override
public void setAdapter(ArrayList<DatabaseObject> databaseObjects) {
mBookmarksSearchAdapter = new BookmarksSearchAdapter(databaseObjects);
mRecyclerView.setAdapter(mBookmarksSearchAdapter);
mBookmarksSearchAdapter.setOnItemClickListener((parent, v, position, id) -> {
Intent intent = new Intent();
Bundle bundleData = new Bundle();
bundleData.putSerializable(REQUEST_RESULT, mBookmarksSearchAdapter.getStopsListFiltered().get(position));
intent.putExtras(bundleData);
setResult(RESULT_OK, intent);
finish();
});
if (!mAdapterIsSet) {
mProgressBar.setVisibility(View.GONE);
mBookmarksSearchAdapter = new BookmarksSearchAdapter(databaseObjects);
mRecyclerView.setAdapter(mBookmarksSearchAdapter);
mBookmarksSearchAdapter.setOnItemClickListener((parent, v, position, id) -> {
Intent intent = new Intent();
Bundle bundleData = new Bundle();
bundleData.putSerializable(REQUEST_RESULT, mBookmarksSearchAdapter.getStopsListFiltered().get(position));
intent.putExtras(bundleData);
setResult(RESULT_OK, intent);
finish();
});
} else {
mBookmarksSearchAdapter.dataChange(databaseObjects);
}
}

@Override
Expand All @@ -58,6 +63,9 @@ protected void onCreate(Bundle savedInstanceState) {
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}

mProgressBar = findViewById(R.id.progress);
mProgressBar.setVisibility(View.VISIBLE);

mRecyclerView = findViewById(R.id.recyclerview_bookmarks_activity);
mRecyclerView.setLayoutManager(new LinearLayoutManager(this));
BookmarksActivityPresenter presenter = new BookmarksActivityPresenter(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import org.xtimms.trackbus.fragment.AppBaseFragment;
import org.xtimms.trackbus.fragment.RateItDialogFragment;
import org.xtimms.trackbus.R;
import org.xtimms.trackbus.activity.settings.SettingsHeadersActivity;
import org.xtimms.trackbus.fragment.BookmarkFragment;
import org.xtimms.trackbus.fragment.StopFragment;
import org.xtimms.trackbus.fragment.TabRouteFragment;
Expand Down Expand Up @@ -71,10 +70,10 @@ private void initOnHolidayDialog() {
for (Holiday holiday : holidays) {
if (holiday.getDate().equals(LocalDate.now())) {
AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this, style.Theme_AlertDialog);
builder.setTitle("Кажется сегодня праздничный день!")
.setMessage("Возможно, транспорт ходит с изменениями в маршруте или по расписанию выходного дня. За подробной информацией обратитесь в автопарк.")
builder.setTitle(getString(string.holiday_title))
.setMessage(string.holiday_summary)
.setCancelable(false)
.setNegativeButton("Понятно",
.setNegativeButton(android.R.string.ok,
(dialog, id) -> dialog.cancel());
AlertDialog alert = builder.create();
alert.show();
Expand Down
56 changes: 0 additions & 56 deletions app/src/main/java/org/xtimms/trackbus/activity/StopsActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -91,62 +91,6 @@ protected void onCreate(Bundle savedInstanceState) {
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}

/*TextView textTitle = findViewById(R.id.text_title_stopactivity);
textTitle.setText(mStop.getStopTitle());
TextView subtitle = findViewById(R.id.subtitle_stopactivity);
subtitle.setText(mStop.getMark());*/

// mTimeText.setOnClickListener(v -> {
// Calendar mcurrentTime = Calendar.getInstance();
// int hour = mcurrentTime.get(Calendar.HOUR_OF_DAY);
// int minute = mcurrentTime.get(Calendar.MINUTE);
// TimePickerDialog mTimePicker;
// mTimePicker = new TimePickerDialog(StopsActivity.this, (timePicker, selectedHour, selectedMinute) -> {
// String newHourses = (selectedHour < 10) ? "0" + selectedHour : String.valueOf(selectedHour);
// String newMinutes = (selectedMinute < 10) ? "0" + selectedMinute : String.valueOf(selectedMinute);
// String newTime = newHourses + ":" + newMinutes;
// mTimeText.setText(newTime);
// dateTimeChange();
// }, hour, minute, true);//Yes 24 hour time
// mTimePicker.setTitle(getString(R.string.time_picker_title));
// mTimePicker.show();
//
// });
//
// mTimeText.addTextChangedListener(new TextWatcher() {
// @Override
// public void beforeTextChanged(CharSequence s, int start, int count, int after) {
//
// }
//
// @Override
// public void onTextChanged(CharSequence s, int start, int before, int count) {
// dateTimeChange();
// }
//
// @Override
// public void afterTextChanged(Editable s) {
//
// }
// });

//mWeekDay.setOnClickListener(v -> {
// Calendar mcurrentDate = Calendar.getInstance();
// int year = mcurrentDate.get(Calendar.YEAR);
// int month = mcurrentDate.get(Calendar.MONTH);
// int day = mcurrentDate.get(Calendar.DAY_OF_MONTH);

// DatePickerDialog datePickerDialog = new DatePickerDialog(StopsActivity.this, (view, year1, monthOfYear, dayOfMonth) -> {
// Calendar newDate = Calendar.getInstance();
// newDate.set(year1, monthOfYear, dayOfMonth);
// SimpleDateFormat sdf = new SimpleDateFormat("EEEE", Locale.getDefault());
// //SimpleDateFormat sdf = new SimpleDateFormat("EEE, d MMM yyyy", Locale.getDefault());
// mWeekDay.setText(sdf.format(newDate.getTime()));
// dateTimeChange();
// }, year, month, day);
// datePickerDialog.show();
//});

}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,35 +88,35 @@ public boolean onPreferenceClick(Preference preference) {
return true;
}
if ("checkdb".equals(preference.getKey())) {
if (!AppUtils.isValidSQLite("/data/data/org.xtimms.trackbus/databases/trackbus.db")) {
if (!AppUtils.isValidSQLite(getDatabasePath("trackbus.db").getAbsolutePath())) {
new AlertDialog.Builder(this, R.style.Theme_AlertDialog)
.setTitle("Uh oh...")
.setMessage("База данных повреждена.")
.setPositiveButton("ОК", ((dialog, which) -> dialog.dismiss()))
.setTitle(getString(R.string.uh_oh))
.setMessage(getString(R.string.database_corrupted))
.setPositiveButton(android.R.string.ok, ((dialog, which) -> dialog.dismiss()))
.show();
return false;
} else {
new AlertDialog.Builder(this, R.style.Theme_AlertDialog)
.setTitle("Отлично")
.setMessage("База данных прошла проверку целостности.")
.setPositiveButton("ОК", ((dialog, which) -> dialog.dismiss()))
.setTitle(getString(R.string.success))
.setMessage(getString(R.string.db_integrity_check))
.setPositiveButton(android.R.string.ok, ((dialog, which) -> dialog.dismiss()))
.show();
return true;
}
}
if ("checkserver".equals(preference.getKey())) {
if (!AppUtils.isURLReachable(this)) {
new AlertDialog.Builder(this, R.style.Theme_AlertDialog)
.setTitle("Uh oh...")
.setMessage("Соединение с сервером недоступно.")
.setPositiveButton("ОК", ((dialog, which) -> dialog.dismiss()))
.setTitle(getString(R.string.uh_oh))
.setMessage(getString(R.string.server_unavailable))
.setPositiveButton(android.R.string.ok, ((dialog, which) -> dialog.dismiss()))
.show();
return false;
} else {
new AlertDialog.Builder(this, R.style.Theme_AlertDialog)
.setTitle("Отлично")
.setMessage("Успешно получен ответ от сервера.")
.setPositiveButton("ОК", ((dialog, which) -> dialog.dismiss()))
.setTitle(getString(R.string.success))
.setMessage(getString(R.string.succeed_response))
.setPositiveButton(android.R.string.ok, ((dialog, which) -> dialog.dismiss()))
.show();
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import org.xtimms.trackbus.model.DatabaseObject;
import org.xtimms.trackbus.model.Route;
import org.xtimms.trackbus.model.Stop;
import org.xtimms.trackbus.object.StopActivityObject;
import org.xtimms.trackbus.util.ColorUtils;
import org.xtimms.trackbus.util.TransportId;

Expand All @@ -27,7 +28,7 @@

public class BookmarksSearchAdapter extends RecyclerView.Adapter<BookmarksSearchAdapter.ViewHolder> implements Filterable {

private final ArrayList<DatabaseObject> mDataset;
private ArrayList<DatabaseObject> mDataset;
private ArrayList<DatabaseObject> mDatabaseObjectFiltered;
private AdapterView.OnItemClickListener onItemClickListener;

Expand Down Expand Up @@ -153,6 +154,11 @@ protected void publishResults(CharSequence charSequence, FilterResults filterRes
};
}

public void dataChange(ArrayList<DatabaseObject> databaseObjects) {
mDataset = databaseObjects;
notifyDataSetChanged();
}

public static class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {

private final BookmarksSearchAdapter adapter;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import org.xtimms.trackbus.model.Route;
import org.xtimms.trackbus.model.Stop;
import org.xtimms.trackbus.presenter.StopFragmentPresenter;
import org.xtimms.trackbus.ui.WrapContentLinearLayoutManager;

import java.util.ArrayList;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ protected void onPreExecute() {
NotificationChannel updatedNotificationChannel = new NotificationChannel(UPDATED_NOTIFICATION_CHANNEL_ID, mContext.getResources().getString(R.string.database_updated_successfully), NotificationManager.IMPORTANCE_LOW);

// Configure the notification channel.
updatingNotificationChannel.setDescription("Уведомление, сообщающее об обновлении расписания, если есть новая версия на сервере.");
updatedNotificationChannel.setDescription("Уведомление, сообщающее об успешном обновлении расписания.");
updatingNotificationChannel.setDescription(mContext.getResources().getString(R.string.notification_updating_description));
updatedNotificationChannel.setDescription(mContext.getResources().getString(R.string.notification_updated_description));
mNotifyManager.createNotificationChannel(updatingNotificationChannel);
mNotifyManager.createNotificationChannel(updatedNotificationChannel);

Expand Down
11 changes: 4 additions & 7 deletions app/src/main/res/layout-sw600dp/item_favorite.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,12 @@
android:ellipsize="end"
android:gravity="center"
android:maxLines="2"
android:text="Нажмите для добавления в закладки"
android:text="@string/click_to_add_bookmark"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/circle"
app:layout_constraintTop_toTopOf="@+id/linearLayout2"
tools:ignore="HardcodedText"
tools:text="@tools:sample/lorem/random" />
tools:ignore="HardcodedText" />

<LinearLayout
android:id="@+id/linearLayout2"
Expand All @@ -54,17 +53,15 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:textAppearance="?attr/textAppearanceSubtitle1"
tools:text="@tools:sample/lorem/random" />
android:textAppearance="?attr/textAppearanceSubtitle1" />

<TextView
android:id="@+id/text_description_bookmark"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:textAppearance="?attr/textAppearanceBody2"
android:textColor="@color/mtrl_list_item_tint_secondary"
tools:text="@tools:sample/lorem/random" />
android:textColor="@color/mtrl_list_item_tint_secondary" />

</LinearLayout>

Expand Down
2 changes: 0 additions & 2 deletions app/src/main/res/layout/activity_about.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@

<include layout="@layout/card_about_4"/>

<include layout="@layout/card_about_6"/>

</LinearLayout>

</ScrollView>
Expand Down
10 changes: 10 additions & 0 deletions app/src/main/res/layout/content_bookmarks.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,14 @@
android:scrollbars="vertical"
tools:listitem="@layout/item_bookmarks_search"/>

<ProgressBar
android:id="@+id/progress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="visible"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

</androidx.constraintlayout.widget.ConstraintLayout>
Loading

0 comments on commit 1d7a65e

Please sign in to comment.