Skip to content
This repository has been archived by the owner on Jul 16, 2018. It is now read-only.

Commit

Permalink
Merge pull request #40 from odin3/dev
Browse files Browse the repository at this point in the history
Release 1.8.0
  • Loading branch information
princeofpensia authored Feb 1, 2017
2 parents c20c10e + 3ac533a commit 88a693e
Show file tree
Hide file tree
Showing 33 changed files with 975 additions and 65 deletions.
2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ android {
applicationId "com.x1unix.avi"
minSdkVersion 14
targetSdkVersion 24
versionCode 20170128
versionName "1.6.1"
versionCode 20170202
versionName "1.8.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables {
useSupportLibrary true
Expand Down
22 changes: 15 additions & 7 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,16 @@
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.VIBRATE" />

<application
android:name=".Application"
android:allowBackup="true"
android:hardwareAccelerated="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:name=".Application"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
Expand All @@ -23,11 +26,12 @@
android:theme="@style/FullscreenTheme" />
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:configChanges="orientation|keyboardHidden|screenSize"
android:label="@string/app_name"
android:theme="@style/SplashScreenTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Expand Down Expand Up @@ -55,14 +59,19 @@
android:name=".MovieDetailsActivity"
android:label="@string/app_name"
android:theme="@style/AppTheme" />

<activity android:name=".DashboardActivity"
<activity
android:name=".DashboardActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:theme="@style/AppTheme.Dashboard" />

<activity android:name=".SearchActivity"
<activity
android:name=".SearchActivity"
android:configChanges="orientation|keyboardHidden|screenSize" />

<activity android:name=".UpdateDownloaderActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:label="@string/pref_category_updates">
</activity>

<receiver android:name=".SearchWidgetProvider">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
Expand All @@ -72,7 +81,6 @@
android:name="android.appwidget.provider"
android:resource="@xml/search_widget_provider" />
</receiver>

</application>

</manifest>
39 changes: 39 additions & 0 deletions app/src/main/assets/changelog_template.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>Changelog</title>
<style>
html, body {
background-color: #EAEAEA;
font: 11pt 'Roboto', sans-serif;
color: black;
}

body {
margin: 24px 18px;
}

h1, h2, h3 {
text-transform: uppercase;
font: 10pt 'Roboto', sans-serif;
display: block;
font-weight: bold;
color: #605F61;
margin-bottom: 10px;
}

ul {
padding-left: 18px;
list-style: square;
}
li {
padding-bottom: 5px;
}
</style>
</head>
<body>
%CONTENT%
</body>
</html>
20 changes: 19 additions & 1 deletion app/src/main/java/com/x1unix/avi/DashboardActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import android.app.SearchManager;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.res.Configuration;
import android.os.Build;
Expand Down Expand Up @@ -151,6 +152,23 @@ public boolean onMenuItemClick(MenuItem item) {
}, 100);
}

private void startUpdate(AviSemVersion newVer) {
startActivity(
new Intent(this, UpdateDownloaderActivity.class)
.putExtra("update", newVer)
);
}

private void showUpdateDialog(final AviSemVersion newVer) {
OTAUpdateChecker.makeDialog(this, newVer)
.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
startUpdate(newVer);
dialog.cancel();
}
}).show();
}

