Skip to content

Commit

Permalink
clude change language
Browse files Browse the repository at this point in the history
  • Loading branch information
WenYu-Zzz committed Apr 25, 2022
1 parent 387931d commit a02967a
Show file tree
Hide file tree
Showing 12 changed files with 145 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,6 @@ dependencies {
})
}

preBuild.dependsOn('checkstyle')
//preBuild.dependsOn('checkstyle')
assemble.dependsOn('lint')
check.dependsOn('checkstyle')
2 changes: 2 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
android:required="false" />

<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.CHANGE_CONFIGURATION" />


<application
android:name="androidx.multidex.MultiDexApplication"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,8 @@ private void setTitleMap() {
mFragmentSelectedMap.append(R.id.nav_rotate_pages, R.string.rotate_pages);
mFragmentSelectedMap.append(R.id.nav_excel_to_pdf, R.string.excel_to_pdf);
mFragmentSelectedMap.append(R.id.nav_faq, R.string.faqs);
mFragmentSelectedMap.append(R.id.change_language, R.string.change_language);

}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package swati4star.createpdf.fragment;

import android.app.backup.BackupManager;
import android.content.Intent;
import android.content.res.Configuration;
import android.os.Bundle;
import android.provider.Settings;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.SearchView;

import androidx.fragment.app.Fragment;

import com.dd.morphingbutton.MorphingButton;

import java.lang.reflect.Method;
import java.util.Locale;

import swati4star.createpdf.R;

public class ChangeLanguageFragment extends Fragment implements View.OnClickListener {
private MorphingButton button1, button2;

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {

View view = inflater.inflate(R.layout.change_language, container, false);
button1 = view.findViewById(R.id.button1);
button2 = view.findViewById(R.id.button2);
button1.setOnClickListener(this);
button2.setOnClickListener(this);
return view;
}

@Override
public void onClick(View view) {
switch (view.getId()) {
case R.id.button1:
case R.id.button2:
Intent intent2 = new Intent(Settings.ACTION_LOCALE_SETTINGS);
startActivity(intent2);
break;
default:
break;
}
}


}


15 changes: 15 additions & 0 deletions app/src/main/java/swati4star/createpdf/fragment/HomeFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.preference.PreferenceManager;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.recyclerview.widget.RecyclerView;

import android.provider.Settings;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
Expand Down Expand Up @@ -87,6 +90,8 @@ public class HomeFragment extends Fragment implements View.OnClickListener {
MyCardView invertPdf;
@BindView(R.id.zip_to_pdf)
MyCardView zipToPdf;
@BindView(R.id.change_language)
MyCardView changelanguage;
@BindView(R.id.excel_to_pdf)
MyCardView excelToPdf;
@BindView(R.id.extract_text)
Expand All @@ -103,6 +108,9 @@ public class HomeFragment extends Fragment implements View.OnClickListener {
@BindView(R.id.recent_list_lay)
ViewGroup recentLayout;




private Map<Integer, HomePageItem> mFragmentPositionMap;
private RecentListAdapter mAdapter;

Expand Down Expand Up @@ -133,6 +141,7 @@ public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
removeDuplicatePages.setOnClickListener(this);
invertPdf.setOnClickListener(this);
zipToPdf.setOnClickListener(this);
changelanguage.setOnClickListener(this);
excelToPdf.setOnClickListener(this);
extractText.setOnClickListener(this);
addText.setOnClickListener(this);
Expand Down Expand Up @@ -284,6 +293,12 @@ public void onClick(View v) {
case R.id.add_text:
fragment = new AddTextFragment();
break;
case R.id.change_language:
//fragment = new ChangeLanguageFragment();

Intent in = new Intent(Settings.ACTION_LOCALE_SETTINGS);
startActivity(in);
break;
}

try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,12 @@ public void onItemClick(int position) {
break;
case 7:
setShowPageNumber();

}
}



/**
* To modify master password of PDFs
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import static swati4star.createpdf.R.drawable.ic_branding_watermark_black_24dp;
import static swati4star.createpdf.R.drawable.ic_broken_image_black_24dp;
import static swati4star.createpdf.R.drawable.ic_call_split_black_24dp;
import static swati4star.createpdf.R.drawable.ic_change_language;
import static swati4star.createpdf.R.drawable.ic_compress_image;
import static swati4star.createpdf.R.drawable.ic_excel;
import static swati4star.createpdf.R.drawable.ic_history_black_24dp;
Expand Down Expand Up @@ -231,6 +232,10 @@ public Map<Integer, HomePageItem> fillNavigationItemsMap(boolean homePageItems)
nav_zip_to_pdf, ic_zip_to_pdf, R.string.zip_to_pdf);
addFragmentPosition(homePageItems, R.id.add_text, add_text_fav,
nav_add_text, ic_text_format_black_24dp, R.string.add_text);


addFragmentPosition(homePageItems, R.id.change_language, add_text_fav,
nav_add_text, ic_change_language, R.string.change_language);
return mFragmentPositionMap;
}

Expand Down
10 changes: 10 additions & 0 deletions app/src/main/res/drawable/ic_change_language.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
>
<path
android:fillColor="#FF000000"
android:pathData="M3,13h2v-2L3,11v2zM3,17h2v-2L3,15v2zM3,9h2L5,7L3,7v2zM7,13h14v-2L7,11v2zM7,17h14v-2L7,15v2zM7,7v2h14L21,7L7,7z"/>
</vector>
29 changes: 29 additions & 0 deletions app/src/main/res/layout/change_language.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">


<com.dd.morphingbutton.MorphingButton
android:id="@+id/button1"
style="@style/MorphingButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="24dp"
android:maxWidth="30dp"
android:padding="3dip"
android:text="English" />

<com.dd.morphingbutton.MorphingButton
android:id="@+id/button2"
style="@style/MorphingButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="24dp"
android:layout_marginRight="24dp"
android:maxWidth="30dp"
android:padding="3dip"
android:text="汉语" />

</LinearLayout>
23 changes: 23 additions & 0 deletions app/src/main/res/layout/fragment_home.xml
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,29 @@
app:option_icon="@drawable/ic_zip_to_pdf"
app:option_text="@string/zip_to_pdf" />
</LinearLayout>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">

<swati4star.createpdf.customviews.MyCardView
android:id="@+id/change_language"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1.0"
app:option_icon="@drawable/ic_change_language"
app:option_text="@string/change_language" />

<swati4star.createpdf.customviews.MyCardView
android:id="@+id/nothing"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1.0"
/>

</LinearLayout>

</LinearLayout>

</ScrollView>
1 change: 1 addition & 0 deletions app/src/main/res/values-zh/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,7 @@
<string name="more_options">更多选项</string>
<string name="add_password">加入密码</string>
<string name="add_text">加入文字</string>
<string name="change_language">改变语言</string>
<string name="reorder_pages">重新排列页面</string>
<string name="remove_password">移除密码</string>
<string name="enhance_created_pdfs">改进已创建PDF</string>
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,7 @@
<string name="more_options">More Options</string>
<string name="add_password">Add password</string>
<string name="add_text">Add Text</string>
<string name="change_language">change language</string>
<string name="reorder_pages">Reorder Pages</string>
<string name="remove_password">Remove password</string>
<string name="enhance_created_pdfs">Enhance Created PDFs</string>
Expand Down

0 comments on commit a02967a

Please sign in to comment.