Skip to content

Commit

Permalink
Merge pull request #36 from zVolt/feature/improving
Browse files Browse the repository at this point in the history
removing unused resources and old activity
  • Loading branch information
zkhan93 authored Oct 31, 2021
2 parents df54b86 + 80b97f5 commit a9dc4b0
Show file tree
Hide file tree
Showing 54 changed files with 42 additions and 1,449 deletions.
22 changes: 9 additions & 13 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,14 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:theme="@style/AppTheme.NoActionBar" />
<activity
android:name=".SettingsActivity"
android:label="@string/title_settings"
android:parentActivityName=".MainActivity"
android:parentActivityName=".HomeActivity"
android:theme="@style/AppTheme.NoActionBar">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="io.github.zkhan93.familyfinance.MainActivity" />
android:value="io.github.zkhan93.familyfinance.HomeActivity" />
</activity>
<activity
android:name=".SelectFamilyActivity"
Expand All @@ -47,11 +43,11 @@
<activity
android:name=".AddMemberActivity"
android:label="@string/title_activity_add_member"
android:parentActivityName=".MainActivity"
android:parentActivityName=".HomeActivity"
android:theme="@style/AppTheme.NoActionBar">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="io.github.zkhan93.familyfinance.MainActivity" />
android:value="io.github.zkhan93.familyfinance.HomeActivity" />
</activity>
<activity
android:name=".PinActivity"
Expand All @@ -60,25 +56,25 @@
android:theme="@style/AppTheme.Dark">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="io.github.zkhan93.familyfinance.MainActivity" />
android:value="io.github.zkhan93.familyfinance.HomeActivity" />
</activity>
<activity
android:name=".CardDetailActivity"
android:label="@string/title_activity_about"
android:parentActivityName=".MainActivity"
android:parentActivityName=".HomeActivity"
android:theme="@style/AppTheme.NoActionBar">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="io.github.zkhan93.familyfinance.MainActivity" />
android:value="io.github.zkhan93.familyfinance.HomeActivity" />
</activity>
<activity
android:name=".AboutActivity"
android:label="@string/title_activity_about"
android:parentActivityName=".MainActivity"
android:parentActivityName=".HomeActivity"
android:theme="@style/AppTheme.NoActionBar">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="io.github.zkhan93.familyfinance.MainActivity" />
android:value="io.github.zkhan93.familyfinance.HomeActivity" />
</activity>

<meta-data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import android.view.MenuInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;

import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
Expand Down Expand Up @@ -44,7 +43,6 @@ public class FragmentAccounts extends Fragment implements AccountVH.ItemInteract

private String familyId;
private AccountListAdapter accountListAdapter;
private Toast toast;
RecyclerView accountsList;
ValueEventListener connectionEventListener = new ValueEventListener() {
@Override
Expand All @@ -53,15 +51,9 @@ public void onDataChange(DataSnapshot snapshot) {
return;
Boolean connected = snapshot.getValue(Boolean.class);
if (connected != null && connected) {
toast.cancel();
toast.setText("connected");
toast.setDuration(Toast.LENGTH_SHORT);
toast.show();
Log.d(TAG, "connected");
} else {
toast.cancel();
toast.setText("not connected");
toast.setDuration(Toast.LENGTH_SHORT);
toast.show();
Log.d(TAG, "not connected");
}
}

Expand Down Expand Up @@ -107,7 +99,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
// Inflate the layout for this fragment
View rootView = inflater.inflate(R.layout.fragment_accounts, container, false);
accountsList = rootView.findViewById(R.id.list);
toast = Toast.makeText(getActivity(), "", Toast.LENGTH_SHORT);

FirebaseDatabase.getInstance().getReference(".info/connected").addValueEventListener
(connectionEventListener);
accountListAdapter = new AccountListAdapter((App) getActivity().getApplication(), familyId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;

Expand Down Expand Up @@ -78,6 +77,7 @@ public void onCreate(Bundle savedInstanceState) {
familyId =
PreferenceManager.getDefaultSharedPreferences(requireActivity()).getString(ARG_FAMILY_ID, null);
}
appState = new ViewModelProvider(requireActivity()).get(AppState.class);
}

@Override
Expand All @@ -91,7 +91,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
ccardsList.setLayoutManager(new LinearLayoutManager(requireActivity().getApplicationContext()));
ccardsList.setAdapter(cCardListAdapter);
setHasOptionsMenu(true);
setUpFab();
showFab();
return rootView;
}

Expand All @@ -100,6 +100,7 @@ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceStat
super.onViewCreated(view, savedInstanceState);
appState.getFabAction().observe(getViewLifecycleOwner(), id -> {
Util.Log.d(TAG, "click: %s", id);
// TODO: probably we have to ignore the first trigger
if (id.equals(TAG))
DialogFragmentCcard.newInstance(familyId).show(getParentFragmentManager(),
DialogFragmentCcard.TAG);
Expand All @@ -109,7 +110,13 @@ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceStat
@Override
public void onResume() {
super.onResume();
appState.getFabActionID().setValue(TAG);
showFab();
}

@Override
public void onPause() {
super.onPause();
appState.disableFab();
}

@Override
Expand All @@ -135,16 +142,8 @@ public void onStop() {
}


@Override
public boolean onOptionsItemSelected(MenuItem item) {
return super.onOptionsItemSelected(item);

}

private void setUpFab(){
appState = new ViewModelProvider(requireActivity()).get(AppState.class);
appState.getFabIcon().setValue(R.drawable.ic_add_white_24dp);
appState.getFabShow().setValue(true);
private void showFab() {
appState.enableFab(R.drawable.ic_add_white_24dp, TAG);
}

@Override
Expand Down
Loading

0 comments on commit a9dc4b0

Please sign in to comment.