private void initBackgroundUpdateCheck() {
final Context context = getApplicationContext();
boolean allowNightlies = PreferenceManager.
Expand All @@ -160,7 +178,7 @@ private void initBackgroundUpdateCheck() {
OTAUpdateChecker.checkForUpdates(new OTAStateListener() {
@Override
protected void onUpdateAvailable(AviSemVersion availableVersion, AviSemVersion currentVersion) {
OTAUpdateChecker.makeDialog(context, availableVersion);
showUpdateDialog(availableVersion);
}
}, allowNightlies);
}
Expand Down
60 changes: 44 additions & 16 deletions app/src/main/java/com/x1unix/avi/SettingsActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.res.Resources;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.Uri;
Expand Down Expand Up @@ -34,47 +35,61 @@ public class SettingsActivity extends AppCompatPreferenceActivity {
private String propIsAutoupdateKey;
private String propUpdateNow;
private String propAllowUnstable;
private String propUseLegacyPlayer;
private SharedPreferences preferences;

private Resources res;

private final String APP_URL = "http://avi-app.x1unix.com";

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

propIsAdEnabledKey = getResources().getString(R.string.avi_prop_no_ads);
propIsAutoupdateKey = getResources().getString(R.string.avi_prop_autocheck_updates);
propUpdateNow = getResources().getString(R.string.prop_btn_update_now);
propAllowUnstable = getResources().getString(R.string.avi_prop_allow_unstable);
res = getResources();

propIsAdEnabledKey = res.getString(R.string.avi_prop_no_ads);
propIsAutoupdateKey = res.getString(R.string.avi_prop_autocheck_updates);
propUpdateNow = res.getString(R.string.prop_btn_update_now);
propAllowUnstable = res.getString(R.string.avi_prop_allow_unstable);
propUseLegacyPlayer = res.getString(R.string.prop_use_legacy_player);

getPrefs();
setContentView(R.layout.activity_settings);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);

addPreferencesFromResource(R.xml.pref_main);

((Preference) findPreference("avi_app_version")).setSummary(BuildConfig.VERSION_NAME);
boolean isPreview = res.getBoolean(R.bool.isPreviewVersion);
String currentVersion = BuildConfig.VERSION_NAME;

if (isPreview) {
currentVersion += " - " + res.getString(R.string.preview_version);
}

findPreference("avi_app_version").setSummary(currentVersion);
findPreference("avi_app_build").setSummary(String.valueOf(BuildConfig.VERSION_CODE));

registerPropsEventHandlers();
}



private void registerPropsEventHandlers() {
// Adblock prop
Preference customPref = (Preference) findPreference(propIsAdEnabledKey);
customPref.setOnPreferenceChangeListener(onTogglePreferenceListener);
findPreference(propIsAdEnabledKey).setOnPreferenceChangeListener(onTogglePreferenceListener);

// Autoupdate prop
Preference autoUpdatePref = (Preference) findPreference(propIsAutoupdateKey);
autoUpdatePref.setOnPreferenceChangeListener(onTogglePreferenceListener);
findPreference(propIsAutoupdateKey).setOnPreferenceChangeListener(onTogglePreferenceListener);

// Autoupdate prop
Preference unstablePref = (Preference) findPreference(propAllowUnstable);
unstablePref.setOnPreferenceChangeListener(onTogglePreferenceListener);
// Allow beta versions prop
findPreference(propAllowUnstable).setOnPreferenceChangeListener(onTogglePreferenceListener);

// Legacy player prop
findPreference(propUseLegacyPlayer).setOnPreferenceChangeListener(onTogglePreferenceListener);

// Update Now Button
Preference updateNowPrefBtn = (Preference) findPreference(propUpdateNow);
updateNowPrefBtn.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
findPreference(propUpdateNow).setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
if (isNetworkAvailable()) {
Expand All @@ -89,7 +104,7 @@ public boolean onPreferenceClick(Preference preference) {
}
});

((Preference) findPreference("avi_author")).setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
findPreference("avi_author").setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(APP_URL));
Expand Down Expand Up @@ -168,8 +183,21 @@ protected void onError(Throwable t) {
}, allowUnstable);
}

private void startUpdate(AviSemVersion newVer) {
startActivity(
new Intent(this, UpdateDownloaderActivity.class)
.putExtra("update", newVer)
);
}

private void showUpdateDialog(final AviSemVersion newVer) {
OTAUpdateChecker.makeDialog(this, newVer).show();;
OTAUpdateChecker.makeDialog(this, newVer)
.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
startUpdate(newVer);
dialog.cancel();
}
}).show();
}

private boolean isNetworkAvailable() {
Expand Down
Loading

0 comments on commit 88a693e

Please sign in to comment.