2019-06-03 23:25:05 +02:00
|
|
|
package org.mian.gitnex.fragments;
|
|
|
|
|
|
|
|
import android.content.Intent;
|
|
|
|
import android.os.Bundle;
|
|
|
|
import android.view.LayoutInflater;
|
|
|
|
import android.view.View;
|
|
|
|
import android.view.ViewGroup;
|
|
|
|
import android.widget.LinearLayout;
|
2020-04-07 22:39:08 +02:00
|
|
|
import androidx.annotation.NonNull;
|
|
|
|
import androidx.annotation.Nullable;
|
|
|
|
import androidx.fragment.app.Fragment;
|
2019-06-03 23:25:05 +02:00
|
|
|
import org.mian.gitnex.R;
|
2020-04-26 15:36:33 +02:00
|
|
|
import org.mian.gitnex.activities.SettingsAppearanceActivity;
|
|
|
|
import org.mian.gitnex.activities.SettingsFileViewerActivity;
|
|
|
|
import org.mian.gitnex.activities.SettingsReportsActivity;
|
|
|
|
import org.mian.gitnex.activities.SettingsSecurityActivity;
|
|
|
|
import org.mian.gitnex.activities.SettingsTranslationActivity;
|
2020-07-07 19:15:01 +02:00
|
|
|
import org.mian.gitnex.helpers.TinyDB;
|
2019-06-03 23:25:05 +02:00
|
|
|
import java.util.Objects;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Author M M Arif
|
|
|
|
*/
|
|
|
|
|
|
|
|
public class SettingsFragment extends Fragment {
|
|
|
|
|
2020-04-07 22:39:08 +02:00
|
|
|
@Nullable
|
|
|
|
@Override
|
|
|
|
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
2019-06-03 23:25:05 +02:00
|
|
|
|
2020-04-07 22:39:08 +02:00
|
|
|
View v = inflater.inflate(R.layout.fragment_settings, container, false);
|
2020-03-05 21:56:42 +01:00
|
|
|
|
2020-05-14 12:46:49 +02:00
|
|
|
LinearLayout appearanceFrame = v.findViewById(R.id.appearanceFrame);
|
2020-04-26 15:36:33 +02:00
|
|
|
LinearLayout fileViewerFrame = v.findViewById(R.id.fileViewerFrame);
|
|
|
|
LinearLayout securityFrame = v.findViewById(R.id.securityFrame);
|
|
|
|
LinearLayout languagesFrame = v.findViewById(R.id.languagesFrame);
|
|
|
|
LinearLayout reportsFrame = v.findViewById(R.id.reportsFrame);
|
2020-03-06 14:46:22 +01:00
|
|
|
|
2020-05-14 12:46:49 +02:00
|
|
|
appearanceFrame.setOnClickListener(v1 -> startActivity(new Intent(getContext(), SettingsAppearanceActivity.class)));
|
2020-04-02 02:59:00 +02:00
|
|
|
|
2020-04-26 15:36:33 +02:00
|
|
|
fileViewerFrame.setOnClickListener(v1 -> startActivity(new Intent(getContext(), SettingsFileViewerActivity.class)));
|
2020-04-02 02:59:00 +02:00
|
|
|
|
2020-04-26 15:36:33 +02:00
|
|
|
securityFrame.setOnClickListener(v1 -> startActivity(new Intent(getContext(), SettingsSecurityActivity.class)));
|
2020-04-04 21:20:25 +02:00
|
|
|
|
2020-04-26 15:36:33 +02:00
|
|
|
languagesFrame.setOnClickListener(v1 -> startActivity(new Intent(getContext(), SettingsTranslationActivity.class)));
|
2020-04-04 21:20:25 +02:00
|
|
|
|
2020-04-26 15:36:33 +02:00
|
|
|
reportsFrame.setOnClickListener(v1 -> startActivity(new Intent(getContext(), SettingsReportsActivity.class)));
|
2020-04-07 22:39:08 +02:00
|
|
|
|
|
|
|
return v;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2020-04-26 15:36:33 +02:00
|
|
|
public void onResume() {
|
|
|
|
|
|
|
|
super.onResume();
|
2020-04-07 22:39:08 +02:00
|
|
|
|
2020-04-26 15:36:33 +02:00
|
|
|
TinyDB tinyDb = new TinyDB(getContext());
|
|
|
|
|
|
|
|
if(tinyDb.getBoolean("refreshParent")) {
|
|
|
|
Objects.requireNonNull(getActivity()).recreate();
|
|
|
|
getActivity().overridePendingTransition(0, 0);
|
|
|
|
tinyDb.putBoolean("refreshParent", false);
|
|
|
|
}
|
2020-04-07 22:39:08 +02:00
|
|
|
|
|
|
|
}
|
2019-06-03 23:25:05 +02:00
|
|
|
|
|
|
|
}
|