Skip to content

Commit

Permalink
Minor fixes [ci skip]
Browse files Browse the repository at this point in the history
  • Loading branch information
sarsamurmu committed Jan 10, 2020
1 parent 55f62fb commit 8e707f8
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 42 deletions.
4 changes: 1 addition & 3 deletions library/src/main/java/candybar/lib/databases/Database.java
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,7 @@ public void onCreate(SQLiteDatabase db) {

@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
/*
* Need to clear shared preferences with version 3.4.0
*/
// Need to clear shared preferences with version 3.4.0
if (newVersion == 9) {
Preferences.get(mContext).clearPreferences();
}
Expand Down
31 changes: 18 additions & 13 deletions library/src/main/java/candybar/lib/fragments/RequestFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -391,17 +391,17 @@ private class RequestLoader extends AsyncTask<Void, Void, Boolean> {
protected void onPreExecute() {
super.onPreExecute();

MaterialDialog.Builder builder = new MaterialDialog.Builder(getActivity())
dialog = new MaterialDialog.Builder(getActivity())
.typeface(
TypefaceHelper.getMedium(getActivity()),
TypefaceHelper.getRegular(getActivity()))
.content(R.string.request_building)
.cancelable(false)
.canceledOnTouchOutside(false)
.progress(true, 0)
.progressIndeterminateStyle(true);
.progressIndeterminateStyle(true)
.build();

dialog = builder.build();
dialog.show();
}

Expand Down Expand Up @@ -514,7 +514,12 @@ protected void onPostExecute(Boolean aBoolean) {
dialog.dismiss();

if (aBoolean) {
if (!isArctic) {
if (isArctic) {
Toast.makeText(getActivity(), R.string.request_arctic_success, Toast.LENGTH_LONG).show();

Preferences.get(getActivity()).setRegularRequestUsed(Preferences.get(getActivity()).getRegularRequestUsed() + RequestFragment.sSelectedRequests.size());
refreshIconRequest();
} else {
IntentChooserFragment.showIntentChooserDialog(getActivity().getSupportFragmentManager(),
IntentChooserFragment.ICON_REQUEST);
}
Expand All @@ -526,7 +531,7 @@ protected void onPostExecute(Boolean aBoolean) {
.typeface(
TypefaceHelper.getMedium(getActivity()),
TypefaceHelper.getRegular(getActivity()))
.content(R.string.request_arctic_manager_error, "\"" + errorMessage + "\"")
.content(R.string.request_arctic_error, "\"" + errorMessage + "\"")
.cancelable(true)
.canceledOnTouchOutside(false)
.positiveText(R.string.close)
Expand All @@ -546,14 +551,14 @@ protected void onPostExecute(Boolean aBoolean) {

public class checkConfigBeforeRequest extends AsyncTask<Void, Void, Boolean> {

MaterialDialog fetchingDataDialog;
MaterialDialog dialog;
private JSONObject configJson;

@Override
protected void onPreExecute() {
super.onPreExecute();

fetchingDataDialog = new MaterialDialog.Builder(getActivity())
dialog = new MaterialDialog.Builder(getActivity())
.typeface(
TypefaceHelper.getMedium(getActivity()),
TypefaceHelper.getRegular(getActivity()))
Expand All @@ -564,13 +569,13 @@ protected void onPreExecute() {
.progressIndeterminateStyle(true)
.build();

fetchingDataDialog.show();
dialog.show();
}

@Override
protected Boolean doInBackground(Void... params) {
String str = getActivity().getResources().getString(R.string.config_json);
URLConnection urlConn = null;
URLConnection urlConn;
BufferedReader bufferedReader = null;
try {
URL url = new URL(str);
Expand All @@ -594,7 +599,7 @@ protected Boolean doInBackground(Void... params) {
try {
bufferedReader.close();
} catch (IOException e) {
e.printStackTrace();
LogUtil.e(Log.getStackTraceString(e));
}
}
}
Expand All @@ -618,7 +623,7 @@ protected void onPostExecute(Boolean resBoolean) {
PackageInfo pInfo = getActivity().getPackageManager().getPackageInfo(getActivity().getPackageName(), 0);
appVersionCode = pInfo.versionCode;
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
LogUtil.e(Log.getStackTraceString(e));
}

if (appVersionCode < disabledReqBelow) canRequest = false;
Expand All @@ -627,7 +632,7 @@ protected void onPostExecute(Boolean resBoolean) {
if ((appVersionCode + "").contentEquals(version)) canRequest = false;
}

fetchingDataDialog.dismiss();
dialog.dismiss();

if (!canRequest) {
new MaterialDialog.Builder(getActivity())
Expand All @@ -654,7 +659,7 @@ protected void onPostExecute(Boolean resBoolean) {
}

} else {
fetchingDataDialog.dismiss();
dialog.dismiss();

new MaterialDialog.Builder(getActivity())
.typeface(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,6 @@ protected Boolean doInBackground(Void... voids) {
while (!isCancelled()) {
try {
Thread.sleep(1);
/*
Intent intent = new Intent(Intent.ACTION_SENDTO, Uri.fromParts("mailto", getResources().getString(R.string.dev_email), null));
*/

boolean nonMailingAppSend = getResources().getBoolean(R.bool.enable_non_mail_app_request);
Intent intent;
Expand Down
14 changes: 0 additions & 14 deletions library/src/main/java/candybar/lib/helpers/LocaleHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -107,26 +107,12 @@ public static String getOtherAppLocaleName(@NonNull Context context, @NonNull Lo
String packageName = fullComponentName.replace("/" + activityName, "");
ComponentName componentName = new ComponentName(packageName, activityName);

/*
LogUtil.d("CandyBar", "Full Component Name: " + fullComponentName);
LogUtil.d("CandyBar", "Activity Name: " + activityName);
LogUtil.d("CandyBar", "Package Name: " + packageName);*/

PackageManager packageManager = context.getPackageManager();
ActivityInfo info = packageManager.getActivityInfo(componentName, PackageManager.GET_META_DATA);

Resources res = packageManager.getResourcesForActivity(componentName);
Context otherAppContext = context.createPackageContext(packageName, Context.CONTEXT_IGNORE_SECURITY);
Configuration configuration = new Configuration();

/*
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
configuration = res.getConfiguration();
configuration.setLocale(locale);
return otherAppContext.createConfigurationContext(configuration).getString(info.labelRes);
}
*/

configuration.locale = locale;
res.updateConfiguration(configuration, context.getResources().getDisplayMetrics());
return info.loadLabel(packageManager).toString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,6 @@ public void start() {
String fileName = mWallpaper.getName() + "." + WallpaperHelper.getFormat(mWallpaper.getMimeType());
File directory = WallpaperHelper.getDefaultWallpapersDirectory(mContext);
File target = new File(directory, fileName);
/*if (!directory.exists()) {
if (!directory.mkdirs()) {
LogUtil.e("Unable to create directory " + directory.toString());
showCafeBar(R.string.wallpaper_download_failed);
return;
}
}*/

if (WallpaperHelper.isWallpaperSaved(mContext, mWallpaper)) {
CafeBar.builder(mContext)
Expand Down
5 changes: 3 additions & 2 deletions library/src/main/res/values/dashboard_strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,9 @@
<string name="request_already_requested">Already requested</string>

<string name="request_building">Building request …</string>
<string name="request_sending_arctic_manager">Sending request to Arctic Manager...</string>
<string name="request_arctic_manager_error">Error occurred while sending request to Arctic Manager. Error is %s</string>
<string name="request_arctic_sending">Sending request to Arctic Manager...</string>
<string name="request_arctic_error">Error occurred while sending request to Arctic Manager. Error is %s</string>
<string name="request_arctic_success">Successfully sent request to Arctic Manager</string>
<string name="request_fetching_data">Fetching latest data...</string>
<string name="request_build_failed">Unable to build icon request</string>
<string name="request_appfilter_failed">Unable to read appfilter.xml</string>
Expand Down

0 comments on commit 8e707f8

Please sign in to comment.