Skip to content

Commit

Permalink
Implement Android N new language flow
Browse files Browse the repository at this point in the history
  • Loading branch information
DA-XIA committed May 15, 2017
1 parent 25685b6 commit 16ec156
Show file tree
Hide file tree
Showing 15 changed files with 218 additions and 46 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.kiminonawa.mydiary.backup;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
Expand All @@ -14,6 +15,8 @@

import com.kiminonawa.mydiary.R;
import com.kiminonawa.mydiary.main.MainActivity;
import com.kiminonawa.mydiary.shared.language.LanguagerHelper;
import com.kiminonawa.mydiary.shared.language.MyContextWrapper;
import com.kiminonawa.mydiary.shared.gui.MyDiaryButton;
import com.nononsenseapps.filepicker.FilePickerActivity;

Expand Down Expand Up @@ -88,6 +91,11 @@ protected void onActivityResult(int requestCode, int resultCode, Intent intent)
}
}

@Override
protected void attachBaseContext(Context newBase) {
super.attachBaseContext(MyContextWrapper.wrap(newBase, LanguagerHelper.getLocaleLanguage(newBase)));
}


@Override
public void onClick(View v) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
package com.kiminonawa.mydiary.backup;

import android.content.Context;
import android.os.Environment;

import com.kiminonawa.mydiary.shared.language.LanguagerHelper;
import com.kiminonawa.mydiary.shared.language.MyContextWrapper;
import com.nononsenseapps.filepicker.AbstractFilePickerFragment;
import com.nononsenseapps.filepicker.FilePickerActivity;

Expand Down Expand Up @@ -38,6 +41,12 @@ protected AbstractFilePickerFragment<File> getFragment(
return currentFragment;
}

@Override
protected void attachBaseContext(Context newBase) {
super.attachBaseContext(MyContextWrapper.wrap(newBase, LanguagerHelper.getLocaleLanguage(newBase)));
}


