Skip to content

Commit

Permalink
Change package ID of gsantner/opoc
Browse files Browse the repository at this point in the history
  • Loading branch information
gsantner committed Sep 9, 2017
1 parent 3ed45b6 commit 6c918af
Show file tree
Hide file tree
Showing 19 changed files with 257 additions and 175 deletions.
4 changes: 2 additions & 2 deletions app/src/main/java/io/github/gsantner/memetastic/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import io.github.gsantner.memetastic.data.MemeFont;
import io.github.gsantner.memetastic.data.MemeLibConfig;
import io.github.gsantner.memetastic.util.AppSettings;
import io.github.gsantner.memetastic.util.Helpers;
import io.github.gsantner.memetastic.util.ContextUtils;

/**
* The apps application object
Expand Down Expand Up @@ -96,7 +96,7 @@ public MemeCategory getMemeCategory(String category) {
}

public void shareBitmapToOtherApp(Bitmap bitmap, Activity activity) {
File imageFile = Helpers.get().saveBitmapToFile(getCacheDir().getAbsolutePath(), getString(R.string.cached_picture_filename), bitmap);
File imageFile = ContextUtils.get().writeImageToFileJpeg(getCacheDir().getAbsolutePath(), getString(R.string.cached_picture_filename), bitmap);
if (imageFile != null) {
Uri imageUri = FileProvider.getUriForFile(this, getString(R.string.app_fileprovider), imageFile);
if (imageUri != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
import butterknife.ButterKnife;
import butterknife.OnClick;
import io.github.gsantner.memetastic.R;
import io.github.gsantner.memetastic.util.Helpers;
import io.github.gsantner.memetastic.util.HelpersA;
import io.github.gsantner.opoc.util.SimpleMarkdownParser;
import io.github.gsantner.memetastic.util.ContextUtils;
import io.github.gsantner.memetastic.util.ActivityUtils;
import net.gsantner.opoc.util.SimpleMarkdownParser;

@SuppressWarnings("unused")
public class AboutActivity extends AppCompatActivity {
Expand Down Expand Up @@ -60,18 +60,18 @@ protected void onCreate(Bundle savedInstanceState) {
textLicense.setMovementMethod(LinkMovementMethod.getInstance());
textContributors.setMovementMethod(LinkMovementMethod.getInstance());

Helpers helpers = Helpers.get();
helpers.setHtmlToTextView(textTeam,
Helpers.get().loadMarkdownForTextViewFromRaw(R.raw.maintainers, "")
ContextUtils cu = ContextUtils.get();
cu.setHtmlToTextView(textTeam,
ContextUtils.get().loadMarkdownForTextViewFromRaw(R.raw.maintainers, "")
);

helpers.setHtmlToTextView(textContributors,
Helpers.get().loadMarkdownForTextViewFromRaw(R.raw.contributors, "")
cu.setHtmlToTextView(textContributors,
cu.loadMarkdownForTextViewFromRaw(R.raw.contributors, "")
);

// License text MUST be shown
try {
helpers.setHtmlToTextView(textLicense,
cu.setHtmlToTextView(textLicense,
SimpleMarkdownParser.get().parse(getString(R.string.copyright_license_text_official).replace("\n", " \n"),
"", SimpleMarkdownParser.FILTER_ANDROID_TEXTVIEW).getHtml()
);
Expand All @@ -96,7 +96,7 @@ public void onButtonClicked(View v) {
switch (v.getId()) {
case R.id.about__activity__text_app_version: {
try {
HelpersA.get(this).showDialogWithHtmlTextView(R.string.changelog, new SimpleMarkdownParser().parse(
ActivityUtils.get(this).showDialogWithHtmlTextView(R.string.changelog, new SimpleMarkdownParser().parse(
getResources().openRawResource(R.raw.changelog),
"", SimpleMarkdownParser.FILTER_ANDROID_TEXTVIEW, SimpleMarkdownParser.FILTER_CHANGELOG
).getHtml()
Expand All @@ -107,12 +107,12 @@ public void onButtonClicked(View v) {
break;
}
case R.id.about__activity__button_app_license: {
HelpersA.get(this).showDialogWithHtmlTextView(R.string.licenses, Helpers.get().readTextfileFromRawRes(R.raw.license, "", ""), false, null);
ActivityUtils.get(this).showDialogWithHtmlTextView(R.string.licenses, ContextUtils.get().readTextfileFromRawRes(R.raw.license, "", ""), false, null);
break;
}
case R.id.about__activity__button_third_party_licenses: {
try {
HelpersA.get(this).showDialogWithHtmlTextView(R.string.licenses, new SimpleMarkdownParser().parse(
ActivityUtils.get(this).showDialogWithHtmlTextView(R.string.licenses, new SimpleMarkdownParser().parse(
getResources().openRawResource(R.raw.licenses_3rd_party),
"", SimpleMarkdownParser.FILTER_ANDROID_TEXTVIEW).getHtml()
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import io.github.gsantner.memetastic.App;
import io.github.gsantner.memetastic.R;
import io.github.gsantner.memetastic.util.AppSettings;
import io.github.gsantner.memetastic.util.Helpers;
import io.github.gsantner.memetastic.util.ContextUtils;

public class ImageViewActivity extends AppCompatActivity {
//########################
Expand Down Expand Up @@ -49,7 +49,7 @@ protected void onCreate(Bundle savedInstanceState) {
setContentView(R.layout.imageview__activity);
ButterKnife.bind(this);
app = (App) getApplication();
//Helpers.get().enableImmersiveMode(getWindow().getDecorView());
//ContextUtils.get().enableImmersiveMode(getWindow().getDecorView());

setSupportActionBar(toolbar);
if (getSupportActionBar() != null) {
Expand All @@ -66,7 +66,7 @@ protected void onCreate(Bundle savedInstanceState) {
".thumbnails" + File.separator + getString(R.string.app_name) + "_");
}

mBitmap = Helpers.get().loadImageFromFilesystem(imagePath);
mBitmap = ContextUtils.get().loadImageFromFilesystem(imagePath);
expandedImageView.setImageBitmap(mBitmap);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@
import io.github.gsantner.memetastic.ui.GridDecoration;
import io.github.gsantner.memetastic.ui.GridRecycleAdapter;
import io.github.gsantner.memetastic.util.AppSettings;
import io.github.gsantner.memetastic.util.Helpers;
import io.github.gsantner.memetastic.util.HelpersA;
import io.github.gsantner.memetastic.util.ContextUtils;
import io.github.gsantner.memetastic.util.ActivityUtils;
import io.github.gsantner.memetastic.util.ThumbnailCleanupTask;
import io.github.gsantner.opoc.util.SimpleMarkdownParser;
import net.gsantner.opoc.util.SimpleMarkdownParser;

public class MainActivity extends AppCompatActivity
implements NavigationView.OnNavigationItemSelectedListener, TabLayout.OnTabSelectedListener {
Expand Down Expand Up @@ -89,7 +89,7 @@ public class MainActivity extends AppCompatActivity
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Helpers.get().setAppLanguage(AppSettings.get().getLanguage());
ContextUtils.get().setAppLanguage(AppSettings.get().getLanguage());
if (AppSettings.get().isOverviewStatusBarHidden()) {
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
Expand All @@ -108,7 +108,7 @@ protected void onCreate(Bundle savedInstanceState) {
tabLayout.setOnTabSelectedListener(this);

// Setup Floating Action Button
int gridColumns = Helpers.get().isInPortraitMode()
int gridColumns = ContextUtils.get().isInPortraitMode()
? app.settings.getGridColumnCountPortrait()
: app.settings.getGridColumnCountLandscape();

Expand Down Expand Up @@ -141,12 +141,12 @@ protected void onCreate(Bundle savedInstanceState) {
String html = mdParser.parse(getString(R.string.copyright_license_text_official).replace("\n", " \n"), "").getHtml();
html += mdParser.parse(getResources().openRawResource(R.raw.licenses_3rd_party), "").getHtml();

HelpersA.get(this).showDialogWithHtmlTextView(R.string.licenses, html);
ActivityUtils.get(this).showDialogWithHtmlTextView(R.string.licenses, html);
} else if (app.settings.isAppCurrentVersionFirstStart()) {
mdParser.parse(
getResources().openRawResource(R.raw.changelog), "",
SimpleMarkdownParser.FILTER_ANDROID_TEXTVIEW, SimpleMarkdownParser.FILTER_CHANGELOG);
HelpersA.get(this).showDialogWithHtmlTextView(R.string.changelog, mdParser.getHtml());
ActivityUtils.get(this).showDialogWithHtmlTextView(R.string.changelog, mdParser.getHtml());
}

} catch (IOException e) {
Expand Down Expand Up @@ -222,11 +222,11 @@ public boolean handleBarClick(MenuItem item) {

switch (item.getItemId()) {
case R.id.action_about: {
HelpersA.get(this).animateToActivity(AboutActivity.class, false, null);
ActivityUtils.get(this).animateToActivity(AboutActivity.class, false, null);
return true;
}
case R.id.action_settings: {
HelpersA.get(this).animateToActivity(SettingsActivity.class, false, SettingsActivity.ACTIVITY_ID);
ActivityUtils.get(this).animateToActivity(SettingsActivity.class, false, SettingsActivity.ACTIVITY_ID);
return true;
}
case R.id.action_exit: {
Expand All @@ -242,16 +242,16 @@ public boolean handleBarClick(MenuItem item) {
return true;
}
case R.id.action_donate_bitcoin: {
Helpers.get().showDonateBitcoinRequest(R.string.donate__bitcoin_id, R.string.donate__bitcoin_amount, R.string.donate__bitcoin_message, R.string.donate__bitcoin_url);
ContextUtils.get().showDonateBitcoinRequest(R.string.donate__bitcoin_id, R.string.donate__bitcoin_amount, R.string.donate__bitcoin_message, R.string.donate__bitcoin_url);
return true;
}
case R.id.action_homepage_code: {
Helpers.get().openWebpageInExternalBrowser(getString(R.string.app_www_source));
ContextUtils.get().openWebpageInExternalBrowser(getString(R.string.app_www_source));
return true;
}
case R.id.action_picture_from_gallery: {
Intent i = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
HelpersA.get(this).animateToActivity(i, false, REQUEST_LOAD_GALLERY_IMAGE);
ActivityUtils.get(this).animateToActivity(i, false, REQUEST_LOAD_GALLERY_IMAGE);
return true;
}
case R.id.action_picture_from_camera: {
Expand All @@ -273,7 +273,7 @@ public boolean handleBarClick(MenuItem item) {
}
case R.id.action_mode_saved: {
emptylistText.setText(R.string.main__nodata__saved);
File filePath = Helpers.get().getPicturesMemetasticFolder();
File filePath = ContextUtils.get().getPicturesMemetasticFolder();
filePath.mkdirs();
memeOriginObject = new MemeOriginStorage(filePath, getString(R.string.dot_thumbnails));
toolbar.setTitle(R.string.main__mode__saved);
Expand Down Expand Up @@ -322,15 +322,15 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
onImageTemplateWasChosen(picturePath, false);
}
} else {
HelpersA.get(this).showSnackBar(R.string.main__error_no_picture_selected, false);
ActivityUtils.get(this).showSnackBar(R.string.main__error_no_picture_selected, false);
}
}

if (requestCode == REQUEST_TAKE_CAMERA_PICTURE) {
if (resultCode == RESULT_OK) {
onImageTemplateWasChosen(cameraPictureFilepath, false);
} else {
HelpersA.get(this).showSnackBar(R.string.main__error_no_picture_selected, false);
ActivityUtils.get(this).showSnackBar(R.string.main__error_no_picture_selected, false);
}
}
}
Expand All @@ -354,7 +354,7 @@ public void showCameraDialog() {
cameraPictureFilepath = photoFile.getAbsolutePath();

} catch (IOException ex) {
HelpersA.get(this).showSnackBar(R.string.main__error_camera_cannot_start, false);
ActivityUtils.get(this).showSnackBar(R.string.main__error_camera_cannot_start, false);
}

// Continue only if the File was successfully created
Expand All @@ -365,7 +365,7 @@ public void showCameraDialog() {
} else {
takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(photoFile));
}
HelpersA.get(this).animateToActivity(takePictureIntent, false, REQUEST_TAKE_CAMERA_PICTURE);
ActivityUtils.get(this).animateToActivity(takePictureIntent, false, REQUEST_TAKE_CAMERA_PICTURE);
}
}
}
Expand All @@ -374,7 +374,7 @@ public void onImageTemplateWasChosen(String filePath, boolean bIsAsset) {
final Intent intent = new Intent(this, MemeCreateActivity.class);
intent.putExtra(MemeCreateActivity.EXTRA_IMAGE_PATH, filePath);
intent.putExtra(MemeCreateActivity.ASSET_IMAGE, bIsAsset);
HelpersA.get(this).animateToActivity(intent, false, MemeCreateActivity.RESULT_MEME_EDITING_FINISHED);
ActivityUtils.get(this).animateToActivity(intent, false, MemeCreateActivity.RESULT_MEME_EDITING_FINISHED);
}

public void openImageViewActivityWithImage(String imagePath) {
Expand All @@ -383,7 +383,7 @@ public void openImageViewActivityWithImage(String imagePath) {
Intent intent = new Intent(this, ImageViewActivity.class);
intent.putExtra(IMAGE_PATH, imagePath);
intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
HelpersA.get(this).animateToActivity(intent, false, null);
ActivityUtils.get(this).animateToActivity(intent, false, null);
}

@Override
Expand All @@ -399,7 +399,7 @@ public void onTabSelected(TabLayout.Tab tab) {

// Custom tab
if (tabPos >= 0 && tabPos == MemeLibConfig.MEME_CATEGORIES.ALL.length) {
File customFolder = Helpers.get().getPicturesMemetasticTemplatesCustomFolder();
File customFolder = ContextUtils.get().getPicturesMemetasticTemplatesCustomFolder();
emptylistText.setText(getString(R.string.main__nodata__custom_templates, getString(R.string.custom_templates_visual)));
memeOriginObject = new MemeOriginStorage(customFolder, getString(R.string.dot_thumbnails));
((MemeOriginStorage) memeOriginObject).setIsTemplate(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@
import io.github.gsantner.memetastic.ui.FontAdapter;
import io.github.gsantner.memetastic.util.AndroidBug5497Workaround;
import io.github.gsantner.memetastic.util.AppSettings;
import io.github.gsantner.memetastic.util.Helpers;
import io.github.gsantner.memetastic.util.HelpersA;
import io.github.gsantner.memetastic.util.ContextUtils;
import io.github.gsantner.memetastic.util.ActivityUtils;
import uz.shift.colorpicker.LineColorPicker;

/**
Expand Down Expand Up @@ -245,7 +245,7 @@ private Bitmap extractBitmapFromIntent(final Intent intent) {
//Scale big images down to avoid "out of memory"
InputStream inputStream = getAssets().open(imagePath);
BitmapFactory.decodeStream(inputStream, new Rect(0, 0, 0, 0), options);
options.inSampleSize = Helpers.get().calculateInSampleSize(options, app.settings.getRenderQualityReal());
options.inSampleSize = ContextUtils.get().calculateInSampleSize(options, app.settings.getRenderQualityReal());
options.inJustDecodeBounds = false;
inputStream.close();
inputStream = getAssets().open(imagePath);
Expand All @@ -257,7 +257,7 @@ private Bitmap extractBitmapFromIntent(final Intent intent) {
} else {
//Scale big images down to avoid "out of memory"
BitmapFactory.decodeFile(imagePath, options);
options.inSampleSize = Helpers.get().calculateInSampleSize(options, app.settings.getRenderQualityReal());
options.inSampleSize = ContextUtils.get().calculateInSampleSize(options, app.settings.getRenderQualityReal());
options.inJustDecodeBounds = false;
bitmap = BitmapFactory.decodeFile(imagePath, options);
}
Expand Down Expand Up @@ -308,7 +308,7 @@ public boolean onImageTouched(View view) {
textEditBottomCaption.clearFocus();
textEditTopCaption.clearFocus();
imageEditView.requestFocus();
HelpersA.get(this).hideSoftKeyboard();
ActivityUtils.get(this).hideSoftKeyboard();
if (moarControlsContainerVisible) {
toggleMoarControls(true, false);
}
Expand Down Expand Up @@ -357,7 +357,7 @@ private boolean saveMemeToFilesystem(boolean showDialog) {
}

String filename = String.format(Locale.getDefault(), "%s_%d.jpg", getString(R.string.app_name), memeSavetime);
boolean wasSaved = Helpers.get().saveBitmapToFile(filepath, filename, lastBitmap) != null && Helpers.get().saveBitmapToFile(thumbnailPath, filename, Helpers.get().createThumbnail(lastBitmap)) != null;
boolean wasSaved = ContextUtils.get().writeImageToFileJpeg(filepath, filename, lastBitmap) != null && ContextUtils.get().writeImageToFileJpeg(thumbnailPath, filename, ContextUtils.get().scaleBitmap(lastBitmap)) != null;
if (wasSaved && showDialog) {

AlertDialog.Builder dialog = new AlertDialog.Builder(this);
Expand Down Expand Up @@ -411,7 +411,7 @@ public void toggleMoarControls(boolean forceVisibile, boolean visible) {
@OnClick(R.id.fab)
public void onFloatingButtonClicked(View view) {
toggleMoarControls(false, false);
HelpersA.get(this).hideSoftKeyboard();
ActivityUtils.get(this).hideSoftKeyboard();
View focusedView = this.getCurrentFocus();
if (focusedView != null) {
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
Expand Down Expand Up @@ -536,7 +536,7 @@ public Bitmap drawMultilineTextToBitmap(Context c, MemeSetting memeSetting) {
bitmap = workBmp;
}

float scale = Helpers.get().getScalingFactorInPixelsForWritingOnPicture(bitmap.getWidth(), bitmap.getHeight());
float scale = ContextUtils.get().getScalingFactorInPixelsForWritingOnPicture(bitmap.getWidth(), bitmap.getHeight());
float borderScale = scale * memeSetting.getCaptionTop().getFontSize() / MemeLibConfig.FONT_SIZES.DEFAULT;
Bitmap.Config bitmapConfig = bitmap.getConfig();
// set default bitmap config if none
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@

import io.github.gsantner.memetastic.BuildConfig;
import io.github.gsantner.memetastic.R;
import io.github.gsantner.memetastic.util.Helpers;
import io.github.gsantner.memetastic.util.HelpersA;
import io.github.gsantner.memetastic.util.ContextUtils;
import io.github.gsantner.memetastic.util.ActivityUtils;

public class SplashActivity extends AppCompatActivity {

Expand Down Expand Up @@ -70,8 +70,8 @@ public void onRequestPermissionsResult(int req, String[] perm, int[] grantResult
private void startMemeCreator(boolean skipDelay) {
// Create MemeCreator directories
int delay = (skipDelay || BuildConfig.DEBUG) ? 1000 : getResources().getInteger(R.integer.splash_delay);
new File(Helpers.get().getPicturesMemetasticFolder(), getString(R.string.dot_thumbnails)).mkdirs();
new File(Helpers.get().getPicturesMemetasticTemplatesCustomFolder(), getString(R.string.dot_thumbnails)).mkdirs();
new File(ContextUtils.get().getPicturesMemetasticFolder(), getString(R.string.dot_thumbnails)).mkdirs();
new File(ContextUtils.get().getPicturesMemetasticTemplatesCustomFolder(), getString(R.string.dot_thumbnails)).mkdirs();


// Start activity and exit splash
Expand All @@ -80,7 +80,7 @@ private void startMemeCreator(boolean skipDelay) {
handler.postDelayed(new Runnable() {
@Override
public void run() {
HelpersA.get(SplashActivity.this).animateToActivity(MainActivity.class, true, null);
ActivityUtils.get(SplashActivity.this).animateToActivity(MainActivity.class, true, null);
}
}, delay);
}
Expand Down
Loading

0 comments on commit 6c918af

Please sign in to comment.