Skip to content

Commit

Permalink
Updating the UI
Browse files Browse the repository at this point in the history
... for Main, Batch and Scheduler
  • Loading branch information
machiav3lli committed Mar 27, 2020
1 parent 6cc7a08 commit 53904a0
Show file tree
Hide file tree
Showing 31 changed files with 300 additions and 152 deletions.
Binary file added arm/release/oandbackupx-arm-release.apk
Binary file not shown.
20 changes: 20 additions & 0 deletions arm/release/output.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"version": 1,
"artifactType": {
"type": "APK",
"kind": "Directory"
},
"applicationId": "com.machiav3lli.backup",
"variantName": "armRelease",
"elements": [
{
"type": "SINGLE",
"filters": [],
"properties": [],
"versionCode": 1103,
"versionName": "1103",
"enabled": true,
"outputFile": "oandbackupx-arm-release.apk"
}
]
}
Binary file added arm64/release/oandbackupx-arm64-release.apk
Binary file not shown.
20 changes: 20 additions & 0 deletions arm64/release/output.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"version": 1,
"artifactType": {
"type": "APK",
"kind": "Directory"
},
"applicationId": "com.machiav3lli.backup",
"variantName": "arm64Release",
"elements": [
{
"type": "SINGLE",
"filters": [],
"properties": [],
"versionCode": 2103,
"versionName": "2103",
"enabled": true,
"outputFile": "oandbackupx-arm64-release.apk"
}
]
}
Binary file added assets/arm64-v8a/oab-utils
Binary file not shown.
Binary file added assets/armeabi-v7a/oab-utils
Binary file not shown.
Binary file added assets/x86/oab-utils
Binary file not shown.
Binary file added assets/x86_64/oab-utils
Binary file not shown.
28 changes: 20 additions & 8 deletions src/main/java/com/machiav3lli/backup/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,10 @@ public void onCreate(Bundle savedInstanceState) {
ButterKnife.bind(this);

checkForPermissions(savedInstanceState);
swipeRefreshLayout.setOnRefreshListener(() -> { refresh(); swipeRefreshLayout.setRefreshing(false);});
swipeRefreshLayout.setOnRefreshListener(() -> {
refresh();
swipeRefreshLayout.setRefreshing(false);
});

searchView.setQueryHint(getString(R.string.searchHint));
searchView.setOnQueryTextListener(new androidx.appcompat.widget.SearchView.OnQueryTextListener() {
Expand All @@ -136,12 +139,6 @@ public boolean onQueryTextSubmit(String query) {
bottomBar.replaceMenu(R.menu.main_bottom_bar);
bottomBar.setOnMenuItemClickListener(item -> {
switch (item.getItemId()) {
case R.id.backup:
startActivityForResult(batchIntent(BatchActivity.class, true), BATCH_REQUEST); break;
case R.id.restore:
startActivityForResult(batchIntent(BatchActivity.class, false), BATCH_REQUEST); break;
case R.id.scheduler:
startActivity(new Intent(getApplicationContext(), SchedulerActivity.class)); break;
// case R.id.preferences: startActivity(new Intent(getApplicationContext(), Preferences.class)); break;
case R.id.tools:
if (backupDir != null) {
Expand All @@ -154,7 +151,8 @@ public boolean onQueryTextSubmit(String query) {
case R.id.help:
startActivity(new Intent(getApplicationContext(), Help.class));
break;
default: break;
default:
break;
}
return true;
});
Expand All @@ -169,6 +167,20 @@ public void showFilterDialog() {
sheetSortFilter.show(getSupportFragmentManager(), "FILTER");
}

@OnClick(R.id.btn_batch_backup)
public void btnBatchBackup() {
startActivityForResult(batchIntent(BatchActivity.class, true), BATCH_REQUEST);
}

@OnClick(R.id.btn_batch_restore)
public void btnBatchRestore() {
startActivityForResult(batchIntent(BatchActivity.class, false), BATCH_REQUEST);
}

@OnClick(R.id.btn_scheduler)
public void btnScheduler() {
startActivity(new Intent(getApplicationContext(), SchedulerActivity.class));
}

@Override
public void onRequestPermissionsResult(int requestCode,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
case AppInfo.MODE_DATA:
holder.backupMode.setText(R.string.onlyDataBackedUp);
break;
case AppInfo.MODE_BOTH:
holder.backupMode.setText(R.string.bothBackedUp);
break;
default:
holder.backupMode.setText("");
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import android.widget.Toast;

import com.annimon.stream.Optional;
import com.google.android.material.bottomappbar.BottomAppBar;
import com.machiav3lli.backup.BaseActivity;
import com.machiav3lli.backup.BlacklistContract;
import com.machiav3lli.backup.BlacklistListener;
Expand All @@ -43,9 +44,11 @@
import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;


public class SchedulerActivity extends BaseActivity
implements View.OnClickListener, AdapterView.OnItemSelectedListener,
BlacklistListener {
Expand All @@ -63,8 +66,8 @@ public class SchedulerActivity extends BaseActivity

int totalSchedules;

// @BindView(R.id.toolBar)
// androidx.appcompat.widget.Toolbar toolBar;
@BindView(R.id.bottom_bar)
BottomAppBar bottomBar;

SharedPreferences defaultPrefs;

Expand All @@ -86,30 +89,34 @@ public void onCreate(Bundle savedInstanceState) {

// setSupportActionBar(toolBar);
// getSupportActionBar().setDisplayHomeAsUpEnabled(true);

bottomBar.replaceMenu(R.menu.scheduler_bottom_bar);
bottomBar.setOnMenuItemClickListener(item -> {
if (item.getItemId() == R.id.globalBlacklist) {
new Thread(() -> {
Bundle args = new Bundle();
args.putInt(Constants.BLACKLIST_ARGS_ID, GLOBALBLACKLISTID);
SQLiteDatabase db = blacklistsDBHelper.getReadableDatabase();
ArrayList<String> blacklistedPackages = blacklistsDBHelper
.getBlacklistedPackages(db, GLOBALBLACKLISTID);
args.putStringArrayList(Constants.BLACKLIST_ARGS_PACKAGES,
blacklistedPackages);
BlacklistDialogFragment blacklistDialogFragment = new BlacklistDialogFragment();
blacklistDialogFragment.setArguments(args);
blacklistDialogFragment.addBlacklistListener(this);
blacklistDialogFragment.show(getFragmentManager(), "blacklistDialog");
}).start();
}
return true;
});
}


@OnClick(R.id.addSchedule)
public void addSchedule() {
new AddScheduleTask(this).execute();
}

@OnClick(R.id.globalBlacklist)
public void getGlobalblacklist() {
new Thread(() -> {
Bundle args = new Bundle();
args.putInt(Constants.BLACKLIST_ARGS_ID, GLOBALBLACKLISTID);
SQLiteDatabase db = blacklistsDBHelper.getReadableDatabase();
ArrayList<String> blacklistedPackages = blacklistsDBHelper
.getBlacklistedPackages(db, GLOBALBLACKLISTID);
args.putStringArrayList(Constants.BLACKLIST_ARGS_PACKAGES,
blacklistedPackages);
BlacklistDialogFragment blacklistDialogFragment = new BlacklistDialogFragment();
blacklistDialogFragment.setArguments(args);
blacklistDialogFragment.addBlacklistListener(this);
blacklistDialogFragment.show(getFragmentManager(), "blacklistDialog");
}).start();
}


@Override
public void onResume() {
Expand Down
1 change: 1 addition & 0 deletions src/main/jniLibs/arm64-v8a/dummy.so
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
arm64-v8a
1 change: 1 addition & 0 deletions src/main/jniLibs/x86_64/dummy.so
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
x86_64
6 changes: 6 additions & 0 deletions src/main/res/drawable/schedules_divider.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<size
android:height="8dp"
android:width="0dp"/>
</shape>
112 changes: 52 additions & 60 deletions src/main/res/layout/activity_batch.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
android:layout_width="match_parent"
android:layout_height="match_parent">

<include layout="@layout/bar_search" />

Expand All @@ -19,86 +18,79 @@
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:listitem="@layout/item_batch_list" />

<FrameLayout
<com.google.android.material.bottomappbar.BottomAppBar
android:id="@+id/bottom_bar"
style="@style/mainBarView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:background="@color/tan_background">
android:backgroundTint="@color/tan_background"
app:fabAlignmentMode="end">

<LinearLayout
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">

<RadioGroup
android:id="@+id/radiogroup"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">

<RadioButton
android:id="@+id/radioApk"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/med_margin"
android:text="@string/radioApk" />

<LinearLayout
<RadioButton
android:id="@+id/radioData"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/med_margin"
android:text="@string/radioData" />

<RadioButton
android:id="@+id/radioBoth"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/radioBoth" />
</RadioGroup>

<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">

<CheckBox
android:id="@+id/cbAll"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.2"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginEnd="@dimen/med_margin"
android:singleLine="true"
android:text="all" />
android:text="@string/all" />

<RadioGroup
android:id="@+id/radiogroup"
<com.google.android.material.button.MaterialButton
android:id="@+id/backupRestoreButton"
style="@style/Widget.MaterialComponents.Button"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.7"
android:gravity="end"
android:orientation="horizontal">

<RadioButton
android:id="@+id/radioApk"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.2"
android:text="@string/radioApk" />

<RadioButton
android:id="@+id/radioData"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.2"
android:text="@string/radioData" />

<RadioButton
android:id="@+id/radioBoth"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.3"
android:text="@string/radioBoth" />
</RadioGroup>
</LinearLayout>


<com.google.android.material.button.MaterialButton
android:id="@+id/backupRestoreButton"
style="@style/filterChip"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="" />
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_gravity="center_horizontal"
android:text="" />
</androidx.appcompat.widget.LinearLayoutCompat>

</LinearLayout>
</androidx.appcompat.widget.LinearLayoutCompat>

</FrameLayout>
</com.google.android.material.bottomappbar.BottomAppBar>

<com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/sort_filter_fab"
style="@style/Widget.MaterialComponents.ExtendedFloatingActionButton.Icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end|bottom"
android:layout_marginRight="@dimen/large_margin"
android:layout_marginBottom="@dimen/batch_fab_height"
android:backgroundTint="@color/app_accent"
android:text="@string/sort"
android:textAppearance="@style/TextAppearance.Button"
app:icon="@drawable/ic_filter_white_48dp" />
android:elevation="12dp"
android:src="@drawable/ic_filter_white_48dp"
app:layout_anchor="@id/bottom_bar" />

</androidx.coordinatorlayout.widget.CoordinatorLayout>
Loading

0 comments on commit 53904a0

Please sign in to comment.