/**
* Override the back-button.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.kiminonawa.mydiary.contacts;

import android.content.Context;
import android.database.Cursor;
import android.graphics.PorterDuff;
import android.os.Bundle;
Expand All @@ -14,6 +15,8 @@

import com.kiminonawa.mydiary.R;
import com.kiminonawa.mydiary.db.DBManager;
import com.kiminonawa.mydiary.shared.language.LanguagerHelper;
import com.kiminonawa.mydiary.shared.language.MyContextWrapper;
import com.kiminonawa.mydiary.shared.SPFManager;
import com.kiminonawa.mydiary.shared.ThemeManager;
import com.kiminonawa.mydiary.shared.gui.LetterComparator;
Expand Down Expand Up @@ -127,6 +130,11 @@ protected void onCreate(Bundle savedInstanceState) {
initTopicAdapter();
}

@Override
protected void attachBaseContext(Context newBase) {
super.attachBaseContext(MyContextWrapper.wrap(newBase, LanguagerHelper.getLocaleLanguage(newBase)));
}

private void initLanguageStr() {
EN = Locale.ENGLISH.getLanguage();
JA = Locale.JAPANESE.getLanguage();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.kiminonawa.mydiary.entries;

import android.content.Context;
import android.database.Cursor;
import android.os.Bundle;
import android.support.annotation.NonNull;
Expand All @@ -26,6 +27,8 @@
import com.kiminonawa.mydiary.entries.diary.item.IDairyRow;
import com.kiminonawa.mydiary.entries.entries.EntriesEntity;
import com.kiminonawa.mydiary.entries.entries.EntriesFragment;
import com.kiminonawa.mydiary.shared.language.LanguagerHelper;
import com.kiminonawa.mydiary.shared.language.MyContextWrapper;
import com.kiminonawa.mydiary.shared.ThemeManager;
import com.kiminonawa.mydiary.shared.statusbar.ChinaPhoneHelper;

Expand Down Expand Up @@ -121,6 +124,11 @@ protected void onStop() {
mGoogleApiClient.disconnect();
}

@Override
protected void attachBaseContext(Context newBase) {
super.attachBaseContext(MyContextWrapper.wrap(newBase, LanguagerHelper.getLocaleLanguage(newBase)));
}


/**
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.kiminonawa.mydiary.entries.photo;

import android.annotation.TargetApi;
import android.content.Context;
import android.graphics.Color;
import android.net.Uri;
import android.os.Build;
Expand All @@ -12,6 +13,8 @@
import android.widget.Toast;

import com.kiminonawa.mydiary.R;
import com.kiminonawa.mydiary.shared.language.LanguagerHelper;
import com.kiminonawa.mydiary.shared.language.MyContextWrapper;
import com.kiminonawa.mydiary.shared.ScreenHelper;

import java.util.ArrayList;
Expand Down Expand Up @@ -71,6 +74,12 @@ public void onCreate(Bundle savedInstanceState) {
}
}

@Override
protected void attachBaseContext(Context newBase) {
super.attachBaseContext(MyContextWrapper.wrap(newBase, LanguagerHelper.getLocaleLanguage(newBase)));
}


@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void setStatusBarColor() {
Window window = getWindow();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.kiminonawa.mydiary.entries.photo;

import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
Expand All @@ -12,6 +13,8 @@

import com.kiminonawa.mydiary.R;
import com.kiminonawa.mydiary.shared.FileManager;
import com.kiminonawa.mydiary.shared.language.LanguagerHelper;
import com.kiminonawa.mydiary.shared.language.MyContextWrapper;

import java.io.File;
import java.util.ArrayList;
Expand Down Expand Up @@ -71,6 +74,12 @@ protected void onCreate(Bundle savedInstanceState) {
}
}

@Override
protected void attachBaseContext(Context newBase) {
super.attachBaseContext(MyContextWrapper.wrap(newBase, LanguagerHelper.getLocaleLanguage(newBase)));
}


private void loadDiaryImageData(long topicId, long diaryId) {
FileManager diaryRoot = new FileManager(PhotoOverviewActivity.this, DIARY_ROOT_DIR);
File topicRootFile;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.kiminonawa.mydiary.init;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
Expand All @@ -11,6 +12,8 @@
import com.kiminonawa.mydiary.R;
import com.kiminonawa.mydiary.main.MainActivity;
import com.kiminonawa.mydiary.security.PasswordActivity;
import com.kiminonawa.mydiary.shared.language.LanguagerHelper;
import com.kiminonawa.mydiary.shared.language.MyContextWrapper;
import com.kiminonawa.mydiary.shared.MyDiaryApplication;
import com.kiminonawa.mydiary.shared.SPFManager;

Expand Down Expand Up @@ -52,6 +55,11 @@ protected void onPause() {
initHandler.removeCallbacksAndMessages(null);
}

@Override
protected void attachBaseContext(Context newBase) {
super.attachBaseContext(MyContextWrapper.wrap(newBase, LanguagerHelper.getLocaleLanguage(newBase)));
}


@Override
public void onInitCompiled(boolean showReleaseNote) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
package com.kiminonawa.mydiary.main;

import android.content.Context;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.widget.TextView;

import com.kiminonawa.mydiary.R;
import com.kiminonawa.mydiary.shared.language.LanguagerHelper;
import com.kiminonawa.mydiary.shared.language.MyContextWrapper;
import com.kiminonawa.mydiary.shared.statusbar.ChinaPhoneHelper;

/**
Expand Down Expand Up @@ -75,6 +78,12 @@ public void onCreate(Bundle savedInstanceState) {
((TextView) findViewById(R.id.TV_about_text)).setText(license.toString());
}

@Override
protected void attachBaseContext(Context newBase) {
super.attachBaseContext(MyContextWrapper.wrap(newBase, LanguagerHelper.getLocaleLanguage(newBase)));
}


public class LicenseObj {

public final static int MIT = 0;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.kiminonawa.mydiary.main;

import android.content.Context;
import android.database.Cursor;
import android.graphics.PorterDuff;
import android.os.Bundle;
Expand Down Expand Up @@ -34,6 +35,8 @@
import com.kiminonawa.mydiary.main.topic.Memo;
import com.kiminonawa.mydiary.oobe.CustomViewTarget;
import com.kiminonawa.mydiary.shared.FileManager;
import com.kiminonawa.mydiary.shared.language.LanguagerHelper;
import com.kiminonawa.mydiary.shared.language.MyContextWrapper;
import com.kiminonawa.mydiary.shared.SPFManager;
import com.kiminonawa.mydiary.shared.ThemeManager;
import com.kiminonawa.mydiary.shared.gui.MyDiaryButton;
Expand Down Expand Up @@ -188,6 +191,12 @@ public void onDestroy() {
super.onDestroy();
}

@Override
protected void attachBaseContext(Context newBase) {
super.attachBaseContext(MyContextWrapper.wrap(newBase, LanguagerHelper.getLocaleLanguage(newBase)));
}


@Override
public void onBackPressed() {
if (!isExit) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.kiminonawa.mydiary.memo;

import android.content.Context;
import android.database.Cursor;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
Expand All @@ -13,6 +14,8 @@

import com.kiminonawa.mydiary.R;
import com.kiminonawa.mydiary.db.DBManager;
import com.kiminonawa.mydiary.shared.language.LanguagerHelper;
import com.kiminonawa.mydiary.shared.language.MyContextWrapper;
import com.kiminonawa.mydiary.shared.ThemeManager;
import com.kiminonawa.mydiary.shared.ViewTools;
import com.kiminonawa.mydiary.shared.statusbar.ChinaPhoneHelper;
Expand Down Expand Up @@ -109,6 +112,12 @@ public void onClick(View v) {
initTopicAdapter();
}

@Override
protected void attachBaseContext(Context newBase) {
super.attachBaseContext(MyContextWrapper.wrap(newBase, LanguagerHelper.getLocaleLanguage(newBase)));
}


private void loadMemo(boolean openDB) {
memoList.clear();
if (openDB) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.kiminonawa.mydiary.security;

import android.content.Context;
import android.content.Intent;
import android.graphics.PorterDuff;
import android.os.Bundle;
Expand All @@ -13,6 +14,8 @@
import com.kiminonawa.mydiary.R;
import com.kiminonawa.mydiary.main.MainActivity;
import com.kiminonawa.mydiary.shared.Encryption;
import com.kiminonawa.mydiary.shared.language.LanguagerHelper;
import com.kiminonawa.mydiary.shared.language.MyContextWrapper;
import com.kiminonawa.mydiary.shared.MyDiaryApplication;
import com.kiminonawa.mydiary.shared.SPFManager;
import com.kiminonawa.mydiary.shared.ThemeManager;
Expand Down Expand Up @@ -123,6 +126,12 @@ public void onClick(View v) {
initUI();
}

@Override
protected void attachBaseContext(Context newBase) {
super.attachBaseContext(MyContextWrapper.wrap(newBase, LanguagerHelper.getLocaleLanguage(newBase)));
}


private void initUI() {
IV_password_number_1.requestFocus();
switch (currentMode) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.kiminonawa.mydiary.setting;

import android.content.Context;
import android.content.Intent;
import android.graphics.BitmapFactory;
import android.graphics.drawable.ColorDrawable;
Expand All @@ -17,6 +18,8 @@
import com.kiminonawa.mydiary.R;
import com.kiminonawa.mydiary.shared.ColorTools;
import com.kiminonawa.mydiary.shared.FileManager;
import com.kiminonawa.mydiary.shared.language.LanguagerHelper;
import com.kiminonawa.mydiary.shared.language.MyContextWrapper;
import com.kiminonawa.mydiary.shared.OldVersionHelper;
import com.kiminonawa.mydiary.shared.PermissionHelper;
import com.kiminonawa.mydiary.shared.SPFManager;
Expand Down Expand Up @@ -136,6 +139,12 @@ public void onActivityResult(int requestCode, int resultCode, Intent data) {
}
}

@Override
protected void attachBaseContext(Context newBase) {
super.attachBaseContext(MyContextWrapper.wrap(newBase, LanguagerHelper.getLocaleLanguage(newBase)));
}


@Override
public void onRequestPermissionsResult(int requestCode,
String permissions[], int[] grantResults) {
Expand Down
Loading

0 comments on commit 16ec156

Please sign in to comment.